diff --git a/.dockerignore b/.dockerignore index 25ea26522f914..239d9da8813f0 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,17 +1,15 @@ -node_modules -**/node_modules -src/bun.js/WebKit/LayoutTests -zig-out -zig-build -**/*.o **/*.a - -examples - +**/*.o **/.next -.git -src/bun.js/WebKit **/CMakeCache.txt +**/node_modules +.git +examples +node_modules packages/**/bun packages/**/bun-profile +src/bun.js/WebKit +src/bun.js/WebKit/LayoutTests +zig-build zig-cache +zig-out \ No newline at end of file diff --git a/.github/workflows/bun-linux-aarch64.yml b/.github/workflows/bun-linux-aarch64.yml index 75704b2983fb3..b4bf297ffbf38 100644 --- a/.github/workflows/bun-linux-aarch64.yml +++ b/.github/workflows/bun-linux-aarch64.yml @@ -4,11 +4,6 @@ concurrency: group: bun-linux-aarch64-${{ github.ref }} cancel-in-progress: true -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - TEST_TAG: bun-test' - on: push: branches: @@ -38,10 +33,7 @@ jobs: arch: aarch64 build_arch: arm64 runner: linux-arm64 - webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-linux-arm64-lto.tar.gz" - webkit_basename: "bun-webkit-linux-arm64-lto" build_machine_arch: aarch64 - steps: - uses: actions/checkout@v3 with: @@ -73,9 +65,7 @@ jobs: BUILDARCH=${{matrix.build_arch}} BUILD_MACHINE_ARCH=${{matrix.build_machine_arch}} CPU_TARGET=${{matrix.cpu}} - WEBKIT_URL=${{matrix.webkit_url}} GIT_SHA=${{github.sha}} - WEBKIT_BASENAME=${{matrix.webkit_basename}} platforms: linux/${{matrix.build_arch}} target: artifact outputs: type=local,dest=${{runner.temp}}/release @@ -111,14 +101,6 @@ jobs: with: name: bun-${{matrix.tag}} path: ${{runner.temp}}/release/bun-${{matrix.tag}}.zip - - uses: actions/upload-artifact@v3 - with: - name: bun-obj-${{matrix.tag}} - path: ${{runner.temp}}/release/bun-obj - - uses: actions/upload-artifact@v3 - with: - name: ${{matrix.tag}}-dependencies - path: ${{runner.temp}}/release/bun-dependencies - name: Release id: release uses: ncipollo/release-action@v1 diff --git a/.github/workflows/bun-linux-build.yml b/.github/workflows/bun-linux-build.yml index 362aa605c0e75..c9556afb23997 100644 --- a/.github/workflows/bun-linux-build.yml +++ b/.github/workflows/bun-linux-build.yml @@ -4,11 +4,6 @@ concurrency: group: bun-linux-build-${{ github.ref }} cancel-in-progress: true -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - TEST_TAG: bun-test' - on: push: branches: @@ -49,16 +44,12 @@ jobs: arch: x86_64 build_arch: amd64 runner: big-ubuntu - webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-linux-amd64-lto.tar.gz" - webkit_basename: "bun-webkit-linux-amd64-lto" build_machine_arch: x86_64 - cpu: nehalem tag: linux-x64-baseline arch: x86_64 build_arch: amd64 runner: big-ubuntu - webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-linux-amd64-lto.tar.gz" - webkit_basename: "bun-webkit-linux-amd64-lto" build_machine_arch: x86_64 steps: @@ -92,9 +83,14 @@ jobs: BUILDARCH=${{matrix.build_arch}} BUILD_MACHINE_ARCH=${{matrix.build_machine_arch}} CPU_TARGET=${{matrix.cpu}} - WEBKIT_URL=${{matrix.webkit_url}} GIT_SHA=${{github.sha}} - WEBKIT_BASENAME=${{matrix.webkit_basename}} + + SCCACHE_BUCKET=bun + SCCACHE_REGION=auto + SCCACHE_S3_USE_SSL=true + SCCACHE_ENDPOINT=${{ secrets.CACHE_S3_ENDPOINT }} + AWS_ACCESS_KEY_ID=${{ secrets.CACHE_S3_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }} platforms: linux/${{matrix.build_arch}} target: artifact outputs: type=local,dest=${{runner.temp}}/release diff --git a/.github/workflows/bun-mac-aarch64.yml b/.github/workflows/bun-mac-aarch64.yml index b6eec21d8a473..0c412d29f2d2f 100644 --- a/.github/workflows/bun-mac-aarch64.yml +++ b/.github/workflows/bun-mac-aarch64.yml @@ -5,9 +5,7 @@ concurrency: cancel-in-progress: true env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - TEST_TAG: bun-test' + LLVM_VERSION: 16 on: push: @@ -32,79 +30,134 @@ on: workflow_dispatch: jobs: - macos-object-files: - name: macOS Object + macOS-zig: + name: macOS Zig Object runs-on: med-ubuntu if: github.repository_owner == 'oven-sh' strategy: matrix: include: - # - cpu: nehalem - # arch: x86_64 - # tag: bun-obj-darwin-x64-baseline - # - cpu: haswell - # arch: x86_64 - # tag: bun-obj-darwin-x64 - cpu: native arch: aarch64 tag: bun-obj-darwin-aarch64 steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - uses: docker/setup-buildx-action@v2 + - uses: actions/checkout@v4 + # - name: Checkout submodules + # run: git submodule update --init --recursive --depth=1 --progress --force + + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v2 id: buildx with: install: true - - name: Run - run: | - rm -rf ${{runner.temp}}/release + - name: Login to GitHub Container Registry uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push + + - name: Compile Zig Object uses: docker/build-push-action@v3 if: runner.arch == 'X64' with: context: . push: false - cache-from: type=gha - cache-to: type=gha,mode=min - build-args: | - ARCH=${{ matrix.arch }} - BUILDARCH=amd64 - BUILD_MACHINE_ARCH=x86_64 - CPU_TARGET=${{ matrix.cpu }} - TRIPLET=${{matrix.arch}}-macos-none - GIT_SHA=${{github.sha}} - platforms: linux/amd64 - target: build_release_obj - outputs: type=local,dest=${{runner.temp}}/release - - name: Build and push - uses: docker/build-push-action@v3 - if: runner.arch == 'ARM64' - with: - context: . - push: false - cache-from: type=gha - cache-to: type=gha,mode=min + # This doesnt seem to work + # cache-from: type=s3,endpoint_url=${{ secrets.CACHE_S3_ENDPOINT }},blobs_prefix=docker_blobs/,manifests_prefix=docker_manifests/,access_key_id=${{ secrets.CACHE_S3_ACCESS_KEY_ID }},secret_access_key=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }},bucket=bun,region=auto + # cache-to: type=s3,endpoint_url=${{ secrets.CACHE_S3_ENDPOINT }},blobs_prefix=docker_blobs/,manifests_prefix=docker_manifests/,access_key_id=${{ secrets.CACHE_S3_ACCESS_KEY_ID }},secret_access_key=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }},bucket=bun,region=auto build-args: | + BUILDARCH=${{ runner.arch == 'X64' && 'amd64' || 'arm64' }} + BUILD_MACHINE_ARCH=${{ runner.arch == 'X64' && 'x86_64' || 'aarch64' }} ARCH=${{ matrix.arch }} - BUILDARCH=arm64 - BUILD_MACHINE_ARCH=aarch64 CPU_TARGET=${{ matrix.cpu }} - TRIPLET=${{matrix.arch}}-macos-none - GIT_SHA=${{github.sha}} - platforms: linux/arm64 + TRIPLET=${{ matrix.arch }}-macos-none + GIT_SHA=${{ github.sha }} + platforms: linux/${{ runner.arch == 'X64' && 'amd64' || 'arm64' }} target: build_release_obj outputs: type=local,dest=${{runner.temp}}/release - - uses: actions/upload-artifact@v3 + + - name: Upload Zig Object + uses: actions/upload-artifact@v3 with: name: ${{ matrix.tag }} - path: ${{runner.temp}}/release/bun.o + path: ${{runner.temp}}/release/bun-zig.o + + macOS-dependencies: + name: macOS Dependencies + runs-on: ${{ matrix.runner }} + if: github.repository_owner == 'oven-sh' + timeout-minutes: 15 + strategy: + matrix: + include: + - cpu: native + arch: aarch64 + tag: bun-darwin-aarch64 + obj: bun-obj-darwin-aarch64 + artifact: bun-obj-darwin-aarch64 + runner: macos-arm64 + steps: + - uses: actions/checkout@v4 + - name: Checkout submodules + run: git submodule update --init --recursive --depth=1 --progress --force + + - name: Install system dependencies + env: + HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 + HOMEBREW_NO_AUTO_UPDATE: 1 + HOMEBREW_NO_INSTALL_CLEANUP: 1 + run: | + brew install sccache ccache rust llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config --force + echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH + echo "$(brew --prefix sccache)/bin" >> $GITHUB_PATH + echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH + echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH + brew link --overwrite llvm@$LLVM_VERSION + + - name: Hash submodule versions + run: | + print_data() { + git submodule | grep -v WebKit + llvm-config --version + rustc --version + cat $(echo scripts/build*.sh scripts/all-dependencies.sh | tr " " "\n" | sort) + } + echo "sha=$(print_data | sha1sum | cut -c 1-10)" >> $GITHUB_OUTPUT + id: submodule-versions + + - name: Cache submodule dependencies + id: cache-deps-restore + uses: actions/cache/restore@v3 + with: + path: ${{runner.temp}}/bun-deps + key: bun-deps-${{ matrix.tag }}-${{ steps.submodule-versions.outputs.sha }} + + - name: Compile submodule dependencies + if: ${{ !steps.cache-deps-restore.outputs.cache-hit }} + env: + CPU_TARGET: ${{ matrix.cpu }} + BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps + run: | + mkdir -p $BUN_DEPS_OUT_DIR + bash ./scripts/clean-dependencies.sh + bash ./scripts/all-dependencies.sh + + - name: Cache submodule dependencies + if: ${{ !steps.cache-deps-restore.outputs.cache-hit }} + id: cache-deps-save + uses: actions/cache/save@v3 + with: + path: ${{runner.temp}}/bun-deps + key: ${{ steps.cache-deps-restore.outputs.cache-primary-key }} + + - name: Upload submodule dependencies + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.tag }}-deps + path: ${{runner.temp}}/bun-deps + macOS-cpp: name: macOS C++ runs-on: ${{ matrix.runner }} @@ -113,257 +166,149 @@ jobs: strategy: matrix: include: - # - cpu: nehalem - # arch: x86_64 - # tag: bun-darwin-x64-baseline - # obj: bun-obj-darwin-x64-baseline - # runner: macos-12 - # artifact: bun-obj-darwin-x64-baseline - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-macos-amd64-lto.tar.gz" - # dependencies: true - # compile_obj: false - # - cpu: haswell - # arch: x86_64 - # tag: bun-darwin-x64 - # obj: bun-obj-darwin-x64 - # runner: macos-12 - # artifact: bun-obj-darwin-x64 - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-macos-amd64-lto.tar.gz" - # dependencies: true - # compile_obj: false - # - cpu: nehalem - # arch: x86_64 - # tag: bun-darwin-x64-baseline - # obj: bun-obj-darwin-x64-baseline - # runner: macos-12 - # artifact: bun-obj-darwin-x64-baseline - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-macos-amd64-lto.tar.gz" - # dependencies: false - # compile_obj: true - # - cpu: haswell - # arch: x86_64 - # tag: bun-darwin-x64 - # obj: bun-obj-darwin-x64 - # runner: macos-12 - # artifact: bun-obj-darwin-x64 - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-macos-amd64-lto.tar.gz" - # dependencies: false - # compile_obj: true - cpu: native arch: aarch64 tag: bun-darwin-aarch64 obj: bun-obj-darwin-aarch64 artifact: bun-obj-darwin-aarch64 - webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-macos-arm64-lto.tar.gz" runner: macos-arm64 - dependencies: true - compile_obj: true steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Checkout submodules - run: git submodule update --init --recursive --depth=1 --progress -j $(sysctl -n hw.ncpu) --force - - name: Install dependencies + run: git submodule update --init --recursive --depth=1 --progress --force + + - name: Install system dependencies env: - CPU_TARGET: ${{ matrix.cpu }} - JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit - JSC_LIB: ${{ runner.temp }}/bun-webkit/lib HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 HOMEBREW_NO_AUTO_UPDATE: 1 HOMEBREW_NO_INSTALL_CLEANUP: 1 - BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun - OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj - BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps run: | - brew install ccache rust llvm@16 pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config esbuild --force + brew install sccache ccache rust llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config --force + echo "$(brew --prefix sccache)/bin" >> $GITHUB_PATH echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH - echo "$(brew --prefix llvm@16)/bin" >> $GITHUB_PATH - brew link --overwrite llvm@16 + echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH + brew link --overwrite llvm@$LLVM_VERSION + + # TODO: replace with sccache - name: ccache uses: hendrikmuhs/ccache-action@v1.2 with: key: ${{ runner.os }}-ccache-${{ matrix.tag }} restore-keys: ${{ runner.os }}-ccache-${{ matrix.tag }} - - name: Download WebKit - if: matrix.compile_obj - env: - CPU_TARGET: ${{ matrix.cpu }} - JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit - JSC_LIB: ${{ runner.temp }}/bun-webkit/lib - BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun - OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj - BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps - BUN_RELEASE_DIR: ${{ runner.temp }}/release - WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit - WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit - run: | - rm -rf $JSC_BASE_DIR - mkdir -p $JSC_BASE_DIR - curl -L ${{ matrix.webkit_url }} | tar -xz -C $JSC_BASE_DIR --strip-components=1 - - name: Compile dependencies - if: matrix.dependencies - env: - CPU_TARGET: ${{ matrix.cpu }} - JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit - JSC_LIB: ${{ runner.temp }}/bun-webkit/lib - BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun - OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj - BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps - BUN_RELEASE_DIR: ${{ runner.temp }}/release - WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit - WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit - run: | - mkdir -p $BUN_DEPS_OUT_DIR - make vendor-without-check + - name: Compile C++ - if: matrix.compile_obj env: CPU_TARGET: ${{ matrix.cpu }} - JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit - JSC_LIB: ${{ runner.temp }}/bun-webkit/lib - BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun + SOURCE_DIR: ${{ github.workspace }} OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps - BUN_RELEASE_DIR: ${{ runner.temp }}/release - WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit - WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit run: | - mkdir -p $OBJ_DIR $BUN_DEPS_OUT_DIR - make clean-bindings - make -j $(sysctl -n hw.ncpu) release-bindings + mkdir -p $OBJ_DIR + cd $OBJ_DIR + + cmake -S $SOURCE_DIR -B $OBJ_DIR \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUN_CPP_ONLY=1 + + bash compile-cpp-only.sh + - name: Upload C++ - if: matrix.compile_obj uses: actions/upload-artifact@v3 with: name: ${{ matrix.tag }}-cpp - path: ${{ runner.temp }}/bun-cpp-obj - - name: Upload Dependencies - if: matrix.dependencies - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.tag }}-deps - path: ${{runner.temp}}/bun-deps - macOS: + path: ${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a + macOS-link: name: macOS Link runs-on: ${{ matrix.runner }} if: github.repository_owner == 'oven-sh' - needs: [macOS-cpp, macos-object-files] - timeout-minutes: 90 + needs: [macOS-zig, macOS-cpp, macOS-dependencies] + timeout-minutes: 60 permissions: write-all strategy: matrix: include: - # - cpu: nehalem - # arch: x86_64 - # tag: bun-darwin-x64-baseline - # obj: bun-obj-darwin-x64-baseline - # package: bun-darwin-x64 - # runner: macos-12 - # artifact: bun-obj-darwin-x64-baseline - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-macos-amd64-lto.tar.gz" - # - cpu: haswell - # arch: x86_64 - # tag: bun-darwin-x64 - # obj: bun-obj-darwin-x64 - # package: bun-darwin-x64 - # runner: macos-12 - # artifact: bun-obj-darwin-x64 - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-macos-amd64-lto.tar.gz" - cpu: native arch: aarch64 tag: bun-darwin-aarch64 obj: bun-obj-darwin-aarch64 package: bun-darwin-aarch64 artifact: bun-obj-darwin-aarch64 - webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-macos-arm64-lto.tar.gz" runner: macos-arm64 steps: - uses: actions/checkout@v3 - name: Checkout submodules - run: git submodule update --init --recursive --depth=1 --progress -j $(sysctl -n hw.ncpu) --force - - name: Install dependencies + run: git submodule update --init --recursive --depth=1 --progress --force + + - name: Install system dependencies env: - CPU_TARGET: ${{ matrix.cpu }} - JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit - JSC_LIB: ${{ runner.temp }}/bun-webkit/lib HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 HOMEBREW_NO_AUTO_UPDATE: 1 HOMEBREW_NO_INSTALL_CLEANUP: 1 - BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun - OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj - BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps run: | - brew install rust ccache llvm@16 pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config esbuild --force + brew install ccache llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv openssl@1.1 ninja --force + echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH - echo "$(brew --prefix llvm@16)/bin" >> $GITHUB_PATH - brew link --overwrite llvm@16 - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ runner.os }}-ccache-${{ matrix.tag }}-link - restore-keys: ${{ runner.os }}-ccache-${{ matrix.tag }}-link - - name: Download WebKit - env: - CPU_TARGET: ${{ matrix.cpu }} - JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit - JSC_LIB: ${{ runner.temp }}/bun-webkit/lib - BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun - OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj - BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps - run: | - rm -rf $JSC_BASE_DIR - mkdir -p $JSC_BASE_DIR - curl -L ${{ matrix.webkit_url }} | tar -xz -C $JSC_BASE_DIR --strip-components=1 + echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH + brew link --overwrite llvm@$LLVM_VERSION + + curl -LO "https://github.com/oven-sh/bun/releases/download/bun-v1.0.7/bun-darwin-${{matrix.arch}}.zip" + unzip bun-darwin-${{matrix.arch}}.zip + mkdir -p ${{ runner.temp }}/.bun/bin + mv bun-darwin-${{matrix.arch}}/bun ${{ runner.temp }}/.bun/bin/bun + chmod +x ${{ runner.temp }}/.bun/bin/bun + echo "${{ runner.temp }}/.bun/bin" >> $GITHUB_PATH + - name: Download C++ uses: actions/download-artifact@v3 with: name: ${{ matrix.tag }}-cpp path: ${{ runner.temp }}/bun-cpp-obj - - name: Download Dependencies - uses: actions/download-artifact@v3 - with: - name: ${{ matrix.tag }}-deps - path: ${{ runner.temp }}/bun-deps - - name: Download Object + + - name: Download Zig Object uses: actions/download-artifact@v3 with: name: ${{ matrix.obj }} path: ${{ runner.temp }}/release + + - name: Hash submodule versions + run: | + print_data() { + git submodule | grep -v WebKit + llvm-config --version + rustc --version + } + echo "sha=$(print_data | sha1sum | cut -c 1-10)" >> $GITHUB_OUTPUT + id: submodule-versions + + - name: Downloaded submodule dependencies + uses: actions/download-artifact@v3 + with: + name: ${{ matrix.tag }}-deps + path: ${{runner.temp}}/bun-deps + - name: Link env: CPU_TARGET: ${{ matrix.cpu }} - JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit - JSC_LIB: ${{ runner.temp }}/bun-webkit/lib - BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun - OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj - BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps - BUN_RELEASE_DIR: ${{ runner.temp }}/release - WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit - WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit run: | - rm -rf packages/${{ matrix.package }} - mkdir -p packages/${{ matrix.package }} - mv ${{ runner.temp }}/release/* packages/${{ matrix.package }}/ - make bun-link-lld-release copy-to-bun-release-dir-bin + SRC_DIR=$PWD + mkdir ${{runner.temp}}/link-build + cd ${{runner.temp}}/link-build + cmake $SRC_DIR \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUN_LINK_ONLY=1 \ + -DBUN_ZIG_OBJ="${{ runner.temp }}/release/bun-zig.o" \ + -DBUN_CPP_ARCHIVE="${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a" \ + -DBUN_DEPS_OUT_DIR="${{runner.temp}}/bun-deps" + ninja - name: Zip - env: - CPU_TARGET: ${{ matrix.cpu }} - JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit - JSC_LIB: ${{ runner.temp }}/bun-webkit/lib - BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun - OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj - BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps - BUN_RELEASE_DIR: ${{ runner.temp }}/release - WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit - WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit run: | - cd ${{runner.temp}}/release + cd ${{runner.temp}}/link-build chmod +x bun-profile bun - mkdir ${{matrix.tag}}-profile - mkdir ${{matrix.tag}} - - /usr/bin/strip -S bun + mkdir -p ${{matrix.tag}}-profile/ ${{matrix.tag}}/ mv bun-profile ${{matrix.tag}}-profile/bun-profile mv bun ${{matrix.tag}}/bun @@ -373,11 +318,11 @@ jobs: - uses: actions/upload-artifact@v3 with: name: ${{matrix.tag}}-profile - path: ${{runner.temp}}/release/${{matrix.tag}}-profile.zip + path: ${{runner.temp}}/link-build/${{matrix.tag}}-profile.zip - uses: actions/upload-artifact@v3 with: name: ${{matrix.tag}} - path: ${{runner.temp}}/release/${{matrix.tag}}.zip + path: ${{runner.temp}}/link-build/${{matrix.tag}}.zip - name: Release id: release uses: ncipollo/release-action@v1 @@ -394,7 +339,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} name: "Canary (${{github.sha}})" tag: "canary" - artifacts: "${{runner.temp}}/release/${{matrix.tag}}.zip,${{runner.temp}}/release/${{matrix.tag}}-profile.zip" + artifacts: "${{runner.temp}}/link-build/${{matrix.tag}}.zip,${{runner.temp}}/link-build/${{matrix.tag}}-profile.zip" - uses: sarisia/actions-status-discord@v1 if: failure() && github.repository_owner == 'oven-sh' && github.event_name == 'pull_request' with: @@ -417,8 +362,8 @@ jobs: macOS-test: name: Tests ${{matrix.tag}} runs-on: ${{ matrix.runner }} - needs: [macOS] - if: github.event_name == 'pull_request' && github.repository_owner == 'oven-sh' + needs: [macOS-link] + # if: github.event_name == 'pull_request' && github.repository_owner == 'oven-sh' permissions: pull-requests: write timeout-minutes: 30 diff --git a/.github/workflows/bun-mac-x64-baseline.yml b/.github/workflows/bun-mac-x64-baseline.yml index f7e6ca6d38b61..1ce57464f772d 100644 --- a/.github/workflows/bun-mac-x64-baseline.yml +++ b/.github/workflows/bun-mac-x64-baseline.yml @@ -5,9 +5,7 @@ concurrency: cancel-in-progress: true env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - TEST_TAG: bun-test' + LLVM_VERSION: 16 on: push: @@ -49,67 +47,60 @@ jobs: # arch: aarch64 # tag: bun-obj-darwin-aarch64 steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - uses: docker/setup-buildx-action@v2 + - uses: actions/checkout@v4 + + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v2 id: buildx with: install: true - - name: Run - run: | - rm -rf ${{runner.temp}}/release + - name: Login to GitHub Container Registry uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v3 - if: runner.arch == 'X64' - with: - context: . - push: false - cache-from: type=gha - cache-to: type=gha,mode=min - build-args: | - ARCH=${{ matrix.arch }} - BUILDARCH=amd64 - BUILD_MACHINE_ARCH=x86_64 - CPU_TARGET=${{ matrix.cpu }} - TRIPLET=${{matrix.arch}}-macos-none - GIT_SHA=${{github.sha}} - platforms: linux/amd64 - target: build_release_obj - outputs: type=local,dest=${{runner.temp}}/release - - name: Build and push + + - name: Compile Zig Object uses: docker/build-push-action@v3 - if: runner.arch == 'ARM64' with: context: . push: false - cache-from: type=gha - cache-to: type=gha,mode=min + # This doesnt seem to work + # cache-from: type=s3,endpoint_url=${{ secrets.CACHE_S3_ENDPOINT }},blobs_prefix=docker_blobs/,manifests_prefix=docker_manifests/,access_key_id=${{ secrets.CACHE_S3_ACCESS_KEY_ID }},secret_access_key=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }},bucket=bun,region=auto + # cache-to: type=s3,endpoint_url=${{ secrets.CACHE_S3_ENDPOINT }},blobs_prefix=docker_blobs/,manifests_prefix=docker_manifests/,access_key_id=${{ secrets.CACHE_S3_ACCESS_KEY_ID }},secret_access_key=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }},bucket=bun,region=auto + # This was used before, but also does not really work + cache-from: type=local,src=/tmp/.buildx-cache-${{matrix.tag}} + cache-to: type=local,dest=/tmp/.buildx-cache-${{matrix.tag}} build-args: | + BUILDARCH=${{ runner.arch == 'X64' && 'amd64' || 'arm64' }} + BUILD_MACHINE_ARCH=${{ runner.arch == 'X64' && 'x86_64' || 'aarch64' }} ARCH=${{ matrix.arch }} - BUILDARCH=arm64 - BUILD_MACHINE_ARCH=aarch64 CPU_TARGET=${{ matrix.cpu }} - TRIPLET=${{matrix.arch}}-macos-none - GIT_SHA=${{github.sha}} - platforms: linux/arm64 + TRIPLET=${{ matrix.arch }}-macos-none + GIT_SHA=${{ github.sha }} + + SCCACHE_BUCKET=bun + SCCACHE_REGION=auto + SCCACHE_S3_USE_SSL=true + SCCACHE_ENDPOINT=${{ secrets.CACHE_S3_ENDPOINT }} + AWS_ACCESS_KEY_ID=${{ secrets.CACHE_S3_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }} + platforms: linux/${{ runner.arch == 'X64' && 'amd64' || 'arm64' }} target: build_release_obj outputs: type=local,dest=${{runner.temp}}/release - - uses: actions/upload-artifact@v3 + + - name: Upload Zig Object + uses: actions/upload-artifact@v3 with: name: ${{ matrix.tag }} - path: ${{runner.temp}}/release/bun.o - macOS-cpp: - name: macOS C++ + path: ${{runner.temp}}/release/bun-zig.o + macOS-dependencies: + name: macOS Dependencies runs-on: ${{ matrix.runner }} if: github.repository_owner == 'oven-sh' - timeout-minutes: 90 + timeout-minutes: 15 strategy: matrix: include: @@ -119,136 +110,139 @@ jobs: obj: bun-obj-darwin-x64-baseline runner: macos-12 artifact: bun-obj-darwin-x64-baseline - webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-macos-amd64-lto.tar.gz" - dependencies: true - compile_obj: false - # - cpu: haswell - # arch: x86_64 - # tag: bun-darwin-x64 - # obj: bun-obj-darwin-x64 - # runner: macos-12 - # artifact: bun-obj-darwin-x64 - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-macos-amd64-lto.tar.gz" - # dependencies: true - # compile_obj: false + steps: + - uses: actions/checkout@v4 + - name: Checkout submodules + run: git submodule update --init --recursive --depth=1 --progress --force + + - name: Install system dependencies + env: + HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 + HOMEBREW_NO_AUTO_UPDATE: 1 + HOMEBREW_NO_INSTALL_CLEANUP: 1 + run: | + brew install sccache ccache rust llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config --force + echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH + echo "$(brew --prefix sccache)/bin" >> $GITHUB_PATH + echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH + echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH + brew link --overwrite llvm@$LLVM_VERSION + + - name: Hash submodule versions + run: | + print_data() { + git submodule | grep -v WebKit + llvm-config --version + rustc --version + cat $(echo scripts/build*.sh scripts/all-dependencies.sh | tr " " "\n" | sort) + } + echo "sha=$(print_data | sha1sum | cut -c 1-10)" >> $GITHUB_OUTPUT + id: submodule-versions + + - name: Cache submodule dependencies + id: cache-deps-restore + uses: actions/cache/restore@v3 + with: + path: ${{runner.temp}}/bun-deps + key: bun-deps-${{ matrix.tag }}-${{ steps.submodule-versions.outputs.sha }} + + - name: Compile submodule dependencies + if: ${{ !steps.cache-deps-restore.outputs.cache-hit }} + env: + CPU_TARGET: ${{ matrix.cpu }} + BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps + run: | + mkdir -p $BUN_DEPS_OUT_DIR + bash ./scripts/clean-dependencies.sh + bash ./scripts/all-dependencies.sh + + - name: Cache submodule dependencies + if: ${{ !steps.cache-deps-restore.outputs.cache-hit }} + id: cache-deps-save + uses: actions/cache/save@v3 + with: + path: ${{runner.temp}}/bun-deps + key: ${{ steps.cache-deps-restore.outputs.cache-primary-key }} + + - name: Upload submodule dependencies + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.tag }}-deps + path: ${{runner.temp}}/bun-deps + + macOS-cpp: + name: macOS C++ + runs-on: ${{ matrix.runner }} + if: github.repository_owner == 'oven-sh' + timeout-minutes: 90 + strategy: + matrix: + include: - cpu: nehalem arch: x86_64 tag: bun-darwin-x64-baseline obj: bun-obj-darwin-x64-baseline runner: macos-12 artifact: bun-obj-darwin-x64-baseline - webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-macos-amd64-lto.tar.gz" - dependencies: false - compile_obj: true - # - cpu: haswell - # arch: x86_64 - # tag: bun-darwin-x64 - # obj: bun-obj-darwin-x64 - # runner: macos-12 - # artifact: bun-obj-darwin-x64 - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-macos-amd64-lto.tar.gz" - # dependencies: false - # compile_obj: true - # - cpu: native - # arch: aarch64 - # tag: bun-darwin-aarch64 - # obj: bun-obj-darwin-aarch64 - # artifact: bun-obj-darwin-aarch64 - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-macos-amd64-lto.tar.gz" - # runner: macos-arm64 - # dependencies: true - # compile_obj: true steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Checkout submodules - run: git submodule update --init --recursive --depth=1 --progress -j $(sysctl -n hw.ncpu) --force - - name: Install dependencies + run: git submodule update --init --recursive --depth=1 --progress --force + + - name: Install system dependencies env: - CPU_TARGET: ${{ matrix.cpu }} - JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit - JSC_LIB: ${{ runner.temp }}/bun-webkit/lib HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 HOMEBREW_NO_AUTO_UPDATE: 1 HOMEBREW_NO_INSTALL_CLEANUP: 1 - BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun - OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj - BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps run: | - brew install ccache rust llvm@16 pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config esbuild --force + brew install sccache ccache rust llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config --force + echo "$(brew --prefix sccache)/bin" >> $GITHUB_PATH echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH - echo "$(brew --prefix llvm@16)/bin" >> $GITHUB_PATH - brew link --overwrite llvm@16 - - name: ccache (dependencies) - uses: hendrikmuhs/ccache-action@v1.2 - if: matrix.dependencies - with: - key: ${{ runner.os }}-ccache-${{ matrix.tag }}-dependencies - restore-keys: ${{ runner.os }}-ccache-${{ matrix.tag }}-dependencies - - name: ccache (c++) + echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH + brew link --overwrite llvm@$LLVM_VERSION + + curl -LO "https://github.com/oven-sh/bun/releases/download/bun-v1.0.7/bun-darwin-x64.zip" + unzip bun-darwin-x64.zip + mkdir -p ${{ runner.temp }}/.bun/bin + mv bun-darwin-x64/bun ${{ runner.temp }}/.bun/bin/bun + chmod +x ${{ runner.temp }}/.bun/bin/bun + echo "${{ runner.temp }}/.bun/bin" >> $GITHUB_PATH + + # TODO: replace with sccache + - name: ccache uses: hendrikmuhs/ccache-action@v1.2 - if: matrix.compile_obj with: - key: ${{ runner.os }}-ccache-${{ matrix.tag }}-obj - restore-keys: ${{ runner.os }}-ccache-${{ matrix.tag }}-obj - - name: Download WebKit - if: matrix.compile_obj - env: - CPU_TARGET: ${{ matrix.cpu }} - JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit - JSC_LIB: ${{ runner.temp }}/bun-webkit/lib - BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun - OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj - BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps - run: | - rm -rf $JSC_BASE_DIR - mkdir -p $JSC_BASE_DIR - curl -L ${{ matrix.webkit_url }} | tar -xz -C $JSC_BASE_DIR --strip-components=1 - - name: Compile dependencies - if: matrix.dependencies - env: - CPU_TARGET: ${{ matrix.cpu }} - JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit - JSC_LIB: ${{ runner.temp }}/bun-webkit/lib - BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun - OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj - BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps - WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit - WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit - run: | - mkdir -p $OBJ_DIR $BUN_DEPS_OUT_DIR - make vendor-without-check + key: ${{ runner.os }}-ccache-${{ matrix.tag }} + restore-keys: ${{ runner.os }}-ccache-${{ matrix.tag }} + - name: Compile C++ - if: matrix.compile_obj env: CPU_TARGET: ${{ matrix.cpu }} - JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit - JSC_LIB: ${{ runner.temp }}/bun-webkit/lib - BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun + SOURCE_DIR: ${{ github.workspace }} OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps - WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit - WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit run: | - mkdir -p $OBJ_DIR $BUN_DEPS_OUT_DIR - make -j $(sysctl -n hw.ncpu) release-bindings + mkdir -p $OBJ_DIR + cd $OBJ_DIR + + cmake -S $SOURCE_DIR -B $OBJ_DIR \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUN_CPP_ONLY=1 + + bash compile-cpp-only.sh + - name: Upload C++ - if: matrix.compile_obj uses: actions/upload-artifact@v3 with: name: ${{ matrix.tag }}-cpp - path: ${{ runner.temp }}/bun-cpp-obj - - name: Upload Dependencies - if: matrix.dependencies - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.tag }}-deps - path: ${{runner.temp}}/bun-deps + path: ${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a macOS: name: macOS Link runs-on: ${{ matrix.runner }} if: github.repository_owner == 'oven-sh' - needs: [macOS-cpp, macos-object-files] + needs: [macOS-cpp, macos-object-files, macOS-dependencies] timeout-minutes: 90 permissions: write-all strategy: @@ -261,113 +255,69 @@ jobs: package: bun-darwin-x64 runner: macos-12 artifact: bun-obj-darwin-x64-baseline - webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-macos-amd64-lto.tar.gz" - # - cpu: haswell - # arch: x86_64 - # tag: bun-darwin-x64 - # obj: bun-obj-darwin-x64 - # package: bun-darwin-x64 - # runner: macos-12 - # artifact: bun-obj-darwin-x64 - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-macos-amd64-lto.tar.gz" - # - cpu: native - # arch: aarch64 - # tag: bun-darwin-aarch64 - # obj: bun-obj-darwin-aarch64 - # package: bun-darwin-aarch64 - # artifact: bun-obj-darwin-aarch64 - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-macos-amd64-lto.tar.gz" - # runner: macos-arm64 steps: - uses: actions/checkout@v3 - name: Checkout submodules - run: git submodule update --init --recursive --depth=1 --progress -j $(sysctl -n hw.ncpu) --force - - name: Install dependencies + run: git submodule update --init --recursive --depth=1 --progress --force + + - name: Install system dependencies env: - CPU_TARGET: ${{ matrix.cpu }} - JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit - JSC_LIB: ${{ runner.temp }}/bun-webkit/lib HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 HOMEBREW_NO_AUTO_UPDATE: 1 HOMEBREW_NO_INSTALL_CLEANUP: 1 - BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun - OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj - BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps run: | - brew install ccache rust llvm@16 pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config esbuild --force + brew install ccache llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv openssl@1.1 ninja --force + echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH - echo "$(brew --prefix llvm@16)/bin" >> $GITHUB_PATH - brew link --overwrite llvm@16 - - name: ccache (link) - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ runner.os }}-ccache-${{ matrix.tag }}-link - restore-keys: ${{ runner.os }}-ccache-${{ matrix.tag }}-link - - name: Download WebKit - env: - CPU_TARGET: ${{ matrix.cpu }} - JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit - JSC_LIB: ${{ runner.temp }}/bun-webkit/lib - BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun - OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj - BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps - BUN_RELEASE_DIR: ${{ runner.temp }}/release - WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit - WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit - run: | - rm -rf $JSC_BASE_DIR - mkdir -p $JSC_BASE_DIR - curl -L ${{ matrix.webkit_url }} | tar -xz -C $JSC_BASE_DIR --strip-components=1 + echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH + brew link --overwrite llvm@$LLVM_VERSION + + curl -LO "https://github.com/oven-sh/bun/releases/download/bun-v1.0.7/bun-darwin-x64.zip" + unzip bun-darwin-x64.zip + mkdir -p ${{ runner.temp }}/.bun/bin + mv bun-darwin-x64/bun ${{ runner.temp }}/.bun/bin/bun + chmod +x ${{ runner.temp }}/.bun/bin/bun + echo "${{ runner.temp }}/.bun/bin" >> $GITHUB_PATH + - name: Download C++ uses: actions/download-artifact@v3 with: name: ${{ matrix.tag }}-cpp path: ${{ runner.temp }}/bun-cpp-obj - - name: Download Dependencies - uses: actions/download-artifact@v3 - with: - name: ${{ matrix.tag }}-deps - path: ${{ runner.temp }}/bun-deps - - name: Download Object + + - name: Download Zig Object uses: actions/download-artifact@v3 with: name: ${{ matrix.obj }} path: ${{ runner.temp }}/release + + - name: Downloaded submodule dependencies + uses: actions/download-artifact@v3 + with: + name: ${{ matrix.tag }}-deps + path: ${{runner.temp}}/bun-deps + - name: Link env: CPU_TARGET: ${{ matrix.cpu }} - JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit - JSC_LIB: ${{ runner.temp }}/bun-webkit/lib - BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun - OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj - BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps - BUN_RELEASE_DIR: ${{ runner.temp }}/release - WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit - WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit run: | - rm -rf packages/${{ matrix.package }} - mkdir -p packages/${{ matrix.package }} - mv ${{ runner.temp }}/release/* packages/${{ matrix.package }}/ - make bun-link-lld-release copy-to-bun-release-dir-bin + SRC_DIR=$PWD + mkdir ${{runner.temp}}/link-build + cd ${{runner.temp}}/link-build + cmake $SRC_DIR \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUN_LINK_ONLY=1 \ + -DBUN_ZIG_OBJ="${{ runner.temp }}/release/bun-zig.o" \ + -DBUN_CPP_ARCHIVE="${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a" \ + -DBUN_DEPS_OUT_DIR="${{runner.temp}}/bun-deps" + ninja - name: Zip - env: - CPU_TARGET: ${{ matrix.cpu }} - JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit - JSC_LIB: ${{ runner.temp }}/bun-webkit/lib - BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun - OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj - BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps - BUN_RELEASE_DIR: ${{ runner.temp }}/release - WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit - WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit run: | - cd ${{runner.temp}}/release + cd ${{runner.temp}}/link-build chmod +x bun-profile bun - mkdir ${{matrix.tag}}-profile - mkdir ${{matrix.tag}} - - /usr/bin/strip -S bun + mkdir -p ${{matrix.tag}}-profile/ ${{matrix.tag}}/ mv bun-profile ${{matrix.tag}}-profile/bun-profile mv bun ${{matrix.tag}}/bun @@ -377,11 +327,11 @@ jobs: - uses: actions/upload-artifact@v3 with: name: ${{matrix.tag}}-profile - path: ${{runner.temp}}/release/${{matrix.tag}}-profile.zip + path: ${{runner.temp}}/link-build/${{matrix.tag}}-profile.zip - uses: actions/upload-artifact@v3 with: name: ${{matrix.tag}} - path: ${{runner.temp}}/release/${{matrix.tag}}.zip + path: ${{runner.temp}}/link-build/${{matrix.tag}}.zip - name: Release id: release uses: ncipollo/release-action@v1 @@ -398,7 +348,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} name: "Canary (${{github.sha}})" tag: "canary" - artifacts: "${{runner.temp}}/release/${{matrix.tag}}.zip,${{runner.temp}}/release/${{matrix.tag}}-profile.zip" + artifacts: "${{runner.temp}}/link-build/${{matrix.tag}}.zip,${{runner.temp}}/link-build/${{matrix.tag}}-profile.zip" - uses: sarisia/actions-status-discord@v1 if: failure() && github.repository_owner == 'oven-sh' && github.event_name == 'pull_request' with: @@ -419,10 +369,11 @@ jobs: [Commit ${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}}) macOS-test: - name: Tests ${{matrix.tag}} + name: macOS Test runs-on: ${{ matrix.runner }} needs: [macOS] - if: github.event_name == 'pull_request' && github.repository_owner == 'oven-sh' + # if: github.event_name == 'pull_request' && github.repository_owner == 'oven-sh' + if: true permissions: pull-requests: write timeout-minutes: 30 diff --git a/.github/workflows/bun-mac-x64.yml b/.github/workflows/bun-mac-x64.yml index 172ab538eb3ef..7b35d123e4672 100644 --- a/.github/workflows/bun-mac-x64.yml +++ b/.github/workflows/bun-mac-x64.yml @@ -5,9 +5,7 @@ concurrency: cancel-in-progress: true env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - TEST_TAG: bun-test' + LLVM_VERSION: 16 on: push: @@ -32,8 +30,8 @@ on: workflow_dispatch: jobs: - macos-object-files: - name: macOS Object + macOS-zig: + name: macOS Zig Object runs-on: med-ubuntu if: github.repository_owner == 'oven-sh' strategy: @@ -45,66 +43,131 @@ jobs: - cpu: haswell arch: x86_64 tag: bun-obj-darwin-x64 - # - cpu: native - # arch: aarch64 - # tag: bun-obj-darwin-aarch64 steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - uses: docker/setup-buildx-action@v2 + - uses: actions/checkout@v4 + + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v2 id: buildx with: install: true - - name: Run - run: | - rm -rf ${{runner.temp}}/release + - name: Login to GitHub Container Registry uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v3 - if: runner.arch == 'X64' - with: - context: . - push: false - cache-from: type=gha - cache-to: type=gha,mode=min - build-args: | - ARCH=${{ matrix.arch }} - BUILDARCH=amd64 - BUILD_MACHINE_ARCH=x86_64 - CPU_TARGET=${{ matrix.cpu }} - TRIPLET=${{matrix.arch}}-macos-none - GIT_SHA=${{github.sha}} - platforms: linux/amd64 - target: build_release_obj - outputs: type=local,dest=${{runner.temp}}/release - - name: Build and push + + - name: Compile Zig Object uses: docker/build-push-action@v3 - if: runner.arch == 'ARM64' with: context: . push: false - cache-from: type=gha - cache-to: type=gha,mode=min + # This doesnt seem to work + # cache-from: type=s3,endpoint_url=${{ secrets.CACHE_S3_ENDPOINT }},blobs_prefix=docker_blobs/,manifests_prefix=docker_manifests/,access_key_id=${{ secrets.CACHE_S3_ACCESS_KEY_ID }},secret_access_key=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }},bucket=bun,region=auto + # cache-to: type=s3,endpoint_url=${{ secrets.CACHE_S3_ENDPOINT }},blobs_prefix=docker_blobs/,manifests_prefix=docker_manifests/,access_key_id=${{ secrets.CACHE_S3_ACCESS_KEY_ID }},secret_access_key=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }},bucket=bun,region=auto + # This was used before, but also does not really work + cache-from: type=local,src=/tmp/.buildx-cache-${{matrix.tag}} + cache-to: type=local,dest=/tmp/.buildx-cache-${{matrix.tag}} build-args: | + BUILDARCH=${{ runner.arch == 'X64' && 'amd64' || 'arm64' }} + BUILD_MACHINE_ARCH=${{ runner.arch == 'X64' && 'x86_64' || 'aarch64' }} ARCH=${{ matrix.arch }} - BUILDARCH=arm64 - BUILD_MACHINE_ARCH=aarch64 CPU_TARGET=${{ matrix.cpu }} - TRIPLET=${{matrix.arch}}-macos-none - GIT_SHA=${{github.sha}} - platforms: linux/arm64 + TRIPLET=${{ matrix.arch }}-macos-none + GIT_SHA=${{ github.sha }} + + SCCACHE_BUCKET=bun + SCCACHE_REGION=auto + SCCACHE_S3_USE_SSL=true + SCCACHE_ENDPOINT=${{ secrets.CACHE_S3_ENDPOINT }} + AWS_ACCESS_KEY_ID=${{ secrets.CACHE_S3_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }} + platforms: linux/${{ runner.arch == 'X64' && 'amd64' || 'arm64' }} target: build_release_obj outputs: type=local,dest=${{runner.temp}}/release - - uses: actions/upload-artifact@v3 + + - name: Upload Zig Object + uses: actions/upload-artifact@v3 with: name: ${{ matrix.tag }} - path: ${{runner.temp}}/release/bun.o + path: ${{runner.temp}}/release/bun-zig.o + + macOS-dependencies: + name: macOS Dependencies + runs-on: ${{ matrix.runner }} + if: github.repository_owner == 'oven-sh' + timeout-minutes: 15 + strategy: + matrix: + include: + - cpu: native + arch: aarch64 + tag: bun-darwin-aarch64 + obj: bun-obj-darwin-aarch64 + artifact: bun-obj-darwin-aarch64 + runner: macos-arm64 + steps: + - uses: actions/checkout@v4 + - name: Checkout submodules + run: git submodule update --init --recursive --depth=1 --progress --force + + - name: Install system dependencies + env: + HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 + HOMEBREW_NO_AUTO_UPDATE: 1 + HOMEBREW_NO_INSTALL_CLEANUP: 1 + run: | + brew install sccache ccache rust llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config --force + echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH + echo "$(brew --prefix sccache)/bin" >> $GITHUB_PATH + echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH + echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH + brew link --overwrite llvm@$LLVM_VERSION + + - name: Hash submodule versions + run: | + print_data() { + git submodule | grep -v WebKit + llvm-config --version + rustc --version + cat $(echo scripts/build*.sh scripts/all-dependencies.sh | tr " " "\n" | sort) + } + echo "sha=$(print_data | sha1sum | cut -c 1-10)" >> $GITHUB_OUTPUT + id: submodule-versions + + - name: Cache submodule dependencies + id: cache-deps-restore + uses: actions/cache/restore@v3 + with: + path: ${{runner.temp}}/bun-deps + key: bun-deps-${{ matrix.tag }}-${{ steps.submodule-versions.outputs.sha }} + + - name: Compile submodule dependencies + if: ${{ !steps.cache-deps-restore.outputs.cache-hit }} + env: + CPU_TARGET: ${{ matrix.cpu }} + BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps + run: | + mkdir -p $BUN_DEPS_OUT_DIR + bash ./scripts/clean-dependencies.sh + bash ./scripts/all-dependencies.sh + + - name: Cache submodule dependencies + if: ${{ !steps.cache-deps-restore.outputs.cache-hit }} + id: cache-deps-save + uses: actions/cache/save@v3 + with: + path: ${{runner.temp}}/bun-deps + key: ${{ steps.cache-deps-restore.outputs.cache-primary-key }} + + - name: Upload submodule dependencies + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.tag }}-deps + path: ${{runner.temp}}/bun-deps + macOS-cpp: name: macOS C++ runs-on: ${{ matrix.runner }} @@ -113,157 +176,76 @@ jobs: strategy: matrix: include: - # - cpu: nehalem - # arch: x86_64 - # tag: bun-darwin-x64-baseline - # obj: bun-obj-darwin-x64-baseline - # runner: macos-12 - # artifact: bun-obj-darwin-x64-baseline - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-macos-amd64-lto.tar.gz" - # dependencies: true - # compile_obj: false - cpu: haswell arch: x86_64 tag: bun-darwin-x64 obj: bun-obj-darwin-x64 runner: macos-12 artifact: bun-obj-darwin-x64 - webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-macos-amd64-lto.tar.gz" - dependencies: true - compile_obj: false - # - cpu: nehalem - # arch: x86_64 - # tag: bun-darwin-x64-baseline - # obj: bun-obj-darwin-x64-baseline - # runner: macos-12 - # artifact: bun-obj-darwin-x64-baseline - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-macos-amd64-lto.tar.gz" - # dependencies: false - # compile_obj: true - - cpu: haswell - arch: x86_64 - tag: bun-darwin-x64 - obj: bun-obj-darwin-x64 - runner: macos-12 - artifact: bun-obj-darwin-x64 - webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-macos-amd64-lto.tar.gz" - dependencies: false - compile_obj: true - # - cpu: native - # arch: aarch64 - # tag: bun-darwin-aarch64 - # obj: bun-obj-darwin-aarch64 - # artifact: bun-obj-darwin-aarch64 - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-macos-arm64-lto.tar.gz" - # runner: macos-arm64 - # dependencies: true - # compile_obj: true steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Checkout submodules - run: git submodule update --init --recursive --depth=1 --progress -j $(sysctl -n hw.ncpu) --force - - name: Install dependencies + run: git submodule update --init --recursive --depth=1 --progress --force + + - name: Install system dependencies env: - CPU_TARGET: ${{ matrix.cpu }} - JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit - JSC_LIB: ${{ runner.temp }}/bun-webkit/lib HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 HOMEBREW_NO_AUTO_UPDATE: 1 HOMEBREW_NO_INSTALL_CLEANUP: 1 - BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun - OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj - BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps run: | - brew install rust ccache llvm@16 pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config esbuild --force + brew install sccache ccache rust llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config --force + echo "$(brew --prefix sccache)/bin" >> $GITHUB_PATH + echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH - echo "$(brew --prefix llvm@16)/bin" >> $GITHUB_PATH - brew link --overwrite llvm@16 - - name: Download WebKit - if: matrix.compile_obj - env: - CPU_TARGET: ${{ matrix.cpu }} - JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit - JSC_LIB: ${{ runner.temp }}/bun-webkit/lib - BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun - OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj - BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps - WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit - WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit - run: | - rm -rf $JSC_BASE_DIR - mkdir -p $JSC_BASE_DIR - curl -L ${{ matrix.webkit_url }} | tar -xz -C $JSC_BASE_DIR --strip-components=1 - - name: ccache (dependencies) - uses: hendrikmuhs/ccache-action@v1.2 - if: matrix.dependencies - with: - key: ${{ runner.os }}-ccache-${{ matrix.tag }}-dependencies - restore-keys: ${{ runner.os }}-ccache-${{ matrix.tag }}-dependencies - - name: ccache (c++) + echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH + brew link --overwrite llvm@$LLVM_VERSION + + curl -LO "https://github.com/oven-sh/bun/releases/download/bun-v1.0.7/bun-darwin-x64.zip" + unzip bun-darwin-x64.zip + mkdir -p ${{ runner.temp }}/.bun/bin + mv bun-darwin-x64/bun ${{ runner.temp }}/.bun/bin/bun + chmod +x ${{ runner.temp }}/.bun/bin/bun + echo "${{ runner.temp }}/.bun/bin" >> $GITHUB_PATH + + # TODO: replace with sccache + - name: ccache uses: hendrikmuhs/ccache-action@v1.2 - if: matrix.compile_obj with: - key: ${{ runner.os }}-ccache-${{ matrix.tag }}-obj - restore-keys: ${{ runner.os }}-ccache-${{ matrix.tag }}-obj - - name: Compile dependencies - if: matrix.dependencies - env: - CPU_TARGET: ${{ matrix.cpu }} - JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit - JSC_LIB: ${{ runner.temp }}/bun-webkit/lib - BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun - OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj - BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps - WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit - WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit - run: | - mkdir -p $OBJ_DIR $BUN_DEPS_OUT_DIR - make vendor-without-check + key: ${{ runner.os }}-ccache-${{ matrix.tag }} + restore-keys: ${{ runner.os }}-ccache-${{ matrix.tag }} + - name: Compile C++ - if: matrix.compile_obj env: CPU_TARGET: ${{ matrix.cpu }} - JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit - JSC_LIB: ${{ runner.temp }}/bun-webkit/lib - BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun + SOURCE_DIR: ${{ github.workspace }} OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps - WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit - WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit run: | - mkdir -p $OBJ_DIR $BUN_DEPS_OUT_DIR - make -j $(sysctl -n hw.ncpu) release-bindings + mkdir -p $OBJ_DIR + cd $OBJ_DIR + + cmake -S $SOURCE_DIR -B $OBJ_DIR \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUN_CPP_ONLY=1 + + bash compile-cpp-only.sh + - name: Upload C++ - if: matrix.compile_obj uses: actions/upload-artifact@v3 with: name: ${{ matrix.tag }}-cpp - path: ${{ runner.temp }}/bun-cpp-obj - - name: Upload Dependencies - if: matrix.dependencies - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.tag }}-deps - path: ${{runner.temp}}/bun-deps - + path: ${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a macOS: name: macOS Link runs-on: ${{ matrix.runner }} if: github.repository_owner == 'oven-sh' - needs: [macOS-cpp, macos-object-files] + needs: [macOS-cpp, macOS-zig, macOS-dependencies] timeout-minutes: 90 permissions: write-all strategy: matrix: include: - # - cpu: nehalem - # arch: x86_64 - # tag: bun-darwin-x64-baseline - # obj: bun-obj-darwin-x64-baseline - # package: bun-darwin-x64 - # runner: macos-12 - # artifact: bun-obj-darwin-x64-baseline - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-macos-amd64-lto.tar.gz" - cpu: haswell arch: x86_64 tag: bun-darwin-x64 @@ -272,104 +254,69 @@ jobs: runner: macos-12 artifact: bun-obj-darwin-x64 webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-macos-amd64-lto.tar.gz" - # - cpu: native - # arch: aarch64 - # tag: bun-darwin-aarch64 - # obj: bun-obj-darwin-aarch64 - # package: bun-darwin-aarch64 - # artifact: bun-obj-darwin-aarch64 - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-macos-arm64-lto.tar.gz" - # runner: macos-arm64 steps: - uses: actions/checkout@v3 - name: Checkout submodules - run: git submodule update --init --recursive --depth=1 --progress -j $(sysctl -n hw.ncpu) --force - - name: Install dependencies + run: git submodule update --init --recursive --depth=1 --progress --force + + - name: Install system dependencies env: - CPU_TARGET: ${{ matrix.cpu }} - JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit - JSC_LIB: ${{ runner.temp }}/bun-webkit/lib HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 HOMEBREW_NO_AUTO_UPDATE: 1 HOMEBREW_NO_INSTALL_CLEANUP: 1 - BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun - OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj - BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps run: | - brew install rust ccache llvm@16 pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config esbuild --force + brew install ccache llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv openssl@1.1 ninja --force + echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH - echo "$(brew --prefix llvm@16)/bin" >> $GITHUB_PATH - brew link --overwrite llvm@16 - - name: Download WebKit - env: - CPU_TARGET: ${{ matrix.cpu }} - JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit - JSC_LIB: ${{ runner.temp }}/bun-webkit/lib - BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun - OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj - BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps - BUN_RELEASE_DIR: ${{ runner.temp }}/release - WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit - WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit - run: | - rm -rf $JSC_BASE_DIR - mkdir -p $JSC_BASE_DIR - curl -L ${{ matrix.webkit_url }} | tar -xz -C $JSC_BASE_DIR --strip-components=1 + echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH + brew link --overwrite llvm@$LLVM_VERSION + + curl -LO "https://github.com/oven-sh/bun/releases/download/bun-v1.0.7/bun-darwin-x64.zip" + unzip bun-darwin-x64.zip + mkdir -p ${{ runner.temp }}/.bun/bin + mv bun-darwin-x64/bun ${{ runner.temp }}/.bun/bin/bun + chmod +x ${{ runner.temp }}/.bun/bin/bun + echo "${{ runner.temp }}/.bun/bin" >> $GITHUB_PATH + - name: Download C++ uses: actions/download-artifact@v3 with: name: ${{ matrix.tag }}-cpp path: ${{ runner.temp }}/bun-cpp-obj - - name: Download Dependencies - uses: actions/download-artifact@v3 - with: - name: ${{ matrix.tag }}-deps - path: ${{ runner.temp }}/bun-deps - - name: Download Object + + - name: Download Zig Object uses: actions/download-artifact@v3 with: name: ${{ matrix.obj }} path: ${{ runner.temp }}/release - - name: ccache (link) - uses: hendrikmuhs/ccache-action@v1.2 + + - name: Downloaded submodule dependencies + uses: actions/download-artifact@v3 with: - key: ${{ runner.os }}-ccache-${{ matrix.tag }}-link - restore-keys: ${{ runner.os }}-ccache-${{ matrix.tag }}-link + name: ${{ matrix.tag }}-deps + path: ${{runner.temp}}/bun-deps + - name: Link env: CPU_TARGET: ${{ matrix.cpu }} - JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit - JSC_LIB: ${{ runner.temp }}/bun-webkit/lib - BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun - OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj - BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps - BUN_RELEASE_DIR: ${{ runner.temp }}/release - WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit - WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit run: | - rm -rf packages/${{ matrix.package }} - mkdir -p packages/${{ matrix.package }} - mv ${{ runner.temp }}/release/* packages/${{ matrix.package }}/ - make bun-link-lld-release copy-to-bun-release-dir-bin + SRC_DIR=$PWD + mkdir ${{runner.temp}}/link-build + cd ${{runner.temp}}/link-build + cmake $SRC_DIR \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUN_LINK_ONLY=1 \ + -DBUN_ZIG_OBJ="${{ runner.temp }}/release/bun-zig.o" \ + -DBUN_CPP_ARCHIVE="${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a" \ + -DBUN_DEPS_OUT_DIR="${{runner.temp}}/bun-deps" + ninja - name: Zip - env: - CPU_TARGET: ${{ matrix.cpu }} - JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit - JSC_LIB: ${{ runner.temp }}/bun-webkit/lib - BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun - OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj - BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps - BUN_RELEASE_DIR: ${{ runner.temp }}/release - WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit - WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit run: | - cd ${{runner.temp}}/release + cd ${{runner.temp}}/link-build chmod +x bun-profile bun - mkdir ${{matrix.tag}}-profile - mkdir ${{matrix.tag}} - - /usr/bin/strip -S bun + mkdir -p ${{matrix.tag}}-profile/ ${{matrix.tag}}/ mv bun-profile ${{matrix.tag}}-profile/bun-profile mv bun ${{matrix.tag}}/bun @@ -379,11 +326,11 @@ jobs: - uses: actions/upload-artifact@v3 with: name: ${{matrix.tag}}-profile - path: ${{runner.temp}}/release/${{matrix.tag}}-profile.zip + path: ${{runner.temp}}/link-build/${{matrix.tag}}-profile.zip - uses: actions/upload-artifact@v3 with: name: ${{matrix.tag}} - path: ${{runner.temp}}/release/${{matrix.tag}}.zip + path: ${{runner.temp}}/link-build/${{matrix.tag}}.zip - name: Release id: release uses: ncipollo/release-action@v1 @@ -400,7 +347,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} name: "Canary (${{github.sha}})" tag: "canary" - artifacts: "${{runner.temp}}/release/${{matrix.tag}}.zip,${{runner.temp}}/release/${{matrix.tag}}-profile.zip" + artifacts: "${{runner.temp}}/link-build/${{matrix.tag}}.zip,${{runner.temp}}/link-build/${{matrix.tag}}-profile.zip" - uses: sarisia/actions-status-discord@v1 if: failure() && github.repository_owner == 'oven-sh' && github.event_name == 'pull_request' with: diff --git a/.github/workflows/bun-release.yml b/.github/workflows/bun-release.yml index 5962e658f48a4..4019fb337e504 100644 --- a/.github/workflows/bun-release.yml +++ b/.github/workflows/bun-release.yml @@ -152,7 +152,7 @@ jobs: matrix: include: - variant: debian - suffix: '' + suffix: "" - variant: debian suffix: -debian - variant: slim diff --git a/.github/workflows/zig-fmt.yml b/.github/workflows/zig-fmt.yml index 2c3c1fefb622d..dff35ddf038fb 100644 --- a/.github/workflows/zig-fmt.yml +++ b/.github/workflows/zig-fmt.yml @@ -1,7 +1,7 @@ name: zig-fmt env: - ZIG_VERSION: 0.12.0-dev.899+027aabf49 + ZIG_VERSION: 0.12.0-dev.1297+a9e66ed73 on: pull_request: diff --git a/.gitignore b/.gitignore index 6f2ef8ed2ec84..ce9b7bc3071c5 100644 --- a/.gitignore +++ b/.gitignore @@ -135,3 +135,23 @@ make-dev-stats.csv .uuid tsconfig.tsbuildinfo +build-release + +*.lib +*.pdb +CMakeFiles +build.ninja +.ninja_deps +.ninja_log +CMakeCache.txt +cmake_install.cmake +compile_commands.json + +*.lib +x64 +**/*.vcxproj* +**/*.sln* +**/*.dir +**/*.pdb + +.webkit-cache \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index 883f639146c35..fcb03d8bed955 100644 --- a/.gitmodules +++ b/.gitmodules @@ -56,15 +56,15 @@ depth = 1 shallow = true fetchRecurseSubmodules = false [submodule "src/deps/c-ares"] - path = src/deps/c-ares - url = https://github.com/c-ares/c-ares.git +path = src/deps/c-ares +url = https://github.com/c-ares/c-ares.git [submodule "src/deps/zstd"] - path = src/deps/zstd - url = https://github.com/facebook/zstd.git - ignore = dirty +path = src/deps/zstd +url = https://github.com/facebook/zstd.git +ignore = dirty [submodule "src/deps/base64"] - path = src/deps/base64 - url = https://github.com/aklomp/base64.git - ignore = dirty - depth = 1 - shallow = true \ No newline at end of file +path = src/deps/base64 +url = https://github.com/aklomp/base64.git +ignore = dirty +depth = 1 +shallow = true diff --git a/.scripts/make-dev-timer.ts b/.scripts/make-dev-timer.ts deleted file mode 100644 index 4b5f8d53598f9..0000000000000 --- a/.scripts/make-dev-timer.ts +++ /dev/null @@ -1,21 +0,0 @@ -// I would have made this a bash script but there isn't an easy way to track -// time in bash sub-second cross platform. -import fs from "fs"; -const start = Date.now() + 5; -const result = Bun.spawnSync(process.argv.slice(2), { - stdio: ["inherit", "inherit", "inherit"], -}); -const end = Date.now(); -const diff = (Math.max(Math.round(end - start), 0) / 1000).toFixed(3); -const success = result.exitCode === 0; -try { - const line = `${new Date().toISOString()}, ${success ? "success" : "fail"}, ${diff}\n`; - if (fs.existsSync(".scripts/make-dev-stats.csv")) { - fs.appendFileSync(".scripts/make-dev-stats.csv", line); - } else { - fs.writeFileSync(".scripts/make-dev-stats.csv", line); - } -} catch { - // Ignore -} -process.exit(result.exitCode); diff --git a/.scripts/postinstall.sh b/.scripts/postinstall.sh deleted file mode 100755 index 89c73320342c0..0000000000000 --- a/.scripts/postinstall.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -set -euxo pipefail - -# if bun-webkit node_modules directory exists -if [ -d ./node_modules/bun-webkit ] || [ -d ./node_modules/bun-webkit-debug ]; then - rm -f bun-webkit - # get the first matching bun-webkit-* directory name - ln -s ./node_modules/$(ls ./node_modules | grep bun-webkit- | grep -v bun-webkit-debug | head -n 1) ./bun-webkit -fi - -# sets up vscode C++ intellisense -rm -f .vscode/clang++ -ln -s $(which clang++-16 || which clang++) .vscode/clang++ 2>/dev/null diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 2327e93a23be3..5c4265d70baea 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -1,23 +1,17 @@ { "configurations": [ { - "name": "Mac", + "name": "Debug", "forcedInclude": ["${workspaceFolder}/src/bun.js/bindings/root.h"], "includePath": [ - "${workspaceFolder}/../webkit-build/include/", - "${workspaceFolder}/bun-webkit/include/", - "${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Debug/", - "${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Debug/ICU/Headers/", - "${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Debug/JavaScriptCore/PrivateHeaders/", - "${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Debug/WTF/Headers", - "${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Debug/bmalloc/Headers/", + "${workspaceFolder}/build/bun-webkit/include", + "${workspaceFolder}/build/codegen", "${workspaceFolder}/src/bun.js/bindings/", "${workspaceFolder}/src/bun.js/bindings/webcore/", "${workspaceFolder}/src/bun.js/bindings/sqlite/", "${workspaceFolder}/src/bun.js/bindings/webcrypto/", "${workspaceFolder}/src/bun.js/modules/", "${workspaceFolder}/src/js/builtins/", - "${workspaceFolder}/src/js/out", "${workspaceFolder}/src/deps/boringssl/include/", "${workspaceFolder}/src/deps", "${workspaceFolder}/src/napi/*", @@ -26,27 +20,16 @@ ], "browse": { "path": [ - "${workspaceFolder}/../webkit-build/include/", - "${workspaceFolder}/bun-webkit/include/", - "${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Debug/", - "${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Debug/ICU/Headers/", - "${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Debug/JavaScriptCore/PrivateHeaders/**", - "${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Debug/WTF/Headers/**", - "${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Debug/bmalloc/Headers/**", - "${workspaceFolder}/src/bun.js/bindings/*", - "${workspaceFolder}/src/bun.js/bindings/*", + "${workspaceFolder}/build/bun-webkit/include", + "${workspaceFolder}/src/bun.js/bindings", "${workspaceFolder}/src/napi/*", - "${workspaceFolder}/src/bun.js/bindings/sqlite/", - "${workspaceFolder}/src/bun.js/bindings/webcrypto/", - "${workspaceFolder}/src/bun.js/bindings/webcore/", "${workspaceFolder}/src/js/builtins/*", - "${workspaceFolder}/src/js/out/*", "${workspaceFolder}/src/bun.js/modules/*", - "${workspaceFolder}/src/deps", - "${workspaceFolder}/src/deps/boringssl/include/", - "${workspaceFolder}/packages/bun-usockets/", - "${workspaceFolder}/packages/bun-uws/", - "${workspaceFolder}/src/napi" + "${workspaceFolder}/src/deps/*", + "${workspaceFolder}/src/deps/boringssl/include/*", + "${workspaceFolder}/packages/bun-usockets/*", + "${workspaceFolder}/packages/bun-uws/*", + "${workspaceFolder}/src/napi/*" ], "limitSymbolsToIncludedHeaders": true, "databaseFilename": ".vscode/cppdb" diff --git a/.vscode/launch.json b/.vscode/launch.json index e10616c6d6f1d..b617320c3144f 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -307,11 +307,9 @@ "name": "bun install", "program": "bun-debug", "args": ["install"], - "cwd": "${fileDirname}", + "cwd": "/Users/jarred/Build/worky", "console": "internalConsole", - "env": { - "BUN_DEBUG_ALL": "1" - } + "env": {} }, { "type": "lldb", diff --git a/.vscode/settings.json b/.vscode/settings.json index 4155db7ac5a40..d3ad3f8eb4a12 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,43 +8,35 @@ "search.useIgnoreFiles": true, "zig.buildOnSave": false, "zig.formattingProvider": "zls", - "zig.buildArgs": ["obj", "-Dfor-editor"], "zig.buildOption": "build", "zig.buildFilePath": "${workspaceFolder}/build.zig", + "zig.initialSetupDone": true, + "editor.formatOnSave": true, "[zig]": { "editor.tabSize": 4, "editor.useTabStops": false, - "editor.defaultFormatter": "ziglang.vscode-zig", - "editor.formatOnSave": true + "editor.defaultFormatter": "ziglang.vscode-zig" }, "[ts]": { - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.formatOnSave": true + "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[js]": { - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.formatOnSave": true + "editor.defaultFormatter": "esbenp.prettier-vscode" }, "zig.zls.enableInlayHints": false, - "zig.zls.enabled": true, "git.ignoreSubmodules": true, "[jsx]": { - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.formatOnSave": true + "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[tsx]": { - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.formatOnSave": true - }, - "[yaml]": { - "editor.formatOnSave": true + "editor.defaultFormatter": "esbenp.prettier-vscode" }, + "[yaml]": {}, "[markdown]": { "editor.unicodeHighlight.ambiguousCharacters": false, "editor.unicodeHighlight.invisibleCharacters": false, "diffEditor.ignoreTrimWhitespace": false, "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.formatOnSave": true, "editor.wordWrap": "on", "editor.quickSuggestions": { "comments": "off", @@ -64,8 +56,6 @@ "**/*.xcscheme": true, "**/*.pem": true, "**/*.xcodeproj": true, - "test/snapshots": true, - "test/snapshots-no-hmr": true, "src/bun.js/WebKit": true, "src/deps/libarchive": true, "src/deps/mimalloc": true, @@ -77,30 +67,25 @@ "src/deps/lol-html": true, "src/deps/c-ares": true, "src/deps/tinycc": true, - "src/deps/zstd": true, - "test/snippets/package-json-exports/_node_modules_copy": true, - "src/js/out": true, - "packages/bun-uws/fuzzing/seed-corpus/": true, - "**/*.dep": true, - "**/CMakeFiles": true + "src/deps/zstd": true }, "C_Cpp.files.exclude": { "**/.vscode": true, - "src/bun.js/WebKit/JSTests": true, - "src/bun.js/WebKit/Tools": true, - "src/bun.js/WebKit/WebDriverTests": true, - "src/bun.js/WebKit/WebKit.xcworkspace": true, - "src/bun.js/WebKit/WebKitLibraries": true, - "src/bun.js/WebKit/Websites": true, - "src/bun.js/WebKit/resources": true, - "src/bun.js/WebKit/LayoutTests": true, - "src/bun.js/WebKit/ManualTests": true, - "src/bun.js/WebKit/PerformanceTests": true, - "src/bun.js/WebKit/WebKitLegacy": true, - "src/bun.js/WebKit/WebCore": true, - "src/bun.js/WebKit/WebDriver": true, - "src/bun.js/WebKit/WebKitBuild": true, - "src/bun.js/WebKit/WebInspectorUI": true + "WebKit/JSTests": true, + "WebKit/Tools": true, + "WebKit/WebDriverTests": true, + "WebKit/WebKit.xcworkspace": true, + "WebKit/WebKitLibraries": true, + "WebKit/Websites": true, + "WebKit/resources": true, + "WebKit/LayoutTests": true, + "WebKit/ManualTests": true, + "WebKit/PerformanceTests": true, + "WebKit/WebKitLegacy": true, + "WebKit/WebCore": true, + "WebKit/WebDriver": true, + "WebKit/WebKitBuild": true, + "WebKit/WebInspectorUI": true }, "[cpp]": { "editor.defaultFormatter": "xaver.clang-format" @@ -191,20 +176,12 @@ "set": "cpp", "__memory": "cpp", "memory_resource": "cpp", - "resource.h": "c", - "sysinfo.h": "c", "*.tcc": "cpp", "list": "cpp", "shared_mutex": "cpp", "cinttypes": "cpp", "variant": "cpp", "sysctl.h": "c", - "interface_adresses.h": "c", - "interface_addresses.h": "c", - "ctype.h": "c", - "ethernet.h": "c", - "inet.h": "c", - "packet.h": "c", "queue": "cpp", "compare": "cpp", "concepts": "cpp", @@ -220,7 +197,23 @@ "regex": "cpp", "span": "cpp", "valarray": "cpp", - "codecvt": "cpp" + "codecvt": "cpp", + "xtr1common": "cpp", + "stop_token": "cpp", + "xfacet": "cpp", + "xhash": "cpp", + "xiosbase": "cpp", + "xlocale": "cpp", + "xlocbuf": "cpp", + "xlocinfo": "cpp", + "xlocmes": "cpp", + "xlocmon": "cpp", + "xlocnum": "cpp", + "xloctime": "cpp", + "xmemory": "cpp", + "xstring": "cpp", + "xtree": "cpp", + "xutility": "cpp" }, "C_Cpp.errorSquiggles": "enabled", "eslint.workingDirectories": ["packages/bun-types"], diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000000..3e52b2d1cdccf --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,1097 @@ +cmake_minimum_required(VERSION 3.22) + +cmake_policy(SET CMP0091 NEW) +cmake_policy(SET CMP0067 NEW) + +set(Bun_VERSION "1.0.8") +set(WEBKIT_TAG 67c9ba93323b4a5a95bc4d1efe61166dc6e3e691) + +set(BUN_WORKDIR "${CMAKE_CURRENT_BINARY_DIR}") +message(STATUS "Configuring Bun ${Bun_VERSION} in ${BUN_WORKDIR}") + +# --- Build Type --- +# This is done at the start simply so this is the first message printed +if(NOT CMAKE_BUILD_TYPE) + message(WARNING "No CMAKE_BUILD_TYPE value specified, defaulting to Debug.\nSet a build type with -DCMAKE_BUILD_TYPE=") + set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build (Debug, Release)" FORCE) +else() + if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release)$") + message(FATAL_ERROR + "Invalid CMAKE_BUILD_TYPE value specified: ${CMAKE_BUILD_TYPE}\n" + "CMAKE_BUILD_TYPE must be Debug or Release.") + endif() + message(STATUS "The CMake build type is: ${CMAKE_BUILD_TYPE}") +endif() +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + set(DEBUG ON) + set(ZIG_OPTIMIZE "Debug") + set(bun "bun-debug") +elseif(CMAKE_BUILD_TYPE STREQUAL "Release") + set(DEBUG OFF) + set(ZIG_OPTIMIZE "ReleaseFast") + set(bun "bun-profile") +endif() + +# --- LLVM --- +# This detection is a little overkill, but it ensures that the set LLVM_VERSION matches under +# any case possible. Sorry for the complexity... +# +# Bun and WebKit must be compiled with the same compiler, so we do as much as we can to ensure that +# the compiler used for the prebuilt WebKit, LLVM 16, is the one that we detect in this process. +# +# It has to be done before project() is called, so that CMake doesnt pick a compiler for us, but even then +# we do some extra work afterwards to double-check, and we will rerun BUN_FIND_LLVM if the compiler did not match. +# +# If the user passes -DLLVM_PREFIX, most of this logic is skipped, but we still warn if invalid. +set(LLVM_VERSION 16) +macro(BUN_FIND_LLVM) + find_program( + _LLVM_CXX_PATH + NAMES clang++-${LLVM_VERSION} clang++ + PATHS ENV PATH ${PLATFORM_LLVM_SEARCH_PATHS} + DOC "Path to LLVM ${LLVM_VERSION}'s clang++ binary. Please pass -DLLVM_PREFIX with the path to LLVM" + ) + if(NOT _LLVM_CXX_PATH) + message(FATAL_ERROR "Could not find LLVM ${LLVM_VERSION}, search paths: ${PLATFORM_LLVM_SEARCH_PATHS}") + endif() + set(CMAKE_CXX_COMPILER "${_LLVM_CXX_PATH}") + find_program( + _LLVM_C_PATH + NAMES clang-${LLVM_VERSION} clang + PATHS ENV PATH ${PLATFORM_LLVM_SEARCH_PATHS} + DOC "Path to LLVM ${LLVM_VERSION}'s clang binary. Please pass -DLLVM_PREFIX with the path to LLVM" + ) + if(NOT _LLVM_C_PATH) + message(FATAL_ERROR "Could not find LLVM ${LLVM_VERSION}, search paths: ${PLATFORM_LLVM_SEARCH_PATHS}") + endif() + set(CMAKE_C_COMPILER "${_LLVM_C_PATH}") + + find_program( + STRIP + NAMES llvm-strip + PATHS ENV PATH ${PLATFORM_LLVM_SEARCH_PATHS} + DOC "Path to LLVM ${LLVM_VERSION}'s llvm-strip binary" + ) + find_program( + STRIP + NAMES strip + PATHS ENV PATH ${PLATFORM_LLVM_SEARCH_PATHS} + DOC "Path to LLVM ${LLVM_VERSION}'s llvm-strip binary" + ) + find_program( + DSYMUTIL + NAMES dsymutil + PATHS ENV PATH ${PLATFORM_LLVM_SEARCH_PATHS} + DOC "Path to LLVM ${LLVM_VERSION}'s dsymutil binary" + ) + find_program( + AR + NAMES llvm-ar + PATHS ENV PATH ${PLATFORM_LLVM_SEARCH_PATHS} + DOC "Path to LLVM ${LLVM_VERSION}'s llvm-ar binary" + ) + find_program( + AR + NAMES ar + PATHS ENV PATH ${PLATFORM_LLVM_SEARCH_PATHS} + DOC "Path to LLVM ${LLVM_VERSION}'s llvm-ar binary" + ) + find_program( + RANLIB + NAMES llvm-ranlib + PATHS ENV PATH ${PLATFORM_LLVM_SEARCH_PATHS} + DOC "Path to LLVM ${LLVM_VERSION}'s llvm-ar binary" + ) + + execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_VARIABLE _tmp) + string(REGEX MATCH "version ([0-9]+)\\.([0-9]+)\\.([0-9]+)" CMAKE_CXX_COMPILER_VERSION "${_tmp}") + set(CMAKE_CXX_COMPILER_VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}") +endmacro() +if(UNIX) + if(LLVM_PREFIX) + set(PLATFORM_LLVM_SEARCH_PATHS ${LLVM_PREFIX}/bin) + else() + set(PLATFORM_LLVM_SEARCH_PATHS /usr/lib/llvm-${LLVM_VERSION}/bin /usr/lib/llvm${LLVM_VERSION}/bin /usr/bin /usr/local/bin) + if(APPLE) + set(PLATFORM_LLVM_SEARCH_PATHS /opt/homebrew/opt/llvm@${LLVM_VERSION}/bin /opt/homebrew/bin ${PLATFORM_LLVM_SEARCH_PATHS}) + endif() + endif() + if(CMAKE_CXX_COMPILER) + set(_LLVM_CXX_PATH "${CMAKE_CXX_COMPILER}") + endif() + if(CMAKE_C_COMPILER) + set(_LLVM_C_PATH "${CMAKE_C_COMPILER}") + endif() + BUN_FIND_LLVM() +else() + # On windows it is expected to use MSVC, and until we get a better build configuration, it is a free-for-all +endif() + +set(CMAKE_COLOR_DIAGNOSTICS ON) +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_C_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_C_STANDARD_REQUIRED ON) + +project(Bun VERSION "${Bun_VERSION}") + +# More effort to prevent using the wrong C++ compiler +if(UNIX) + if((NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (NOT CMAKE_CXX_COMPILER_VERSION MATCHES "^${LLVM_VERSION}\.")) + # Attempt to auto-correct the compiler + message(STATUS "Compiler mismatch, attempting to auto-correct") + unset(_LLVM_CXX_PATH) + BUN_FIND_LLVM() + if((NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (NOT CMAKE_CXX_COMPILER_VERSION MATCHES "^${LLVM_VERSION}\.")) + message(WARNING "Expected LLVM ${LLVM_VERSION} as the C++ compiler, build may fail or break at runtime.") + endif() + endif() +endif() + +message(STATUS "C++ Compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} at ${CMAKE_CXX_COMPILER}") +# --- End LLVM --- + +set(DEFAULT_ON_UNLESS_WINDOWS ON) +if(WIN32) + set(DEFAULT_ON_UNLESS_WINDOWS OFF) +endif() +set(DEFAULT_ON_UNLESS_APPLE ON) +if(APPLE) + set(DEFAULT_ON_UNLESS_APPLE OFF) +endif() + +set(CI OFF) +if(DEFINED ENV{CI} OR DEFINED ENV{GITHUB_ACTIONS}) + set(CI ON) +endif() + +# -- Build Flags -- +option(USE_STATIC_SQLITE "Statically link SQLite?" ${DEFAULT_ON_UNLESS_APPLE}) +option(USE_CUSTOM_ZLIB "Use Bun's recommended version of zlib" ON) +option(USE_CUSTOM_BORINGSSL "Use Bun's recommended version of BoringSSL" ON) +option(USE_CUSTOM_LIBARCHIVE "Use Bun's recommended version of libarchive" ON) +option(USE_CUSTOM_MIMALLOC "Use Bun's recommended version of Mimalloc" ON) +option(USE_CUSTOM_ZSTD "Use Bun's recommended version of zstd" ON) +option(USE_CUSTOM_CARES "Use Bun's recommended version of c-ares" ON) +option(USE_CUSTOM_BASE64 "Use Bun's recommended version of libbase64" ON) +option(USE_CUSTOM_LOLHTML "Use Bun's recommended version of lolhtml" ON) +option(USE_CUSTOM_TINYCC "Use Bun's recommended version of tinycc" ON) +option(USE_CUSTOM_LIBUV "Use Bun's recommended version of libuv (Windows only)" OFF) +option(USE_BASELINE_BUILD "Build Bun for baseline (older) CPUs" OFF) +option(USE_DEBUG_JSC "Enable assertions and use a debug build of JavaScriptCore" OFF) +option(USE_UNIFIED_SOURCES "Use unified sources to speed up the build" OFF) + +option(CANARY "Make `bun --revision` report a canary release" OFF) + +set(ERROR_LIMIT 100 CACHE STRING "Maximum number of errors to show when compiling C++ code") + +set(ARCH x86_64) +if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|arm64|arm") + set(ARCH aarch64) +endif() + +if(NOT CPU_TARGET) + if(ENV{CPU_TARGET}) + set(CPU_TARGET $ENV{CPU_TARGET}) + else() + set(CPU_TARGET "native" CACHE STRING "CPU target for the compiler" FORCE) + if (ARCH STREQUAL "x86_64") + if (NOT MSVC) + if (USE_BASELINE_BUILD) + set(CPU_TARGET "nehalem") + else() + set(CPU_TARGET "haswell") + endif() + endif() + endif() + endif() +endif() +message(STATUS "Building for CPU Target: ${CPU_TARGET}") + +if(NOT ZIG_TARGET) + set(ZIG_TARGET "native") + if(WIN32) + set(ZIG_TARGET "${ARCH}-windows-msvc") + endif() +endif() + +set(CONFIGURE_DEPENDS "CONFIGURE_DEPENDS") +if(NO_CONFIGURE_DEPENDS) + set(CONFIGURE_DEPENDS "") +endif() + +# --- CLI Paths --- +set(REQUIRED_IF_NOT_ONLY_CPP_OR_LINK "") +if(NOT BUN_CPP_ONLY AND NOT BUN_LINK_ONLY) + set(REQUIRED_IF_NOT_ONLY_CPP_OR_LINK "REQUIRED") +endif() + +# Zig Compiler +function(validate_zig validator_result_var item) + set(${validator_result_var} FALSE PARENT_SCOPE) + # We will allow any valid zig compiler, as long as it contains some text from `zig zen` + # Ideally we would do a version or feature check, but that would be quite slow + execute_process(COMMAND ${item} zen OUTPUT_VARIABLE ZIG_ZEN_OUTPUT) + if(ZIG_ZEN_OUTPUT MATCHES "Together we serve the users") + set(${validator_result_var} TRUE PARENT_SCOPE) + else() + set(${validator_result_var} FALSE PARENT_SCOPE) + endif() +endfunction() +find_program(ZIG_COMPILER zig ${REQUIRED_IF_NOT_ONLY_CPP_OR_LINK} DOC "Path to the Zig compiler" VALIDATOR validate_zig) +message(STATUS "Found Zig Compiler: ${ZIG_COMPILER}") + +# Bun +if(NOT WIN32) + find_program(BUN_EXECUTABLE bun ${REQUIRED_IF_NOT_ONLY_CPP_OR_LINK} DOC "Path to an already built release of Bun") + message(STATUS "Found Bun: ${BUN_EXECUTABLE}") +else() + set(BUN_EXECUTABLE "echo") +endif() + +# Prettier +find_program(PRETTIER prettier DOC "Path to prettier" PATHS ./node_modules/.bin ENV PATH) + +# Esbuild (TODO: switch these to "bun build") +find_program(ESBUILD esbuild DOC "Path to esbuild" PATHS ./node_modules/.bin ENV PATH) + +# Ruby (only needed for unified sources) +if(USE_UNIFIED_SOURCES) + # ruby 'WebKit/Source/WTF/Scripts/generate-unified-source-bundles.rb' source_list.txt --source-tree-path . --derived-sources-path build/unified-sources + find_program(RUBY ruby DOC "Path to ruby") +endif() + +# CCache +find_program(CCACHE_PROGRAM ccache) +if(CCACHE_PROGRAM) + set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") + set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") + message(STATUS "Using ccache: ${CCACHE_PROGRAM}") +endif() + +# --- WebKit --- +# WebKit is either prebuilt and distributed via NPM, or you can pass WEBKIT_DIR to use a local build. +# We cannot include their CMake build files (TODO: explain why, for now ask @paperdave why) +# +# On Unix, this will pull from NPM the single package that is needed and use that +if(WIN32) + set(STATIC_LIB_EXT "lib") + set(libJavaScriptCore "JavaScriptCore") + set(libWTF "WTF") +else() + set(STATIC_LIB_EXT "a") + set(libJavaScriptCore "libJavaScriptCore") + set(libWTF "libWTF") +endif() +if(NOT WEBKIT_DIR) + if(WIN32) + message(FATAL_ERROR "Windows does not have prebuilt webkit yet. Please run release-windows.ps1 and pass the path to the built webkit with -DWEBKIT_DIR") + endif() + set(BUN_WEBKIT_PACKAGE_NAME_SUFFIX "") + set(ASSERT_ENABLED "0") + if(USE_DEBUG_JSC) + set(BUN_WEBKIT_PACKAGE_NAME_SUFFIX "-debug") + set(ASSERT_ENABLED "1") + elseif(NOT DEBUG) + set(BUN_WEBKIT_PACKAGE_NAME_SUFFIX "-lto") + set(ASSERT_ENABLED "0") + endif() + if (WIN32) + set(BUN_WEBKIT_PACKAGE_PLATFORM "win32") + elseif(APPLE) + set(BUN_WEBKIT_PACKAGE_PLATFORM "macos") + else() + set(BUN_WEBKIT_PACKAGE_PLATFORM "linux") + endif() + if(ARCH STREQUAL "x86_64") + set(BUN_WEBKIT_PACKAGE_ARCH "amd64") + elseif(ARCH MATCHES "aarch64|arm64|arm") + set(BUN_WEBKIT_PACKAGE_ARCH "arm64") + endif() + set(BUN_WEBKIT_PACKAGE_NAME "bun-webkit-${BUN_WEBKIT_PACKAGE_PLATFORM}-${BUN_WEBKIT_PACKAGE_ARCH}${BUN_WEBKIT_PACKAGE_NAME_SUFFIX}") + + message(STATUS "Using Pre-built WebKit: ${BUN_WEBKIT_PACKAGE_NAME}") + execute_process( + COMMAND ${BUN_EXECUTABLE} + "${CMAKE_CURRENT_SOURCE_DIR}/src/codegen/download-webkit.ts" + "--outdir=${BUN_WORKDIR}/bun-webkit" + "--tag=${WEBKIT_TAG}" + "--package=${BUN_WEBKIT_PACKAGE_NAME}" + WORKING_DIRECTORY ${BUN_WORKDIR} + ) + if(NOT EXISTS "${BUN_WORKDIR}/bun-webkit") + message(FATAL_ERROR "Prebuilt WebKit package ${BUN_WEBKIT_PACKAGE_NAME} failed to install") + endif() + set(WEBKIT_INCLUDE_DIR "${BUN_WORKDIR}/bun-webkit/include") + set(WEBKIT_LIB_DIR "${BUN_WORKDIR}/bun-webkit/lib") +elseif(WEBKIT_DIR STREQUAL "omit") + message(STATUS "Not using WebKit. This is only valid if you are only trying to build Zig code") +else() + # Setting WEBKIT_DIR means you either have a path to the WebKit repo, or you have a path to packaged webkit + # Non-packaged webkit has CMakeLists.txt + if(EXISTS "${WEBKIT_DIR}/CMakeLists.txt") + # Since we may be doing a Debug build of Bun but with a Release build of JSC, we can't + # include their CMakeLists directly here, but rather we need to run `cmake` as a dependency + # of our build. It'll still have decent caching which is what really matters. + + # cmake WEBKIT_DIR -B WEBKIT_DIR/WebKitBuild/WEBKIT_BUILD_TYPE + # -DPORT=JSCOnly + # -DENABLE_STATIC_JSC=ON + # -DENABLE_SINGLE_THREADED_VM_ENTRY_SCOPE=ON + # -DCMAKE_BUILD_TYPE=Debug + # -DENABLE_BUN_SKIP_FAILING_ASSERTIONS=ON + # -DUSE_THIN_ARCHIVES=OFF + # -DENABLE_FTL_JIT=ON + # -DCMAKE_C_COMPILER=(which clang-16) + # -DDCMAKE_CXX_COMPILER=(which clang++-16) + # -DDUSE_BUN_JSC_ADDITIONS=1 + # -DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" + # -DCMAKE_AR=$(which llvm-ar) + # -DCMAKE_RANLIB=$(which llvm-ranlib) + # -DALLOW_LINE_AND_COLUMN_NUMBER_IN_BUILTINS=ON + # -G Ninja + # -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 + # -DPTHREAD_JIT_PERMISSIONS_API=1 + # -DUSE_PTHREAD_JIT_PERMISSIONS_API=ON + # -DENABLE_REMOTE_INSPECTOR=ON + message(FATAL_ERROR "TODO: Setting WEBKIT_DIR to the WebKit repository to enable automatic builds. For now you need to run the release script, and point to the packaged directory.") + else() + if(NOT EXISTS "${WEBKIT_DIR}/lib/${libWTF}.${STATIC_LIB_EXT}" OR NOT EXISTS "${WEBKIT_DIR}/lib/${libJavaScriptCore}.${STATIC_LIB_EXT}") + if(WEBKIT_DIR MATCHES "src/bun.js/WebKit$") + message(FATAL_ERROR "WebKit directory ${WEBKIT_DIR} does not contain all the required files for Bun. Did you forget to init submodules?") + endif() + message(FATAL_ERROR "WebKit directory ${WEBKIT_DIR} does not contain all the required files for Bun. Expected a path to the oven-sh/WebKit repository, or a path to a folder containing `include` and `lib`.") + endif() + + set(WEBKIT_INCLUDE_DIR "${WEBKIT_DIR}/include") + set(WEBKIT_LIB_DIR "${WEBKIT_DIR}/lib") + + message(STATUS "Using specified WebKit directory: ${WEBKIT_DIR}") + + set(ASSERT_ENABLED "0") + message(STATUS "WebKit assertions: OFF") + endif() +endif() + +# --- CMake Macros --- + +# Append the given dependencies to the source file +macro(WEBKIT_ADD_SOURCE_DEPENDENCIES _source _deps) + set(_tmp) + get_source_file_property(_tmp ${_source} OBJECT_DEPENDS) + if(NOT _tmp) + set(_tmp "") + endif() + + foreach(f ${_deps}) + list(APPEND _tmp "${f}") + endforeach() + + set_source_files_properties(${_source} PROPERTIES OBJECT_DEPENDS "${_tmp}") + unset(_tmp) +endmacro() + +# --- BUILD --- + +set(BUN_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src") +set(BUN_DEPS_DIR "${BUN_SRC}/deps") +set(BUN_CODEGEN_SRC "${BUN_SRC}/codegen") + +if(NOT BUN_DEPS_OUT_DIR) + set(BUN_DEPS_OUT_DIR "${BUN_DEPS_DIR}") +endif() + +set(BUN_RAW_SOURCES, "") + +file(GLOB BUN_CPP ${CONFIGURE_DEPENDS} + "${BUN_SRC}/deps/*.cpp" + "${BUN_SRC}/io/*.cpp" + "${BUN_SRC}/bun.js/modules/*.cpp" + "${BUN_SRC}/bun.js/bindings/*.cpp" + "${BUN_SRC}/bun.js/bindings/webcore/*.cpp" + "${BUN_SRC}/bun.js/bindings/sqlite/*.cpp" + "${BUN_SRC}/bun.js/bindings/webcrypto/*.cpp" + "${BUN_SRC}/bun.js/bindings/webcrypto/*/*.cpp" + "${BUN_SRC}/deps/picohttpparser/picohttpparser.c" +) +list(APPEND BUN_RAW_SOURCES ${BUN_CPP}) + +set(USOCKETS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/packages/bun-usockets/src") +file(GLOB USOCKETS_FILES ${CONFIGURE_DEPENDS} + "${USOCKETS_SRC}/*.c" + "${USOCKETS_SRC}/eventing/*.c" + "${USOCKETS_SRC}/internal/*.c" + "${USOCKETS_SRC}/crypto/*.c" + "${USOCKETS_SRC}/crypto/*.cpp" +) +list(APPEND BUN_RAW_SOURCES ${USOCKETS_FILES}) + +# --- Classes Generator --- +file(GLOB BUN_CLASSES_TS ${CONFIGURE_DEPENDS} + "${BUN_SRC}/bun.js/*.classes.ts" + "${BUN_SRC}/bun.js/api/*.classes.ts" + "${BUN_SRC}/bun.js/test/*.classes.ts" + "${BUN_SRC}/bun.js/webcore/*.classes.ts" + "${BUN_SRC}/bun.js/node/*.classes.ts" +) +add_custom_command( + OUTPUT "${BUN_WORKDIR}/codegen/ZigGeneratedClasses.h" + "${BUN_WORKDIR}/codegen/ZigGeneratedClasses.cpp" + "${BUN_WORKDIR}/codegen/ZigGeneratedClasses+lazyStructureHeader.h" + "${BUN_WORKDIR}/codegen/ZigGeneratedClasses+DOMClientIsoSubspaces.h" + "${BUN_WORKDIR}/codegen/ZigGeneratedClasses+DOMIsoSubspaces.h" + "${BUN_WORKDIR}/codegen/ZigGeneratedClasses+lazyStructureImpl.h" + "${BUN_WORKDIR}/codegen/ZigGeneratedClasses.zig" + COMMAND ${BUN_EXECUTABLE} "${BUN_CODEGEN_SRC}/generate-classes.ts" ${BUN_CLASSES_TS} "${BUN_WORKDIR}/codegen" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + MAIN_DEPENDENCY "${BUN_CODEGEN_SRC}/generate-classes.ts" + DEPENDS ${BUN_CLASSES_TS} + VERBATIM + COMMENT "Generating *.classes.ts bindings" +) +list(APPEND BUN_RAW_SOURCES "${BUN_WORKDIR}/codegen/ZigGeneratedClasses.cpp") + +# --- JSSink Generator --- +add_custom_command( + OUTPUT "${BUN_WORKDIR}/codegen/JSSink.cpp" + "${BUN_WORKDIR}/codegen/JSSink.h" + COMMAND ${BUN_EXECUTABLE} "src/codegen/generate-jssink.ts" "${BUN_WORKDIR}/codegen" + VERBATIM + MAIN_DEPENDENCY "src/codegen/generate-jssink.ts" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Generating JSSink" +) +list(APPEND BUN_RAW_SOURCES "${BUN_WORKDIR}/codegen/JSSink.cpp") + +# --- .lut.h Generator --- +if(NOT BUN_LINK_ONLY) + set(BUN_OBJECT_LUT_SOURCES + bun.js/bindings/BunObject.cpp + bun.js/bindings/ZigGlobalObject.lut.txt + bun.js/bindings/JSBuffer.cpp + bun.js/bindings/BunProcess.cpp + bun.js/bindings/ProcessBindingConstants.cpp + bun.js/bindings/ProcessBindingNatives.cpp + ) + set(BUN_HASH_LUT_GENERATOR "${BUN_CODEGEN_SRC}/create-hash-table.ts") + macro(GENERATE_HASH_LUT _input _output _display_name) + add_custom_command( + OUTPUT ${_output} + MAIN_DEPENDENCY ${BUN_HASH_LUT_GENERATOR} + DEPENDS ${_input} + COMMAND ${BUN_EXECUTABLE} ${BUN_HASH_LUT_GENERATOR} ${_input} ${_output} + VERBATIM + COMMENT "Generating ${_display_name}" + ) + # list(APPEND JavaScriptCore_HEADERS ${_output}) + WEBKIT_ADD_SOURCE_DEPENDENCIES(${_input} ${_output}) + endmacro() + foreach(_file ${BUN_OBJECT_LUT_SOURCES}) + if(NOT EXISTS "${BUN_SRC}/${_file}") + message(FATAL_ERROR "Could not find ${_file} needed for LUT generation") + endif() + + get_filename_component(_name ${_file} NAME_WE) + + # workaround for ZigGlobalObject + if(_name MATCHES "ZigGlobalObject") + set(_name "ZigGlobalObject") + endif() + + GENERATE_HASH_LUT(${BUN_SRC}/${_file} ${BUN_WORKDIR}/codegen/${_name}.lut.h ${_name}.lut.h) + endforeach() + + WEBKIT_ADD_SOURCE_DEPENDENCIES(${BUN_SRC}/bun.js/bindings/ZigGlobalObject.cpp ${BUN_WORKDIR}/codegen/ZigGlobalObject.lut.h) +endif() + +# --- Identifier Cache --- +if(NOT NO_CODEGEN) + set(BUN_IDENTIFIER_CACHE_OUT + "${BUN_SRC}/js_lexer/id_continue_bitset.blob" + "${BUN_SRC}/js_lexer/id_continue_bitset.meta.blob" + "${BUN_SRC}/js_lexer/id_start_bitset.blob" + "${BUN_SRC}/js_lexer/id_start_bitset.meta.blob") + add_custom_command( + OUTPUT ${BUN_IDENTIFIER_CACHE_OUT} + MAIN_DEPENDENCY "${BUN_SRC}/js_lexer/identifier_data.zig" + DEPENDS "${BUN_SRC}/js_lexer/identifier_cache.zig" + COMMAND ${ZIG_COMPILER} run "${BUN_SRC}/js_lexer/identifier_data.zig" + VERBATIM + COMMENT "Building Identifier Cache" + ) +endif() + +# --- Bundled TS/JS --- +# Note: It's not worth doing this in parallel at the CMake/Ninja level, because this bundling +# requires all the JS files to be known, but also Bun will use all cores during bundling anyways. +if(NOT NO_CODEGEN) + file(GLOB BUN_TS_MODULES ${CONFIGURE_DEPENDS} + "${BUN_SRC}/js/node/*.ts" + "${BUN_SRC}/js/node/*.js" + "${BUN_SRC}/js/bun/*.js" + "${BUN_SRC}/js/bun/*.ts" + "${BUN_SRC}/js/thirdparty/*.js" + "${BUN_SRC}/js/thirdparty/*.ts" + "${BUN_SRC}/js/internal/*.js" + "${BUN_SRC}/js/internal/*.ts" + ) + file(GLOB BUN_TS_FUNCTIONS ${CONFIGURE_DEPENDS} "${BUN_SRC}/js/builtins/*.ts") + + file(GLOB CODEGEN_FILES ${CONFIGURE_DEPENDS} "${BUN_CODEGEN_SRC}/*.ts") + + add_custom_command( + OUTPUT + "${BUN_WORKDIR}/codegen/InternalModuleRegistryConstants.h" + "${BUN_WORKDIR}/codegen/InternalModuleRegistry+createInternalModuleById.h" + "${BUN_WORKDIR}/codegen/InternalModuleRegistry+enum.h" + "${BUN_WORKDIR}/codegen/InternalModuleRegistry+numberOfModules.h" + "${BUN_WORKDIR}/codegen/NativeModuleImpl.h" + "${BUN_WORKDIR}/codegen/ResolvedSourceTag.zig" + "${BUN_WORKDIR}/codegen/SyntheticModuleType.h" + COMMAND ${BUN_EXECUTABLE} "${BUN_SRC}/codegen/bundle-modules.ts" "--debug=${DEBUG}" "${BUN_WORKDIR}" + DEPENDS ${BUN_TS_MODULES} ${CODEGEN_FILES} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Bundling JS modules" + ) +endif() +WEBKIT_ADD_SOURCE_DEPENDENCIES( + "${BUN_SRC}/bun.js/bindings/InternalModuleRegistry.cpp" + "${BUN_WORKDIR}/codegen/InternalModuleRegistryConstants.h" +) + +add_custom_command( + OUTPUT "${BUN_WORKDIR}/codegen/WebCoreJSBuiltins.cpp" + "${BUN_WORKDIR}/codegen/WebCoreJSBuiltins.h" + COMMAND ${BUN_EXECUTABLE} "${BUN_SRC}/codegen/bundle-functions.ts" "--debug=${DEBUG}" "${BUN_WORKDIR}" + DEPENDS ${BUN_TS_FUNCTIONS} ${CODEGEN_FILES} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Bundling JS builtin functions" +) +list(APPEND BUN_RAW_SOURCES "${BUN_WORKDIR}/codegen/WebCoreJSBuiltins.cpp") + +# --- Peechy API --- +# if(NOT NO_CODEGEN) +# add_custom_command( +# OUTPUT "${BUN_SRC}/api/schema.js" +# "${BUN_SRC}/api/schema.d.ts" +# "${BUN_SRC}/api/schema.zig" +# WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" +# COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/node_modules/.bin/peechy" +# "--schema" "${BUN_SRC}/api/schema.peechy" +# "--esm" "${BUN_SRC}/api/schema.js" +# "--ts" "${BUN_SRC}/api/schema.d.ts" +# "--zig" "${BUN_SRC}/api/schema.zig" +# COMMAND "${ZIG_COMPILER}" "fmt" "src/api/schema.zig" +# COMMAND "${PRETTIER}" "--config=.prettierrc.cjs" "--write" "src/api/schema.js" "src/api/schema.d.ts" +# DEPENDS "${BUN_SRC}/api/schema.peechy" +# COMMENT "Building schema" +# ) +# add_custom_command( +# OUTPUT "${BUN_SRC}/analytics/analytics_schema.zig" +# WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" +# COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/node_modules/.bin/peechy" +# "--schema" "${BUN_SRC}/analytics/schema.peechy" +# "--zig" "${BUN_SRC}/analytics/analytics_schema.zig" +# COMMAND "${ZIG_COMPILER}" "fmt" "${BUN_SRC}/analytics/analytics_schema.zig" +# DEPENDS "${BUN_SRC}/api/schema.peechy" +# COMMENT "Building analytics_schema.zig" +# ) +# endif() + +# --- Runtime.js --- +if(NOT NO_CODEGEN) + add_custom_command( + OUTPUT "src/fallback.out.js" + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + COMMAND "${ESBUILD}" "--target=esnext" "--bundle" "src/fallback.ts" "--format=iife" "--platform=browser" "--minify" "--outfile=src/fallback.out.js" + DEPENDS "src/fallback.ts" + ) +endif() + +# --- Zig Object --- +file(GLOB ZIG_FILES + "${BUN_SRC}/*.zig" + "${BUN_SRC}/**/*.zig" + "${BUN_SRC}/**/**/*.zig" + "${BUN_SRC}/**/**/**/*.zig" +) + +if(NOT BUN_ZIG_OBJ) + set(BUN_ZIG_OBJ "${BUN_WORKDIR}/CMakeFiles/bun-zig.o") +endif() +get_filename_component(BUN_ZIG_OBJ "${BUN_ZIG_OBJ}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") + +set(USES_TERMINAL_NOT_IN_CI "") +if(NOT CI) + set(USES_TERMINAL_NOT_IN_CI "USES_TERMINAL") +endif() + +if(NOT BUN_LINK_ONLY AND NOT BUN_CPP_ONLY) + add_custom_command( + OUTPUT "${BUN_ZIG_OBJ}" + COMMAND + "${ZIG_COMPILER}" "build" "obj" + "-Doutput-file=${BUN_ZIG_OBJ}" + "-Dgenerated-code=${BUN_WORKDIR}/codegen" + "-Dversion=${Bun_VERSION}" + "-Dcanary=$,true,false>" + "-Doptimize=${ZIG_OPTIMIZE}" + "-Dcpu=${CPU_TARGET}" + "-Dtarget=${ZIG_TARGET}" + DEPENDS + "${CMAKE_CURRENT_SOURCE_DIR}/build.zig" + "${ZIG_FILES}" + "${BUN_WORKDIR}/codegen/ZigGeneratedClasses.zig" + "${BUN_WORKDIR}/codegen/ResolvedSourceTag.zig" + "${BUN_IDENTIFIER_CACHE_OUT}" + "${BUN_SRC}/api/schema.zig" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Building zig code" + VERBATIM + # This is here to show Zig's progress indicator + ${USES_TERMINAL_NOT_IN_CI} + ) +endif() + +if(WIN32) + list(APPEND BUN_RAW_SOURCES "${BUN_SRC}/bun.js/bindings/windows/musl-memmem.c") + include_directories("${BUN_SRC}/bun.js/bindings/windows") +endif() + +if (NOT BUN_CPP_ARCHIVE) + # TODO: unified sources + set(BUN_SOURCES ${BUN_RAW_SOURCES}) +else() + # used by ci + set(BUN_SOURCES "") + link_libraries(${BUN_CPP_ARCHIVE}) +endif() + +# -- The Buntime™️ --- +if(NOT BUN_CPP_ONLY) + add_executable(${bun} "${BUN_SOURCES}" "${BUN_ZIG_OBJ}") +else() + add_executable(${bun} "${BUN_SOURCES}") +endif() + +set_target_properties(${bun} PROPERTIES + CXX_STANDARD 20 + CXX_STANDARD_REQUIRED YES + CXX_EXTENSIONS YES + CXX_VISIBILITY_PRESET hidden + C_STANDARD 17 + C_STANDARD_REQUIRED YES + VISIBILITY_INLINES_HIDDEN YES +) + +if(NOT BUN_CPP_ARCHIVE) + string(REPLACE ";" ".o\n " BUN_OBJECT_LIST "${BUN_SOURCES}.o") + string(REPLACE "${BUN_WORKDIR}/" "CMakeFiles/${bun}.dir/" BUN_OBJECT_LIST "${BUN_OBJECT_LIST}") + string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "CMakeFiles/${bun}.dir/" BUN_OBJECT_LIST "${BUN_OBJECT_LIST}") + + write_file("${BUN_WORKDIR}/compile-cpp-only.sh" + "#!/usr/bin/env bash\n" + "set -e\n" + "OBJ_LIST=(\n ${BUN_OBJECT_LIST}\n)\n" + "ninja \${OBJ_LIST[@]}\n" + "${AR} rcvs bun-cpp-objects.a \${OBJ_LIST[@]}\n" + "echo '-> bun-cpp-objects.a'\n" + ) +else() + set_target_properties(${bun} PROPERTIES LINKER_LANGUAGE CXX) +endif() + +# Set /subsystem:console on bun for windows +if(WIN32) + set_target_properties(${bun} PROPERTIES LINK_FLAGS " /SUBSYSTEM:CONSOLE ") +endif() + +add_compile_definitions( + # TODO: are all of these variables strictly necessary? + "_HAS_EXCEPTIONS=0" + "LIBUS_USE_OPENSSL=1" + "UWS_HTTPRESPONSE_NO_WRITEMARK=1" + "LIBUS_USE_BORINGSSL=1" + "WITH_BORINGSSL=1" + "STATICALLY_LINKED_WITH_JavaScriptCore=1" + "STATICALLY_LINKED_WITH_WTF=1" + "STATICALLY_LINKED_WITH_BMALLOC=1" + "BUILDING_WITH_CMAKE=1" + "JSC_OBJC_API_ENABLED=0" + "BUN_SINGLE_THREADED_PER_VM_ENTRY_SCOPE=1" + "NAPI_EXPERIMENTAL=ON" + "NOMINMAX" + "IS_BUILD" + "BUILDING_JSCONLY__" + "ASSERT_ENABLED=$,1,0>" + "BUN_DYNAMIC_JS_LOAD_PATH=\"${BUN_WORKDIR}/js\"" +) +if(NOT ASSERT_ENABLED) + add_compile_definitions("NDEBUG=1") +endif() + +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR}/packages/ + ${CMAKE_CURRENT_SOURCE_DIR}/packages/bun-usockets + ${CMAKE_CURRENT_SOURCE_DIR}/packages/bun-usockets/src + ${CMAKE_CURRENT_SOURCE_DIR}/src/bun.js/bindings + ${CMAKE_CURRENT_SOURCE_DIR}/src/bun.js/bindings/webcore + ${CMAKE_CURRENT_SOURCE_DIR}/src/bun.js/bindings/webcrypto + ${CMAKE_CURRENT_SOURCE_DIR}/src/bun.js/bindings/sqlite + ${CMAKE_CURRENT_SOURCE_DIR}/src/bun.js/modules + ${CMAKE_CURRENT_SOURCE_DIR}/src/js/builtins + ${CMAKE_CURRENT_SOURCE_DIR}/src/napi + ${CMAKE_CURRENT_SOURCE_DIR}/src/deps + ${CMAKE_CURRENT_SOURCE_DIR}/src/deps/picohttpparser + ${WEBKIT_INCLUDE_DIR} + "${BUN_WORKDIR}/codegen" +) + +# --- clang and linker flags --- +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + if(NOT MSVC) + target_compile_options(${bun} PUBLIC -g3 -O1) + endif() + add_compile_definitions("BUN_DEBUG=1") +elseif(CMAKE_BUILD_TYPE STREQUAL "Release") + if (MSVC) + target_compile_options(${bun} PUBLIC /O2) + else() + target_compile_options(${bun} PUBLIC -O3 -flto=full -emit-llvm) + endif() +endif() + +if(NOT MSVC) + if(NOT CI) + target_compile_options(${bun} PRIVATE -fdiagnostics-color=always) + endif() + + target_compile_options(${bun} PUBLIC + -march=${CPU_TARGET} + -mtune=${CPU_TARGET} + -fconstexpr-steps=1271242 + -fconstexpr-depth=27 + -fno-exceptions + -fvisibility=hidden + -fvisibility-inlines-hidden + -fno-rtti + -ferror-limit=${ERROR_LIMIT} + -fPIC + -fno-omit-frame-pointer + ) + target_link_options(${bun} PUBLIC + -fuse-ld=lld + ) + string(APPEND CMAKE_CXX_FLAGS " -std=c++2a ") +else() # MSVC + string(APPEND SUPPRESS_WARNING_NUMBERS + # JSC deletes operator delete to prevent accidental use + "/wd4291 " + # we use #pragma mark in some places + "/wd4068" + ) + string(APPEND CMAKE_CXX_FLAGS " /EHsc /GR-") + string(APPEND CMAKE_C_FLAGS " /EHsc /GR- ${SUPPRESS_WARNING_NUMBERS} /experimental:c11atomics /std:c17") + string(APPEND CMAKE_CXX_FLAGS " /Zc:__cplusplus /Zc:inline /bigobj ${SUPPRESS_WARNING_NUMBERS}") +endif() + +if(APPLE) + if(ARCH STREQUAL "x86_64") + set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14") + else() + set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0") + endif() + + target_link_options(${bun} PUBLIC "-dead_strip") + target_link_options(${bun} PUBLIC "-dead_strip_dylibs") + target_link_options(${bun} PUBLIC "-exported_symbols_list" "${BUN_SRC}/symbols.txt") + set_target_properties(${bun} PROPERTIES LINK_DEPENDS "${BUN_SRC}/symbols.txt") + + target_link_options(${bun} PUBLIC "-fno-keep-static-consts") + target_link_libraries(${bun} PRIVATE "resolv") +endif() + +if(UNIX AND NOT APPLE) + target_link_options(${bun} PUBLIC + "-static-libstdc++" + "-static-libgcc" + "-fuse-ld=lld" + "-Wl,-z,now" + "-Wl,--as-needed" + "-Wl,--gc-sections" + "-Wl,-z,stack-size=12800000" + "-Wl,--wrap=fcntl" + "-Wl,--wrap=fcntl64" + "-Wl,--wrap=stat64" + "-Wl,--wrap=pow" + "-Wl,--wrap=exp" + "-Wl,--wrap=log" + "-Wl,--wrap=log2" + "-Wl,--wrap=lstat" + "-Wl,--wrap=stat" + "-Wl,--wrap=fstat" + "-Wl,--wrap=fstatat" + "-Wl,--wrap=lstat64" + "-Wl,--wrap=stat64" + "-Wl,--wrap=fstat64" + "-Wl,--wrap=fstatat64" + "-Wl,--wrap=mknod" + "-Wl,--wrap=mknodat" + "-Wl,--wrap=statx " + "-Wl,--compress-debug-sections=zlib" + "-Bsymbolics-functions" + "-rdynamic" + "-Wl,--dynamic-list=${BUN_SRC}/symbols.dyn" + "-Wl,--version-script=${BUN_SRC}/linker.lds" + ) + + target_link_libraries(${bun} PRIVATE "c") + target_link_libraries(${bun} PRIVATE "pthread") + target_link_libraries(${bun} PRIVATE "dl") + + target_link_libraries(${bun} PRIVATE "libatomic.a") + + target_link_libraries(${bun} PRIVATE "${WEBKIT_LIB_DIR}/libicudata.a") + target_link_libraries(${bun} PRIVATE "${WEBKIT_LIB_DIR}/libicui18n.a") + target_link_libraries(${bun} PRIVATE "${WEBKIT_LIB_DIR}/libicuuc.a") + + set_target_properties(${bun} PROPERTIES LINK_DEPENDS "${BUN_SRC}/linker.lds") + set_target_properties(${bun} PROPERTIES LINK_DEPENDS "${BUN_SRC}/symbols.dyn") +endif() + +if(WIN32) + add_compile_definitions( + "WIN32" + "_WINDOWS" + "_CRT_SECURE_NO_WARNINGS" + "WIN32_LEAN_AND_MEAN=1" + ) + + set_property(TARGET ${bun} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreadedDLL") +endif() + +# --- ICU --- +if(APPLE) + # TODO: a much better check can be done to find this path + find_path( + ICU4C_DIR NAMES lib/libicudata.a + PATHS ENV PATH /usr/local/opt/icu4c /opt/homebrew/opt/icu4c + ) + find_path( + ICONV_DIR NAMES lib/libiconv.a + PATHS ENV PATH /usr/local/opt/libiconv /opt/homebrew/opt/libiconv + ) + + target_link_libraries(${bun} PRIVATE "icucore") + target_link_libraries(${bun} PRIVATE "${ICONV_DIR}/lib/libiconv.a") + target_link_libraries(${bun} PRIVATE "${ICU4C_DIR}/lib/libicudata.a") + target_link_libraries(${bun} PRIVATE "${ICU4C_DIR}/lib/libicui18n.a") + target_link_libraries(${bun} PRIVATE "${ICU4C_DIR}/lib/libicuuc.a") + include_directories(${ICU4C_DIR}/include) +endif() + +# --- Stripped Binary "bun" +if(CMAKE_BUILD_TYPE STREQUAL "Release" AND NOT WIN32) + # add_custom_command( + # TARGET ${bun} + # POST_BUILD + # COMMAND ${DSYMUTIL} -o ${BUN_WORKDIR}/bun.dSYM ${BUN_WORKDIR}/${bun} + # COMMENT "Stripping Symbols" + # ) + add_custom_command( + TARGET ${bun} + POST_BUILD + COMMAND ${STRIP} -s -x -S -o ${BUN_WORKDIR}/bun ${BUN_WORKDIR}/${bun} + COMMENT "Stripping Symbols" + ) +endif() + +# --- Dependencies --- + +if(USE_CUSTOM_ZLIB) + include_directories(${BUN_DEPS_DIR}/zlib) + if(WIN32) + target_link_libraries(${bun} PRIVATE "${BUN_DEPS_OUT_DIR}/zlibstatic.lib") + else() + target_link_libraries(${bun} PRIVATE "${BUN_DEPS_OUT_DIR}/libz.a") + endif() +else() + if(WIN32) + target_link_libraries(${bun} PRIVATE "${BUN_DEPS_DIR}/zlib_maybethisworks.lib") + else() + find_package(ZLIB REQUIRED) + target_link_libraries(${bun} PRIVATE ZLIB::ZLIB) + endif() +endif() + +if(USE_CUSTOM_BORINGSSL) + include_directories(${BUN_DEPS_DIR}/boringssl/include) + if (WIN32) + target_link_libraries(${bun} PRIVATE "${BUN_DEPS_OUT_DIR}/crypto.lib") + target_link_libraries(${bun} PRIVATE "${BUN_DEPS_OUT_DIR}/ssl.lib") + target_link_libraries(${bun} PRIVATE "${BUN_DEPS_OUT_DIR}/decrepit.lib") + else() + target_link_libraries(${bun} PRIVATE "${BUN_DEPS_OUT_DIR}/libcrypto.a") + target_link_libraries(${bun} PRIVATE "${BUN_DEPS_OUT_DIR}/libssl.a") + target_link_libraries(${bun} PRIVATE "${BUN_DEPS_OUT_DIR}/libdecrepit.a") + endif() +else() + include(FindBoringSSL) + FindBoringSSL(${bun}) +endif() + +if(USE_CUSTOM_LIBARCHIVE) + include_directories(${BUN_DEPS_DIR}/libarchive/include) + if (WIN32) + target_link_libraries(${bun} PRIVATE "${BUN_DEPS_OUT_DIR}/archive.lib") + else() + target_link_libraries(${bun} PRIVATE "${BUN_DEPS_OUT_DIR}/libarchive.a") + endif() +else() + find_package(LibArchive REQUIRED) + target_link_libraries(${bun} PRIVATE LibArchive::LibArchive) +endif() + +if(USE_CUSTOM_MIMALLOC) + include_directories(${BUN_DEPS_DIR}/mimalloc/include) + if (WIN32) + target_link_libraries(${bun} PRIVATE "${BUN_DEPS_OUT_DIR}/mimalloc-static.lib") + elseif(APPLE) + # https://github.com/microsoft/mimalloc/issues/512 + # Linking mimalloc via object file on macOS x64 can cause heap corruption + target_link_libraries(${bun} PRIVATE "${BUN_DEPS_OUT_DIR}/libmimalloc.a") + else() + target_link_libraries(${bun} PRIVATE "${BUN_DEPS_OUT_DIR}/libmimalloc.o") + endif() +else() + find_package(mimalloc REQUIRED) + target_link_libraries(${bun} PRIVATE mimalloc) +endif() + +if(USE_CUSTOM_ZSTD) + include_directories(${BUN_DEPS_DIR}/zstd/include) + if (WIN32) + target_link_libraries(${bun} PRIVATE "${BUN_DEPS_OUT_DIR}/zstd.lib") + else() + target_link_libraries(${bun} PRIVATE "${BUN_DEPS_OUT_DIR}/libzstd.a") + endif() +else() + find_package(zstd CONFIG REQUIRED) + target_link_libraries(${bun} PRIVATE zstd::libzstd) +endif() + +if(USE_CUSTOM_CARES) + include_directories(${BUN_DEPS_DIR}/c-ares/include) + if (WIN32) + target_link_libraries(${bun} PRIVATE "${BUN_DEPS_OUT_DIR}/cares.lib") + else() + target_link_libraries(${bun} PRIVATE "${BUN_DEPS_OUT_DIR}/libcares.a") + endif() +else() + find_package(c-ares CONFIG REQUIRED) + target_link_libraries(${bun} PRIVATE c-ares::cares) +endif() + +if(USE_CUSTOM_BASE64) + include_directories(${BUN_DEPS_DIR}/base64/include) + if (WIN32) + target_link_libraries(${bun} PRIVATE "${BUN_DEPS_OUT_DIR}/base64.lib") + else() + target_link_libraries(${bun} PRIVATE "${BUN_DEPS_OUT_DIR}/libbase64.a") + endif() +else() + find_package(base64 REQUIRED) + target_link_libraries(${bun} PRIVATE base64::base64) +endif() + +if(NOT WIN32) + if (USE_CUSTOM_TINYCC) + if (WIN32) + # target_link_libraries(${bun} PRIVATE "${BUN_DEPS_OUT_DIR}/tcc.lib") + target_link_libraries(${bun} PRIVATE "${BUN_DEPS_OUT_DIR}/tcc.lib") + else() + target_link_libraries(${bun} PRIVATE "${BUN_DEPS_OUT_DIR}/libtcc.a") + endif() + else() + find_package(tinycc REQUIRED) + target_link_libraries(${bun} PRIVATE tinycc::tinycc) + endif() +endif() + +if(USE_CUSTOM_LOLHTML) + if (WIN32) + target_link_libraries(${bun} PRIVATE "${BUN_DEPS_OUT_DIR}/lolhtml.lib") + else() + target_link_libraries(${bun} PRIVATE "${BUN_DEPS_OUT_DIR}/liblolhtml.a") + endif() +else() + find_package(lolhtml REQUIRED) + target_link_libraries(${bun} PRIVATE lolhtml::lolhtml) +endif() + +if(WIN32) + if (USE_CUSTOM_LIBUV) + target_link_libraries(${bun} PRIVATE "${BUN_DEPS_OUT_DIR}/uv.lib") + else() + find_package(libuv CONFIG REQUIRED ) + target_link_libraries(${bun} PRIVATE $,libuv::uv_a,libuv::uv>) + endif() + message(STATUS "Found libuv: ${libuv_LIBRARIES}") +endif() + +if(USE_STATIC_SQLITE) + add_library(sqlite3 STATIC src/bun.js/bindings/sqlite/sqlite3.c) + target_include_directories(sqlite3 PUBLIC src/bun.js/bindings/sqlite) + target_compile_definitions(sqlite3 PRIVATE + "SQLITE_ENABLE_COLUMN_METADATA=" + "SQLITE_MAX_VARIABLE_NUMBER=250000" + "SQLITE_ENABLE_RTREE=1" + "SQLITE_ENABLE_FTS3=1" + "SQLITE_ENABLE_FTS3_PARENTHESIS=1" + "SQLITE_ENABLE_FTS5=1" + "SQLITE_ENABLE_JSON1=1" + ) + target_link_libraries(${bun} PRIVATE sqlite3) + message(STATUS "Using static sqlite3") + target_compile_definitions(${bun} PRIVATE "LAZY_LOAD_SQLITE=0") +else() + message(STATUS "Using dynamicly linked sqlite3") + target_compile_definitions(${bun} PRIVATE "LAZY_LOAD_SQLITE=1") +endif() + +if(NOT MSVC) + target_link_libraries(${bun} PRIVATE "${WEBKIT_LIB_DIR}/libWTF.a") + target_link_libraries(${bun} PRIVATE "${WEBKIT_LIB_DIR}/libJavaScriptCore.a") + target_link_libraries(${bun} PRIVATE "${WEBKIT_LIB_DIR}/libbmalloc.a") +else() + target_link_libraries(${bun} PRIVATE "${WEBKIT_LIB_DIR}/WTF.lib") + target_link_libraries(${bun} PRIVATE "${WEBKIT_LIB_DIR}/JavaScriptCore.lib") + + if (WIN32) + string (APPEND CMAKE_CXX_FLAGS + " /external:anglebrackets /Gs- /Zi" + ) + string (APPEND CMAKE_FLAGS + " /external:anglebrackets /Gs- /Zi" + ) + set_target_properties(${bun} PROPERTIES LINK_FLAGS " /SUBSYSTEM:CONSOLE /STACK:4194304,2097152") + endif() + + if (DEFINED ENV{VCPKG_ROOT}) + include_directories($ENV{VCPKG_ROOT}/installed/x64-windows/include) + endif() + + # include_directories(C:/Users/windo/Build/WebKit/WebKitBuild/WTF/DerivedSources) + # include_directories(C:/Users/windo/Build/WebKit/WebKitBuild/WTF/Headers) + + target_include_directories(${bun} PUBLIC C:/Users/windo/Code/WebKit/WebKitLibraries/win/include) + target_link_directories(${bun} PUBLIC C:/Users/windo/Code/WebKit/WebKitLibraries/win/lib64) + target_link_directories(${bun} PUBLIC C:/Users/windo/Code/lib64) + + target_link_libraries(${bun} PUBLIC icuuc icudt icutu icuio icuin icutest) + target_link_libraries(${bun} PUBLIC winmm ws2_32 bcrypt ntdll kernel32 shell32 shlwapi advapi32 vcruntime ucrt legacy_stdio_definitions) +endif() + +if(NO_CODEGEN) + message(STATUS "NO_CODEGEN is ON, a handful of build steps will not run.") +endif() \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 4d7e83ffd049b..8d2a0a6826499 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,9 @@ +# This Dockerfile is used by CI workflows to build Bun. It is not intended as a development +# environment, or to be used as a base image for other projects. +# +# You likely want this image instead: https://hub.docker.com/r/oven/bun ARG DEBIAN_FRONTEND=noninteractive ARG GITHUB_WORKSPACE=/build -ARG ZIG_PATH=${GITHUB_WORKSPACE}/zig ARG WEBKIT_DIR=${GITHUB_WORKSPACE}/bun-webkit ARG BUN_RELEASE_DIR=${GITHUB_WORKSPACE}/bun-release ARG BUN_DEPS_OUT_DIR=${GITHUB_WORKSPACE}/bun-deps @@ -8,123 +11,138 @@ ARG BUN_DIR=${GITHUB_WORKSPACE}/bun ARG CPU_TARGET=native ARG ARCH=x86_64 ARG BUILD_MACHINE_ARCH=x86_64 -ARG TRIPLET=${ARCH}-linux-gnu ARG BUILDARCH=amd64 -ARG WEBKIT_TAG=2023-oct3-4 -ARG ZIG_TAG=jul1 -ARG ZIG_VERSION="0.12.0-dev.899+027aabf49" -ARG WEBKIT_BASENAME="bun-webkit-linux-$BUILDARCH" - -ARG ZIG_FOLDERNAME=zig-linux-${BUILD_MACHINE_ARCH}-${ZIG_VERSION} -ARG ZIG_FILENAME=${ZIG_FOLDERNAME}.tar.xz -ARG WEBKIT_URL="https://github.com/oven-sh/WebKit/releases/download/$WEBKIT_TAG/${WEBKIT_BASENAME}.tar.gz" -ARG ZIG_URL="https://ziglang.org/builds/${ZIG_FILENAME}" -ARG GIT_SHA="" -ARG BUN_BASE_VERSION=1.0 +ARG TRIPLET=${ARCH}-linux-gnu +ARG GIT_SHA="unknown" -FROM bitnami/minideb:bullseye as bun-base +ARG BUN_VERSION="1.0.7" +ARG NODE_VERSION="20" +ARG LLVM_VERSION="16" +ARG ZIG_VERSION="0.12.0-dev.1297+a9e66ed73" -RUN install_packages ca-certificates curl wget lsb-release software-properties-common gnupg gnupg1 gnupg2 && \ - echo "deb https://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-16 main" > /etc/apt/sources.list.d/llvm.list && \ - echo "deb-src https://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-16 main" >> /etc/apt/sources.list.d/llvm.list && \ - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \ - curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \ - install_packages \ - cmake \ - file \ - git \ - gnupg \ - libc-dev \ - libxml2 \ - libxml2-dev \ - make \ - ninja-build \ - perl \ - python3 \ - rsync \ - ruby \ - unzip \ - clang-16 \ - lld-16 \ - lldb-16 \ - clangd-16 \ - xz-utils \ - bash tar gzip ccache nodejs && \ - npm install -g esbuild +ARG SCCACHE_BUCKET +ARG SCCACHE_REGION +ARG SCCACHE_S3_USE_SSL +ARG SCCACHE_ENDPOINT +ARG AWS_ACCESS_KEY_ID +ARG AWS_SECRET_ACCESS_KEY -ENV CXX=clang++-16 -ENV CC=clang-16 +FROM bitnami/minideb:bullseye as bun-base ARG DEBIAN_FRONTEND -ARG GITHUB_WORKSPACE -ARG WEBKIT_DIR -ARG BUN_RELEASE_DIR -ARG BUN_DEPS_OUT_DIR +ARG BUN_VERSION +ARG NODE_VERSION +ARG LLVM_VERSION +ARG BUILD_MACHINE_ARCH ARG BUN_DIR -ARG BUILDARCH -ARG ZIG_PATH -ARG WEBKIT_URL -ARG ZIG_URL -ARG ZIG_FOLDERNAME -ARG ZIG_FILENAME +ARG BUN_DEPS_OUT_DIR -ENV WEBKIT_OUT_DIR=${WEBKIT_DIR} +ENV CI 1 ENV BUILDARCH=${BUILDARCH} +ENV BUN_DEPS_OUT_DIR=${BUN_DEPS_OUT_DIR} + +ENV CXX=clang++-16 +ENV CC=clang-16 ENV AR=/usr/bin/llvm-ar-16 -ENV ZIG "${ZIG_PATH}/zig" -ENV PATH="$ZIG/bin:$PATH" ENV LD=lld-16 -RUN mkdir -p $BUN_DIR $BUN_DEPS_OUT_DIR - -FROM bun-base as bun-base-with-zig-and-webkit +ENV SCCACHE_BUCKET=${SCCACHE_BUCKET} +ENV SCCACHE_REGION=${SCCACHE_REGION} +ENV SCCACHE_S3_USE_SSL=${SCCACHE_S3_USE_SSL} +ENV SCCACHE_ENDPOINT=${SCCACHE_ENDPOINT} +ENV AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} +ENV AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} + +RUN apt-get update -y \ + && install_packages \ + ca-certificates \ + curl \ + gnupg \ + && echo "deb https://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-${LLVM_VERSION} main" > /etc/apt/sources.list.d/llvm.list \ + && echo "deb-src https://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-${LLVM_VERSION} main" >> /etc/apt/sources.list.d/llvm.list \ + && curl -fsSL "https://apt.llvm.org/llvm-snapshot.gpg.key" | apt-key add - \ + && echo "deb https://deb.nodesource.com/node_${NODE_VERSION}.x nodistro main" > /etc/apt/sources.list.d/nodesource.list \ + && curl -fsSL "https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key" | apt-key add - \ + && echo "deb https://apt.kitware.com/ubuntu/ focal main" > /etc/apt/sources.list.d/kitware.list \ + && curl -fsSL "https://apt.kitware.com/keys/kitware-archive-latest.asc" | apt-key add - \ + && install_packages \ + wget \ + bash \ + software-properties-common \ + build-essential \ + autoconf \ + automake \ + libtool \ + pkg-config \ + clang-${LLVM_VERSION} \ + lld-${LLVM_VERSION} \ + lldb-${LLVM_VERSION} \ + clangd-${LLVM_VERSION} \ + make \ + cmake \ + ninja-build \ + file \ + libc-dev \ + libxml2 \ + libxml2-dev \ + xz-utils \ + git \ + tar \ + rsync \ + gzip \ + unzip \ + perl \ + python3 \ + ruby \ + golang \ + nodejs \ + && ln -s /usr/bin/clang-${LLVM_VERSION} /usr/bin/clang \ + && ln -s /usr/bin/clang++-${LLVM_VERSION} /usr/bin/clang++ \ + && ln -s /usr/bin/lld-${LLVM_VERSION} /usr/bin/lld \ + && ln -s /usr/bin/lldb-${LLVM_VERSION} /usr/bin/lldb \ + && ln -s /usr/bin/clangd-${LLVM_VERSION} /usr/bin/clangd \ + && ln -s /usr/bin/llvm-ar-${LLVM_VERSION} /usr/bin/llvm-ar \ + && arch="$(dpkg --print-architecture)" \ + && case "${arch##*-}" in \ + amd64) variant="x64";; \ + arm64) variant="aarch64";; \ + *) echo "error: unsupported architecture: $arch"; exit 1 ;; \ + esac \ + && wget "https://github.com/oven-sh/bun/releases/download/bun-v${BUN_VERSION}/bun-linux-${variant}.zip" \ + && unzip bun-linux-${variant}.zip \ + && mv bun-linux-${variant}/bun /usr/bin/bun \ + && ln -s /usr/bin/bun /usr/bin/bunx \ + && rm -rf bun-linux-${variant} bun-linux-${variant}.zip \ + && mkdir -p ${BUN_DIR} ${BUN_DEPS_OUT_DIR} +# && if [ -n "${SCCACHE_BUCKET}" ]; then \ +# echo "Setting up sccache" \ +# && wget https://github.com/mozilla/sccache/releases/download/v0.5.4/sccache-v0.5.4-${BUILD_MACHINE_ARCH}-unknown-linux-musl.tar.gz \ +# && tar xf sccache-v0.5.4-${BUILD_MACHINE_ARCH}-unknown-linux-musl.tar.gz \ +# && mv sccache-v0.5.4-${BUILD_MACHINE_ARCH}-unknown-linux-musl/sccache /usr/bin/sccache \ +# && rm -rf sccache-v0.5.4-${BUILD_MACHINE_ARCH}-unknown-linux-musl.tar.gz sccache-v0.5.4-${BUILD_MACHINE_ARCH}-unknown-linux-musl \ + +FROM bun-base as bun-base-with-zig + +ARG ZIG_VERSION +ARG BUILD_MACHINE_ARCH +ARG ZIG_FOLDERNAME=zig-linux-${BUILD_MACHINE_ARCH}-${ZIG_VERSION} +ARG ZIG_FILENAME=${ZIG_FOLDERNAME}.tar.xz +ARG ZIG_URL="https://ziglang.org/builds/${ZIG_FILENAME}" WORKDIR $GITHUB_WORKSPACE ADD $ZIG_URL . -RUN tar xf ${ZIG_FILENAME} && \ - rm ${ZIG_FILENAME} && mv ${ZIG_FOLDERNAME} zig; - - - -WORKDIR $GITHUB_WORKSPACE - -ARG GITHUB_WORKSPACE -ARG WEBKIT_DIR -ARG BUN_RELEASE_DIR -ARG BUN_DEPS_OUT_DIR -ARG BUN_DIR -ARG BUILDARCH -ARG ZIG_PATH -ARG WEBKIT_URL -ARG ZIG_URL -ARG WEBKIT_BASENAME - -ADD ${WEBKIT_URL} . - -RUN mkdir -p ${WEBKIT_DIR} && cd ${GITHUB_WORKSPACE} && \ - gunzip ${WEBKIT_BASENAME}.tar.gz && tar -xf ${WEBKIT_BASENAME}.tar && \ - cat ${WEBKIT_DIR}/include/cmakeconfig.h > /dev/null - -LABEL org.opencontainers.image.title="bun base image with zig & webkit ${BUILDARCH} (glibc)" -LABEL org.opencontainers.image.source=https://github.com/oven-sh/bun +RUN tar xf ${ZIG_FILENAME} \ + && mv ${ZIG_FOLDERNAME}/lib /usr/lib/zig \ + && mv ${ZIG_FOLDERNAME}/zig /usr/bin/zig \ + && rm -rf ${ZIG_FILENAME} ${ZIG_FOLDERNAME} FROM bun-base as c-ares -ARG DEBIAN_FRONTEND -ARG GITHUB_WORKSPACE -ARG ZIG_PATH -# Directory extracts to "bun-webkit" -ARG WEBKIT_DIR -ARG BUN_RELEASE_DIR -ARG BUN_DEPS_OUT_DIR ARG BUN_DIR ARG CPU_TARGET ENV CPU_TARGET=${CPU_TARGET} - ENV CCACHE_DIR=/ccache -ENV JSC_BASE_DIR=${WEBKIT_DIR} -ENV LIB_ICU_PATH=${WEBKIT_DIR}/lib COPY Makefile ${BUN_DIR}/Makefile COPY src/deps/c-ares ${BUN_DIR}/src/deps/c-ares @@ -133,20 +151,11 @@ WORKDIR $BUN_DIR RUN --mount=type=cache,target=/ccache cd $BUN_DIR && make c-ares && rm -rf ${BUN_DIR}/src/deps/c-ares ${BUN_DIR}/Makefile - FROM bun-base as lolhtml -RUN install_packages build-essential && curl https://sh.rustup.rs -sSf | sh -s -- -y +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y -ARG DEBIAN_FRONTEND -ARG GITHUB_WORKSPACE -ARG ZIG_PATH -# Directory extracts to "bun-webkit" -ARG WEBKIT_DIR -ARG BUN_RELEASE_DIR -ARG BUN_DEPS_OUT_DIR ARG BUN_DIR - ARG CPU_TARGET ENV CPU_TARGET=${CPU_TARGET} @@ -155,88 +164,57 @@ COPY src/deps/lol-html ${BUN_DIR}/src/deps/lol-html ENV CCACHE_DIR=/ccache -RUN --mount=type=cache,target=/ccache export PATH=$PATH:$HOME/.cargo/bin && export CC=$(which clang-16) && cd ${BUN_DIR} && \ - make lolhtml && rm -rf src/deps/lol-html Makefile +RUN --mount=type=cache,target=/ccache export PATH=$PATH:$HOME/.cargo/bin && cd ${BUN_DIR} && \ + make lolhtml && rm -rf src/deps/lol-html Makefile FROM bun-base as mimalloc -ARG DEBIAN_FRONTEND -ARG GITHUB_WORKSPACE -ARG ZIG_PATH -# Directory extracts to "bun-webkit" -ARG WEBKIT_DIR -ARG BUN_RELEASE_DIR -ARG BUN_DEPS_OUT_DIR ARG BUN_DIR +ARG CPU_TARGET +ENV CPU_TARGET=${CPU_TARGET} COPY Makefile ${BUN_DIR}/Makefile COPY src/deps/mimalloc ${BUN_DIR}/src/deps/mimalloc -ARG CPU_TARGET -ENV CPU_TARGET=${CPU_TARGET} ENV CCACHE_DIR=/ccache RUN --mount=type=cache,target=/ccache cd ${BUN_DIR} && \ - make mimalloc && rm -rf src/deps/mimalloc Makefile + make mimalloc && rm -rf src/deps/mimalloc Makefile FROM bun-base as zlib -ARG DEBIAN_FRONTEND -ARG GITHUB_WORKSPACE -ARG ZIG_PATH -# Directory extracts to "bun-webkit" -ARG WEBKIT_DIR -ARG BUN_RELEASE_DIR -ARG BUN_DEPS_OUT_DIR ARG BUN_DIR ARG CPU_TARGET ENV CPU_TARGET=${CPU_TARGET} +ENV CCACHE_DIR=/ccache COPY Makefile ${BUN_DIR}/Makefile COPY src/deps/zlib ${BUN_DIR}/src/deps/zlib WORKDIR $BUN_DIR -ENV CCACHE_DIR=/ccache - RUN --mount=type=cache,target=/ccache cd $BUN_DIR && \ - make zlib && rm -rf src/deps/zlib Makefile + make zlib && rm -rf src/deps/zlib Makefile FROM bun-base as libarchive -ARG DEBIAN_FRONTEND -ARG GITHUB_WORKSPACE -ARG ZIG_PATH -# Directory extracts to "bun-webkit" -ARG WEBKIT_DIR -ARG BUN_RELEASE_DIR -ARG BUN_DEPS_OUT_DIR ARG BUN_DIR ARG CPU_TARGET ENV CPU_TARGET=${CPU_TARGET} +ENV CCACHE_DIR=/ccache RUN install_packages autoconf automake libtool pkg-config COPY Makefile ${BUN_DIR}/Makefile COPY src/deps/libarchive ${BUN_DIR}/src/deps/libarchive -ENV CCACHE_DIR=/ccache WORKDIR $BUN_DIR - RUN --mount=type=cache,target=/ccache cd $BUN_DIR && \ - make libarchive && rm -rf src/deps/libarchive Makefile - - + make libarchive && rm -rf src/deps/libarchive Makefile FROM bun-base as tinycc -ARG DEBIAN_FRONTEND -ARG GITHUB_WORKSPACE -ARG ZIG_PATH -# Directory extracts to "bun-webkit" -ARG WEBKIT_DIR -ARG BUN_RELEASE_DIR ARG BUN_DEPS_OUT_DIR ARG BUN_DIR ARG CPU_TARGET @@ -248,13 +226,6 @@ FROM bun-base as boringssl RUN install_packages golang -ARG DEBIAN_FRONTEND -ARG GITHUB_WORKSPACE -ARG ZIG_PATH -# Directory extracts to "bun-webkit" -ARG WEBKIT_DIR -ARG BUN_RELEASE_DIR -ARG BUN_DEPS_OUT_DIR ARG BUN_DIR ARG CPU_TARGET ENV CPU_TARGET=${CPU_TARGET} @@ -268,42 +239,8 @@ ENV CCACHE_DIR=/ccache RUN --mount=type=cache,target=/ccache cd ${BUN_DIR} && make boringssl && rm -rf src/deps/boringssl Makefile -FROM bun-base as uws - -ARG DEBIAN_FRONTEND -ARG GITHUB_WORKSPACE -ARG ZIG_PATH -# Directory extracts to "bun-webkit" -ARG WEBKIT_DIR -ARG BUN_RELEASE_DIR -ARG BUN_DEPS_OUT_DIR -ARG BUN_DIR -ARG CPU_TARGET -ENV CPU_TARGET=${CPU_TARGET} - -COPY Makefile ${BUN_DIR}/Makefile -COPY packages/bun-uws ${BUN_DIR}/packages/bun-uws -COPY packages/bun-usockets ${BUN_DIR}/packages/bun-usockets -COPY src/deps/zlib ${BUN_DIR}/src/deps/zlib -COPY src/deps/boringssl/include ${BUN_DIR}/src/deps/boringssl/include -COPY src/deps/c-ares/include ${BUN_DIR}/src/deps/c-ares/include -COPY src/deps/libuwsockets.cpp ${BUN_DIR}/src/deps/libuwsockets.cpp -COPY src/deps/_libusockets.h ${BUN_DIR}/src/deps/_libusockets.h - -WORKDIR $BUN_DIR - -RUN cd $BUN_DIR && \ - make uws && rm -rf packages/bun-uws Makefile - FROM bun-base as base64 -ARG DEBIAN_FRONTEND -ARG GITHUB_WORKSPACE -ARG ZIG_PATH -# Directory extracts to "bun-webkit" -ARG WEBKIT_DIR -ARG BUN_RELEASE_DIR -ARG BUN_DEPS_OUT_DIR ARG BUN_DIR ARG CPU_TARGET ENV CPU_TARGET=${CPU_TARGET} @@ -314,372 +251,184 @@ COPY src/deps/base64 ${BUN_DIR}/src/deps/base64 WORKDIR $BUN_DIR RUN cd $BUN_DIR && \ - make base64 && rm -rf src/deps/base64 Makefile + make base64 && rm -rf src/deps/base64 Makefile -FROM bun-base as picohttp +FROM bun-base as zstd -ARG DEBIAN_FRONTEND -ARG GITHUB_WORKSPACE -ARG ZIG_PATH -# Directory extracts to "bun-webkit" -ARG WEBKIT_DIR -ARG BUN_RELEASE_DIR -ARG BUN_DEPS_OUT_DIR ARG BUN_DIR + ARG CPU_TARGET ENV CPU_TARGET=${CPU_TARGET} +ENV CCACHE_DIR=/ccache + COPY Makefile ${BUN_DIR}/Makefile -COPY src/deps/picohttpparser ${BUN_DIR}/src/deps/picohttpparser -COPY src/deps/*.c ${BUN_DIR}/src/deps/ -COPY src/deps/*.h ${BUN_DIR}/src/deps/ +COPY src/deps/zstd ${BUN_DIR}/src/deps/zstd +COPY .prettierrc.cjs ${BUN_DIR}/.prettierrc.cjs WORKDIR $BUN_DIR -RUN cd $BUN_DIR && \ - make picohttp - +RUN --mount=type=cache,target=/ccache cd $BUN_DIR && make zstd -FROM bun-base-with-zig-and-webkit as identifier_cache +FROM bun-base-with-zig as bun-identifier-cache ARG DEBIAN_FRONTEND ARG GITHUB_WORKSPACE -ARG ZIG_PATH -# Directory extracts to "bun-webkit" -ARG WEBKIT_DIR -ARG BUN_RELEASE_DIR -ARG BUN_DEPS_OUT_DIR -ARG BUN_DIR ARG CPU_TARGET +ARG BUN_DIR ENV CPU_TARGET=${CPU_TARGET} WORKDIR $BUN_DIR -COPY Makefile ${BUN_DIR}/Makefile COPY src/js_lexer/identifier_data.zig ${BUN_DIR}/src/js_lexer/identifier_data.zig COPY src/js_lexer/identifier_cache.zig ${BUN_DIR}/src/js_lexer/identifier_cache.zig -RUN cd $BUN_DIR && \ - make identifier-cache && rm -rf zig-cache Makefile +RUN cd $BUN_DIR \ + && zig run src/js_lexer/identifier_data.zig \ + && rm -rf zig-cache -FROM bun-base-with-zig-and-webkit as node_fallbacks +FROM bun-base as bun-node-fallbacks -ARG DEBIAN_FRONTEND -ARG GITHUB_WORKSPACE -ARG ZIG_PATH -# Directory extracts to "bun-webkit" -ARG WEBKIT_DIR -ARG BUN_RELEASE_DIR -ARG BUN_DEPS_OUT_DIR ARG BUN_DIR -ARG CPU_TARGET -ENV CPU_TARGET=${CPU_TARGET} WORKDIR $BUN_DIR - -COPY Makefile ${BUN_DIR}/Makefile COPY src/node-fallbacks ${BUN_DIR}/src/node-fallbacks -RUN cd $BUN_DIR && \ - make node-fallbacks && rm -rf src/node-fallbacks/node_modules Makefile -FROM bun-base-with-zig-and-webkit as prepare_release +RUN cd $BUN_DIR/src/node-fallbacks \ + && bun install --frozen-lockfile \ + && bun run build \ + && rm -rf src/node-fallbacks/node_modules -ARG DEBIAN_FRONTEND -ARG GITHUB_WORKSPACE -ARG ZIG_PATH -# Directory extracts to "bun-webkit" -ARG WEBKIT_DIR -ARG BUN_RELEASE_DIR -ARG BUN_DEPS_OUT_DIR -ARG BUN_DIR -ARG CPU_TARGET -ENV CPU_TARGET=${CPU_TARGET} - -WORKDIR $BUN_DIR - -COPY ./root.zig ${BUN_DIR}/root.zig -COPY ./src ${BUN_DIR}/src -COPY ./build.zig ${BUN_DIR}/build.zig -COPY ./completions ${BUN_DIR}/completions -COPY ./packages ${BUN_DIR}/packages -COPY ./src/build-id ${BUN_DIR}/src/build-id -COPY ./package.json ${BUN_DIR}/package.json -COPY ./misctools ${BUN_DIR}/misctools -COPY Makefile ${BUN_DIR}/Makefile - - -FROM prepare_release as compile_release_obj - -ARG DEBIAN_FRONTEND -ARG GITHUB_WORKSPACE -ARG ZIG_PATH -# Directory extracts to "bun-webkit" -ARG WEBKIT_DIR -ARG BUN_RELEASE_DIR -ARG BUN_DEPS_OUT_DIR -ARG BUN_DIR -ARG CPU_TARGET -ENV CPU_TARGET=${CPU_TARGET} +FROM bun-base as bun-webkit -COPY Makefile ${BUN_DIR}/Makefile -COPY .prettierrc.cjs ${BUN_DIR}/.prettierrc.cjs +ARG BUILDARCH -WORKDIR $BUN_DIR +COPY CMakeLists.txt ${BUN_DIR}/CMakeLists.txt -ENV JSC_BASE_DIR=${WEBKIT_DIR} -ENV LIB_ICU_PATH=${WEBKIT_DIR}/lib -ARG ARCH -ARG TRIPLET -ARG CPU_TARGET -ENV CPU_TARGET=${CPU_TARGET} -ARG GIT_SHA -ARG BUN_BASE_VERSION +RUN mkdir ${BUN_DIR}/bun-webkit \ + && WEBKIT_TAG=$(grep 'set(WEBKIT_TAG' "${BUN_DIR}/CMakeLists.txt" | awk '{print $2}' | cut -f 1 -d ')') \ + && WEBKIT_URL="https://github.com/oven-sh/WebKit/releases/download/autobuild-${WEBKIT_TAG}/bun-webkit-linux-${BUILDARCH}-lto.tar.gz" \ + && echo "Downloading ${WEBKIT_URL}" \ + && curl -fsSL "${WEBKIT_URL}" | tar -xz -C ${BUN_DIR}/bun-webkit --strip-components=1 -ENV BUN_BASE_VERSION=${BUN_BASE_VERSION} -ENV GIT_SHA=${GIT_SHA} +FROM bun-base as bun-cpp-objects -COPY --from=identifier_cache ${BUN_DIR}/src/js_lexer/*.blob ${BUN_DIR}/src/js_lexer/ -COPY --from=node_fallbacks ${BUN_DIR}/src/node-fallbacks/out ${BUN_DIR}/src/node-fallbacks/out +COPY --from=bun-webkit ${BUN_DIR}/bun-webkit ${BUN_DIR}/bun-webkit -COPY ./src/build-id ${BUN_DIR}/src/build-id +COPY packages ${BUN_DIR}/packages +COPY src ${BUN_DIR}/src +COPY CMakeLists.txt ${BUN_DIR}/CMakeLists.txt +COPY src/deps/boringssl/include ${BUN_DIR}/src/deps/boringssl/include ENV CCACHE_DIR=/ccache -RUN --mount=type=cache,target=/ccache cd $BUN_DIR && mkdir -p src/bun.js/bindings-obj && rm -rf $HOME/.cache zig-cache && make prerelease && \ - mkdir -p $BUN_RELEASE_DIR && \ - OUTPUT_DIR=/tmp/bun-${TRIPLET}-${GIT_SHA} $ZIG_PATH/zig build obj -Doutput-dir=/tmp/bun-${TRIPLET}-${GIT_SHA} -Doptimize=ReleaseFast -Dtarget="${TRIPLET}" -Dcpu="${CPU_TARGET}" && \ - cp /tmp/bun-${TRIPLET}-${GIT_SHA}/bun.o /tmp/bun-${TRIPLET}-${GIT_SHA}/bun-${BUN_BASE_VERSION}.$(cat ${BUN_DIR}/src/build-id).o && cd / && rm -rf $BUN_DIR +RUN --mount=type=cache,target=/ccache mkdir ${BUN_DIR}/build \ + && cd ${BUN_DIR}/build \ + && mkdir -p tmp_modules tmp_functions js codegen \ + && cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release -DBUN_CPP_ONLY=1 -DWEBKIT_DIR=/build/bun/bun-webkit \ + && bash compile-cpp-only.sh -FROM scratch as build_release_obj +FROM bun-base-with-zig as bun-codegen-for-zig -ARG DEBIAN_FRONTEND -ARG GITHUB_WORKSPACE -ARG ZIG_PATH -# Directory extracts to "bun-webkit" -ARG WEBKIT_DIR -ARG BUN_RELEASE_DIR -ARG BUN_DEPS_OUT_DIR -ARG GIT_SHA -ARG TRIPLET -ARG BUN_DIR -ARG CPU_TARGET -ENV CPU_TARGET=${CPU_TARGET} - -COPY --from=compile_release_obj /tmp/bun-${TRIPLET}-${GIT_SHA}/*.o / - -FROM prepare_release as compile_cpp - -ARG DEBIAN_FRONTEND -ARG GITHUB_WORKSPACE -ARG ZIG_PATH -# Directory extracts to "bun-webkit" -ARG WEBKIT_DIR -ARG BUN_RELEASE_DIR -ARG BUN_DEPS_OUT_DIR -ARG BUN_DIR -ARG CPU_TARGET -ENV CPU_TARGET=${CPU_TARGET} - -COPY Makefile ${BUN_DIR}/Makefile -COPY .prettierrc.cjs ${BUN_DIR}/.prettierrc.cjs +COPY package.json bun.lockb Makefile .gitmodules .prettierrc.cjs ${BUN_DIR}/ +COPY src/runtime ${BUN_DIR}/src/runtime +COPY src/runtime.js src/runtime.footer*.js src/react-refresh.js ${BUN_DIR}/src/ +COPY packages/bun-error ${BUN_DIR}/packages/bun-error +COPY src/fallback.ts ${BUN_DIR}/src/fallback.ts +COPY src/api ${BUN_DIR}/src/api WORKDIR $BUN_DIR -ENV JSC_BASE_DIR=${WEBKIT_DIR} -ENV LIB_ICU_PATH=${WEBKIT_DIR}/lib +# TODO: move away from Makefile entirely +RUN bun install --frozen-lockfile \ + && make runtime_js fallback_decoder bun_error \ + && rm -rf src/runtime src/fallback.ts node_modules bun.lockb package.json Makefile -# Required for webcrypto bindings -COPY src/deps/boringssl/include ${BUN_DIR}/src/deps/boringssl/include - -ENV CCACHE_DIR=/ccache - -RUN --mount=type=cache,target=/ccache cd $BUN_DIR && mkdir -p src/bun.js/bindings-obj && rm -rf $HOME/.cache zig-cache && mkdir -p $BUN_RELEASE_DIR && \ - make release-bindings -j10 && mv src/bun.js/bindings-obj/* /tmp +FROM bun-base-with-zig as bun-compile-zig-obj -FROM bun-base as sqlite - -ARG DEBIAN_FRONTEND -ARG GITHUB_WORKSPACE ARG ZIG_PATH -# Directory extracts to "bun-webkit" -ARG WEBKIT_DIR -ARG BUN_RELEASE_DIR -ARG BUN_DEPS_OUT_DIR -ARG BUN_DIR - +ARG TRIPLET +ARG GIT_SHA ARG CPU_TARGET -ENV CPU_TARGET=${CPU_TARGET} -ENV CCACHE_DIR=/ccache +COPY *.zig package.json CMakeLists.txt ${BUN_DIR}/ +COPY completions ${BUN_DIR}/completions +COPY packages ${BUN_DIR}/packages +COPY src ${BUN_DIR}/src -COPY Makefile ${BUN_DIR}/Makefile -COPY src/bun.js/bindings/sqlite ${BUN_DIR}/src/bun.js/bindings/sqlite -COPY .prettierrc.cjs ${BUN_DIR}/.prettierrc.cjs +COPY --from=bun-identifier-cache ${BUN_DIR}/src/js_lexer/*.blob ${BUN_DIR}/src/js_lexer/ +COPY --from=bun-node-fallbacks ${BUN_DIR}/src/node-fallbacks/out ${BUN_DIR}/src/node-fallbacks/out +COPY --from=bun-codegen-for-zig ${BUN_DIR}/src/*.out.js ${BUN_DIR}/src/*.out.refresh.js ${BUN_DIR}/src/ +COPY --from=bun-codegen-for-zig ${BUN_DIR}/packages/bun-error/dist ${BUN_DIR}/packages/bun-error/dist WORKDIR $BUN_DIR -ENV JSC_BASE_DIR=${WEBKIT_DIR} -ENV LIB_ICU_PATH=${WEBKIT_DIR}/lib +RUN mkdir -p build \ + && bun run $BUN_DIR/src/codegen/bundle-modules-fast.ts $BUN_DIR/build \ + && cd build \ + && cmake .. \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCPU_TARGET="${CPU_TARGET}" \ + -DZIG_TARGET="${TRIPLET}" \ + -DWEBKIT_DIR="omit" \ + -DNO_CONFIGURE_DEPENDS=1 \ + -DNO_CODEGEN=1 \ + -DBUN_ZIG_OBJ="/tmp/bun-zig.o" \ + && ONLY_ZIG=1 ninja "/tmp/bun-zig.o" \ + && echo "-> /tmp/bun-zig.o" -RUN --mount=type=cache,target=/ccache cd $BUN_DIR && make sqlite - -FROM bun-base as zstd - -ARG DEBIAN_FRONTEND -ARG GITHUB_WORKSPACE -ARG ZIG_PATH -# Directory extracts to "bun-webkit" -ARG WEBKIT_DIR -ARG BUN_RELEASE_DIR -ARG BUN_DEPS_OUT_DIR -ARG BUN_DIR +FROM scratch as build_release_obj ARG CPU_TARGET ENV CPU_TARGET=${CPU_TARGET} -ENV CCACHE_DIR=/ccache - -COPY Makefile ${BUN_DIR}/Makefile -COPY src/deps/zstd ${BUN_DIR}/src/deps/zstd -COPY .prettierrc.cjs ${BUN_DIR}/.prettierrc.cjs - -WORKDIR $BUN_DIR - -ENV JSC_BASE_DIR=${WEBKIT_DIR} -ENV LIB_ICU_PATH=${WEBKIT_DIR}/lib - -RUN --mount=type=cache,target=/ccache cd $BUN_DIR && make zstd - -FROM scratch as build_release_cpp +COPY --from=bun-compile-zig-obj /tmp/bun-zig.o / -COPY --from=compile_cpp /tmp/*.o / +FROM bun-base as bun-link -FROM prepare_release as build_release - -ARG DEBIAN_FRONTEND -ARG GITHUB_WORKSPACE -ARG ZIG_PATH -# Directory extracts to "bun-webkit" -ARG WEBKIT_DIR -ARG BUN_RELEASE_DIR -ARG BUN_DEPS_OUT_DIR -ARG BUN_DIR ARG CPU_TARGET ENV CPU_TARGET=${CPU_TARGET} -COPY Makefile ${BUN_DIR}/Makefile -COPY .prettierrc.cjs ${BUN_DIR}/.prettierrc.cjs - WORKDIR $BUN_DIR -ENV JSC_BASE_DIR=${WEBKIT_DIR} -ENV LIB_ICU_PATH=${WEBKIT_DIR}/lib - -COPY --from=zlib ${BUN_DEPS_OUT_DIR}/*.a ${BUN_DEPS_OUT_DIR}/ -COPY --from=base64 ${BUN_DEPS_OUT_DIR}/*.a ${BUN_DEPS_OUT_DIR}/ -COPY --from=libarchive ${BUN_DEPS_OUT_DIR}/*.a ${BUN_DEPS_OUT_DIR}/ -COPY --from=boringssl ${BUN_DEPS_OUT_DIR}/*.a ${BUN_DEPS_OUT_DIR}/ -COPY --from=lolhtml ${BUN_DEPS_OUT_DIR}/*.a ${BUN_DEPS_OUT_DIR}/ -COPY --from=mimalloc ${BUN_DEPS_OUT_DIR}/*.o ${BUN_DEPS_OUT_DIR}/ -COPY --from=picohttp ${BUN_DEPS_OUT_DIR}/*.o ${BUN_DEPS_OUT_DIR}/ -COPY --from=sqlite ${BUN_DEPS_OUT_DIR}/*.o ${BUN_DEPS_OUT_DIR}/ -COPY --from=zstd ${BUN_DEPS_OUT_DIR}/*.a ${BUN_DEPS_OUT_DIR}/ -COPY --from=tinycc ${BUN_DEPS_OUT_DIR}/*.a ${BUN_DEPS_OUT_DIR}/ -COPY --from=uws ${BUN_DEPS_OUT_DIR}/*.a ${BUN_DEPS_OUT_DIR}/ -COPY --from=uws ${BUN_DEPS_OUT_DIR}/*.o ${BUN_DEPS_OUT_DIR}/ -COPY --from=c-ares ${BUN_DEPS_OUT_DIR}/*.a ${BUN_DEPS_OUT_DIR}/ - -COPY --from=build_release_obj /*.o /tmp -COPY --from=build_release_cpp /*.o ${BUN_DIR}/src/bun.js/bindings-obj/ -COPY --from=build_release_cpp /*.a ${BUN_DEPS_OUT_DIR}/ - -RUN cd $BUN_DIR && mkdir -p ${BUN_RELEASE_DIR} && make bun-relink copy-to-bun-release-dir && \ - rm -rf $HOME/.cache zig-cache misctools package.json build-id completions build.zig $(BUN_DIR)/packages - - +RUN mkdir -p build bun-webkit + +# lol +COPY src/bun.js/bindings/sqlite/sqlite3.c ${BUN_DIR}/src/bun.js/bindings/sqlite/sqlite3.c + +COPY src/symbols.dyn src/linker.lds ${BUN_DIR}/src/ + +COPY CMakeLists.txt ${BUN_DIR}/CMakeLists.txt +COPY --from=zlib ${BUN_DEPS_OUT_DIR}/* ${BUN_DEPS_OUT_DIR}/ +COPY --from=base64 ${BUN_DEPS_OUT_DIR}/* ${BUN_DEPS_OUT_DIR}/ +COPY --from=libarchive ${BUN_DEPS_OUT_DIR}/* ${BUN_DEPS_OUT_DIR}/ +COPY --from=boringssl ${BUN_DEPS_OUT_DIR}/* ${BUN_DEPS_OUT_DIR}/ +COPY --from=lolhtml ${BUN_DEPS_OUT_DIR}/* ${BUN_DEPS_OUT_DIR}/ +COPY --from=mimalloc ${BUN_DEPS_OUT_DIR}/* ${BUN_DEPS_OUT_DIR}/ +COPY --from=zstd ${BUN_DEPS_OUT_DIR}/* ${BUN_DEPS_OUT_DIR}/ +COPY --from=tinycc ${BUN_DEPS_OUT_DIR}/* ${BUN_DEPS_OUT_DIR}/ +COPY --from=c-ares ${BUN_DEPS_OUT_DIR}/* ${BUN_DEPS_OUT_DIR}/ +COPY --from=bun-compile-zig-obj /tmp/bun-zig.o ${BUN_DIR}/build/bun-zig.o +COPY --from=bun-cpp-objects ${BUN_DIR}/build/bun-cpp-objects.a ${BUN_DIR}/build/bun-cpp-objects.a +COPY --from=bun-cpp-objects ${BUN_DIR}/bun-webkit/lib ${BUN_DIR}/bun-webkit/lib + +WORKDIR $BUN_DIR/build + +RUN cmake .. \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUN_LINK_ONLY=1 \ + -DBUN_ZIG_OBJ="${BUN_DIR}/build/bun-zig.o" \ + -DBUN_CPP_ARCHIVE="${BUN_DIR}/build/bun-cpp-objects.a" \ + -DWEBKIT_DIR="${BUN_DIR}/bun-webkit" \ + -DBUN_DEPS_OUT_DIR="${BUN_DEPS_OUT_DIR}" \ + && ninja \ + && mkdir -p /build/out \ + && mv bun bun-profile /build/out \ + && rm -rf ${BUN_DIR} ${BUN_DEPS_OUT_DIR} FROM scratch as artifact -ARG DEBIAN_FRONTEND -ARG GITHUB_WORKSPACE -ARG ZIG_PATH -# Directory extracts to "bun-webkit" -ARG WEBKIT_DIR -ARG BUN_RELEASE_DIR -ARG BUN_DEPS_OUT_DIR -ARG BUN_DIR - -COPY --from=build_release ${BUN_RELEASE_DIR}/bun /bun -COPY --from=build_release ${BUN_RELEASE_DIR}/bun-profile /bun-profile -COPY --from=build_release ${BUN_DEPS_OUT_DIR}/* /bun-dependencies -COPY --from=build_release_obj /*.o /bun-obj - - -FROM prepare_release as build_unit - -ARG DEBIAN_FRONTEND -ARG GITHUB_WORKSPACE -ARG ZIG_PATH -# Directory extracts to "bun-webkit" -ARG WEBKIT_DIR -ARG BUN_RELEASE_DIR -ARG BUN_DEPS_OUT_DIR -ARG BUN_DIR - -WORKDIR $BUN_DIR - -ENV PATH "$ZIG_PATH:$PATH" -ENV LIB_ICU_PATH "${WEBKIT_DIR}/lib" - -CMD make headers \ - api \ - analytics \ - bun_error \ - fallback_decoder \ - bindings -j10 && \ - make \ - run-all-unit-tests - - - -# FROM bun-test-base as test_base - -# ARG DEBIAN_FRONTEND=noninteractive -# ARG GITHUB_WORKSPACE=/build -# ARG ZIG_PATH=${GITHUB_WORKSPACE}/zig -# # Directory extracts to "bun-webkit" -# ARG WEBKIT_DIR=${GITHUB_WORKSPACE}/bun-webkit -# ARG BUN_RELEASE_DIR=${GITHUB_WORKSPACE}/bun-release -# ARG BUN_DEPS_OUT_DIR=${GITHUB_WORKSPACE}/bun-deps -# ARG BUN_DIR=${GITHUB_WORKSPACE}/bun - -# ARG BUILDARCH=amd64 -# RUN groupadd -r chromium && useradd -d ${BUN_DIR} -M -r -g chromium -G audio,video chromium \ -# && mkdir -p /home/chromium/Downloads && chown -R chromium:chromium /home/chromium - -# USER chromium -# WORKDIR $BUN_DIR - -# ENV NPM_CLIENT bun -# ENV PATH "${BUN_DIR}/packages/bun-linux-x64:${BUN_DIR}/packages/bun-linux-aarch64:$PATH" -# ENV CI 1 -# ENV BROWSER_EXECUTABLE /usr/bin/chromium - -# COPY ./test ${BUN_DIR}/test -# COPY Makefile ${BUN_DIR}/Makefile -# COPY package.json ${BUN_DIR}/package.json -# COPY .docker/run-test.sh ${BUN_DIR}/run-test.sh -# COPY ./bun.lockb ${BUN_DIR}/bun.lockb - -# # # We don't want to worry about architecture differences in this image -# COPY --from=release /opt/bun/bin/bun ${BUN_DIR}/packages/bun-linux-aarch64/bun -# COPY --from=release /opt/bun/bin/bun ${BUN_DIR}/packages/bun-linux-x64/bun - -# USER root -# RUN chgrp -R chromium ${BUN_DIR} && chmod g+rwx ${BUN_DIR} && chown -R chromium:chromium ${BUN_DIR} -# USER chromium - -# CMD [ "bash", "run-test.sh" ] - -# FROM release +COPY --from=bun-link /build/out / \ No newline at end of file diff --git a/Makefile b/Makefile index 16fbbfb4fe7c2..b95810342d13c 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,6 @@ endif MIN_MACOS_VERSION ?= $(DEFAULT_MIN_MACOS_VERSION) BUN_BASE_VERSION = 1.0 - CI ?= false AR= @@ -66,7 +65,7 @@ PACKAGE_JSON_VERSION = $(BUN_BASE_VERSION).$(BUILD_ID) BUN_BUILD_TAG = bun-v$(PACKAGE_JSON_VERSION) BUN_RELEASE_BIN = $(PACKAGE_DIR)/bun PRETTIER ?= $(shell which prettier 2>/dev/null || echo "./node_modules/.bin/prettier") -ESBUILD = $(shell which esbuild 2>/dev/null || echo "./node_modules/.bin/esbuild") +ESBUILD = "$(shell which esbuild 2>/dev/null || echo "./node_modules/.bin/esbuild")" DSYMUTIL ?= $(shell which dsymutil 2>/dev/null || which dsymutil-15 2>/dev/null) WEBKIT_DIR ?= $(realpath src/bun.js/WebKit) WEBKIT_RELEASE_DIR ?= $(WEBKIT_DIR)/WebKitBuild/Release @@ -74,7 +73,7 @@ WEBKIT_DEBUG_DIR ?= $(WEBKIT_DIR)/WebKitBuild/Debug WEBKIT_RELEASE_DIR_LTO ?= $(WEBKIT_DIR)/WebKitBuild/ReleaseLTO -NPM_CLIENT ?= $(shell which bun 2>/dev/null || which npm 2>/dev/null) +NPM_CLIENT = "$(shell which bun 2>/dev/null || which npm 2>/dev/null)" ZIG ?= $(shell which zig 2>/dev/null || echo -e "error: Missing zig. Please make sure zig is in PATH. Or set ZIG=/path/to-zig-executable") # We must use the same compiler version for the JavaScriptCore bindings and JavaScriptCore @@ -187,11 +186,6 @@ BUN_CFLAGS = $(MACOS_MIN_FLAG) $(MARCH_NATIVE) $(OPTIMIZATION_LEVEL) -fno-excep BUN_TMP_DIR := /tmp/make-bun CFLAGS=$(CFLAGS_WITHOUT_MARCH) $(MARCH_NATIVE) -DEFAULT_USE_BMALLOC := 1 - - -USE_BMALLOC ?= DEFAULT_USE_BMALLOC - # Set via postinstall ifeq (,$(realpath $(JSC_BASE_DIR))) JSC_BASE_DIR = $(realpath $(firstword $(wildcard bun-webkit))) @@ -380,9 +374,7 @@ ICU_FLAGS ?= # Ideally, we could just look up the linker search paths ifeq ($(OS_NAME),linux) LIB_ICU_PATH ?= $(JSC_LIB) - ICU_FLAGS += $(LIB_ICU_PATH)/libicuuc.a $(LIB_ICU_PATH)/libicudata.a $(LIB_ICU_PATH)/libicui18n.a -else -LIB_ICU_PATH ?= $(BUN_DEPS_DIR) +ICU_FLAGS += $(LIB_ICU_PATH)/libicuuc.a $(LIB_ICU_PATH)/libicudata.a $(LIB_ICU_PATH)/libicui18n.a endif ifeq ($(OS_NAME),darwin) @@ -764,7 +756,7 @@ USOCKETS_DIR = $(BUN_DIR)/packages/bun-usockets USOCKETS_SRC_DIR = $(USOCKETS_DIR)/src usockets: - rm -rf $(USOCKETS_DIR)/*.i $(USOCKETS_DIR)/*.bc $(USOCKETS_DIR)/*.o $(USOCKETS_DIR)/*.s $(USOCKETS_DIR)/*.ii $(USOCKETS_DIR)/*.s + rm -rf $(USOCKETS_DIR)/*.i $(USOCKETS_DIR)/*.bc $(USOCKETS_DIR)/*.o $(USOCKETS_DIR)/*.s $(USOCKETS_DIR)/*.ii $(USOCKETS_DIR)/*.s $(BUN_DEPS_OUT_DIR)/libusockets.a cd $(USOCKETS_DIR) && $(CC_WITH_CCACHE) -I$(USOCKETS_SRC_DIR) -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc $(EMIT_LLVM_FOR_RELEASE) $(MACOS_MIN_FLAG) -fPIC $(CFLAGS) $(UWS_CC_FLAGS) -save-temps -I$(BUN_DEPS_DIR)/uws/uSockets/src $(UWS_LDFLAGS) -g $(DEFAULT_LINKER_FLAGS) $(PLATFORM_LINKER_FLAGS) $(OPTIMIZATION_LEVEL) -c $(wildcard $(USOCKETS_SRC_DIR)/*.c) $(wildcard $(USOCKETS_SRC_DIR)/**/*.c) cd $(USOCKETS_DIR) && $(CXX_WITH_CCACHE) -I$(USOCKETS_SRC_DIR) -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc $(EMIT_LLVM_FOR_RELEASE) $(MACOS_MIN_FLAG) -fPIC $(CXXFLAGS) $(UWS_CXX_FLAGS) -save-temps -I$(BUN_DEPS_DIR)/uws/uSockets/src $(UWS_LDFLAGS) -g $(DEFAULT_LINKER_FLAGS) $(PLATFORM_LINKER_FLAGS) $(OPTIMIZATION_LEVEL) -c $(wildcard $(USOCKETS_SRC_DIR)/*.cpp) $(wildcard $(USOCKETS_SRC_DIR)/**/*.cpp) cd $(USOCKETS_DIR) && $(AR) rcvs $(BUN_DEPS_OUT_DIR)/libusockets.a $(USOCKETS_DIR)/*.{o,bc} @@ -833,10 +825,10 @@ fallback_decoder: .PHONY: runtime_js runtime_js: - @NODE_ENV=production $(ESBUILD) --define:process.env.NODE_ENV="production" --target=esnext --bundle src/runtime/index.ts --format=iife --platform=browser --global-name=BUN_RUNTIME --minify --external:/bun:* > src/runtime.out.js; cat src/runtime.footer.js >> src/runtime.out.js - @NODE_ENV=production $(ESBUILD) --define:process.env.NODE_ENV="production" --target=esnext --bundle src/runtime/index-with-refresh.ts --format=iife --platform=browser --global-name=BUN_RUNTIME --minify --external:/bun:* > src/runtime.out.refresh.js; cat src/runtime.footer.with-refresh.js >> src/runtime.out.refresh.js - @NODE_ENV=production $(ESBUILD) --define:process.env.NODE_ENV="production" --target=esnext --bundle src/runtime/index-without-hmr.ts --format=iife --platform=node --global-name=BUN_RUNTIME --minify --external:/bun:* > src/runtime.node.pre.out.js; cat src/runtime.node.pre.out.js src/runtime.footer.node.js > src/runtime.node.out.js - @NODE_ENV=production $(ESBUILD) --define:process.env.NODE_ENV="production" --target=esnext --bundle src/runtime/index-without-hmr.ts --format=iife --platform=node --global-name=BUN_RUNTIME --minify --external:/bun:* > src/runtime.bun.pre.out.js; cat src/runtime.bun.pre.out.js src/runtime.footer.bun.js > src/runtime.bun.out.js + @NODE_ENV=production $(ESBUILD) --define:process.env.NODE_ENV=\"production\" --target=esnext --bundle src/runtime/index.ts --format=iife --platform=browser --global-name=BUN_RUNTIME --minify --external:/bun:* > src/runtime.out.js; cat src/runtime.footer.js >> src/runtime.out.js + @NODE_ENV=production $(ESBUILD) --define:process.env.NODE_ENV=\"production\" --target=esnext --bundle src/runtime/index-with-refresh.ts --format=iife --platform=browser --global-name=BUN_RUNTIME --minify --external:/bun:* > src/runtime.out.refresh.js; cat src/runtime.footer.with-refresh.js >> src/runtime.out.refresh.js + @NODE_ENV=production $(ESBUILD) --define:process.env.NODE_ENV=\"production\" --target=esnext --bundle src/runtime/index-without-hmr.ts --format=iife --platform=node --global-name=BUN_RUNTIME --minify --external:/bun:* > src/runtime.node.pre.out.js; cat src/runtime.node.pre.out.js src/runtime.footer.node.js > src/runtime.node.out.js + @NODE_ENV=production $(ESBUILD) --define:process.env.NODE_ENV=\"production\" --target=esnext --bundle src/runtime/index-without-hmr.ts --format=iife --platform=node --global-name=BUN_RUNTIME --minify --external:/bun:* > src/runtime.bun.pre.out.js; cat src/runtime.bun.pre.out.js src/runtime.footer.bun.js > src/runtime.bun.out.js .PHONY: runtime_js_dev runtime_js_dev: @@ -1485,12 +1477,12 @@ wasm-return1: $(ZIG) build-lib -OReleaseSmall test/bun.js/wasm-return-1-test.zig -femit-bin=test/bun.js/wasm-return-1-test.wasm -target wasm32-freestanding generate-classes: - bun src/bun.js/scripts/generate-classes.ts + bun src/codegen/generate-classes.ts $(ZIG) fmt src/bun.js/bindings/generated_classes.zig $(CLANG_FORMAT) -i src/bun.js/bindings/ZigGeneratedClasses.h src/bun.js/bindings/ZigGeneratedClasses.cpp generate-sink: - bun src/bun.js/scripts/generate-jssink.js + bun src/codegen/generate-jssink.js $(CLANG_FORMAT) -i src/bun.js/bindings/JSSink.cpp src/bun.js/bindings/JSSink.h ./src/bun.js/scripts/create_hash_table src/bun.js/bindings/JSSink.cpp > src/bun.js/bindings/JSSinkLookupTable.h $(SED) -i -e 's/#include "Lookup.h"//' src/bun.js/bindings/JSSinkLookupTable.h @@ -1919,40 +1911,17 @@ bun: vendor identifier-cache build-obj bun-link-lld-release bun-codesign-release static-hash-table: bun src/js/_codegen/static-hash-tables.ts -.PHONY: cpp -cpp: ## compile src/js/builtins + all c++ code then link - @make clean-bindings js - @make static-hash-table - @make bindings -j$(CPU_COUNT) - @make link - -.PHONY: cpp -cpp-no-link: - @make clean-bindings js - @make bindings -j$(CPU_COUNT) - -.PHONY: zig -zig: ## compile zig code then link - @make mkdir-dev dev-obj link - -.PHONY: zig-no-link -zig-no-link: - @make mkdir-dev dev-obj - -.PHONY: dev -dev: # combo of `make cpp` and `make zig` - @make cpp-no-link zig-no-link -j2 - @make link - -.PHONY: setup -setup: vendor-dev identifier-cache clean-bindings - make jsc-check dev - @echo "" - @echo "First build complete!" - @echo "\"bun-debug\" is available at $(DEBUG_BIN)/bun-debug" - @echo "" - -.PHONY: help -help: ## to print this help - @echo "For detailed build instructions, see https://bun.sh/docs/project/contributing" - @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9_-]+:.*?## / {gsub("\\\\n",sprintf("\n%22c",""), $$2);printf "\033[36m%-20s\033[0m \t\t%s\n", $$1, $$2}' $(MAKEFILE_LIST) \ No newline at end of file +cpp: + echo makefile is deprecated - use `cmake` / `bun run build` + +zig: + echo makefile is deprecated - use `cmake` / `bun run build` + +dev: + echo makefile is deprecated - use `cmake` / `bun run build` + +setup: + echo makefile is deprecated - use `cmake` / `bun run build` + +help: + echo makefile is deprecated - use `cmake` / `bun run build` diff --git a/bench/snippets/async-overhead.mjs b/bench/snippets/async-overhead.mjs index 7af987bff0c54..e285c7edd6f3c 100644 --- a/bench/snippets/async-overhead.mjs +++ b/bench/snippets/async-overhead.mjs @@ -6,23 +6,30 @@ bench("await 1", async function () { return await 1; }); -function callnextTick(resolve) { - process.nextTick(resolve); -} +if (typeof process !== "undefined") { + bench("process.nextTick x 100", async function () { + var remaining = 100; + var cb, promise; + promise = new Promise(resolve => { + cb = resolve; + }); -function awaitNextTick() { - return new Promise(callnextTick); -} + for (let i = 0; i < 100; i++) { + process.nextTick(() => { + if (--remaining === 0) cb(); + }); + } -bench("promise.nextTick", async function () { - return awaitNextTick(); -}); + return promise; + }); + + bench("await 1 x 100", async function () { + for (let i = 0; i < 100; i++) await 1; + }); +} bench("await new Promise(resolve => resolve())", async function () { await new Promise(resolve => resolve()); }); -bench("Promise.all(Array.from({length: 100}, () => new Promise((resolve) => resolve())))", async function () { - return Promise.all(Array.from({ length: 100 }, () => Promise.resolve(1))); -}); await run(); diff --git a/build.zig b/build.zig index d18e3252a183d..5b094713fe5fc 100644 --- a/build.zig +++ b/build.zig @@ -1,6 +1,7 @@ -const required_zig_version = "0.12.0-dev.899+027aabf49"; - +const recommended_zig_version = "0.12.0-dev.1297+a9e66ed73"; +const zig_version = @import("builtin").zig_version; const std = @import("std"); + const pathRel = std.fs.path.relative; const Wyhash = @import("./src/wyhash.zig").Wyhash; var is_debug_build = false; @@ -13,6 +14,11 @@ fn moduleSource(comptime out: []const u8) FileSource { } } +fn exists(path: []const u8) bool { + _ = std.fs.openFileAbsolute(path, .{ .mode = .read_only }) catch return false; + return true; +} + const color_map = std.ComptimeStringMap([]const u8, .{ &.{ "black", "30m" }, &.{ "blue", "34m" }, @@ -48,11 +54,37 @@ fn addInternalPackages(b: *Build, step: *CompileStep, _: std.mem.Allocator, _: [ }; step.addModule("async_io", io); + + step.addModule("zlib-internal", brk: { + if (target.isWindows()) { + break :brk b.createModule(.{ .source_file = FileSource.relative("src/deps/zlib.win32.zig") }); + } + + break :brk b.createModule(.{ .source_file = FileSource.relative("src/deps/zlib.posix.zig") }); + }); + + var async_: *Module = brk: { + if (target.isDarwin() or target.isLinux() or target.isFreeBSD()) { + break :brk b.createModule(.{ + .source_file = FileSource.relative("src/async/posix_event_loop.zig"), + }); + } else if (target.isWindows()) { + break :brk b.createModule(.{ + .source_file = FileSource.relative("src/async/windows_event_loop.zig"), + }); + } + + break :brk b.createModule(.{ + .source_file = FileSource.relative("src/async/stub_event_loop.zig"), + }); + }; + step.addModule("async", async_); } const BunBuildOptions = struct { canary: bool = false, sha: [:0]const u8 = "", + version: []const u8 = "", baseline: bool = false, bindgen: bool = false, sizegen: bool = false, @@ -61,6 +93,8 @@ const BunBuildOptions = struct { runtime_js_version: u64 = 0, fallback_html_version: u64 = 0, + tinycc: bool = true, + pub fn updateRuntime(this: *BunBuildOptions) anyerror!void { if (std.fs.cwd().openFile("src/runtime.out.js", .{ .mode = .read_only })) |file| { defer file.close(); @@ -92,6 +126,11 @@ const BunBuildOptions = struct { pub fn step(this: BunBuildOptions, b: anytype) *std.build.OptionsStep { var opts = b.addOptions(); opts.addOption(@TypeOf(this.canary), "is_canary", this.canary); + opts.addOption( + std.SemanticVersion, + "version", + std.SemanticVersion.parse(this.version) catch @panic(b.fmt("Invalid version: {s}", .{this.version})), + ); opts.addOption(@TypeOf(this.sha), "sha", this.sha); opts.addOption(@TypeOf(this.baseline), "baseline", this.baseline); opts.addOption(@TypeOf(this.bindgen), "bindgen", this.bindgen); @@ -99,6 +138,7 @@ const BunBuildOptions = struct { opts.addOption(@TypeOf(this.base_path), "base_path", this.base_path); opts.addOption(@TypeOf(this.runtime_js_version), "runtime_js_version", this.runtime_js_version); opts.addOption(@TypeOf(this.fallback_html_version), "fallback_html_version", this.fallback_html_version); + opts.addOption(@TypeOf(this.tinycc), "tinycc", this.tinycc); return opts; } }; @@ -148,18 +188,24 @@ pub fn build(b: *Build) !void { } pub fn build_(b: *Build) !void { - if (!std.mem.eql(u8, @import("builtin").zig_version_string, required_zig_version)) { - const colors = std.io.getStdErr().supportsAnsiEscapeCodes(); - std.debug.print( - "{s}WARNING:\nBun requires zig version '{s}', but found '{s}', build may fail...\nMake sure you installed the right version as per https://bun.sh/docs/project/development#install-zig\n{s}You can update to the right version using 'zigup {s}'\n\n", - .{ - if (colors) "\x1b[1;33m" else "", - required_zig_version, - @import("builtin").zig_version_string, - if (colors) "\x1b[0m" else "", - required_zig_version, - }, - ); + switch (comptime zig_version.order(std.SemanticVersion.parse(recommended_zig_version) catch unreachable)) { + .eq => {}, + .lt => { + @compileError("The minimum version of Zig required to compile Bun is " ++ recommended_zig_version ++ ", found " ++ @import("builtin").zig_version_string); + }, + .gt => { + const colors = std.io.getStdErr().supportsAnsiEscapeCodes(); + std.debug.print( + "{s}WARNING:\nBun recommends Zig version '{s}', but found '{s}', build may fail...\nMake sure you installed the right version as per https://bun.sh/docs/project/contributing#install-zig\n{s}You can update to the right version using 'zigup {s}'\n\n", + .{ + if (colors) "\x1b[1;33m" else "", + recommended_zig_version, + @import("builtin").zig_version_string, + if (colors) "\x1b[0m" else "", + recommended_zig_version, + }, + ); + }, } // Standard target options allows the person running `zig build` to choose @@ -171,6 +217,8 @@ pub fn build_(b: *Build) !void { // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. optimize = b.standardOptimizeOption(.{}); + const generated_code_directory = b.option([]const u8, "generated-code", "Set the generated code directory") orelse "./build"; + var output_dir_buf = std.mem.zeroes([4096]u8); var bin_label = if (optimize == std.builtin.OptimizeMode.Debug) "packages/debug-bun-" else "packages/bun-"; @@ -203,15 +251,17 @@ pub fn build_(b: *Build) !void { var triplet = triplet_buf[0 .. osname.len + cpuArchName.len + 1]; - if (b.option([]const u8, "output-dir", "target to install to") orelse std.os.getenv("OUTPUT_DIR")) |output_dir_| { - output_dir = try pathRel(b.allocator, b.install_prefix, output_dir_); + const outfile_maybe = b.option([]const u8, "output-file", "target to install to"); + + if (outfile_maybe) |outfile| { + output_dir = try pathRel(b.allocator, b.install_prefix, std.fs.path.dirname(outfile) orelse ""); } else { const output_dir_base = try std.fmt.bufPrint(&output_dir_buf, "{s}{s}", .{ bin_label, triplet }); output_dir = try pathRel(b.allocator, b.install_prefix, output_dir_base); } is_debug_build = optimize == OptimizeMode.Debug; - const bun_executable_name = if (optimize == std.builtin.OptimizeMode.Debug) "bun-debug" else "bun"; + const bun_executable_name = if (outfile_maybe) |outfile| std.fs.path.basename(outfile[0 .. outfile.len - std.fs.path.extension(outfile).len]) else if (is_debug_build) "bun-debug" else "bun"; const root_src = if (target.getOsTag() == std.Target.Os.Tag.freestanding) "root_wasm.zig" else @@ -236,7 +286,28 @@ pub fn build_(b: *Build) !void { .main_mod_path = .{ .cwd_relative = b.pathFromRoot(".") }, }); - b.reference_trace = 16; + if (!exists(b.pathFromRoot(try std.fs.path.join(b.allocator, &.{ + "src", + "js_lexer", + "id_continue_bitset.blob", + })))) { + const identifier_data = b.pathFromRoot(try std.fs.path.join(b.allocator, &.{ "src", "js_lexer", "identifier_data.zig" })); + var run_step = b.addSystemCommand(&.{ + b.zig_exe, + "run", + identifier_data, + }); + run_step.has_side_effects = true; + obj.step.dependOn(&run_step.step); + } + + b.reference_trace = if (b.option(u32, "reference-trace", "Set the reference trace")) |trace| + if (trace == 0) + null + else + trace + else + 16; var default_build_options: BunBuildOptions = brk: { const is_baseline = arch.isX86() and (target.cpu_model == .baseline or @@ -247,7 +318,7 @@ pub fn build_(b: *Build) !void { git_sha = b.allocator.dupeZ(u8, sha) catch unreachable; } else { sha: { - const result = std.ChildProcess.exec(.{ + const result = std.ChildProcess.run(.{ .allocator = b.allocator, .argv = &.{ "git", @@ -262,9 +333,12 @@ pub fn build_(b: *Build) !void { } } - const is_canary = (std.os.getenvZ("BUN_CANARY") orelse "0")[0] == '1'; + const is_canary = + b.option(bool, "canary", "Treat this as a canary build") orelse + ((b.env_map.get("BUN_CANARY") orelse "0")[0] == '1'); break :brk .{ .canary = is_canary, + .version = b.option([]const u8, "version", "Value of `Bun.version`") orelse "0.0.0", .sha = git_sha, .baseline = is_baseline, .bindgen = false, @@ -299,8 +373,9 @@ pub fn build_(b: *Build) !void { min_version, max_version, obj.target.getCpuModel().name, - }) catch unreachable; - std.io.getStdErr().writer().print("Output: {s}/{s}\n\n", .{ output_dir, bun_executable_name }) catch unreachable; + }) catch {}; + std.io.getStdErr().writer().print("Zig {s}\n", .{@import("builtin").zig_version_string}) catch {}; + // std.io.getStdErr().writer().print("Output: {s}/{s}\n\n", .{ output_dir, bun_executable_name }) catch unreachable; defer obj_step.dependOn(&obj.step); @@ -319,13 +394,22 @@ pub fn build_(b: *Build) !void { obj.addOptions("build_options", actual_build_options.step(b)); - obj.linkLibC(); + // Generated Code + // TODO: exit with a better error early if these files do not exist. it is an indication someone ran `zig build` directly without the code generators. + obj.addModule("generated/ZigGeneratedClasses.zig", b.createModule(.{ + .source_file = .{ .path = b.fmt("{s}/ZigGeneratedClasses.zig", .{generated_code_directory}) }, + })); + obj.addModule("generated/ResolvedSourceTag.zig", b.createModule(.{ + .source_file = .{ .path = b.fmt("{s}/ResolvedSourceTag.zig", .{generated_code_directory}) }, + })); + obj.linkLibC(); + obj.dll_export_fns = true; obj.strip = false; - obj.bundle_compiler_rt = false; obj.omit_frame_pointer = optimize != .Debug; + obj.subsystem = .Console; // Disable stack probing on x86 so we don't need to include compiler_rt - if (target.getCpuArch().isX86()) obj.disable_stack_probing = true; + if (target.getCpuArch().isX86() or target.isWindows()) obj.disable_stack_probing = true; if (b.option(bool, "for-editor", "Do not emit bin, just check for errors") orelse false) { // obj.emit_bin = .no_emit; diff --git a/bun.lockb b/bun.lockb index e1a306d6163f3..6116d7891d148 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/src/bun.js/bindings/webcore/WebCoreBuiltins.h b/docs/project/building-windows.md similarity index 100% rename from src/bun.js/bindings/webcore/WebCoreBuiltins.h rename to docs/project/building-windows.md diff --git a/docs/project/contributing.md b/docs/project/contributing.md index d3524a04021bc..b2ddda4909c97 100644 --- a/docs/project/contributing.md +++ b/docs/project/contributing.md @@ -72,16 +72,11 @@ If not, run this to manually link it: ```bash#macOS (Homebrew) # use fish_add_path if you're using fish $ export PATH="$PATH:$(brew --prefix llvm@16)/bin" -$ export LDFLAGS="$LDFLAGS -L$(brew --prefix llvm@16)/lib" -$ export CPPFLAGS="$CPPFLAGS -I$(brew --prefix llvm@16)/include" ``` ```bash#Arch - +# use fish_add_path if you're using fish $ export PATH="$PATH:/usr/lib/llvm16/bin" -$ export LDFLAGS="$LDFLAGS -L/usr/lib/llvm16/lib" -$ export CPPFLAGS="$CPPFLAGS -I/usr/lib/llvm16/include" - ``` {% /codetabs %} @@ -93,24 +88,24 @@ Using your system's package manager, install the rest of Bun's dependencies: {% codetabs %} ```bash#macOS (Homebrew) -$ brew install automake ccache cmake coreutils esbuild gnu-sed go libiconv libtool ninja pkg-config rust +$ brew install automake ccache cmake coreutils gnu-sed go libiconv libtool ninja pkg-config rust ``` ```bash#Ubuntu/Debian -$ sudo apt install cargo ccache cmake git golang libtool ninja-build pkg-config rustc esbuild +$ sudo apt install cargo ccache cmake git golang libtool ninja-build pkg-config rustc ``` ```bash#Arch -$ sudo pacman -S base-devel ccache cmake esbuild git go libiconv libtool make ninja pkg-config python rust sed unzip +$ sudo pacman -S base-devel ccache cmake git go libiconv libtool make ninja pkg-config python rust sed unzip ``` ```bash#Fedora -$ sudo dnf install cargo ccache cmake git golang libtool ninja-build pkg-config rustc golang-github-evanw-esbuild libatomic-static libstdc++-static sed unzip +$ sudo dnf install cargo ccache cmake git golang libtool ninja-build pkg-config rustc libatomic-static libstdc++-static sed unzip ``` {% /codetabs %} -{% details summary="Ubuntu — Unable to locate package esbuild" %} + ## Install Zig @@ -130,11 +123,11 @@ Zig can be installed either with our npm package [`@oven/zig`](https://www.npmjs ```bash $ bun install -g @oven/zig -$ zigup 0.12.0-dev.899+027aabf49 +$ zigup 0.12.0-dev.1297+a9e66ed73 ``` {% callout %} -We last updated Zig on **October 12th, 2023** +We last updated Zig on **October 26th, 2023** {% /callout %} ## First Build @@ -142,175 +135,36 @@ We last updated Zig on **October 12th, 2023** After cloning the repository, run the following command to run the first build. This may take a while as it will clone submodules and build dependencies. ```bash -$ make setup +$ bash ./src/scripts/setup.sh ``` -The binary will be located at `packages/debug-bun-{platform}-{arch}/bun-debug`. It is recommended to add this to your `$PATH`. To verify the build worked, let's print the version number on the development build of Bun. +The binary will be located at `./build/bun-debug`. It is recommended to add this to your `$PATH`. To verify the build worked, let's print the version number on the development build of Bun. ```bash -$ packages/debug-bun-*/bun-debug --version +$ build/bun-debug --version bun 1.x.y__dev ``` -Note: `make setup` is just an alias for the following: +To rebuild, you can simply invoke `ninja` ```bash -$ make assert-deps submodule npm-install-dev node-fallbacks runtime_js fallback_decoder bun_error mimalloc picohttp zlib boringssl libarchive lolhtml sqlite usockets uws tinycc c-ares zstd base64 cpp zig link +$ ninja -C build ``` -## Rebuilding - -Bun uses a series of make commands to rebuild parts of the codebase. The general rule for rebuilding is there is `make link` to rerun the linker, and then different make targets for different parts of the codebase. Do not pass `-j` to make as these scripts will break if run out of order, and multiple cores will be used when possible during the builds. - -{% table %} - -- What changed -- Run this command - ---- - -- Zig Code -- `make zig` - ---- - -- C++ Code -- `make cpp` - ---- - -- Zig + C++ Code -- `make dev` (combination of the above two) - ---- - -- JS/TS Code in `src/js` -- `make js` (in bun-debug, js is loaded from disk without a recompile). If you change the names of any file or add/remove anything, you must also run `make dev`. - ---- - -- `*.classes.ts` -- `make generate-classes dev` - ---- - -- JSSink -- `make generate-sink cpp` - ---- - -- `src/node_fallbacks/*` -- `make node-fallbacks zig` - ---- - -- `identifier_data.zig` -- `make identifier-cache zig` - ---- - -- Code using `cppFn`/`JSC.markBinding` -- `make headers` (TODO: explain what this is used for and why it's useful) - -{% /table %} - -`make setup` cloned a bunch of submodules and built the subprojects. When a submodule is out of date, run `make submodule` to quickly reset/update all your submodules, then you can rebuild individual submodules with their respective command. - -{% table %} - -- Dependency -- Run this command - ---- - -- WebKit -- `bun install` (it is a prebuilt package) - ---- - -- uWebSockets -- `make uws` - ---- - -- Mimalloc -- `make mimalloc` - ---- - -- PicoHTTPParser -- `make picohttp` - ---- - -- zlib -- `make zlib` - ---- - -- BoringSSL -- `make boringssl` - ---- - -- libarchive -- `make libarchive` - ---- - -- lolhtml -- `make lolhtml` - ---- - -- sqlite -- `make sqlite` - ---- - -- TinyCC -- `make tinycc` - ---- - -- c-ares -- `make c-ares` - ---- - -- zstd -- `make zstd` - ---- - -- Base64 -- `make base64` - -{% /table %} - -The above will probably also need Zig and/or C++ code rebuilt. - -## VSCode - -VSCode is the recommended IDE for working on Bun, as it has been configured. Once opening, you can run `Extensions: Show Recommended Extensions` to install the recommended extensions for Zig and C++. ZLS is automatically configured. - -## JavaScript builtins - -When you change anything in `src/js/builtins/*` or switch branches, run this: +Note: `make setup` is just an alias for the following steps: ```bash -$ make js cpp +$ ./src/scripts/update-submodules.sh +$ ./src/scripts/all-dependencies.sh +$ cmake . -GNinja -B build -DCMAKE_BUILD_TYPE=Debug +$ ninja -C build ``` -That inlines the TypeScript code into C++ headers. - -{% callout %} -Make sure you have `ccache` installed, otherwise regeneration will take much longer than it should. -{% /callout %} +## VSCode -For more information on how `src/js` works, see `src/js/README.md` in the codebase. +VSCode is the recommended IDE for working on Bun, as it has been configured. Once opening, you can run `Extensions: Show Recommended Extensions` to install the recommended extensions for Zig and C++. ZLS is automatically configured. -## Code generation scripts + ## Modifying ESM modules -Certain modules like `node:fs`, `node:stream`, `bun:sqlite`, and `ws` are implemented in JavaScript. These live in `src/js/{node,bun,thirdparty}` files and are pre-bundled using Bun. The bundled code is committed so CI builds can run without needing a copy of Bun. - -When these are changed, run: - -``` -$ make js -``` - -In debug builds, Bun automatically loads these from the filesystem, wherever it was compiled, so no need to re-run `make dev`. +Certain modules like `node:fs`, `node:stream`, `bun:sqlite`, and `ws` are implemented in JavaScript. These live in `src/js/{node,bun,thirdparty}` files and are pre-bundled using Bun. In debug builds, Bun automatically loads these from the filesystem, wherever it was compiled, so no need to re-run `make dev`. ## Release build To build a release build of Bun, run: ```bash -$ make release-bindings -j12 -$ make release +$ mkdir build-release +$ cmake . -GNinja -B build-release -DCMAKE_BUILD_TYPE=Release +$ ninja -C build-release ``` -The binary will be located at `packages/bun-{platform}-{arch}/bun`. +The binary will be located at `./build-release/bun` and `./build-release/bun-profile`. ## Valgrind @@ -394,6 +241,8 @@ $ make cpp ## Building WebKit locally + Debug mode of JSC +**TODO**: This is out of date. TLDR is pass `-DUSE_DEBUG_JSC=1` or `-DWEBKIT_DIR=...` to cmake + WebKit is not cloned by default (to save time and disk space). To clone and build WebKit locally, run: ```bash @@ -455,15 +304,15 @@ If you see an error when compiling `libarchive`, run this: $ brew install pkg-config ``` -### missing files on `zig build obj` + -### cmakeconfig.h not found + ### macOS `library not found for -lSystem` @@ -494,4 +343,4 @@ Bun requires `libatomic` to be statically linked. On Arch Linux, it is only give $ sudo ln -s /lib/libatomic.so /lib/libatomic.a ``` -The built version of bun may not work on other systems if compiled this way. +The built version of Bun may not work on other systems if compiled this way. diff --git a/docs/project/internals/build-process-for-ci.md b/docs/project/internals/build-process-for-ci.md new file mode 100644 index 0000000000000..e3fb33879aab1 --- /dev/null +++ b/docs/project/internals/build-process-for-ci.md @@ -0,0 +1,75 @@ +There are four parts to the CI build: + +- Dependencies: should be cached across builds as much as possible, it depends on git submodule hashes +- Zig Object: depends on \*.zig and potentially src/js +- C++ Object: depends on \*.cpp and src/js +- Linking: depends on the above three + +Utilizing multiple GitHub Action runners allows us to do a lot of work in parallel. + +## Dependencies + +```sh +BUN_DEPS_OUT_DIR="/optional/out/dir" bash ./scripts/all-dependencies.sh +``` + +## Zig Object + +This does not have a dependency on WebKit or any of the dependencies at all. It can be compiled without checking out submodules, but you will need to have bun install run. It can be very easily cross compiled. + +```sh +BUN_REPO=/path/to/oven-sh/bun + +cd tmp1 + +cmake $BUN_REPO \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCPU_TARGET="native" \ + -DZIG_TARGET="native" \ + -DBUN_ZIG_OBJ="./bun-zig.o" + +ninja ./bun-zig.o +# -> bun-zig.o +``` + +## C++ Object + +Note: if WEBKIT_DIR is not passed, it is automatically downloaded from GitHub releases. This depends on the headers from submodules but not neccecarily the build copies of them, .a files, etc. + +```sh +cd tmp2 + +cmake $BUN_REPO \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUN_CPP_ONLY=1 \ + +bash compile-cpp-only.sh +# -> bun-cpp-objects.a +``` + +## Linking + +The goal is you run both stages from above on different machines, so that they can build in parallel. Zig build is slow, and MacOS build runners are slower on average than the linux ones. With both artifacts from above, you can link them together: + +```sh +cd tmp3 + +cmake $BUN_REPO \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUN_LINK_ONLY=1 \ + -DBUN_ZIG_OBJ="/path/to/bun-zig.o" \ + -DBUN_CPP_ARCHIVE="/path/to/bun-cpp-objects.a" + +ninja + +# optiona: +# -DBUN_DEPS_OUT_DIR=... custom deps dir, use this to cache the built deps between rebuilds +# -DWEBKIT_DIR=... same thing, but it's probably fast enough to pull from github releases + +# -> bun +# -> bun-profile +# -> bun.dSYM/ +``` diff --git a/misctools/readlink-getfd.zig b/misctools/readlink-getfd.zig index ddf00639867c4..5a1d8208e4663 100644 --- a/misctools/readlink-getfd.zig +++ b/misctools/readlink-getfd.zig @@ -27,7 +27,7 @@ pub fn main() anyerror!void { var args = std.mem.bytesAsSlice([]u8, try std.process.argsAlloc(allocator)); const to_resolve = args[args.len - 1]; - const cwd = try std.process.getCwdAlloc(allocator); + const cwd = try bun.getcwdAlloc(allocator); var path: []u8 = undefined; var out_buffer: [bun.MAX_PATH_BYTES]u8 = undefined; diff --git a/misctools/tgz.zig b/misctools/tgz.zig index 2d6a70a781286..45ff04f37ac0f 100644 --- a/misctools/tgz.zig +++ b/misctools/tgz.zig @@ -47,7 +47,7 @@ pub fn main() anyerror!void { bun.asByteSlice(args[args.len - 1]), }; - const tarball_path = path_handler.joinAbsStringBuf(try std.process.getCwdAlloc(std.heap.c_allocator), &tarball_path_buf, &parts, .auto); + const tarball_path = path_handler.joinAbsStringBuf(try bun.getcwdAlloc(std.heap.c_allocator), &tarball_path_buf, &parts, .auto); Output.prettyErrorln("Tarball Path: {s}", .{tarball_path}); var folder = basename; diff --git a/package.json b/package.json index 6c11ff55fecc5..ad8ea7bb199ca 100644 --- a/package.json +++ b/package.json @@ -15,9 +15,11 @@ }, "private": true, "scripts": { + "build": "cmake . -DCMAKE_BUILD_TYPE=Debug -GNinja -Bbuild && ninja -Cbuild", + "build:release": "cmake . -DCMAKE_BUILD_TYPE=Release -GNinja -Bbuild-release && ninja -Cbuild-release", "build-runtime": "esbuild --target=esnext --bundle src/runtime/index.ts --format=iife --platform=browser --global-name=BUN_RUNTIME > src/runtime.out.js; cat src/runtime.footer.js >> src/runtime.out.js", "build-fallback": "esbuild --target=esnext --bundle src/fallback.ts --format=iife --platform=browser --minify > src/fallback.out.js", - "postinstall": "bash .scripts/postinstall.sh", + "postinstall_not_anymore": "bash .scripts/postinstall.sh", "typecheck": "tsc --noEmit && cd test && bun run typecheck", "fmt": "prettier --write --cache './{src,test,bench,packages/{bun-types,bun-inspector-*,bun-vscode,bun-debug-adapter-protocol}}/**/*.{mjs,ts,tsx,js,jsx}'", "lint": "eslint './**/*.d.ts' --cache", @@ -26,8 +28,7 @@ "devDependencies": { "@types/react": "^18.0.25", "@typescript-eslint/eslint-plugin": "^5.31.0", - "@typescript-eslint/parser": "^5.31.0", - "bun-webkit": "0.0.1-67c9ba93323b4a5a95bc4d1efe61166dc6e3e691" + "@typescript-eslint/parser": "^5.31.0" }, "version": "0.0.0", "prettier": "./.prettierrc.cjs" diff --git a/packages/bun-usockets/src/context.c b/packages/bun-usockets/src/context.c index 9e0dd535602b9..ec731a4f751f4 100644 --- a/packages/bun-usockets/src/context.c +++ b/packages/bun-usockets/src/context.c @@ -566,10 +566,10 @@ void *us_socket_context_ext(int ssl, struct us_socket_context_t *context) { } -void us_socket_context_on_handshake(int ssl, struct us_socket_context_t *context, void (*on_handshake)(struct us_socket_context_t *, int success, struct us_bun_verify_error_t verify_error, void* custom_data), void* custom_data) { +void us_socket_context_on_handshake(int ssl, struct us_socket_context_t *context, void (*on_handshake)(struct us_socket_t *, int success, struct us_bun_verify_error_t verify_error, void* custom_data), void* custom_data) { #ifndef LIBUS_NO_SSL if (ssl) { - us_internal_on_ssl_handshake((struct us_internal_ssl_socket_context_t *) context, (void (*)(struct us_internal_ssl_socket_t *, int success, struct us_bun_verify_error_t verify_error, void* custom_data))on_handshake, custom_data); + us_internal_on_ssl_handshake((struct us_internal_ssl_socket_context_t *) context, (us_internal_on_handshake_t)on_handshake, custom_data); return; } #endif diff --git a/packages/bun-usockets/src/crypto/openssl.c b/packages/bun-usockets/src/crypto/openssl.c index a03bf3520897f..9819c90d42604 100644 --- a/packages/bun-usockets/src/crypto/openssl.c +++ b/packages/bun-usockets/src/crypto/openssl.c @@ -18,51 +18,54 @@ #if (defined(LIBUS_USE_OPENSSL) || defined(LIBUS_USE_WOLFSSL)) /* These are in sni_tree.cpp */ -void *sni_new(); -void sni_free(void *sni, void(*cb)(void *)); -int sni_add(void *sni, const char *hostname, void *user); -void *sni_remove(void *sni, const char *hostname); -void *sni_find(void *sni, const char *hostname); +void* sni_new(); +void sni_free(void* sni, void (*cb)(void*)); +int sni_add(void* sni, const char* hostname, void* user); +void* sni_remove(void* sni, const char* hostname); +void* sni_find(void* sni, const char* hostname); -#include "libusockets.h" #include "internal/internal.h" +#include "libusockets.h" #include /* This module contains the entire OpenSSL implementation * of the SSL socket and socket context interfaces. */ #ifdef LIBUS_USE_OPENSSL -#include #include -#include #include +#include +#include #elif LIBUS_USE_WOLFSSL -#include -#include #include -#include #include +#include +#include +#include #endif #include "./root_certs.h" -#include +// #include static const size_t root_certs_size = sizeof(root_certs) / sizeof(root_certs[0]); -static X509* root_cert_instances[root_certs_size] = {NULL}; -static atomic_flag root_cert_instances_lock = ATOMIC_FLAG_INIT; -static atomic_bool root_cert_instances_initialized = 0; +static X509* root_cert_instances[1] = { NULL }; +// static atomic_flag root_cert_instances_lock = ATOMIC_FLAG_INIT; +// static atomic_bool root_cert_instances_initialized = 0; + +/* These are in root_certs.cpp */ +extern X509_STORE* us_get_default_ca_store(); struct loop_ssl_data { char *ssl_read_input, *ssl_read_output; unsigned int ssl_read_input_length; unsigned int ssl_read_input_offset; - struct us_socket_t *ssl_socket; + struct us_socket_t* ssl_socket; int last_write_was_msg_more; int msg_more; - BIO *shared_rbio; - BIO *shared_wbio; - BIO_METHOD *shared_biom; + BIO* shared_rbio; + BIO* shared_wbio; + BIO_METHOD* shared_biom; }; struct us_internal_ssl_socket_context_t { @@ -71,49 +74,52 @@ struct us_internal_ssl_socket_context_t { // this thing can be shared with other socket contexts via socket transfer! // maybe instead of holding once you hold many, a vector or set // when a socket that belongs to another socket context transfers to a new socket context - SSL_CTX *ssl_context; + SSL_CTX* ssl_context; int is_parent; /* These decorate the base implementation */ - struct us_internal_ssl_socket_t *(*on_open)(struct us_internal_ssl_socket_t *, int is_client, char *ip, int ip_length); - struct us_internal_ssl_socket_t *(*on_data)(struct us_internal_ssl_socket_t *, char *data, int length); - struct us_internal_ssl_socket_t *(*on_writable)(struct us_internal_ssl_socket_t *); - struct us_internal_ssl_socket_t *(*on_close)(struct us_internal_ssl_socket_t *, int code, void *reason); + struct us_internal_ssl_socket_t* (*on_open)(struct us_internal_ssl_socket_t*, int is_client, char* ip, int ip_length); + struct us_internal_ssl_socket_t* (*on_data)(struct us_internal_ssl_socket_t*, char* data, int length); + struct us_internal_ssl_socket_t* (*on_writable)(struct us_internal_ssl_socket_t*); + struct us_internal_ssl_socket_t* (*on_close)(struct us_internal_ssl_socket_t*, int code, void* reason); /* Called for missing SNI hostnames, if not NULL */ - void (*on_server_name)(struct us_internal_ssl_socket_context_t *, const char *hostname); + void (*on_server_name)(struct us_internal_ssl_socket_context_t*, const char* hostname); /* Pointer to sni tree, created when the context is created and freed likewise when freed */ - void *sni; + void* sni; - void (*on_handshake)(struct us_internal_ssl_socket_t *, int success, struct us_bun_verify_error_t verify_error, void* custom_data); + us_internal_on_handshake_t on_handshake; void* handshake_data; }; // same here, should or shouldn't it contain s? struct us_internal_ssl_socket_t { struct us_socket_t s; - SSL *ssl; + SSL* ssl; int ssl_write_wants_read; // we use this for now int ssl_read_wants_write; int pending_handshake; }; -int passphrase_cb(char *buf, int size, int rwflag, void *u) { - const char *passphrase = (const char *) u; +int passphrase_cb(char* buf, int size, int rwflag, void* u) +{ + const char* passphrase = (const char*)u; size_t passphrase_length = strlen(passphrase); memcpy(buf, passphrase, passphrase_length); // put null at end? no? - return (int) passphrase_length; + return (int)passphrase_length; } -int BIO_s_custom_create(BIO *bio) { +int BIO_s_custom_create(BIO* bio) +{ BIO_set_init(bio, 1); return 1; } -long BIO_s_custom_ctrl(BIO *bio, int cmd, long num, void *user) { - switch(cmd) { +long BIO_s_custom_ctrl(BIO* bio, int cmd, long num, void* user) +{ + switch (cmd) { case BIO_CTRL_FLUSH: return 1; default: @@ -121,10 +127,9 @@ long BIO_s_custom_ctrl(BIO *bio, int cmd, long num, void *user) { } } - - -int BIO_s_custom_write(BIO *bio, const char *data, int length) { - struct loop_ssl_data *loop_ssl_data = (struct loop_ssl_data *) BIO_get_data(bio); +int BIO_s_custom_write(BIO* bio, const char* data, int length) +{ + struct loop_ssl_data* loop_ssl_data = (struct loop_ssl_data*)BIO_get_data(bio); loop_ssl_data->last_write_was_msg_more = loop_ssl_data->msg_more || length == 16413; int written = us_socket_write(0, loop_ssl_data->ssl_socket, data, length, loop_ssl_data->last_write_was_msg_more); @@ -139,17 +144,18 @@ int BIO_s_custom_write(BIO *bio, const char *data, int length) { return written; } -int BIO_s_custom_read(BIO *bio, char *dst, int length) { - struct loop_ssl_data *loop_ssl_data = (struct loop_ssl_data *) BIO_get_data(bio); +int BIO_s_custom_read(BIO* bio, char* dst, int length) +{ + struct loop_ssl_data* loop_ssl_data = (struct loop_ssl_data*)BIO_get_data(bio); - //printf("BIO_s_custom_read\n"); + // printf("BIO_s_custom_read\n"); if (!loop_ssl_data->ssl_read_input_length) { BIO_set_flags(bio, BIO_FLAGS_SHOULD_RETRY | BIO_FLAGS_READ); return -1; } - if ((unsigned int) length > loop_ssl_data->ssl_read_input_length) { + if ((unsigned int)length > loop_ssl_data->ssl_read_input_length) { length = loop_ssl_data->ssl_read_input_length; } @@ -160,14 +166,13 @@ int BIO_s_custom_read(BIO *bio, char *dst, int length) { return length; } +struct us_internal_ssl_socket_t* ssl_on_open(struct us_internal_ssl_socket_t* s, int is_client, char* ip, int ip_length) +{ -struct us_internal_ssl_socket_t *ssl_on_open(struct us_internal_ssl_socket_t *s, int is_client, char *ip, int ip_length) { + struct us_internal_ssl_socket_context_t* context = (struct us_internal_ssl_socket_context_t*)us_socket_context(0, &s->s); - struct us_internal_ssl_socket_context_t *context = (struct us_internal_ssl_socket_context_t *) us_socket_context(0, &s->s); - - - struct us_loop_t *loop = us_socket_context_loop(0, &context->sc); - struct loop_ssl_data *loop_ssl_data = (struct loop_ssl_data *) loop->data.ssl_data; + struct us_loop_t* loop = us_socket_context_loop(0, &context->sc); + struct loop_ssl_data* loop_ssl_data = (struct loop_ssl_data*)loop->data.ssl_data; s->ssl = SSL_new(context->ssl_context); s->ssl_write_wants_read = 0; @@ -184,52 +189,52 @@ struct us_internal_ssl_socket_t *ssl_on_open(struct us_internal_ssl_socket_t *s, SSL_set_accept_state(s->ssl); } - struct us_internal_ssl_socket_t * result = (struct us_internal_ssl_socket_t *) context->on_open(s, is_client, ip, ip_length); + struct us_internal_ssl_socket_t* result = (struct us_internal_ssl_socket_t*)context->on_open(s, is_client, ip, ip_length); // Hello Message! // always handshake after open if on_handshake is set - if(context->on_handshake || s->pending_handshake) { + if (context->on_handshake || s->pending_handshake) { s->pending_handshake = 1; us_internal_ssl_handshake(s, context->on_handshake, context->handshake_data); } - + return result; } - -void us_internal_on_ssl_handshake(struct us_internal_ssl_socket_context_t * context, void (*on_handshake)(struct us_internal_ssl_socket_t *, int success, struct us_bun_verify_error_t verify_error, void* custom_data), void* custom_data) { +void us_internal_on_ssl_handshake(struct us_internal_ssl_socket_context_t* context, void (*on_handshake)(struct us_internal_ssl_socket_t*, int success, struct us_bun_verify_error_t verify_error, void* custom_data), void* custom_data) +{ context->on_handshake = on_handshake; context->handshake_data = custom_data; } -void us_internal_ssl_handshake(struct us_internal_ssl_socket_t *s, void (*on_handshake)(struct us_internal_ssl_socket_t *, int success, struct us_bun_verify_error_t verify_error, void* custom_data), void* custom_data) { - struct us_internal_ssl_socket_context_t *context = (struct us_internal_ssl_socket_context_t *) us_socket_context(0, &s->s); - +void us_internal_ssl_handshake(struct us_internal_ssl_socket_t* s, us_internal_on_handshake_t on_handshake, void* custom_data) +{ + struct us_internal_ssl_socket_context_t* context = (struct us_internal_ssl_socket_context_t*)us_socket_context(0, &s->s); + // will start on_open, on_writable or on_data - if(!s->ssl) { - + if (!s->ssl) { + s->pending_handshake = 1; context->on_handshake = on_handshake; context->handshake_data = custom_data; return; } - struct us_loop_t *loop = us_socket_context_loop(0, &context->sc); - struct loop_ssl_data *loop_ssl_data = (struct loop_ssl_data *) loop->data.ssl_data; + struct us_loop_t* loop = us_socket_context_loop(0, &context->sc); + struct loop_ssl_data* loop_ssl_data = (struct loop_ssl_data*)loop->data.ssl_data; loop_ssl_data->ssl_socket = &s->s; - if (us_socket_is_closed(0, &s->s) || us_internal_ssl_socket_is_shut_down(s)) { + if (us_socket_is_closed(0, &s->s) || us_internal_ssl_socket_is_shut_down(s)) { s->pending_handshake = 0; - + struct us_bun_verify_error_t verify_error = (struct us_bun_verify_error_t) { .error = 0, .code = NULL, .reason = NULL }; - if(on_handshake != NULL) { + if (on_handshake != NULL) { on_handshake(s, 0, verify_error, custom_data); } return; } - int result = SSL_do_handshake(s->ssl); if (result <= 0) { @@ -237,7 +242,7 @@ void us_internal_ssl_handshake(struct us_internal_ssl_socket_t *s, void (*on_han // as far as I know these are the only errors we want to handle if (err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE) { s->pending_handshake = 0; - + struct us_bun_verify_error_t verify_error = us_internal_verify_error(s); // clear per thread error queue if it may contain something if (err == SSL_ERROR_SSL || err == SSL_ERROR_SYSCALL) { @@ -245,7 +250,7 @@ void us_internal_ssl_handshake(struct us_internal_ssl_socket_t *s, void (*on_han } // error - if(on_handshake != NULL) { + if (on_handshake != NULL) { on_handshake(s, 0, verify_error, custom_data); } return; @@ -257,14 +262,13 @@ void us_internal_ssl_handshake(struct us_internal_ssl_socket_t *s, void (*on_han if (!us_socket_is_closed(0, &s->s) && !us_internal_ssl_socket_is_shut_down(s)) { us_socket_write(1, loop_ssl_data->ssl_socket, "\0", 0, 0); } - } } else { s->pending_handshake = 0; struct us_bun_verify_error_t verify_error = us_internal_verify_error(s); // success - if(on_handshake != NULL) { + if (on_handshake != NULL) { on_handshake(s, 1, verify_error, custom_data); } // Ensure that we'll cycle through internal openssl's state @@ -272,20 +276,20 @@ void us_internal_ssl_handshake(struct us_internal_ssl_socket_t *s, void (*on_han us_socket_write(1, loop_ssl_data->ssl_socket, "\0", 0, 0); } } - } - -struct us_internal_ssl_socket_t *us_internal_ssl_socket_close(struct us_internal_ssl_socket_t *s, int code, void *reason) { - struct us_internal_ssl_socket_context_t *context = (struct us_internal_ssl_socket_context_t *) us_socket_context(0, &s->s); +struct us_internal_ssl_socket_t* us_internal_ssl_socket_close(struct us_internal_ssl_socket_t* s, int code, void* reason) +{ + struct us_internal_ssl_socket_context_t* context = (struct us_internal_ssl_socket_context_t*)us_socket_context(0, &s->s); if (s->pending_handshake) { s->pending_handshake = 0; } - return (struct us_internal_ssl_socket_t *) us_socket_close(0, (struct us_socket_t *) s, code, reason); + return (struct us_internal_ssl_socket_t*)us_socket_close(0, (struct us_socket_t*)s, code, reason); } -struct us_internal_ssl_socket_t *ssl_on_close(struct us_internal_ssl_socket_t *s, int code, void *reason) { - struct us_internal_ssl_socket_context_t *context = (struct us_internal_ssl_socket_context_t *) us_socket_context(0, &s->s); +struct us_internal_ssl_socket_t* ssl_on_close(struct us_internal_ssl_socket_t* s, int code, void* reason) +{ + struct us_internal_ssl_socket_context_t* context = (struct us_internal_ssl_socket_context_t*)us_socket_context(0, &s->s); if (s->pending_handshake) { s->pending_handshake = 0; } @@ -294,8 +298,9 @@ struct us_internal_ssl_socket_t *ssl_on_close(struct us_internal_ssl_socket_t *s return context->on_close(s, code, reason); } -struct us_internal_ssl_socket_t *ssl_on_end(struct us_internal_ssl_socket_t *s) { - if(&s->s && s->pending_handshake) { +struct us_internal_ssl_socket_t* ssl_on_end(struct us_internal_ssl_socket_t* s) +{ + if (s && s->pending_handshake) { s->pending_handshake = 0; } // whatever state we are in, a TCP FIN is always an answered shutdown @@ -305,20 +310,20 @@ struct us_internal_ssl_socket_t *ssl_on_end(struct us_internal_ssl_socket_t *s) } // this whole function needs a complete clean-up -struct us_internal_ssl_socket_t *ssl_on_data(struct us_internal_ssl_socket_t *s, void *data, int length) { +struct us_internal_ssl_socket_t* ssl_on_data(struct us_internal_ssl_socket_t* s, void* data, int length) +{ // note: this context can change when we adopt the socket! - struct us_internal_ssl_socket_context_t *context = (struct us_internal_ssl_socket_context_t *) us_socket_context(0, &s->s); - + struct us_internal_ssl_socket_context_t* context = (struct us_internal_ssl_socket_context_t*)us_socket_context(0, &s->s); - struct us_loop_t *loop = us_socket_context_loop(0, &context->sc); - struct loop_ssl_data *loop_ssl_data = (struct loop_ssl_data *) loop->data.ssl_data; + struct us_loop_t* loop = us_socket_context_loop(0, &context->sc); + struct loop_ssl_data* loop_ssl_data = (struct loop_ssl_data*)loop->data.ssl_data; - if(s->pending_handshake) { + if (s->pending_handshake) { us_internal_ssl_handshake(s, context->on_handshake, context->handshake_data); } - // note: if we put data here we should never really clear it (not in write either, it still should be available for SSL_write to read from!) + // note: if we put data here we should never really clear it (not in write either, it still should be available for SSL_write to read from!) loop_ssl_data->ssl_read_input = data; loop_ssl_data->ssl_read_input_length = length; loop_ssl_data->ssl_read_input_offset = 0; @@ -330,12 +335,11 @@ struct us_internal_ssl_socket_t *ssl_on_data(struct us_internal_ssl_socket_t *s, } if (us_internal_ssl_socket_is_shut_down(s)) { - int ret = 0; if ((ret = SSL_shutdown(s->ssl)) == 1) { // two phase shutdown is complete here - //printf("Two step SSL shutdown complete\n"); + // printf("Two step SSL shutdown complete\n"); /* Todo: this should also report some kind of clean shutdown */ return us_internal_ssl_socket_close(s, 0, NULL); @@ -347,7 +351,6 @@ struct us_internal_ssl_socket_t *ssl_on_data(struct us_internal_ssl_socket_t *s, // we need to clear the error queue in case these added to the thread local queue ERR_clear_error(); } - } // no further processing of data when in shutdown state @@ -356,7 +359,7 @@ struct us_internal_ssl_socket_t *ssl_on_data(struct us_internal_ssl_socket_t *s, // bug checking: this loop needs a lot of attention and clean-ups and check-ups int read = 0; - restart: +restart: while (1) { int just_read = SSL_read(s->ssl, loop_ssl_data->ssl_read_output + LIBUS_RECV_BUFFER_PADDING + read, LIBUS_RECV_BUFFER_LENGTH - read); @@ -369,7 +372,7 @@ struct us_internal_ssl_socket_t *ssl_on_data(struct us_internal_ssl_socket_t *s, if (err == SSL_ERROR_ZERO_RETURN) { // zero return can be EOF/FIN, if we have data just signal on_data and close if (read) { - context = (struct us_internal_ssl_socket_context_t *) us_socket_context(0, &s->s); + context = (struct us_internal_ssl_socket_context_t*)us_socket_context(0, &s->s); s = context->on_data(s, loop_ssl_data->ssl_read_output + LIBUS_RECV_BUFFER_PADDING, read); if (us_socket_is_closed(0, &s->s)) { @@ -379,10 +382,10 @@ struct us_internal_ssl_socket_t *ssl_on_data(struct us_internal_ssl_socket_t *s, // terminate connection here return us_internal_ssl_socket_close(s, 0, NULL); } - + if (err == SSL_ERROR_SSL || err == SSL_ERROR_SYSCALL) { // clear per thread error queue if it may contain something - + ERR_clear_error(); } @@ -406,7 +409,7 @@ struct us_internal_ssl_socket_t *ssl_on_data(struct us_internal_ssl_socket_t *s, break; } - context = (struct us_internal_ssl_socket_context_t *) us_socket_context(0, &s->s); + context = (struct us_internal_ssl_socket_context_t*)us_socket_context(0, &s->s); s = context->on_data(s, loop_ssl_data->ssl_read_output + LIBUS_RECV_BUFFER_PADDING, read); if (us_socket_is_closed(0, &s->s)) { @@ -415,7 +418,6 @@ struct us_internal_ssl_socket_t *ssl_on_data(struct us_internal_ssl_socket_t *s, break; } - } read += just_read; @@ -423,7 +425,7 @@ struct us_internal_ssl_socket_t *ssl_on_data(struct us_internal_ssl_socket_t *s, // at this point we might be full and need to emit the data to application and start over if (read == LIBUS_RECV_BUFFER_LENGTH) { - context = (struct us_internal_ssl_socket_context_t *) us_socket_context(0, &s->s); + context = (struct us_internal_ssl_socket_context_t*)us_socket_context(0, &s->s); // emit data and restart s = context->on_data(s, loop_ssl_data->ssl_read_output + LIBUS_RECV_BUFFER_PADDING, read); @@ -441,9 +443,9 @@ struct us_internal_ssl_socket_t *ssl_on_data(struct us_internal_ssl_socket_t *s, s->ssl_write_wants_read = 0; // make sure to update context before we call (context can change if the user adopts the socket!) - context = (struct us_internal_ssl_socket_context_t *) us_socket_context(0, &s->s); + context = (struct us_internal_ssl_socket_context_t*)us_socket_context(0, &s->s); - s = (struct us_internal_ssl_socket_t *) context->sc.on_writable(&s->s); // cast here! + s = (struct us_internal_ssl_socket_t*)context->sc.on_writable(&s->s); // cast here! // if we are closed here, then exit if (us_socket_is_closed(0, &s->s)) { return s; @@ -452,36 +454,37 @@ struct us_internal_ssl_socket_t *ssl_on_data(struct us_internal_ssl_socket_t *s, // check this then? if (SSL_get_shutdown(s->ssl) & SSL_RECEIVED_SHUTDOWN) { - //printf("SSL_RECEIVED_SHUTDOWN\n"); + // printf("SSL_RECEIVED_SHUTDOWN\n"); - //exit(-2); + // exit(-2); // not correct anyways! s = us_internal_ssl_socket_close(s, 0, NULL); - //us_ + // us_ } return s; } -struct us_internal_ssl_socket_t *ssl_on_writable(struct us_internal_ssl_socket_t *s) { +struct us_internal_ssl_socket_t* ssl_on_writable(struct us_internal_ssl_socket_t* s) +{ - struct us_internal_ssl_socket_context_t *context = (struct us_internal_ssl_socket_context_t *) us_socket_context(0, &s->s); + struct us_internal_ssl_socket_context_t* context = (struct us_internal_ssl_socket_context_t*)us_socket_context(0, &s->s); - if(s->pending_handshake) { + if (s->pending_handshake) { us_internal_ssl_handshake(s, context->on_handshake, context->handshake_data); } // todo: cork here so that we efficiently output both from reading and from writing? if (s->ssl_read_wants_write) { s->ssl_read_wants_write = 0; - + // make sure to update context before we call (context can change if the user adopts the socket!) - context = (struct us_internal_ssl_socket_context_t *) us_socket_context(0, &s->s); + context = (struct us_internal_ssl_socket_context_t*)us_socket_context(0, &s->s); // if this one fails to write data, it sets ssl_read_wants_write again - s = (struct us_internal_ssl_socket_t *) context->sc.on_data(&s->s, 0, 0); // cast here! + s = (struct us_internal_ssl_socket_t*)context->sc.on_data(&s->s, 0, 0); // cast here! } // should this one come before we have read? should it come always? spurious on_writable is okay @@ -491,9 +494,10 @@ struct us_internal_ssl_socket_t *ssl_on_writable(struct us_internal_ssl_socket_t } /* Lazily inits loop ssl data first time */ -void us_internal_init_loop_ssl_data(struct us_loop_t *loop) { +void us_internal_init_loop_ssl_data(struct us_loop_t* loop) +{ if (!loop->data.ssl_data) { - struct loop_ssl_data *loop_ssl_data = us_malloc(sizeof(struct loop_ssl_data)); + struct loop_ssl_data* loop_ssl_data = us_malloc(sizeof(struct loop_ssl_data)); loop_ssl_data->ssl_read_input_length = 0; loop_ssl_data->ssl_read_input_offset = 0; loop_ssl_data->last_write_was_msg_more = 0; @@ -519,8 +523,9 @@ void us_internal_init_loop_ssl_data(struct us_loop_t *loop) { } /* Called by loop free, clears any loop ssl data */ -void us_internal_free_loop_ssl_data(struct us_loop_t *loop) { - struct loop_ssl_data *loop_ssl_data = (struct loop_ssl_data *) loop->data.ssl_data; +void us_internal_free_loop_ssl_data(struct us_loop_t* loop) +{ + struct loop_ssl_data* loop_ssl_data = (struct loop_ssl_data*)loop->data.ssl_data; if (loop_ssl_data) { us_free(loop_ssl_data->ssl_read_output); @@ -536,7 +541,8 @@ void us_internal_free_loop_ssl_data(struct us_loop_t *loop) { // we throttle reading data for ssl sockets that are in init state. here we actually use // the kernel buffering to our advantage -int ssl_is_low_prio(struct us_internal_ssl_socket_t *s) { +int ssl_is_low_prio(struct us_internal_ssl_socket_t* s) +{ /* We use SSL_in_before() instead of SSL_in_init(), because only the first step is CPU intensive, and we want to * speed up the rest of connection establishing if the CPU intensive work is already done, so fully established * connections increase lineary over time under high load */ @@ -544,14 +550,16 @@ int ssl_is_low_prio(struct us_internal_ssl_socket_t *s) { } /* Per-context functions */ -void *us_internal_ssl_socket_context_get_native_handle(struct us_internal_ssl_socket_context_t *context) { +void* us_internal_ssl_socket_context_get_native_handle(struct us_internal_ssl_socket_context_t* context) +{ return context->ssl_context; } -struct us_internal_ssl_socket_context_t *us_internal_create_child_ssl_socket_context(struct us_internal_ssl_socket_context_t *context, int context_ext_size) { +struct us_internal_ssl_socket_context_t* us_internal_create_child_ssl_socket_context(struct us_internal_ssl_socket_context_t* context, int context_ext_size) +{ /* Create a new non-SSL context */ - struct us_socket_context_options_t options = {0}; - struct us_internal_ssl_socket_context_t *child_context = (struct us_internal_ssl_socket_context_t *) us_create_socket_context(0, context->sc.loop, sizeof(struct us_internal_ssl_socket_context_t) + context_ext_size, options); + struct us_socket_context_options_t options = { 0 }; + struct us_internal_ssl_socket_context_t* child_context = (struct us_internal_ssl_socket_context_t*)us_create_socket_context(0, context->sc.loop, sizeof(struct us_internal_ssl_socket_context_t) + context_ext_size, options); /* The only thing we share is SSL_CTX */ child_context->ssl_context = context->ssl_context; @@ -562,109 +570,26 @@ struct us_internal_ssl_socket_context_t *us_internal_create_child_ssl_socket_con /* Common function for creating a context from options. * We must NOT free a SSL_CTX with only SSL_CTX_free! Also free any password */ -void free_ssl_context(SSL_CTX *ssl_context) { +void free_ssl_context(SSL_CTX* ssl_context) +{ if (!ssl_context) { return; } /* If we have set a password string, free it here */ - void *password = SSL_CTX_get_default_passwd_cb_userdata(ssl_context); + void* password = SSL_CTX_get_default_passwd_cb_userdata(ssl_context); /* OpenSSL returns NULL if we have no set password */ us_free(password); SSL_CTX_free(ssl_context); } - - -// This callback is used to avoid the default passphrase callback in OpenSSL -// which will typically prompt for the passphrase. The prompting is designed -// for the OpenSSL CLI, but works poorly for this case because it involves -// synchronous interaction with the controlling terminal, something we never -// want, and use this function to avoid it. -int us_no_password_callback(char* buf, int size, int rwflag, void* u) { - return 0; -} - - -static X509 * us_ssl_ctx_get_X509_without_callback_from(struct us_cert_string_t content) { - X509 *x = NULL; - BIO *in; - - ERR_clear_error(); // clear error stack for SSL_CTX_use_certificate() - - in = BIO_new_mem_buf(content.str, content.len); - if (in == NULL) { - OPENSSL_PUT_ERROR(SSL, ERR_R_BUF_LIB); - goto end; - } - - x = PEM_read_bio_X509(in, NULL, us_no_password_callback, NULL); - if (x == NULL) { - OPENSSL_PUT_ERROR(SSL, ERR_R_PEM_LIB); - goto end; - } - - return x; - -end: - X509_free(x); - BIO_free(in); - return NULL; -} - -int us_internal_raw_root_certs(struct us_cert_string_t** out) { - *out = root_certs; - return root_certs_size; -} - -void us_internal_init_root_certs() { - if(atomic_load(&root_cert_instances_initialized) == 1) return; - - while(atomic_flag_test_and_set_explicit(&root_cert_instances_lock, memory_order_acquire)); - - // if some thread already created it after we acquired the lock we skip and release the lock - if(atomic_load(&root_cert_instances_initialized) == 0) { - for (size_t i = 0; i < root_certs_size; i++) { - root_cert_instances[i] = us_ssl_ctx_get_X509_without_callback_from(root_certs[i]); - } - - atomic_store(&root_cert_instances_initialized, 1); - } - - atomic_flag_clear_explicit(&root_cert_instances_lock, memory_order_release); -} - -X509_STORE* us_get_default_ca_store() { - X509_STORE *store = X509_STORE_new(); - if (store == NULL) { - return NULL; - } - - if (!X509_STORE_set_default_paths(store)) { - X509_STORE_free(store); - return NULL; - } - - us_internal_init_root_certs(); - - // load all root_cert_instances on the default ca store - for (size_t i = 0; i < root_certs_size; i++) { - X509* cert = root_cert_instances[i]; - if(cert == NULL) continue; - X509_up_ref(cert); - X509_STORE_add_cert(store, cert); - } - - return store; -} - - /* This function should take any options and return SSL_CTX - which has to be free'd with * our destructor function - free_ssl_context() */ -SSL_CTX *create_ssl_context_from_options(struct us_socket_context_options_t options) { +SSL_CTX* create_ssl_context_from_options(struct us_socket_context_options_t options) +{ /* Create the context */ - SSL_CTX *ssl_context = SSL_CTX_new(TLS_method()); + SSL_CTX* ssl_context = SSL_CTX_new(TLS_method()); /* Default options we rely on - changing these will break our logic */ SSL_CTX_set_read_ahead(ssl_context, 1); @@ -677,13 +602,13 @@ SSL_CTX *create_ssl_context_from_options(struct us_socket_context_options_t opti /* Important option for lowering memory usage, but lowers performance slightly */ if (options.ssl_prefer_low_memory_usage) { - SSL_CTX_set_mode(ssl_context, SSL_MODE_RELEASE_BUFFERS); + SSL_CTX_set_mode(ssl_context, SSL_MODE_RELEASE_BUFFERS); } if (options.passphrase) { /* When freeing the CTX we need to check SSL_CTX_get_default_passwd_cb_userdata and * free it if set */ - SSL_CTX_set_default_passwd_cb_userdata(ssl_context, (void *) strdup(options.passphrase)); + SSL_CTX_set_default_passwd_cb_userdata(ssl_context, (void*)strdup(options.passphrase)); SSL_CTX_set_default_passwd_cb(ssl_context, passphrase_cb); } @@ -704,9 +629,9 @@ SSL_CTX *create_ssl_context_from_options(struct us_socket_context_options_t opti } if (options.ca_file_name) { - STACK_OF(X509_NAME) *ca_list; + STACK_OF(X509_NAME) * ca_list; ca_list = SSL_load_client_CA_file(options.ca_file_name); - if(ca_list == NULL) { + if (ca_list == NULL) { free_ssl_context(ssl_context); return NULL; } @@ -720,8 +645,8 @@ SSL_CTX *create_ssl_context_from_options(struct us_socket_context_options_t opti if (options.dh_params_file_name) { /* Set up ephemeral DH parameters. */ - DH *dh_2048 = NULL; - FILE *paramfile; + DH* dh_2048 = NULL; + FILE* paramfile; paramfile = fopen(options.dh_params_file_name, "r"); if (paramfile) { @@ -763,239 +688,244 @@ SSL_CTX *create_ssl_context_from_options(struct us_socket_context_options_t opti return ssl_context; } +int us_ssl_ctx_use_privatekey_content(SSL_CTX* ctx, const char* content, int type) +{ + int reason_code, ret = 0; + BIO* in; + EVP_PKEY* pkey = NULL; + in = BIO_new_mem_buf(content, strlen(content)); + if (in == NULL) { + OPENSSL_PUT_ERROR(SSL, ERR_R_BUF_LIB); + goto end; + } + if (type == SSL_FILETYPE_PEM) { + reason_code = ERR_R_PEM_LIB; + pkey = PEM_read_bio_PrivateKey(in, NULL, SSL_CTX_get_default_passwd_cb(ctx), + SSL_CTX_get_default_passwd_cb_userdata(ctx)); + } else if (type == SSL_FILETYPE_ASN1) { + reason_code = ERR_R_ASN1_LIB; + pkey = d2i_PrivateKey_bio(in, NULL); + } else { + OPENSSL_PUT_ERROR(SSL, SSL_R_BAD_SSL_FILETYPE); + goto end; + } -int us_ssl_ctx_use_privatekey_content(SSL_CTX *ctx, const char *content, int type) { - int reason_code, ret = 0; - BIO *in; - EVP_PKEY *pkey = NULL; - in = BIO_new_mem_buf(content, strlen(content)); - if (in == NULL) { - OPENSSL_PUT_ERROR(SSL, ERR_R_BUF_LIB); - goto end; - } - - if (type == SSL_FILETYPE_PEM) { - reason_code = ERR_R_PEM_LIB; - pkey = PEM_read_bio_PrivateKey(in, NULL, SSL_CTX_get_default_passwd_cb(ctx), - SSL_CTX_get_default_passwd_cb_userdata(ctx)); - } else if (type == SSL_FILETYPE_ASN1) { - reason_code = ERR_R_ASN1_LIB; - pkey = d2i_PrivateKey_bio(in, NULL); - } else { - OPENSSL_PUT_ERROR(SSL, SSL_R_BAD_SSL_FILETYPE); - goto end; - } - - if (pkey == NULL) { - OPENSSL_PUT_ERROR(SSL, reason_code); - goto end; - } - ret = SSL_CTX_use_PrivateKey(ctx, pkey); - EVP_PKEY_free(pkey); + if (pkey == NULL) { + OPENSSL_PUT_ERROR(SSL, reason_code); + goto end; + } + ret = SSL_CTX_use_PrivateKey(ctx, pkey); + EVP_PKEY_free(pkey); end: - BIO_free(in); - return ret; + BIO_free(in); + return ret; } -X509 * us_ssl_ctx_get_X509_from(SSL_CTX *ctx, const char *content) { - X509 *x = NULL; - BIO *in; +X509* us_ssl_ctx_get_X509_from(SSL_CTX* ctx, const char* content) +{ + X509* x = NULL; + BIO* in; - ERR_clear_error(); // clear error stack for SSL_CTX_use_certificate() + ERR_clear_error(); // clear error stack for SSL_CTX_use_certificate() - in = BIO_new_mem_buf(content, strlen(content)); - if (in == NULL) { - OPENSSL_PUT_ERROR(SSL, ERR_R_BUF_LIB); - goto end; - } + in = BIO_new_mem_buf(content, strlen(content)); + if (in == NULL) { + OPENSSL_PUT_ERROR(SSL, ERR_R_BUF_LIB); + goto end; + } - x = PEM_read_bio_X509(in, NULL, SSL_CTX_get_default_passwd_cb(ctx), - SSL_CTX_get_default_passwd_cb_userdata(ctx)); - if (x == NULL) { - OPENSSL_PUT_ERROR(SSL, ERR_R_PEM_LIB); - goto end; - } + x = PEM_read_bio_X509(in, NULL, SSL_CTX_get_default_passwd_cb(ctx), + SSL_CTX_get_default_passwd_cb_userdata(ctx)); + if (x == NULL) { + OPENSSL_PUT_ERROR(SSL, ERR_R_PEM_LIB); + goto end; + } - return x; + return x; end: - X509_free(x); - BIO_free(in); - return NULL; -} - -int us_ssl_ctx_use_certificate_chain(SSL_CTX *ctx, const char *content) { - BIO *in; - int ret = 0; - X509 *x = NULL; - - ERR_clear_error(); // clear error stack for SSL_CTX_use_certificate() - - in = BIO_new_mem_buf(content, strlen(content)); - if (in == NULL) { - OPENSSL_PUT_ERROR(SSL, ERR_R_BUF_LIB); - goto end; - } - - x = PEM_read_bio_X509_AUX(in, NULL, SSL_CTX_get_default_passwd_cb(ctx), - SSL_CTX_get_default_passwd_cb_userdata(ctx)); - if (x == NULL) { - OPENSSL_PUT_ERROR(SSL, ERR_R_PEM_LIB); - goto end; - } - - ret = SSL_CTX_use_certificate(ctx, x); - - if (ERR_peek_error() != 0) { - ret = 0; // Key/certificate mismatch doesn't imply ret==0 ... - } - - if (ret) { - // If we could set up our certificate, now proceed to the CA - // certificates. - X509 *ca; - int r; - uint32_t err; - - SSL_CTX_clear_chain_certs(ctx); - - while ((ca = PEM_read_bio_X509(in, NULL, SSL_CTX_get_default_passwd_cb(ctx), - SSL_CTX_get_default_passwd_cb_userdata(ctx))) != - NULL) { - r = SSL_CTX_add0_chain_cert(ctx, ca); - if (!r) { - X509_free(ca); - ret = 0; + X509_free(x); + BIO_free(in); + return NULL; +} + +int us_ssl_ctx_use_certificate_chain(SSL_CTX* ctx, const char* content) +{ + BIO* in; + int ret = 0; + X509* x = NULL; + + ERR_clear_error(); // clear error stack for SSL_CTX_use_certificate() + + in = BIO_new_mem_buf(content, strlen(content)); + if (in == NULL) { + OPENSSL_PUT_ERROR(SSL, ERR_R_BUF_LIB); goto end; - } - // Note that we must not free r if it was successfully added to the chain - // (while we must free the main certificate, since its reference count is - // increased by SSL_CTX_use_certificate). } - // When the while loop ends, it's usually just EOF. - err = ERR_peek_last_error(); - if (ERR_GET_LIB(err) == ERR_LIB_PEM && - ERR_GET_REASON(err) == PEM_R_NO_START_LINE) { - ERR_clear_error(); - } else { - ret = 0; // some real error + x = PEM_read_bio_X509_AUX(in, NULL, SSL_CTX_get_default_passwd_cb(ctx), + SSL_CTX_get_default_passwd_cb_userdata(ctx)); + if (x == NULL) { + OPENSSL_PUT_ERROR(SSL, ERR_R_PEM_LIB); + goto end; + } + + ret = SSL_CTX_use_certificate(ctx, x); + + if (ERR_peek_error() != 0) { + ret = 0; // Key/certificate mismatch doesn't imply ret==0 ... + } + + if (ret) { + // If we could set up our certificate, now proceed to the CA + // certificates. + X509* ca; + int r; + uint32_t err; + + SSL_CTX_clear_chain_certs(ctx); + + while ((ca = PEM_read_bio_X509(in, NULL, SSL_CTX_get_default_passwd_cb(ctx), + SSL_CTX_get_default_passwd_cb_userdata(ctx))) + != NULL) { + r = SSL_CTX_add0_chain_cert(ctx, ca); + if (!r) { + X509_free(ca); + ret = 0; + goto end; + } + // Note that we must not free r if it was successfully added to the chain + // (while we must free the main certificate, since its reference count is + // increased by SSL_CTX_use_certificate). + } + + // When the while loop ends, it's usually just EOF. + err = ERR_peek_last_error(); + if (ERR_GET_LIB(err) == ERR_LIB_PEM && ERR_GET_REASON(err) == PEM_R_NO_START_LINE) { + ERR_clear_error(); + } else { + ret = 0; // some real error + } } - } end: - X509_free(x); - BIO_free(in); - return ret; -} - -const char* us_X509_error_code(long err) { // NOLINT(runtime/int) - const char* code = "UNSPECIFIED"; -#define CASE_X509_ERR(CODE) case X509_V_ERR_##CODE: code = #CODE; break; - switch (err) { - // if you modify anything in here, *please* update the respective section in - // doc/api/tls.md as well - CASE_X509_ERR(UNABLE_TO_GET_ISSUER_CERT) - CASE_X509_ERR(UNABLE_TO_GET_CRL) - CASE_X509_ERR(UNABLE_TO_DECRYPT_CERT_SIGNATURE) - CASE_X509_ERR(UNABLE_TO_DECRYPT_CRL_SIGNATURE) - CASE_X509_ERR(UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY) - CASE_X509_ERR(CERT_SIGNATURE_FAILURE) - CASE_X509_ERR(CRL_SIGNATURE_FAILURE) - CASE_X509_ERR(CERT_NOT_YET_VALID) - CASE_X509_ERR(CERT_HAS_EXPIRED) - CASE_X509_ERR(CRL_NOT_YET_VALID) - CASE_X509_ERR(CRL_HAS_EXPIRED) - CASE_X509_ERR(ERROR_IN_CERT_NOT_BEFORE_FIELD) - CASE_X509_ERR(ERROR_IN_CERT_NOT_AFTER_FIELD) - CASE_X509_ERR(ERROR_IN_CRL_LAST_UPDATE_FIELD) - CASE_X509_ERR(ERROR_IN_CRL_NEXT_UPDATE_FIELD) - CASE_X509_ERR(OUT_OF_MEM) - CASE_X509_ERR(DEPTH_ZERO_SELF_SIGNED_CERT) - CASE_X509_ERR(SELF_SIGNED_CERT_IN_CHAIN) - CASE_X509_ERR(UNABLE_TO_GET_ISSUER_CERT_LOCALLY) - CASE_X509_ERR(UNABLE_TO_VERIFY_LEAF_SIGNATURE) - CASE_X509_ERR(CERT_CHAIN_TOO_LONG) - CASE_X509_ERR(CERT_REVOKED) - CASE_X509_ERR(INVALID_CA) - CASE_X509_ERR(PATH_LENGTH_EXCEEDED) - CASE_X509_ERR(INVALID_PURPOSE) - CASE_X509_ERR(CERT_UNTRUSTED) - CASE_X509_ERR(CERT_REJECTED) - CASE_X509_ERR(HOSTNAME_MISMATCH) - } + X509_free(x); + BIO_free(in); + return ret; +} + +const char* us_X509_error_code(long err) +{ // NOLINT(runtime/int) + const char* code = "UNSPECIFIED"; +#define CASE_X509_ERR(CODE) \ + case X509_V_ERR_##CODE: \ + code = #CODE; \ + break; + switch (err) { + // if you modify anything in here, *please* update the respective section in + // doc/api/tls.md as well + CASE_X509_ERR(UNABLE_TO_GET_ISSUER_CERT) + CASE_X509_ERR(UNABLE_TO_GET_CRL) + CASE_X509_ERR(UNABLE_TO_DECRYPT_CERT_SIGNATURE) + CASE_X509_ERR(UNABLE_TO_DECRYPT_CRL_SIGNATURE) + CASE_X509_ERR(UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY) + CASE_X509_ERR(CERT_SIGNATURE_FAILURE) + CASE_X509_ERR(CRL_SIGNATURE_FAILURE) + CASE_X509_ERR(CERT_NOT_YET_VALID) + CASE_X509_ERR(CERT_HAS_EXPIRED) + CASE_X509_ERR(CRL_NOT_YET_VALID) + CASE_X509_ERR(CRL_HAS_EXPIRED) + CASE_X509_ERR(ERROR_IN_CERT_NOT_BEFORE_FIELD) + CASE_X509_ERR(ERROR_IN_CERT_NOT_AFTER_FIELD) + CASE_X509_ERR(ERROR_IN_CRL_LAST_UPDATE_FIELD) + CASE_X509_ERR(ERROR_IN_CRL_NEXT_UPDATE_FIELD) + CASE_X509_ERR(OUT_OF_MEM) + CASE_X509_ERR(DEPTH_ZERO_SELF_SIGNED_CERT) + CASE_X509_ERR(SELF_SIGNED_CERT_IN_CHAIN) + CASE_X509_ERR(UNABLE_TO_GET_ISSUER_CERT_LOCALLY) + CASE_X509_ERR(UNABLE_TO_VERIFY_LEAF_SIGNATURE) + CASE_X509_ERR(CERT_CHAIN_TOO_LONG) + CASE_X509_ERR(CERT_REVOKED) + CASE_X509_ERR(INVALID_CA) + CASE_X509_ERR(PATH_LENGTH_EXCEEDED) + CASE_X509_ERR(INVALID_PURPOSE) + CASE_X509_ERR(CERT_UNTRUSTED) + CASE_X509_ERR(CERT_REJECTED) + CASE_X509_ERR(HOSTNAME_MISMATCH) + } #undef CASE_X509_ERR - return code; + return code; } -long us_internal_verify_peer_certificate( // NOLINT(runtime/int) +long us_internal_verify_peer_certificate( // NOLINT(runtime/int) const SSL* ssl, - long def) { // NOLINT(runtime/int) - long err = def; // NOLINT(runtime/int) - X509* peer_cert = SSL_get_peer_certificate(ssl); - if (peer_cert) { - X509_free(peer_cert); - err = SSL_get_verify_result(ssl); - } else { - const SSL_CIPHER* curr_cipher = SSL_get_current_cipher(ssl); - - const SSL_SESSION* sess = SSL_get_session(ssl); - // Allow no-cert for PSK authentication in TLS1.2 and lower. - // In TLS1.3 check that session was reused because TLS1.3 PSK - // looks like session resumption. - if ((curr_cipher && SSL_CIPHER_get_auth_nid(curr_cipher) == NID_auth_psk) || - (sess && SSL_SESSION_get_protocol_version(sess) == TLS1_3_VERSION && - SSL_session_reused(ssl))) { - return X509_V_OK; + long def) +{ // NOLINT(runtime/int) + long err = def; // NOLINT(runtime/int) + X509* peer_cert = SSL_get_peer_certificate(ssl); + if (peer_cert) { + X509_free(peer_cert); + err = SSL_get_verify_result(ssl); + } else { + const SSL_CIPHER* curr_cipher = SSL_get_current_cipher(ssl); + + const SSL_SESSION* sess = SSL_get_session(ssl); + // Allow no-cert for PSK authentication in TLS1.2 and lower. + // In TLS1.3 check that session was reused because TLS1.3 PSK + // looks like session resumption. + if ((curr_cipher && SSL_CIPHER_get_auth_nid(curr_cipher) == NID_auth_psk) || (sess && SSL_SESSION_get_protocol_version(sess) == TLS1_3_VERSION && SSL_session_reused(ssl))) { + return X509_V_OK; + } } - } - return err; + return err; } - -struct us_bun_verify_error_t us_internal_verify_error(struct us_internal_ssl_socket_t *s) { +struct us_bun_verify_error_t us_internal_verify_error(struct us_internal_ssl_socket_t* s) +{ if (us_socket_is_closed(0, &s->s) || us_internal_ssl_socket_is_shut_down(s)) { return (struct us_bun_verify_error_t) { .error = 0, .code = NULL, .reason = NULL }; } SSL* ssl = s->ssl; - long x509_verify_error = // NOLINT(runtime/int) + long x509_verify_error = // NOLINT(runtime/int) us_internal_verify_peer_certificate( ssl, X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT); if (x509_verify_error == X509_V_OK) return (struct us_bun_verify_error_t) { .error = x509_verify_error, .code = NULL, .reason = NULL }; - + const char* reason = X509_verify_cert_error_string(x509_verify_error); const char* code = us_X509_error_code(x509_verify_error); return (struct us_bun_verify_error_t) { .error = x509_verify_error, .code = code, .reason = reason }; } -int us_verify_callback(int preverify_ok, X509_STORE_CTX* ctx) { - // From https://www.openssl.org/docs/man1.1.1/man3/SSL_verify_cb: - // - // If VerifyCallback returns 1, the verification process is continued. If - // VerifyCallback always returns 1, the TLS/SSL handshake will not be - // terminated with respect to verification failures and the connection will - // be established. The calling process can however retrieve the error code - // of the last verification error using SSL_get_verify_result(3) or by - // maintaining its own error storage managed by VerifyCallback. - // - // Since we cannot perform I/O quickly enough with X509_STORE_CTX_ APIs in - // this callback, we ignore all preverify_ok errors and let the handshake - // continue. It is imperative that the user use Connection::VerifyError after - // the 'secure' callback has been made. - return 1; -} - -SSL_CTX *create_ssl_context_from_bun_options(struct us_bun_socket_context_options_t options) { +int us_verify_callback(int preverify_ok, X509_STORE_CTX* ctx) +{ + // From https://www.openssl.org/docs/man1.1.1/man3/SSL_verify_cb: + // + // If VerifyCallback returns 1, the verification process is continued. If + // VerifyCallback always returns 1, the TLS/SSL handshake will not be + // terminated with respect to verification failures and the connection will + // be established. The calling process can however retrieve the error code + // of the last verification error using SSL_get_verify_result(3) or by + // maintaining its own error storage managed by VerifyCallback. + // + // Since we cannot perform I/O quickly enough with X509_STORE_CTX_ APIs in + // this callback, we ignore all preverify_ok errors and let the handshake + // continue. It is imperative that the user use Connection::VerifyError after + // the 'secure' callback has been made. + return 1; +} + +SSL_CTX* create_ssl_context_from_bun_options(struct us_bun_socket_context_options_t options) +{ /* Create the context */ - SSL_CTX *ssl_context = SSL_CTX_new(TLS_method()); + SSL_CTX* ssl_context = SSL_CTX_new(TLS_method()); /* Default options we rely on - changing these will break our logic */ SSL_CTX_set_read_ahead(ssl_context, 1); @@ -1008,14 +938,13 @@ SSL_CTX *create_ssl_context_from_bun_options(struct us_bun_socket_context_option /* Important option for lowering memory usage, but lowers performance slightly */ if (options.ssl_prefer_low_memory_usage) { - SSL_CTX_set_mode(ssl_context, SSL_MODE_RELEASE_BUFFERS); + SSL_CTX_set_mode(ssl_context, SSL_MODE_RELEASE_BUFFERS); } - if (options.passphrase) { /* When freeing the CTX we need to check SSL_CTX_get_default_passwd_cb_userdata and * free it if set */ - SSL_CTX_set_default_passwd_cb_userdata(ssl_context, (void *) strdup(options.passphrase)); + SSL_CTX_set_default_passwd_cb_userdata(ssl_context, (void*)strdup(options.passphrase)); SSL_CTX_set_default_passwd_cb(ssl_context, passphrase_cb); } @@ -1026,7 +955,7 @@ SSL_CTX *create_ssl_context_from_bun_options(struct us_bun_socket_context_option return NULL; } } else if (options.cert && options.cert_count > 0) { - for(unsigned int i = 0; i < options.cert_count; i++) { + for (unsigned int i = 0; i < options.cert_count; i++) { if (us_ssl_ctx_use_certificate_chain(ssl_context, options.cert[i]) != 1) { free_ssl_context(ssl_context); return NULL; @@ -1041,7 +970,7 @@ SSL_CTX *create_ssl_context_from_bun_options(struct us_bun_socket_context_option return NULL; } } else if (options.key && options.key_count > 0) { - for(unsigned int i = 0; i < options.key_count; i++){ + for (unsigned int i = 0; i < options.key_count; i++) { if (us_ssl_ctx_use_privatekey_content(ssl_context, options.key[i], SSL_FILETYPE_PEM) != 1) { free_ssl_context(ssl_context); return NULL; @@ -1052,31 +981,31 @@ SSL_CTX *create_ssl_context_from_bun_options(struct us_bun_socket_context_option if (options.ca_file_name) { SSL_CTX_set_cert_store(ssl_context, us_get_default_ca_store()); - STACK_OF(X509_NAME) *ca_list; + STACK_OF(X509_NAME) * ca_list; ca_list = SSL_load_client_CA_file(options.ca_file_name); - if(ca_list == NULL) { + if (ca_list == NULL) { free_ssl_context(ssl_context); return NULL; } - + SSL_CTX_set_client_CA_list(ssl_context, ca_list); if (SSL_CTX_load_verify_locations(ssl_context, options.ca_file_name, NULL) != 1) { free_ssl_context(ssl_context); return NULL; } - - if(options.reject_unauthorized) { + + if (options.reject_unauthorized) { SSL_CTX_set_verify(ssl_context, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, us_verify_callback); } else { SSL_CTX_set_verify(ssl_context, SSL_VERIFY_PEER, us_verify_callback); } - }else if (options.ca && options.ca_count > 0) { + } else if (options.ca && options.ca_count > 0) { X509_STORE* cert_store = NULL; - - for(unsigned int i = 0; i < options.ca_count; i++){ + + for (unsigned int i = 0; i < options.ca_count; i++) { X509* ca_cert = us_ssl_ctx_get_X509_from(ssl_context, options.ca[i]); - if (ca_cert == NULL){ + if (ca_cert == NULL) { free_ssl_context(ssl_context); return NULL; } @@ -1085,23 +1014,23 @@ SSL_CTX *create_ssl_context_from_bun_options(struct us_bun_socket_context_option cert_store = us_get_default_ca_store(); SSL_CTX_set_cert_store(ssl_context, cert_store); } - + X509_STORE_add_cert(cert_store, ca_cert); - if(!SSL_CTX_add_client_CA(ssl_context, ca_cert)){ + if (!SSL_CTX_add_client_CA(ssl_context, ca_cert)) { free_ssl_context(ssl_context); return NULL; } - if(options.reject_unauthorized) { + if (options.reject_unauthorized) { SSL_CTX_set_verify(ssl_context, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, us_verify_callback); } else { SSL_CTX_set_verify(ssl_context, SSL_VERIFY_PEER, us_verify_callback); } } } else { - if(options.request_cert) { + if (options.request_cert) { SSL_CTX_set_cert_store(ssl_context, us_get_default_ca_store()); - - if(options.reject_unauthorized) { + + if (options.reject_unauthorized) { SSL_CTX_set_verify(ssl_context, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, us_verify_callback); } else { SSL_CTX_set_verify(ssl_context, SSL_VERIFY_PEER, us_verify_callback); @@ -1110,8 +1039,8 @@ SSL_CTX *create_ssl_context_from_bun_options(struct us_bun_socket_context_option } if (options.dh_params_file_name) { /* Set up ephemeral DH parameters. */ - DH *dh_2048 = NULL; - FILE *paramfile; + DH* dh_2048 = NULL; + FILE* paramfile; paramfile = fopen(options.dh_params_file_name, "r"); if (paramfile) { @@ -1158,11 +1087,12 @@ SSL_CTX *create_ssl_context_from_bun_options(struct us_bun_socket_context_option } /* Returns a servername's userdata if any */ -void *us_internal_ssl_socket_context_find_server_name_userdata(struct us_internal_ssl_socket_context_t *context, const char *hostname_pattern) { - +void* us_internal_ssl_socket_context_find_server_name_userdata(struct us_internal_ssl_socket_context_t* context, const char* hostname_pattern) +{ + /* We can use sni_find because looking up a "wildcard pattern" will match the exact literal "wildcard pattern" first, * before it matches by the very wildcard itself, so it works fine (exact match is the only thing we care for here) */ - SSL_CTX *ssl_context = sni_find(context->sni, hostname_pattern); + SSL_CTX* ssl_context = sni_find(context->sni, hostname_pattern); if (ssl_context) { return SSL_CTX_get_ex_data(ssl_context, 0); @@ -1172,15 +1102,17 @@ void *us_internal_ssl_socket_context_find_server_name_userdata(struct us_interna } /* Returns either nullptr or the previously set user data attached to this SSL's selected SNI context */ -void *us_internal_ssl_socket_get_sni_userdata(struct us_internal_ssl_socket_t *s) { +void* us_internal_ssl_socket_get_sni_userdata(struct us_internal_ssl_socket_t* s) +{ return SSL_CTX_get_ex_data(SSL_get_SSL_CTX(s->ssl), 0); } /* Todo: return error on failure? */ -void us_internal_ssl_socket_context_add_server_name(struct us_internal_ssl_socket_context_t *context, const char *hostname_pattern, struct us_socket_context_options_t options, void *user) { +void us_internal_ssl_socket_context_add_server_name(struct us_internal_ssl_socket_context_t* context, const char* hostname_pattern, struct us_socket_context_options_t options, void* user) +{ /* Try and construct an SSL_CTX from options */ - SSL_CTX *ssl_context = create_ssl_context_from_options(options); + SSL_CTX* ssl_context = create_ssl_context_from_options(options); /* Attach the user data to this context */ if (1 != SSL_CTX_set_ex_data(ssl_context, 0, user)) { @@ -1196,10 +1128,11 @@ void us_internal_ssl_socket_context_add_server_name(struct us_internal_ssl_socke } } -void us_bun_internal_ssl_socket_context_add_server_name(struct us_internal_ssl_socket_context_t *context, const char *hostname_pattern, struct us_bun_socket_context_options_t options, void *user) { +void us_bun_internal_ssl_socket_context_add_server_name(struct us_internal_ssl_socket_context_t* context, const char* hostname_pattern, struct us_bun_socket_context_options_t options, void* user) +{ /* Try and construct an SSL_CTX from options */ - SSL_CTX *ssl_context = create_ssl_context_from_bun_options(options); + SSL_CTX* ssl_context = create_ssl_context_from_bun_options(options); /* Attach the user data to this context */ if (1 != SSL_CTX_set_ex_data(ssl_context, 0, user)) { @@ -1215,22 +1148,25 @@ void us_bun_internal_ssl_socket_context_add_server_name(struct us_internal_ssl_s } } -void us_internal_ssl_socket_context_on_server_name(struct us_internal_ssl_socket_context_t *context, void (*cb)(struct us_internal_ssl_socket_context_t *, const char *hostname)) { +void us_internal_ssl_socket_context_on_server_name(struct us_internal_ssl_socket_context_t* context, void (*cb)(struct us_internal_ssl_socket_context_t*, const char* hostname)) +{ context->on_server_name = cb; } -void us_internal_ssl_socket_context_remove_server_name(struct us_internal_ssl_socket_context_t *context, const char *hostname_pattern) { +void us_internal_ssl_socket_context_remove_server_name(struct us_internal_ssl_socket_context_t* context, const char* hostname_pattern) +{ /* The same thing must happen for sni_free, that's why we have a callback */ - SSL_CTX *sni_node_ssl_context = (SSL_CTX *) sni_remove(context->sni, hostname_pattern); + SSL_CTX* sni_node_ssl_context = (SSL_CTX*)sni_remove(context->sni, hostname_pattern); free_ssl_context(sni_node_ssl_context); } /* Returns NULL or SSL_CTX. May call missing server name callback */ -SSL_CTX *resolve_context(struct us_internal_ssl_socket_context_t *context, const char *hostname) { +SSL_CTX* resolve_context(struct us_internal_ssl_socket_context_t* context, const char* hostname) +{ /* Try once first */ - void *user = sni_find(context->sni, hostname); + void* user = sni_find(context->sni, hostname); if (!user) { /* Emit missing hostname then try again */ if (!context->on_server_name) { @@ -1248,20 +1184,20 @@ SSL_CTX *resolve_context(struct us_internal_ssl_socket_context_t *context, const } // arg is context -int sni_cb(SSL *ssl, int *al, void *arg) { +int sni_cb(SSL* ssl, int* al, void* arg) +{ if (ssl) { - const char *hostname = SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name); + const char* hostname = SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name); if (hostname && hostname[0]) { /* Try and resolve (match) required hostname with what we have registered */ - SSL_CTX *resolved_ssl_context = resolve_context((struct us_internal_ssl_socket_context_t *) arg, hostname); + SSL_CTX* resolved_ssl_context = resolve_context((struct us_internal_ssl_socket_context_t*)arg, hostname); if (resolved_ssl_context) { - //printf("Did find matching SNI context for hostname: <%s>!\n", hostname); + // printf("Did find matching SNI context for hostname: <%s>!\n", hostname); SSL_set_SSL_CTX(ssl, resolved_ssl_context); } else { /* Call a blocking callback notifying of missing context */ } - } return SSL_TLSEXT_ERR_OK; @@ -1271,33 +1207,34 @@ int sni_cb(SSL *ssl, int *al, void *arg) { return SSL_TLSEXT_ERR_NOACK; } -struct us_internal_ssl_socket_context_t *us_internal_create_ssl_socket_context(struct us_loop_t *loop, int context_ext_size, struct us_socket_context_options_t options) { +struct us_internal_ssl_socket_context_t* us_internal_create_ssl_socket_context(struct us_loop_t* loop, int context_ext_size, struct us_socket_context_options_t options) +{ /* If we haven't initialized the loop data yet, do so . * This is needed because loop data holds shared OpenSSL data and * the function is also responsible for initializing OpenSSL */ us_internal_init_loop_ssl_data(loop); /* First of all we try and create the SSL context from options */ - SSL_CTX *ssl_context = create_ssl_context_from_options(options); + SSL_CTX* ssl_context = create_ssl_context_from_options(options); if (!ssl_context) { /* We simply fail early if we cannot even create the OpenSSL context */ return NULL; } /* Otherwise ee continue by creating a non-SSL context, but with larger ext to hold our SSL stuff */ - struct us_internal_ssl_socket_context_t *context = (struct us_internal_ssl_socket_context_t *) us_create_socket_context(0, loop, sizeof(struct us_internal_ssl_socket_context_t) + context_ext_size, options); + struct us_internal_ssl_socket_context_t* context = (struct us_internal_ssl_socket_context_t*)us_create_socket_context(0, loop, sizeof(struct us_internal_ssl_socket_context_t) + context_ext_size, options); /* I guess this is the only optional callback */ context->on_server_name = NULL; /* Then we extend its SSL parts */ - context->ssl_context = ssl_context;//create_ssl_context_from_options(options); + context->ssl_context = ssl_context; // create_ssl_context_from_options(options); context->is_parent = 1; context->on_handshake = NULL; context->handshake_data = NULL; /* We, as parent context, may ignore data */ - context->sc.is_low_prio = (int (*)(struct us_socket_t *)) ssl_is_low_prio; + context->sc.is_low_prio = (int (*)(struct us_socket_t*))ssl_is_low_prio; /* Parent contexts may use SNI */ SSL_CTX_set_tlsext_servername_callback(context->ssl_context, sni_cb); @@ -1308,33 +1245,34 @@ struct us_internal_ssl_socket_context_t *us_internal_create_ssl_socket_context(s return context; } -struct us_internal_ssl_socket_context_t *us_internal_bun_create_ssl_socket_context(struct us_loop_t *loop, int context_ext_size, struct us_bun_socket_context_options_t options) { +struct us_internal_ssl_socket_context_t* us_internal_bun_create_ssl_socket_context(struct us_loop_t* loop, int context_ext_size, struct us_bun_socket_context_options_t options) +{ /* If we haven't initialized the loop data yet, do so . * This is needed because loop data holds shared OpenSSL data and * the function is also responsible for initializing OpenSSL */ us_internal_init_loop_ssl_data(loop); /* First of all we try and create the SSL context from options */ - SSL_CTX *ssl_context = create_ssl_context_from_bun_options(options); + SSL_CTX* ssl_context = create_ssl_context_from_bun_options(options); if (!ssl_context) { /* We simply fail early if we cannot even create the OpenSSL context */ return NULL; } /* Otherwise ee continue by creating a non-SSL context, but with larger ext to hold our SSL stuff */ - struct us_internal_ssl_socket_context_t *context = (struct us_internal_ssl_socket_context_t *) us_create_bun_socket_context(0, loop, sizeof(struct us_internal_ssl_socket_context_t) + context_ext_size, options); + struct us_internal_ssl_socket_context_t* context = (struct us_internal_ssl_socket_context_t*)us_create_bun_socket_context(0, loop, sizeof(struct us_internal_ssl_socket_context_t) + context_ext_size, options); /* I guess this is the only optional callback */ context->on_server_name = NULL; /* Then we extend its SSL parts */ - context->ssl_context = ssl_context;//create_ssl_context_from_options(options); + context->ssl_context = ssl_context; // create_ssl_context_from_options(options); context->is_parent = 1; - + context->on_handshake = NULL; context->handshake_data = NULL; /* We, as parent context, may ignore data */ - context->sc.is_low_prio = (int (*)(struct us_socket_t *)) ssl_is_low_prio; + context->sc.is_low_prio = (int (*)(struct us_socket_t*))ssl_is_low_prio; /* Parent contexts may use SNI */ SSL_CTX_set_tlsext_servername_callback(context->ssl_context, sni_cb); @@ -1347,12 +1285,14 @@ struct us_internal_ssl_socket_context_t *us_internal_bun_create_ssl_socket_conte } /* Our destructor for hostnames, used below */ -void sni_hostname_destructor(void *user) { +void sni_hostname_destructor(void* user) +{ /* Some nodes hold null, so this one must ignore this case */ - free_ssl_context((SSL_CTX *) user); + free_ssl_context((SSL_CTX*)user); } -void us_internal_ssl_socket_context_free(struct us_internal_ssl_socket_context_t *context) { +void us_internal_ssl_socket_context_free(struct us_internal_ssl_socket_context_t* context) +{ /* If we are parent then we need to free our OpenSSL context */ if (context->is_parent) { free_ssl_context(context->ssl_context); @@ -1365,103 +1305,115 @@ void us_internal_ssl_socket_context_free(struct us_internal_ssl_socket_context_t us_socket_context_free(0, &context->sc); } -struct us_listen_socket_t *us_internal_ssl_socket_context_listen(struct us_internal_ssl_socket_context_t *context, const char *host, int port, int options, int socket_ext_size) { +struct us_listen_socket_t* us_internal_ssl_socket_context_listen(struct us_internal_ssl_socket_context_t* context, const char* host, int port, int options, int socket_ext_size) +{ return us_socket_context_listen(0, &context->sc, host, port, options, sizeof(struct us_internal_ssl_socket_t) - sizeof(struct us_socket_t) + socket_ext_size); } -struct us_listen_socket_t *us_internal_ssl_socket_context_listen_unix(struct us_internal_ssl_socket_context_t *context, const char *path, int options, int socket_ext_size) { +struct us_listen_socket_t* us_internal_ssl_socket_context_listen_unix(struct us_internal_ssl_socket_context_t* context, const char* path, int options, int socket_ext_size) +{ return us_socket_context_listen_unix(0, &context->sc, path, options, sizeof(struct us_internal_ssl_socket_t) - sizeof(struct us_socket_t) + socket_ext_size); } -struct us_internal_ssl_socket_t *us_internal_ssl_socket_context_connect(struct us_internal_ssl_socket_context_t *context, const char *host, int port, const char *source_host, int options, int socket_ext_size) { - return (struct us_internal_ssl_socket_t *) us_socket_context_connect(0, &context->sc, host, port, source_host, options, sizeof(struct us_internal_ssl_socket_t) - sizeof(struct us_socket_t) + socket_ext_size); +struct us_internal_ssl_socket_t* us_internal_ssl_socket_context_connect(struct us_internal_ssl_socket_context_t* context, const char* host, int port, const char* source_host, int options, int socket_ext_size) +{ + return (struct us_internal_ssl_socket_t*)us_socket_context_connect(0, &context->sc, host, port, source_host, options, sizeof(struct us_internal_ssl_socket_t) - sizeof(struct us_socket_t) + socket_ext_size); } -struct us_internal_ssl_socket_t *us_internal_ssl_socket_context_connect_unix(struct us_internal_ssl_socket_context_t *context, const char *server_path, int options, int socket_ext_size) { - return (struct us_internal_ssl_socket_t *) us_socket_context_connect_unix(0, &context->sc, server_path, options, sizeof(struct us_internal_ssl_socket_t) - sizeof(struct us_socket_t) + socket_ext_size); +struct us_internal_ssl_socket_t* us_internal_ssl_socket_context_connect_unix(struct us_internal_ssl_socket_context_t* context, const char* server_path, int options, int socket_ext_size) +{ + return (struct us_internal_ssl_socket_t*)us_socket_context_connect_unix(0, &context->sc, server_path, options, sizeof(struct us_internal_ssl_socket_t) - sizeof(struct us_socket_t) + socket_ext_size); } -void us_internal_ssl_socket_context_on_open(struct us_internal_ssl_socket_context_t *context, struct us_internal_ssl_socket_t *(*on_open)(struct us_internal_ssl_socket_t *s, int is_client, char *ip, int ip_length)) { - us_socket_context_on_open(0, &context->sc, (struct us_socket_t *(*)(struct us_socket_t *, int, char *, int)) ssl_on_open); +void us_internal_ssl_socket_context_on_open(struct us_internal_ssl_socket_context_t* context, struct us_internal_ssl_socket_t* (*on_open)(struct us_internal_ssl_socket_t* s, int is_client, char* ip, int ip_length)) +{ + us_socket_context_on_open(0, &context->sc, (struct us_socket_t * (*)(struct us_socket_t*, int, char*, int)) ssl_on_open); context->on_open = on_open; } -void us_internal_ssl_socket_context_on_close(struct us_internal_ssl_socket_context_t *context, struct us_internal_ssl_socket_t *(*on_close)(struct us_internal_ssl_socket_t *s, int code, void *reason)) { - us_socket_context_on_close(0, (struct us_socket_context_t *) context, (struct us_socket_t *(*)(struct us_socket_t *, int, void *)) ssl_on_close); +void us_internal_ssl_socket_context_on_close(struct us_internal_ssl_socket_context_t* context, struct us_internal_ssl_socket_t* (*on_close)(struct us_internal_ssl_socket_t* s, int code, void* reason)) +{ + us_socket_context_on_close(0, (struct us_socket_context_t*)context, (struct us_socket_t * (*)(struct us_socket_t*, int, void*)) ssl_on_close); context->on_close = on_close; } -void us_internal_ssl_socket_context_on_data(struct us_internal_ssl_socket_context_t *context, struct us_internal_ssl_socket_t *(*on_data)(struct us_internal_ssl_socket_t *s, char *data, int length)) { - us_socket_context_on_data(0, (struct us_socket_context_t *) context, (struct us_socket_t *(*)(struct us_socket_t *, char *, int)) ssl_on_data); +void us_internal_ssl_socket_context_on_data(struct us_internal_ssl_socket_context_t* context, struct us_internal_ssl_socket_t* (*on_data)(struct us_internal_ssl_socket_t* s, char* data, int length)) +{ + us_socket_context_on_data(0, (struct us_socket_context_t*)context, (struct us_socket_t * (*)(struct us_socket_t*, char*, int)) ssl_on_data); context->on_data = on_data; } -void us_internal_ssl_socket_context_on_writable(struct us_internal_ssl_socket_context_t *context, struct us_internal_ssl_socket_t *(*on_writable)(struct us_internal_ssl_socket_t *s)) { - us_socket_context_on_writable(0, (struct us_socket_context_t *) context, (struct us_socket_t *(*)(struct us_socket_t *)) ssl_on_writable); +void us_internal_ssl_socket_context_on_writable(struct us_internal_ssl_socket_context_t* context, struct us_internal_ssl_socket_t* (*on_writable)(struct us_internal_ssl_socket_t* s)) +{ + us_socket_context_on_writable(0, (struct us_socket_context_t*)context, (struct us_socket_t * (*)(struct us_socket_t*)) ssl_on_writable); context->on_writable = on_writable; } -void us_internal_ssl_socket_context_on_timeout(struct us_internal_ssl_socket_context_t *context, struct us_internal_ssl_socket_t *(*on_timeout)(struct us_internal_ssl_socket_t *s)) { - us_socket_context_on_timeout(0, (struct us_socket_context_t *) context, (struct us_socket_t *(*)(struct us_socket_t *)) on_timeout); +void us_internal_ssl_socket_context_on_timeout(struct us_internal_ssl_socket_context_t* context, struct us_internal_ssl_socket_t* (*on_timeout)(struct us_internal_ssl_socket_t* s)) +{ + us_socket_context_on_timeout(0, (struct us_socket_context_t*)context, (struct us_socket_t * (*)(struct us_socket_t*)) on_timeout); } -void us_internal_ssl_socket_context_on_long_timeout(struct us_internal_ssl_socket_context_t *context, struct us_internal_ssl_socket_t *(*on_long_timeout)(struct us_internal_ssl_socket_t *s)) { - us_socket_context_on_long_timeout(0, (struct us_socket_context_t *) context, (struct us_socket_t *(*)(struct us_socket_t *)) on_long_timeout); +void us_internal_ssl_socket_context_on_long_timeout(struct us_internal_ssl_socket_context_t* context, struct us_internal_ssl_socket_t* (*on_long_timeout)(struct us_internal_ssl_socket_t* s)) +{ + us_socket_context_on_long_timeout(0, (struct us_socket_context_t*)context, (struct us_socket_t * (*)(struct us_socket_t*)) on_long_timeout); } /* We do not really listen to passed FIN-handler, we entirely override it with our handler since SSL doesn't really have support for half-closed sockets */ -void us_internal_ssl_socket_context_on_end(struct us_internal_ssl_socket_context_t *context, struct us_internal_ssl_socket_t *(*on_end)(struct us_internal_ssl_socket_t *)) { - us_socket_context_on_end(0, (struct us_socket_context_t *) context, (struct us_socket_t *(*)(struct us_socket_t *)) ssl_on_end); +void us_internal_ssl_socket_context_on_end(struct us_internal_ssl_socket_context_t* context, struct us_internal_ssl_socket_t* (*on_end)(struct us_internal_ssl_socket_t*)) +{ + us_socket_context_on_end(0, (struct us_socket_context_t*)context, (struct us_socket_t * (*)(struct us_socket_t*)) ssl_on_end); } -void us_internal_ssl_socket_context_on_connect_error(struct us_internal_ssl_socket_context_t *context, struct us_internal_ssl_socket_t *(*on_connect_error)(struct us_internal_ssl_socket_t *, int code)) { - us_socket_context_on_connect_error(0, (struct us_socket_context_t *) context, (struct us_socket_t *(*)(struct us_socket_t *, int)) on_connect_error); +void us_internal_ssl_socket_context_on_connect_error(struct us_internal_ssl_socket_context_t* context, struct us_internal_ssl_socket_t* (*on_connect_error)(struct us_internal_ssl_socket_t*, int code)) +{ + us_socket_context_on_connect_error(0, (struct us_socket_context_t*)context, (struct us_socket_t * (*)(struct us_socket_t*, int)) on_connect_error); } -void *us_internal_ssl_socket_context_ext(struct us_internal_ssl_socket_context_t *context) { +void* us_internal_ssl_socket_context_ext(struct us_internal_ssl_socket_context_t* context) +{ return context + 1; } /* Per socket functions */ -void *us_internal_ssl_socket_get_native_handle(struct us_internal_ssl_socket_t *s) { +void* us_internal_ssl_socket_get_native_handle(struct us_internal_ssl_socket_t* s) +{ return s->ssl; } -int us_internal_ssl_socket_raw_write(struct us_internal_ssl_socket_t *s, const char *data, int length, int msg_more) { - +int us_internal_ssl_socket_raw_write(struct us_internal_ssl_socket_t* s, const char* data, int length, int msg_more) +{ + if (us_socket_is_closed(0, &s->s) || us_internal_ssl_socket_is_shut_down(s)) { return 0; } return us_socket_write(0, &s->s, data, length, msg_more); } -int us_internal_ssl_socket_write(struct us_internal_ssl_socket_t *s, const char *data, int length, int msg_more) { - +int us_internal_ssl_socket_write(struct us_internal_ssl_socket_t* s, const char* data, int length, int msg_more) +{ if (us_socket_is_closed(0, &s->s) || us_internal_ssl_socket_is_shut_down(s)) { return 0; } - struct us_internal_ssl_socket_context_t *context = (struct us_internal_ssl_socket_context_t *) us_socket_context(0, &s->s); + struct us_internal_ssl_socket_context_t* context = (struct us_internal_ssl_socket_context_t*)us_socket_context(0, &s->s); - struct us_loop_t *loop = us_socket_context_loop(0, &context->sc); - struct loop_ssl_data *loop_ssl_data = (struct loop_ssl_data *) loop->data.ssl_data; + struct us_loop_t* loop = us_socket_context_loop(0, &context->sc); + struct loop_ssl_data* loop_ssl_data = (struct loop_ssl_data*)loop->data.ssl_data; // it makes literally no sense to touch this here! it should start at 0 and ONLY be set and reset by the on_data function! // the way is is now, triggering a write from a read will essentially delete all input data! // what we need to do is to check if this ever is non-zero and print a warning - - loop_ssl_data->ssl_read_input_length = 0; - loop_ssl_data->ssl_socket = &s->s; loop_ssl_data->msg_more = msg_more; loop_ssl_data->last_write_was_msg_more = 0; - //printf("Calling SSL_write\n"); + // printf("Calling SSL_write\n"); int written = SSL_write(s->ssl, data, length); - //printf("Returning from SSL_write\n"); + // printf("Returning from SSL_write\n"); loop_ssl_data->msg_more = 0; if (loop_ssl_data->last_write_was_msg_more && !msg_more) { @@ -1486,32 +1438,33 @@ int us_internal_ssl_socket_write(struct us_internal_ssl_socket_t *s, const char } } -void *us_internal_ssl_socket_ext(struct us_internal_ssl_socket_t *s) { +void* us_internal_ssl_socket_ext(struct us_internal_ssl_socket_t* s) +{ return s + 1; } -int us_internal_ssl_socket_is_shut_down(struct us_internal_ssl_socket_t *s) { - return us_socket_is_shut_down(0, &s->s) || SSL_get_shutdown(s->ssl) & SSL_SENT_SHUTDOWN; +int us_internal_ssl_socket_is_shut_down(struct us_internal_ssl_socket_t* s) +{ + return us_socket_is_shut_down(0, &s->s) || SSL_get_shutdown(s->ssl) & SSL_SENT_SHUTDOWN; } -void us_internal_ssl_socket_shutdown(struct us_internal_ssl_socket_t *s) { +void us_internal_ssl_socket_shutdown(struct us_internal_ssl_socket_t* s) +{ if (!us_socket_is_closed(0, &s->s) && !us_internal_ssl_socket_is_shut_down(s)) { - struct us_internal_ssl_socket_context_t *context = (struct us_internal_ssl_socket_context_t *) us_socket_context(0, &s->s); - struct us_loop_t *loop = us_socket_context_loop(0, &context->sc); - struct loop_ssl_data *loop_ssl_data = (struct loop_ssl_data *) loop->data.ssl_data; + struct us_internal_ssl_socket_context_t* context = (struct us_internal_ssl_socket_context_t*)us_socket_context(0, &s->s); + struct us_loop_t* loop = us_socket_context_loop(0, &context->sc); + struct loop_ssl_data* loop_ssl_data = (struct loop_ssl_data*)loop->data.ssl_data; // also makes no sense to touch this here! // however the idea is that if THIS socket is not the same as ssl_socket then this data is not for me // but this is not correct as it is currently anyways, any data available should be properly reset loop_ssl_data->ssl_read_input_length = 0; - // essentially we need two of these: one for CURRENT CALL and one for CURRENT SOCKET WITH DATA // if those match in the BIO function then you may read, if not then you may not read // we need ssl_read_socket to be set in on_data and checked in the BIO loop_ssl_data->ssl_socket = &s->s; - loop_ssl_data->msg_more = 0; // sets SSL_SENT_SHUTDOWN no matter what (not actually true if error!) @@ -1534,16 +1487,16 @@ void us_internal_ssl_socket_shutdown(struct us_internal_ssl_socket_t *s) { } } -struct us_internal_ssl_socket_t *us_internal_ssl_socket_context_adopt_socket(struct us_internal_ssl_socket_context_t *context, struct us_internal_ssl_socket_t *s, int ext_size) { +struct us_internal_ssl_socket_t* us_internal_ssl_socket_context_adopt_socket(struct us_internal_ssl_socket_context_t* context, struct us_internal_ssl_socket_t* s, int ext_size) +{ // todo: this is completely untested - return (struct us_internal_ssl_socket_t *) us_socket_context_adopt_socket(0, &context->sc, &s->s, sizeof(struct us_internal_ssl_socket_t) - sizeof(struct us_socket_t) + ext_size); + return (struct us_internal_ssl_socket_t*)us_socket_context_adopt_socket(0, &context->sc, &s->s, sizeof(struct us_internal_ssl_socket_t) - sizeof(struct us_socket_t) + ext_size); } - - -struct us_internal_ssl_socket_t * ssl_wrapped_context_on_close(struct us_internal_ssl_socket_t *s, int code, void *reason) { - struct us_internal_ssl_socket_context_t *context = (struct us_internal_ssl_socket_context_t *) us_socket_context(0, &s->s); - struct us_wrapped_socket_context_t* wrapped_context = (struct us_wrapped_socket_context_t *)us_internal_ssl_socket_context_ext(context); +struct us_internal_ssl_socket_t* ssl_wrapped_context_on_close(struct us_internal_ssl_socket_t* s, int code, void* reason) +{ + struct us_internal_ssl_socket_context_t* context = (struct us_internal_ssl_socket_context_t*)us_socket_context(0, &s->s); + struct us_wrapped_socket_context_t* wrapped_context = (struct us_wrapped_socket_context_t*)us_internal_ssl_socket_context_ext(context); if (wrapped_context->events.on_close) { wrapped_context->events.on_close((struct us_socket_t*)s, code, reason); @@ -1557,10 +1510,10 @@ struct us_internal_ssl_socket_t * ssl_wrapped_context_on_close(struct us_interna return s; } - -struct us_internal_ssl_socket_t * ssl_wrapped_context_on_writable(struct us_internal_ssl_socket_t *s) { - struct us_internal_ssl_socket_context_t *context = (struct us_internal_ssl_socket_context_t *) us_socket_context(0, &s->s); - struct us_wrapped_socket_context_t* wrapped_context = (struct us_wrapped_socket_context_t *)us_internal_ssl_socket_context_ext(context); +struct us_internal_ssl_socket_t* ssl_wrapped_context_on_writable(struct us_internal_ssl_socket_t* s) +{ + struct us_internal_ssl_socket_context_t* context = (struct us_internal_ssl_socket_context_t*)us_socket_context(0, &s->s); + struct us_wrapped_socket_context_t* wrapped_context = (struct us_wrapped_socket_context_t*)us_internal_ssl_socket_context_ext(context); if (wrapped_context->events.on_writable) { wrapped_context->events.on_writable((struct us_socket_t*)s); @@ -1574,10 +1527,10 @@ struct us_internal_ssl_socket_t * ssl_wrapped_context_on_writable(struct us_inte return s; } - -struct us_internal_ssl_socket_t * ssl_wrapped_context_on_data(struct us_internal_ssl_socket_t *s, char *data, int length) { - struct us_internal_ssl_socket_context_t *context = (struct us_internal_ssl_socket_context_t *) us_socket_context(0, &s->s); - struct us_wrapped_socket_context_t* wrapped_context = (struct us_wrapped_socket_context_t *)us_internal_ssl_socket_context_ext(context); +struct us_internal_ssl_socket_t* ssl_wrapped_context_on_data(struct us_internal_ssl_socket_t* s, char* data, int length) +{ + struct us_internal_ssl_socket_context_t* context = (struct us_internal_ssl_socket_context_t*)us_socket_context(0, &s->s); + struct us_wrapped_socket_context_t* wrapped_context = (struct us_wrapped_socket_context_t*)us_internal_ssl_socket_context_ext(context); // raw data if needed if (wrapped_context->old_events.on_data) { wrapped_context->old_events.on_data((struct us_socket_t*)s, data, length); @@ -1586,9 +1539,10 @@ struct us_internal_ssl_socket_t * ssl_wrapped_context_on_data(struct us_internal return ssl_on_data(s, data, length); } -struct us_internal_ssl_socket_t * ssl_wrapped_context_on_timeout(struct us_internal_ssl_socket_t * s) { - struct us_internal_ssl_socket_context_t *context = (struct us_internal_ssl_socket_context_t *) us_socket_context(0, &s->s); - struct us_wrapped_socket_context_t* wrapped_context = (struct us_wrapped_socket_context_t *)us_internal_ssl_socket_context_ext(context); +struct us_internal_ssl_socket_t* ssl_wrapped_context_on_timeout(struct us_internal_ssl_socket_t* s) +{ + struct us_internal_ssl_socket_context_t* context = (struct us_internal_ssl_socket_context_t*)us_socket_context(0, &s->s); + struct us_wrapped_socket_context_t* wrapped_context = (struct us_wrapped_socket_context_t*)us_internal_ssl_socket_context_ext(context); if (wrapped_context->events.on_timeout) { wrapped_context->events.on_timeout((struct us_socket_t*)s); @@ -1601,9 +1555,10 @@ struct us_internal_ssl_socket_t * ssl_wrapped_context_on_timeout(struct us_inter return s; } -struct us_internal_ssl_socket_t * ssl_wrapped_context_on_long_timeout(struct us_internal_ssl_socket_t * s) { - struct us_internal_ssl_socket_context_t *context = (struct us_internal_ssl_socket_context_t *) us_socket_context(0, &s->s); - struct us_wrapped_socket_context_t* wrapped_context = (struct us_wrapped_socket_context_t *)us_internal_ssl_socket_context_ext(context); +struct us_internal_ssl_socket_t* ssl_wrapped_context_on_long_timeout(struct us_internal_ssl_socket_t* s) +{ + struct us_internal_ssl_socket_context_t* context = (struct us_internal_ssl_socket_context_t*)us_socket_context(0, &s->s); + struct us_wrapped_socket_context_t* wrapped_context = (struct us_wrapped_socket_context_t*)us_internal_ssl_socket_context_ext(context); if (wrapped_context->events.on_long_timeout) { wrapped_context->events.on_long_timeout((struct us_socket_t*)s); @@ -1616,9 +1571,10 @@ struct us_internal_ssl_socket_t * ssl_wrapped_context_on_long_timeout(struct us return s; } -struct us_internal_ssl_socket_t * ssl_wrapped_context_on_end(struct us_internal_ssl_socket_t * s) { - struct us_internal_ssl_socket_context_t *context = (struct us_internal_ssl_socket_context_t *) us_socket_context(0, &s->s); - struct us_wrapped_socket_context_t* wrapped_context = (struct us_wrapped_socket_context_t *)us_internal_ssl_socket_context_ext(context); +struct us_internal_ssl_socket_t* ssl_wrapped_context_on_end(struct us_internal_ssl_socket_t* s) +{ + struct us_internal_ssl_socket_context_t* context = (struct us_internal_ssl_socket_context_t*)us_socket_context(0, &s->s); + struct us_wrapped_socket_context_t* wrapped_context = (struct us_wrapped_socket_context_t*)us_internal_ssl_socket_context_ext(context); if (wrapped_context->events.on_end) { wrapped_context->events.on_end((struct us_socket_t*)s); @@ -1630,9 +1586,10 @@ struct us_internal_ssl_socket_t * ssl_wrapped_context_on_end(struct us_internal return s; } -struct us_internal_ssl_socket_t * ssl_wrapped_on_connect_error(struct us_internal_ssl_socket_t * s, int code) { - struct us_internal_ssl_socket_context_t *context = (struct us_internal_ssl_socket_context_t *) us_socket_context(0, &s->s); - struct us_wrapped_socket_context_t* wrapped_context = (struct us_wrapped_socket_context_t *)us_internal_ssl_socket_context_ext(context); +struct us_internal_ssl_socket_t* ssl_wrapped_on_connect_error(struct us_internal_ssl_socket_t* s, int code) +{ + struct us_internal_ssl_socket_context_t* context = (struct us_internal_ssl_socket_context_t*)us_socket_context(0, &s->s); + struct us_wrapped_socket_context_t* wrapped_context = (struct us_wrapped_socket_context_t*)us_internal_ssl_socket_context_ext(context); if (wrapped_context->events.on_connect_error) { wrapped_context->events.on_connect_error((struct us_socket_t*)s, code); @@ -1644,30 +1601,33 @@ struct us_internal_ssl_socket_t * ssl_wrapped_on_connect_error(struct us_interna return s; } -struct us_internal_ssl_socket_t* us_internal_ssl_socket_open(struct us_internal_ssl_socket_t * s, int is_client, char* ip, int ip_length) { +struct us_internal_ssl_socket_t* us_internal_ssl_socket_open(struct us_internal_ssl_socket_t* s, int is_client, char* ip, int ip_length) +{ // closed if (us_socket_is_closed(0, &s->s)) { return s; } // already opened - if (s->ssl) return s; + if (s->ssl) + return s; // start SSL open return ssl_on_open(s, is_client, ip, ip_length); } -struct us_internal_ssl_socket_t *us_internal_ssl_socket_wrap_with_tls(struct us_socket_t *s, struct us_bun_socket_context_options_t options, struct us_socket_events_t events, int socket_ext_size) { +struct us_internal_ssl_socket_t* us_internal_ssl_socket_wrap_with_tls(struct us_socket_t* s, struct us_bun_socket_context_options_t options, struct us_socket_events_t events, int socket_ext_size) +{ /* Cannot wrap a closed socket */ if (us_socket_is_closed(0, s)) { return NULL; } - struct us_socket_context_t * old_context = us_socket_context(0, s); - - struct us_socket_context_t * context = us_create_bun_socket_context(1, old_context->loop, sizeof(struct us_wrapped_socket_context_t), options); - struct us_internal_ssl_socket_context_t *tls_context = (struct us_internal_ssl_socket_context_t *) context; + struct us_socket_context_t* old_context = us_socket_context(0, s); + + struct us_socket_context_t* context = us_create_bun_socket_context(1, old_context->loop, sizeof(struct us_wrapped_socket_context_t), options); + struct us_internal_ssl_socket_context_t* tls_context = (struct us_internal_ssl_socket_context_t*)context; - struct us_wrapped_socket_context_t* wrapped_context = (struct us_wrapped_socket_context_t *)us_internal_ssl_socket_context_ext(tls_context); + struct us_wrapped_socket_context_t* wrapped_context = (struct us_wrapped_socket_context_t*)us_internal_ssl_socket_context_ext(tls_context); // we need to fire this events on the old context struct us_socket_events_t old_events = (struct us_socket_events_t) { .on_close = old_context->on_close, @@ -1681,41 +1641,40 @@ struct us_internal_ssl_socket_t *us_internal_ssl_socket_wrap_with_tls(struct us_ wrapped_context->old_events = old_events; wrapped_context->events = events; - // no need to wrap open because socket is already open (only new context will be called so we can configure hostname and ssl stuff normally here before handshake) - tls_context->on_open = (struct us_internal_ssl_socket_t *(*)(struct us_internal_ssl_socket_t *, int, char *, int))events.on_open; - + tls_context->on_open = (struct us_internal_ssl_socket_t * (*)(struct us_internal_ssl_socket_t*, int, char*, int)) events.on_open; + // on handshake is not available on the old context so we just add this - if(events.on_handshake){ - us_internal_on_ssl_handshake(tls_context, (void (*)(struct us_internal_ssl_socket_t *, int, struct us_bun_verify_error_t, void*))events.on_handshake, NULL); + if (events.on_handshake) { + us_internal_on_ssl_handshake(tls_context, (void (*)(struct us_internal_ssl_socket_t*, int, struct us_bun_verify_error_t, void*))events.on_handshake, NULL); } // we need to wrap these events because we need to call the old context events as well - us_socket_context_on_connect_error(0, context, (struct us_socket_t *(*)(struct us_socket_t *, int)) ssl_wrapped_on_connect_error); - us_socket_context_on_end(0, context, (struct us_socket_t *(*)(struct us_socket_t *)) ssl_wrapped_context_on_end); - us_socket_context_on_long_timeout(0, context, (struct us_socket_t *(*)(struct us_socket_t *)) ssl_wrapped_context_on_long_timeout); - us_socket_context_on_timeout(0, context, (struct us_socket_t *(*)(struct us_socket_t *)) ssl_wrapped_context_on_timeout); - + us_socket_context_on_connect_error(0, context, (struct us_socket_t * (*)(struct us_socket_t*, int)) ssl_wrapped_on_connect_error); + us_socket_context_on_end(0, context, (struct us_socket_t * (*)(struct us_socket_t*)) ssl_wrapped_context_on_end); + us_socket_context_on_long_timeout(0, context, (struct us_socket_t * (*)(struct us_socket_t*)) ssl_wrapped_context_on_long_timeout); + us_socket_context_on_timeout(0, context, (struct us_socket_t * (*)(struct us_socket_t*)) ssl_wrapped_context_on_timeout); + // special case this will be called after ssl things are done // called from ssl_on_data handler is called inside ssl_wrapped_context_on_data - tls_context->on_data = (struct us_internal_ssl_socket_t *(*)(struct us_internal_ssl_socket_t *, char *, int))events.on_data; - us_socket_context_on_data(0, context, (struct us_socket_t *(*)(struct us_socket_t *, char *, int)) ssl_wrapped_context_on_data); - + tls_context->on_data = (struct us_internal_ssl_socket_t * (*)(struct us_internal_ssl_socket_t*, char*, int)) events.on_data; + us_socket_context_on_data(0, context, (struct us_socket_t * (*)(struct us_socket_t*, char*, int)) ssl_wrapped_context_on_data); + // here is the inverse of the above ssl_on_writable will call ssl_wrapped_context_on_writable tls_context->on_writable = ssl_wrapped_context_on_writable; - us_socket_context_on_writable(0, context, (struct us_socket_t *(*)(struct us_socket_t *)) ssl_on_writable); + us_socket_context_on_writable(0, context, (struct us_socket_t * (*)(struct us_socket_t*)) ssl_on_writable); tls_context->on_close = ssl_wrapped_context_on_close; - us_socket_context_on_close(0, context, (struct us_socket_t *(*)(struct us_socket_t *, int, void *)) ssl_on_close); - + us_socket_context_on_close(0, context, (struct us_socket_t * (*)(struct us_socket_t*, int, void*)) ssl_on_close); + // will resize to tls + ext size - struct us_internal_ssl_socket_t * socket = (struct us_internal_ssl_socket_t *) us_socket_context_adopt_socket(0, context, s, sizeof(struct us_internal_ssl_socket_t) - sizeof(struct us_socket_t) + socket_ext_size); + struct us_internal_ssl_socket_t* socket = (struct us_internal_ssl_socket_t*)us_socket_context_adopt_socket(0, context, s, sizeof(struct us_internal_ssl_socket_t) - sizeof(struct us_socket_t) + socket_ext_size); socket->ssl = NULL; socket->ssl_write_wants_read = 0; socket->ssl_read_wants_write = 0; return socket; -} +} #endif diff --git a/packages/bun-usockets/src/crypto/root_certs.cpp b/packages/bun-usockets/src/crypto/root_certs.cpp new file mode 100644 index 0000000000000..c6e98f17d6da0 --- /dev/null +++ b/packages/bun-usockets/src/crypto/root_certs.cpp @@ -0,0 +1,90 @@ +// MSVC doesn't support C11 stdatomic.h propertly yet. +// so we use C++ std::atomic instead. +#include "./internal/internal.h" +#include "./root_certs.h" +#include +#include +#include + +static const int root_certs_size = sizeof(root_certs) / sizeof(root_certs[0]); +static X509* root_cert_instances[sizeof(root_certs) / sizeof(root_certs[0])] = {NULL}; +static std::atomic_flag root_cert_instances_lock = ATOMIC_FLAG_INIT; +static std::atomic_bool root_cert_instances_initialized = 0; + +// This callback is used to avoid the default passphrase callback in OpenSSL +// which will typically prompt for the passphrase. The prompting is designed +// for the OpenSSL CLI, but works poorly for this case because it involves +// synchronous interaction with the controlling terminal, something we never +// want, and use this function to avoid it. +int us_no_password_callback(char* buf, int size, int rwflag, void* u) { + return 0; +} + +static X509 * us_ssl_ctx_get_X509_without_callback_from(struct us_cert_string_t content) { + X509 *x = NULL; + BIO *in; + + ERR_clear_error(); // clear error stack for SSL_CTX_use_certificate() + + in = BIO_new_mem_buf(content.str, content.len); + if (in == NULL) { + OPENSSL_PUT_ERROR(SSL, ERR_R_BUF_LIB); + goto end; + } + + x = PEM_read_bio_X509(in, NULL, us_no_password_callback, NULL); + if (x == NULL) { + OPENSSL_PUT_ERROR(SSL, ERR_R_PEM_LIB); + goto end; + } + + return x; + +end: + X509_free(x); + BIO_free(in); + return NULL; +} + +static void us_internal_init_root_certs() { + if(std::atomic_load(&root_cert_instances_initialized) == 1) return; + + while(atomic_flag_test_and_set_explicit(&root_cert_instances_lock, std::memory_order_acquire)); + + if(!atomic_exchange(&root_cert_instances_initialized, 1)) { + for (size_t i = 0; i < root_certs_size; i++) { + root_cert_instances[i] = us_ssl_ctx_get_X509_without_callback_from(root_certs[i]); + } + } + + atomic_flag_clear_explicit(&root_cert_instances_lock, std::memory_order_release); +} + +extern "C" int us_internal_raw_root_certs(struct us_cert_string_t** out) { + *out = root_certs; + return root_certs_size; +} + +extern "C" X509_STORE* us_get_default_ca_store() { + X509_STORE *store = X509_STORE_new(); + if (store == NULL) { + return NULL; + } + + if (!X509_STORE_set_default_paths(store)) { + X509_STORE_free(store); + return NULL; + } + + us_internal_init_root_certs(); + + // load all root_cert_instances on the default ca store + for (size_t i = 0; i < root_certs_size; i++) { + X509* cert = root_cert_instances[i]; + if(cert == NULL) continue; + X509_up_ref(cert); + X509_STORE_add_cert(store, cert); + } + + return store; +} \ No newline at end of file diff --git a/packages/bun-usockets/src/eventing/epoll_kqueue.c b/packages/bun-usockets/src/eventing/epoll_kqueue.c index d051f5b5adc35..57662372778da 100644 --- a/packages/bun-usockets/src/eventing/epoll_kqueue.c +++ b/packages/bun-usockets/src/eventing/epoll_kqueue.c @@ -35,8 +35,8 @@ void us_loop_run_bun_tick(struct us_loop_t *loop, int64_t timeoutMs, void*); /* Pointer tags are used to indicate a Bun pointer versus a uSockets pointer */ #define UNSET_BITS_49_UNTIL_64 0x0000FFFFFFFFFFFF #define CLEAR_POINTER_TAG(p) ((void *) ((uintptr_t) (p) & UNSET_BITS_49_UNTIL_64)) -#define LIKELY(cond) __builtin_expect((uint64_t)(void*)(cond), 1) -#define UNLIKELY(cond) __builtin_expect((uint64_t)(void*)(cond), 0) +#define LIKELY(cond) __builtin_expect((_Bool)(cond), 1) +#define UNLIKELY(cond) __builtin_expect((_Bool)(cond), 0) #ifdef LIBUS_USE_EPOLL #define GET_READY_POLL(loop, index) (struct us_poll_t *) loop->ready_polls[index].data.ptr diff --git a/packages/bun-usockets/src/eventing/libuv.c b/packages/bun-usockets/src/eventing/libuv.c new file mode 100644 index 0000000000000..4bb76f802425b --- /dev/null +++ b/packages/bun-usockets/src/eventing/libuv.c @@ -0,0 +1,330 @@ +/* + * Authored by Alex Hultman, 2018-2021. + * Intellectual property of third-party. + + * 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. + */ + +#include "internal/internal.h" +#include "libusockets.h" +#include + +#ifdef LIBUS_USE_LIBUV + +/* uv_poll_t->data always (except for most times after calling us_poll_stop) + * points to the us_poll_t */ +static void poll_cb(uv_poll_t *p, int status, int events) { + us_internal_dispatch_ready_poll((struct us_poll_t *)p->data, status < 0, + events); +} + +static void prepare_cb(uv_prepare_t *p) { + struct us_loop_t *loop = p->data; + us_internal_loop_pre(loop); +} + +/* Note: libuv timers execute AFTER the post callback */ +static void check_cb(uv_check_t *p) { + struct us_loop_t *loop = p->data; + us_internal_loop_post(loop); +} + +/* Not used for polls, since polls need two frees */ +static void close_cb_free(uv_handle_t *h) { free(h->data); } + +/* This one is different for polls, since we need two frees here */ +static void close_cb_free_poll(uv_handle_t *h) { + /* It is only in case we called us_poll_stop then quickly us_poll_free that we + * enter this. Most of the time, actual freeing is done by us_poll_free. */ + if (h->data) { + free(h->data); + free(h); + } +} + +static void timer_cb(uv_timer_t *t) { + struct us_internal_callback_t *cb = t->data; + cb->cb(cb); +} + +static void async_cb(uv_async_t *a) { + struct us_internal_callback_t *cb = a->data; + // internal asyncs give their loop, not themselves + cb->cb((struct us_internal_callback_t *)cb->loop); +} + +// poll +void us_poll_init(struct us_poll_t *p, LIBUS_SOCKET_DESCRIPTOR fd, + int poll_type) { + p->poll_type = poll_type; + p->fd = fd; +} + +void us_poll_free(struct us_poll_t *p, struct us_loop_t *loop) { + /* The idea here is like so; in us_poll_stop we call uv_close after setting + * data of uv-poll to 0. This means that in close_cb_free we call free on 0 + * with does nothing, since us_poll_stop should not really free the poll. + * HOWEVER, if we then call us_poll_free while still closing the uv-poll, we + * simply change back the data to point to our structure so that we actually + * do free it like we should. */ + if (uv_is_closing((uv_handle_t *)p->uv_p)) { + p->uv_p->data = p; + } else { + free(p->uv_p); + free(p); + } +} + +void us_poll_start(struct us_poll_t *p, struct us_loop_t *loop, int events) { + p->poll_type = us_internal_poll_type(p) | + ((events & LIBUS_SOCKET_READABLE) ? POLL_TYPE_POLLING_IN : 0) | + ((events & LIBUS_SOCKET_WRITABLE) ? POLL_TYPE_POLLING_OUT : 0); + + uv_poll_init_socket(loop->uv_loop, p->uv_p, p->fd); + uv_poll_start(p->uv_p, events, poll_cb); +} + +void us_poll_change(struct us_poll_t *p, struct us_loop_t *loop, int events) { + if (us_poll_events(p) != events) { + p->poll_type = + us_internal_poll_type(p) | + ((events & LIBUS_SOCKET_READABLE) ? POLL_TYPE_POLLING_IN : 0) | + ((events & LIBUS_SOCKET_WRITABLE) ? POLL_TYPE_POLLING_OUT : 0); + + uv_poll_start(p->uv_p, events, poll_cb); + } +} + +void us_poll_stop(struct us_poll_t *p, struct us_loop_t *loop) { + uv_poll_stop(p->uv_p); + + /* We normally only want to close the poll here, not free it. But if we stop + * it, then quickly "free" it with us_poll_free, we postpone the actual + * freeing to close_cb_free_poll whenever it triggers. That's why we set data + * to null here, so that us_poll_free can reset it if needed */ + p->uv_p->data = 0; + uv_close((uv_handle_t *)p->uv_p, close_cb_free_poll); +} + +int us_poll_events(struct us_poll_t *p) { + return ((p->poll_type & POLL_TYPE_POLLING_IN) ? LIBUS_SOCKET_READABLE : 0) | + ((p->poll_type & POLL_TYPE_POLLING_OUT) ? LIBUS_SOCKET_WRITABLE : 0); +} + +unsigned int us_internal_accept_poll_event(struct us_poll_t *p) { return 0; } + +int us_internal_poll_type(struct us_poll_t *p) { return p->poll_type & 3; } + +void us_internal_poll_set_type(struct us_poll_t *p, int poll_type) { + p->poll_type = poll_type | (p->poll_type & 12); +} + +LIBUS_SOCKET_DESCRIPTOR us_poll_fd(struct us_poll_t *p) { return p->fd; } + +void us_loop_pump(struct us_loop_t *loop) { + uv_run(loop->uv_loop, UV_RUN_NOWAIT); +} + +struct us_loop_t *us_create_loop(void *hint, + void (*wakeup_cb)(struct us_loop_t *loop), + void (*pre_cb)(struct us_loop_t *loop), + void (*post_cb)(struct us_loop_t *loop), + unsigned int ext_size) { + struct us_loop_t *loop = + (struct us_loop_t *)malloc(sizeof(struct us_loop_t) + ext_size); + + loop->uv_loop = hint ? hint : uv_loop_new(); + loop->is_default = hint != 0; + + loop->uv_pre = malloc(sizeof(uv_prepare_t)); + uv_prepare_init(loop->uv_loop, loop->uv_pre); + uv_prepare_start(loop->uv_pre, prepare_cb); + uv_unref((uv_handle_t *)loop->uv_pre); + loop->uv_pre->data = loop; + + loop->uv_check = malloc(sizeof(uv_check_t)); + uv_check_init(loop->uv_loop, loop->uv_check); + uv_unref((uv_handle_t *)loop->uv_check); + uv_check_start(loop->uv_check, check_cb); + loop->uv_check->data = loop; + + // here we create two unreffed handles - timer and async + us_internal_loop_data_init(loop, wakeup_cb, pre_cb, post_cb); + + // if we do not own this loop, we need to integrate and set up timer + if (hint) { + us_loop_integrate(loop); + } + + return loop; +} + +// based on if this was default loop or not +void us_loop_free(struct us_loop_t *loop) { + // ref and close down prepare and check + uv_ref((uv_handle_t *)loop->uv_pre); + uv_prepare_stop(loop->uv_pre); + loop->uv_pre->data = loop->uv_pre; + uv_close((uv_handle_t *)loop->uv_pre, close_cb_free); + + uv_ref((uv_handle_t *)loop->uv_check); + uv_check_stop(loop->uv_check); + loop->uv_check->data = loop->uv_check; + uv_close((uv_handle_t *)loop->uv_check, close_cb_free); + + us_internal_loop_data_free(loop); + + // we need to run the loop one last round to call all close callbacks + // we cannot do this if we do not own the loop, default + if (!loop->is_default) { + uv_run(loop->uv_loop, UV_RUN_NOWAIT); + uv_loop_delete(loop->uv_loop); + } + + // now we can free our part + free(loop); +} + +void us_loop_run(struct us_loop_t *loop) { + us_loop_integrate(loop); + + uv_run(loop->uv_loop, UV_RUN_NOWAIT); +} + +struct us_poll_t *us_create_poll(struct us_loop_t *loop, int fallthrough, + unsigned int ext_size) { + struct us_poll_t *p = + (struct us_poll_t *)malloc(sizeof(struct us_poll_t) + ext_size); + p->uv_p = malloc(sizeof(uv_poll_t)); + p->uv_p->data = p; + return p; +} + +/* If we update our block position we have to updarte the uv_poll data to point + * to us */ +struct us_poll_t *us_poll_resize(struct us_poll_t *p, struct us_loop_t *loop, + unsigned int ext_size) { + + struct us_poll_t *new_p = realloc(p, sizeof(struct us_poll_t) + ext_size); + new_p->uv_p->data = new_p; + + return new_p; +} + +// timer +struct us_timer_t *us_create_timer(struct us_loop_t *loop, int fallthrough, + unsigned int ext_size) { + struct us_internal_callback_t *cb = malloc( + sizeof(struct us_internal_callback_t) + sizeof(uv_timer_t) + ext_size); + + cb->loop = loop; + cb->cb_expects_the_loop = 0; // never read? + cb->leave_poll_ready = 0; // never read? + + uv_timer_t *uv_timer = (uv_timer_t *)(cb + 1); + uv_timer_init(loop->uv_loop, uv_timer); + uv_timer->data = cb; + + if (fallthrough) { + uv_unref((uv_handle_t *)uv_timer); + } + + return (struct us_timer_t *)cb; +} + +void *us_timer_ext(struct us_timer_t *timer) { + return ((char *)timer) + sizeof(struct us_internal_callback_t) + + sizeof(uv_timer_t); +} + +void us_timer_close(struct us_timer_t *t) { + struct us_internal_callback_t *cb = (struct us_internal_callback_t *)t; + + uv_timer_t *uv_timer = (uv_timer_t *)(cb + 1); + + // always ref the timer before closing it + uv_ref((uv_handle_t *)uv_timer); + + uv_timer_stop(uv_timer); + + uv_timer->data = cb; + uv_close((uv_handle_t *)uv_timer, close_cb_free); +} + +void us_timer_set(struct us_timer_t *t, void (*cb)(struct us_timer_t *t), + int ms, int repeat_ms) { + struct us_internal_callback_t *internal_cb = + (struct us_internal_callback_t *)t; + + internal_cb->cb = (void (*)(struct us_internal_callback_t *))cb; + + uv_timer_t *uv_timer = (uv_timer_t *)(internal_cb + 1); + if (!ms) { + uv_timer_stop(uv_timer); + } else { + uv_timer_start(uv_timer, timer_cb, ms, repeat_ms); + } +} + +struct us_loop_t *us_timer_loop(struct us_timer_t *t) { + struct us_internal_callback_t *internal_cb = + (struct us_internal_callback_t *)t; + + return internal_cb->loop; +} + +// async (internal only) +struct us_internal_async *us_internal_create_async(struct us_loop_t *loop, + int fallthrough, + unsigned int ext_size) { + struct us_internal_callback_t *cb = malloc( + sizeof(struct us_internal_callback_t) + sizeof(uv_async_t) + ext_size); + + cb->loop = loop; + return (struct us_internal_async *)cb; +} + +void us_internal_async_close(struct us_internal_async *a) { + struct us_internal_callback_t *cb = (struct us_internal_callback_t *)a; + + uv_async_t *uv_async = (uv_async_t *)(cb + 1); + + // always ref the async before closing it + uv_ref((uv_handle_t *)uv_async); + + uv_async->data = cb; + uv_close((uv_handle_t *)uv_async, close_cb_free); +} + +void us_internal_async_set(struct us_internal_async *a, + void (*cb)(struct us_internal_async *)) { + struct us_internal_callback_t *internal_cb = + (struct us_internal_callback_t *)a; + + internal_cb->cb = (void (*)(struct us_internal_callback_t *))cb; + + uv_async_t *uv_async = (uv_async_t *)(internal_cb + 1); + uv_async_init(internal_cb->loop->uv_loop, uv_async, async_cb); + uv_unref((uv_handle_t *)uv_async); + uv_async->data = internal_cb; +} + +void us_internal_async_wakeup(struct us_internal_async *a) { + struct us_internal_callback_t *internal_cb = + (struct us_internal_callback_t *)a; + + uv_async_t *uv_async = (uv_async_t *)(internal_cb + 1); + uv_async_send(uv_async); +} + +#endif \ No newline at end of file diff --git a/packages/bun-usockets/src/internal/eventing/libuv.h b/packages/bun-usockets/src/internal/eventing/libuv.h new file mode 100644 index 0000000000000..80001a58b0a01 --- /dev/null +++ b/packages/bun-usockets/src/internal/eventing/libuv.h @@ -0,0 +1,47 @@ +/* + * Authored by Alex Hultman, 2018-2019. + * Intellectual property of third-party. + + * 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. + */ + +#ifndef LIBUV_H +#define LIBUV_H + +#include "internal/loop_data.h" + +#include +#define LIBUS_SOCKET_READABLE UV_READABLE +#define LIBUS_SOCKET_WRITABLE UV_WRITABLE + +struct us_loop_t { + alignas(LIBUS_EXT_ALIGNMENT) struct us_internal_loop_data_t data; + + uv_loop_t *uv_loop; + int is_default; + + uv_prepare_t *uv_pre; + uv_check_t *uv_check; +}; + +// it is no longer valid to cast a pointer to us_poll_t to a pointer of +// uv_poll_t +struct us_poll_t { + /* We need to hold a pointer to this uv_poll_t since we need to be able to + * resize our block */ + uv_poll_t *uv_p; + LIBUS_SOCKET_DESCRIPTOR fd; + unsigned char poll_type; +}; + +#endif // LIBUV_H \ No newline at end of file diff --git a/packages/bun-usockets/src/internal/internal.h b/packages/bun-usockets/src/internal/internal.h index 2d4719571a518..d6c5d31400f47 100644 --- a/packages/bun-usockets/src/internal/internal.h +++ b/packages/bun-usockets/src/internal/internal.h @@ -20,7 +20,9 @@ #if defined(_MSC_VER) +#ifndef __cplusplus #define alignas(x) __declspec(align(x)) +#endif #else #include #endif @@ -43,6 +45,10 @@ void us_internal_loop_update_pending_ready_polls(struct us_loop_t *loop, struct #include "internal/eventing/epoll_kqueue.h" #endif +#ifdef LIBUS_USE_LIBUV +#include "internal/eventing/libuv.h" +#endif + /* Poll type and what it polls for */ enum { /* Two first bits */ @@ -126,6 +132,15 @@ struct us_internal_callback_t { #endif +#if __cplusplus +extern "C" { +#endif +int us_internal_raw_root_certs(struct us_cert_string_t** out); + +#if __cplusplus +} +#endif + /* Listen sockets are sockets */ struct us_listen_socket_t { alignas(LIBUS_EXT_ALIGNMENT) struct us_socket_t s; @@ -163,6 +178,7 @@ struct us_socket_context_t { struct us_internal_ssl_socket_context_t; struct us_internal_ssl_socket_t; +typedef void (*us_internal_on_handshake_t)(struct us_internal_ssl_socket_t *, int success, struct us_bun_verify_error_t verify_error, void* custom_data); /* SNI functions */ void us_internal_ssl_socket_context_add_server_name(struct us_internal_ssl_socket_context_t *context, const char *hostname_pattern, struct us_socket_context_options_t options, void *user); @@ -190,8 +206,8 @@ void us_internal_ssl_socket_context_on_close(struct us_internal_ssl_socket_conte void us_internal_ssl_socket_context_on_data(struct us_internal_ssl_socket_context_t *context, struct us_internal_ssl_socket_t *(*on_data)(struct us_internal_ssl_socket_t *s, char *data, int length)); -void us_internal_ssl_handshake(struct us_internal_ssl_socket_t *s, void (*on_handshake)(struct us_internal_ssl_socket_t *, int success, struct us_bun_verify_error_t verify_error, void* custom_data), void* custom_data); -void us_internal_on_ssl_handshake(struct us_internal_ssl_socket_context_t * context, void (*on_handshake)(struct us_internal_ssl_socket_t *, int success, struct us_bun_verify_error_t verify_error, void* custom_data), void* custom_data); +void us_internal_ssl_handshake(struct us_internal_ssl_socket_t *s, us_internal_on_handshake_t on_handshake, void* custom_data); +void us_internal_on_ssl_handshake(struct us_internal_ssl_socket_context_t * context, us_internal_on_handshake_t on_handshake, void* custom_data); void us_internal_ssl_socket_context_on_writable(struct us_internal_ssl_socket_context_t *context, struct us_internal_ssl_socket_t *(*on_writable)(struct us_internal_ssl_socket_t *s)); diff --git a/packages/bun-usockets/src/libusockets.h b/packages/bun-usockets/src/libusockets.h index 7a3e8c0fb2ef6..b343bc376eb5a 100644 --- a/packages/bun-usockets/src/libusockets.h +++ b/packages/bun-usockets/src/libusockets.h @@ -153,6 +153,12 @@ struct us_socket_context_options_t { int ssl_prefer_low_memory_usage; /* Todo: rename to prefer_low_memory_usage and apply for TCP as well */ }; +struct us_bun_verify_error_t { + long error; + const char* code; + const char* reason; +}; + struct us_socket_events_t { struct us_socket_t *(*on_open)(struct us_socket_t *, int is_client, char *ip, int ip_length); struct us_socket_t *(*on_data)(struct us_socket_t *, char *data, int length); @@ -166,11 +172,6 @@ struct us_socket_events_t { void (*on_handshake)(struct us_socket_t*, int success, struct us_bun_verify_error_t verify_error, void* custom_data); }; -struct us_bun_verify_error_t { - long error; - const char* code; - const char* reason; -}; struct us_bun_socket_context_options_t { const char *key_file_name; @@ -231,7 +232,7 @@ void us_socket_context_on_long_timeout(int ssl, struct us_socket_context_t *cont void us_socket_context_on_connect_error(int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_connect_error)(struct us_socket_t *s, int code)); -void us_socket_context_on_handshake(int ssl, struct us_socket_context_t *context, void (*on_handshake)(struct us_socket_context_t *, int success, struct us_bun_verify_error_t verify_error, void* custom_data), void* custom_data); +void us_socket_context_on_handshake(int ssl, struct us_socket_context_t *context, void (*on_handshake)(struct us_socket_t *, int success, struct us_bun_verify_error_t verify_error, void* custom_data), void* custom_data); /* Emitted when a socket has been half-closed */ void us_socket_context_on_end(int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_end)(struct us_socket_t *s)); diff --git a/packages/bun-usockets/src/loop.c b/packages/bun-usockets/src/loop.c index e230fa29b20c3..d214e6c277d1f 100644 --- a/packages/bun-usockets/src/loop.c +++ b/packages/bun-usockets/src/loop.c @@ -18,7 +18,9 @@ #include "libusockets.h" #include "internal/internal.h" #include +#ifndef WIN32 #include +#endif /* The loop has 2 fallthrough polls */ void us_internal_loop_data_init(struct us_loop_t *loop, void (*wakeup_cb)(struct us_loop_t *loop), diff --git a/packages/bun-usockets/src/socket.c b/packages/bun-usockets/src/socket.c index 0cc3aee4aaa36..3199020728cd1 100644 --- a/packages/bun-usockets/src/socket.c +++ b/packages/bun-usockets/src/socket.c @@ -150,15 +150,69 @@ struct us_socket_t *us_socket_close(int ssl, struct us_socket_t *s, int code, vo return s; } +// This function is the same as us_socket_close but: +// - does not emit on_close event +// - does not close +struct us_socket_t *us_socket_detach(int ssl, struct us_socket_t *s) { + if (!us_socket_is_closed(0, s)) { + if (s->low_prio_state == 1) { + /* Unlink this socket from the low-priority queue */ + if (!s->prev) s->context->loop->data.low_prio_head = s->next; + else s->prev->next = s->next; + + if (s->next) s->next->prev = s->prev; + + s->prev = 0; + s->next = 0; + s->low_prio_state = 0; + } else { + us_internal_socket_context_unlink_socket(s->context, s); + } + us_poll_stop((struct us_poll_t *) s, s->context->loop); + + /* Link this socket to the close-list and let it be deleted after this iteration */ + s->next = s->context->loop->data.closed_head; + s->context->loop->data.closed_head = s; + + /* Any socket with prev = context is marked as closed */ + s->prev = (struct us_socket_t *) s->context; + + return s; + } + return s; +} + +// This function is used for moving a socket between two different event loops +struct us_socket_t *us_socket_attach(int ssl, LIBUS_SOCKET_DESCRIPTOR client_fd, struct us_socket_context_t *ctx, int flags, int socket_ext_size) { + struct us_poll_t *accepted_p = us_create_poll(ctx->loop, 0, sizeof(struct us_socket_t) - sizeof(struct us_poll_t) + socket_ext_size); + us_poll_init(accepted_p, client_fd, POLL_TYPE_SOCKET); + us_poll_start(accepted_p, ctx->loop, flags); + + struct us_socket_t *s = (struct us_socket_t *) accepted_p; + + s->context = ctx; + s->timeout = 0; + s->low_prio_state = 0; + + /* We always use nodelay */ + bsd_socket_nodelay(client_fd, 1); + us_internal_socket_context_link_socket(ctx, s); + + if (ctx->on_open) ctx->on_open(s, 0, 0, 0); + + return s; +} + struct us_socket_t *us_socket_pair(struct us_socket_context_t *ctx, int socket_ext_size, LIBUS_SOCKET_DESCRIPTOR* fds) { -#ifdef LIBUS_USE_LIBUV +#if defined(LIBUS_USE_LIBUV) || defined(WIN32) return 0; -#endif +#else if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) != 0) { return 0; } return us_socket_from_fd(ctx, socket_ext_size, fds[0]); +#endif } /* This is not available for SSL sockets as it makes no sense. */ @@ -177,9 +231,9 @@ int us_socket_write2(int ssl, struct us_socket_t *s, const char *header, int hea } struct us_socket_t *us_socket_from_fd(struct us_socket_context_t *ctx, int socket_ext_size, LIBUS_SOCKET_DESCRIPTOR fd) { -#ifdef LIBUS_USE_LIBUV +#if defined(LIBUS_USE_LIBUV) || defined(WIN32) return 0; -#endif +#else struct us_poll_t *p1 = us_create_poll(ctx->loop, 0, sizeof(struct us_socket_t) + socket_ext_size); us_poll_init(p1, fd, POLL_TYPE_SOCKET); us_poll_start(p1, ctx->loop, LIBUS_SOCKET_READABLE | LIBUS_SOCKET_WRITABLE); @@ -200,6 +254,7 @@ struct us_socket_t *us_socket_from_fd(struct us_socket_context_t *ctx, int socke } return s; +#endif } diff --git a/packages/bun-uws/src/AsyncSocket.h b/packages/bun-uws/src/AsyncSocket.h index 966998c868453..f3bca3d1b42c3 100644 --- a/packages/bun-uws/src/AsyncSocket.h +++ b/packages/bun-uws/src/AsyncSocket.h @@ -219,9 +219,9 @@ struct AsyncSocket { unsigned char *b = (unsigned char *) binary.data(); if (binary.length() == 4) { - ipLength = sprintf(buf, "%u.%u.%u.%u", b[0], b[1], b[2], b[3]); + ipLength = snprintf(buf, sizeof(buf), "%u.%u.%u.%u", b[0], b[1], b[2], b[3]); } else { - ipLength = sprintf(buf, "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", + ipLength = snprintf(buf, sizeof(buf), "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7], b[8], b[9], b[10], b[11], b[12], b[13], b[14], b[15]); } diff --git a/scripts/all-dependencies.sh b/scripts/all-dependencies.sh new file mode 100755 index 0000000000000..b87b6ef7fcf36 --- /dev/null +++ b/scripts/all-dependencies.sh @@ -0,0 +1,68 @@ +set -euo pipefail +source "$(dirname -- "${BASH_SOURCE[0]}")/env.sh" +FORCE= + + +while getopts "f" opt; do + case ${opt} in + f ) + FORCE=1 + ;; + \? ) + echo "Usage: all-dependencies.sh [-h] [-f]" + echo "Options:" + echo " h Print this help message" + echo " f Set force to 1" + exit 1 + ;; + esac +done + +BUILT_ANY=0 + +dep() { + local script="$1" + if [ -z "$FORCE" ]; then + HAS_ALL_DEPS=1 + shift + for lib in "$@"; do + if [ ! -f "$BUN_DEPS_OUT_DIR/$lib" ]; then + HAS_ALL_DEPS=0 + break + fi + done + if [ "$HAS_ALL_DEPS" -eq 1 ]; then + printf "%s - already built\n" "$script" + return + fi + fi + printf "building %s\n" "$script" + + set +e + bash "$SCRIPT_DIR/build-$script.sh" + EXIT=$? + + if [ "$EXIT" -ne 0 ]; then + printf "Failed to build %s\n" "$script" + exit "$EXIT" + fi + + set -e + + BUILT_ANY=1 +} + +dep base64 libbase64.a +dep boringssl libcrypto.a libssl.a libdecrepit.a +dep cares libcares.a +dep libarchive libarchive.a +dep lolhtml liblolhtml.a +dep mimalloc-debug libmimalloc-debug.a +dep mimalloc libmimalloc.a +dep tinycc libtcc.a +dep zlib libz.a +dep zstd libzstd.a + +if [ "$BUILT_ANY" -eq 0 ]; then + printf "(run with -f to rebuild)\n" +fi \ No newline at end of file diff --git a/scripts/build-base64.ps1 b/scripts/build-base64.ps1 new file mode 100644 index 0000000000000..f74c7dcb61204 --- /dev/null +++ b/scripts/build-base64.ps1 @@ -0,0 +1,11 @@ +$ErrorActionPreference = 'Stop' # Setting strict mode, similar to 'set -euo pipefail' in bash +. (Join-Path $PSScriptRoot "env.ps1") + +$CWD = Get-Location + +Set-Location (Join-Path $BUN_DEPS_DIR 'base64') +cmake $CMAKE_FLAGS . +cmake --build . --clean-first --config Release +Copy-Item **/*.lib $BUN_DEPS_OUT_DIR + +Set-Location $CWD \ No newline at end of file diff --git a/scripts/build-base64.sh b/scripts/build-base64.sh new file mode 100755 index 0000000000000..160875f96e183 --- /dev/null +++ b/scripts/build-base64.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -euxo pipefail +source $(dirname -- "${BASH_SOURCE[0]}")/env.sh + +cd $BUN_DEPS_DIR/base64 + +rm -rf build +mkdir -p build +cd build + +cmake "${CMAKE_FLAGS[@]}" .. -GNinja -B . +ninja + +cp libbase64.a $BUN_DEPS_OUT_DIR/libbase64.a diff --git a/scripts/build-boringssl.ps1 b/scripts/build-boringssl.ps1 new file mode 100644 index 0000000000000..77adb94f51bae --- /dev/null +++ b/scripts/build-boringssl.ps1 @@ -0,0 +1,13 @@ +$ErrorActionPreference = 'Stop' # Setting strict mode, similar to 'set -euo pipefail' in bash +. (Join-Path $PSScriptRoot "env.ps1") +$CWD = Get-Location + +$null = mkdir -p $BUN_DEPS_OUT_DIR -Force +Set-Location $BUN_DEPS_DIR/boringssl +cmake $CMAKE_FLAGS . +cmake --build . --target crypto --target ssl --target decrepit --clean-first --config Release +Copy-Item crypto/Release/crypto.lib $BUN_DEPS_OUT_DIR +Copy-Item ssl/Release/ssl.lib $BUN_DEPS_OUT_DIR +Copy-Item decrepit/Release/decrepit.lib $BUN_DEPS_OUT_DIR + +Set-Location $CWD diff --git a/scripts/build-boringssl.sh b/scripts/build-boringssl.sh new file mode 100755 index 0000000000000..5ac58fae783c0 --- /dev/null +++ b/scripts/build-boringssl.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -euxo pipefail +source $(dirname -- "${BASH_SOURCE[0]}")/env.sh + +cd $BUN_DEPS_DIR/boringssl +mkdir -p build +cd build + +cmake "${CMAKE_FLAGS[@]}" -DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" -GNinja .. +ninja libcrypto.a libssl.a libdecrepit.a + +cp **/libcrypto.a $BUN_DEPS_OUT_DIR/libcrypto.a +cp **/libssl.a $BUN_DEPS_OUT_DIR/libssl.a +cp **/libdecrepit.a $BUN_DEPS_OUT_DIR/libdecrepit.a diff --git a/scripts/build-cares.ps1 b/scripts/build-cares.ps1 new file mode 100644 index 0000000000000..7e4b587bb02c2 --- /dev/null +++ b/scripts/build-cares.ps1 @@ -0,0 +1,13 @@ +$ErrorActionPreference = 'Stop' # Setting strict mode, similar to 'set -euo pipefail' in bash +. (Join-Path $PSScriptRoot "env.ps1") +$CWD = Get-Location + +Set-Location (Join-Path $BUN_DEPS_DIR 'c-ares') +Remove-Item -r build -ErrorAction SilentlyContinue +$null = mkdir build -ErrorAction SilentlyContinue +Set-Location build +cmake $CMAKE_FLAGS -DCARES_STATIC=ON -DCARES_SHARED=OFF .. +cmake --build . --clean-first --config Release +Copy-Item ./lib/Release/*.lib $BUN_DEPS_OUT_DIR + +Set-Location $CWD \ No newline at end of file diff --git a/scripts/build-cares.sh b/scripts/build-cares.sh new file mode 100755 index 0000000000000..7711136382ba3 --- /dev/null +++ b/scripts/build-cares.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +set -euxo pipefail +source $(dirname -- "${BASH_SOURCE[0]}")/env.sh + +cd $BUN_DEPS_DIR/c-ares + +rm -rf build +mkdir -p build + +cd build + +cmake "${CMAKE_FLAGS[@]}" .. \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DCARES_STATIC=ON \ + -DCARES_STATIC_PIC=ON \ + -DCARES_SHARED=OFF \ + -G "Ninja" + +ninja + +cp lib/libcares.a $BUN_DEPS_OUT_DIR/libcares.a diff --git a/scripts/build-libarchive.ps1 b/scripts/build-libarchive.ps1 new file mode 100644 index 0000000000000..5e8f23c4fedb3 --- /dev/null +++ b/scripts/build-libarchive.ps1 @@ -0,0 +1,10 @@ +$ErrorActionPreference = 'Stop' # Setting strict mode, similar to 'set -euo pipefail' in bash +. (Join-Path $PSScriptRoot "env.ps1") +$CWD = Get-Location + +Set-Location $BUN_DEPS_DIR/libarchive +cmake -DBUILD_SHARED_LIBS=OFF -DENABLE_TEST=OFF -DENABLE_INSTALL=OFF -DENABLE_WERROR=0 $CMAKE_FLAGS . +cmake --build . --target ALL_BUILD --clean-first --config Release +Copy-Item libarchive/Release/archive.lib $BUN_DEPS_OUT_DIR + +Set-Location $CWD diff --git a/scripts/build-libarchive.sh b/scripts/build-libarchive.sh new file mode 100755 index 0000000000000..25b8c63935a3d --- /dev/null +++ b/scripts/build-libarchive.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +set -euxo pipefail +source $(dirname -- "${BASH_SOURCE[0]}")/env.sh + +mkdir -p $BUN_DEPS_OUT_DIR + +cd $BUN_DEPS_DIR/libarchive +make clean || echo "" +./build/clean.sh || echo "" +./build/autogen.sh +./configure --disable-shared --enable-static --with-pic --disable-bsdtar --disable-bsdcat --disable-rpath --enable-posix-regex-lib --without-xml2 --without-expat --without-openssl --without-iconv --without-zlib +make -j$CPUS +cp ./.libs/libarchive.a $BUN_DEPS_OUT_DIR/libarchive.a diff --git a/scripts/build-libuv.ps1 b/scripts/build-libuv.ps1 new file mode 100644 index 0000000000000..9ccda67f6b984 --- /dev/null +++ b/scripts/build-libuv.ps1 @@ -0,0 +1,19 @@ +$ErrorActionPreference = 'Stop' # Setting strict mode, similar to 'set -euo pipefail' in bash +. (Join-Path $PSScriptRoot "env.ps1") +$CWD = Get-Location + +$UVSource = (Join-Path $PSScriptRoot "../build/libuv") +if (!(test-path -PathType container $UVSource)) { + Set-Location (Join-Path $PSScriptRoot "../build") + git clone "https://github.com/libuv/libuv" libuv --depth=1 +} + +Set-Location $UVSource +New-Item -ItemType Directory -Force -Path build +Set-Location build +cmake .. $CMAKE_FLAGS "-DCMAKE_C_FLAGS=`"/DWIN32 /D_WINDOWS -Wno-int-conversion`"" +cmake --build . --clean-first --config Release + +Copy-Item .\libuv.lib $BUN_DEPS_OUT_DIR + +Set-Location $CWD diff --git a/scripts/build-lolhtml.ps1 b/scripts/build-lolhtml.ps1 new file mode 100644 index 0000000000000..fa3898922d0f1 --- /dev/null +++ b/scripts/build-lolhtml.ps1 @@ -0,0 +1,10 @@ +$ErrorActionPreference = 'Stop' # Setting strict mode, similar to 'set -euo pipefail' in bash +. (Join-Path $PSScriptRoot "env.ps1") +$CWD = Get-Location + +Set-Location $BUN_DEPS_DIR/lol-html/c-api +cargo build --release --target x86_64-pc-windows-msvc +Copy-Item target/x86_64-pc-windows-msvc/release/lolhtml.lib $BUN_DEPS_OUT_DIR +Copy-Item target/x86_64-pc-windows-msvc/release/lolhtml.pdb $BUN_DEPS_OUT_DIR + +Set-Location $CWD \ No newline at end of file diff --git a/scripts/build-lolhtml.sh b/scripts/build-lolhtml.sh new file mode 100755 index 0000000000000..6b9099c80727e --- /dev/null +++ b/scripts/build-lolhtml.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +set -euxo pipefail +source $(dirname -- "${BASH_SOURCE[0]}")/env.sh + +cd $BUN_DEPS_DIR/lol-html/c-api +cargo build --release +cp target/release/liblolhtml.a $BUN_DEPS_OUT_DIR/liblolhtml.a diff --git a/scripts/build-mimalloc-debug.sh b/scripts/build-mimalloc-debug.sh new file mode 100755 index 0000000000000..ebb82ccbc13a3 --- /dev/null +++ b/scripts/build-mimalloc-debug.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +set -euxo pipefail +source "$(dirname -- "${BASH_SOURCE[0]}")/env.sh" + +MIMALLOC_OVERRIDE_FLAG=${MIMALLOC_OVERRIDE_FLAG:-} +MIMALLOC_VALGRIND_ENABLED_FLAG=${MIMALLOC_VALGRIND_ENABLED_FLAG:-} + +cd $BUN_DEPS_DIR/mimalloc + +rm -rf CMakeCache* CMakeFiles + +cmake "${CMAKE_FLAGS[@]}" . \ + -DCMAKE_BUILD_TYPE=Debug \ + -DMI_DEBUG=1 \ + -DMI_SKIP_COLLECT_ON_EXIT=1 \ + -DMI_BUILD_SHARED=OFF \ + -DMI_BUILD_STATIC=ON \ + -DMI_BUILD_TESTS=OFF \ + -DMI_OSX_ZONE=OFF \ + -DMI_OSX_INTERPOSE=OFF \ + -DMI_BUILD_OBJECT=ON \ + -DMI_USE_CXX=ON \ + -DMI_OVERRIDE=OFF \ + -DMI_OSX_ZONE=OFF \ + -GNinja + +ninja + +cp libmimalloc-debug.a $BUN_DEPS_OUT_DIR/libmimalloc-debug.a diff --git a/scripts/build-mimalloc.ps1 b/scripts/build-mimalloc.ps1 new file mode 100644 index 0000000000000..5149ef0d043a7 --- /dev/null +++ b/scripts/build-mimalloc.ps1 @@ -0,0 +1,22 @@ +$ErrorActionPreference = 'Stop' # Setting strict mode, similar to 'set -euo pipefail' in bash +. (Join-Path $PSScriptRoot "env.ps1") +$CWD = Get-Location + +Set-Location (Join-Path $BUN_DEPS_DIR 'mimalloc') +cmake $CMAKE_FLAGS ` + -DMI_SKIP_COLLECT_ON_EXIT=1 ` + -DMI_BUILD_SHARED=OFF ` + -DMI_BUILD_STATIC=ON ` + -DMI_BUILD_TESTS=OFF ` + -DMI_OSX_ZONE=OFF ` + -DMI_OSX_INTERPOSE=OFF ` + -DMI_BUILD_OBJECT=ON ` + -DMI_USE_CXX=ON ` + -DMI_OVERRIDE=OFF ` + -DMI_OSX_ZONE=OFF ` + +cmake --build . --clean-first --config Release + +Copy-Item **/*.lib $BUN_DEPS_OUT_DIR + +Set-Location $CWD diff --git a/scripts/build-mimalloc.sh b/scripts/build-mimalloc.sh new file mode 100755 index 0000000000000..616e451867251 --- /dev/null +++ b/scripts/build-mimalloc.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +set -euxo pipefail +source "$(dirname -- "${BASH_SOURCE[0]}")/env.sh" + +MIMALLOC_OVERRIDE_FLAG=${MIMALLOC_OVERRIDE_FLAG:-} +MIMALLOC_VALGRIND_ENABLED_FLAG=${MIMALLOC_VALGRIND_ENABLED_FLAG:-} + +cd $BUN_DEPS_DIR/mimalloc + +rm -rf CMakeCache* CMakeFiles + +cmake "${CMAKE_FLAGS[@]}" . \ + -DCMAKE_BUILD_TYPE=Release \ + -DMI_SKIP_COLLECT_ON_EXIT=1 \ + -DMI_BUILD_SHARED=OFF \ + -DMI_BUILD_STATIC=ON \ + -DMI_BUILD_TESTS=OFF \ + -DMI_OSX_ZONE=OFF \ + -DMI_OSX_INTERPOSE=OFF \ + -DMI_BUILD_OBJECT=ON \ + -DMI_USE_CXX=ON \ + -DMI_OVERRIDE=OFF \ + -DMI_OSX_ZONE=OFF \ + -GNinja + +ninja + +cp libmimalloc.a $BUN_DEPS_OUT_DIR/libmimalloc.a diff --git a/scripts/build-tinycc.sh b/scripts/build-tinycc.sh new file mode 100755 index 0000000000000..103a4fbf196f0 --- /dev/null +++ b/scripts/build-tinycc.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -euxo pipefail +source $(dirname -- "${BASH_SOURCE[0]}")/env.sh + +mkdir -p $BUN_DEPS_OUT_DIR + +cd $BUN_DEPS_DIR/tinycc +make clean +CFLAGS="${CFLAGS} -DTCC_LIBTCC1=\\\"\0\\\"" ./configure --enable-static --cc="$CC" --ar="$AR" --config-predefs=yes +make libtcc.a -j$CPUS +cp libtcc.a $BUN_DEPS_OUT_DIR diff --git a/scripts/build-zlib.ps1 b/scripts/build-zlib.ps1 new file mode 100644 index 0000000000000..f3cae807531d8 --- /dev/null +++ b/scripts/build-zlib.ps1 @@ -0,0 +1,21 @@ +$ErrorActionPreference = 'Stop' # Setting strict mode, similar to 'set -euo pipefail' in bash +. (Join-Path $PSScriptRoot "env.ps1") +$CWD = Get-Location + +# The current pinned commit of zlib in bun is on a fork that doesnt work on Windows, +# so here we use a different repo. There's a possibility this other fork (zlib-ng) has similar +# performance to what we have now (cloudflare/zlib), but need to benchmark first. +$ZlibSource = (Join-Path $PSScriptRoot "../build/zlib-ng") +if (!(test-path -PathType container $ZlibSource)) { + Set-Location (Join-Path $PSScriptRoot "../build") + git clone "https://github.com/zlib-ng/zlib-ng" zlib-ng +} + +Set-Location $ZlibSource +New-Item -ItemType Directory -Force -Path build +Set-Location build +cmake .. -DCMAKE_BUILD_TYPE=Release -DZLIB_COMPAT=1 -DWITH_NATIVE_INSTRUCTIONS=1 -DWITH_GTEST=0 +cmake --build . --clean-first --config Release +Copy-Item .\Release\zlibstatic.lib $BUN_DEPS_OUT_DIR + +Set-Location $CWD diff --git a/scripts/build-zlib.sh b/scripts/build-zlib.sh new file mode 100755 index 0000000000000..6ffafba10ade1 --- /dev/null +++ b/scripts/build-zlib.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +set -euxo pipefail +source $(dirname -- "${BASH_SOURCE[0]}")/env.sh + +mkdir -p $BUN_DEPS_OUT_DIR +cd $BUN_DEPS_DIR/zlib +export CFLAGS="-O3" +if [[ $(uname -s) == 'Darwin' ]]; then + export CFLAGS="$CFLAGS -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}" +fi +CFLAGS="${CFLAGS}" ./configure --static +make -j${CPUS} +cp ./libz.a $BUN_DEPS_OUT_DIR/libz.a diff --git a/scripts/build-zstd.ps1 b/scripts/build-zstd.ps1 new file mode 100644 index 0000000000000..e5588d514ee35 --- /dev/null +++ b/scripts/build-zstd.ps1 @@ -0,0 +1,10 @@ +$ErrorActionPreference = 'Stop' # Setting strict mode, similar to 'set -euo pipefail' in bash +. (Join-Path $PSScriptRoot "env.ps1") +$CWD = Get-Location + +Set-Location (Join-Path $BUN_DEPS_DIR 'zstd\build\cmake') +cmake $CMAKE_FLAGS -DZSTD_BUILD_STATIC=ON -DCMAKE_BUILD_TYPE=Release +cmake --build . --clean-first --config Release +Copy-Item lib\*\**.lib $BUN_DEPS_OUT_DIR + +Set-Location $CWD diff --git a/scripts/build-zstd.sh b/scripts/build-zstd.sh new file mode 100755 index 0000000000000..c29c4c8219e14 --- /dev/null +++ b/scripts/build-zstd.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -euxo pipefail +source $(dirname -- "${BASH_SOURCE[0]}")/env.sh + +mkdir -p $BUN_DEPS_OUT_DIR + +cd $BUN_DEPS_DIR/zstd +rm -rf Release CMakeCache.txt CMakeFiles +cmake "${CMAKE_FLAGS[@]}" -DZSTD_BUILD_STATIC=ON -B Release -S build/cmake -G Ninja +ninja -C Release +cp Release/lib/libzstd.a $BUN_DEPS_OUT_DIR/libzstd.a diff --git a/scripts/clean-dependencies.sh b/scripts/clean-dependencies.sh new file mode 100755 index 0000000000000..0c8b54c9bfcdc --- /dev/null +++ b/scripts/clean-dependencies.sh @@ -0,0 +1,26 @@ +FORCE= + +SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) +BUN_BASE_DIR=${BUN_BASE_DIR:-$(cd $SCRIPT_DIR && cd .. && pwd)} +BUN_DEPS_OUT_DIR=${BUN_DEPS_OUT_DIR:-$BUN_BASE_DIR/src/deps/} +BUN_DEPS_DIR=${BUN_DEPS_DIR:-$BUN_BASE_DIR/src/deps/} + +rm -f $BUN_DEPS_OUT_DIR/*.a + +git_reset() { + dir=$(pwd) + cd $1 + git reset --hard + git clean -fdx + cd $dir +} + +git_reset $BUN_DEPS_DIR/boringssl +git_reset $BUN_DEPS_DIR/c-ares +git_reset $BUN_DEPS_DIR/libarchive +git_reset $BUN_DEPS_DIR/lol-html +git_reset $BUN_DEPS_DIR/mimalloc +git_reset $BUN_DEPS_DIR/picohttpparser +git_reset $BUN_DEPS_DIR/tinycc +git_reset $BUN_DEPS_DIR/zlib +git_reset $BUN_DEPS_DIR/zstd \ No newline at end of file diff --git a/scripts/env.ps1 b/scripts/env.ps1 new file mode 100644 index 0000000000000..effcc8521c470 --- /dev/null +++ b/scripts/env.ps1 @@ -0,0 +1,29 @@ +$ErrorActionPreference = 'Stop' # Setting strict mode, similar to 'set -euo pipefail' in bash + +# this is the environment script for building bun's dependencies +# it sets c compiler and flags +$ScriptDir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent + +$BUN_BASE_DIR = if ($env:BUN_BASE_DIR) { $env:BUN_BASE_DIR } else { Join-Path $ScriptDir '..' } +$BUN_DEPS_DIR = if ($env:BUN_DEPS_DIR) { $env:BUN_DEPS_DIR } else { Join-Path $BUN_BASE_DIR 'src\deps' } +$BUN_DEPS_OUT_DIR = if ($env:BUN_DEPS_OUT_DIR) { $env:BUN_DEPS_OUT_DIR } else { $BUN_DEPS_DIR } + +# this compiler detection could be better +$CPUS = if ($env:CPUS) { $env:CPUS } else { (Get-WmiObject -Class Win32_Processor).NumberOfCores } + +$CFLAGS = '/O2' +$CXXFLAGS = '/O2' + +$Env:CFLAGS = $CFLAGS +$Env:CXXFLAGS = $CXXFLAGS + +$CMAKE_FLAGS = @( + "-GNinja", + "-DCMAKE_C_COMPILER=clang-cl", + "-DCMAKE_CXX_COMPILER=clang-cl", + "-DCMAKE_C_FLAGS=`"$CFLAGS`"", + "-DCMAKE_CXX_FLAGS=`"$CXXFLAGS`"", + "-DCMAKE_BUILD_TYPE=Release" +) + +$null = New-Item -ItemType Directory -Force -Path $BUN_DEPS_OUT_DIR diff --git a/scripts/env.sh b/scripts/env.sh new file mode 100755 index 0000000000000..4f3974d0946b8 --- /dev/null +++ b/scripts/env.sh @@ -0,0 +1,45 @@ +# this is the environment script for building bun's dependencies +# it sets c compiler and flags +export SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) +export BUN_BASE_DIR=${BUN_BASE_DIR:-$(cd $SCRIPT_DIR && cd .. && pwd)} +export BUN_DEPS_DIR=${BUN_DEPS_DIR:-$BUN_BASE_DIR/src/deps/} +export BUN_DEPS_OUT_DIR=${BUN_DEPS_OUT_DIR:-$BUN_BASE_DIR/src/deps/} + +# this compiler detection could be better +export CC=${CC:-$(which clang-16 || which clang || which cc)} +export CXX=${CXX:-$(which clang++-16 || which clang++ || which c++)} +export AR=${AR:-$(which llvm-ar || which ar)} +export CPUS=${CPUS:-$(nproc || sysctl -n hw.ncpu || echo 1)} + +export CMAKE_CXX_COMPILER=${CXX} +export CMAKE_C_COMPILER=${CC} + +export CFLAGS='-O3 -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden' +export CXXFLAGS='-O3 -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden' + +export CMAKE_FLAGS=( + -DCMAKE_C_COMPILER="${CC}" + -DCMAKE_CXX_COMPILER="${CXX}" + -DCMAKE_C_FLAGS="$CFLAGS" + -DCMAKE_CXX_FLAGS="$CXXFLAGS" + -DCMAKE_BUILD_TYPE=Release +) + +if [[ $(uname -s) == 'Darwin' ]]; then + if ! [[ $(uname -m) == 'arm64' ]]; then + export CMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET:-10.14} + else + export CMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET:-11.0} + fi + + CMAKE_FLAGS+=(-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) + export CFLAGS="$CFLAGS -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}" + export CXXFLAGS="$CXXFLAGS -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}" +fi + +mkdir -p $BUN_DEPS_OUT_DIR + +if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then + echo "C Compiler: ${CC}" + echo "C++ Compiler: ${CXX}" +fi diff --git a/scripts/setup.sh b/scripts/setup.sh new file mode 100755 index 0000000000000..8df663df75175 --- /dev/null +++ b/scripts/setup.sh @@ -0,0 +1,11 @@ +cd -- "$(dirname -- "${BASH_SOURCE[0]}")" +bash ./update-submodules.sh +bash ./all-dependencies.sh + +cd ../ + +bun i + +mkdir build +cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug -G Ninja +ninja \ No newline at end of file diff --git a/scripts/update-submodules.sh b/scripts/update-submodules.sh new file mode 100755 index 0000000000000..7dbb34c14fbf0 --- /dev/null +++ b/scripts/update-submodules.sh @@ -0,0 +1,12 @@ + +cd -- "$(dirname -- "${BASH_SOURCE[0]}")" +cd .. +NAMES=$(cat .gitmodules | grep 'path = ' | awk '{print $3}') + +# we will exclude webkit unless you explicity clone it yourself (a huge download) +if [ ! -e "src/bun.js/WebKit/.git" ]; then + NAMES=$(echo "$NAMES" | grep -v 'WebKit') +fi + +set -euxo pipefail +git submodule update --init --recursive --progress --depth=1 --checkout $NAMES diff --git a/.scripts/write-versions.sh b/scripts/write-versions.sh similarity index 100% rename from .scripts/write-versions.sh rename to scripts/write-versions.sh diff --git a/src/__global.zig b/src/__global.zig index 029834a0f17b9..8ef9784be8eab 100644 --- a/src/__global.zig +++ b/src/__global.zig @@ -7,18 +7,7 @@ const StringTypes = @import("./string_types.zig"); const Mimalloc = @import("root").bun.Mimalloc; const bun = @import("root").bun; -pub const build_id = std.fmt.parseInt(u64, std.mem.trim(u8, @embedFile("./build-id"), "\n \r\t"), 10) catch unreachable; - -pub const version: if (Environment.isWasm) - std.SemanticVersion -else - @import("./install/semver.zig").Version = .{ - .major = 1, - .minor = 0, - .patch = build_id, -}; - -const version_string = std.fmt.comptimePrint("{d}.{d}.{d}", .{ version.major, version.minor, version.patch }); +const version_string = Environment.version_string; pub const package_json_version = if (Environment.isDebug) version_string ++ "_debug" @@ -79,7 +68,7 @@ pub fn setThreadName(name: StringTypes.stringZ) void { /// Flushes stdout and stderr and exits with the given code. pub fn exit(code: u8) noreturn { Output.flush(); - std.os.exit(code); + std.c._exit(code); } pub const AllocatorConfiguration = struct { diff --git a/src/analytics/analytics_thread.zig b/src/analytics/analytics_thread.zig index b0ee2cdbc02ab..ce71fea662c03 100644 --- a/src/analytics/analytics_thread.zig +++ b/src/analytics/analytics_thread.zig @@ -332,7 +332,7 @@ pub const GenerateHeader = struct { "IOPlatformExpertDevice", }; - const result = try std.ChildProcess.exec(.{ + const result = try std.ChildProcess.run(.{ .allocator = default_allocator, .cwd = Fs.FileSystem.instance.top_level_dir, .argv = std.mem.span(&cmds), diff --git a/src/async/posix_event_loop.zig b/src/async/posix_event_loop.zig new file mode 100644 index 0000000000000..2896d5f8be9cd --- /dev/null +++ b/src/async/posix_event_loop.zig @@ -0,0 +1,852 @@ +const bun = @import("root").bun; +const Output = bun.Output; +const JSC = bun.JSC; +const uws = bun.uws; +const Environment = bun.Environment; +const std = @import("std"); + +pub const Loop = uws.Loop; + +/// Track if an object whose file descriptor is being watched should keep the event loop alive. +/// This is not reference counted. It only tracks active or inactive. +pub const KeepAlive = struct { + status: Status = .inactive, + + const log = Output.scoped(.KeepAlive, false); + + const Status = enum { active, inactive, done }; + + pub inline fn isActive(this: KeepAlive) bool { + return this.status == .active; + } + + /// Make calling ref() on this poll into a no-op. + pub fn disable(this: *KeepAlive) void { + this.unref(JSC.VirtualMachine.get()); + this.status = .done; + } + + /// Only intended to be used from EventLoop.Pollable + pub fn deactivate(this: *KeepAlive, loop: *Loop) void { + if (this.status != .active) + return; + + this.status = .inactive; + loop.num_polls -= 1; + loop.active -|= 1; + } + + /// Only intended to be used from EventLoop.Pollable + pub fn activate(this: *KeepAlive, loop: *Loop) void { + if (this.status != .inactive) + return; + + this.status = .active; + loop.num_polls += 1; + loop.active += 1; + } + + pub fn init() KeepAlive { + return .{}; + } + + /// Prevent a poll from keeping the process alive. + pub fn unref(this: *KeepAlive, vm: *JSC.VirtualMachine) void { + if (this.status != .active) + return; + this.status = .inactive; + vm.event_loop_handle.?.unref(); + } + + /// From another thread, Prevent a poll from keeping the process alive. + pub fn unrefConcurrently(this: *KeepAlive, vm: *JSC.VirtualMachine) void { + if (this.status != .active) + return; + this.status = .inactive; + vm.event_loop_handle.?.unrefConcurrently(); + } + + /// Prevent a poll from keeping the process alive on the next tick. + pub fn unrefOnNextTick(this: *KeepAlive, vm: *JSC.VirtualMachine) void { + if (this.status != .active) + return; + this.status = .inactive; + vm.pending_unref_counter +|= 1; + } + + /// From another thread, prevent a poll from keeping the process alive on the next tick. + pub fn unrefOnNextTickConcurrently(this: *KeepAlive, vm: *JSC.VirtualMachine) void { + if (this.status != .active) + return; + this.status = .inactive; + _ = @atomicRmw(@TypeOf(vm.pending_unref_counter), &vm.pending_unref_counter, .Add, 1, .Monotonic); + } + + /// Allow a poll to keep the process alive. + pub fn ref(this: *KeepAlive, vm: *JSC.VirtualMachine) void { + if (this.status != .inactive) + return; + this.status = .active; + vm.event_loop_handle.?.ref(); + } + + /// Allow a poll to keep the process alive. + pub fn refConcurrently(this: *KeepAlive, vm: *JSC.VirtualMachine) void { + if (this.status != .inactive) + return; + this.status = .active; + vm.event_loop_handle.?.refConcurrently(); + } + + pub fn refConcurrentlyFromEventLoop(this: *KeepAlive, loop: *JSC.EventLoop) void { + this.refConcurrently(loop.virtual_machine); + } + + pub fn unrefConcurrentlyFromEventLoop(this: *KeepAlive, loop: *JSC.EventLoop) void { + this.unrefConcurrently(loop.virtual_machine); + } +}; + +const KQueueGenerationNumber = if (Environment.isMac and Environment.allow_assert) usize else u0; +pub const FilePoll = struct { + var max_generation_number: KQueueGenerationNumber = 0; + + fd: bun.UFileDescriptor = invalid_fd, + flags: Flags.Set = Flags.Set{}, + owner: Owner = undefined, + + /// We re-use FilePoll objects to avoid allocating new ones. + /// + /// That means we might run into situations where the event is stale. + /// on macOS kevent64 has an extra pointer field so we use it for that + /// linux doesn't have a field like that + generation_number: KQueueGenerationNumber = 0, + next_to_free: ?*FilePoll = null, + + const FileReader = JSC.WebCore.FileReader; + const FileSink = JSC.WebCore.FileSink; + const FIFO = JSC.WebCore.FIFO; + const Subprocess = JSC.Subprocess; + const BufferedInput = Subprocess.BufferedInput; + const BufferedOutput = Subprocess.BufferedOutput; + const DNSResolver = JSC.DNS.DNSResolver; + const GetAddrInfoRequest = JSC.DNS.GetAddrInfoRequest; + const Deactivated = opaque { + pub var owner: Owner = Owner.init(@as(*Deactivated, @ptrFromInt(@as(usize, 0xDEADBEEF)))); + }; + + pub const Owner = bun.TaggedPointerUnion(.{ + FileReader, + FileSink, + Subprocess, + BufferedInput, + FIFO, + Deactivated, + DNSResolver, + GetAddrInfoRequest, + }); + + fn updateFlags(poll: *FilePoll, updated: Flags.Set) void { + var flags = poll.flags; + flags.remove(.readable); + flags.remove(.writable); + flags.remove(.process); + flags.remove(.machport); + flags.remove(.eof); + flags.remove(.hup); + + flags.setUnion(updated); + poll.flags = flags; + } + + pub fn onKQueueEvent(poll: *FilePoll, loop: *Loop, kqueue_event: *const std.os.system.kevent64_s) void { + if (KQueueGenerationNumber != u0) + std.debug.assert(poll.generation_number == kqueue_event.ext[0]); + + poll.updateFlags(Flags.fromKQueueEvent(kqueue_event.*)); + poll.onUpdate(loop, kqueue_event.data); + } + + pub fn onEpollEvent(poll: *FilePoll, loop: *Loop, epoll_event: *std.os.linux.epoll_event) void { + poll.updateFlags(Flags.fromEpollEvent(epoll_event.*)); + poll.onUpdate(loop, 0); + } + + pub fn clearEvent(poll: *FilePoll, flag: Flags) void { + poll.flags.remove(flag); + } + + pub fn isReadable(this: *FilePoll) bool { + const readable = this.flags.contains(.readable); + this.flags.remove(.readable); + return readable; + } + + pub fn isHUP(this: *FilePoll) bool { + const readable = this.flags.contains(.hup); + this.flags.remove(.hup); + return readable; + } + + pub fn isEOF(this: *FilePoll) bool { + const readable = this.flags.contains(.eof); + this.flags.remove(.eof); + return readable; + } + + pub fn isWritable(this: *FilePoll) bool { + const readable = this.flags.contains(.writable); + this.flags.remove(.writable); + return readable; + } + + pub fn deinit(this: *FilePoll) void { + var vm = JSC.VirtualMachine.get(); + var loop = vm.event_loop_handle.?; + this.deinitPossiblyDefer(vm, loop, vm.rareData().filePolls(vm), false); + } + + pub fn deinitForceUnregister(this: *FilePoll) void { + var vm = JSC.VirtualMachine.get(); + var loop = vm.event_loop_handle.?; + this.deinitPossiblyDefer(vm, loop, vm.rareData().filePolls(vm), true); + } + + fn deinitPossiblyDefer(this: *FilePoll, vm: *JSC.VirtualMachine, loop: *Loop, polls: *FilePoll.Store, force_unregister: bool) void { + if (this.isRegistered()) { + _ = this.unregister(loop, force_unregister); + } + + this.owner = Deactivated.owner; + const was_ever_registered = this.flags.contains(.was_ever_registered); + this.flags = Flags.Set{}; + this.fd = invalid_fd; + polls.put(this, vm, was_ever_registered); + } + + pub fn deinitWithVM(this: *FilePoll, vm: *JSC.VirtualMachine) void { + var loop = vm.event_loop_handle.?; + this.deinitPossiblyDefer(vm, loop, vm.rareData().filePolls(vm), false); + } + + pub fn isRegistered(this: *const FilePoll) bool { + return this.flags.contains(.poll_writable) or this.flags.contains(.poll_readable) or this.flags.contains(.poll_process) or this.flags.contains(.poll_machport); + } + + const kqueue_or_epoll = if (Environment.isMac) "kevent" else "epoll"; + + pub fn onUpdate(poll: *FilePoll, loop: *Loop, size_or_offset: i64) void { + if (poll.flags.contains(.one_shot) and !poll.flags.contains(.needs_rearm)) { + if (poll.flags.contains(.has_incremented_poll_count)) poll.deactivate(loop); + poll.flags.insert(.needs_rearm); + } + var ptr = poll.owner; + switch (ptr.tag()) { + @field(Owner.Tag, "FIFO") => { + log("onUpdate " ++ kqueue_or_epoll ++ " (fd: {d}) FIFO", .{poll.fd}); + ptr.as(FIFO).ready(size_or_offset, poll.flags.contains(.hup)); + }, + @field(Owner.Tag, "Subprocess") => { + log("onUpdate " ++ kqueue_or_epoll ++ " (fd: {d}) Subprocess", .{poll.fd}); + var loader = ptr.as(JSC.Subprocess); + + loader.onExitNotificationTask(); + }, + @field(Owner.Tag, "FileSink") => { + log("onUpdate " ++ kqueue_or_epoll ++ " (fd: {d}) FileSink", .{poll.fd}); + var loader = ptr.as(JSC.WebCore.FileSink); + loader.onPoll(size_or_offset, 0); + }, + + @field(Owner.Tag, "DNSResolver") => { + log("onUpdate " ++ kqueue_or_epoll ++ " (fd: {d}) DNSResolver", .{poll.fd}); + var loader: *DNSResolver = ptr.as(DNSResolver); + loader.onDNSPoll(poll); + }, + + @field(Owner.Tag, "GetAddrInfoRequest") => { + log("onUpdate " ++ kqueue_or_epoll ++ " (fd: {d}) GetAddrInfoRequest", .{poll.fd}); + var loader: *GetAddrInfoRequest = ptr.as(GetAddrInfoRequest); + loader.onMachportChange(); + }, + + else => { + log("onUpdate " ++ kqueue_or_epoll ++ " (fd: {d}) disconnected?", .{poll.fd}); + }, + } + } + + pub const Flags = enum { + // What are we asking the event loop about? + + /// Poll for readable events + poll_readable, + + /// Poll for writable events + poll_writable, + + /// Poll for process-related events + poll_process, + + /// Poll for machport events + poll_machport, + + // What did the event loop tell us? + readable, + writable, + process, + eof, + hup, + machport, + + // What is the type of file descriptor? + fifo, + tty, + + one_shot, + needs_rearm, + + has_incremented_poll_count, + + disable, + + nonblocking, + + was_ever_registered, + ignore_updates, + + pub fn poll(this: Flags) Flags { + return switch (this) { + .readable => .poll_readable, + .writable => .poll_writable, + .process => .poll_process, + .machport => .poll_machport, + else => this, + }; + } + + pub const Set = std.EnumSet(Flags); + pub const Struct = std.enums.EnumFieldStruct(Flags, bool, false); + + pub fn fromKQueueEvent(kqueue_event: std.os.system.kevent64_s) Flags.Set { + var flags = Flags.Set{}; + if (kqueue_event.filter == std.os.system.EVFILT_READ) { + flags.insert(Flags.readable); + log("readable", .{}); + if (kqueue_event.flags & std.os.system.EV_EOF != 0) { + flags.insert(Flags.hup); + log("hup", .{}); + } + } else if (kqueue_event.filter == std.os.system.EVFILT_WRITE) { + flags.insert(Flags.writable); + log("writable", .{}); + if (kqueue_event.flags & std.os.system.EV_EOF != 0) { + flags.insert(Flags.hup); + log("hup", .{}); + } + } else if (kqueue_event.filter == std.os.system.EVFILT_PROC) { + log("proc", .{}); + flags.insert(Flags.process); + } else if (kqueue_event.filter == std.os.system.EVFILT_MACHPORT) { + log("machport", .{}); + flags.insert(Flags.machport); + } + return flags; + } + + pub fn fromEpollEvent(epoll: std.os.linux.epoll_event) Flags.Set { + var flags = Flags.Set{}; + if (epoll.events & std.os.linux.EPOLL.IN != 0) { + flags.insert(Flags.readable); + log("readable", .{}); + } + if (epoll.events & std.os.linux.EPOLL.OUT != 0) { + flags.insert(Flags.writable); + log("writable", .{}); + } + if (epoll.events & std.os.linux.EPOLL.ERR != 0) { + flags.insert(Flags.eof); + log("eof", .{}); + } + if (epoll.events & std.os.linux.EPOLL.HUP != 0) { + flags.insert(Flags.hup); + log("hup", .{}); + } + return flags; + } + }; + + const HiveArray = bun.HiveArray(FilePoll, 128).Fallback; + + // We defer freeing FilePoll until the end of the next event loop iteration + // This ensures that we don't free a FilePoll before the next callback is called + pub const Store = struct { + hive: HiveArray, + pending_free_head: ?*FilePoll = null, + pending_free_tail: ?*FilePoll = null, + + const log = Output.scoped(.FilePoll, false); + + pub fn init(allocator: std.mem.Allocator) Store { + return .{ + .hive = HiveArray.init(allocator), + }; + } + + pub fn get(this: *Store) *FilePoll { + return this.hive.get(); + } + + pub fn processDeferredFrees(this: *Store) void { + var next = this.pending_free_head; + while (next) |current| { + next = current.next_to_free; + current.next_to_free = null; + this.hive.put(current); + } + this.pending_free_head = null; + this.pending_free_tail = null; + } + + pub fn put(this: *Store, poll: *FilePoll, vm: *JSC.VirtualMachine, ever_registered: bool) void { + if (!ever_registered) { + this.hive.put(poll); + return; + } + + std.debug.assert(poll.next_to_free == null); + + if (this.pending_free_tail) |tail| { + std.debug.assert(this.pending_free_head != null); + std.debug.assert(tail.next_to_free == null); + tail.next_to_free = poll; + } + + if (this.pending_free_head == null) { + this.pending_free_head = poll; + std.debug.assert(this.pending_free_tail == null); + } + + poll.flags.insert(.ignore_updates); + this.pending_free_tail = poll; + std.debug.assert(vm.after_event_loop_callback == null or vm.after_event_loop_callback == @as(?JSC.OpaqueCallback, @ptrCast(&processDeferredFrees))); + vm.after_event_loop_callback = @ptrCast(&processDeferredFrees); + vm.after_event_loop_callback_ctx = this; + } + }; + + const log = Output.scoped(.FilePoll, false); + + pub inline fn isActive(this: *const FilePoll) bool { + return this.flags.contains(.has_incremented_poll_count); + } + + pub inline fn isWatching(this: *const FilePoll) bool { + return !this.flags.contains(.needs_rearm) and (this.flags.contains(.poll_readable) or this.flags.contains(.poll_writable) or this.flags.contains(.poll_process)); + } + + pub inline fn isKeepingProcessAlive(this: *const FilePoll) bool { + return !this.flags.contains(.disable) and this.isActive(); + } + + /// Make calling ref() on this poll into a no-op. + pub fn disableKeepingProcessAlive(this: *FilePoll, vm: *JSC.VirtualMachine) void { + if (this.flags.contains(.disable)) + return; + this.flags.insert(.disable); + + vm.event_loop_handle.?.active -= @as(u32, @intFromBool(this.flags.contains(.has_incremented_poll_count))); + } + + pub fn enableKeepingProcessAlive(this: *FilePoll, vm: *JSC.VirtualMachine) void { + if (!this.flags.contains(.disable)) + return; + this.flags.remove(.disable); + + vm.event_loop_handle.?.active += @as(u32, @intFromBool(this.flags.contains(.has_incremented_poll_count))); + } + + pub fn canActivate(this: *const FilePoll) bool { + return !this.flags.contains(.has_incremented_poll_count); + } + + /// Only intended to be used from EventLoop.Pollable + pub fn deactivate(this: *FilePoll, loop: *Loop) void { + std.debug.assert(this.flags.contains(.has_incremented_poll_count)); + loop.num_polls -= @as(i32, @intFromBool(this.flags.contains(.has_incremented_poll_count))); + loop.active -|= @as(u32, @intFromBool(!this.flags.contains(.disable) and this.flags.contains(.has_incremented_poll_count))); + + this.flags.remove(.has_incremented_poll_count); + } + + /// Only intended to be used from EventLoop.Pollable + pub fn activate(this: *FilePoll, loop: *Loop) void { + loop.num_polls += @as(i32, @intFromBool(!this.flags.contains(.has_incremented_poll_count))); + loop.active += @as(u32, @intFromBool(!this.flags.contains(.disable) and !this.flags.contains(.has_incremented_poll_count))); + this.flags.insert(.has_incremented_poll_count); + } + + pub fn init(vm: *JSC.VirtualMachine, fd: bun.FileDescriptor, flags: Flags.Struct, comptime Type: type, owner: *Type) *FilePoll { + return initWithOwner(vm, fd, flags, Owner.init(owner)); + } + + pub fn initWithOwner(vm: *JSC.VirtualMachine, fd: bun.FileDescriptor, flags: Flags.Struct, owner: Owner) *FilePoll { + var poll = vm.rareData().filePolls(vm).get(); + poll.fd = @intCast(fd); + poll.flags = Flags.Set.init(flags); + poll.owner = owner; + poll.next_to_free = null; + + if (KQueueGenerationNumber != u0) { + max_generation_number +%= 1; + poll.generation_number = max_generation_number; + } + return poll; + } + + pub inline fn canRef(this: *const FilePoll) bool { + if (this.flags.contains(.disable)) + return false; + + return !this.flags.contains(.has_incremented_poll_count); + } + + pub inline fn canUnref(this: *const FilePoll) bool { + return this.flags.contains(.has_incremented_poll_count); + } + + /// Prevent a poll from keeping the process alive. + pub fn unref(this: *FilePoll, vm: *JSC.VirtualMachine) void { + if (!this.canUnref()) + return; + log("unref", .{}); + this.deactivate(vm.event_loop_handle.?); + } + + /// Allow a poll to keep the process alive. + pub fn ref(this: *FilePoll, vm: *JSC.VirtualMachine) void { + if (this.canRef()) + return; + log("ref", .{}); + this.activate(vm.event_loop_handle.?); + } + + pub fn onTick(loop: *Loop, tagged_pointer: ?*anyopaque) callconv(.C) void { + var tag = Pollable.from(tagged_pointer); + + if (tag.tag() != @field(Pollable.Tag, "FilePoll")) + return; + + var file_poll: *FilePoll = tag.as(FilePoll); + if (file_poll.flags.contains(.ignore_updates)) { + return; + } + + if (comptime Environment.isMac) + onKQueueEvent(file_poll, loop, &loop.ready_polls[@as(usize, @intCast(loop.current_ready_poll))]) + else if (comptime Environment.isLinux) + onEpollEvent(file_poll, loop, &loop.ready_polls[@as(usize, @intCast(loop.current_ready_poll))]); + } + + const Pollable = bun.TaggedPointerUnion( + .{ + FilePoll, + Deactivated, + }, + ); + + comptime { + @export(onTick, .{ .name = "Bun__internal_dispatch_ready_poll" }); + } + + const timeout = std.mem.zeroes(std.os.timespec); + const kevent = std.c.kevent; + const linux = std.os.linux; + + pub fn register(this: *FilePoll, loop: *Loop, flag: Flags, one_shot: bool) JSC.Maybe(void) { + return registerWithFd(this, loop, flag, one_shot, this.fd); + } + pub fn registerWithFd(this: *FilePoll, loop: *Loop, flag: Flags, one_shot: bool, fd: u64) JSC.Maybe(void) { + const watcher_fd = loop.fd; + + log("register: {s} ({d})", .{ @tagName(flag), fd }); + + std.debug.assert(fd != invalid_fd); + + if (one_shot) { + this.flags.insert(.one_shot); + } + + if (comptime Environment.isLinux) { + const one_shot_flag: u32 = if (!this.flags.contains(.one_shot)) 0 else linux.EPOLL.ONESHOT; + + const flags: u32 = switch (flag) { + .process, + .readable, + => linux.EPOLL.IN | linux.EPOLL.HUP | one_shot_flag, + .writable => linux.EPOLL.OUT | linux.EPOLL.HUP | linux.EPOLL.ERR | one_shot_flag, + else => unreachable, + }; + + var event = linux.epoll_event{ .events = flags, .data = .{ .u64 = @intFromPtr(Pollable.init(this).ptr()) } }; + + var op: u32 = if (this.isRegistered() or this.flags.contains(.needs_rearm)) linux.EPOLL.CTL_MOD else linux.EPOLL.CTL_ADD; + + const ctl = linux.epoll_ctl( + watcher_fd, + op, + @intCast(fd), + &event, + ); + this.flags.insert(.was_ever_registered); + if (JSC.Maybe(void).errnoSys(ctl, .epoll_ctl)) |errno| { + return errno; + } + } else if (comptime Environment.isMac) { + var changelist = std.mem.zeroes([2]std.os.system.kevent64_s); + const one_shot_flag: u16 = if (!this.flags.contains(.one_shot)) 0 else std.c.EV_ONESHOT; + changelist[0] = switch (flag) { + .readable => .{ + .ident = @as(u64, @intCast(fd)), + .filter = std.os.system.EVFILT_READ, + .data = 0, + .fflags = 0, + .udata = @intFromPtr(Pollable.init(this).ptr()), + .flags = std.c.EV_ADD | one_shot_flag, + .ext = .{ this.generation_number, 0 }, + }, + .writable => .{ + .ident = @as(u64, @intCast(fd)), + .filter = std.os.system.EVFILT_WRITE, + .data = 0, + .fflags = 0, + .udata = @intFromPtr(Pollable.init(this).ptr()), + .flags = std.c.EV_ADD | one_shot_flag, + .ext = .{ this.generation_number, 0 }, + }, + .process => .{ + .ident = @as(u64, @intCast(fd)), + .filter = std.os.system.EVFILT_PROC, + .data = 0, + .fflags = std.c.NOTE_EXIT, + .udata = @intFromPtr(Pollable.init(this).ptr()), + .flags = std.c.EV_ADD | one_shot_flag, + .ext = .{ this.generation_number, 0 }, + }, + .machport => .{ + .ident = @as(u64, @intCast(fd)), + .filter = std.os.system.EVFILT_MACHPORT, + .data = 0, + .fflags = 0, + .udata = @intFromPtr(Pollable.init(this).ptr()), + .flags = std.c.EV_ADD | one_shot_flag, + .ext = .{ this.generation_number, 0 }, + }, + else => unreachable, + }; + + // output events only include change errors + const KEVENT_FLAG_ERROR_EVENTS = 0x000002; + + // The kevent() system call returns the number of events placed in + // the eventlist, up to the value given by nevents. If the time + // limit expires, then kevent() returns 0. + const rc = rc: { + while (true) { + const rc = std.os.system.kevent64( + watcher_fd, + &changelist, + 1, + // The same array may be used for the changelist and eventlist. + &changelist, + // we set 0 here so that if we get an error on + // registration, it becomes errno + 0, + KEVENT_FLAG_ERROR_EVENTS, + &timeout, + ); + + if (std.c.getErrno(rc) == .INTR) continue; + break :rc rc; + } + }; + + this.flags.insert(.was_ever_registered); + + // If an error occurs while + // processing an element of the changelist and there is enough room + // in the eventlist, then the event will be placed in the eventlist + // with EV_ERROR set in flags and the system error in data. + if (changelist[0].flags == std.c.EV_ERROR and changelist[0].data != 0) { + return JSC.Maybe(void).errnoSys(changelist[0].data, .kevent).?; + // Otherwise, -1 will be returned, and errno will be set to + // indicate the error condition. + } + + const errno = std.c.getErrno(rc); + + if (errno != .SUCCESS) { + return JSC.Maybe(void){ + .err = bun.sys.Error.fromCode(errno, .kqueue), + }; + } + } else { + bun.todo(@src(), {}); + } + if (this.canActivate()) + this.activate(loop); + this.flags.insert(switch (flag) { + .readable => .poll_readable, + .process => if (comptime Environment.isLinux) .poll_readable else .poll_process, + .writable => .poll_writable, + .machport => .poll_machport, + else => unreachable, + }); + this.flags.remove(.needs_rearm); + + return JSC.Maybe(void).success; + } + + const invalid_fd = bun.invalid_fd; + + pub fn unregister(this: *FilePoll, loop: *Loop, force_unregister: bool) JSC.Maybe(void) { + return this.unregisterWithFd(loop, this.fd, force_unregister); + } + + pub fn unregisterWithFd(this: *FilePoll, loop: *Loop, fd: bun.UFileDescriptor, force_unregister: bool) JSC.Maybe(void) { + if (!(this.flags.contains(.poll_readable) or this.flags.contains(.poll_writable) or this.flags.contains(.poll_process) or this.flags.contains(.poll_machport))) { + // no-op + return JSC.Maybe(void).success; + } + + std.debug.assert(fd != invalid_fd); + const watcher_fd = loop.fd; + const flag: Flags = brk: { + if (this.flags.contains(.poll_readable)) + break :brk .readable; + if (this.flags.contains(.poll_writable)) + break :brk .writable; + if (this.flags.contains(.poll_process)) + break :brk .process; + + if (this.flags.contains(.poll_machport)) + break :brk .machport; + return JSC.Maybe(void).success; + }; + + if (this.flags.contains(.needs_rearm) and !force_unregister) { + log("unregister: {s} ({d}) skipped due to needs_rearm", .{ @tagName(flag), fd }); + this.flags.remove(.poll_process); + this.flags.remove(.poll_readable); + this.flags.remove(.poll_process); + this.flags.remove(.poll_machport); + return JSC.Maybe(void).success; + } + + log("unregister: {s} ({d})", .{ @tagName(flag), fd }); + + if (comptime Environment.isLinux) { + const ctl = linux.epoll_ctl( + watcher_fd, + linux.EPOLL.CTL_DEL, + @intCast(fd), + null, + ); + + if (JSC.Maybe(void).errnoSys(ctl, .epoll_ctl)) |errno| { + return errno; + } + } else if (comptime Environment.isMac) { + var changelist = std.mem.zeroes([2]std.os.system.kevent64_s); + + changelist[0] = switch (flag) { + .readable => .{ + .ident = @as(u64, @intCast(fd)), + .filter = std.os.system.EVFILT_READ, + .data = 0, + .fflags = 0, + .udata = @intFromPtr(Pollable.init(this).ptr()), + .flags = std.c.EV_DELETE, + .ext = .{ 0, 0 }, + }, + .machport => .{ + .ident = @as(u64, @intCast(fd)), + .filter = std.os.system.EVFILT_MACHPORT, + .data = 0, + .fflags = 0, + .udata = @intFromPtr(Pollable.init(this).ptr()), + .flags = std.c.EV_DELETE, + .ext = .{ 0, 0 }, + }, + .writable => .{ + .ident = @as(u64, @intCast(fd)), + .filter = std.os.system.EVFILT_WRITE, + .data = 0, + .fflags = 0, + .udata = @intFromPtr(Pollable.init(this).ptr()), + .flags = std.c.EV_DELETE, + .ext = .{ 0, 0 }, + }, + .process => .{ + .ident = @as(u64, @intCast(fd)), + .filter = std.os.system.EVFILT_PROC, + .data = 0, + .fflags = std.c.NOTE_EXIT, + .udata = @intFromPtr(Pollable.init(this).ptr()), + .flags = std.c.EV_DELETE, + .ext = .{ 0, 0 }, + }, + else => unreachable, + }; + + // output events only include change errors + const KEVENT_FLAG_ERROR_EVENTS = 0x000002; + + // The kevent() system call returns the number of events placed in + // the eventlist, up to the value given by nevents. If the time + // limit expires, then kevent() returns 0. + const rc = std.os.system.kevent64( + watcher_fd, + &changelist, + 1, + // The same array may be used for the changelist and eventlist. + &changelist, + 1, + KEVENT_FLAG_ERROR_EVENTS, + &timeout, + ); + // If an error occurs while + // processing an element of the changelist and there is enough room + // in the eventlist, then the event will be placed in the eventlist + // with EV_ERROR set in flags and the system error in data. + if (changelist[0].flags == std.c.EV_ERROR) { + return JSC.Maybe(void).errnoSys(changelist[0].data, .kevent).?; + // Otherwise, -1 will be returned, and errno will be set to + // indicate the error condition. + } + + const errno = std.c.getErrno(rc); + switch (rc) { + std.math.minInt(@TypeOf(rc))...-1 => return JSC.Maybe(void).errnoSys(@intFromEnum(errno), .kevent).?, + else => {}, + } + } else { + bun.todo(@src(), {}); + } + + this.flags.remove(.needs_rearm); + this.flags.remove(.one_shot); + // we don't support both right now + std.debug.assert(!(this.flags.contains(.poll_readable) and this.flags.contains(.poll_writable))); + this.flags.remove(.poll_readable); + this.flags.remove(.poll_writable); + this.flags.remove(.poll_process); + this.flags.remove(.poll_machport); + if (this.isActive()) + this.deactivate(loop); + + return JSC.Maybe(void).success; + } +}; + +pub const Waker = @import("io").Waker; diff --git a/src/async/stub_event_loop.zig b/src/async/stub_event_loop.zig new file mode 100644 index 0000000000000..2b24b21c0b4b3 --- /dev/null +++ b/src/async/stub_event_loop.zig @@ -0,0 +1,3 @@ +pub const Loop = opaque {}; +pub const KeepAlive = opaque {}; +pub const FilePoll = opaque {}; diff --git a/src/async/windows_event_loop.zig b/src/async/windows_event_loop.zig new file mode 100644 index 0000000000000..c2c3a699efe3d --- /dev/null +++ b/src/async/windows_event_loop.zig @@ -0,0 +1,344 @@ +const bun = @import("root").bun; +const Output = bun.Output; +const JSC = bun.JSC; +const uws = bun.uws; +const Environment = bun.Environment; +const std = @import("std"); +const uv = bun.windows.libuv; +pub const Loop = uv.Loop; + +pub const KeepAlive = struct { + // handle.init zeroes the memory + handle: uv.uv_async_t = undefined, + + status: Status = .inactive, + + const log = Output.scoped(.KeepAlive, false); + + const Status = enum { active, inactive, done }; + + pub inline fn isActive(this: KeepAlive) bool { + if (comptime Environment.allow_assert) { + if (this.status == .active) { + std.debug.assert(this.handle.isActive()); + } + } + return this.status == .active; + } + + /// Make calling ref() on this poll into a no-op. + pub fn disable(this: *KeepAlive) void { + if (this.status == .active) { + this.unref(JSC.VirtualMachine.get()); + this.handle.close(null); + } + + this.status = .done; + } + + /// Only intended to be used from EventLoop.Pollable + pub fn deactivate(this: *KeepAlive, loop: *Loop) void { + _ = loop; + if (this.status != .active) + return; + + this.status = .inactive; + this.handle.close(null); + } + + /// Only intended to be used from EventLoop.Pollable + pub fn activate(this: *KeepAlive, loop: *Loop) void { + if (this.status != .active) + return; + + this.status = .active; + this.handle.init(loop, null); + } + + pub fn init() KeepAlive { + return .{}; + } + + /// Prevent a poll from keeping the process alive. + pub fn unref(this: *KeepAlive, vm: *JSC.VirtualMachine) void { + _ = vm; + if (this.status != .active) + return; + this.status = .inactive; + this.handle.unref(); + } + + /// From another thread, Prevent a poll from keeping the process alive. + pub fn unrefConcurrently(this: *KeepAlive, vm: *JSC.VirtualMachine) void { + _ = vm; + if (this.status != .active) + return; + this.status = .inactive; + + // TODO: https://github.com/oven-sh/bun/pull/4410#discussion_r1317326194 + this.handle.unref(); + } + + /// Prevent a poll from keeping the process alive on the next tick. + pub fn unrefOnNextTick(this: *KeepAlive, vm: *JSC.VirtualMachine) void { + _ = vm; + if (this.status != .active) + return; + this.status = .inactive; + this.handle.unref(); + } + + /// From another thread, prevent a poll from keeping the process alive on the next tick. + pub fn unrefOnNextTickConcurrently(this: *KeepAlive, vm: *JSC.VirtualMachine) void { + _ = vm; + if (this.status != .active) + return; + this.status = .inactive; + // TODO: https://github.com/oven-sh/bun/pull/4410#discussion_r1317326194 + this.handle.unref(); + } + + /// Allow a poll to keep the process alive. + pub fn ref(this: *KeepAlive, vm: *JSC.VirtualMachine) void { + if (this.status != .inactive) + return; + this.status = .active; + this.handle.init(vm.event_loop_handle.?, null); + this.handle.ref(); + } + + /// Allow a poll to keep the process alive. + pub fn refConcurrently(this: *KeepAlive, vm: *JSC.VirtualMachine) void { + if (this.status != .inactive) + return; + this.status = .active; + // TODO: https://github.com/oven-sh/bun/pull/4410#discussion_r1317326194 + this.handle.init(vm.event_loop_handle.?, null); + this.handle.ref(); + } + + pub fn refConcurrentlyFromEventLoop(this: *KeepAlive, loop: *JSC.EventLoop) void { + this.refConcurrently(loop.virtual_machine); + } + + pub fn unrefConcurrentlyFromEventLoop(this: *KeepAlive, loop: *JSC.EventLoop) void { + this.unrefConcurrently(loop.virtual_machine); + } +}; + +const Posix = @import("./posix_event_loop.zig"); + +pub const FilePoll = struct { + fd: bun.FileDescriptor, + owner: Owner = undefined, + flags: Flags.Set = Flags.Set{}, + next_to_free: ?*FilePoll = null, + + pub const Flags = Posix.FilePoll.Flags; + pub const Owner = Posix.FilePoll.Owner; + + const log = Output.scoped(.FilePoll, false); + + pub inline fn isActive(this: *const FilePoll) bool { + return this.flags.contains(.has_incremented_poll_count); + } + + pub inline fn isWatching(this: *const FilePoll) bool { + return !this.flags.contains(.needs_rearm) and (this.flags.contains(.poll_readable) or this.flags.contains(.poll_writable) or this.flags.contains(.poll_process)); + } + + pub inline fn isKeepingProcessAlive(this: *const FilePoll) bool { + return !this.flags.contains(.disable) and this.isActive(); + } + + pub fn isRegistered(this: *const FilePoll) bool { + return this.flags.contains(.poll_writable) or this.flags.contains(.poll_readable) or this.flags.contains(.poll_process) or this.flags.contains(.poll_machport); + } + + /// Make calling ref() on this poll into a no-op. + pub fn disableKeepingProcessAlive(this: *FilePoll, vm: *JSC.VirtualMachine) void { + if (this.flags.contains(.disable)) + return; + this.flags.insert(.disable); + + vm.event_loop_handle.?.active_handles -= @as(u32, @intFromBool(this.flags.contains(.has_incremented_poll_count))); + } + + pub fn init(vm: *JSC.VirtualMachine, fd: bun.FileDescriptor, flags: Flags.Struct, comptime Type: type, owner: *Type) *FilePoll { + return initWithOwner(vm, fd, flags, Owner.init(owner)); + } + + pub fn initWithOwner(vm: *JSC.VirtualMachine, fd: bun.FileDescriptor, flags: Flags.Struct, owner: Owner) *FilePoll { + var poll = vm.rareData().filePolls(vm).get(); + poll.fd = fd; + poll.flags = Flags.Set.init(flags); + poll.owner = owner; + poll.next_to_free = null; + + return poll; + } + + pub fn deinit(this: *FilePoll) void { + var vm = JSC.VirtualMachine.get(); + this.deinitWithVM(vm); + } + + pub fn unregister(this: *FilePoll, loop: *Loop) bool { + _ = loop; + uv.uv_unref(@ptrFromInt(this.fd)); + return true; + } + + fn deinitPossiblyDefer(this: *FilePoll, vm: *JSC.VirtualMachine, loop: *Loop, polls: *FilePoll.Store) void { + if (this.isRegistered()) { + _ = this.unregister(loop); + } + + const was_ever_registered = this.flags.contains(.was_ever_registered); + this.flags = Flags.Set{}; + this.fd = bun.invalid_fd; + polls.put(this, vm, was_ever_registered); + } + + pub fn isReadable(this: *FilePoll) bool { + const readable = this.flags.contains(.readable); + this.flags.remove(.readable); + return readable; + } + + pub fn isHUP(this: *FilePoll) bool { + const readable = this.flags.contains(.hup); + this.flags.remove(.hup); + return readable; + } + + pub fn isEOF(this: *FilePoll) bool { + const readable = this.flags.contains(.eof); + this.flags.remove(.eof); + return readable; + } + + pub fn clearEvent(poll: *FilePoll, flag: Flags) void { + poll.flags.remove(flag); + } + + pub fn isWritable(this: *FilePoll) bool { + const readable = this.flags.contains(.writable); + this.flags.remove(.writable); + return readable; + } + + pub fn deinitWithVM(this: *FilePoll, vm: *JSC.VirtualMachine) void { + var loop = vm.event_loop_handle.?; + this.deinitPossiblyDefer(vm, loop, vm.rareData().filePolls(vm)); + } + + pub fn enableKeepingProcessAlive(this: *FilePoll, vm: *JSC.VirtualMachine) void { + if (!this.flags.contains(.disable)) + return; + this.flags.remove(.disable); + + vm.event_loop_handle.?.active_handles += @as(u32, @intFromBool(this.flags.contains(.has_incremented_poll_count))); + } + + pub fn canActivate(this: *const FilePoll) bool { + return !this.flags.contains(.has_incremented_poll_count); + } + + /// Only intended to be used from EventLoop.Pollable + pub fn deactivate(this: *FilePoll, loop: *Loop) void { + std.debug.assert(this.flags.contains(.has_incremented_poll_count)); + loop.active_handles -= @as(u32, @intFromBool(!this.flags.contains(.disable) and this.flags.contains(.has_incremented_poll_count))); + this.flags.remove(.has_incremented_poll_count); + } + + /// Only intended to be used from EventLoop.Pollable + pub fn activate(this: *FilePoll, loop: *Loop) void { + loop.active_handles += @as(u32, @intFromBool(!this.flags.contains(.disable) and !this.flags.contains(.has_incremented_poll_count))); + this.flags.insert(.has_incremented_poll_count); + } + + pub inline fn canRef(this: *const FilePoll) bool { + if (this.flags.contains(.disable)) + return false; + + return !this.flags.contains(.has_incremented_poll_count); + } + + pub inline fn canUnref(this: *const FilePoll) bool { + return this.flags.contains(.has_incremented_poll_count); + } + + /// Prevent a poll from keeping the process alive. + pub fn unref(this: *FilePoll, vm: *JSC.VirtualMachine) void { + if (!this.canUnref()) + return; + log("unref", .{}); + this.deactivate(vm.event_loop_handle.?); + } + + /// Allow a poll to keep the process alive. + pub fn ref(this: *FilePoll, vm: *JSC.VirtualMachine) void { + if (this.canRef()) + return; + log("ref", .{}); + this.activate(vm.event_loop_handle.?); + } + + const HiveArray = bun.HiveArray(FilePoll, 128).Fallback; + + pub const Store = struct { + hive: HiveArray, + pending_free_head: ?*FilePoll = null, + pending_free_tail: ?*FilePoll = null, + + const log = Output.scoped(.FilePoll, false); + + pub fn init(allocator: std.mem.Allocator) Store { + return .{ + .hive = HiveArray.init(allocator), + }; + } + + pub fn get(this: *Store) *FilePoll { + return this.hive.get(); + } + + pub fn processDeferredFrees(this: *Store) void { + var next = this.pending_free_head; + while (next) |current| { + next = current.next_to_free; + current.next_to_free = null; + this.hive.put(current); + } + this.pending_free_head = null; + this.pending_free_tail = null; + } + + pub fn put(this: *Store, poll: *FilePoll, vm: *JSC.VirtualMachine, ever_registered: bool) void { + if (!ever_registered) { + this.hive.put(poll); + return; + } + + std.debug.assert(poll.next_to_free == null); + + if (this.pending_free_tail) |tail| { + std.debug.assert(this.pending_free_head != null); + std.debug.assert(tail.next_to_free == null); + tail.next_to_free = poll; + } + + if (this.pending_free_head == null) { + this.pending_free_head = poll; + std.debug.assert(this.pending_free_tail == null); + } + + poll.flags.insert(.ignore_updates); + this.pending_free_tail = poll; + std.debug.assert(vm.after_event_loop_callback == null or vm.after_event_loop_callback == @as(?JSC.OpaqueCallback, @ptrCast(&processDeferredFrees))); + vm.after_event_loop_callback = @ptrCast(&processDeferredFrees); + vm.after_event_loop_callback_ctx = this; + } + }; +}; diff --git a/src/build-id b/src/build-id deleted file mode 100644 index c7930257dfef5..0000000000000 --- a/src/build-id +++ /dev/null @@ -1 +0,0 @@ -7 \ No newline at end of file diff --git a/src/bun.js/WebKit b/src/bun.js/WebKit index 1a49a1f94bf42..36c3bf3f22816 160000 --- a/src/bun.js/WebKit +++ b/src/bun.js/WebKit @@ -1 +1 @@ -Subproject commit 1a49a1f94bf42ab4f8c6b11d7bbbb21e491d2d62 +Subproject commit 36c3bf3f228165806be6158ca63b3cf2bc554d6b diff --git a/src/bun.js/api/JSBundler.classes.ts b/src/bun.js/api/JSBundler.classes.ts index 09412b55c02c3..664502a34bc50 100644 --- a/src/bun.js/api/JSBundler.classes.ts +++ b/src/bun.js/api/JSBundler.classes.ts @@ -1,4 +1,4 @@ -import { define } from "../scripts/class-definitions"; +import { define } from "../../codegen/class-definitions"; export default [ define({ diff --git a/src/bun.js/api/bun.classes.ts b/src/bun.js/api/bun.classes.ts index 36f48f790d3e4..32ea56b92fec2 100644 --- a/src/bun.js/api/bun.classes.ts +++ b/src/bun.js/api/bun.classes.ts @@ -1,4 +1,4 @@ -import { define } from "../scripts/class-definitions"; +import { define } from "../../codegen/class-definitions"; export default [ define({ diff --git a/src/bun.js/api/bun.zig b/src/bun.js/api/bun.zig index 4ae5c34103b47..317203c8631e3 100644 --- a/src/bun.js/api/bun.zig +++ b/src/bun.js/api/bun.zig @@ -204,7 +204,6 @@ const MarkedArrayBuffer = @import("../base.zig").MarkedArrayBuffer; const getAllocator = @import("../base.zig").getAllocator; const JSValue = @import("root").bun.JSC.JSValue; -const Microtask = @import("root").bun.JSC.Microtask; const JSGlobalObject = @import("root").bun.JSC.JSGlobalObject; const ExceptionValueRef = @import("root").bun.JSC.ExceptionValueRef; const JSPrivateDataPtr = @import("root").bun.JSC.JSPrivateDataPtr; @@ -234,6 +233,7 @@ const Which = @import("../../which.zig"); const ErrorableString = JSC.ErrorableString; const is_bindgen = JSC.is_bindgen; const max_addressible_memory = std.math.maxInt(u56); +const Async = bun.Async; threadlocal var css_imports_list_strings: [512]ZigString = undefined; threadlocal var css_imports_list: [512]Api.StringPointer = undefined; @@ -1554,12 +1554,12 @@ pub const Crypto = struct { promise: JSC.JSPromise.Strong, event_loop: *JSC.EventLoop, global: *JSC.JSGlobalObject, - ref: JSC.PollRef = .{}, + ref: Async.KeepAlive = .{}, task: JSC.WorkPoolTask = .{ .callback = &run }, pub const Result = struct { value: Value, - ref: JSC.PollRef = .{}, + ref: Async.KeepAlive = .{}, task: JSC.AnyTask = undefined, promise: JSC.JSPromise.Strong, @@ -1804,12 +1804,12 @@ pub const Crypto = struct { promise: JSC.JSPromise.Strong, event_loop: *JSC.EventLoop, global: *JSC.JSGlobalObject, - ref: JSC.PollRef = .{}, + ref: Async.KeepAlive = .{}, task: JSC.WorkPoolTask = .{ .callback = &run }, pub const Result = struct { value: Value, - ref: JSC.PollRef = .{}, + ref: Async.KeepAlive = .{}, task: JSC.AnyTask = undefined, promise: JSC.JSPromise.Strong, @@ -3335,7 +3335,8 @@ pub const Timer = struct { if (val.did_unref_timer) { val.did_unref_timer = false; - vm.event_loop_handle.?.num_polls += 1; + if (comptime Environment.isPosix) + vm.event_loop_handle.?.num_polls += 1; } } } @@ -3408,7 +3409,7 @@ pub const Timer = struct { .callback = JSC.Strong.create(callback, globalThis), .globalThis = globalThis, .timer = uws.Timer.create( - vm.event_loop_handle.?, + vm.uwsLoop(), id, ), }; @@ -3454,7 +3455,8 @@ pub const Timer = struct { if (!val.did_unref_timer) { val.did_unref_timer = true; - vm.event_loop_handle.?.num_polls -= 1; + if (comptime Environment.isPosix) + vm.event_loop_handle.?.num_polls -= 1; } } } @@ -3484,7 +3486,7 @@ pub const Timer = struct { globalThis: *JSC.JSGlobalObject, timer: *uws.Timer, did_unref_timer: bool = false, - poll_ref: JSC.PollRef = JSC.PollRef.init(), + poll_ref: Async.KeepAlive = Async.KeepAlive.init(), arguments: JSC.Strong = .{}, has_scheduled_job: bool = false, @@ -3606,8 +3608,9 @@ pub const Timer = struct { this.timer.deinit(false); - // balance double unreffing in doUnref - vm.event_loop_handle.?.num_polls += @as(i32, @intFromBool(this.did_unref_timer)); + if (comptime Environment.isPosix) + // balance double unreffing in doUnref + vm.event_loop_handle.?.num_polls += @as(i32, @intFromBool(this.did_unref_timer)); this.callback.deinit(); this.arguments.deinit(); @@ -3662,7 +3665,7 @@ pub const Timer = struct { .callback = JSC.Strong.create(callback, globalThis), .globalThis = globalThis, .timer = uws.Timer.create( - vm.event_loop_handle.?, + vm.uwsLoop(), Timeout.ID{ .id = id, .kind = kind, diff --git a/src/bun.js/api/bun/dns_resolver.zig b/src/bun.js/api/bun/dns_resolver.zig index 3c20f4df758ac..f796060f9d964 100644 --- a/src/bun.js/api/bun/dns_resolver.zig +++ b/src/bun.js/api/bun/dns_resolver.zig @@ -14,7 +14,7 @@ const JSC = @import("root").bun.JSC; const JSValue = JSC.JSValue; const JSGlobalObject = JSC.JSGlobalObject; const c_ares = bun.c_ares; - +const Async = bun.Async; const GetAddrInfoAsyncCallback = fn (i32, ?*std.c.addrinfo, ?*anyopaque) callconv(.C) void; const INET6_ADDRSTRLEN = if (bun.Environment.isWindows) 65 else 46; const IANA_DNS_PORT = 53; @@ -42,7 +42,7 @@ const LibInfo = struct { const RTLD_LAZY = 1; const RTLD_LOCAL = 4; - handle = std.c.dlopen("libinfo.dylib", RTLD_LAZY | RTLD_LOCAL); + handle = bun.C.dlopen("libinfo.dylib", RTLD_LAZY | RTLD_LOCAL); if (handle == null) Output.debug("libinfo.dylib not found", .{}); return handle; @@ -120,7 +120,7 @@ const LibInfo = struct { return promise_value; } std.debug.assert(request.backend.libinfo.machport != null); - request.backend.libinfo.file_poll = bun.JSC.FilePoll.init(this.vm, std.math.maxInt(i32) - 1, .{}, GetAddrInfoRequest, request); + request.backend.libinfo.file_poll = bun.Async.FilePoll.init(this.vm, std.math.maxInt(i32) - 1, .{}, GetAddrInfoRequest, request); std.debug.assert( request.backend.libinfo.file_poll.?.registerWithFd( this.vm.event_loop_handle.?, @@ -645,7 +645,7 @@ pub fn ResolveInfoRequest(comptime cares_type: type, comptime type_name: []const var hasher = std.hash.Wyhash.init(0); hasher.update(name); const hash = hasher.final(); - var poll_ref = JSC.PollRef.init(); + var poll_ref = Async.KeepAlive.init(); poll_ref.ref(globalThis.bunVM()); request.* = .{ .resolver_for_caching = resolver, @@ -742,7 +742,7 @@ pub const GetHostByAddrInfoRequest = struct { var hasher = std.hash.Wyhash.init(0); hasher.update(name); const hash = hasher.final(); - var poll_ref = JSC.PollRef.init(); + var poll_ref = Async.KeepAlive.init(); poll_ref.ref(globalThis.bunVM()); request.* = .{ .resolver_for_caching = resolver, @@ -818,14 +818,14 @@ pub const CAresNameInfo = struct { globalThis: *JSC.JSGlobalObject = undefined, promise: JSC.JSPromise.Strong, - poll_ref: JSC.PollRef, + poll_ref: bun.Async.KeepAlive, allocated: bool = false, next: ?*@This() = null, name: []const u8, pub fn init(globalThis: *JSC.JSGlobalObject, allocator: std.mem.Allocator, name: []const u8) !*@This() { var this = try allocator.create(@This()); - var poll_ref = JSC.PollRef.init(); + var poll_ref = bun.Async.KeepAlive.init(); poll_ref.ref(globalThis.bunVM()); this.* = .{ .globalThis = globalThis, .promise = JSC.JSPromise.Strong.init(globalThis), .poll_ref = poll_ref, .allocated = true, .name = name }; return this; @@ -906,7 +906,7 @@ pub const GetNameInfoRequest = struct { var hasher = std.hash.Wyhash.init(0); hasher.update(name); const hash = hasher.final(); - var poll_ref = JSC.PollRef.init(); + var poll_ref = bun.Async.KeepAlive.init(); poll_ref.ref(globalThis.bunVM()); request.* = .{ .resolver_for_caching = resolver, @@ -997,7 +997,7 @@ pub const GetAddrInfoRequest = struct { comptime cache_field: []const u8, ) !*GetAddrInfoRequest { var request = try globalThis.allocator().create(GetAddrInfoRequest); - var poll_ref = JSC.PollRef.init(); + var poll_ref = Async.KeepAlive.init(); poll_ref.ref(globalThis.bunVM()); request.* = .{ .backend = backend, @@ -1129,7 +1129,7 @@ pub const GetAddrInfoRequest = struct { }, pub const LibInfo = struct { - file_poll: ?*bun.JSC.FilePoll = null, + file_poll: ?*bun.Async.FilePoll = null, machport: ?*anyopaque = null, extern fn getaddrinfo_send_reply(*anyopaque, *const JSC.DNS.LibInfo.GetaddrinfoAsyncHandleReply) bool; @@ -1208,14 +1208,14 @@ pub const CAresReverse = struct { globalThis: *JSC.JSGlobalObject = undefined, promise: JSC.JSPromise.Strong, - poll_ref: JSC.PollRef, + poll_ref: Async.KeepAlive, allocated: bool = false, next: ?*@This() = null, name: []const u8, pub fn init(globalThis: *JSC.JSGlobalObject, allocator: std.mem.Allocator, name: []const u8) !*@This() { var this = try allocator.create(@This()); - var poll_ref = JSC.PollRef.init(); + var poll_ref = Async.KeepAlive.init(); poll_ref.ref(globalThis.bunVM()); this.* = .{ .globalThis = globalThis, .promise = JSC.JSPromise.Strong.init(globalThis), .poll_ref = poll_ref, .allocated = true, .name = name }; return this; @@ -1279,14 +1279,14 @@ pub fn CAresLookup(comptime cares_type: type, comptime type_name: []const u8) ty globalThis: *JSC.JSGlobalObject = undefined, promise: JSC.JSPromise.Strong, - poll_ref: JSC.PollRef, + poll_ref: Async.KeepAlive, allocated: bool = false, next: ?*@This() = null, name: []const u8, pub fn init(globalThis: *JSC.JSGlobalObject, allocator: std.mem.Allocator, name: []const u8) !*@This() { var this = try allocator.create(@This()); - var poll_ref = JSC.PollRef.init(); + var poll_ref = Async.KeepAlive.init(); poll_ref.ref(globalThis.bunVM()); this.* = .{ .globalThis = globalThis, .promise = JSC.JSPromise.Strong.init(globalThis), .poll_ref = poll_ref, .allocated = true, .name = name }; return this; @@ -1352,11 +1352,11 @@ pub const DNSLookup = struct { promise: JSC.JSPromise.Strong, allocated: bool = false, next: ?*DNSLookup = null, - poll_ref: JSC.PollRef, + poll_ref: Async.KeepAlive, pub fn init(globalThis: *JSC.JSGlobalObject, allocator: std.mem.Allocator) !*DNSLookup { var this = try allocator.create(DNSLookup); - var poll_ref = JSC.PollRef.init(); + var poll_ref = Async.KeepAlive.init(); poll_ref.ref(globalThis.bunVM()); this.* = .{ @@ -1463,7 +1463,7 @@ pub const GlobalData = struct { global.* = .{ .resolver = .{ .vm = vm, - .polls = std.AutoArrayHashMap(i32, ?*JSC.FilePoll).init(allocator), + .polls = std.AutoArrayHashMap(i32, ?*Async.FilePoll).init(allocator), }, }; @@ -1476,7 +1476,7 @@ pub const DNSResolver = struct { channel: ?*c_ares.Channel = null, vm: *JSC.VirtualMachine, - polls: std.AutoArrayHashMap(i32, ?*JSC.FilePoll) = undefined, + polls: std.AutoArrayHashMap(i32, ?*Async.FilePoll) = undefined, pending_host_cache_cares: PendingCache = PendingCache.init(), pending_host_cache_native: PendingCache = PendingCache.init(), @@ -1818,7 +1818,7 @@ pub const DNSResolver = struct { pub fn onDNSPoll( this: *DNSResolver, - poll: *JSC.FilePoll, + poll: *Async.FilePoll, ) void { var vm = this.vm; defer vm.drainMicrotasks(); @@ -1842,6 +1842,11 @@ pub const DNSResolver = struct { readable: bool, writable: bool, ) void { + if (comptime Environment.isWindows) { + bun.todo(@src(), {}); + return; + } + var vm = this.vm; if (!readable and !writable) { @@ -1860,7 +1865,7 @@ pub const DNSResolver = struct { var poll_entry = this.polls.getOrPut(fd) catch unreachable; if (!poll_entry.found_existing) { - poll_entry.value_ptr.* = JSC.FilePoll.init(vm, bun.toFD(fd), .{}, DNSResolver, this); + poll_entry.value_ptr.* = Async.FilePoll.init(vm, bun.toFD(fd), .{}, DNSResolver, this); } var poll = poll_entry.value_ptr.*.?; @@ -2020,8 +2025,8 @@ pub const DNSResolver = struct { return .zero; } - const ip = ip_str.toSliceClone(globalThis, bun.default_allocator).slice(); - + const ip_slice = ip_str.toSliceClone(globalThis, bun.default_allocator); + const ip = ip_slice.slice(); var vm = globalThis.bunVM(); var resolver = vm.rareData().globalDNSResolver(vm); var channel: *c_ares.Channel = switch (resolver.getChannel()) { @@ -2032,7 +2037,7 @@ pub const DNSResolver = struct { .code = bun.String.static(err.code()), .message = bun.String.static(err.label()), }; - + defer ip_slice.deinit(); globalThis.throwValue(system_error.toErrorInstance(globalThis)); return .zero; }, diff --git a/src/bun.js/api/bun/socket.zig b/src/bun.js/api/bun/socket.zig index 24e5db5c6691f..e1377aa1827d1 100644 --- a/src/bun.js/api/bun/socket.zig +++ b/src/bun.js/api/bun/socket.zig @@ -17,6 +17,7 @@ const uws = @import("root").bun.uws; const ZigString = JSC.ZigString; const BoringSSL = bun.BoringSSL; const X509 = @import("./x509.zig"); +const Async = bun.Async; fn normalizeListeningHost(host: [:0]const u8) ?[*:0]const u8 { if (host.len == 0 or strings.eqlComptime(host, "0.0.0.0")) { @@ -447,7 +448,7 @@ pub const Listener = struct { handlers: Handlers, listener: ?*uws.ListenSocket = null, - poll_ref: JSC.PollRef = JSC.PollRef.init(), + poll_ref: Async.KeepAlive = Async.KeepAlive.init(), connection: UnixOrHost, socket_context: ?*uws.SocketContext = null, ssl: bool = false, @@ -582,7 +583,7 @@ pub const Listener = struct { var socket_context = uws.us_create_bun_socket_context( @intFromBool(ssl_enabled), - uws.Loop.get().?, + uws.Loop.get(), @sizeOf(usize), ctx_opts, ) orelse { @@ -919,7 +920,7 @@ pub const Listener = struct { globalObject.bunVM().eventLoop().ensureWaker(); - var socket_context = uws.us_create_bun_socket_context(@intFromBool(ssl_enabled), uws.Loop.get().?, @sizeOf(usize), ctx_opts).?; + var socket_context = uws.us_create_bun_socket_context(@intFromBool(ssl_enabled), uws.Loop.get(), @sizeOf(usize), ctx_opts).?; var connection: Listener.UnixOrHost = if (port) |port_| .{ .host = .{ .host = (hostname_or_unix.cloneIfNeeded(bun.default_allocator) catch unreachable).slice(), .port = port_ }, } else .{ @@ -1087,7 +1088,7 @@ fn NewSocket(comptime ssl: bool) type { wrapped: WrappedType = .none, handlers: *Handlers, this_value: JSC.JSValue = .zero, - poll_ref: JSC.PollRef = JSC.PollRef.init(), + poll_ref: Async.KeepAlive = Async.KeepAlive.init(), reffer: JSC.Ref = JSC.Ref.init(), last_4: [4]u8 = .{ 0, 0, 0, 0 }, authorized: bool = false, diff --git a/src/bun.js/api/bun/subprocess.zig b/src/bun.js/api/bun/subprocess.zig index c62570e9267fd..865ff3428750c 100644 --- a/src/bun.js/api/bun/subprocess.zig +++ b/src/bun.js/api/bun/subprocess.zig @@ -13,8 +13,9 @@ const JSC = @import("root").bun.JSC; const JSValue = JSC.JSValue; const JSGlobalObject = JSC.JSGlobalObject; const Which = @import("../../../which.zig"); -const uws = @import("../../../deps/uws.zig"); +const Async = bun.Async; const IPC = @import("../../ipc.zig"); +const uws = bun.uws; const PosixSpawn = @import("./spawn.zig").PosixSpawn; @@ -68,13 +69,13 @@ pub const Subprocess = struct { pub const SignalCode = bun.SignalCode; pub const Poll = union(enum) { - poll_ref: ?*JSC.FilePoll, + poll_ref: ?*Async.FilePoll, wait_thread: WaitThreadPoll, }; pub const WaitThreadPoll = struct { ref_count: std.atomic.Atomic(u32) = std.atomic.Atomic(u32).init(0), - poll_ref: JSC.PollRef = .{}, + poll_ref: Async.KeepAlive = .{}, }; pub const IPCMode = enum { @@ -524,7 +525,7 @@ pub const Subprocess = struct { pub const BufferedInput = struct { remain: []const u8 = "", fd: bun.FileDescriptor = bun.invalid_fd, - poll_ref: ?*JSC.FilePoll = null, + poll_ref: ?*Async.FilePoll = null, written: usize = 0, source: union(enum) { @@ -1574,7 +1575,7 @@ pub const Subprocess = struct { subprocess.* = Subprocess{ .globalThis = globalThis, .pid = pid, - .pidfd = @truncate(pidfd), + .pidfd = if (WaiterThread.shouldUseWaiterThread()) @truncate(bun.invalid_fd) else @truncate(pidfd), .stdin = Writable.init(stdio[bun.STDIN_FD], stdin_pipe[1], globalThis) catch { globalThis.throw("out of memory", .{}); return .zero; @@ -1612,7 +1613,7 @@ pub const Subprocess = struct { if (comptime !is_sync) { if (!WaiterThread.shouldUseWaiterThread()) { - var poll = JSC.FilePoll.init(jsc_vm, watchfd, .{}, Subprocess, subprocess); + var poll = Async.FilePoll.init(jsc_vm, watchfd, .{}, Subprocess, subprocess); subprocess.poll = .{ .poll_ref = poll }; subprocess.flags.reference_count += 1; switch (subprocess.poll.poll_ref.?.register( @@ -1679,7 +1680,7 @@ pub const Subprocess = struct { subprocess.closeIO(.stdin); if (!WaiterThread.shouldUseWaiterThread()) { - var poll = JSC.FilePoll.init(jsc_vm, watchfd, .{}, Subprocess, subprocess); + var poll = Async.FilePoll.init(jsc_vm, watchfd, .{}, Subprocess, subprocess); subprocess.poll = .{ .poll_ref = poll }; subprocess.flags.reference_count += 1; switch (subprocess.poll.poll_ref.?.register( @@ -1781,6 +1782,9 @@ pub const Subprocess = struct { } pub fn onWaitPid(this: *Subprocess, sync: bool, this_jsvalue: JSC.JSValue, waitpid_result_: JSC.Maybe(PosixSpawn.WaitPidResult)) void { + if(Environment.isWindows) { + @panic("windows doesnt support subprocess yet. haha"); + } defer if (sync) this.updateHasPendingActivity(); const pid = this.pid; @@ -2180,6 +2184,8 @@ pub const Subprocess = struct { concurrent_queue: Queue = .{}, queue: std.ArrayList(*Subprocess) = std.ArrayList(*Subprocess).init(bun.default_allocator), started: std.atomic.Atomic(u32) = std.atomic.Atomic(u32).init(0), + signalfd: if (Environment.isLinux) bun.FileDescriptor else u0 = undefined, + eventfd: if (Environment.isLinux) bun.FileDescriptor else u0 = undefined, pub fn setShouldUseWaiterThread() void { @atomicStore(bool, &should_use_waiter_thread, true, .Monotonic); @@ -2207,6 +2213,14 @@ pub const Subprocess = struct { var thread = try std.Thread.spawn(.{ .stack_size = 512 * 1024 }, loop, .{}); thread.detach(); + + if (comptime Environment.isLinux) { + const linux = std.os.linux; + var mask = std.os.empty_sigset; + linux.sigaddset(&mask, std.os.SIG.CHLD); + instance.signalfd = try std.os.signalfd(-1, &mask, linux.SFD.CLOEXEC | linux.SFD.NONBLOCK); + instance.eventfd = try std.os.eventfd(0, linux.EFD.NONBLOCK | linux.EFD.CLOEXEC | 0); + } } pub const WaitPidResultTask = struct { @@ -2244,6 +2258,11 @@ pub const Subprocess = struct { process.updateHasPendingActivity(); init() catch @panic("Failed to start WaiterThread"); + + if (comptime Environment.isLinux) { + const one = @as([8]u8, @bitCast(@as(usize, 1))); + _ = std.os.write(instance.eventfd, &one) catch @panic("Failed to write to eventfd"); + } } pub fn loop() void { @@ -2296,10 +2315,31 @@ pub const Subprocess = struct { i += 1; } - var mask = std.os.empty_sigset; - var signal: c_int = std.os.SIG.CHLD; - var rc = std.c.sigwait(&mask, &signal); - _ = rc; + if (comptime Environment.isLinux) { + var polls = [_]std.os.pollfd{ + .{ + .fd = @intCast(this.signalfd), + .events = std.os.POLL.IN | std.os.POLL.ERR, + .revents = 0, + }, + .{ + .fd = @intCast(this.eventfd), + .events = std.os.POLL.IN | std.os.POLL.ERR, + .revents = 0, + }, + }; + + _ = std.os.poll(&polls, std.math.maxInt(i32)) catch 0; + + // Make sure we consume any pending signals + var buf: [1024]u8 = undefined; + _ = std.os.read(this.signalfd, &buf) catch 0; + } else { + var mask = std.os.empty_sigset; + var signal: c_int = std.os.SIG.CHLD; + var rc = std.c.sigwait(&mask, &signal); + _ = rc; + } } } }; diff --git a/src/bun.js/api/crypto.classes.ts b/src/bun.js/api/crypto.classes.ts index 471e87702c4c0..8262b5751d362 100644 --- a/src/bun.js/api/crypto.classes.ts +++ b/src/bun.js/api/crypto.classes.ts @@ -1,4 +1,4 @@ -import { define } from "../scripts/class-definitions"; +import { define } from "../../codegen/class-definitions"; const names = ["SHA1", "MD5", "MD4", "SHA224", "SHA512", "SHA384", "SHA256", "SHA512_256"]; const named = names.map(name => { diff --git a/src/bun.js/api/ffi.classes.ts b/src/bun.js/api/ffi.classes.ts index 0a146b22e6bf5..a0708ac854052 100644 --- a/src/bun.js/api/ffi.classes.ts +++ b/src/bun.js/api/ffi.classes.ts @@ -1,4 +1,4 @@ -import { define } from "../scripts/class-definitions"; +import { define } from "../../codegen/class-definitions"; export default [ define({ diff --git a/src/bun.js/api/ffi.zig b/src/bun.js/api/ffi.zig index a7a03e7840054..02e0a78768d4c 100644 --- a/src/bun.js/api/ffi.zig +++ b/src/bun.js/api/ffi.zig @@ -50,7 +50,6 @@ const MarkedArrayBuffer = @import("../base.zig").MarkedArrayBuffer; const getAllocator = @import("../base.zig").getAllocator; const JSValue = @import("root").bun.JSC.JSValue; -const Microtask = @import("root").bun.JSC.Microtask; const JSGlobalObject = @import("root").bun.JSC.JSGlobalObject; const ExceptionValueRef = @import("root").bun.JSC.ExceptionValueRef; const JSPrivateDataPtr = @import("root").bun.JSC.JSPrivateDataPtr; @@ -672,7 +671,9 @@ pub const FFI = struct { val.arg_types.clearAndFree(allocator); if (val.state) |state| { - TCC.tcc_delete(state); + if (comptime !Environment.isWindows) { + TCC.tcc_delete(state); + } val.state = null; } @@ -772,6 +773,9 @@ pub const FFI = struct { this: *Function, allocator: std.mem.Allocator, ) !void { + if (comptime Environment.isWindows) { + return; + } var source_code = std.ArrayList(u8).init(allocator); var source_code_writer = source_code.writer(); try this.printSourceCode(&source_code_writer); @@ -786,7 +790,9 @@ pub const FFI = struct { this.state = state; defer { if (this.step == .failed) { - TCC.tcc_delete(state); + if (comptime !Environment.isWindows) { + TCC.tcc_delete(state); + } this.state = null; } } @@ -895,6 +901,9 @@ pub const FFI = struct { } pub fn inject(state: *TCC.TCCState) void { + if (comptime Environment.isWindows) { + return; + } JSC.markBinding(@src()); _ = TCC.tcc_add_symbol(state, "memset", &memset); _ = TCC.tcc_add_symbol(state, "memcpy", &memcpy); @@ -935,6 +944,9 @@ pub const FFI = struct { js_function: JSValue, is_threadsafe: bool, ) !void { + if (comptime Environment.isWindows) { + return; + } JSC.markBinding(@src()); var source_code = std.ArrayList(u8).init(allocator); var source_code_writer = source_code.writer(); @@ -958,7 +970,9 @@ pub const FFI = struct { this.state = state; defer { if (this.step == .failed) { - TCC.tcc_delete(state); + if (comptime !Environment.isWindows) { + TCC.tcc_delete(state); + } this.state = null; } } diff --git a/src/bun.js/api/filesystem_router.classes.ts b/src/bun.js/api/filesystem_router.classes.ts index 9af94047cb878..4c331f7de9a72 100644 --- a/src/bun.js/api/filesystem_router.classes.ts +++ b/src/bun.js/api/filesystem_router.classes.ts @@ -1,4 +1,4 @@ -import { define } from "../scripts/class-definitions"; +import { define } from "../../codegen/class-definitions"; export default [ define({ diff --git a/src/bun.js/api/html_rewriter.classes.ts b/src/bun.js/api/html_rewriter.classes.ts index f904f6f29bc73..a00c20b7e194b 100644 --- a/src/bun.js/api/html_rewriter.classes.ts +++ b/src/bun.js/api/html_rewriter.classes.ts @@ -1,4 +1,4 @@ -import { define } from "../scripts/class-definitions"; +import { define } from "../../codegen/class-definitions"; export default [ define({ diff --git a/src/bun.js/api/server.classes.ts b/src/bun.js/api/server.classes.ts index 81ec3098842a6..236e5188c20fa 100644 --- a/src/bun.js/api/server.classes.ts +++ b/src/bun.js/api/server.classes.ts @@ -1,4 +1,4 @@ -import { define } from "../scripts/class-definitions"; +import { define } from "../../codegen/class-definitions"; function generate(name) { return define({ diff --git a/src/bun.js/api/server.zig b/src/bun.js/api/server.zig index edf1d6d697a55..4992c2a6ee959 100644 --- a/src/bun.js/api/server.zig +++ b/src/bun.js/api/server.zig @@ -49,7 +49,6 @@ const MarkedArrayBuffer = @import("../base.zig").MarkedArrayBuffer; const getAllocator = @import("../base.zig").getAllocator; const JSValue = @import("root").bun.JSC.JSValue; -const Microtask = @import("root").bun.JSC.Microtask; const JSGlobalObject = @import("root").bun.JSC.JSGlobalObject; const ExceptionValueRef = @import("root").bun.JSC.ExceptionValueRef; const JSPrivateDataPtr = @import("root").bun.JSC.JSPrivateDataPtr; @@ -90,6 +89,7 @@ const SendfileContext = struct { }; const DateTime = bun.DateTime; const linux = std.os.linux; +const Async = bun.Async; const BlobFileContentResult = struct { data: [:0]const u8, @@ -4830,7 +4830,7 @@ pub fn NewServer(comptime NamespaceType: type, comptime ssl_enabled_: bool, comp listen_callback: JSC.AnyTask = undefined, allocator: std.mem.Allocator, - poll_ref: JSC.PollRef = .{}, + poll_ref: Async.KeepAlive = .{}, temporary_url_buffer: std.ArrayListUnmanaged(u8) = .{}, cached_hostname: bun.String = bun.String.empty, @@ -5580,7 +5580,7 @@ pub fn NewServer(comptime NamespaceType: type, comptime ssl_enabled_: bool, comp } this.listener = socket; - this.vm.event_loop_handle = uws.Loop.get(); + this.vm.event_loop_handle = Async.Loop.get(); if (!ssl_enabled_) this.vm.addListeningSocketForWatchMode(@intCast(socket.?.socket().fd())); } diff --git a/src/bun.js/api/sockets.classes.ts b/src/bun.js/api/sockets.classes.ts index 2a17ca39d095a..c99abf6552d13 100644 --- a/src/bun.js/api/sockets.classes.ts +++ b/src/bun.js/api/sockets.classes.ts @@ -1,4 +1,4 @@ -import { define } from "../scripts/class-definitions"; +import { define } from "../../codegen/class-definitions"; function generate(ssl) { return define({ diff --git a/src/bun.js/base.zig b/src/bun.js/base.zig index 241b13108f2d9..c125a856c577f 100644 --- a/src/bun.js/base.zig +++ b/src/bun.js/base.zig @@ -1591,848 +1591,6 @@ pub const Ref = struct { } }; -/// Track if an object whose file descriptor is being watched should keep the event loop alive. -/// This is not reference counted. It only tracks active or inactive. -pub const PollRef = struct { - status: Status = .inactive, - - const log = Output.scoped(.PollRef, false); - - const Status = enum { active, inactive, done }; - - pub inline fn isActive(this: PollRef) bool { - return this.status == .active; - } - - /// Make calling ref() on this poll into a no-op. - pub fn disable(this: *PollRef) void { - this.unref(JSC.VirtualMachine.get()); - this.status = .done; - } - - /// Only intended to be used from EventLoop.Pollable - pub fn deactivate(this: *PollRef, loop: *uws.Loop) void { - if (this.status != .active) - return; - - this.status = .inactive; - loop.num_polls -= 1; - loop.active -|= 1; - } - - /// Only intended to be used from EventLoop.Pollable - pub fn activate(this: *PollRef, loop: *uws.Loop) void { - if (this.status != .inactive) - return; - - this.status = .active; - loop.num_polls += 1; - loop.active += 1; - } - - pub fn init() PollRef { - return .{}; - } - - /// Prevent a poll from keeping the process alive. - pub fn unref(this: *PollRef, vm: *JSC.VirtualMachine) void { - if (this.status != .active) - return; - this.status = .inactive; - vm.event_loop_handle.?.unref(); - } - - /// From another thread, Prevent a poll from keeping the process alive. - pub fn unrefConcurrently(this: *PollRef, vm: *JSC.VirtualMachine) void { - if (this.status != .active) - return; - this.status = .inactive; - vm.event_loop_handle.?.unrefConcurrently(); - } - - /// Prevent a poll from keeping the process alive on the next tick. - pub fn unrefOnNextTick(this: *PollRef, vm: *JSC.VirtualMachine) void { - if (this.status != .active) - return; - this.status = .inactive; - vm.pending_unref_counter +|= 1; - } - - /// From another thread, prevent a poll from keeping the process alive on the next tick. - pub fn unrefOnNextTickConcurrently(this: *PollRef, vm: *JSC.VirtualMachine) void { - if (this.status != .active) - return; - this.status = .inactive; - _ = @atomicRmw(@TypeOf(vm.pending_unref_counter), &vm.pending_unref_counter, .Add, 1, .Monotonic); - } - - /// Allow a poll to keep the process alive. - pub fn ref(this: *PollRef, vm: *JSC.VirtualMachine) void { - if (this.status != .inactive) - return; - this.status = .active; - vm.event_loop_handle.?.ref(); - } - - /// Allow a poll to keep the process alive. - pub fn refConcurrently(this: *PollRef, vm: *JSC.VirtualMachine) void { - if (this.status != .inactive) - return; - this.status = .active; - vm.event_loop_handle.?.refConcurrently(); - } - - pub fn refConcurrentlyFromEventLoop(this: *PollRef, loop: *JSC.EventLoop) void { - this.refConcurrently(loop.virtual_machine); - } - - pub fn unrefConcurrentlyFromEventLoop(this: *PollRef, loop: *JSC.EventLoop) void { - this.unrefConcurrently(loop.virtual_machine); - } -}; - -const KQueueGenerationNumber = if (Environment.isMac and Environment.allow_assert) usize else u0; -pub const FilePoll = struct { - var max_generation_number: KQueueGenerationNumber = 0; - - fd: bun.UFileDescriptor = invalid_fd, - flags: Flags.Set = Flags.Set{}, - owner: Owner = undefined, - - /// We re-use FilePoll objects to avoid allocating new ones. - /// - /// That means we might run into situations where the event is stale. - /// on macOS kevent64 has an extra pointer field so we use it for that - /// linux doesn't have a field like that - generation_number: KQueueGenerationNumber = 0, - next_to_free: ?*FilePoll = null, - - const FileReader = JSC.WebCore.FileReader; - const FileSink = JSC.WebCore.FileSink; - const FIFO = JSC.WebCore.FIFO; - const Subprocess = JSC.Subprocess; - const BufferedInput = Subprocess.BufferedInput; - const BufferedOutput = Subprocess.BufferedOutput; - const DNSResolver = JSC.DNS.DNSResolver; - const GetAddrInfoRequest = JSC.DNS.GetAddrInfoRequest; - const Deactivated = opaque { - pub var owner: Owner = Owner.init(@as(*Deactivated, @ptrFromInt(@as(usize, 0xDEADBEEF)))); - }; - - pub const Owner = bun.TaggedPointerUnion(.{ - FileReader, - FileSink, - Subprocess, - BufferedInput, - FIFO, - Deactivated, - DNSResolver, - GetAddrInfoRequest, - }); - - fn updateFlags(poll: *FilePoll, updated: Flags.Set) void { - var flags = poll.flags; - flags.remove(.readable); - flags.remove(.writable); - flags.remove(.process); - flags.remove(.machport); - flags.remove(.eof); - flags.remove(.hup); - - flags.setUnion(updated); - poll.flags = flags; - } - - pub fn onKQueueEvent(poll: *FilePoll, loop: *uws.Loop, kqueue_event: *const std.os.system.kevent64_s) void { - if (KQueueGenerationNumber != u0) - std.debug.assert(poll.generation_number == kqueue_event.ext[0]); - - poll.updateFlags(Flags.fromKQueueEvent(kqueue_event.*)); - poll.onUpdate(loop, kqueue_event.data); - } - - pub fn onEpollEvent(poll: *FilePoll, loop: *uws.Loop, epoll_event: *std.os.linux.epoll_event) void { - poll.updateFlags(Flags.fromEpollEvent(epoll_event.*)); - poll.onUpdate(loop, 0); - } - - pub fn clearEvent(poll: *FilePoll, flag: Flags) void { - poll.flags.remove(flag); - } - - pub fn isReadable(this: *FilePoll) bool { - const readable = this.flags.contains(.readable); - this.flags.remove(.readable); - return readable; - } - - pub fn isHUP(this: *FilePoll) bool { - const readable = this.flags.contains(.hup); - this.flags.remove(.hup); - return readable; - } - - pub fn isEOF(this: *FilePoll) bool { - const readable = this.flags.contains(.eof); - this.flags.remove(.eof); - return readable; - } - - pub fn isWritable(this: *FilePoll) bool { - const readable = this.flags.contains(.writable); - this.flags.remove(.writable); - return readable; - } - - pub fn deinit(this: *FilePoll) void { - var vm = JSC.VirtualMachine.get(); - var loop = vm.event_loop_handle.?; - this.deinitPossiblyDefer(vm, loop, vm.rareData().filePolls(vm), false); - } - - pub fn deinitForceUnregister(this: *FilePoll) void { - var vm = JSC.VirtualMachine.get(); - var loop = vm.event_loop_handle.?; - this.deinitPossiblyDefer(vm, loop, vm.rareData().filePolls(vm), true); - } - - fn deinitPossiblyDefer(this: *FilePoll, vm: *JSC.VirtualMachine, loop: *uws.Loop, polls: *JSC.FilePoll.Store, force_unregister: bool) void { - if (this.isRegistered()) { - _ = this.unregister(loop, force_unregister); - } - - this.owner = Deactivated.owner; - const was_ever_registered = this.flags.contains(.was_ever_registered); - this.flags = Flags.Set{}; - this.fd = invalid_fd; - polls.put(this, vm, was_ever_registered); - } - - pub fn deinitWithVM(this: *FilePoll, vm: *JSC.VirtualMachine) void { - var loop = vm.event_loop_handle.?; - this.deinitPossiblyDefer(vm, loop, vm.rareData().filePolls(vm), false); - } - - pub fn isRegistered(this: *const FilePoll) bool { - return this.flags.contains(.poll_writable) or this.flags.contains(.poll_readable) or this.flags.contains(.poll_process) or this.flags.contains(.poll_machport); - } - - const kqueue_or_epoll = if (Environment.isMac) "kevent" else "epoll"; - - pub fn onUpdate(poll: *FilePoll, loop: *uws.Loop, size_or_offset: i64) void { - if (poll.flags.contains(.one_shot) and !poll.flags.contains(.needs_rearm)) { - if (poll.flags.contains(.has_incremented_poll_count)) poll.deactivate(loop); - poll.flags.insert(.needs_rearm); - } - var ptr = poll.owner; - switch (ptr.tag()) { - @field(Owner.Tag, "FIFO") => { - log("onUpdate " ++ kqueue_or_epoll ++ " (fd: {d}) FIFO", .{poll.fd}); - ptr.as(FIFO).ready(size_or_offset, poll.flags.contains(.hup)); - }, - @field(Owner.Tag, "Subprocess") => { - log("onUpdate " ++ kqueue_or_epoll ++ " (fd: {d}) Subprocess", .{poll.fd}); - var loader = ptr.as(JSC.Subprocess); - - loader.onExitNotificationTask(); - }, - @field(Owner.Tag, "FileSink") => { - log("onUpdate " ++ kqueue_or_epoll ++ " (fd: {d}) FileSink", .{poll.fd}); - var loader = ptr.as(JSC.WebCore.FileSink); - loader.onPoll(size_or_offset, 0); - }, - - @field(Owner.Tag, "DNSResolver") => { - log("onUpdate " ++ kqueue_or_epoll ++ " (fd: {d}) DNSResolver", .{poll.fd}); - var loader: *DNSResolver = ptr.as(DNSResolver); - loader.onDNSPoll(poll); - }, - - @field(Owner.Tag, "GetAddrInfoRequest") => { - log("onUpdate " ++ kqueue_or_epoll ++ " (fd: {d}) GetAddrInfoRequest", .{poll.fd}); - var loader: *GetAddrInfoRequest = ptr.as(GetAddrInfoRequest); - loader.onMachportChange(); - }, - - else => { - log("onUpdate " ++ kqueue_or_epoll ++ " (fd: {d}) disconnected?", .{poll.fd}); - }, - } - } - - pub const Flags = enum { - // What are we asking the event loop about? - - /// Poll for readable events - poll_readable, - - /// Poll for writable events - poll_writable, - - /// Poll for process-related events - poll_process, - - /// Poll for machport events - poll_machport, - - // What did the event loop tell us? - readable, - writable, - process, - eof, - hup, - machport, - - // What is the type of file descriptor? - fifo, - tty, - - one_shot, - needs_rearm, - - has_incremented_poll_count, - - disable, - - nonblocking, - - was_ever_registered, - ignore_updates, - - pub fn poll(this: Flags) Flags { - return switch (this) { - .readable => .poll_readable, - .writable => .poll_writable, - .process => .poll_process, - .machport => .poll_machport, - else => this, - }; - } - - pub const Set = std.EnumSet(Flags); - pub const Struct = std.enums.EnumFieldStruct(Flags, bool, false); - - pub fn fromKQueueEvent(kqueue_event: std.os.system.kevent64_s) Flags.Set { - var flags = Flags.Set{}; - if (kqueue_event.filter == std.os.system.EVFILT_READ) { - flags.insert(Flags.readable); - log("readable", .{}); - if (kqueue_event.flags & std.os.system.EV_EOF != 0) { - flags.insert(Flags.hup); - log("hup", .{}); - } - } else if (kqueue_event.filter == std.os.system.EVFILT_WRITE) { - flags.insert(Flags.writable); - log("writable", .{}); - if (kqueue_event.flags & std.os.system.EV_EOF != 0) { - flags.insert(Flags.hup); - log("hup", .{}); - } - } else if (kqueue_event.filter == std.os.system.EVFILT_PROC) { - log("proc", .{}); - flags.insert(Flags.process); - } else if (kqueue_event.filter == std.os.system.EVFILT_MACHPORT) { - log("machport", .{}); - flags.insert(Flags.machport); - } - return flags; - } - - pub fn fromEpollEvent(epoll: std.os.linux.epoll_event) Flags.Set { - var flags = Flags.Set{}; - if (epoll.events & std.os.linux.EPOLL.IN != 0) { - flags.insert(Flags.readable); - log("readable", .{}); - } - if (epoll.events & std.os.linux.EPOLL.OUT != 0) { - flags.insert(Flags.writable); - log("writable", .{}); - } - if (epoll.events & std.os.linux.EPOLL.ERR != 0) { - flags.insert(Flags.eof); - log("eof", .{}); - } - if (epoll.events & std.os.linux.EPOLL.HUP != 0) { - flags.insert(Flags.hup); - log("hup", .{}); - } - return flags; - } - }; - - const HiveArray = bun.HiveArray(FilePoll, 128).Fallback; - - // We defer freeing FilePoll until the end of the next event loop iteration - // This ensures that we don't free a FilePoll before the next callback is called - pub const Store = struct { - hive: HiveArray, - pending_free_head: ?*FilePoll = null, - pending_free_tail: ?*FilePoll = null, - - const log = Output.scoped(.FilePoll, false); - - pub fn init(allocator: std.mem.Allocator) Store { - return .{ - .hive = HiveArray.init(allocator), - }; - } - - pub fn get(this: *Store) *FilePoll { - return this.hive.get(); - } - - pub fn processDeferredFrees(this: *Store) void { - var next = this.pending_free_head; - while (next) |current| { - next = current.next_to_free; - current.next_to_free = null; - this.hive.put(current); - } - this.pending_free_head = null; - this.pending_free_tail = null; - } - - pub fn put(this: *Store, poll: *FilePoll, vm: *JSC.VirtualMachine, ever_registered: bool) void { - if (!ever_registered) { - this.hive.put(poll); - return; - } - - std.debug.assert(poll.next_to_free == null); - - if (this.pending_free_tail) |tail| { - std.debug.assert(this.pending_free_head != null); - std.debug.assert(tail.next_to_free == null); - tail.next_to_free = poll; - } - - if (this.pending_free_head == null) { - this.pending_free_head = poll; - std.debug.assert(this.pending_free_tail == null); - } - - poll.flags.insert(.ignore_updates); - this.pending_free_tail = poll; - std.debug.assert(vm.after_event_loop_callback == null or vm.after_event_loop_callback == @as(?JSC.OpaqueCallback, @ptrCast(&processDeferredFrees))); - vm.after_event_loop_callback = @ptrCast(&processDeferredFrees); - vm.after_event_loop_callback_ctx = this; - } - }; - - const log = Output.scoped(.FilePoll, false); - - pub inline fn isActive(this: *const FilePoll) bool { - return this.flags.contains(.has_incremented_poll_count); - } - - pub inline fn isWatching(this: *const FilePoll) bool { - return !this.flags.contains(.needs_rearm) and (this.flags.contains(.poll_readable) or this.flags.contains(.poll_writable) or this.flags.contains(.poll_process)); - } - - pub inline fn isKeepingProcessAlive(this: *const FilePoll) bool { - return !this.flags.contains(.disable) and this.isActive(); - } - - /// Make calling ref() on this poll into a no-op. - pub fn disableKeepingProcessAlive(this: *FilePoll, vm: *JSC.VirtualMachine) void { - if (this.flags.contains(.disable)) - return; - this.flags.insert(.disable); - - vm.event_loop_handle.?.active -= @as(u32, @intFromBool(this.flags.contains(.has_incremented_poll_count))); - } - - pub fn enableKeepingProcessAlive(this: *FilePoll, vm: *JSC.VirtualMachine) void { - if (!this.flags.contains(.disable)) - return; - this.flags.remove(.disable); - - vm.event_loop_handle.?.active += @as(u32, @intFromBool(this.flags.contains(.has_incremented_poll_count))); - } - - pub fn canActivate(this: *const FilePoll) bool { - return !this.flags.contains(.has_incremented_poll_count); - } - - /// Only intended to be used from EventLoop.Pollable - pub fn deactivate(this: *FilePoll, loop: *uws.Loop) void { - std.debug.assert(this.flags.contains(.has_incremented_poll_count)); - loop.num_polls -= @as(i32, @intFromBool(this.flags.contains(.has_incremented_poll_count))); - loop.active -|= @as(u32, @intFromBool(!this.flags.contains(.disable) and this.flags.contains(.has_incremented_poll_count))); - - this.flags.remove(.has_incremented_poll_count); - } - - /// Only intended to be used from EventLoop.Pollable - pub fn activate(this: *FilePoll, loop: *uws.Loop) void { - loop.num_polls += @as(i32, @intFromBool(!this.flags.contains(.has_incremented_poll_count))); - loop.active += @as(u32, @intFromBool(!this.flags.contains(.disable) and !this.flags.contains(.has_incremented_poll_count))); - this.flags.insert(.has_incremented_poll_count); - } - - pub fn init(vm: *JSC.VirtualMachine, fd: bun.FileDescriptor, flags: Flags.Struct, comptime Type: type, owner: *Type) *FilePoll { - return initWithOwner(vm, fd, flags, Owner.init(owner)); - } - - pub fn initWithOwner(vm: *JSC.VirtualMachine, fd: bun.FileDescriptor, flags: Flags.Struct, owner: Owner) *FilePoll { - var poll = vm.rareData().filePolls(vm).get(); - poll.fd = @intCast(fd); - poll.flags = Flags.Set.init(flags); - poll.owner = owner; - poll.next_to_free = null; - - if (KQueueGenerationNumber != u0) { - max_generation_number +%= 1; - poll.generation_number = max_generation_number; - } - return poll; - } - - pub inline fn canRef(this: *const FilePoll) bool { - if (this.flags.contains(.disable)) - return false; - - return !this.flags.contains(.has_incremented_poll_count); - } - - pub inline fn canUnref(this: *const FilePoll) bool { - return this.flags.contains(.has_incremented_poll_count); - } - - /// Prevent a poll from keeping the process alive. - pub fn unref(this: *FilePoll, vm: *JSC.VirtualMachine) void { - if (!this.canUnref()) - return; - log("unref", .{}); - this.deactivate(vm.event_loop_handle.?); - } - - /// Allow a poll to keep the process alive. - pub fn ref(this: *FilePoll, vm: *JSC.VirtualMachine) void { - if (this.canRef()) - return; - log("ref", .{}); - this.activate(vm.event_loop_handle.?); - } - - pub fn onTick(loop: *uws.Loop, tagged_pointer: ?*anyopaque) callconv(.C) void { - var tag = Pollable.from(tagged_pointer); - - if (tag.tag() != @field(Pollable.Tag, "FilePoll")) - return; - - var file_poll: *FilePoll = tag.as(FilePoll); - if (file_poll.flags.contains(.ignore_updates)) { - return; - } - - if (comptime Environment.isMac) - onKQueueEvent(file_poll, loop, &loop.ready_polls[@as(usize, @intCast(loop.current_ready_poll))]) - else if (comptime Environment.isLinux) - onEpollEvent(file_poll, loop, &loop.ready_polls[@as(usize, @intCast(loop.current_ready_poll))]); - } - - const Pollable = bun.TaggedPointerUnion( - .{ - FilePoll, - Deactivated, - }, - ); - - comptime { - @export(onTick, .{ .name = "Bun__internal_dispatch_ready_poll" }); - } - - const timeout = std.mem.zeroes(std.os.timespec); - const kevent = std.c.kevent; - const linux = std.os.linux; - - pub fn register(this: *FilePoll, loop: *uws.Loop, flag: Flags, one_shot: bool) JSC.Maybe(void) { - return registerWithFd(this, loop, flag, one_shot, this.fd); - } - pub fn registerWithFd(this: *FilePoll, loop: *uws.Loop, flag: Flags, one_shot: bool, fd: u64) JSC.Maybe(void) { - const watcher_fd = loop.fd; - - log("register: {s} ({d})", .{ @tagName(flag), fd }); - - std.debug.assert(fd != invalid_fd); - - if (one_shot) { - this.flags.insert(.one_shot); - } - - if (comptime Environment.isLinux) { - const one_shot_flag: u32 = if (!this.flags.contains(.one_shot)) 0 else linux.EPOLL.ONESHOT; - - const flags: u32 = switch (flag) { - .process, - .readable, - => linux.EPOLL.IN | linux.EPOLL.HUP | one_shot_flag, - .writable => linux.EPOLL.OUT | linux.EPOLL.HUP | linux.EPOLL.ERR | one_shot_flag, - else => unreachable, - }; - - var event = linux.epoll_event{ .events = flags, .data = .{ .u64 = @intFromPtr(Pollable.init(this).ptr()) } }; - - var op: u32 = if (this.isRegistered() or this.flags.contains(.needs_rearm)) linux.EPOLL.CTL_MOD else linux.EPOLL.CTL_ADD; - - const ctl = linux.epoll_ctl( - watcher_fd, - op, - @intCast(fd), - &event, - ); - this.flags.insert(.was_ever_registered); - if (JSC.Maybe(void).errnoSys(ctl, .epoll_ctl)) |errno| { - return errno; - } - } else if (comptime Environment.isMac) { - var changelist = std.mem.zeroes([2]std.os.system.kevent64_s); - const one_shot_flag: u16 = if (!this.flags.contains(.one_shot)) 0 else std.c.EV_ONESHOT; - changelist[0] = switch (flag) { - .readable => .{ - .ident = @as(u64, @intCast(fd)), - .filter = std.os.system.EVFILT_READ, - .data = 0, - .fflags = 0, - .udata = @intFromPtr(Pollable.init(this).ptr()), - .flags = std.c.EV_ADD | one_shot_flag, - .ext = .{ this.generation_number, 0 }, - }, - .writable => .{ - .ident = @as(u64, @intCast(fd)), - .filter = std.os.system.EVFILT_WRITE, - .data = 0, - .fflags = 0, - .udata = @intFromPtr(Pollable.init(this).ptr()), - .flags = std.c.EV_ADD | one_shot_flag, - .ext = .{ this.generation_number, 0 }, - }, - .process => .{ - .ident = @as(u64, @intCast(fd)), - .filter = std.os.system.EVFILT_PROC, - .data = 0, - .fflags = std.c.NOTE_EXIT, - .udata = @intFromPtr(Pollable.init(this).ptr()), - .flags = std.c.EV_ADD | one_shot_flag, - .ext = .{ this.generation_number, 0 }, - }, - .machport => .{ - .ident = @as(u64, @intCast(fd)), - .filter = std.os.system.EVFILT_MACHPORT, - .data = 0, - .fflags = 0, - .udata = @intFromPtr(Pollable.init(this).ptr()), - .flags = std.c.EV_ADD | one_shot_flag, - .ext = .{ this.generation_number, 0 }, - }, - else => unreachable, - }; - - // output events only include change errors - const KEVENT_FLAG_ERROR_EVENTS = 0x000002; - - // The kevent() system call returns the number of events placed in - // the eventlist, up to the value given by nevents. If the time - // limit expires, then kevent() returns 0. - const rc = rc: { - while (true) { - const rc = std.os.system.kevent64( - watcher_fd, - &changelist, - 1, - // The same array may be used for the changelist and eventlist. - &changelist, - // we set 0 here so that if we get an error on - // registration, it becomes errno - 0, - KEVENT_FLAG_ERROR_EVENTS, - &timeout, - ); - - if (std.c.getErrno(rc) == .INTR) continue; - break :rc rc; - } - }; - - this.flags.insert(.was_ever_registered); - - // If an error occurs while - // processing an element of the changelist and there is enough room - // in the eventlist, then the event will be placed in the eventlist - // with EV_ERROR set in flags and the system error in data. - if (changelist[0].flags == std.c.EV_ERROR and changelist[0].data != 0) { - return JSC.Maybe(void).errnoSys(changelist[0].data, .kevent).?; - // Otherwise, -1 will be returned, and errno will be set to - // indicate the error condition. - } - - const errno = std.c.getErrno(rc); - - if (errno != .SUCCESS) { - return JSC.Maybe(void){ - .err = bun.sys.Error.fromCode(errno, .kqueue), - }; - } - } else { - bun.todo(@src(), {}); - } - if (this.canActivate()) - this.activate(loop); - this.flags.insert(switch (flag) { - .readable => .poll_readable, - .process => if (comptime Environment.isLinux) .poll_readable else .poll_process, - .writable => .poll_writable, - .machport => .poll_machport, - else => unreachable, - }); - this.flags.remove(.needs_rearm); - - return JSC.Maybe(void).success; - } - - const invalid_fd = bun.invalid_fd; - - pub fn unregister(this: *FilePoll, loop: *uws.Loop, force_unregister: bool) JSC.Maybe(void) { - return this.unregisterWithFd(loop, this.fd, force_unregister); - } - - pub fn unregisterWithFd(this: *FilePoll, loop: *uws.Loop, fd: bun.UFileDescriptor, force_unregister: bool) JSC.Maybe(void) { - if (!(this.flags.contains(.poll_readable) or this.flags.contains(.poll_writable) or this.flags.contains(.poll_process) or this.flags.contains(.poll_machport))) { - // no-op - return JSC.Maybe(void).success; - } - - std.debug.assert(fd != invalid_fd); - const watcher_fd = loop.fd; - const flag: Flags = brk: { - if (this.flags.contains(.poll_readable)) - break :brk .readable; - if (this.flags.contains(.poll_writable)) - break :brk .writable; - if (this.flags.contains(.poll_process)) - break :brk .process; - - if (this.flags.contains(.poll_machport)) - break :brk .machport; - return JSC.Maybe(void).success; - }; - - if (this.flags.contains(.needs_rearm) and !force_unregister) { - log("unregister: {s} ({d}) skipped due to needs_rearm", .{ @tagName(flag), fd }); - this.flags.remove(.poll_process); - this.flags.remove(.poll_readable); - this.flags.remove(.poll_process); - this.flags.remove(.poll_machport); - return JSC.Maybe(void).success; - } - - log("unregister: {s} ({d})", .{ @tagName(flag), fd }); - - if (comptime Environment.isLinux) { - const ctl = linux.epoll_ctl( - watcher_fd, - linux.EPOLL.CTL_DEL, - @intCast(fd), - null, - ); - - if (JSC.Maybe(void).errnoSys(ctl, .epoll_ctl)) |errno| { - return errno; - } - } else if (comptime Environment.isMac) { - var changelist = std.mem.zeroes([2]std.os.system.kevent64_s); - - changelist[0] = switch (flag) { - .readable => .{ - .ident = @as(u64, @intCast(fd)), - .filter = std.os.system.EVFILT_READ, - .data = 0, - .fflags = 0, - .udata = @intFromPtr(Pollable.init(this).ptr()), - .flags = std.c.EV_DELETE, - .ext = .{ 0, 0 }, - }, - .machport => .{ - .ident = @as(u64, @intCast(fd)), - .filter = std.os.system.EVFILT_MACHPORT, - .data = 0, - .fflags = 0, - .udata = @intFromPtr(Pollable.init(this).ptr()), - .flags = std.c.EV_DELETE, - .ext = .{ 0, 0 }, - }, - .writable => .{ - .ident = @as(u64, @intCast(fd)), - .filter = std.os.system.EVFILT_WRITE, - .data = 0, - .fflags = 0, - .udata = @intFromPtr(Pollable.init(this).ptr()), - .flags = std.c.EV_DELETE, - .ext = .{ 0, 0 }, - }, - .process => .{ - .ident = @as(u64, @intCast(fd)), - .filter = std.os.system.EVFILT_PROC, - .data = 0, - .fflags = std.c.NOTE_EXIT, - .udata = @intFromPtr(Pollable.init(this).ptr()), - .flags = std.c.EV_DELETE, - .ext = .{ 0, 0 }, - }, - else => unreachable, - }; - - // output events only include change errors - const KEVENT_FLAG_ERROR_EVENTS = 0x000002; - - // The kevent() system call returns the number of events placed in - // the eventlist, up to the value given by nevents. If the time - // limit expires, then kevent() returns 0. - const rc = std.os.system.kevent64( - watcher_fd, - &changelist, - 1, - // The same array may be used for the changelist and eventlist. - &changelist, - 1, - KEVENT_FLAG_ERROR_EVENTS, - &timeout, - ); - // If an error occurs while - // processing an element of the changelist and there is enough room - // in the eventlist, then the event will be placed in the eventlist - // with EV_ERROR set in flags and the system error in data. - if (changelist[0].flags == std.c.EV_ERROR) { - return JSC.Maybe(void).errnoSys(changelist[0].data, .kevent).?; - // Otherwise, -1 will be returned, and errno will be set to - // indicate the error condition. - } - - const errno = std.c.getErrno(rc); - switch (rc) { - std.math.minInt(@TypeOf(rc))...-1 => return JSC.Maybe(void).errnoSys(@intFromEnum(errno), .kevent).?, - else => {}, - } - } else { - bun.todo(@src(), {}); - } - - this.flags.remove(.needs_rearm); - this.flags.remove(.one_shot); - // we don't support both right now - std.debug.assert(!(this.flags.contains(.poll_readable) and this.flags.contains(.poll_writable))); - this.flags.remove(.poll_readable); - this.flags.remove(.poll_writable); - this.flags.remove(.poll_process); - this.flags.remove(.poll_machport); - if (this.isActive()) - this.deactivate(loop); - - return JSC.Maybe(void).success; - } -}; - pub const Strong = @import("./Strong.zig").Strong; pub const BinaryType = enum { diff --git a/src/bun.js/bindings/ActiveDOMCallback.cpp b/src/bun.js/bindings/ActiveDOMCallback.cpp index 2f7936aef3937..1a0fb426f9a2a 100644 --- a/src/bun.js/bindings/ActiveDOMCallback.cpp +++ b/src/bun.js/bindings/ActiveDOMCallback.cpp @@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" +#include "webcore/config.h" #include "ActiveDOMCallback.h" #include "ScriptExecutionContext.h" diff --git a/src/bun.js/bindings/AsyncContextFrame.cpp b/src/bun.js/bindings/AsyncContextFrame.cpp index 7b715d3d7d6a7..08afe6e35d2ab 100644 --- a/src/bun.js/bindings/AsyncContextFrame.cpp +++ b/src/bun.js/bindings/AsyncContextFrame.cpp @@ -1,9 +1,7 @@ -#pragma once - #include "root.h" #include "ZigGlobalObject.h" #include "AsyncContextFrame.h" -#include "JavaScriptCore/InternalFieldTuple.h" +#include using namespace JSC; using namespace WebCore; @@ -64,7 +62,7 @@ void AsyncContextFrame::visitChildrenImpl(JSCell* cell, Visitor& visitor) DEFINE_VISIT_CHILDREN(AsyncContextFrame); -extern "C" EncodedJSValue AsyncContextFrame__withAsyncContextIfNeeded(JSGlobalObject* globalObject, EncodedJSValue callback) +extern "C" JSC::EncodedJSValue AsyncContextFrame__withAsyncContextIfNeeded(JSGlobalObject* globalObject, JSC::EncodedJSValue callback) { return JSValue::encode(AsyncContextFrame::withAsyncContextIfNeeded(globalObject, JSValue::decode(callback))); } diff --git a/src/bun.js/bindings/AsyncContextFrame.h b/src/bun.js/bindings/AsyncContextFrame.h index f5ddf4ce0b1a9..7635cb19c6b35 100644 --- a/src/bun.js/bindings/AsyncContextFrame.h +++ b/src/bun.js/bindings/AsyncContextFrame.h @@ -2,7 +2,7 @@ #include "root.h" #include "BunClientData.h" -#include "JavaScriptCore/CallData.h" +#include class AsyncContextFrame : public JSC::JSNonFinalObject { public: diff --git a/src/bun.js/bindings/Buffer.cpp b/src/bun.js/bindings/Buffer.cpp deleted file mode 100644 index 28b49791fc6fb..0000000000000 --- a/src/bun.js/bindings/Buffer.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// ----- THIS IS NOT WEBCORE ---- -// It reuses the namespace. -// ----- THIS IS NOT WEBCORE ---- - -// Node.js buffer - -#include "root.h" - -#include "Buffer.h" -#include "JavaScriptCore/Uint8Array.h" - -namespace WebCore { - -Ref Buffer::create(JSC::JSGlobalObject* globalObject, JSC::JSUint8Array* array, size_t byteOffset, size_t length) -{ - return adoptRef(*new Buffer(globalObject, array, byteOffset, length)); -} -Ref Buffer::create(JSC::JSGlobalObject* globalObject, JSC::JSUint8Array* array) -{ - return create(globalObject, array, 0, array->byteLength()); -} - -int32_t static write(WTF::StringView view, size_t offset, size_t length, BufferEncodingType encodingType) -{ -} - -Buffer::~Buffer() -{ -} - -Ref Buffer::createEmpty(JSC::JSGlobalObject* globalObject) -{ - return adoptRef(*new Buffer(globalObject, nullptr, 0, 0)); -} -Ref Buffer::create(JSC::JSGlobalObject* globalObject, UChar* ptr, size_t len, BufferEncodingType encoding) -{ -} -Ref Buffer::create(JSC::JSGlobalObject* globalObject, LChar* ptr, size_t len, BufferEncodingType encoding) -{ -} - -Ref Buffer::create(JSC::JSGlobalObject* globalObject, WTF::StringView& str, BufferEncodingType encoding) -{ - if (str.is8Bit()) { - } -} -Ref Buffer::create(JSC::JSGlobalObject* globalObject, WTF::String& str, BufferEncodingType encoding) -{ -} - -} \ No newline at end of file diff --git a/src/bun.js/bindings/Buffer.h b/src/bun.js/bindings/Buffer.h deleted file mode 100644 index 4f15835135ee8..0000000000000 --- a/src/bun.js/bindings/Buffer.h +++ /dev/null @@ -1,50 +0,0 @@ -#pragma once -// ----- THIS IS NOT WEBCORE ---- -// It reuses the namespace. -// ----- THIS IS NOT WEBCORE ---- - -// Node.js buffer - -#include "root.h" - -#include "BufferEncodingType.h" -#include "JavaScriptCore/GenericTypedArrayView.h" -#include "JavaScriptCore/JSBase.h" -#include "headers-handwritten.h" - -extern "C" JSC::EncodedJSValue JSBuffer__bufferFromLength(JSC::JSGlobalObject* lexicalGlobalObject, int64_t length); -extern "C" JSC::EncodedJSValue JSBuffer__bufferFromPointerAndLengthAndDeinit(JSC::JSGlobalObject* lexicalGlobalObject, char* ptr, size_t length, void* ctx, JSTypedArrayBytesDeallocator bytesDeallocator); -extern "C" JSC::EncodedJSValue Bun__encoding__toString(const uint8_t* input, size_t len, JSC::JSGlobalObject* globalObject, Encoding encoding); -extern "C" JSC::EncodedJSValue Bun__encoding__toStringUTF8(const uint8_t* input, size_t len, JSC::JSGlobalObject* globalObject); -extern "C" bool Bun__Buffer_fill(ZigString*, void*, size_t, WebCore::BufferEncodingType); - -namespace WebCore { - -class Buffer final : public RefCounted { -public: - using Adaptor = JSC::JSUint8Array::Adaptor; - ~Buffer(); - - static int32_t write(WTF::StringView view, size_t offset, size_t length, BufferEncodingType encodingType); - - static Ref create(JSC::JSGlobalObject* globalObject, JSC::JSUint8Array*, size_t byteOffset, size_t length); - static Ref create(JSC::JSGlobalObject* globalObject, JSC::JSUint8Array*); - - static Ref createEmpty(JSC::JSGlobalObject* globalObject); - static Ref create(JSC::JSGlobalObject* globalObject, UChar* ptr, size_t len, BufferEncodingType encoding); - static Ref create(JSC::JSGlobalObject* globalObject, LChar* ptr, size_t len, BufferEncodingType encoding); - - static Ref create(JSC::JSGlobalObject* globalObject, WTF::StringView&, BufferEncodingType encoding); - static Ref create(JSC::JSGlobalObject* globalObject, WTF::String&, BufferEncodingType encoding); - - Buffer(JSC::JSGlobalObject* globalObject, JSC::JSUint8Array* array, size_t byteOffset, - size_t length) - : m_array(array) - - { - } - - JSC::JSUint8Array* m_array; -}; - -} \ No newline at end of file diff --git a/src/bun.js/bindings/BunClientData.cpp b/src/bun.js/bindings/BunClientData.cpp index 9af17d6384a57..544827ae7ebc3 100644 --- a/src/bun.js/bindings/BunClientData.cpp +++ b/src/bun.js/bindings/BunClientData.cpp @@ -4,21 +4,21 @@ #include "ExtendedDOMClientIsoSubspaces.h" #include "ExtendedDOMIsoSubspaces.h" -#include "JavaScriptCore/FastMallocAlignedMemoryAllocator.h" -#include "JavaScriptCore/HeapInlines.h" -#include "JavaScriptCore/IsoHeapCellType.h" -#include "JavaScriptCore/JSDestructibleObjectHeapCellType.h" -// #include "JavaScriptCore/MarkingConstraint.h" -#include "JavaScriptCore/SubspaceInlines.h" -#include "JavaScriptCore/VM.h" -#include "wtf/MainThread.h" +#include +#include +#include +#include +// #include +#include +#include +#include #include "JSDOMConstructorBase.h" #include "JSDOMBuiltinConstructorBase.h" #include "BunGCOutputConstraint.h" #include "WebCoreTypedArrayController.h" -#include "JavaScriptCore/JSCInlines.h" +#include #include "JSDOMWrapper.h" #include diff --git a/src/bun.js/bindings/BunClientData.h b/src/bun.js/bindings/BunClientData.h index 0bee575df377b..e6862b955325a 100644 --- a/src/bun.js/bindings/BunClientData.h +++ b/src/bun.js/bindings/BunClientData.h @@ -13,16 +13,15 @@ class DOMWrapperWorld; #include "ExtendedDOMClientIsoSubspaces.h" #include "ExtendedDOMIsoSubspaces.h" #include "DOMIsoSubspaces.h" -// #include "DOMWrapperWorld.h" #include "BunBuiltinNames.h" // #include "WebCoreJSBuiltins.h" // #include "WorkerThreadType.h" -#include "wtf/Function.h" -#include "wtf/HashSet.h" -#include "wtf/RefPtr.h" -#include "JavaScriptCore/WeakInlines.h" -#include "JavaScriptCore/IsoSubspacePerVM.h" -#include "wtf/StdLibExtras.h" +#include +#include +#include +#include +#include +#include #include "WebCoreJSBuiltins.h" #include "JSCTaskScheduler.h" diff --git a/src/bun.js/bindings/BunGCOutputConstraint.cpp b/src/bun.js/bindings/BunGCOutputConstraint.cpp index 97ee0761baa53..eb321cd6b0fd7 100644 --- a/src/bun.js/bindings/BunGCOutputConstraint.cpp +++ b/src/bun.js/bindings/BunGCOutputConstraint.cpp @@ -25,11 +25,11 @@ #include "config.h" -#include "JavaScriptCore/WeakInlines.h" -#include "JavaScriptCore/AbstractSlotVisitorInlines.h" +#include +#include -#include "JavaScriptCore/VM.h" -#include "JavaScriptCore/MarkingConstraint.h" +#include +#include // namespace JSC { @@ -134,10 +134,10 @@ #include "BunGCOutputConstraint.h" #include "WebCoreJSClientData.h" -#include "JavaScriptCore/BlockDirectoryInlines.h" -#include "JavaScriptCore/HeapInlines.h" -#include "JavaScriptCore/MarkedBlockInlines.h" -#include "JavaScriptCore/SubspaceInlines.h" +#include +#include +#include +#include namespace WebCore { diff --git a/src/bun.js/bindings/BunInjectedScriptHost.cpp b/src/bun.js/bindings/BunInjectedScriptHost.cpp index 2be574025c8a1..d689d42371c56 100644 --- a/src/bun.js/bindings/BunInjectedScriptHost.cpp +++ b/src/bun.js/bindings/BunInjectedScriptHost.cpp @@ -8,7 +8,7 @@ #include "JSEventListener.h" #include "JSEventTarget.h" #include "JSWorker.h" -#include "JavaScriptCore/ObjectConstructor.h" +#include #include "JSFetchHeaders.h" #include "JSURLSearchParams.h" diff --git a/src/bun.js/bindings/BunObject.cpp b/src/bun.js/bindings/BunObject.cpp index 498b83b45b385..0bc5a8fb5fb02 100644 --- a/src/bun.js/bindings/BunObject.cpp +++ b/src/bun.js/bindings/BunObject.cpp @@ -5,9 +5,9 @@ #include "helpers.h" #include "IDLTypes.h" #include "DOMURL.h" -#include "JavaScriptCore/JSPromise.h" -#include "JavaScriptCore/JSBase.h" -#include "JavaScriptCore/BuiltinNames.h" +#include +#include +#include #include "ScriptExecutionContext.h" #include "WebCoreJSClientData.h" #include @@ -20,7 +20,7 @@ #include "headers.h" #include "BunObject.h" #include "WebCoreJSBuiltins.h" -#include "JavaScriptCore/JSObject.h" +#include #include "DOMJITIDLConvert.h" #include "DOMJITIDLType.h" #include "DOMJITIDLTypeFilter.h" @@ -46,7 +46,7 @@ static JSValue constructEnvObject(VM& vm, JSObject* object) return jsCast(object->globalObject())->processEnvObject(); } -static inline EncodedJSValue flattenArrayOfBuffersIntoArrayBuffer(JSGlobalObject* lexicalGlobalObject, JSValue arrayValue) +static inline JSC::EncodedJSValue flattenArrayOfBuffersIntoArrayBuffer(JSGlobalObject* lexicalGlobalObject, JSValue arrayValue) { auto& vm = lexicalGlobalObject->vm(); @@ -195,7 +195,7 @@ static JSValue constructPluginObject(VM& vm, JSObject* bunObject) return pluginFunction; } -extern "C" EncodedJSValue JSPasswordObject__create(JSGlobalObject*); +extern "C" JSC::EncodedJSValue JSPasswordObject__create(JSGlobalObject*); static JSValue constructPasswordObject(VM& vm, JSObject* bunObject) { @@ -390,8 +390,8 @@ JSC_DEFINE_HOST_FUNCTION(functionBunSleep, return JSC::JSValue::encode(promise); } -extern "C" EncodedJSValue Bun__escapeHTML8(JSGlobalObject* globalObject, EncodedJSValue input, const LChar* ptr, size_t length); -extern "C" EncodedJSValue Bun__escapeHTML16(JSGlobalObject* globalObject, EncodedJSValue input, const UChar* ptr, size_t length); +extern "C" JSC::EncodedJSValue Bun__escapeHTML8(JSGlobalObject* globalObject, JSC::EncodedJSValue input, const LChar* ptr, size_t length); +extern "C" JSC::EncodedJSValue Bun__escapeHTML16(JSGlobalObject* globalObject, JSC::EncodedJSValue input, const UChar* ptr, size_t length); // JSC_DEFINE_JIT_OPERATION(functionBunEscapeHTMLWithoutTypeCheck, JSC::EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, JSObject* castedglobalObject, JSString* string)) // { @@ -429,7 +429,7 @@ JSC_DEFINE_HOST_FUNCTION(functionBunEscapeHTML, (JSC::JSGlobalObject * lexicalGl RELEASE_AND_RETURN(scope, JSValue::encode(string)); auto resolvedString = string->value(lexicalGlobalObject); - EncodedJSValue encodedInput = JSValue::encode(string); + JSC::EncodedJSValue encodedInput = JSValue::encode(string); if (!resolvedString.is8Bit()) { RELEASE_AND_RETURN(scope, Bun__escapeHTML16(lexicalGlobalObject, encodedInput, resolvedString.characters16(), length)); } else { diff --git a/src/bun.js/bindings/BunObject.lut.h b/src/bun.js/bindings/BunObject.lut.h deleted file mode 100644 index a2aa95fda6e72..0000000000000 --- a/src/bun.js/bindings/BunObject.lut.h +++ /dev/null @@ -1,359 +0,0 @@ -// File generated via `make static-hash-table` / `make cpp` -static const struct CompactHashIndex bunObjectTableIndex[269] = { - { 75, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 38, -1 }, - { -1, -1 }, - { 44, -1 }, - { -1, -1 }, - { -1, -1 }, - { 4, -1 }, - { -1, -1 }, - { 2, -1 }, - { 48, -1 }, - { 34, 261 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 71, -1 }, - { 79, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 60, -1 }, - { -1, -1 }, - { -1, -1 }, - { 11, 258 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 45, 264 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 67, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 59, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 47, 265 }, - { 32, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 70, -1 }, - { 65, -1 }, - { -1, -1 }, - { 14, -1 }, - { 23, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 43, -1 }, - { -1, -1 }, - { 52, -1 }, - { -1, -1 }, - { -1, -1 }, - { 37, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 64, -1 }, - { -1, -1 }, - { 20, 256 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 73, -1 }, - { -1, -1 }, - { 77, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 74, -1 }, - { 22, 259 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 53, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 40, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 29, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 63, -1 }, - { 35, 266 }, - { -1, -1 }, - { 33, -1 }, - { 54, -1 }, - { -1, -1 }, - { 26, -1 }, - { 15, -1 }, - { -1, -1 }, - { -1, -1 }, - { 6, -1 }, - { 10, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 18, -1 }, - { -1, -1 }, - { -1, -1 }, - { 0, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 5, -1 }, - { 16, -1 }, - { -1, -1 }, - { -1, -1 }, - { 24, -1 }, - { 1, -1 }, - { 31, 267 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 46, -1 }, - { -1, -1 }, - { -1, -1 }, - { 8, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 69, -1 }, - { -1, -1 }, - { 76, 268 }, - { -1, -1 }, - { 36, -1 }, - { -1, -1 }, - { -1, -1 }, - { 39, 260 }, - { -1, -1 }, - { -1, -1 }, - { 7, 262 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 66, -1 }, - { 3, -1 }, - { -1, -1 }, - { 61, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 28, -1 }, - { 19, 257 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 9, -1 }, - { -1, -1 }, - { -1, -1 }, - { 49, -1 }, - { 12, -1 }, - { -1, -1 }, - { 80, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 17, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 27, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 13, -1 }, - { -1, -1 }, - { -1, -1 }, - { 25, -1 }, - { -1, -1 }, - { -1, -1 }, - { 42, 263 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 21, -1 }, - { 30, -1 }, - { 41, -1 }, - { 50, -1 }, - { 51, -1 }, - { 55, -1 }, - { 56, -1 }, - { 57, -1 }, - { 58, -1 }, - { 62, -1 }, - { 68, -1 }, - { 72, -1 }, - { 78, -1 }, -}; - -static const struct HashTableValue bunObjectTableValues[81] = { - { "ArrayBufferSink"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BunObject_getter_wrap_ArrayBufferSink } }, - { "CryptoHasher"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BunObject_getter_wrap_CryptoHasher } }, - { "DO_NOT_USE_OR_YOU_WILL_BE_FIRED_mimalloc_dump"_s, static_cast(PropertyAttribute::DontEnum|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_mimalloc_dump, 1 } }, - { "FFI"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BunObject_getter_wrap_FFI } }, - { "FileSystemRouter"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BunObject_getter_wrap_FileSystemRouter } }, - { "MD4"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BunObject_getter_wrap_MD4 } }, - { "MD5"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BunObject_getter_wrap_MD5 } }, - { "SHA1"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BunObject_getter_wrap_SHA1 } }, - { "SHA224"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BunObject_getter_wrap_SHA224 } }, - { "SHA256"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BunObject_getter_wrap_SHA256 } }, - { "SHA384"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BunObject_getter_wrap_SHA384 } }, - { "SHA512"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BunObject_getter_wrap_SHA512 } }, - { "SHA512_256"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BunObject_getter_wrap_SHA512_256 } }, - { "TOML"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BunObject_getter_wrap_TOML } }, - { "Transpiler"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BunObject_getter_wrap_Transpiler } }, - { "_Os"_s, static_cast(PropertyAttribute::DontEnum|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback__Os, 1 } }, - { "_Path"_s, static_cast(PropertyAttribute::DontEnum|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback__Path, 1 } }, - { "allocUnsafe"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_allocUnsafe, 1 } }, - { "argv"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BunObject_getter_wrap_argv } }, - { "assetPrefix"_s, static_cast(PropertyAttribute::DontEnum|PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BunObject_getter_wrap_assetPrefix } }, - { "build"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_build, 1 } }, - { "concatArrayBuffers"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionConcatTypedArrays, 1 } }, - { "connect"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_connect, 1 } }, - { "cwd"_s, static_cast(PropertyAttribute::DontEnum|PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BunObject_getter_wrap_cwd } }, - { "deepEquals"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionBunDeepEquals, 2 } }, - { "deepMatch"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionBunDeepMatch, 2 } }, - { "deflateSync"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_deflateSync, 1 } }, - { "dns"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructDNSObject } }, - { "enableANSIColors"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BunObject_getter_wrap_enableANSIColors } }, - { "env"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructEnvObject } }, - { "escapeHTML"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionBunEscapeHTML, 2 } }, - { "fetch"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Bun__fetch, 1 } }, - { "file"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_file, 1 } }, - { "fileURLToPath"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionFileURLToPath, 1 } }, - { "fs"_s, static_cast(PropertyAttribute::DontEnum|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_fs, 1 } }, - { "gc"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_gc, 1 } }, - { "generateHeapSnapshot"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_generateHeapSnapshot, 1 } }, - { "getImportedStyles"_s, static_cast(PropertyAttribute::DontEnum|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_getImportedStyles, 1 } }, - { "gunzipSync"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_gunzipSync, 1 } }, - { "gzipSync"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_gzipSync, 1 } }, - { "hash"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BunObject_getter_wrap_hash } }, - { "indexOfLine"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_indexOfLine, 1 } }, - { "inflateSync"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_inflateSync, 1 } }, - { "inspect"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BunObject_getter_wrap_inspect } }, - { "isMainThread"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructIsMainThread } }, - { "jest"_s, static_cast(PropertyAttribute::DontEnum|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_jest, 1 } }, - { "listen"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_listen, 1 } }, - { "main"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BunObject_getter_wrap_main } }, - { "mmap"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_mmap, 1 } }, - { "nanoseconds"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionBunNanoseconds, 0 } }, - { "openInEditor"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_openInEditor, 1 } }, - { "origin"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BunObject_getter_wrap_origin } }, - { "password"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructPasswordObject } }, - { "pathToFileURL"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionPathToFileURL, 1 } }, - { "peek"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructBunPeekObject } }, - { "plugin"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructPluginObject } }, - { "readableStreamToArray"_s, ((static_cast(PropertyAttribute::Builtin|PropertyAttribute::Function)) & ~PropertyAttribute::Function) | PropertyAttribute::Builtin, NoIntrinsic, { HashTableValue::BuiltinGeneratorType, bunObjectReadableStreamToArrayCodeGenerator, 1 } }, - { "readableStreamToArrayBuffer"_s, ((static_cast(PropertyAttribute::Builtin|PropertyAttribute::Function)) & ~PropertyAttribute::Function) | PropertyAttribute::Builtin, NoIntrinsic, { HashTableValue::BuiltinGeneratorType, bunObjectReadableStreamToArrayBufferCodeGenerator, 1 } }, - { "readableStreamToBlob"_s, ((static_cast(PropertyAttribute::Builtin|PropertyAttribute::Function)) & ~PropertyAttribute::Function) | PropertyAttribute::Builtin, NoIntrinsic, { HashTableValue::BuiltinGeneratorType, bunObjectReadableStreamToBlobCodeGenerator, 1 } }, - { "readableStreamToFormData"_s, ((static_cast(PropertyAttribute::Builtin|PropertyAttribute::Function)) & ~PropertyAttribute::Function) | PropertyAttribute::Builtin, NoIntrinsic, { HashTableValue::BuiltinGeneratorType, bunObjectReadableStreamToFormDataCodeGenerator, 1 } }, - { "readableStreamToJSON"_s, ((static_cast(PropertyAttribute::Builtin|PropertyAttribute::Function)) & ~PropertyAttribute::Function) | PropertyAttribute::Builtin, NoIntrinsic, { HashTableValue::BuiltinGeneratorType, bunObjectReadableStreamToJSONCodeGenerator, 1 } }, - { "readableStreamToText"_s, ((static_cast(PropertyAttribute::Builtin|PropertyAttribute::Function)) & ~PropertyAttribute::Function) | PropertyAttribute::Builtin, NoIntrinsic, { HashTableValue::BuiltinGeneratorType, bunObjectReadableStreamToTextCodeGenerator, 1 } }, - { "registerMacro"_s, static_cast(PropertyAttribute::DontEnum|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_registerMacro, 1 } }, - { "resolve"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_resolve, 1 } }, - { "resolveSync"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_resolveSync, 1 } }, - { "revision"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructBunRevision } }, - { "serve"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_serve, 1 } }, - { "sha"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_sha, 1 } }, - { "shrink"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_shrink, 1 } }, - { "sleep"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionBunSleep, 1 } }, - { "sleepSync"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_sleepSync, 1 } }, - { "spawn"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_spawn, 1 } }, - { "spawnSync"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_spawnSync, 1 } }, - { "stderr"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BunObject_getter_wrap_stderr } }, - { "stdin"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BunObject_getter_wrap_stdin } }, - { "stdout"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BunObject_getter_wrap_stdout } }, - { "stringHashCode"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionHashCode, 1 } }, - { "unsafe"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BunObject_getter_wrap_unsafe } }, - { "version"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructBunVersion } }, - { "which"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_which, 1 } }, - { "write"_s, static_cast(PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BunObject_callback_write, 1 } }, -}; - -static const struct HashTable bunObjectTable = - { 81, 255, false, nullptr, bunObjectTableValues, bunObjectTableIndex }; diff --git a/src/bun.js/bindings/BunPlugin.cpp b/src/bun.js/bindings/BunPlugin.cpp index 0cd47b3c93c34..920a281d427f0 100644 --- a/src/bun.js/bindings/BunPlugin.cpp +++ b/src/bun.js/bindings/BunPlugin.cpp @@ -1,32 +1,32 @@ #include "BunPlugin.h" #include "headers-handwritten.h" -#include "JavaScriptCore/CatchScope.h" -#include "JavaScriptCore/JSGlobalObject.h" -#include "JavaScriptCore/JSTypeInfo.h" -#include "JavaScriptCore/Structure.h" #include "helpers.h" #include "ZigGlobalObject.h" -#include "JavaScriptCore/JavaScript.h" -#include "JavaScriptCore/JSObjectInlines.h" -#include "wtf/text/WTFString.h" -#include "JavaScriptCore/JSCInlines.h" -#include "JavaScriptCore/StrongInlines.h" - -#include "JavaScriptCore/ObjectConstructor.h" -#include "JavaScriptCore/SubspaceInlines.h" -#include "JavaScriptCore/RegExpObject.h" -#include "JavaScriptCore/JSPromise.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include "BunClientData.h" -#include "isBuiltinModule.h" -#include "JavaScriptCore/RegularExpression.h" -#include "JavaScriptCore/JSMap.h" -#include "JavaScriptCore/JSMapInlines.h" -#include "JavaScriptCore/JSModuleRecord.h" -#include "JavaScriptCore/JSModuleNamespaceObject.h" -#include "JavaScriptCore/SourceOrigin.h" -#include "JavaScriptCore/JSModuleLoader.h" #include "CommonJSModuleRecord.h" +#include "isBuiltinModule.h" namespace Zig { @@ -42,7 +42,7 @@ static bool isValidNamespaceString(String& namespaceString) return namespaceRegex->match(namespaceString) > -1; } -static EncodedJSValue jsFunctionAppendOnLoadPluginBody(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callframe, BunPluginTarget target, BunPlugin::Base& plugin, void* ctx, OnAppendPluginCallback callback) +static JSC::EncodedJSValue jsFunctionAppendOnLoadPluginBody(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callframe, BunPluginTarget target, BunPlugin::Base& plugin, void* ctx, OnAppendPluginCallback callback) { JSC::VM& vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); @@ -152,7 +152,8 @@ static EncodedJSValue jsFunctionAppendVirtualModulePluginBody(JSC::JSGlobalObjec } global->requireMap()->remove(globalObject, moduleIdValue); - esmRegistry && esmRegistry->remove(globalObject, moduleIdValue); + if (esmRegistry) + esmRegistry->remove(globalObject, moduleIdValue); // bool hasBeenRequired = global->requireMap()->has(globalObject, moduleIdValue); // bool hasBeenImported = esmRegistry && esmRegistry->has(globalObject, moduleIdValue); @@ -164,7 +165,7 @@ static EncodedJSValue jsFunctionAppendVirtualModulePluginBody(JSC::JSGlobalObjec return JSValue::encode(jsUndefined()); } -static EncodedJSValue jsFunctionAppendOnResolvePluginBody(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callframe, BunPluginTarget target, BunPlugin::Base& plugin, void* ctx, OnAppendPluginCallback callback) +static JSC::EncodedJSValue jsFunctionAppendOnResolvePluginBody(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callframe, BunPluginTarget target, BunPlugin::Base& plugin, void* ctx, OnAppendPluginCallback callback) { JSC::VM& vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); @@ -217,7 +218,7 @@ static EncodedJSValue jsFunctionAppendOnResolvePluginBody(JSC::JSGlobalObject* g return JSValue::encode(jsUndefined()); } -static EncodedJSValue jsFunctionAppendOnResolvePluginGlobal(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callframe, BunPluginTarget target) +static JSC::EncodedJSValue jsFunctionAppendOnResolvePluginGlobal(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callframe, BunPluginTarget target) { Zig::GlobalObject* global = Zig::jsCast(globalObject); @@ -226,7 +227,7 @@ static EncodedJSValue jsFunctionAppendOnResolvePluginGlobal(JSC::JSGlobalObject* return jsFunctionAppendOnResolvePluginBody(globalObject, callframe, target, plugins, global->bunVM(), callback); } -static EncodedJSValue jsFunctionAppendOnLoadPluginGlobal(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callframe, BunPluginTarget target) +static JSC::EncodedJSValue jsFunctionAppendOnLoadPluginGlobal(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callframe, BunPluginTarget target) { Zig::GlobalObject* global = Zig::jsCast(globalObject); @@ -270,7 +271,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionAppendOnResolvePluginBrowser, (JSC::JSGlobalO return jsFunctionAppendOnResolvePluginGlobal(globalObject, callframe, BunPluginTargetBrowser); } -extern "C" EncodedJSValue jsFunctionBunPluginClear(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callframe) +extern "C" JSC::EncodedJSValue jsFunctionBunPluginClear(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callframe) { Zig::GlobalObject* global = reinterpret_cast(globalObject); global->onLoadPlugins.fileNamespace.clear(); @@ -283,7 +284,7 @@ extern "C" EncodedJSValue jsFunctionBunPluginClear(JSC::JSGlobalObject* globalOb return JSValue::encode(jsUndefined()); } -extern "C" EncodedJSValue setupBunPlugin(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callframe, BunPluginTarget target) +extern "C" JSC::EncodedJSValue setupBunPlugin(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callframe, BunPluginTarget target) { JSC::VM& vm = globalObject->vm(); auto clientData = WebCore::clientData(vm); @@ -370,7 +371,7 @@ extern "C" EncodedJSValue setupBunPlugin(JSC::JSGlobalObject* globalObject, JSC: RELEASE_AND_RETURN(throwScope, JSValue::encode(jsUndefined())); } -extern "C" EncodedJSValue jsFunctionBunPlugin(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callframe) +extern "C" JSC::EncodedJSValue jsFunctionBunPlugin(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callframe) { Zig::GlobalObject* global = reinterpret_cast(globalObject); return setupBunPlugin(globalObject, callframe, BunPluginTargetBun); diff --git a/src/bun.js/bindings/BunPlugin.h b/src/bun.js/bindings/BunPlugin.h index 162e70dc7ad6c..4431e32cc2b31 100644 --- a/src/bun.js/bindings/BunPlugin.h +++ b/src/bun.js/bindings/BunPlugin.h @@ -2,8 +2,8 @@ #include "root.h" #include "headers-handwritten.h" -#include "JavaScriptCore/JSGlobalObject.h" -#include "JavaScriptCore/Strong.h" +#include +#include #include "helpers.h" extern "C" JSC_DECLARE_HOST_FUNCTION(jsFunctionBunPlugin); diff --git a/src/bun.js/bindings/Process.cpp b/src/bun.js/bindings/BunProcess.cpp similarity index 94% rename from src/bun.js/bindings/Process.cpp rename to src/bun.js/bindings/BunProcess.cpp index 6fbc797cd90f1..c8269e1f638d8 100644 --- a/src/bun.js/bindings/Process.cpp +++ b/src/bun.js/bindings/BunProcess.cpp @@ -1,10 +1,9 @@ -#include "Process.h" -#include "JavaScriptCore/InternalFieldTuple.h" -#include "JavaScriptCore/JSMicrotask.h" -#include "JavaScriptCore/ObjectConstructor.h" -#include "JavaScriptCore/NumberPrototype.h" +#include "BunProcess.h" +#include +#include +#include +#include #include "node_api.h" -#include #include "ZigGlobalObject.h" #include "headers.h" #include "JSEnvironmentVariableMap.h" @@ -16,9 +15,17 @@ #include #include #include -#include + +#ifndef WIN32 #include +#include #include +#include +#else +#include +#include +#include +#endif #include "JSNextTickQueue.h" #include "ProcessBindingUV.h" #include "ProcessBindingNatives.h" @@ -121,6 +128,32 @@ JSC_DEFINE_CUSTOM_SETTER(Process_defaultSetter, static bool getWindowSize(int fd, size_t* width, size_t* height) { +#if OS(WINDOWS) + CONSOLE_SCREEN_BUFFER_INFO csbi; + HANDLE handle = INVALID_HANDLE_VALUE; + switch (fd) { + case 0: + handle = GetStdHandle(STD_INPUT_HANDLE); + break; + case 1: + handle = GetStdHandle(STD_OUTPUT_HANDLE); + break; + case 2: + handle = GetStdHandle(STD_ERROR_HANDLE); + break; + default: + break; + } + if (handle == INVALID_HANDLE_VALUE) + return false; + + if (!GetConsoleScreenBufferInfo(handle, &csbi)) + return false; + + *width = csbi.srWindow.Right - csbi.srWindow.Left + 1; + *height = csbi.srWindow.Bottom - csbi.srWindow.Top + 1; + return true; +#else struct winsize ws; int err; do @@ -134,6 +167,7 @@ static bool getWindowSize(int fd, size_t* width, size_t* height) *height = ws.ws_row; return true; +#endif } JSC_DEFINE_HOST_FUNCTION(Process_functionInternalGetWindowSize, @@ -203,13 +237,20 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionDlopen, WTF::String filename = callFrame->uncheckedArgument(1).toWTFString(globalObject); RETURN_IF_EXCEPTION(scope, {}); - +#if OS(WINDOWS) + CString utf8 = filename.utf8(); + HMODULE handle = LoadLibraryA(utf8.data()); +#else CString utf8 = filename.utf8(); - void* handle = dlopen(utf8.data(), RTLD_LAZY); +#endif if (!handle) { +#if OS(WINDOWS) + WTF::String msg = makeString("LoadLibraryA failed with error code: "_s, GetLastError()); +#else WTF::String msg = WTF::String::fromUTF8(dlerror()); +#endif JSC::throwTypeError(globalObject, scope, msg); return JSC::JSValue::encode(JSC::JSValue {}); } @@ -230,13 +271,24 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionDlopen, JSC::EncodedJSValue (*napi_register_module_v1)(JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue exports); +#if OS(WINDOWS) +#define dlsym GetProcAddress +#endif napi_register_module_v1 = reinterpret_cast( dlsym(handle, "napi_register_module_v1")); +#if OS(WINDOWS) +#undef dlsym +#endif + if (!napi_register_module_v1) { +#if OS(WINDOWS) + FreeLibrary(handle); +#else dlclose(handle); +#endif JSC::throwTypeError(globalObject, scope, "symbol 'napi_register_module_v1' not found in native module. Is this a Node API (napi) module?"_s); return JSC::JSValue::encode(JSC::JSValue {}); } @@ -247,6 +299,8 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionDlopen, JSC_DEFINE_HOST_FUNCTION(Process_functionUmask, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { +#if !OS(WINDOWS) + if (callFrame->argumentCount() == 0 || callFrame->argument(0).isUndefined()) { mode_t currentMask = umask(0); umask(currentMask); @@ -279,6 +333,9 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionUmask, } return JSC::JSValue::encode(JSC::jsNumber(umask(newUmask))); +#else + return JSC::JSValue::encode(JSC::jsNumber(0)); +#endif } extern "C" uint64_t Bun__readOriginTimer(void*); @@ -439,7 +496,7 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionChdir, return JSC::JSValue::encode(result); } - +#if !OS(WINDOWS) static HashMap* signalNameToNumberMap = nullptr; static HashMap* signalNumberToNameMap = nullptr; @@ -657,14 +714,20 @@ static void onDidChangeListeners(EventEmitter& eventEmitter, const Identifier& e } } } +#endif void Process::emitSignalEvent(int signalNumber) { +#if !OS(WINDOWS) + String signalName = signalNumberToNameMap->get(signalNumber); Identifier signalNameIdentifier = Identifier::fromString(vm(), signalName); MarkedArgumentBuffer args; args.append(jsNumber(signalNumber)); wrapped().emitForBindings(signalNameIdentifier, args); +#else + UNUSED_PARAM(signalNumber); +#endif } Process::~Process() @@ -782,7 +845,7 @@ static JSValue constructVersions(VM& vm, JSObject* processObject) JSC::JSValue(JSC::jsOwnedString(vm, makeAtomString(REPORTED_NODE_VERSION)))); object->putDirect( vm, JSC::Identifier::fromString(vm, "bun"_s), - JSC::JSValue(JSC::jsOwnedString(vm, makeAtomString(Bun__version + 1 /* prefix with v */)))); + JSC::JSValue(JSC::jsOwnedString(vm, makeAtomString(Bun__version + 1 /* remove "v" prefix */)))); object->putDirect(vm, JSC::Identifier::fromString(vm, "webkit"_s), JSC::JSValue(JSC::jsOwnedString(vm, makeAtomString(BUN_WEBKIT_VERSION)))); object->putDirect(vm, JSC::Identifier::fromString(vm, "boringssl"_s), @@ -811,7 +874,11 @@ static JSValue constructVersions(VM& vm, JSObject* processObject) JSC::JSValue(JSC::jsString(vm, makeString(Bun__versions_usockets))), 0); object->putDirect(vm, JSC::Identifier::fromString(vm, "v8"_s), JSValue(JSC::jsString(vm, makeString("11.3.244.8-node.15"_s))), 0); +#if OS(WINDOWS) + object->putDirect(vm, JSC::Identifier::fromString(vm, "uv"_s), JSValue(JSC::jsString(vm, makeString(uv_version_string()))), 0); +#else object->putDirect(vm, JSC::Identifier::fromString(vm, "uv"_s), JSValue(JSC::jsString(vm, makeString("1.46.0"_s))), 0); +#endif object->putDirect(vm, JSC::Identifier::fromString(vm, "napi"_s), JSValue(JSC::jsString(vm, makeString("9"_s))), 0); object->putDirect(vm, JSC::Identifier::fromString(vm, "modules"_s), @@ -922,6 +989,10 @@ static JSValue constructStderr(VM& vm, JSObject* processObject) return constructStdioWriteStream(globalObject, 2); } +#if OS(WINDOWS) +#define STDIN_FILENO 0 +#endif + static JSValue constructStdin(VM& vm, JSObject* processObject) { auto* globalObject = Bun__getDefaultGlobal(); @@ -973,7 +1044,11 @@ static JSValue constructPid(VM& vm, JSObject* processObject) static JSValue constructPpid(VM& vm, JSObject* processObject) { +#if OS(WINDOWS) + return jsUndefined(); +#else return jsNumber(getppid()); +#endif } static JSValue constructArgv0(VM& vm, JSObject* processObject) @@ -1002,13 +1077,9 @@ static JSValue constructArgv(VM& vm, JSObject* processObject) static JSValue constructArch(VM& vm, JSObject* processObject) { -#if defined(__x86_64__) +#if CPU(X86_64) return JSC::jsString(vm, makeAtomString("x64")); -#elif defined(__i386__) - return JSC::jsString(vm, makeAtomString("x86")); -#elif defined(__arm__) - return JSC::jsString(vm, makeAtomString("arm")); -#elif defined(__aarch64__) +#elif CPU(ARM64) return JSC::jsString(vm, makeAtomString("arm64")); #else #error "Unknown architecture" @@ -1021,6 +1092,8 @@ static JSValue constructPlatform(VM& vm, JSObject* processObject) return JSC::jsString(vm, makeAtomString("darwin")); #elif defined(__linux__) return JSC::jsString(vm, makeAtomString("linux")); +#elif OS(WINDOWS) + return JSC::jsString(vm, makeAtomString("win32")); #else #error "Unknown platform" #endif @@ -1052,6 +1125,28 @@ static JSValue constructEnv(VM& vm, JSObject* processObject) return globalObject->processEnvObject(); } +#if OS(WINDOWS) +static int getuid() +{ + return 0; +} + +static int geteuid() +{ + return 0; +} + +static int getegid() +{ + return 0; +} + +static int getgid() +{ + return 0; +} +#endif + JSC_DEFINE_HOST_FUNCTION(Process_functiongetuid, (JSGlobalObject * globalObject, CallFrame* callFrame)) { return JSValue::encode(jsNumber(getuid())); @@ -1074,6 +1169,7 @@ JSC_DEFINE_HOST_FUNCTION(Process_functiongetgid, (JSGlobalObject * globalObject, JSC_DEFINE_HOST_FUNCTION(Process_functiongetgroups, (JSGlobalObject * globalObject, CallFrame* callFrame)) { +#if !OS(WINDOWS) auto& vm = globalObject->vm(); int ngroups = getgroups(0, nullptr); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -1100,6 +1196,9 @@ JSC_DEFINE_HOST_FUNCTION(Process_functiongetgroups, (JSGlobalObject * globalObje groups->push(globalObject, jsNumber(egid)); return JSValue::encode(groups); +#else + return JSValue::encode(jsUndefined()); +#endif } JSC_DEFINE_HOST_FUNCTION(Process_functionAssert, (JSGlobalObject * globalObject, CallFrame* callFrame)) @@ -1343,11 +1442,19 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionCpuUsage, { JSC::VM& vm = globalObject->vm(); auto throwScope = DECLARE_THROW_SCOPE(vm); +#if !OS(WINDOWS) struct rusage rusage; if (getrusage(RUSAGE_SELF, &rusage) != 0) { throwSystemError(throwScope, globalObject, "Failed to get CPU usage"_s, "getrusage"_s, errno); return JSValue::encode(jsUndefined()); } +#else + uv_rusage_t rusage; + if (uv_getrusage(&rusage) != 0) { + throwSystemError(throwScope, globalObject, "Failed to get CPU usage"_s, "uv_getrusage"_s, errno); + return JSValue::encode(jsUndefined()); + } +#endif auto* process = getProcessObject(globalObject, callFrame->thisValue()); @@ -1486,8 +1593,10 @@ int getRSS(size_t* rss) err: return EINVAL; +#elif OS(WINDOWS) + return uv_resident_set_memory(rss); #else -#error "Unsupported platform" +#error "Unknown platform" #endif } @@ -1559,15 +1668,15 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionOpenStdin, (JSGlobalObject * globalObje } auto throwScope = DECLARE_THROW_SCOPE(vm); - if (JSValue stdin = global->processObject()->getIfPropertyExists(globalObject, Identifier::fromString(vm, "stdin"_s))) { + if (JSValue stdinValue = global->processObject()->getIfPropertyExists(globalObject, Identifier::fromString(vm, "stdin"_s))) { RETURN_IF_EXCEPTION(throwScope, JSValue::encode(jsUndefined())); - if (!stdin.isObject()) { + if (!stdinValue.isObject()) { throwTypeError(globalObject, throwScope, "stdin is not an object"_s); return JSValue::encode(jsUndefined()); } - JSValue resumeValue = stdin.getObject()->getIfPropertyExists(globalObject, Identifier::fromString(vm, "resume"_s)); + JSValue resumeValue = stdinValue.getObject()->getIfPropertyExists(globalObject, Identifier::fromString(vm, "resume"_s)); RETURN_IF_EXCEPTION(throwScope, JSValue::encode(jsUndefined())); if (!resumeValue.isUndefinedOrNull()) { auto resumeFunction = jsDynamicCast(resumeValue); @@ -1579,11 +1688,11 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionOpenStdin, (JSGlobalObject * globalObje auto callData = getCallData(resumeFunction); MarkedArgumentBuffer args; - JSC::call(globalObject, resumeFunction, callData, stdin, args); + JSC::call(globalObject, resumeFunction, callData, stdinValue, args); RETURN_IF_EXCEPTION(throwScope, JSValue::encode(jsUndefined())); } - RELEASE_AND_RETURN(throwScope, JSValue::encode(stdin)); + RELEASE_AND_RETURN(throwScope, JSValue::encode(stdinValue)); } RELEASE_AND_RETURN(throwScope, JSValue::encode(jsUndefined())); @@ -1738,9 +1847,19 @@ JSC_DEFINE_CUSTOM_SETTER(setProcessDebugPort, JSC_DEFINE_CUSTOM_GETTER(processTitle, (JSC::JSGlobalObject * globalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName)) { +#if !OS(WINDOWS) ZigString str; Bun__Process__getTitle(globalObject, &str); return JSValue::encode(Zig::toJSStringValue(str, globalObject)); +#else + auto& vm = globalObject->vm(); + char title[1024]; + if (uv_get_process_title(title, sizeof(title)) != 0) { + return JSValue::encode(jsString(vm, String("bun"_s))); + } + + return JSValue::encode(jsString(vm, WTF::String::fromUTF8(title))); +#endif } JSC_DEFINE_CUSTOM_SETTER(setProcessTitle, @@ -1748,17 +1867,22 @@ JSC_DEFINE_CUSTOM_SETTER(setProcessTitle, JSC::EncodedJSValue value, JSC::PropertyName)) { JSC::VM& vm = globalObject->vm(); - + auto scope = DECLARE_THROW_SCOPE(vm); JSC::JSObject* thisObject = JSC::jsDynamicCast(JSValue::decode(thisValue)); JSC::JSString* jsString = JSC::jsDynamicCast(JSValue::decode(value)); if (!thisObject || !jsString) { return false; } - +#if !OS(WINDOWS) ZigString str = Zig::toZigString(jsString, globalObject); Bun__Process__setTitle(globalObject, &str); - return true; +#else + WTF::String str = jsString->value(globalObject); + RETURN_IF_EXCEPTION(scope, false); + CString cstr = str.utf8(); + return uv_set_process_title(cstr.data()) == 0; +#endif } JSC_DEFINE_HOST_FUNCTION(Process_functionCwd, @@ -1786,7 +1910,12 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionReallyKill, int signal = callFrame->argument(1).toInt32(globalObject); RETURN_IF_EXCEPTION(scope, {}); +#if !OS(WINDOWS) int result = kill(pid, signal); +#else + int result = uv_kill(pid, signal); +#endif + if (result < 0) { throwSystemError(scope, globalObject, "kill"_s, errno); } @@ -1806,7 +1935,7 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionKill, } JSC::JSValue signalValue = callFrame->argument(1); - +#if !OS(WINDOWS) int signal = SIGTERM; if (signalValue.isNumber()) { @@ -1829,6 +1958,21 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionKill, } int result = kill(pid, signal); +#else + int signal = 1; + if (signalValue.isNumber()) { + signal = signalValue.toInt32(globalObject); + RETURN_IF_EXCEPTION(scope, {}); + } else if (signalValue.isString()) { + throwTypeError(globalObject, scope, "TODO: implement this function with strings on Windows! Sorry!!"_s); + RETURN_IF_EXCEPTION(scope, {}); + } else if (!signalValue.isUndefinedOrNull()) { + throwTypeError(globalObject, scope, "signal must be a string or number"_s); + return JSValue::encode(jsUndefined()); + } + + int result = uv_kill(pid, signal); +#endif if (result < 0) { throwSystemError(scope, globalObject, "kill"_s, errno); @@ -1931,15 +2075,19 @@ extern "C" void Process__emitDisconnectEvent(Zig::GlobalObject* global) _kill Process_functionReallyKill Function 2 @end */ -#include "Process.lut.h" -const JSC::ClassInfo Process::s_info = { "Process"_s, &Base::s_info, &processObjectTable, nullptr, - CREATE_METHOD_TABLE(Process) }; +#include "BunProcess.lut.h" + +const JSC::ClassInfo Process::s_info + = { "Process"_s, &Base::s_info, &processObjectTable, nullptr, + CREATE_METHOD_TABLE(Process) }; void Process::finishCreation(JSC::VM& vm) { Base::finishCreation(vm); +#ifndef WIN32 wrapped().onDidChangeListener = &onDidChangeListeners; +#endif m_cpuUsageStructure.initLater([](const JSC::LazyProperty::Initializer& init) { init.set(constructCPUUsageStructure(init.vm, init.owner->globalObject())); diff --git a/src/bun.js/bindings/Process.h b/src/bun.js/bindings/BunProcess.h similarity index 100% rename from src/bun.js/bindings/Process.h rename to src/bun.js/bindings/BunProcess.h diff --git a/src/bun.js/bindings/BunString.cpp b/src/bun.js/bindings/BunString.cpp index 99fd021757629..2a40d28a4cdd2 100644 --- a/src/bun.js/bindings/BunString.cpp +++ b/src/bun.js/bindings/BunString.cpp @@ -1,9 +1,10 @@ #include "root.h" #include "headers-handwritten.h" -#include "JavaScriptCore/JSCJSValueInlines.h" +#include #include "helpers.h" #include "simdutf.h" -#include "wtf/Seconds.h" +#include +#include #include "GCDefferalContext.h" #include #include @@ -266,7 +267,7 @@ extern "C" BunString BunString__createExternal(const char* bytes, size_t length, return { BunStringTag::WTFStringImpl, { .wtf = &impl.leakRef() } }; } -extern "C" EncodedJSValue BunString__toJSON( +extern "C" JSC::EncodedJSValue BunString__toJSON( JSC::JSGlobalObject* globalObject, BunString* bunString) { @@ -279,7 +280,7 @@ extern "C" EncodedJSValue BunString__toJSON( return JSC::JSValue::encode(result); } -extern "C" EncodedJSValue BunString__createArray( +extern "C" JSC::EncodedJSValue BunString__createArray( JSC::JSGlobalObject* globalObject, const BunString* ptr, size_t length) { diff --git a/src/bun.js/bindings/CommonJSModuleRecord.cpp b/src/bun.js/bindings/CommonJSModuleRecord.cpp index 8e1da59c42d61..cc42c56843312 100644 --- a/src/bun.js/bindings/CommonJSModuleRecord.cpp +++ b/src/bun.js/bindings/CommonJSModuleRecord.cpp @@ -32,26 +32,24 @@ #include "root.h" #include "headers-handwritten.h" #include "ZigGlobalObject.h" -#include "JavaScriptCore/JSSourceCode.h" -#include "JavaScriptCore/JSString.h" -#include "JavaScriptCore/JSValueInternal.h" -#include "JavaScriptCore/JSVirtualMachineInternal.h" -#include "JavaScriptCore/ObjectConstructor.h" -#include "JavaScriptCore/OptionsList.h" -#include "JavaScriptCore/ParserError.h" -#include "JavaScriptCore/ScriptExecutable.h" -#include "JavaScriptCore/SourceOrigin.h" -#include "JavaScriptCore/StackFrame.h" -#include "JavaScriptCore/StackVisitor.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "BunClientData.h" -#include "JavaScriptCore/Identifier.h" +#include #include "ImportMetaObject.h" -#include "JavaScriptCore/TypedArrayInlines.h" -#include "JavaScriptCore/PropertyNameArray.h" -#include "JavaScriptCore/JSWeakMap.h" -#include "JavaScriptCore/JSWeakMapInlines.h" -#include "JavaScriptCore/JSWithScope.h" +#include +#include +#include +#include +#include #include #include @@ -61,7 +59,7 @@ #include #include #include "ZigSourceProvider.h" -#include "JavaScriptCore/FunctionPrototype.h" +#include #include "CommonJSModuleRecord.h" #include #include @@ -322,7 +320,7 @@ JSC_DEFINE_CUSTOM_SETTER(setterPath, return true; } -extern "C" EncodedJSValue Resolver__propForRequireMainPaths(JSGlobalObject*); +extern "C" JSC::EncodedJSValue Resolver__propForRequireMainPaths(JSGlobalObject*); JSC_DEFINE_CUSTOM_GETTER(getterPaths, (JSC::JSGlobalObject * globalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName)) { diff --git a/src/bun.js/bindings/DOMException.h b/src/bun.js/bindings/DOMException.h index f5e48262b31fa..b764393c17b52 100644 --- a/src/bun.js/bindings/DOMException.h +++ b/src/bun.js/bindings/DOMException.h @@ -30,7 +30,7 @@ #include "root.h" #include "ExceptionCode.h" -#include "wtf/text/WTFString.h" +#include namespace WebCore { diff --git a/src/bun.js/bindings/DOMFormData.cpp b/src/bun.js/bindings/DOMFormData.cpp index 6c204c5f4a8f9..6567007a51c72 100644 --- a/src/bun.js/bindings/DOMFormData.cpp +++ b/src/bun.js/bindings/DOMFormData.cpp @@ -30,7 +30,7 @@ #include "config.h" #include "DOMFormData.h" -#include "wtf/URLParser.h" +#include namespace WebCore { diff --git a/src/bun.js/bindings/DOMURL.cpp b/src/bun.js/bindings/DOMURL.cpp index b88161a4d0783..9818fc6cb99a0 100644 --- a/src/bun.js/bindings/DOMURL.cpp +++ b/src/bun.js/bindings/DOMURL.cpp @@ -32,7 +32,7 @@ // #include "PublicURLManager.h" // #include "ResourceRequest.h" #include "URLSearchParams.h" -// #include "wtf/MainThread.h" +// #include namespace WebCore { diff --git a/src/bun.js/bindings/DOMURL.h b/src/bun.js/bindings/DOMURL.h index 0f19510b6e676..7e8c40015e2d9 100644 --- a/src/bun.js/bindings/DOMURL.h +++ b/src/bun.js/bindings/DOMURL.h @@ -30,8 +30,8 @@ #include "ExceptionOr.h" #include "URLDecomposition.h" -#include "wtf/URL.h" -#include "wtf/WeakPtr.h" +#include +#include namespace WebCore { diff --git a/src/bun.js/bindings/DOMWrapperWorld-class.h b/src/bun.js/bindings/DOMWrapperWorld-class.h index d2d4fb00c10a3..75d14bfaf9969 100644 --- a/src/bun.js/bindings/DOMWrapperWorld-class.h +++ b/src/bun.js/bindings/DOMWrapperWorld-class.h @@ -2,7 +2,7 @@ #include "root.h" -#include "wtf/Forward.h" +#include namespace WebCore { diff --git a/src/bun.js/bindings/DOMWrapperWorld.cpp b/src/bun.js/bindings/DOMWrapperWorld.cpp index f0d92ee849d9a..b09b35e849a6e 100644 --- a/src/bun.js/bindings/DOMWrapperWorld.cpp +++ b/src/bun.js/bindings/DOMWrapperWorld.cpp @@ -26,7 +26,7 @@ #include "WebCoreJSClientData.h" // #include "WindowProxy.h" #include "ZigGlobalObject.h" -#include "wtf/MainThread.h" +#include namespace WebCore { diff --git a/src/bun.js/bindings/Exception.h b/src/bun.js/bindings/Exception.h index 8607e31151da5..e14b1e01a1fab 100644 --- a/src/bun.js/bindings/Exception.h +++ b/src/bun.js/bindings/Exception.h @@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "root.h" #include "ExceptionCode.h" -#include "wtf/text/WTFString.h" +#include namespace WebCore { diff --git a/src/bun.js/bindings/ExceptionCode.h b/src/bun.js/bindings/ExceptionCode.h index 26c1e4adaecc2..d63691db1cb40 100644 --- a/src/bun.js/bindings/ExceptionCode.h +++ b/src/bun.js/bindings/ExceptionCode.h @@ -20,7 +20,7 @@ #include "root.h" -#include "wtf/EnumTraits.h" +#include namespace WebCore { diff --git a/src/bun.js/bindings/ExceptionOr.h b/src/bun.js/bindings/ExceptionOr.h index 3bbc641a11b7c..5241d45d5b899 100644 --- a/src/bun.js/bindings/ExceptionOr.h +++ b/src/bun.js/bindings/ExceptionOr.h @@ -29,9 +29,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "root.h" #include "Exception.h" -#include "wtf/CrossThreadCopier.h" -#include "wtf/Expected.h" -#include "wtf/StdLibExtras.h" +#include +#include +#include namespace WebCore { diff --git a/src/bun.js/bindings/ImportMetaObject.cpp b/src/bun.js/bindings/ImportMetaObject.cpp index 199a13392e3df..5d74af680f32d 100644 --- a/src/bun.js/bindings/ImportMetaObject.cpp +++ b/src/bun.js/bindings/ImportMetaObject.cpp @@ -21,23 +21,23 @@ #include "JSDOMWrapperCache.h" #include "ScriptExecutionContext.h" #include "WebCoreJSClientData.h" -#include "JavaScriptCore/FunctionPrototype.h" -#include "JavaScriptCore/HeapAnalyzer.h" +#include +#include -#include "JavaScriptCore/JSDestructibleObjectHeapCellType.h" -#include "JavaScriptCore/SlotVisitorMacros.h" -#include "JavaScriptCore/SubspaceInlines.h" -#include "wtf/GetPtr.h" -#include "wtf/PointerPreparations.h" -#include "wtf/URL.h" -#include "JavaScriptCore/BuiltinNames.h" +#include +#include +#include +#include +#include +#include +#include #include "JSBufferEncodingType.h" -#include "JavaScriptCore/JSBase.h" +#include #include "JSDOMURL.h" -#include "JavaScriptCore/JSNativeStdFunction.h" -#include "JavaScriptCore/GetterSetter.h" +#include +#include #include #include #include @@ -47,7 +47,7 @@ namespace Zig { using namespace JSC; using namespace WebCore; -static EncodedJSValue functionRequireResolve(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame, const WTF::String& fromStr) +static JSC::EncodedJSValue functionRequireResolve(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame, const WTF::String& fromStr) { JSC::VM& vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); @@ -148,7 +148,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionRequireResolve, (JSC::JSGlobalObject * global return functionRequireResolve(globalObject, callFrame, fromStr); } -extern "C" EncodedJSValue functionImportMeta__resolveSync(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame) +extern "C" JSC::EncodedJSValue functionImportMeta__resolveSync(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame) { JSC::VM& vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(globalObject->vm()); @@ -236,7 +236,7 @@ extern "C" EncodedJSValue functionImportMeta__resolveSync(JSC::JSGlobalObject* g return result; } -extern "C" EncodedJSValue functionImportMeta__resolveSyncPrivate(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame) +extern "C" JSC::EncodedJSValue functionImportMeta__resolveSyncPrivate(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame) { JSC::VM& vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(globalObject->vm()); @@ -363,7 +363,7 @@ Zig::ImportMetaObject* ImportMetaObject::create(JSC::JSGlobalObject* jslobalObje return Zig::ImportMetaObject::create(vm, globalObject, structure, view); } -JSC_DEFINE_CUSTOM_GETTER(jsImportMetaObjectGetter_url, (JSGlobalObject * globalObject, EncodedJSValue thisValue, PropertyName propertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsImportMetaObjectGetter_url, (JSGlobalObject * globalObject, JSC::EncodedJSValue thisValue, PropertyName propertyName)) { ImportMetaObject* thisObject = jsDynamicCast(JSValue::decode(thisValue)); if (UNLIKELY(!thisObject)) @@ -371,7 +371,7 @@ JSC_DEFINE_CUSTOM_GETTER(jsImportMetaObjectGetter_url, (JSGlobalObject * globalO return JSValue::encode(thisObject->urlProperty.getInitializedOnMainThread(thisObject)); } -JSC_DEFINE_CUSTOM_GETTER(jsImportMetaObjectGetter_dir, (JSGlobalObject * globalObject, EncodedJSValue thisValue, PropertyName propertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsImportMetaObjectGetter_dir, (JSGlobalObject * globalObject, JSC::EncodedJSValue thisValue, PropertyName propertyName)) { ImportMetaObject* thisObject = jsDynamicCast(JSValue::decode(thisValue)); if (UNLIKELY(!thisObject)) @@ -379,7 +379,7 @@ JSC_DEFINE_CUSTOM_GETTER(jsImportMetaObjectGetter_dir, (JSGlobalObject * globalO return JSValue::encode(thisObject->dirProperty.getInitializedOnMainThread(thisObject)); } -JSC_DEFINE_CUSTOM_GETTER(jsImportMetaObjectGetter_file, (JSGlobalObject * globalObject, EncodedJSValue thisValue, PropertyName propertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsImportMetaObjectGetter_file, (JSGlobalObject * globalObject, JSC::EncodedJSValue thisValue, PropertyName propertyName)) { ImportMetaObject* thisObject = jsDynamicCast(JSValue::decode(thisValue)); if (UNLIKELY(!thisObject)) @@ -387,7 +387,7 @@ JSC_DEFINE_CUSTOM_GETTER(jsImportMetaObjectGetter_file, (JSGlobalObject * global return JSValue::encode(thisObject->fileProperty.getInitializedOnMainThread(thisObject)); } -JSC_DEFINE_CUSTOM_GETTER(jsImportMetaObjectGetter_path, (JSGlobalObject * globalObject, EncodedJSValue thisValue, PropertyName propertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsImportMetaObjectGetter_path, (JSGlobalObject * globalObject, JSC::EncodedJSValue thisValue, PropertyName propertyName)) { ImportMetaObject* thisObject = jsDynamicCast(JSValue::decode(thisValue)); if (UNLIKELY(!thisObject)) @@ -395,7 +395,7 @@ JSC_DEFINE_CUSTOM_GETTER(jsImportMetaObjectGetter_path, (JSGlobalObject * global return JSValue::encode(thisObject->pathProperty.getInitializedOnMainThread(thisObject)); } -JSC_DEFINE_CUSTOM_GETTER(jsImportMetaObjectGetter_require, (JSGlobalObject * globalObject, EncodedJSValue thisValue, PropertyName propertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsImportMetaObjectGetter_require, (JSGlobalObject * globalObject, JSC::EncodedJSValue thisValue, PropertyName propertyName)) { ImportMetaObject* thisObject = jsDynamicCast(JSValue::decode(thisValue)); if (UNLIKELY(!thisObject)) diff --git a/src/bun.js/bindings/InternalModuleRegistry.cpp b/src/bun.js/bindings/InternalModuleRegistry.cpp index 03f94619260da..37b02c911d877 100644 --- a/src/bun.js/bindings/InternalModuleRegistry.cpp +++ b/src/bun.js/bindings/InternalModuleRegistry.cpp @@ -1,12 +1,12 @@ #include "InternalModuleRegistry.h" #include "ZigGlobalObject.h" -#include "JavaScriptCore/BuiltinUtils.h" -#include "JavaScriptCore/JSFunction.h" -#include "JavaScriptCore/LazyProperty.h" -#include "JavaScriptCore/LazyPropertyInlines.h" -#include "JavaScriptCore/VMTrapsInlines.h" -#include "JavaScriptCore/JSModuleLoader.h" +#include +#include +#include +#include +#include +#include #include "InternalModuleRegistryConstants.h" @@ -64,7 +64,6 @@ static void maybeAddCodeCoverage(JSC::VM& vm, const JSC::SourceCode& code) return result; #if BUN_DEBUG -#include "../../src/js/out/DebugPath.h" #define ASSERT_INTERNAL_MODULE(result, moduleName) \ if (!result || !result.isCell() || !jsDynamicCast(result)) { \ printf("Expected \"%s\" to export a JSObject. Bun is going to crash.", moduleName.utf8().data()); \ @@ -74,23 +73,21 @@ JSValue initializeInternalModuleFromDisk( VM& vm, WTF::String moduleName, WTF::String fileBase, - WTF::String fallback, WTF::String urlString) { - WTF::String file = makeString(BUN_DYNAMIC_JS_LOAD_PATH, "modules_dev/"_s, fileBase); + WTF::String file = makeString(BUN_DYNAMIC_JS_LOAD_PATH, "/"_s, fileBase); if (auto contents = WTF::FileSystemImpl::readEntireFile(file)) { auto string = WTF::String::fromUTF8(contents.value()); INTERNAL_MODULE_REGISTRY_GENERATE_(globalObject, vm, string, moduleName, urlString); } else { - printf("bun-debug failed to load bundled version of \"%s\" at \"%s\" (was it deleted?)\n" - "Please run `make js` to rebundle these builtins.\n", + printf("\nFATAL: bun-debug failed to load bundled version of \"%s\" at \"%s\" (was it deleted?)\n" + "Please re-compile Bun to continue.\n\n", moduleName.utf8().data(), file.utf8().data()); - // Fallback to embedded source - INTERNAL_MODULE_REGISTRY_GENERATE_(globalObject, vm, fallback, moduleName, urlString); + CRASH(); } } #define INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, moduleId, filename, SOURCE, urlString) \ - return initializeInternalModuleFromDisk(globalObject, vm, moduleId, filename, SOURCE, urlString) + return initializeInternalModuleFromDisk(globalObject, vm, moduleId, filename, urlString) #else #define ASSERT_INTERNAL_MODULE(result, moduleName) \ @@ -149,7 +146,7 @@ JSValue InternalModuleRegistry::requireId(JSGlobalObject* globalObject, VM& vm, return value; } -#include "../../../src/js/out/InternalModuleRegistry+createInternalModuleById.h" +#include "InternalModuleRegistry+createInternalModuleById.h" // This is called like @getInternalField(@internalModuleRegistry, 1) ?? @createInternalModuleById(1) // so we want to write it to the internal field when loaded. diff --git a/src/bun.js/bindings/InternalModuleRegistry.h b/src/bun.js/bindings/InternalModuleRegistry.h index 0944a382ae19f..922445c600bb7 100644 --- a/src/bun.js/bindings/InternalModuleRegistry.h +++ b/src/bun.js/bindings/InternalModuleRegistry.h @@ -1,9 +1,9 @@ #pragma once #include "root.h" -#include "JavaScriptCore/JSInternalFieldObjectImpl.h" -#include "JavaScriptCore/JSInternalFieldObjectImplInlines.h" +#include +#include #include "BunClientData.h" -#include "../../../src/js/out/InternalModuleRegistry+numberOfModules.h" +#include "InternalModuleRegistry+numberOfModules.h" namespace Bun { using namespace JSC; @@ -28,7 +28,7 @@ class InternalModuleRegistry : public JSInternalFieldObjectImpl& internalField(Field field) const { return Base::internalField(static_cast(field)); } diff --git a/src/bun.js/bindings/JSBuffer.cpp b/src/bun.js/bindings/JSBuffer.cpp index 543ef2ea38879..84435d6c44685 100644 --- a/src/bun.js/bindings/JSBuffer.cpp +++ b/src/bun.js/bindings/JSBuffer.cpp @@ -19,8 +19,8 @@ #include "JSDOMWrapperCache.h" #include "ScriptExecutionContext.h" #include "WebCoreJSClientData.h" -#include "JavaScriptCore/FunctionPrototype.h" -#include "JavaScriptCore/HeapAnalyzer.h" +#include +#include #include #include @@ -28,22 +28,26 @@ #include #include -#include "JavaScriptCore/JSDestructibleObjectHeapCellType.h" -#include "JavaScriptCore/SlotVisitorMacros.h" -#include "JavaScriptCore/SubspaceInlines.h" -#include "wtf/GetPtr.h" -#include "wtf/PointerPreparations.h" -#include "wtf/URL.h" -#include "wtf/text/WTFString.h" -#include "JavaScriptCore/BuiltinNames.h" +#include +#include +#include +#include +#include +#include +#include +#include #include "JSBufferEncodingType.h" -#include "JavaScriptCore/JSBase.h" +#include #if ENABLE(MEDIA_SOURCE) #include "BufferMediaSource.h" #include "JSMediaSource.h" #endif +#ifdef WIN32 +#include "musl-memmem.h" +#endif + #include #include "DOMJITIDLConvert.h" #include "DOMJITIDLType.h" @@ -51,8 +55,8 @@ #include "DOMJITHelpers.h" #include -// #include "JavaScriptCore/JSTypedArrayViewPrototype.h" -#include "JavaScriptCore/JSArrayBufferViewInlines.h" +// #include +#include using namespace JSC; using namespace WebCore; @@ -218,7 +222,7 @@ JSC::EncodedJSValue JSBuffer__bufferFromPointerAndLengthAndDeinit(JSC::JSGlobalO namespace WebCore { using namespace JSC; -static inline EncodedJSValue writeToBuffer(JSC::JSGlobalObject* lexicalGlobalObject, JSArrayBufferView* castedThis, JSString* str, uint32_t offset, uint32_t length, BufferEncodingType encoding) +static inline JSC::EncodedJSValue writeToBuffer(JSC::JSGlobalObject* lexicalGlobalObject, JSArrayBufferView* castedThis, JSString* str, uint32_t offset, uint32_t length, BufferEncodingType encoding) { if (UNLIKELY(str->length() == 0)) return JSC::JSValue::encode(JSC::jsNumber(0)); @@ -243,6 +247,9 @@ static inline EncodedJSValue writeToBuffer(JSC::JSGlobalObject* lexicalGlobalObj } break; } + default: { + break; + } } return JSC::JSValue::encode(JSC::jsNumber(written)); @@ -271,7 +278,7 @@ static inline JSC::JSUint8Array* JSBuffer__bufferFromLengthAsArray(JSC::JSGlobal RELEASE_AND_RETURN(throwScope, uint8Array); } -extern "C" EncodedJSValue JSBuffer__bufferFromLength(JSC::JSGlobalObject* lexicalGlobalObject, int64_t length) +extern "C" JSC::EncodedJSValue JSBuffer__bufferFromLength(JSC::JSGlobalObject* lexicalGlobalObject, int64_t length) { return JSC::JSValue::encode(JSBuffer__bufferFromLengthAsArray(lexicalGlobalObject, length)); } @@ -310,18 +317,18 @@ EncodedJSValue JSBuffer__bufferFromPointerAndLength(JSC::JSGlobalObject* lexical } // new Buffer() -static inline EncodedJSValue constructBufferEmpty(JSGlobalObject* lexicalGlobalObject) +static inline JSC::EncodedJSValue constructBufferEmpty(JSGlobalObject* lexicalGlobalObject) { return JSBuffer__bufferFromLength(lexicalGlobalObject, 0); } // new Buffer(size) -static inline EncodedJSValue constructBufferFromLength(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +static inline JSC::EncodedJSValue constructBufferFromLength(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) { return jsBufferConstructorFunction_allocUnsafeBody(lexicalGlobalObject, callFrame); } -static EncodedJSValue constructFromEncoding(JSGlobalObject* lexicalGlobalObject, JSString* str, WebCore::BufferEncodingType encoding) +static JSC::EncodedJSValue constructFromEncoding(JSGlobalObject* lexicalGlobalObject, JSString* str, WebCore::BufferEncodingType encoding) { auto& vm = JSC::getVM(lexicalGlobalObject); auto scope = DECLARE_THROW_SCOPE(vm); @@ -345,6 +352,9 @@ static EncodedJSValue constructFromEncoding(JSGlobalObject* lexicalGlobalObject, result = JSBuffer__bufferFromPointerAndLength(lexicalGlobalObject, view.characters8(), view.length()); break; } + default: { + break; + } } } else { switch (encoding) { @@ -364,6 +374,9 @@ static EncodedJSValue constructFromEncoding(JSGlobalObject* lexicalGlobalObject, result = JSBuffer__bufferFromPointerAndLength(lexicalGlobalObject, reinterpret_cast(view.characters16()), view.length() * 2); break; } + default: { + break; + } } } @@ -583,6 +596,9 @@ static inline JSC::EncodedJSValue jsBufferByteLengthFromStringAndEncoding(JSC::J } break; } + default: { + break; + } } RELEASE_AND_RETURN(scope, JSC::JSValue::encode(JSC::jsNumber(written))); diff --git a/src/bun.js/bindings/JSBuffer.h b/src/bun.js/bindings/JSBuffer.h index 9c1bf44cac248..05f906eb896f0 100644 --- a/src/bun.js/bindings/JSBuffer.h +++ b/src/bun.js/bindings/JSBuffer.h @@ -23,12 +23,18 @@ #include "root.h" #include -#include "wtf/NeverDestroyed.h" +#include #include "BufferEncodingType.h" -#include "Buffer.h" +#include "headers-handwritten.h" +extern "C" JSC::EncodedJSValue JSBuffer__bufferFromLength(JSC::JSGlobalObject* lexicalGlobalObject, int64_t length); +extern "C" JSC::EncodedJSValue JSBuffer__bufferFromPointerAndLengthAndDeinit(JSC::JSGlobalObject* lexicalGlobalObject, char* ptr, size_t length, void* ctx, JSTypedArrayBytesDeallocator bytesDeallocator); +extern "C" JSC::EncodedJSValue Bun__encoding__toString(const uint8_t* input, size_t len, JSC::JSGlobalObject* globalObject, Encoding encoding); +extern "C" JSC::EncodedJSValue Bun__encoding__toStringUTF8(const uint8_t* input, size_t len, JSC::JSGlobalObject* globalObject); +extern "C" bool Bun__Buffer_fill(ZigString*, void*, size_t, WebCore::BufferEncodingType); extern "C" bool JSBuffer__isBuffer(JSC::JSGlobalObject*, JSC::EncodedJSValue); + void toBuffer(JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSUint8Array* uint8Array); JSC::JSValue makeBuffer(JSC::JSGlobalObject* lexicalGlobalObject, unsigned int byteLength); JSC::JSValue makeBufferUnsafe(JSC::JSGlobalObject* lexicalGlobalObject, unsigned int byteLength); diff --git a/src/bun.js/bindings/JSBuffer.lut.h b/src/bun.js/bindings/JSBuffer.lut.h deleted file mode 100644 index 35a3acea931e8..0000000000000 --- a/src/bun.js/bindings/JSBuffer.lut.h +++ /dev/null @@ -1,52 +0,0 @@ -// File generated via `make static-hash-table` / `make cpp` -static const struct CompactHashIndex jsBufferConstructorTableIndex[33] = { - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 1, 32 }, - { 0, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 8, -1 }, - { 3, -1 }, - { -1, -1 }, - { 5, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 9, -1 }, - { -1, -1 }, - { 4, -1 }, - { -1, -1 }, - { 6, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 2, -1 }, - { -1, -1 }, - { 7, -1 }, -}; - -static const struct HashTableValue jsBufferConstructorTableValues[10] = { - { "alloc"_s, static_cast(PropertyAttribute::Constructable|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsBufferConstructorFunction_alloc, 1 } }, - { "allocUnsafe"_s, static_cast(PropertyAttribute::Constructable|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsBufferConstructorFunction_allocUnsafe, 1 } }, - { "allocUnsafeSlow"_s, static_cast(PropertyAttribute::Constructable|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsBufferConstructorFunction_allocUnsafeSlow, 1 } }, - { "byteLength"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsBufferConstructorFunction_byteLength, 2 } }, - { "compare"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsBufferConstructorFunction_compare, 2 } }, - { "concat"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsBufferConstructorFunction_concat, 2 } }, - { "from"_s, ((static_cast(PropertyAttribute::Builtin|PropertyAttribute::Function)) & ~PropertyAttribute::Function) | PropertyAttribute::Builtin, NoIntrinsic, { HashTableValue::BuiltinGeneratorType, jsBufferConstructorFromCodeGenerator, 1 } }, - { "isBuffer"_s, ((static_cast(PropertyAttribute::Builtin|PropertyAttribute::Function)) & ~PropertyAttribute::Function) | PropertyAttribute::Builtin, NoIntrinsic, { HashTableValue::BuiltinGeneratorType, jsBufferConstructorIsBufferCodeGenerator, 1 } }, - { "toBuffer"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsBufferConstructorFunction_toBuffer, 1 } }, - { "isEncoding"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsBufferConstructorFunction_isEncoding, 1 } }, -}; - -static const struct HashTable jsBufferConstructorTable = - { 10, 31, false, nullptr, jsBufferConstructorTableValues, jsBufferConstructorTableIndex }; diff --git a/src/bun.js/bindings/JSBufferEncodingType.cpp b/src/bun.js/bindings/JSBufferEncodingType.cpp index dde9e1be2725f..8645ee6914cd0 100644 --- a/src/bun.js/bindings/JSBufferEncodingType.cpp +++ b/src/bun.js/bindings/JSBufferEncodingType.cpp @@ -18,8 +18,6 @@ Boston, MA 02110-1301, USA. */ -#pragma once - #include "config.h" #include "JSBufferEncodingType.h" diff --git a/src/bun.js/bindings/JSBufferList.cpp b/src/bun.js/bindings/JSBufferList.cpp index 0db5527d742e3..e592fb96d2f33 100644 --- a/src/bun.js/bindings/JSBufferList.cpp +++ b/src/bun.js/bindings/JSBufferList.cpp @@ -1,7 +1,7 @@ #include "JSBufferList.h" #include "JSBuffer.h" -#include "JavaScriptCore/Lookup.h" -#include "JavaScriptCore/ObjectConstructor.h" +#include +#include #include "ZigGlobalObject.h" #include "JSDOMOperation.h" #include "headers.h" @@ -346,50 +346,49 @@ static inline JSC::EncodedJSValue jsBufferListPrototypeFunction_consumeBody(JSC: RELEASE_AND_RETURN(throwScope, JSC::JSValue::encode(castedThis->consume(vm, lexicalGlobalObject, n, hasString))); } -static JSC_DECLARE_HOST_FUNCTION(jsBufferListPrototypeFunction_push); -static JSC_DEFINE_HOST_FUNCTION(jsBufferListPrototypeFunction_push, +JSC_DEFINE_HOST_FUNCTION(jsBufferListPrototypeFunction_push, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { return IDLOperation::call(*globalObject, *callFrame, "push"); } -static JSC_DECLARE_HOST_FUNCTION(jsBufferListPrototypeFunction_unshift); -static JSC_DEFINE_HOST_FUNCTION(jsBufferListPrototypeFunction_unshift, + +JSC_DEFINE_HOST_FUNCTION(jsBufferListPrototypeFunction_unshift, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { return IDLOperation::call(*globalObject, *callFrame, "unshift"); } -static JSC_DECLARE_HOST_FUNCTION(jsBufferListPrototypeFunction_shift); -static JSC_DEFINE_HOST_FUNCTION(jsBufferListPrototypeFunction_shift, + +JSC_DEFINE_HOST_FUNCTION(jsBufferListPrototypeFunction_shift, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { return IDLOperation::call(*globalObject, *callFrame, "shift"); } -static JSC_DECLARE_HOST_FUNCTION(jsBufferListPrototypeFunction_clear); -static JSC_DEFINE_HOST_FUNCTION(jsBufferListPrototypeFunction_clear, + +JSC_DEFINE_HOST_FUNCTION(jsBufferListPrototypeFunction_clear, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { return IDLOperation::call(*globalObject, *callFrame, "clear"); } -static JSC_DECLARE_HOST_FUNCTION(jsBufferListPrototypeFunction_first); -static JSC_DEFINE_HOST_FUNCTION(jsBufferListPrototypeFunction_first, + +JSC_DEFINE_HOST_FUNCTION(jsBufferListPrototypeFunction_first, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { return IDLOperation::call(*globalObject, *callFrame, "first"); } -static JSC_DECLARE_HOST_FUNCTION(jsBufferListPrototypeFunction_concat); -static JSC_DEFINE_HOST_FUNCTION(jsBufferListPrototypeFunction_concat, + +JSC_DEFINE_HOST_FUNCTION(jsBufferListPrototypeFunction_concat, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { return IDLOperation::call(*globalObject, *callFrame, "concat"); } -static JSC_DECLARE_HOST_FUNCTION(jsBufferListPrototypeFunction_join); -static JSC_DEFINE_HOST_FUNCTION(jsBufferListPrototypeFunction_join, + +JSC_DEFINE_HOST_FUNCTION(jsBufferListPrototypeFunction_join, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { return IDLOperation::call(*globalObject, *callFrame, "join"); } -static JSC_DECLARE_HOST_FUNCTION(jsBufferListPrototypeFunction_consume); -static JSC_DEFINE_HOST_FUNCTION(jsBufferListPrototypeFunction_consume, + +JSC_DEFINE_HOST_FUNCTION(jsBufferListPrototypeFunction_consume, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { return IDLOperation::call(*globalObject, *callFrame, "consume"); diff --git a/src/bun.js/bindings/JSBufferList.h b/src/bun.js/bindings/JSBufferList.h index ebbc1781eea33..e4593c5fc6c46 100644 --- a/src/bun.js/bindings/JSBufferList.h +++ b/src/bun.js/bindings/JSBufferList.h @@ -1,7 +1,7 @@ #pragma once #include "root.h" -#include "wtf/Deque.h" +#include namespace WebCore { using namespace JSC; @@ -49,12 +49,12 @@ class JSBufferList : public JSC::JSNonFinalObject { inline size_t length() { return m_deque.size(); } void push(JSC::VM& vm, JSC::JSValue v) { - m_deque.append(WriteBarrier()); + m_deque.append(WriteBarrier()); m_deque.last().set(vm, this, v); } void unshift(JSC::VM& vm, JSC::JSValue v) { - m_deque.prepend(WriteBarrier()); + m_deque.prepend(WriteBarrier()); m_deque.first().set(vm, this, v); } JSC::JSValue shift() @@ -83,7 +83,7 @@ class JSBufferList : public JSC::JSNonFinalObject { JSC::JSValue _getString(JSC::VM&, JSC::JSGlobalObject*, size_t); private: - Deque> m_deque; + Deque> m_deque; }; class JSBufferListPrototype : public JSC::JSNonFinalObject { diff --git a/src/bun.js/bindings/JSBundlerPlugin.cpp b/src/bun.js/bindings/JSBundlerPlugin.cpp index d896d5b3d4a3d..d75f23d6a9dd9 100644 --- a/src/bun.js/bindings/JSBundlerPlugin.cpp +++ b/src/bun.js/bindings/JSBundlerPlugin.cpp @@ -1,24 +1,24 @@ #include "JSBundlerPlugin.h" #include "headers-handwritten.h" -#include "JavaScriptCore/CatchScope.h" -#include "JavaScriptCore/JSGlobalObject.h" -#include "JavaScriptCore/JSTypeInfo.h" -#include "JavaScriptCore/Structure.h" +#include +#include +#include +#include #include "helpers.h" #include "ZigGlobalObject.h" -#include "JavaScriptCore/JavaScript.h" -#include "JavaScriptCore/JSObjectInlines.h" -#include "wtf/text/WTFString.h" -#include "JavaScriptCore/JSCInlines.h" - -#include "JavaScriptCore/ObjectConstructor.h" -#include "JavaScriptCore/SubspaceInlines.h" -#include "JavaScriptCore/RegExpObject.h" -#include "JavaScriptCore/JSPromise.h" +#include +#include +#include +#include + +#include +#include +#include +#include #include "BunClientData.h" #include "ModuleLoader.h" -#include "JavaScriptCore/RegularExpression.h" +#include #include #include #include @@ -385,10 +385,10 @@ extern "C" Bun::JSBundlerPlugin* JSBundlerPlugin__create(Zig::GlobalObject* glob target); } -extern "C" EncodedJSValue JSBundlerPlugin__runSetupFunction( +extern "C" JSC::EncodedJSValue JSBundlerPlugin__runSetupFunction( Bun::JSBundlerPlugin* plugin, - EncodedJSValue encodedSetupFunction, - EncodedJSValue encodedConfig) + JSC::EncodedJSValue encodedSetupFunction, + JSC::EncodedJSValue encodedConfig) { auto& vm = plugin->vm(); auto scope = DECLARE_CATCH_SCOPE(vm); diff --git a/src/bun.js/bindings/JSBundlerPlugin.h b/src/bun.js/bindings/JSBundlerPlugin.h index 4d82cdc1bbaac..3a1f062243de0 100644 --- a/src/bun.js/bindings/JSBundlerPlugin.h +++ b/src/bun.js/bindings/JSBundlerPlugin.h @@ -2,9 +2,9 @@ #include "root.h" #include "headers-handwritten.h" -#include "JavaScriptCore/JSGlobalObject.h" -#include "JavaScriptCore/Strong.h" -#include "JavaScriptCore/RegularExpression.h" +#include +#include +#include #include "helpers.h" #include #include diff --git a/src/bun.js/bindings/JSCInlines.h b/src/bun.js/bindings/JSCInlines.h index 7c18714da6cbf..1e4910c3d5540 100644 --- a/src/bun.js/bindings/JSCInlines.h +++ b/src/bun.js/bindings/JSCInlines.h @@ -36,22 +36,22 @@ // In fact, it can make a lot of sense: outside of JSC, this file becomes a kind of umbrella // header that pulls in most (all?) of the interesting things in JSC. -#include "JavaScriptCore/ExceptionHelpers.h" -#include "JavaScriptCore/GCIncomingRefCountedInlines.h" -#include "JavaScriptCore/HeapInlines.h" -#include "JavaScriptCore/IdentifierInlines.h" -#include "JavaScriptCore/JSArrayBufferViewInlines.h" -#include "JavaScriptCore/JSCJSValueInlines.h" -#include "JavaScriptCore/JSCellInlines.h" -#include "JavaScriptCore/JSFunctionInlines.h" -#include "JavaScriptCore/JSGlobalObjectInlines.h" -#include "JavaScriptCore/JSObjectInlines.h" -#include "JavaScriptCore/JSGlobalProxy.h" -#include "JavaScriptCore/JSString.h" -#include "JavaScriptCore/Operations.h" -#include "JavaScriptCore/SlotVisitorInlines.h" -#include "JavaScriptCore/StrongInlines.h" -#include "JavaScriptCore/StructureInlines.h" -#include "JavaScriptCore/ThrowScope.h" -#include "JavaScriptCore/WeakGCMapInlines.h" -#include "JavaScriptCore/WeakGCSetInlines.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/src/bun.js/bindings/JSDOMBinding.h b/src/bun.js/bindings/JSDOMBinding.h index 607eafa780fc0..ef6cdf25f0581 100644 --- a/src/bun.js/bindings/JSDOMBinding.h +++ b/src/bun.js/bindings/JSDOMBinding.h @@ -3,18 +3,18 @@ #include "root.h" #include "ExceptionOr.h" -#include "JavaScriptCore/AuxiliaryBarrierInlines.h" -#include "JavaScriptCore/HeapInlines.h" -#include "JavaScriptCore/JSArray.h" -#include "JavaScriptCore/JSCJSValueInlines.h" -#include "JavaScriptCore/JSCellInlines.h" -#include "JavaScriptCore/JSObjectInlines.h" -#include "JavaScriptCore/Lookup.h" -#include "JavaScriptCore/ObjectConstructor.h" -#include "JavaScriptCore/SlotVisitorInlines.h" -#include "JavaScriptCore/StructureInlines.h" -#include "JavaScriptCore/WriteBarrier.h" -#include "wtf/Forward.h" -#include "wtf/GetPtr.h" -#include "wtf/Vector.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include diff --git a/src/bun.js/bindings/JSDOMExceptionHandling.cpp b/src/bun.js/bindings/JSDOMExceptionHandling.cpp index 38a55f7f2334a..e3f99710637ce 100644 --- a/src/bun.js/bindings/JSDOMExceptionHandling.cpp +++ b/src/bun.js/bindings/JSDOMExceptionHandling.cpp @@ -26,11 +26,11 @@ #include "JSDOMExceptionHandling.h" #include "JSDOMPromiseDeferred.h" -#include "JavaScriptCore/ErrorHandlingScope.h" -#include "JavaScriptCore/Exception.h" -#include "JavaScriptCore/ExceptionHelpers.h" -#include "JavaScriptCore/ScriptCallStack.h" -#include "JavaScriptCore/ScriptCallStackFactory.h" +#include +#include +#include +#include +#include #include "headers.h" #include "CachedScript.h" @@ -200,7 +200,7 @@ void propagateExceptionSlowPath(JSC::JSGlobalObject& lexicalGlobalObject, JSC::T throwException(&lexicalGlobalObject, throwScope, createDOMException(lexicalGlobalObject, WTFMove(exception))); } -static EncodedJSValue throwTypeError(JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope, const String& errorMessage) +static JSC::EncodedJSValue throwTypeError(JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope, const String& errorMessage) { return throwVMTypeError(&lexicalGlobalObject, scope, errorMessage); } diff --git a/src/bun.js/bindings/JSDOMExceptionHandling.h b/src/bun.js/bindings/JSDOMExceptionHandling.h index 01dc44790340f..97153d5aa9fd4 100644 --- a/src/bun.js/bindings/JSDOMExceptionHandling.h +++ b/src/bun.js/bindings/JSDOMExceptionHandling.h @@ -27,7 +27,7 @@ #include "ExceptionDetails.h" #include "ExceptionOr.h" -#include "JavaScriptCore/ThrowScope.h" +#include namespace JSC { class CatchScope; diff --git a/src/bun.js/bindings/JSDOMFile.cpp b/src/bun.js/bindings/JSDOMFile.cpp index 1e1f9f2bce436..4e0e4bf48270d 100644 --- a/src/bun.js/bindings/JSDOMFile.cpp +++ b/src/bun.js/bindings/JSDOMFile.cpp @@ -1,8 +1,8 @@ #include "root.h" #include "ZigGeneratedClasses.h" -#include "JavaScriptCore/ObjectConstructor.h" -#include "JavaScriptCore/InternalFunction.h" -#include "JavaScriptCore/FunctionPrototype.h" +#include +#include +#include #include "JSDOMFile.h" using namespace JSC; @@ -63,7 +63,7 @@ class JSDOMFile : public JSC::InternalFunction { return JSDOMFile__hasInstance(JSValue::encode(object), globalObject, JSValue::encode(value)); } - static EncodedJSValue construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) + static JSC::EncodedJSValue construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) { Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); JSC::VM& vm = globalObject->vm(); @@ -97,6 +97,7 @@ class JSDOMFile : public JSC::InternalFunction { { auto scope = DECLARE_THROW_SCOPE(lexicalGlobalObject->vm()); throwTypeError(lexicalGlobalObject, scope, "Class constructor File cannot be invoked without 'new"_s); + return {}; } }; diff --git a/src/bun.js/bindings/JSDOMGlobalObject.cpp b/src/bun.js/bindings/JSDOMGlobalObject.cpp index cc0bb87dea486..f90268828d1a2 100644 --- a/src/bun.js/bindings/JSDOMGlobalObject.cpp +++ b/src/bun.js/bindings/JSDOMGlobalObject.cpp @@ -1,5 +1,5 @@ #include "JSDOMGlobalObject.h" -#include "JavaScriptCore/JSCast.h" +#include #include "ZigGlobalObject.h" namespace WebCore { diff --git a/src/bun.js/bindings/JSDOMGlobalObject.h b/src/bun.js/bindings/JSDOMGlobalObject.h index 0249362d9858e..03a8569e0c9d2 100644 --- a/src/bun.js/bindings/JSDOMGlobalObject.h +++ b/src/bun.js/bindings/JSDOMGlobalObject.h @@ -4,10 +4,10 @@ #include "DOMWrapperWorld.h" -#include "JavaScriptCore/HeapInlines.h" -#include "JavaScriptCore/JSGlobalObject.h" -#include "JavaScriptCore/JSObjectInlines.h" -#include "JavaScriptCore/WeakGCMap.h" +#include +#include +#include +#include #include "ScriptExecutionContext.h" namespace WebCore { diff --git a/src/bun.js/bindings/JSDOMWrapper.cpp b/src/bun.js/bindings/JSDOMWrapper.cpp index 3af4dff5ed648..2530679c7ac2e 100644 --- a/src/bun.js/bindings/JSDOMWrapper.cpp +++ b/src/bun.js/bindings/JSDOMWrapper.cpp @@ -33,7 +33,7 @@ // #include "JSDOMWindow.h" // #include "JSRemoteDOMWindow.h" // #include "SerializedScriptValue.h" -// #include "JavaScriptCore/Error.h" +// #include namespace WebCore { diff --git a/src/bun.js/bindings/JSDOMWrapper.h b/src/bun.js/bindings/JSDOMWrapper.h index f80585e72b3d3..5d24fbc7fabe5 100644 --- a/src/bun.js/bindings/JSDOMWrapper.h +++ b/src/bun.js/bindings/JSDOMWrapper.h @@ -25,8 +25,8 @@ #include "JSDOMGlobalObject.h" #include "ZigGlobalObject.h" #include "NodeConstants.h" -#include "JavaScriptCore/JSDestructibleObject.h" -#include "wtf/SignedPtr.h" +#include +#include namespace WebCore { using namespace Zig; diff --git a/src/bun.js/bindings/JSDOMWrapperCache.cpp b/src/bun.js/bindings/JSDOMWrapperCache.cpp index 662462bac5e32..a48bd13115206 100644 --- a/src/bun.js/bindings/JSDOMWrapperCache.cpp +++ b/src/bun.js/bindings/JSDOMWrapperCache.cpp @@ -35,7 +35,7 @@ Structure* cacheDOMStructure(JSDOMGlobalObject& globalObject, Structure* structu { auto addToStructures = [](JSDOMStructureMap& structures, JSDOMGlobalObject& globalObject, Structure* structure, const ClassInfo* classInfo) { ASSERT(!structures.contains(classInfo)); - return structures.set(classInfo, WriteBarrier(globalObject.vm(), &globalObject, structure)).iterator->value.get(); + return structures.set(classInfo, JSC::WriteBarrier(globalObject.vm(), &globalObject, structure)).iterator->value.get(); }; if (globalObject.vm().heap.mutatorShouldBeFenced()) { Locker locker { globalObject.gcLock() }; diff --git a/src/bun.js/bindings/JSEnvironmentVariableMap.cpp b/src/bun.js/bindings/JSEnvironmentVariableMap.cpp index 4942b300fa8ea..9e65b1854801e 100644 --- a/src/bun.js/bindings/JSEnvironmentVariableMap.cpp +++ b/src/bun.js/bindings/JSEnvironmentVariableMap.cpp @@ -3,8 +3,8 @@ #include "helpers.h" -#include "JavaScriptCore/JSObject.h" -#include "JavaScriptCore/ObjectConstructor.h" +#include +#include #include "BunClientData.h" using namespace JSC; @@ -17,7 +17,7 @@ namespace Bun { using namespace WebCore; -JSC_DEFINE_CUSTOM_GETTER(jsGetterEnvironmentVariable, (JSGlobalObject * globalObject, EncodedJSValue thisValue, PropertyName propertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsGetterEnvironmentVariable, (JSGlobalObject * globalObject, JSC::EncodedJSValue thisValue, PropertyName propertyName)) { VM& vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); @@ -41,7 +41,7 @@ JSC_DEFINE_CUSTOM_GETTER(jsGetterEnvironmentVariable, (JSGlobalObject * globalOb return JSValue::encode(result); } -JSC_DEFINE_CUSTOM_SETTER(jsSetterEnvironmentVariable, (JSGlobalObject * globalObject, EncodedJSValue thisValue, EncodedJSValue value, PropertyName propertyName)) +JSC_DEFINE_CUSTOM_SETTER(jsSetterEnvironmentVariable, (JSGlobalObject * globalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue value, PropertyName propertyName)) { VM& vm = globalObject->vm(); JSC::JSObject* object = JSValue::decode(thisValue).getObject(); @@ -52,7 +52,7 @@ JSC_DEFINE_CUSTOM_SETTER(jsSetterEnvironmentVariable, (JSGlobalObject * globalOb return true; } -JSC_DEFINE_CUSTOM_GETTER(jsTimeZoneEnvironmentVariableGetter, (JSGlobalObject * globalObject, EncodedJSValue thisValue, PropertyName propertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsTimeZoneEnvironmentVariableGetter, (JSGlobalObject * globalObject, JSC::EncodedJSValue thisValue, PropertyName propertyName)) { VM& vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); @@ -83,7 +83,7 @@ JSC_DEFINE_CUSTOM_GETTER(jsTimeZoneEnvironmentVariableGetter, (JSGlobalObject * // In Node.js, the "TZ" environment variable is special. // Setting it automatically updates the timezone. // We also expose an explicit setTimeZone function in bun:jsc -JSC_DEFINE_CUSTOM_SETTER(jsTimeZoneEnvironmentVariableSetter, (JSGlobalObject * globalObject, EncodedJSValue thisValue, EncodedJSValue value, PropertyName propertyName)) +JSC_DEFINE_CUSTOM_SETTER(jsTimeZoneEnvironmentVariableSetter, (JSGlobalObject * globalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue value, PropertyName propertyName)) { VM& vm = globalObject->vm(); JSC::JSObject* object = JSValue::decode(thisValue).getObject(); diff --git a/src/bun.js/bindings/JSFFIFunction.cpp b/src/bun.js/bindings/JSFFIFunction.cpp index 71a53be4c5df2..ac4120c2d5e53 100644 --- a/src/bun.js/bindings/JSFFIFunction.cpp +++ b/src/bun.js/bindings/JSFFIFunction.cpp @@ -26,8 +26,8 @@ #include "root.h" #include "JSFFIFunction.h" -#include "JavaScriptCore/JSCJSValueInlines.h" -#include "JavaScriptCore/VM.h" +#include +#include #include "ZigGlobalObject.h" #include diff --git a/src/bun.js/bindings/JSFFIFunction.h b/src/bun.js/bindings/JSFFIFunction.h index 1ec37f76753ff..e186c730362da 100644 --- a/src/bun.js/bindings/JSFFIFunction.h +++ b/src/bun.js/bindings/JSFFIFunction.h @@ -5,12 +5,12 @@ class GlobalObject; } #include "root.h" -#include "JavaScriptCore/JSFunction.h" -#include "JavaScriptCore/VM.h" +#include +#include #include "headers-handwritten.h" #include "BunClientData.h" -#include "JavaScriptCore/CallFrame.h" +#include namespace JSC { class JSGlobalObject; diff --git a/src/bun.js/bindings/JSMockFunction.cpp b/src/bun.js/bindings/JSMockFunction.cpp index fac62830b5974..15675117f23f4 100644 --- a/src/bun.js/bindings/JSMockFunction.cpp +++ b/src/bun.js/bindings/JSMockFunction.cpp @@ -4,16 +4,16 @@ #include #include "ZigGlobalObject.h" #include -#include "JavaScriptCore/Completion.h" -#include "JavaScriptCore/ObjectConstructor.h" +#include +#include #include "ExtendedDOMClientIsoSubspaces.h" #include "ExtendedDOMIsoSubspaces.h" #include "BunClientData.h" -#include "JavaScriptCore/LazyProperty.h" -#include "JavaScriptCore/JSCJSValueInlines.h" -#include "JavaScriptCore/JSInternalPromise.h" -#include "JavaScriptCore/LazyPropertyInlines.h" -#include "JavaScriptCore/VMTrapsInlines.h" +#include +#include +#include +#include +#include #include #include #include @@ -69,22 +69,22 @@ JSC_DECLARE_HOST_FUNCTION(jsMockFunctionWithImplementationCleanup); JSC_DECLARE_HOST_FUNCTION(jsMockFunctionWithImplementation); // This is a stub. Exists so that the same code can be run in Jest -extern "C" EncodedJSValue JSMock__jsUseFakeTimers(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame) +extern "C" JSC::EncodedJSValue JSMock__jsUseFakeTimers(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame) { return JSValue::encode(callFrame->thisValue()); } -extern "C" EncodedJSValue JSMock__jsUseRealTimers(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame) +extern "C" JSC::EncodedJSValue JSMock__jsUseRealTimers(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame) { globalObject->overridenDateNow = -1; return JSValue::encode(callFrame->thisValue()); } -extern "C" EncodedJSValue JSMock__jsNow(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame) +extern "C" JSC::EncodedJSValue JSMock__jsNow(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame) { return JSValue::encode(jsNumber(globalObject->jsDateNow())); } -extern "C" EncodedJSValue JSMock__jsSetSystemTime(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame) +extern "C" JSC::EncodedJSValue JSMock__jsSetSystemTime(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame) { JSValue argument0 = callFrame->argument(0); @@ -171,13 +171,13 @@ class JSMockImplementation final : public JSNonFinalObject { } // either a function or a return value, depends on kind - mutable JSC::WriteBarrier underlyingValue; + mutable JSC::WriteBarrier underlyingValue; // a combination of a pointer to the next implementation and a flag indicating if this is a once implementation // - undefined - no next value // - jsNumber(1) - no next value + is a once implementation // - JSMockImplementation - next value + is a once implementation - mutable JSC::WriteBarrier nextValueOrSentinel; + mutable JSC::WriteBarrier nextValueOrSentinel; DECLARE_EXPORT_INFO; DECLARE_VISIT_CHILDREN; @@ -571,13 +571,13 @@ extern "C" void JSMock__resetSpies(Zig::GlobalObject* globalObject) globalObject->mockModule.activeSpies.clear(); } -extern "C" EncodedJSValue JSMock__jsRestoreAllMocks(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callframe) +extern "C" JSC::EncodedJSValue JSMock__jsRestoreAllMocks(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callframe) { JSMock__resetSpies(jsCast(globalObject)); return JSValue::encode(jsUndefined()); } -extern "C" EncodedJSValue JSMock__jsSpyOn(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callframe) +extern "C" JSC::EncodedJSValue JSMock__jsSpyOn(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callframe) { auto& vm = lexicalGlobalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); @@ -1037,7 +1037,7 @@ JSC_DEFINE_CUSTOM_GETTER(jsMockFunctionGetter_protoImpl, (JSC::JSGlobalObject * return JSValue::encode(jsUndefined()); } -extern "C" EncodedJSValue JSMock__jsMockFn(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callframe) +extern "C" JSC::EncodedJSValue JSMock__jsMockFn(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callframe) { auto& vm = lexicalGlobalObject->vm(); auto* globalObject = jsCast(lexicalGlobalObject); @@ -1071,7 +1071,7 @@ extern "C" EncodedJSValue JSMock__jsMockFn(JSC::JSGlobalObject* lexicalGlobalObj return JSValue::encode(thisObject); } -extern "C" EncodedJSValue JSMockFunction__getCalls(EncodedJSValue encodedValue) +extern "C" JSC::EncodedJSValue JSMockFunction__getCalls(EncodedJSValue encodedValue) { JSValue value = JSValue::decode(encodedValue); if (auto* mock = tryJSDynamicCast(value)) { @@ -1080,7 +1080,7 @@ extern "C" EncodedJSValue JSMockFunction__getCalls(EncodedJSValue encodedValue) return JSValue::encode({}); } -extern "C" EncodedJSValue JSMockFunction__getReturns(EncodedJSValue encodedValue) +extern "C" JSC::EncodedJSValue JSMockFunction__getReturns(EncodedJSValue encodedValue) { JSValue value = JSValue::decode(encodedValue); if (auto* mock = tryJSDynamicCast(value)) { diff --git a/src/bun.js/bindings/JSMockFunction.h b/src/bun.js/bindings/JSMockFunction.h index 592481ef807f7..1b8e2b995de94 100644 --- a/src/bun.js/bindings/JSMockFunction.h +++ b/src/bun.js/bindings/JSMockFunction.h @@ -1,8 +1,8 @@ #pragma once #include "root.h" -#include "JavaScriptCore/LazyProperty.h" -#include "JavaScriptCore/Strong.h" +#include +#include namespace WebCore { } @@ -30,7 +30,7 @@ class JSMockModule final { static JSMockModule create(JSC::JSGlobalObject*); - JSC::Strong activeSpies; + JSC::Strong activeSpies; }; class MockWithImplementationCleanupData : public JSC::JSInternalFieldObjectImpl<4> { diff --git a/src/bun.js/bindings/JSSink.cpp b/src/bun.js/bindings/JSSink.cpp deleted file mode 100644 index ef63438499870..0000000000000 --- a/src/bun.js/bindings/JSSink.cpp +++ /dev/null @@ -1,2133 +0,0 @@ - -// AUTO-GENERATED FILE. DO NOT EDIT. -// Generated by 'make generate-sink' -// To regenerate this file, run: -// -// make generate-sink -// -#include "root.h" -#include "headers.h" -#include "BunClientData.h" - -#include "JSSink.h" -#include "AsyncContextFrame.h" - -#include "ActiveDOMObject.h" -#include "ExtendedDOMClientIsoSubspaces.h" -#include "ExtendedDOMIsoSubspaces.h" -#include "IDLTypes.h" -// #include "JSBlob.h" -#include "JSDOMAttribute.h" -#include "JSDOMBinding.h" -#include "JSDOMConstructor.h" -#include "JSDOMConvertBase.h" -#include "JSDOMConvertInterface.h" -#include "JSDOMConvertStrings.h" -#include "JSDOMExceptionHandling.h" -#include "JSDOMGlobalObject.h" -#include "JSDOMGlobalObjectInlines.h" -#include "JSDOMOperation.h" -#include "JSDOMWrapperCache.h" -#include "ScriptExecutionContext.h" -#include "WebCoreJSClientData.h" -#include "JavaScriptCore/FunctionPrototype.h" -#include "JavaScriptCore/HeapAnalyzer.h" - -#include "JavaScriptCore/JSDestructibleObjectHeapCellType.h" -#include "JavaScriptCore/SlotVisitorMacros.h" -#include "JavaScriptCore/SubspaceInlines.h" -#include "wtf/GetPtr.h" -#include "wtf/PointerPreparations.h" -#include "wtf/URL.h" -#include "JavaScriptCore/BuiltinNames.h" - -#include "JSBufferEncodingType.h" -#include "JavaScriptCore/JSBase.h" -#if ENABLE(MEDIA_SOURCE) -#include "BufferMediaSource.h" -#include "JSMediaSource.h" -#endif - -// #include "JavaScriptCore/JSTypedArrayViewPrototype.h" -#include "JavaScriptCore/JSArrayBufferViewInlines.h" - -#include "JSReadableStream.h" -#include "BunClientData.h" -#include "JavaScriptCore/Weak.h" -#include "JavaScriptCore/WeakInlines.h" - -namespace WebCore { -using namespace JSC; - -JSC_DEFINE_HOST_FUNCTION(functionStartDirectStream, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) -{ - - auto& vm = lexicalGlobalObject->vm(); - auto scope = DECLARE_THROW_SCOPE(vm); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - - JSC::JSValue readableStream = callFrame->argument(0); - JSC::JSValue onPull = callFrame->argument(1); - JSC::JSValue onClose = callFrame->argument(2); - JSC::JSValue asyncContext = callFrame->argument(3); - - if (!readableStream.isObject()) { - scope.throwException(globalObject, JSC::createTypeError(globalObject, "Expected ReadableStream"_s)); - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - if (!onPull.isObject() || !onPull.isCallable()) { - onPull = JSC::jsUndefined(); - } else if (!asyncContext.isUndefined()) { - onPull = AsyncContextFrame::create(globalObject, onPull, asyncContext); - } - - if (!onClose.isObject() || !onClose.isCallable()) { - onClose = JSC::jsUndefined(); - } else if (!asyncContext.isUndefined()) { - onClose = AsyncContextFrame::create(globalObject, onClose, asyncContext); - } - - if (WebCore::JSReadableArrayBufferSinkController* ArrayBufferSinkController = JSC::jsDynamicCast(callFrame->thisValue())) { - if (ArrayBufferSinkController->wrapped() == nullptr) { - scope.throwException(globalObject, JSC::createTypeError(globalObject, "Cannot start stream with closed controller"_s)); - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - ArrayBufferSinkController->start(globalObject, readableStream, onPull, onClose); - } - - else if (WebCore::JSReadableFileSinkController* FileSinkController = JSC::jsDynamicCast(callFrame->thisValue())) { - if (FileSinkController->wrapped() == nullptr) { - scope.throwException(globalObject, JSC::createTypeError(globalObject, "Cannot start stream with closed controller"_s)); - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - FileSinkController->start(globalObject, readableStream, onPull, onClose); - } - - else if (WebCore::JSReadableHTTPResponseSinkController* HTTPResponseSinkController = JSC::jsDynamicCast(callFrame->thisValue())) { - if (HTTPResponseSinkController->wrapped() == nullptr) { - scope.throwException(globalObject, JSC::createTypeError(globalObject, "Cannot start stream with closed controller"_s)); - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - HTTPResponseSinkController->start(globalObject, readableStream, onPull, onClose); - } - - else if (WebCore::JSReadableHTTPSResponseSinkController* HTTPSResponseSinkController = JSC::jsDynamicCast(callFrame->thisValue())) { - if (HTTPSResponseSinkController->wrapped() == nullptr) { - scope.throwException(globalObject, JSC::createTypeError(globalObject, "Cannot start stream with closed controller"_s)); - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - HTTPSResponseSinkController->start(globalObject, readableStream, onPull, onClose); - } - - else { - scope.throwException(globalObject, JSC::createTypeError(globalObject, "Unknown direct controller. This is a bug in Bun."_s)); - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - RELEASE_AND_RETURN(scope, JSC::JSValue::encode(JSC::jsUndefined())); -} - -void JSArrayBufferSink::ref() -{ - if (!m_sinkPtr) - return; - - m_refCount++; - if (m_refCount == 1) { - ArrayBufferSink__updateRef(m_sinkPtr, true); - } -} - -void JSArrayBufferSink::unref() -{ - if (!m_sinkPtr) - return; - - m_refCount = std::max(0, m_refCount - 1); - if (!m_refCount) { - ArrayBufferSink__updateRef(m_sinkPtr, false); - } -} - -JSC_DEFINE_HOST_FUNCTION(ArrayBufferSink__ref, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - auto* sink = jsDynamicCast(callFrame->thisValue()); - if (LIKELY(sink)) { - sink->ref(); - } - return JSC::JSValue::encode(JSC::jsUndefined()); -} - -JSC_DEFINE_HOST_FUNCTION(ArrayBufferSink__unref, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - auto* sink = jsDynamicCast(callFrame->thisValue()); - if (LIKELY(sink)) { - sink->unref(); - } - return JSC::JSValue::encode(JSC::jsUndefined()); -} - -JSC_DEFINE_CUSTOM_GETTER(functionArrayBufferSink__getter, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - - return JSC::JSValue::encode(globalObject->ArrayBufferSink()); -} - -JSC_DECLARE_HOST_FUNCTION(JSReadableArrayBufferSinkController__close); -JSC_DEFINE_HOST_FUNCTION(JSReadableArrayBufferSinkController__close, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) -{ - - auto& vm = lexicalGlobalObject->vm(); - auto scope = DECLARE_THROW_SCOPE(vm); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - WebCore::JSReadableArrayBufferSinkController* controller = JSC::jsDynamicCast(callFrame->thisValue()); - if (!controller) { - scope.throwException(globalObject, JSC::createTypeError(globalObject, "Expected JSReadableArrayBufferSinkController"_s)); - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - void* ptr = controller->wrapped(); - if (ptr == nullptr) { - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - controller->detach(); - ArrayBufferSink__close(lexicalGlobalObject, ptr); - return JSC::JSValue::encode(JSC::jsUndefined()); -} - -JSC_DECLARE_HOST_FUNCTION(JSReadableArrayBufferSinkController__end); -JSC_DEFINE_HOST_FUNCTION(JSReadableArrayBufferSinkController__end, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) -{ - - auto& vm = lexicalGlobalObject->vm(); - auto scope = DECLARE_THROW_SCOPE(vm); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - WebCore::JSReadableArrayBufferSinkController* controller = JSC::jsDynamicCast(callFrame->thisValue()); - if (!controller) { - scope.throwException(globalObject, JSC::createTypeError(globalObject, "Expected JSReadableArrayBufferSinkController"_s)); - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - void* ptr = controller->wrapped(); - if (ptr == nullptr) { - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - controller->detach(); - return ArrayBufferSink__endWithSink(ptr, lexicalGlobalObject); -} - -JSC_DECLARE_HOST_FUNCTION(ArrayBufferSink__doClose); -JSC_DEFINE_HOST_FUNCTION(ArrayBufferSink__doClose, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) -{ - - auto& vm = lexicalGlobalObject->vm(); - auto scope = DECLARE_THROW_SCOPE(vm); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - WebCore::JSArrayBufferSink* sink = JSC::jsDynamicCast(callFrame->thisValue()); - if (!sink) { - scope.throwException(globalObject, JSC::createTypeError(globalObject, "Expected ArrayBufferSink"_s)); - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - void* ptr = sink->wrapped(); - if (ptr == nullptr) { - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - sink->detach(); - ArrayBufferSink__close(lexicalGlobalObject, ptr); - return JSC::JSValue::encode(JSC::jsUndefined()); -} - -void JSFileSink::ref() -{ - if (!m_sinkPtr) - return; - - m_refCount++; - if (m_refCount == 1) { - FileSink__updateRef(m_sinkPtr, true); - } -} - -void JSFileSink::unref() -{ - if (!m_sinkPtr) - return; - - m_refCount = std::max(0, m_refCount - 1); - if (!m_refCount) { - FileSink__updateRef(m_sinkPtr, false); - } -} - -JSC_DEFINE_HOST_FUNCTION(FileSink__ref, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - auto* sink = jsDynamicCast(callFrame->thisValue()); - if (LIKELY(sink)) { - sink->ref(); - } - return JSC::JSValue::encode(JSC::jsUndefined()); -} - -JSC_DEFINE_HOST_FUNCTION(FileSink__unref, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - auto* sink = jsDynamicCast(callFrame->thisValue()); - if (LIKELY(sink)) { - sink->unref(); - } - return JSC::JSValue::encode(JSC::jsUndefined()); -} - -JSC_DEFINE_CUSTOM_GETTER(functionFileSink__getter, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - - return JSC::JSValue::encode(globalObject->FileSink()); -} - -JSC_DECLARE_HOST_FUNCTION(JSReadableFileSinkController__close); -JSC_DEFINE_HOST_FUNCTION(JSReadableFileSinkController__close, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) -{ - - auto& vm = lexicalGlobalObject->vm(); - auto scope = DECLARE_THROW_SCOPE(vm); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - WebCore::JSReadableFileSinkController* controller = JSC::jsDynamicCast(callFrame->thisValue()); - if (!controller) { - scope.throwException(globalObject, JSC::createTypeError(globalObject, "Expected JSReadableFileSinkController"_s)); - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - void* ptr = controller->wrapped(); - if (ptr == nullptr) { - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - controller->detach(); - FileSink__close(lexicalGlobalObject, ptr); - return JSC::JSValue::encode(JSC::jsUndefined()); -} - -JSC_DECLARE_HOST_FUNCTION(JSReadableFileSinkController__end); -JSC_DEFINE_HOST_FUNCTION(JSReadableFileSinkController__end, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) -{ - - auto& vm = lexicalGlobalObject->vm(); - auto scope = DECLARE_THROW_SCOPE(vm); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - WebCore::JSReadableFileSinkController* controller = JSC::jsDynamicCast(callFrame->thisValue()); - if (!controller) { - scope.throwException(globalObject, JSC::createTypeError(globalObject, "Expected JSReadableFileSinkController"_s)); - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - void* ptr = controller->wrapped(); - if (ptr == nullptr) { - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - controller->detach(); - return FileSink__endWithSink(ptr, lexicalGlobalObject); -} - -JSC_DECLARE_HOST_FUNCTION(FileSink__doClose); -JSC_DEFINE_HOST_FUNCTION(FileSink__doClose, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) -{ - - auto& vm = lexicalGlobalObject->vm(); - auto scope = DECLARE_THROW_SCOPE(vm); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - WebCore::JSFileSink* sink = JSC::jsDynamicCast(callFrame->thisValue()); - if (!sink) { - scope.throwException(globalObject, JSC::createTypeError(globalObject, "Expected FileSink"_s)); - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - void* ptr = sink->wrapped(); - if (ptr == nullptr) { - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - sink->detach(); - FileSink__close(lexicalGlobalObject, ptr); - return JSC::JSValue::encode(JSC::jsUndefined()); -} - -void JSHTTPResponseSink::ref() -{ - if (!m_sinkPtr) - return; - - m_refCount++; - if (m_refCount == 1) { - HTTPResponseSink__updateRef(m_sinkPtr, true); - } -} - -void JSHTTPResponseSink::unref() -{ - if (!m_sinkPtr) - return; - - m_refCount = std::max(0, m_refCount - 1); - if (!m_refCount) { - HTTPResponseSink__updateRef(m_sinkPtr, false); - } -} - -JSC_DEFINE_HOST_FUNCTION(HTTPResponseSink__ref, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - auto* sink = jsDynamicCast(callFrame->thisValue()); - if (LIKELY(sink)) { - sink->ref(); - } - return JSC::JSValue::encode(JSC::jsUndefined()); -} - -JSC_DEFINE_HOST_FUNCTION(HTTPResponseSink__unref, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - auto* sink = jsDynamicCast(callFrame->thisValue()); - if (LIKELY(sink)) { - sink->unref(); - } - return JSC::JSValue::encode(JSC::jsUndefined()); -} - -JSC_DEFINE_CUSTOM_GETTER(functionHTTPResponseSink__getter, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - - return JSC::JSValue::encode(globalObject->HTTPResponseSink()); -} - -JSC_DECLARE_HOST_FUNCTION(JSReadableHTTPResponseSinkController__close); -JSC_DEFINE_HOST_FUNCTION(JSReadableHTTPResponseSinkController__close, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) -{ - - auto& vm = lexicalGlobalObject->vm(); - auto scope = DECLARE_THROW_SCOPE(vm); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - WebCore::JSReadableHTTPResponseSinkController* controller = JSC::jsDynamicCast(callFrame->thisValue()); - if (!controller) { - scope.throwException(globalObject, JSC::createTypeError(globalObject, "Expected JSReadableHTTPResponseSinkController"_s)); - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - void* ptr = controller->wrapped(); - if (ptr == nullptr) { - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - controller->detach(); - HTTPResponseSink__close(lexicalGlobalObject, ptr); - return JSC::JSValue::encode(JSC::jsUndefined()); -} - -JSC_DECLARE_HOST_FUNCTION(JSReadableHTTPResponseSinkController__end); -JSC_DEFINE_HOST_FUNCTION(JSReadableHTTPResponseSinkController__end, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) -{ - - auto& vm = lexicalGlobalObject->vm(); - auto scope = DECLARE_THROW_SCOPE(vm); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - WebCore::JSReadableHTTPResponseSinkController* controller = JSC::jsDynamicCast(callFrame->thisValue()); - if (!controller) { - scope.throwException(globalObject, JSC::createTypeError(globalObject, "Expected JSReadableHTTPResponseSinkController"_s)); - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - void* ptr = controller->wrapped(); - if (ptr == nullptr) { - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - controller->detach(); - return HTTPResponseSink__endWithSink(ptr, lexicalGlobalObject); -} - -JSC_DECLARE_HOST_FUNCTION(HTTPResponseSink__doClose); -JSC_DEFINE_HOST_FUNCTION(HTTPResponseSink__doClose, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) -{ - - auto& vm = lexicalGlobalObject->vm(); - auto scope = DECLARE_THROW_SCOPE(vm); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - WebCore::JSHTTPResponseSink* sink = JSC::jsDynamicCast(callFrame->thisValue()); - if (!sink) { - scope.throwException(globalObject, JSC::createTypeError(globalObject, "Expected HTTPResponseSink"_s)); - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - void* ptr = sink->wrapped(); - if (ptr == nullptr) { - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - sink->detach(); - HTTPResponseSink__close(lexicalGlobalObject, ptr); - return JSC::JSValue::encode(JSC::jsUndefined()); -} - -void JSHTTPSResponseSink::ref() -{ - if (!m_sinkPtr) - return; - - m_refCount++; - if (m_refCount == 1) { - HTTPSResponseSink__updateRef(m_sinkPtr, true); - } -} - -void JSHTTPSResponseSink::unref() -{ - if (!m_sinkPtr) - return; - - m_refCount = std::max(0, m_refCount - 1); - if (!m_refCount) { - HTTPSResponseSink__updateRef(m_sinkPtr, false); - } -} - -JSC_DEFINE_HOST_FUNCTION(HTTPSResponseSink__ref, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - auto* sink = jsDynamicCast(callFrame->thisValue()); - if (LIKELY(sink)) { - sink->ref(); - } - return JSC::JSValue::encode(JSC::jsUndefined()); -} - -JSC_DEFINE_HOST_FUNCTION(HTTPSResponseSink__unref, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - auto* sink = jsDynamicCast(callFrame->thisValue()); - if (LIKELY(sink)) { - sink->unref(); - } - return JSC::JSValue::encode(JSC::jsUndefined()); -} - -JSC_DEFINE_CUSTOM_GETTER(functionHTTPSResponseSink__getter, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - - return JSC::JSValue::encode(globalObject->HTTPSResponseSink()); -} - -JSC_DECLARE_HOST_FUNCTION(JSReadableHTTPSResponseSinkController__close); -JSC_DEFINE_HOST_FUNCTION(JSReadableHTTPSResponseSinkController__close, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) -{ - - auto& vm = lexicalGlobalObject->vm(); - auto scope = DECLARE_THROW_SCOPE(vm); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - WebCore::JSReadableHTTPSResponseSinkController* controller = JSC::jsDynamicCast(callFrame->thisValue()); - if (!controller) { - scope.throwException(globalObject, JSC::createTypeError(globalObject, "Expected JSReadableHTTPSResponseSinkController"_s)); - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - void* ptr = controller->wrapped(); - if (ptr == nullptr) { - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - controller->detach(); - HTTPSResponseSink__close(lexicalGlobalObject, ptr); - return JSC::JSValue::encode(JSC::jsUndefined()); -} - -JSC_DECLARE_HOST_FUNCTION(JSReadableHTTPSResponseSinkController__end); -JSC_DEFINE_HOST_FUNCTION(JSReadableHTTPSResponseSinkController__end, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) -{ - - auto& vm = lexicalGlobalObject->vm(); - auto scope = DECLARE_THROW_SCOPE(vm); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - WebCore::JSReadableHTTPSResponseSinkController* controller = JSC::jsDynamicCast(callFrame->thisValue()); - if (!controller) { - scope.throwException(globalObject, JSC::createTypeError(globalObject, "Expected JSReadableHTTPSResponseSinkController"_s)); - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - void* ptr = controller->wrapped(); - if (ptr == nullptr) { - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - controller->detach(); - return HTTPSResponseSink__endWithSink(ptr, lexicalGlobalObject); -} - -JSC_DECLARE_HOST_FUNCTION(HTTPSResponseSink__doClose); -JSC_DEFINE_HOST_FUNCTION(HTTPSResponseSink__doClose, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) -{ - - auto& vm = lexicalGlobalObject->vm(); - auto scope = DECLARE_THROW_SCOPE(vm); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - WebCore::JSHTTPSResponseSink* sink = JSC::jsDynamicCast(callFrame->thisValue()); - if (!sink) { - scope.throwException(globalObject, JSC::createTypeError(globalObject, "Expected HTTPSResponseSink"_s)); - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - void* ptr = sink->wrapped(); - if (ptr == nullptr) { - return JSC::JSValue::encode(JSC::jsUndefined()); - } - - sink->detach(); - HTTPSResponseSink__close(lexicalGlobalObject, ptr); - return JSC::JSValue::encode(JSC::jsUndefined()); -} - -#include "JSSinkLookupTable.h" - -/* Source for JSArrayBufferSinkPrototypeTableValues.lut.h -@begin JSArrayBufferSinkPrototypeTable - close ArrayBufferSink__doClose ReadOnly|DontDelete|Function 0 - flush ArrayBufferSink__flush ReadOnly|DontDelete|Function 1 - end ArrayBufferSink__end ReadOnly|DontDelete|Function 0 - start ArrayBufferSink__start ReadOnly|DontDelete|Function 1 - write ArrayBufferSink__write ReadOnly|DontDelete|Function 1 - ref ArrayBufferSink__ref ReadOnly|DontDelete|Function 0 - unref ArrayBufferSink__unref ReadOnly|DontDelete|Function 0 -@end -*/ - -/* Source for JSReadableArrayBufferSinkControllerPrototypeTableValues.lut.h -@begin JSReadableArrayBufferSinkControllerPrototypeTable - close JSReadableArrayBufferSinkController__close ReadOnly|DontDelete|Function 0 - flush ArrayBufferSink__flush ReadOnly|DontDelete|Function 1 - end JSReadableArrayBufferSinkController__end ReadOnly|DontDelete|Function 0 - start ArrayBufferSink__start ReadOnly|DontDelete|Function 1 - write ArrayBufferSink__write ReadOnly|DontDelete|Function 1 -@end -*/ - -/* Source for JSFileSinkPrototypeTableValues.lut.h -@begin JSFileSinkPrototypeTable - close FileSink__doClose ReadOnly|DontDelete|Function 0 - flush FileSink__flush ReadOnly|DontDelete|Function 1 - end FileSink__end ReadOnly|DontDelete|Function 0 - start FileSink__start ReadOnly|DontDelete|Function 1 - write FileSink__write ReadOnly|DontDelete|Function 1 - ref FileSink__ref ReadOnly|DontDelete|Function 0 - unref FileSink__unref ReadOnly|DontDelete|Function 0 -@end -*/ - -/* Source for JSReadableFileSinkControllerPrototypeTableValues.lut.h -@begin JSReadableFileSinkControllerPrototypeTable - close JSReadableFileSinkController__close ReadOnly|DontDelete|Function 0 - flush FileSink__flush ReadOnly|DontDelete|Function 1 - end JSReadableFileSinkController__end ReadOnly|DontDelete|Function 0 - start FileSink__start ReadOnly|DontDelete|Function 1 - write FileSink__write ReadOnly|DontDelete|Function 1 -@end -*/ - -/* Source for JSHTTPResponseSinkPrototypeTableValues.lut.h -@begin JSHTTPResponseSinkPrototypeTable - close HTTPResponseSink__doClose ReadOnly|DontDelete|Function 0 - flush HTTPResponseSink__flush ReadOnly|DontDelete|Function 1 - end HTTPResponseSink__end ReadOnly|DontDelete|Function 0 - start HTTPResponseSink__start ReadOnly|DontDelete|Function 1 - write HTTPResponseSink__write ReadOnly|DontDelete|Function 1 - ref HTTPResponseSink__ref ReadOnly|DontDelete|Function 0 - unref HTTPResponseSink__unref ReadOnly|DontDelete|Function 0 -@end -*/ - -/* Source for JSReadableHTTPResponseSinkControllerPrototypeTableValues.lut.h -@begin JSReadableHTTPResponseSinkControllerPrototypeTable - close JSReadableHTTPResponseSinkController__close ReadOnly|DontDelete|Function 0 - flush HTTPResponseSink__flush ReadOnly|DontDelete|Function 1 - end JSReadableHTTPResponseSinkController__end ReadOnly|DontDelete|Function 0 - start HTTPResponseSink__start ReadOnly|DontDelete|Function 1 - write HTTPResponseSink__write ReadOnly|DontDelete|Function 1 -@end -*/ - -/* Source for JSHTTPSResponseSinkPrototypeTableValues.lut.h -@begin JSHTTPSResponseSinkPrototypeTable - close HTTPSResponseSink__doClose ReadOnly|DontDelete|Function 0 - flush HTTPSResponseSink__flush ReadOnly|DontDelete|Function 1 - end HTTPSResponseSink__end ReadOnly|DontDelete|Function 0 - start HTTPSResponseSink__start ReadOnly|DontDelete|Function 1 - write HTTPSResponseSink__write ReadOnly|DontDelete|Function 1 - ref HTTPSResponseSink__ref ReadOnly|DontDelete|Function 0 - unref HTTPSResponseSink__unref ReadOnly|DontDelete|Function 0 -@end -*/ - -/* Source for JSReadableHTTPSResponseSinkControllerPrototypeTableValues.lut.h -@begin JSReadableHTTPSResponseSinkControllerPrototypeTable - close JSReadableHTTPSResponseSinkController__close ReadOnly|DontDelete|Function 0 - flush HTTPSResponseSink__flush ReadOnly|DontDelete|Function 1 - end JSReadableHTTPSResponseSinkController__end ReadOnly|DontDelete|Function 0 - start HTTPSResponseSink__start ReadOnly|DontDelete|Function 1 - write HTTPSResponseSink__write ReadOnly|DontDelete|Function 1 -@end -*/ - -#pragma mark - ArrayBufferSink - -class JSArrayBufferSinkPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSArrayBufferSinkPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSArrayBufferSinkPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSArrayBufferSinkPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSArrayBufferSinkPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSArrayBufferSinkPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSArrayBufferSinkPrototype, JSArrayBufferSinkPrototype::Base); - -class JSReadableArrayBufferSinkControllerPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSReadableArrayBufferSinkControllerPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSReadableArrayBufferSinkControllerPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSReadableArrayBufferSinkControllerPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSReadableArrayBufferSinkControllerPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSReadableArrayBufferSinkControllerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSReadableArrayBufferSinkControllerPrototype, JSReadableArrayBufferSinkControllerPrototype::Base); - -const ClassInfo JSArrayBufferSinkPrototype::s_info = { "ArrayBufferSink"_s, &Base::s_info, &JSArrayBufferSinkPrototypeTable, nullptr, CREATE_METHOD_TABLE(JSArrayBufferSinkPrototype) }; -const ClassInfo JSArrayBufferSink::s_info = { "ArrayBufferSink"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSArrayBufferSink) }; -const ClassInfo JSArrayBufferSinkConstructor::s_info = { "ArrayBufferSink"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSArrayBufferSinkConstructor) }; - -const ClassInfo JSReadableArrayBufferSinkControllerPrototype::s_info = { "ReadableArrayBufferSinkController"_s, &Base::s_info, &JSReadableArrayBufferSinkControllerPrototypeTable, nullptr, CREATE_METHOD_TABLE(JSReadableArrayBufferSinkControllerPrototype) }; -const ClassInfo JSReadableArrayBufferSinkController::s_info = { "ReadableArrayBufferSinkController"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSReadableArrayBufferSinkController) }; - -JSArrayBufferSink::~JSArrayBufferSink() -{ - if (m_sinkPtr) { - ArrayBufferSink__finalize(m_sinkPtr); - } -} - -JSReadableArrayBufferSinkController::~JSReadableArrayBufferSinkController() -{ - if (m_sinkPtr) { - ArrayBufferSink__finalize(m_sinkPtr); - } -} - -JSObject* JSArrayBufferSink::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) -{ - return JSArrayBufferSinkPrototype::create(vm, &globalObject, JSArrayBufferSinkPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); -} - -JSObject* JSReadableArrayBufferSinkController::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) -{ - return JSReadableArrayBufferSinkControllerPrototype::create(vm, &globalObject, JSReadableArrayBufferSinkControllerPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); -} - -void JSReadableArrayBufferSinkController::detach() -{ - m_sinkPtr = nullptr; - m_onPull.clear(); - - auto readableStream = m_weakReadableStream.get(); - auto onClose = m_onClose.get(); - - if (readableStream && onClose) { - auto callData = JSC::getCallData(onClose); - if (callData.type != JSC::CallData::Type::None) { - JSC::JSGlobalObject* globalObject = this->globalObject(); - JSC::MarkedArgumentBuffer arguments; - arguments.append(readableStream); - arguments.append(jsUndefined()); - call(globalObject, onClose, callData, JSC::jsUndefined(), arguments); - } - } - - m_onClose.clear(); - m_weakReadableStream.clear(); -} - -JSArrayBufferSinkConstructor* JSArrayBufferSinkConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSObject* prototype) -{ - JSArrayBufferSinkConstructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSArrayBufferSinkConstructor(vm, structure, ArrayBufferSink__construct); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSArrayBufferSink* JSArrayBufferSink::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr) -{ - JSArrayBufferSink* ptr = new (NotNull, JSC::allocateCell(vm)) JSArrayBufferSink(vm, structure, sinkPtr); - ptr->finishCreation(vm); - return ptr; -} - -JSReadableArrayBufferSinkController* JSReadableArrayBufferSinkController::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr) -{ - JSReadableArrayBufferSinkController* ptr = new (NotNull, JSC::allocateCell(vm)) JSReadableArrayBufferSinkController(vm, structure, sinkPtr); - ptr->finishCreation(vm); - return ptr; -} - -void JSArrayBufferSinkConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSObject* prototype) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); - initializeProperties(vm, globalObject, prototype); -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSArrayBufferSinkConstructor::construct(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame) -{ - return ArrayBufferSink__construct(globalObject, callFrame); -} - -void JSArrayBufferSinkConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSObject* prototype) -{ - putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); - JSString* nameString = jsNontrivialString(vm, "ArrayBufferSink"_s); - m_originalName.set(vm, this, nameString); - putDirect(vm, vm.propertyNames->name, nameString, JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); -} - -void JSArrayBufferSinkPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSArrayBufferSink::info(), JSArrayBufferSinkPrototypeTableValues, *this); - putDirect(vm, JSC::Identifier::fromString(vm, "sinkId"_s), JSC::jsNumber(JSArrayBufferSink::Sink), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -void JSReadableArrayBufferSinkControllerPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSReadableArrayBufferSinkController::info(), JSReadableArrayBufferSinkControllerPrototypeTableValues, *this); - putDirect(vm, JSC::Identifier::fromString(vm, "sinkId"_s), JSC::jsNumber(JSArrayBufferSink::Sink), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -void JSArrayBufferSink::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -void JSReadableArrayBufferSinkController::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -void JSArrayBufferSink::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - analyzer.setWrappedObjectForCell(cell, wrapped); - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -void JSReadableArrayBufferSinkController::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - analyzer.setWrappedObjectForCell(cell, wrapped); - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -template -void JSReadableArrayBufferSinkController::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSReadableArrayBufferSinkController* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - visitor.append(thisObject->m_onPull); - visitor.append(thisObject->m_onClose); - void* ptr = thisObject->m_sinkPtr; - if (ptr) - visitor.addOpaqueRoot(ptr); -} - -DEFINE_VISIT_CHILDREN(JSReadableArrayBufferSinkController); - -template -void JSArrayBufferSink::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSArrayBufferSink* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - void* ptr = thisObject->m_sinkPtr; - if (ptr) - visitor.addOpaqueRoot(ptr); -} - -DEFINE_VISIT_CHILDREN(JSArrayBufferSink); - -void JSReadableArrayBufferSinkController::start(JSC::JSGlobalObject* globalObject, JSC::JSValue readableStream, JSC::JSValue onPull, JSC::JSValue onClose) -{ - this->m_weakReadableStream = JSC::Weak(readableStream.getObject()); - this->m_onPull.set(globalObject->vm(), this, onPull); - this->m_onClose.set(globalObject->vm(), this, onClose); -} - -void JSArrayBufferSink::destroy(JSCell* cell) -{ - static_cast(cell)->JSArrayBufferSink::~JSArrayBufferSink(); -} - -void JSReadableArrayBufferSinkController::destroy(JSCell* cell) -{ - static_cast(cell)->JSReadableArrayBufferSinkController::~JSReadableArrayBufferSinkController(); -} - -#pragma mark - FileSink - -class JSFileSinkPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSFileSinkPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSFileSinkPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSFileSinkPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSFileSinkPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSFileSinkPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSFileSinkPrototype, JSFileSinkPrototype::Base); - -class JSReadableFileSinkControllerPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSReadableFileSinkControllerPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSReadableFileSinkControllerPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSReadableFileSinkControllerPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSReadableFileSinkControllerPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSReadableFileSinkControllerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSReadableFileSinkControllerPrototype, JSReadableFileSinkControllerPrototype::Base); - -const ClassInfo JSFileSinkPrototype::s_info = { "FileSink"_s, &Base::s_info, &JSFileSinkPrototypeTable, nullptr, CREATE_METHOD_TABLE(JSFileSinkPrototype) }; -const ClassInfo JSFileSink::s_info = { "FileSink"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSFileSink) }; -const ClassInfo JSFileSinkConstructor::s_info = { "FileSink"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSFileSinkConstructor) }; - -const ClassInfo JSReadableFileSinkControllerPrototype::s_info = { "ReadableFileSinkController"_s, &Base::s_info, &JSReadableFileSinkControllerPrototypeTable, nullptr, CREATE_METHOD_TABLE(JSReadableFileSinkControllerPrototype) }; -const ClassInfo JSReadableFileSinkController::s_info = { "ReadableFileSinkController"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSReadableFileSinkController) }; - -JSFileSink::~JSFileSink() -{ - if (m_sinkPtr) { - FileSink__finalize(m_sinkPtr); - } -} - -JSReadableFileSinkController::~JSReadableFileSinkController() -{ - if (m_sinkPtr) { - FileSink__finalize(m_sinkPtr); - } -} - -JSObject* JSFileSink::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) -{ - return JSFileSinkPrototype::create(vm, &globalObject, JSFileSinkPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); -} - -JSObject* JSReadableFileSinkController::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) -{ - return JSReadableFileSinkControllerPrototype::create(vm, &globalObject, JSReadableFileSinkControllerPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); -} - -void JSReadableFileSinkController::detach() -{ - m_sinkPtr = nullptr; - m_onPull.clear(); - - auto readableStream = m_weakReadableStream.get(); - auto onClose = m_onClose.get(); - - if (readableStream && onClose) { - auto callData = JSC::getCallData(onClose); - if (callData.type != JSC::CallData::Type::None) { - JSC::JSGlobalObject* globalObject = this->globalObject(); - JSC::MarkedArgumentBuffer arguments; - arguments.append(readableStream); - arguments.append(jsUndefined()); - call(globalObject, onClose, callData, JSC::jsUndefined(), arguments); - } - } - - m_onClose.clear(); - m_weakReadableStream.clear(); -} - -JSFileSinkConstructor* JSFileSinkConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSObject* prototype) -{ - JSFileSinkConstructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSFileSinkConstructor(vm, structure, FileSink__construct); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSFileSink* JSFileSink::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr) -{ - JSFileSink* ptr = new (NotNull, JSC::allocateCell(vm)) JSFileSink(vm, structure, sinkPtr); - ptr->finishCreation(vm); - return ptr; -} - -JSReadableFileSinkController* JSReadableFileSinkController::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr) -{ - JSReadableFileSinkController* ptr = new (NotNull, JSC::allocateCell(vm)) JSReadableFileSinkController(vm, structure, sinkPtr); - ptr->finishCreation(vm); - return ptr; -} - -void JSFileSinkConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSObject* prototype) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); - initializeProperties(vm, globalObject, prototype); -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSFileSinkConstructor::construct(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame) -{ - return FileSink__construct(globalObject, callFrame); -} - -void JSFileSinkConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSObject* prototype) -{ - putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); - JSString* nameString = jsNontrivialString(vm, "FileSink"_s); - m_originalName.set(vm, this, nameString); - putDirect(vm, vm.propertyNames->name, nameString, JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); -} - -void JSFileSinkPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSFileSink::info(), JSFileSinkPrototypeTableValues, *this); - putDirect(vm, JSC::Identifier::fromString(vm, "sinkId"_s), JSC::jsNumber(JSFileSink::Sink), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -void JSReadableFileSinkControllerPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSReadableFileSinkController::info(), JSReadableFileSinkControllerPrototypeTableValues, *this); - putDirect(vm, JSC::Identifier::fromString(vm, "sinkId"_s), JSC::jsNumber(JSFileSink::Sink), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -void JSFileSink::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -void JSReadableFileSinkController::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -void JSFileSink::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - analyzer.setWrappedObjectForCell(cell, wrapped); - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -void JSReadableFileSinkController::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - analyzer.setWrappedObjectForCell(cell, wrapped); - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -template -void JSReadableFileSinkController::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSReadableFileSinkController* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - visitor.append(thisObject->m_onPull); - visitor.append(thisObject->m_onClose); - void* ptr = thisObject->m_sinkPtr; - if (ptr) - visitor.addOpaqueRoot(ptr); -} - -DEFINE_VISIT_CHILDREN(JSReadableFileSinkController); - -template -void JSFileSink::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSFileSink* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - void* ptr = thisObject->m_sinkPtr; - if (ptr) - visitor.addOpaqueRoot(ptr); -} - -DEFINE_VISIT_CHILDREN(JSFileSink); - -void JSReadableFileSinkController::start(JSC::JSGlobalObject* globalObject, JSC::JSValue readableStream, JSC::JSValue onPull, JSC::JSValue onClose) -{ - this->m_weakReadableStream = JSC::Weak(readableStream.getObject()); - this->m_onPull.set(globalObject->vm(), this, onPull); - this->m_onClose.set(globalObject->vm(), this, onClose); -} - -void JSFileSink::destroy(JSCell* cell) -{ - static_cast(cell)->JSFileSink::~JSFileSink(); -} - -void JSReadableFileSinkController::destroy(JSCell* cell) -{ - static_cast(cell)->JSReadableFileSinkController::~JSReadableFileSinkController(); -} - -#pragma mark - HTTPResponseSink - -class JSHTTPResponseSinkPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSHTTPResponseSinkPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSHTTPResponseSinkPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSHTTPResponseSinkPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSHTTPResponseSinkPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSHTTPResponseSinkPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSHTTPResponseSinkPrototype, JSHTTPResponseSinkPrototype::Base); - -class JSReadableHTTPResponseSinkControllerPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSReadableHTTPResponseSinkControllerPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSReadableHTTPResponseSinkControllerPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSReadableHTTPResponseSinkControllerPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSReadableHTTPResponseSinkControllerPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSReadableHTTPResponseSinkControllerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSReadableHTTPResponseSinkControllerPrototype, JSReadableHTTPResponseSinkControllerPrototype::Base); - -const ClassInfo JSHTTPResponseSinkPrototype::s_info = { "HTTPResponseSink"_s, &Base::s_info, &JSHTTPResponseSinkPrototypeTable, nullptr, CREATE_METHOD_TABLE(JSHTTPResponseSinkPrototype) }; -const ClassInfo JSHTTPResponseSink::s_info = { "HTTPResponseSink"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTTPResponseSink) }; -const ClassInfo JSHTTPResponseSinkConstructor::s_info = { "HTTPResponseSink"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTTPResponseSinkConstructor) }; - -const ClassInfo JSReadableHTTPResponseSinkControllerPrototype::s_info = { "ReadableHTTPResponseSinkController"_s, &Base::s_info, &JSReadableHTTPResponseSinkControllerPrototypeTable, nullptr, CREATE_METHOD_TABLE(JSReadableHTTPResponseSinkControllerPrototype) }; -const ClassInfo JSReadableHTTPResponseSinkController::s_info = { "ReadableHTTPResponseSinkController"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSReadableHTTPResponseSinkController) }; - -JSHTTPResponseSink::~JSHTTPResponseSink() -{ - if (m_sinkPtr) { - HTTPResponseSink__finalize(m_sinkPtr); - } -} - -JSReadableHTTPResponseSinkController::~JSReadableHTTPResponseSinkController() -{ - if (m_sinkPtr) { - HTTPResponseSink__finalize(m_sinkPtr); - } -} - -JSObject* JSHTTPResponseSink::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) -{ - return JSHTTPResponseSinkPrototype::create(vm, &globalObject, JSHTTPResponseSinkPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); -} - -JSObject* JSReadableHTTPResponseSinkController::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) -{ - return JSReadableHTTPResponseSinkControllerPrototype::create(vm, &globalObject, JSReadableHTTPResponseSinkControllerPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); -} - -void JSReadableHTTPResponseSinkController::detach() -{ - m_sinkPtr = nullptr; - m_onPull.clear(); - - auto readableStream = m_weakReadableStream.get(); - auto onClose = m_onClose.get(); - - if (readableStream && onClose) { - auto callData = JSC::getCallData(onClose); - if (callData.type != JSC::CallData::Type::None) { - JSC::JSGlobalObject* globalObject = this->globalObject(); - JSC::MarkedArgumentBuffer arguments; - arguments.append(readableStream); - arguments.append(jsUndefined()); - call(globalObject, onClose, callData, JSC::jsUndefined(), arguments); - } - } - - m_onClose.clear(); - m_weakReadableStream.clear(); -} - -JSHTTPResponseSinkConstructor* JSHTTPResponseSinkConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSObject* prototype) -{ - JSHTTPResponseSinkConstructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSHTTPResponseSinkConstructor(vm, structure, HTTPResponseSink__construct); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSHTTPResponseSink* JSHTTPResponseSink::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr) -{ - JSHTTPResponseSink* ptr = new (NotNull, JSC::allocateCell(vm)) JSHTTPResponseSink(vm, structure, sinkPtr); - ptr->finishCreation(vm); - return ptr; -} - -JSReadableHTTPResponseSinkController* JSReadableHTTPResponseSinkController::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr) -{ - JSReadableHTTPResponseSinkController* ptr = new (NotNull, JSC::allocateCell(vm)) JSReadableHTTPResponseSinkController(vm, structure, sinkPtr); - ptr->finishCreation(vm); - return ptr; -} - -void JSHTTPResponseSinkConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSObject* prototype) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); - initializeProperties(vm, globalObject, prototype); -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSHTTPResponseSinkConstructor::construct(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame) -{ - return HTTPResponseSink__construct(globalObject, callFrame); -} - -void JSHTTPResponseSinkConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSObject* prototype) -{ - putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); - JSString* nameString = jsNontrivialString(vm, "HTTPResponseSink"_s); - m_originalName.set(vm, this, nameString); - putDirect(vm, vm.propertyNames->name, nameString, JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); -} - -void JSHTTPResponseSinkPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSHTTPResponseSink::info(), JSHTTPResponseSinkPrototypeTableValues, *this); - putDirect(vm, JSC::Identifier::fromString(vm, "sinkId"_s), JSC::jsNumber(JSHTTPResponseSink::Sink), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -void JSReadableHTTPResponseSinkControllerPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSReadableHTTPResponseSinkController::info(), JSReadableHTTPResponseSinkControllerPrototypeTableValues, *this); - putDirect(vm, JSC::Identifier::fromString(vm, "sinkId"_s), JSC::jsNumber(JSHTTPResponseSink::Sink), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -void JSHTTPResponseSink::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -void JSReadableHTTPResponseSinkController::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -void JSHTTPResponseSink::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - analyzer.setWrappedObjectForCell(cell, wrapped); - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -void JSReadableHTTPResponseSinkController::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - analyzer.setWrappedObjectForCell(cell, wrapped); - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -template -void JSReadableHTTPResponseSinkController::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSReadableHTTPResponseSinkController* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - visitor.append(thisObject->m_onPull); - visitor.append(thisObject->m_onClose); - void* ptr = thisObject->m_sinkPtr; - if (ptr) - visitor.addOpaqueRoot(ptr); -} - -DEFINE_VISIT_CHILDREN(JSReadableHTTPResponseSinkController); - -template -void JSHTTPResponseSink::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSHTTPResponseSink* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - void* ptr = thisObject->m_sinkPtr; - if (ptr) - visitor.addOpaqueRoot(ptr); -} - -DEFINE_VISIT_CHILDREN(JSHTTPResponseSink); - -void JSReadableHTTPResponseSinkController::start(JSC::JSGlobalObject* globalObject, JSC::JSValue readableStream, JSC::JSValue onPull, JSC::JSValue onClose) -{ - this->m_weakReadableStream = JSC::Weak(readableStream.getObject()); - this->m_onPull.set(globalObject->vm(), this, onPull); - this->m_onClose.set(globalObject->vm(), this, onClose); -} - -void JSHTTPResponseSink::destroy(JSCell* cell) -{ - static_cast(cell)->JSHTTPResponseSink::~JSHTTPResponseSink(); -} - -void JSReadableHTTPResponseSinkController::destroy(JSCell* cell) -{ - static_cast(cell)->JSReadableHTTPResponseSinkController::~JSReadableHTTPResponseSinkController(); -} - -#pragma mark - HTTPSResponseSink - -class JSHTTPSResponseSinkPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSHTTPSResponseSinkPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSHTTPSResponseSinkPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSHTTPSResponseSinkPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSHTTPSResponseSinkPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSHTTPSResponseSinkPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSHTTPSResponseSinkPrototype, JSHTTPSResponseSinkPrototype::Base); - -class JSReadableHTTPSResponseSinkControllerPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSReadableHTTPSResponseSinkControllerPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSReadableHTTPSResponseSinkControllerPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSReadableHTTPSResponseSinkControllerPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSReadableHTTPSResponseSinkControllerPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSReadableHTTPSResponseSinkControllerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSReadableHTTPSResponseSinkControllerPrototype, JSReadableHTTPSResponseSinkControllerPrototype::Base); - -const ClassInfo JSHTTPSResponseSinkPrototype::s_info = { "HTTPSResponseSink"_s, &Base::s_info, &JSHTTPSResponseSinkPrototypeTable, nullptr, CREATE_METHOD_TABLE(JSHTTPSResponseSinkPrototype) }; -const ClassInfo JSHTTPSResponseSink::s_info = { "HTTPSResponseSink"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTTPSResponseSink) }; -const ClassInfo JSHTTPSResponseSinkConstructor::s_info = { "HTTPSResponseSink"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTTPSResponseSinkConstructor) }; - -const ClassInfo JSReadableHTTPSResponseSinkControllerPrototype::s_info = { "ReadableHTTPSResponseSinkController"_s, &Base::s_info, &JSReadableHTTPSResponseSinkControllerPrototypeTable, nullptr, CREATE_METHOD_TABLE(JSReadableHTTPSResponseSinkControllerPrototype) }; -const ClassInfo JSReadableHTTPSResponseSinkController::s_info = { "ReadableHTTPSResponseSinkController"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSReadableHTTPSResponseSinkController) }; - -JSHTTPSResponseSink::~JSHTTPSResponseSink() -{ - if (m_sinkPtr) { - HTTPSResponseSink__finalize(m_sinkPtr); - } -} - -JSReadableHTTPSResponseSinkController::~JSReadableHTTPSResponseSinkController() -{ - if (m_sinkPtr) { - HTTPSResponseSink__finalize(m_sinkPtr); - } -} - -JSObject* JSHTTPSResponseSink::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) -{ - return JSHTTPSResponseSinkPrototype::create(vm, &globalObject, JSHTTPSResponseSinkPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); -} - -JSObject* JSReadableHTTPSResponseSinkController::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) -{ - return JSReadableHTTPSResponseSinkControllerPrototype::create(vm, &globalObject, JSReadableHTTPSResponseSinkControllerPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); -} - -void JSReadableHTTPSResponseSinkController::detach() -{ - m_sinkPtr = nullptr; - m_onPull.clear(); - - auto readableStream = m_weakReadableStream.get(); - auto onClose = m_onClose.get(); - - if (readableStream && onClose) { - auto callData = JSC::getCallData(onClose); - if (callData.type != JSC::CallData::Type::None) { - JSC::JSGlobalObject* globalObject = this->globalObject(); - JSC::MarkedArgumentBuffer arguments; - arguments.append(readableStream); - arguments.append(jsUndefined()); - call(globalObject, onClose, callData, JSC::jsUndefined(), arguments); - } - } - - m_onClose.clear(); - m_weakReadableStream.clear(); -} - -JSHTTPSResponseSinkConstructor* JSHTTPSResponseSinkConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSObject* prototype) -{ - JSHTTPSResponseSinkConstructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSHTTPSResponseSinkConstructor(vm, structure, HTTPSResponseSink__construct); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSHTTPSResponseSink* JSHTTPSResponseSink::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr) -{ - JSHTTPSResponseSink* ptr = new (NotNull, JSC::allocateCell(vm)) JSHTTPSResponseSink(vm, structure, sinkPtr); - ptr->finishCreation(vm); - return ptr; -} - -JSReadableHTTPSResponseSinkController* JSReadableHTTPSResponseSinkController::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr) -{ - JSReadableHTTPSResponseSinkController* ptr = new (NotNull, JSC::allocateCell(vm)) JSReadableHTTPSResponseSinkController(vm, structure, sinkPtr); - ptr->finishCreation(vm); - return ptr; -} - -void JSHTTPSResponseSinkConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSObject* prototype) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); - initializeProperties(vm, globalObject, prototype); -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSHTTPSResponseSinkConstructor::construct(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame) -{ - return HTTPSResponseSink__construct(globalObject, callFrame); -} - -void JSHTTPSResponseSinkConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSObject* prototype) -{ - putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); - JSString* nameString = jsNontrivialString(vm, "HTTPSResponseSink"_s); - m_originalName.set(vm, this, nameString); - putDirect(vm, vm.propertyNames->name, nameString, JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); -} - -void JSHTTPSResponseSinkPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSHTTPSResponseSink::info(), JSHTTPSResponseSinkPrototypeTableValues, *this); - putDirect(vm, JSC::Identifier::fromString(vm, "sinkId"_s), JSC::jsNumber(JSHTTPSResponseSink::Sink), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -void JSReadableHTTPSResponseSinkControllerPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSReadableHTTPSResponseSinkController::info(), JSReadableHTTPSResponseSinkControllerPrototypeTableValues, *this); - putDirect(vm, JSC::Identifier::fromString(vm, "sinkId"_s), JSC::jsNumber(JSHTTPSResponseSink::Sink), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -void JSHTTPSResponseSink::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -void JSReadableHTTPSResponseSinkController::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -void JSHTTPSResponseSink::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - analyzer.setWrappedObjectForCell(cell, wrapped); - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -void JSReadableHTTPSResponseSinkController::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - analyzer.setWrappedObjectForCell(cell, wrapped); - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -template -void JSReadableHTTPSResponseSinkController::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSReadableHTTPSResponseSinkController* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - visitor.append(thisObject->m_onPull); - visitor.append(thisObject->m_onClose); - void* ptr = thisObject->m_sinkPtr; - if (ptr) - visitor.addOpaqueRoot(ptr); -} - -DEFINE_VISIT_CHILDREN(JSReadableHTTPSResponseSinkController); - -template -void JSHTTPSResponseSink::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSHTTPSResponseSink* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - void* ptr = thisObject->m_sinkPtr; - if (ptr) - visitor.addOpaqueRoot(ptr); -} - -DEFINE_VISIT_CHILDREN(JSHTTPSResponseSink); - -void JSReadableHTTPSResponseSinkController::start(JSC::JSGlobalObject* globalObject, JSC::JSValue readableStream, JSC::JSValue onPull, JSC::JSValue onClose) -{ - this->m_weakReadableStream = JSC::Weak(readableStream.getObject()); - this->m_onPull.set(globalObject->vm(), this, onPull); - this->m_onClose.set(globalObject->vm(), this, onClose); -} - -void JSHTTPSResponseSink::destroy(JSCell* cell) -{ - static_cast(cell)->JSHTTPSResponseSink::~JSHTTPSResponseSink(); -} - -void JSReadableHTTPSResponseSinkController::destroy(JSCell* cell) -{ - static_cast(cell)->JSReadableHTTPSResponseSinkController::~JSReadableHTTPSResponseSinkController(); -} - -JSObject* createJSSinkPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, SinkID sinkID) -{ - switch (sinkID) { - - case ArrayBufferSink: - return JSArrayBufferSinkPrototype::create(vm, globalObject, JSArrayBufferSinkPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); - - case FileSink: - return JSFileSinkPrototype::create(vm, globalObject, JSFileSinkPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); - - case HTTPResponseSink: - return JSHTTPResponseSinkPrototype::create(vm, globalObject, JSHTTPResponseSinkPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); - - case HTTPSResponseSink: - return JSHTTPSResponseSinkPrototype::create(vm, globalObject, JSHTTPSResponseSinkPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); - - default: - RELEASE_ASSERT_NOT_REACHED(); - } -} -JSObject* createJSSinkControllerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, SinkID sinkID) -{ - switch (sinkID) { - - case ArrayBufferSink: - return JSReadableArrayBufferSinkControllerPrototype::create(vm, globalObject, JSReadableArrayBufferSinkControllerPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); - - case FileSink: - return JSReadableFileSinkControllerPrototype::create(vm, globalObject, JSReadableFileSinkControllerPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); - - case HTTPResponseSink: - return JSReadableHTTPResponseSinkControllerPrototype::create(vm, globalObject, JSReadableHTTPResponseSinkControllerPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); - - case HTTPSResponseSink: - return JSReadableHTTPSResponseSinkControllerPrototype::create(vm, globalObject, JSReadableHTTPSResponseSinkControllerPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); - - default: - RELEASE_ASSERT_NOT_REACHED(); - } -} -Structure* createJSSinkControllerStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, SinkID sinkID) -{ - switch (sinkID) { - - case ArrayBufferSink: { - auto* prototype = createJSSinkControllerPrototype(vm, globalObject, sinkID); - return JSReadableArrayBufferSinkController::createStructure(vm, globalObject, prototype); - } - - case FileSink: { - auto* prototype = createJSSinkControllerPrototype(vm, globalObject, sinkID); - return JSReadableFileSinkController::createStructure(vm, globalObject, prototype); - } - - case HTTPResponseSink: { - auto* prototype = createJSSinkControllerPrototype(vm, globalObject, sinkID); - return JSReadableHTTPResponseSinkController::createStructure(vm, globalObject, prototype); - } - - case HTTPSResponseSink: { - auto* prototype = createJSSinkControllerPrototype(vm, globalObject, sinkID); - return JSReadableHTTPSResponseSinkController::createStructure(vm, globalObject, prototype); - } - - default: - RELEASE_ASSERT_NOT_REACHED(); - } -} -} // namespace WebCore - -extern "C" JSC__JSValue ArrayBufferSink__createObject(JSC__JSGlobalObject* arg0, void* sinkPtr) -{ - auto& vm = arg0->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(arg0); - JSC::Structure* structure = globalObject->ArrayBufferSinkStructure(); - return JSC::JSValue::encode(WebCore::JSArrayBufferSink::create(vm, globalObject, structure, sinkPtr)); -} - -extern "C" void* ArrayBufferSink__fromJS(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1) -{ - JSC::VM& vm = WebCore::getVM(arg0); - if (auto* sink = JSC::jsDynamicCast(JSC::JSValue::decode(JSValue1))) - return sink->wrapped(); - - if (auto* controller = JSC::jsDynamicCast(JSC::JSValue::decode(JSValue1))) - return controller->wrapped(); - - return nullptr; -} - -extern "C" void ArrayBufferSink__detachPtr(JSC__JSValue JSValue0) -{ - if (auto* sink = JSC::jsDynamicCast(JSC::JSValue::decode(JSValue0))) { - sink->detach(); - return; - } - - if (auto* controller = JSC::jsDynamicCast(JSC::JSValue::decode(JSValue0))) { - controller->detach(); - return; - } -} - -extern "C" JSC__JSValue ArrayBufferSink__assignToStream(JSC__JSGlobalObject* arg0, JSC__JSValue stream, void* sinkPtr, void** controllerValue) -{ - auto& vm = arg0->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(arg0); - - JSC::Structure* structure = WebCore::getDOMStructure(vm, *globalObject); - WebCore::JSReadableArrayBufferSinkController* controller = WebCore::JSReadableArrayBufferSinkController::create(vm, globalObject, structure, sinkPtr); - *controllerValue = reinterpret_cast(JSC::JSValue::encode(controller)); - return globalObject->assignToStream(JSC::JSValue::decode(stream), controller); -} - -extern "C" void ArrayBufferSink__onReady(JSC__JSValue controllerValue, JSC__JSValue amt, JSC__JSValue offset) -{ - WebCore::JSReadableArrayBufferSinkController* controller = JSC::jsCast(JSC::JSValue::decode(controllerValue).getObject()); - - JSC::JSValue function = controller->m_onPull.get(); - if (!function) - return; - JSC::JSGlobalObject* globalObject = controller->globalObject(); - - JSC::MarkedArgumentBuffer arguments; - arguments.append(controller); - arguments.append(JSC::JSValue::decode(amt)); - arguments.append(JSC::JSValue::decode(offset)); - - AsyncContextFrame::call(globalObject, function, JSC::jsUndefined(), arguments); -} - -extern "C" void ArrayBufferSink__onStart(JSC__JSValue controllerValue) -{ -} - -extern "C" void ArrayBufferSink__onClose(JSC__JSValue controllerValue, JSC__JSValue reason) -{ - WebCore::JSReadableArrayBufferSinkController* controller = JSC::jsCast(JSC::JSValue::decode(controllerValue).getObject()); - - JSC::JSValue function = controller->m_onClose.get(); - if (!function) - return; - // only call close once - controller->m_onClose.clear(); - JSC::JSGlobalObject* globalObject = controller->globalObject(); - - JSC::MarkedArgumentBuffer arguments; - auto readableStream = controller->m_weakReadableStream.get(); - arguments.append(readableStream ? readableStream : JSC::jsUndefined()); - - arguments.append(JSC::JSValue::decode(reason)); - AsyncContextFrame::call(globalObject, function, JSC::jsUndefined(), arguments); -} - -extern "C" JSC__JSValue FileSink__createObject(JSC__JSGlobalObject* arg0, void* sinkPtr) -{ - auto& vm = arg0->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(arg0); - JSC::Structure* structure = globalObject->FileSinkStructure(); - return JSC::JSValue::encode(WebCore::JSFileSink::create(vm, globalObject, structure, sinkPtr)); -} - -extern "C" void* FileSink__fromJS(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1) -{ - JSC::VM& vm = WebCore::getVM(arg0); - if (auto* sink = JSC::jsDynamicCast(JSC::JSValue::decode(JSValue1))) - return sink->wrapped(); - - if (auto* controller = JSC::jsDynamicCast(JSC::JSValue::decode(JSValue1))) - return controller->wrapped(); - - return nullptr; -} - -extern "C" void FileSink__detachPtr(JSC__JSValue JSValue0) -{ - if (auto* sink = JSC::jsDynamicCast(JSC::JSValue::decode(JSValue0))) { - sink->detach(); - return; - } - - if (auto* controller = JSC::jsDynamicCast(JSC::JSValue::decode(JSValue0))) { - controller->detach(); - return; - } -} - -extern "C" JSC__JSValue FileSink__assignToStream(JSC__JSGlobalObject* arg0, JSC__JSValue stream, void* sinkPtr, void** controllerValue) -{ - auto& vm = arg0->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(arg0); - - JSC::Structure* structure = WebCore::getDOMStructure(vm, *globalObject); - WebCore::JSReadableFileSinkController* controller = WebCore::JSReadableFileSinkController::create(vm, globalObject, structure, sinkPtr); - *controllerValue = reinterpret_cast(JSC::JSValue::encode(controller)); - return globalObject->assignToStream(JSC::JSValue::decode(stream), controller); -} - -extern "C" void FileSink__onReady(JSC__JSValue controllerValue, JSC__JSValue amt, JSC__JSValue offset) -{ - WebCore::JSReadableFileSinkController* controller = JSC::jsCast(JSC::JSValue::decode(controllerValue).getObject()); - - JSC::JSValue function = controller->m_onPull.get(); - if (!function) - return; - JSC::JSGlobalObject* globalObject = controller->globalObject(); - - JSC::MarkedArgumentBuffer arguments; - arguments.append(controller); - arguments.append(JSC::JSValue::decode(amt)); - arguments.append(JSC::JSValue::decode(offset)); - - AsyncContextFrame::call(globalObject, function, JSC::jsUndefined(), arguments); -} - -extern "C" void FileSink__onStart(JSC__JSValue controllerValue) -{ -} - -extern "C" void FileSink__onClose(JSC__JSValue controllerValue, JSC__JSValue reason) -{ - WebCore::JSReadableFileSinkController* controller = JSC::jsCast(JSC::JSValue::decode(controllerValue).getObject()); - - JSC::JSValue function = controller->m_onClose.get(); - if (!function) - return; - // only call close once - controller->m_onClose.clear(); - JSC::JSGlobalObject* globalObject = controller->globalObject(); - - JSC::MarkedArgumentBuffer arguments; - auto readableStream = controller->m_weakReadableStream.get(); - arguments.append(readableStream ? readableStream : JSC::jsUndefined()); - - arguments.append(JSC::JSValue::decode(reason)); - AsyncContextFrame::call(globalObject, function, JSC::jsUndefined(), arguments); -} - -extern "C" JSC__JSValue HTTPResponseSink__createObject(JSC__JSGlobalObject* arg0, void* sinkPtr) -{ - auto& vm = arg0->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(arg0); - JSC::Structure* structure = globalObject->HTTPResponseSinkStructure(); - return JSC::JSValue::encode(WebCore::JSHTTPResponseSink::create(vm, globalObject, structure, sinkPtr)); -} - -extern "C" void* HTTPResponseSink__fromJS(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1) -{ - JSC::VM& vm = WebCore::getVM(arg0); - if (auto* sink = JSC::jsDynamicCast(JSC::JSValue::decode(JSValue1))) - return sink->wrapped(); - - if (auto* controller = JSC::jsDynamicCast(JSC::JSValue::decode(JSValue1))) - return controller->wrapped(); - - return nullptr; -} - -extern "C" void HTTPResponseSink__detachPtr(JSC__JSValue JSValue0) -{ - if (auto* sink = JSC::jsDynamicCast(JSC::JSValue::decode(JSValue0))) { - sink->detach(); - return; - } - - if (auto* controller = JSC::jsDynamicCast(JSC::JSValue::decode(JSValue0))) { - controller->detach(); - return; - } -} - -extern "C" JSC__JSValue HTTPResponseSink__assignToStream(JSC__JSGlobalObject* arg0, JSC__JSValue stream, void* sinkPtr, void** controllerValue) -{ - auto& vm = arg0->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(arg0); - - JSC::Structure* structure = WebCore::getDOMStructure(vm, *globalObject); - WebCore::JSReadableHTTPResponseSinkController* controller = WebCore::JSReadableHTTPResponseSinkController::create(vm, globalObject, structure, sinkPtr); - *controllerValue = reinterpret_cast(JSC::JSValue::encode(controller)); - return globalObject->assignToStream(JSC::JSValue::decode(stream), controller); -} - -extern "C" void HTTPResponseSink__onReady(JSC__JSValue controllerValue, JSC__JSValue amt, JSC__JSValue offset) -{ - WebCore::JSReadableHTTPResponseSinkController* controller = JSC::jsCast(JSC::JSValue::decode(controllerValue).getObject()); - - JSC::JSValue function = controller->m_onPull.get(); - if (!function) - return; - JSC::JSGlobalObject* globalObject = controller->globalObject(); - - JSC::MarkedArgumentBuffer arguments; - arguments.append(controller); - arguments.append(JSC::JSValue::decode(amt)); - arguments.append(JSC::JSValue::decode(offset)); - - AsyncContextFrame::call(globalObject, function, JSC::jsUndefined(), arguments); -} - -extern "C" void HTTPResponseSink__onStart(JSC__JSValue controllerValue) -{ -} - -extern "C" void HTTPResponseSink__onClose(JSC__JSValue controllerValue, JSC__JSValue reason) -{ - WebCore::JSReadableHTTPResponseSinkController* controller = JSC::jsCast(JSC::JSValue::decode(controllerValue).getObject()); - - JSC::JSValue function = controller->m_onClose.get(); - if (!function) - return; - // only call close once - controller->m_onClose.clear(); - JSC::JSGlobalObject* globalObject = controller->globalObject(); - - JSC::MarkedArgumentBuffer arguments; - auto readableStream = controller->m_weakReadableStream.get(); - arguments.append(readableStream ? readableStream : JSC::jsUndefined()); - - arguments.append(JSC::JSValue::decode(reason)); - AsyncContextFrame::call(globalObject, function, JSC::jsUndefined(), arguments); -} - -extern "C" JSC__JSValue HTTPSResponseSink__createObject(JSC__JSGlobalObject* arg0, void* sinkPtr) -{ - auto& vm = arg0->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(arg0); - JSC::Structure* structure = globalObject->HTTPSResponseSinkStructure(); - return JSC::JSValue::encode(WebCore::JSHTTPSResponseSink::create(vm, globalObject, structure, sinkPtr)); -} - -extern "C" void* HTTPSResponseSink__fromJS(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1) -{ - JSC::VM& vm = WebCore::getVM(arg0); - if (auto* sink = JSC::jsDynamicCast(JSC::JSValue::decode(JSValue1))) - return sink->wrapped(); - - if (auto* controller = JSC::jsDynamicCast(JSC::JSValue::decode(JSValue1))) - return controller->wrapped(); - - return nullptr; -} - -extern "C" void HTTPSResponseSink__detachPtr(JSC__JSValue JSValue0) -{ - if (auto* sink = JSC::jsDynamicCast(JSC::JSValue::decode(JSValue0))) { - sink->detach(); - return; - } - - if (auto* controller = JSC::jsDynamicCast(JSC::JSValue::decode(JSValue0))) { - controller->detach(); - return; - } -} - -extern "C" JSC__JSValue HTTPSResponseSink__assignToStream(JSC__JSGlobalObject* arg0, JSC__JSValue stream, void* sinkPtr, void** controllerValue) -{ - auto& vm = arg0->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(arg0); - - JSC::Structure* structure = WebCore::getDOMStructure(vm, *globalObject); - WebCore::JSReadableHTTPSResponseSinkController* controller = WebCore::JSReadableHTTPSResponseSinkController::create(vm, globalObject, structure, sinkPtr); - *controllerValue = reinterpret_cast(JSC::JSValue::encode(controller)); - return globalObject->assignToStream(JSC::JSValue::decode(stream), controller); -} - -extern "C" void HTTPSResponseSink__onReady(JSC__JSValue controllerValue, JSC__JSValue amt, JSC__JSValue offset) -{ - WebCore::JSReadableHTTPSResponseSinkController* controller = JSC::jsCast(JSC::JSValue::decode(controllerValue).getObject()); - - JSC::JSValue function = controller->m_onPull.get(); - if (!function) - return; - JSC::JSGlobalObject* globalObject = controller->globalObject(); - - JSC::MarkedArgumentBuffer arguments; - arguments.append(controller); - arguments.append(JSC::JSValue::decode(amt)); - arguments.append(JSC::JSValue::decode(offset)); - - AsyncContextFrame::call(globalObject, function, JSC::jsUndefined(), arguments); -} - -extern "C" void HTTPSResponseSink__onStart(JSC__JSValue controllerValue) -{ -} - -extern "C" void HTTPSResponseSink__onClose(JSC__JSValue controllerValue, JSC__JSValue reason) -{ - WebCore::JSReadableHTTPSResponseSinkController* controller = JSC::jsCast(JSC::JSValue::decode(controllerValue).getObject()); - - JSC::JSValue function = controller->m_onClose.get(); - if (!function) - return; - // only call close once - controller->m_onClose.clear(); - JSC::JSGlobalObject* globalObject = controller->globalObject(); - - JSC::MarkedArgumentBuffer arguments; - auto readableStream = controller->m_weakReadableStream.get(); - arguments.append(readableStream ? readableStream : JSC::jsUndefined()); - - arguments.append(JSC::JSValue::decode(reason)); - AsyncContextFrame::call(globalObject, function, JSC::jsUndefined(), arguments); -} diff --git a/src/bun.js/bindings/JSSink.h b/src/bun.js/bindings/JSSink.h deleted file mode 100644 index 3a419562d43bf..0000000000000 --- a/src/bun.js/bindings/JSSink.h +++ /dev/null @@ -1,611 +0,0 @@ - -// AUTO-GENERATED FILE. DO NOT EDIT. -// Generated by 'make generate-sink' -// -#pragma once - -#include "root.h" - -#include "JSDOMWrapper.h" -#include "wtf/NeverDestroyed.h" - -#include "Sink.h" - -extern "C" bool JSSink_isSink(JSC::JSGlobalObject*, JSC::EncodedJSValue); - -namespace WebCore { -using namespace JSC; - -JSC_DECLARE_HOST_FUNCTION(functionStartDirectStream); -class JSArrayBufferSinkConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSArrayBufferSinkConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSC::JSObject* prototype); - static constexpr SinkID Sink = SinkID::ArrayBufferSink; - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForJSSinkConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSinkConstructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForJSSinkConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSinkConstructor = std::forward(space); }); - } - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - -private: - JSArrayBufferSinkConstructor(JSC::VM& vm, JSC::Structure* structure, JSC::NativeFunction nativeFunction) - : Base(vm, structure, nativeFunction, nativeFunction) - - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype); -}; - -class JSArrayBufferSink final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSArrayBufferSink* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr); - static constexpr SinkID Sink = SinkID::ArrayBufferSink; - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForJSSink.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSink = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForJSSink.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSink = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject& globalObject); - - ~JSArrayBufferSink(); - - void* wrapped() const { return m_sinkPtr; } - DECLARE_VISIT_CHILDREN; - - void detach() - { - m_sinkPtr = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - - void ref(); - void unref(); - - void* m_sinkPtr; - int m_refCount { 1 }; - - JSArrayBufferSink(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_sinkPtr = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -class JSReadableArrayBufferSinkController final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSReadableArrayBufferSinkController* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr); - static constexpr SinkID Sink = SinkID::ArrayBufferSink; - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForJSSinkController.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSinkController = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForJSSinkController.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSinkController = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject& globalObject); - - ~JSReadableArrayBufferSinkController(); - - void* wrapped() const { return m_sinkPtr; } - void detach(); - - void start(JSC::JSGlobalObject* globalObject, JSC::JSValue readableStream, JSC::JSValue onPull, JSC::JSValue onClose); - DECLARE_VISIT_CHILDREN; - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - - void* m_sinkPtr; - mutable WriteBarrier m_onPull; - mutable WriteBarrier m_onClose; - mutable JSC::Weak m_weakReadableStream; - - JSReadableArrayBufferSinkController(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_sinkPtr = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -JSC_DECLARE_CUSTOM_GETTER(functionArrayBufferSink__getter); - -class JSFileSinkConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSFileSinkConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSC::JSObject* prototype); - static constexpr SinkID Sink = SinkID::FileSink; - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForJSSinkConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSinkConstructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForJSSinkConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSinkConstructor = std::forward(space); }); - } - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - -private: - JSFileSinkConstructor(JSC::VM& vm, JSC::Structure* structure, JSC::NativeFunction nativeFunction) - : Base(vm, structure, nativeFunction, nativeFunction) - - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype); -}; - -class JSFileSink final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSFileSink* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr); - static constexpr SinkID Sink = SinkID::FileSink; - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForJSSink.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSink = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForJSSink.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSink = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject& globalObject); - - ~JSFileSink(); - - void* wrapped() const { return m_sinkPtr; } - DECLARE_VISIT_CHILDREN; - - void detach() - { - m_sinkPtr = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - - void ref(); - void unref(); - - void* m_sinkPtr; - int m_refCount { 1 }; - - JSFileSink(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_sinkPtr = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -class JSReadableFileSinkController final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSReadableFileSinkController* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr); - static constexpr SinkID Sink = SinkID::FileSink; - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForJSSinkController.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSinkController = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForJSSinkController.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSinkController = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject& globalObject); - - ~JSReadableFileSinkController(); - - void* wrapped() const { return m_sinkPtr; } - void detach(); - - void start(JSC::JSGlobalObject* globalObject, JSC::JSValue readableStream, JSC::JSValue onPull, JSC::JSValue onClose); - DECLARE_VISIT_CHILDREN; - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - - void* m_sinkPtr; - mutable WriteBarrier m_onPull; - mutable WriteBarrier m_onClose; - mutable JSC::Weak m_weakReadableStream; - - JSReadableFileSinkController(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_sinkPtr = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -JSC_DECLARE_CUSTOM_GETTER(functionFileSink__getter); - -class JSHTTPResponseSinkConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSHTTPResponseSinkConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSC::JSObject* prototype); - static constexpr SinkID Sink = SinkID::HTTPResponseSink; - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForJSSinkConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSinkConstructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForJSSinkConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSinkConstructor = std::forward(space); }); - } - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - -private: - JSHTTPResponseSinkConstructor(JSC::VM& vm, JSC::Structure* structure, JSC::NativeFunction nativeFunction) - : Base(vm, structure, nativeFunction, nativeFunction) - - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype); -}; - -class JSHTTPResponseSink final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSHTTPResponseSink* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr); - static constexpr SinkID Sink = SinkID::HTTPResponseSink; - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForJSSink.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSink = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForJSSink.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSink = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject& globalObject); - - ~JSHTTPResponseSink(); - - void* wrapped() const { return m_sinkPtr; } - DECLARE_VISIT_CHILDREN; - - void detach() - { - m_sinkPtr = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - - void ref(); - void unref(); - - void* m_sinkPtr; - int m_refCount { 1 }; - - JSHTTPResponseSink(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_sinkPtr = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -class JSReadableHTTPResponseSinkController final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSReadableHTTPResponseSinkController* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr); - static constexpr SinkID Sink = SinkID::HTTPResponseSink; - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForJSSinkController.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSinkController = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForJSSinkController.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSinkController = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject& globalObject); - - ~JSReadableHTTPResponseSinkController(); - - void* wrapped() const { return m_sinkPtr; } - void detach(); - - void start(JSC::JSGlobalObject* globalObject, JSC::JSValue readableStream, JSC::JSValue onPull, JSC::JSValue onClose); - DECLARE_VISIT_CHILDREN; - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - - void* m_sinkPtr; - mutable WriteBarrier m_onPull; - mutable WriteBarrier m_onClose; - mutable JSC::Weak m_weakReadableStream; - - JSReadableHTTPResponseSinkController(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_sinkPtr = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -JSC_DECLARE_CUSTOM_GETTER(functionHTTPResponseSink__getter); - -class JSHTTPSResponseSinkConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSHTTPSResponseSinkConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSC::JSObject* prototype); - static constexpr SinkID Sink = SinkID::HTTPSResponseSink; - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForJSSinkConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSinkConstructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForJSSinkConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSinkConstructor = std::forward(space); }); - } - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - -private: - JSHTTPSResponseSinkConstructor(JSC::VM& vm, JSC::Structure* structure, JSC::NativeFunction nativeFunction) - : Base(vm, structure, nativeFunction, nativeFunction) - - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype); -}; - -class JSHTTPSResponseSink final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSHTTPSResponseSink* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr); - static constexpr SinkID Sink = SinkID::HTTPSResponseSink; - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForJSSink.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSink = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForJSSink.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSink = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject& globalObject); - - ~JSHTTPSResponseSink(); - - void* wrapped() const { return m_sinkPtr; } - DECLARE_VISIT_CHILDREN; - - void detach() - { - m_sinkPtr = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - - void ref(); - void unref(); - - void* m_sinkPtr; - int m_refCount { 1 }; - - JSHTTPSResponseSink(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_sinkPtr = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -class JSReadableHTTPSResponseSinkController final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSReadableHTTPSResponseSinkController* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr); - static constexpr SinkID Sink = SinkID::HTTPSResponseSink; - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForJSSinkController.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSinkController = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForJSSinkController.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSinkController = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject& globalObject); - - ~JSReadableHTTPSResponseSinkController(); - - void* wrapped() const { return m_sinkPtr; } - void detach(); - - void start(JSC::JSGlobalObject* globalObject, JSC::JSValue readableStream, JSC::JSValue onPull, JSC::JSValue onClose); - DECLARE_VISIT_CHILDREN; - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - - void* m_sinkPtr; - mutable WriteBarrier m_onPull; - mutable WriteBarrier m_onClose; - mutable JSC::Weak m_weakReadableStream; - - JSReadableHTTPSResponseSinkController(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_sinkPtr = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -JSC_DECLARE_CUSTOM_GETTER(functionHTTPSResponseSink__getter); - -JSObject* createJSSinkPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, WebCore::SinkID sinkID); -JSObject* createJSSinkControllerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, WebCore::SinkID sinkID); -Structure* createJSSinkControllerStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, WebCore::SinkID sinkID); -} // namespace WebCore diff --git a/src/bun.js/bindings/JSSinkLookupTable.h b/src/bun.js/bindings/JSSinkLookupTable.h deleted file mode 100644 index 78183692a6d47..0000000000000 --- a/src/bun.js/bindings/JSSinkLookupTable.h +++ /dev/null @@ -1,321 +0,0 @@ -// Automatically generated from src/bun.js/bindings/JSSink.cpp using ./src/bun.js/scripts/create_hash_table. DO NOT EDIT! - - - - - -static const struct CompactHashIndex JSArrayBufferSinkPrototypeTableIndex[19] = { - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 6, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 0, 16 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 5, -1 }, - { 4, -1 }, - { 1, 17 }, - { 2, 18 }, - { 3, -1 }, -}; - -static const struct HashTableValue JSArrayBufferSinkPrototypeTableValues[7] = { - { "close"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__doClose, 0 } }, - { "flush"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__flush, 1 } }, - { "end"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__end, 0 } }, - { "start"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__start, 1 } }, - { "write"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__write, 1 } }, - { "ref"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__ref, 0 } }, - { "unref"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__unref, 0 } }, -}; - -static const struct HashTable JSArrayBufferSinkPrototypeTable = - { 7, 15, false, nullptr, JSArrayBufferSinkPrototypeTableValues, JSArrayBufferSinkPrototypeTableIndex }; - - - - - - - -static const struct CompactHashIndex JSReadableArrayBufferSinkControllerPrototypeTableIndex[19] = { - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 0, 16 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 4, -1 }, - { 1, 17 }, - { 2, 18 }, - { 3, -1 }, -}; - -static const struct HashTableValue JSReadableArrayBufferSinkControllerPrototypeTableValues[5] = { - { "close"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, JSReadableArrayBufferSinkController__close, 0 } }, - { "flush"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__flush, 1 } }, - { "end"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, JSReadableArrayBufferSinkController__end, 0 } }, - { "start"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__start, 1 } }, - { "write"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__write, 1 } }, -}; - -static const struct HashTable JSReadableArrayBufferSinkControllerPrototypeTable = - { 5, 15, false, nullptr, JSReadableArrayBufferSinkControllerPrototypeTableValues, JSReadableArrayBufferSinkControllerPrototypeTableIndex }; - - - - - - - -static const struct CompactHashIndex JSFileSinkPrototypeTableIndex[19] = { - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 6, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 0, 16 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 5, -1 }, - { 4, -1 }, - { 1, 17 }, - { 2, 18 }, - { 3, -1 }, -}; - -static const struct HashTableValue JSFileSinkPrototypeTableValues[7] = { - { "close"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__doClose, 0 } }, - { "flush"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__flush, 1 } }, - { "end"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__end, 0 } }, - { "start"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__start, 1 } }, - { "write"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__write, 1 } }, - { "ref"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__ref, 0 } }, - { "unref"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__unref, 0 } }, -}; - -static const struct HashTable JSFileSinkPrototypeTable = - { 7, 15, false, nullptr, JSFileSinkPrototypeTableValues, JSFileSinkPrototypeTableIndex }; - - - - - - - -static const struct CompactHashIndex JSReadableFileSinkControllerPrototypeTableIndex[19] = { - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 0, 16 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 4, -1 }, - { 1, 17 }, - { 2, 18 }, - { 3, -1 }, -}; - -static const struct HashTableValue JSReadableFileSinkControllerPrototypeTableValues[5] = { - { "close"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, JSReadableFileSinkController__close, 0 } }, - { "flush"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__flush, 1 } }, - { "end"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, JSReadableFileSinkController__end, 0 } }, - { "start"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__start, 1 } }, - { "write"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__write, 1 } }, -}; - -static const struct HashTable JSReadableFileSinkControllerPrototypeTable = - { 5, 15, false, nullptr, JSReadableFileSinkControllerPrototypeTableValues, JSReadableFileSinkControllerPrototypeTableIndex }; - - - - - - - -static const struct CompactHashIndex JSHTTPResponseSinkPrototypeTableIndex[19] = { - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 6, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 0, 16 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 5, -1 }, - { 4, -1 }, - { 1, 17 }, - { 2, 18 }, - { 3, -1 }, -}; - -static const struct HashTableValue JSHTTPResponseSinkPrototypeTableValues[7] = { - { "close"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__doClose, 0 } }, - { "flush"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__flush, 1 } }, - { "end"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__end, 0 } }, - { "start"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__start, 1 } }, - { "write"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__write, 1 } }, - { "ref"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__ref, 0 } }, - { "unref"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__unref, 0 } }, -}; - -static const struct HashTable JSHTTPResponseSinkPrototypeTable = - { 7, 15, false, nullptr, JSHTTPResponseSinkPrototypeTableValues, JSHTTPResponseSinkPrototypeTableIndex }; - - - - - - - -static const struct CompactHashIndex JSReadableHTTPResponseSinkControllerPrototypeTableIndex[19] = { - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 0, 16 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 4, -1 }, - { 1, 17 }, - { 2, 18 }, - { 3, -1 }, -}; - -static const struct HashTableValue JSReadableHTTPResponseSinkControllerPrototypeTableValues[5] = { - { "close"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, JSReadableHTTPResponseSinkController__close, 0 } }, - { "flush"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__flush, 1 } }, - { "end"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, JSReadableHTTPResponseSinkController__end, 0 } }, - { "start"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__start, 1 } }, - { "write"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__write, 1 } }, -}; - -static const struct HashTable JSReadableHTTPResponseSinkControllerPrototypeTable = - { 5, 15, false, nullptr, JSReadableHTTPResponseSinkControllerPrototypeTableValues, JSReadableHTTPResponseSinkControllerPrototypeTableIndex }; - - - - - - - -static const struct CompactHashIndex JSHTTPSResponseSinkPrototypeTableIndex[19] = { - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 6, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 0, 16 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 5, -1 }, - { 4, -1 }, - { 1, 17 }, - { 2, 18 }, - { 3, -1 }, -}; - -static const struct HashTableValue JSHTTPSResponseSinkPrototypeTableValues[7] = { - { "close"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__doClose, 0 } }, - { "flush"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__flush, 1 } }, - { "end"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__end, 0 } }, - { "start"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__start, 1 } }, - { "write"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__write, 1 } }, - { "ref"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__ref, 0 } }, - { "unref"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__unref, 0 } }, -}; - -static const struct HashTable JSHTTPSResponseSinkPrototypeTable = - { 7, 15, false, nullptr, JSHTTPSResponseSinkPrototypeTableValues, JSHTTPSResponseSinkPrototypeTableIndex }; - - - - - - - -static const struct CompactHashIndex JSReadableHTTPSResponseSinkControllerPrototypeTableIndex[19] = { - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 0, 16 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 4, -1 }, - { 1, 17 }, - { 2, 18 }, - { 3, -1 }, -}; - -static const struct HashTableValue JSReadableHTTPSResponseSinkControllerPrototypeTableValues[5] = { - { "close"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, JSReadableHTTPSResponseSinkController__close, 0 } }, - { "flush"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__flush, 1 } }, - { "end"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, JSReadableHTTPSResponseSinkController__end, 0 } }, - { "start"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__start, 1 } }, - { "write"_s, static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__write, 1 } }, -}; - -static const struct HashTable JSReadableHTTPSResponseSinkControllerPrototypeTable = - { 5, 15, false, nullptr, JSReadableHTTPSResponseSinkControllerPrototypeTableValues, JSReadableHTTPSResponseSinkControllerPrototypeTableIndex }; - - diff --git a/src/bun.js/bindings/JSStringDecoder.cpp b/src/bun.js/bindings/JSStringDecoder.cpp index b8c2dd50cd1e6..1a34ffae9f039 100644 --- a/src/bun.js/bindings/JSStringDecoder.cpp +++ b/src/bun.js/bindings/JSStringDecoder.cpp @@ -1,13 +1,13 @@ #include "JSStringDecoder.h" #include "JSBuffer.h" -#include "JavaScriptCore/Lookup.h" -#include "JavaScriptCore/ObjectConstructor.h" +#include +#include #include "ZigGlobalObject.h" #include "JSDOMOperation.h" #include "JSDOMAttribute.h" #include "headers.h" #include "JSDOMConvertEnumeration.h" -#include "JavaScriptCore/JSArrayBufferView.h" +#include #include "BunClientData.h" namespace WebCore { @@ -22,7 +22,7 @@ static JSC_DECLARE_CUSTOM_GETTER(jsStringDecoder_lastChar); static JSC_DECLARE_CUSTOM_GETTER(jsStringDecoder_lastNeed); static JSC_DECLARE_CUSTOM_GETTER(jsStringDecoder_lastTotal); -static inline EncodedJSValue jsStringDecoderCast(JSGlobalObject* globalObject, JSValue stringDecoderValue) +static inline JSC::EncodedJSValue jsStringDecoderCast(JSGlobalObject* globalObject, JSValue stringDecoderValue) { if (LIKELY(jsDynamicCast(stringDecoderValue))) return JSValue::encode(stringDecoderValue); @@ -205,9 +205,12 @@ JSC::JSValue JSStringDecoder::text(JSC::VM& vm, JSC::JSGlobalObject* globalObjec } default: { // should never reach here. - RETURN_IF_EXCEPTION(throwScope, JSC::jsUndefined()); + RELEASE_AND_RETURN(throwScope, JSC::jsUndefined()); + break; } } + + __builtin_unreachable(); } JSC::JSValue JSStringDecoder::write(JSC::VM& vm, JSC::JSGlobalObject* globalObject, uint8_t* bufPtr, uint32_t length) @@ -245,6 +248,8 @@ JSC::JSValue JSStringDecoder::write(JSC::VM& vm, JSC::JSGlobalObject* globalObje RELEASE_AND_RETURN(throwScope, JSC::JSValue::decode(Bun__encoding__toString(bufPtr, length, globalObject, static_cast(m_encoding)))); } } + + __builtin_unreachable(); } class ResetScope final { @@ -404,7 +409,7 @@ static inline JSC::EncodedJSValue jsStringDecoderPrototypeFunction_textBody(JSC: RELEASE_AND_RETURN(throwScope, JSC::JSValue::encode(castedThis->write(vm, lexicalGlobalObject, reinterpret_cast(view->vector()) + offset, byteLength - offset))); } -static JSC_DEFINE_HOST_FUNCTION(jsStringDecoderPrototypeFunction_write, +JSC_DEFINE_HOST_FUNCTION(jsStringDecoderPrototypeFunction_write, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { JSValue stringDecoderValue = JSValue::decode(jsStringDecoderCast(globalObject, callFrame->thisValue())); @@ -414,7 +419,7 @@ static JSC_DEFINE_HOST_FUNCTION(jsStringDecoderPrototypeFunction_write, JSStringDecoder* castedThis = jsCast(stringDecoderValue); return jsStringDecoderPrototypeFunction_writeBody(globalObject, callFrame, castedThis); } -static JSC_DEFINE_HOST_FUNCTION(jsStringDecoderPrototypeFunction_end, +JSC_DEFINE_HOST_FUNCTION(jsStringDecoderPrototypeFunction_end, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { JSValue stringDecoderValue = JSValue::decode(jsStringDecoderCast(globalObject, callFrame->thisValue())); @@ -424,7 +429,7 @@ static JSC_DEFINE_HOST_FUNCTION(jsStringDecoderPrototypeFunction_end, JSStringDecoder* castedThis = jsCast(stringDecoderValue); return jsStringDecoderPrototypeFunction_endBody(globalObject, callFrame, castedThis); } -static JSC_DEFINE_HOST_FUNCTION(jsStringDecoderPrototypeFunction_text, +JSC_DEFINE_HOST_FUNCTION(jsStringDecoderPrototypeFunction_text, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { JSValue stringDecoderValue = JSValue::decode(jsStringDecoderCast(globalObject, callFrame->thisValue())); @@ -436,7 +441,7 @@ static JSC_DEFINE_HOST_FUNCTION(jsStringDecoderPrototypeFunction_text, return jsStringDecoderPrototypeFunction_textBody(globalObject, callFrame, castedThis); } -static JSC_DEFINE_CUSTOM_GETTER(jsStringDecoder_lastChar, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +static JSC_DEFINE_CUSTOM_GETTER(jsStringDecoder_lastChar, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = JSC::getVM(lexicalGlobalObject); JSValue stringDecoderValue = JSValue::decode(jsStringDecoderCast(lexicalGlobalObject, JSValue::decode(thisValue))); @@ -450,7 +455,7 @@ static JSC_DEFINE_CUSTOM_GETTER(jsStringDecoder_lastChar, (JSGlobalObject * lexi JSC::JSUint8Array* uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, globalObject->JSBufferSubclassStructure(), WTFMove(buffer), 0, 4); RELEASE_AND_RETURN(throwScope, JSC::JSValue::encode(uint8Array)); } -static JSC_DEFINE_CUSTOM_GETTER(jsStringDecoder_lastNeed, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +static JSC_DEFINE_CUSTOM_GETTER(jsStringDecoder_lastNeed, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = JSC::getVM(lexicalGlobalObject); JSValue stringDecoderValue = JSValue::decode(jsStringDecoderCast(lexicalGlobalObject, JSValue::decode(thisValue))); @@ -461,7 +466,7 @@ static JSC_DEFINE_CUSTOM_GETTER(jsStringDecoder_lastNeed, (JSGlobalObject * lexi auto throwScope = DECLARE_THROW_SCOPE(vm); RELEASE_AND_RETURN(throwScope, JSC::JSValue::encode(JSC::jsNumber(thisObject->m_lastNeed))); } -static JSC_DEFINE_CUSTOM_GETTER(jsStringDecoder_lastTotal, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +static JSC_DEFINE_CUSTOM_GETTER(jsStringDecoder_lastTotal, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = JSC::getVM(lexicalGlobalObject); JSValue stringDecoderValue = JSValue::decode(jsStringDecoderCast(lexicalGlobalObject, JSValue::decode(thisValue))); diff --git a/src/bun.js/bindings/KeyObject.cpp b/src/bun.js/bindings/KeyObject.cpp index d5782779da12e..d770c67a5b887 100644 --- a/src/bun.js/bindings/KeyObject.cpp +++ b/src/bun.js/bindings/KeyObject.cpp @@ -145,7 +145,7 @@ AsymmetricKeyValueWithDER KeyObject__ParsePublicKeyPEM(const char* key_pem, size_t key_pem_len) { auto bp = BIOPtr(BIO_new_mem_buf(const_cast(key_pem), key_pem_len)); - auto result = (AsymmetricKeyValueWithDER) { .key = nullptr, .der_data = nullptr, .der_len = 0 }; + auto result = AsymmetricKeyValueWithDER { .key = nullptr, .der_data = nullptr, .der_len = 0 }; if (!bp) { ERR_clear_error(); @@ -1178,7 +1178,6 @@ JSC::EncodedJSValue KeyObject__createPublicKey(JSC::JSGlobalObject* globalObject JSC::EncodedJSValue KeyObject__createSecretKey(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - JSValue bufferArg = callFrame->uncheckedArgument(0); auto& vm = lexicalGlobalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); @@ -1194,7 +1193,6 @@ JSC::EncodedJSValue KeyObject__createSecretKey(JSC::JSGlobalObject* lexicalGloba auto type = bufferArgCell->type(); switch (type) { - case DataViewType: case Uint8ArrayType: case Uint8ClampedArrayType: @@ -2071,8 +2069,8 @@ JSC::EncodedJSValue KeyObject__generateKeyPairSync(JSC::JSGlobalObject* lexicalG publicExponentArray[0] = (uint8_t)(publicExponent >> 24); publicExponentArray[1] = (uint8_t)(publicExponent >> 16); publicExponentArray[2] = (uint8_t)(publicExponent >> 8); - publicExponentArray[3] = (uint8_t)publicExponent; - + publicExponentArray[3] = (uint8_t)publicExponent; + int modulusLength = modulusLengthJS.toUInt32(lexicalGlobalObject); auto returnValue = JSC::JSValue {}; auto keyPairCallback = [&](CryptoKeyPair&& pair) { @@ -2107,17 +2105,17 @@ JSC::EncodedJSValue KeyObject__generateKeyPairSync(JSC::JSGlobalObject* lexicalG } auto namedCurve = namedCurveJS.toWTFString(lexicalGlobalObject); RETURN_IF_EXCEPTION(scope, encodedJSValue()); - if(namedCurve == "P-384"_s || namedCurve == "p384"_s || namedCurve == "secp384r1"_s) { + if (namedCurve == "P-384"_s || namedCurve == "p384"_s || namedCurve == "secp384r1"_s) { namedCurve = "P-384"_s; - } else if(namedCurve == "P-256"_s || namedCurve == "p256"_s || namedCurve == "prime256v1"_s) { + } else if (namedCurve == "P-256"_s || namedCurve == "p256"_s || namedCurve == "prime256v1"_s) { namedCurve = "P-256"_s; - } else if(namedCurve == "P-521"_s || namedCurve == "p521"_s || namedCurve == "secp521r1"_s) { + } else if (namedCurve == "P-521"_s || namedCurve == "p521"_s || namedCurve == "secp521r1"_s) { namedCurve = "P-521"_s; - }else { + } else { throwException(lexicalGlobalObject, scope, createTypeError(lexicalGlobalObject, "curve not supported"_s)); - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } - + auto result = CryptoKeyEC::generatePair(CryptoAlgorithmIdentifier::ECDSA, namedCurve, true, CryptoKeyUsageSign | CryptoKeyUsageVerify); if (result.hasException()) { WebCore::propagateException(*lexicalGlobalObject, scope, result.releaseException()); @@ -2190,7 +2188,9 @@ JSC::EncodedJSValue KeyObject__generateKeySync(JSC::JSGlobalObject* lexicalGloba throwException(lexicalGlobalObject, scope, createTypeError(lexicalGlobalObject, "Invalid length"_s)); return JSValue::encode(JSC::jsUndefined()); } - return JSC::JSValue::encode(JSCryptoKey::create(structure, zigGlobalObject, WTFMove(result.releaseNonNull()))); + // TODO(@paperdave 2023-10-19): i removed WTFMove from result.releaseNonNull() as per MSVC compiler error. + // We need to evaluate if that is the proper fix here. + return JSC::JSValue::encode(JSCryptoKey::create(structure, zigGlobalObject, (result.releaseNonNull()))); } else if (type_str == "aes"_s) { Zig::GlobalObject* zigGlobalObject = reinterpret_cast(lexicalGlobalObject); auto* structure = zigGlobalObject->JSCryptoKeyStructure(); @@ -2209,7 +2209,9 @@ JSC::EncodedJSValue KeyObject__generateKeySync(JSC::JSGlobalObject* lexicalGloba throwException(lexicalGlobalObject, scope, createTypeError(lexicalGlobalObject, "Invalid length"_s)); return JSValue::encode(JSC::jsUndefined()); } - return JSC::JSValue::encode(JSCryptoKey::create(structure, zigGlobalObject, WTFMove(result.releaseNonNull()))); + // TODO(@paperdave 2023-10-19): i removed WTFMove from result.releaseNonNull() as per MSVC compiler error. + // We need to evaluate if that is the proper fix here. + return JSC::JSValue::encode(JSCryptoKey::create(structure, zigGlobalObject, (result.releaseNonNull()))); } else { throwException(lexicalGlobalObject, scope, createTypeError(lexicalGlobalObject, "algorithm should be 'aes' or 'hmac'"_s)); return JSValue::encode(JSC::jsUndefined()); @@ -2281,23 +2283,23 @@ static AsymmetricKeyValue GetInternalAsymmetricKey(WebCore::CryptoKey& key) case CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5: case CryptoAlgorithmIdentifier::RSA_OAEP: case CryptoAlgorithmIdentifier::RSA_PSS: - return (AsymmetricKeyValue) { .key = downcast(key).platformKey(), .owned = false }; + return AsymmetricKeyValue { .key = downcast(key).platformKey(), .owned = false }; case CryptoAlgorithmIdentifier::ECDSA: case CryptoAlgorithmIdentifier::ECDH: - return (AsymmetricKeyValue) { .key = downcast(key).platformKey(), .owned = false }; + return AsymmetricKeyValue { .key = downcast(key).platformKey(), .owned = false }; case CryptoAlgorithmIdentifier::Ed25519: { const auto& okpKey = downcast(key); auto keyData = okpKey.exportKey(); if (okpKey.type() == CryptoKeyType::Private) { auto* evp_key = EVP_PKEY_new_raw_private_key(okpKey.namedCurve() == CryptoKeyOKP::NamedCurve::X25519 ? EVP_PKEY_X25519 : EVP_PKEY_ED25519, nullptr, keyData.data(), keyData.size()); - return (AsymmetricKeyValue) { .key = evp_key, .owned = true }; + return AsymmetricKeyValue { .key = evp_key, .owned = true }; } else { auto* evp_key = EVP_PKEY_new_raw_public_key(okpKey.namedCurve() == CryptoKeyOKP::NamedCurve::X25519 ? EVP_PKEY_X25519 : EVP_PKEY_ED25519, nullptr, keyData.data(), keyData.size()); - return (AsymmetricKeyValue) { .key = evp_key, .owned = true }; + return AsymmetricKeyValue { .key = evp_key, .owned = true }; } } default: - return (AsymmetricKeyValue) { .key = NULL, .owned = false }; + return AsymmetricKeyValue { .key = NULL, .owned = false }; } } diff --git a/src/bun.js/bindings/ModuleLoader.cpp b/src/bun.js/bindings/ModuleLoader.cpp index 55e0bbf821e8d..209add950bb63 100644 --- a/src/bun.js/bindings/ModuleLoader.cpp +++ b/src/bun.js/bindings/ModuleLoader.cpp @@ -4,25 +4,23 @@ #include "ModuleLoader.h" #include "ZigGlobalObject.h" -#include "JavaScriptCore/JSCInlines.h" -#include "JavaScriptCore/JSNativeStdFunction.h" -#include "JavaScriptCore/JSCJSValueInlines.h" -#include "JavaScriptCore/JSInternalPromise.h" -#include "JavaScriptCore/JSInternalFieldObjectImpl.h" +#include +#include +#include +#include +#include #include "ZigSourceProvider.h" -#include "JavaScriptCore/JSSourceCode.h" -#include "JavaScriptCore/JSString.h" -#include "JavaScriptCore/JSValueInternal.h" -#include "JavaScriptCore/JSVirtualMachineInternal.h" -#include "JavaScriptCore/ObjectConstructor.h" -#include "JavaScriptCore/OptionsList.h" -#include "JavaScriptCore/ParserError.h" -#include "JavaScriptCore/ScriptExecutable.h" -#include "JavaScriptCore/SourceOrigin.h" -#include "JavaScriptCore/StackFrame.h" -#include "JavaScriptCore/StackVisitor.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "EventEmitter.h" #include "JSEventEmitter.h" @@ -34,7 +32,7 @@ #include #include "../modules/_NativeModule.h" -#include "../../js/out/NativeModuleImpl.h" +#include "NativeModuleImpl.h" #include "../modules/ObjectModule.h" @@ -66,8 +64,7 @@ static JSC::JSInternalPromise* resolvedInternalPromise(JSC::JSGlobalObject* glob } // Converts an object from InternalModuleRegistry into { ...obj, default: obj } -static JSC::SyntheticSourceProvider::SyntheticSourceGenerator -generateInternalModuleSourceCode(JSC::JSGlobalObject* globalObject, InternalModuleRegistry::Field moduleId) +static JSC::SyntheticSourceProvider::SyntheticSourceGenerator generateInternalModuleSourceCode(JSC::JSGlobalObject* globalObject, InternalModuleRegistry::Field moduleId) { return [moduleId](JSC::JSGlobalObject* lexicalGlobalObject, JSC::Identifier moduleKey, @@ -81,14 +78,14 @@ generateInternalModuleSourceCode(JSC::JSGlobalObject* globalObject, InternalModu if (!object) { return; } - RETURN_IF_EXCEPTION(throwScope, {}); + RETURN_IF_EXCEPTION(throwScope, void()); JSC::EnsureStillAliveScope stillAlive(object); PropertyNameArray properties(vm, PropertyNameMode::Strings, PrivateSymbolMode::Exclude); object->getPropertyNames(globalObject, properties, DontEnumPropertiesMode::Exclude); - RETURN_IF_EXCEPTION(throwScope, {}); + RETURN_IF_EXCEPTION(throwScope, void()); auto len = properties.size() + 1; exportNames.reserveCapacity(len); @@ -386,7 +383,7 @@ static JSValue handleVirtualModuleResult( } extern "C" void Bun__onFulfillAsyncModule( - EncodedJSValue promiseValue, + JSC::EncodedJSValue promiseValue, ErrorableResolvedSource* res, BunString* specifier, BunString* referrer) diff --git a/src/bun.js/bindings/ModuleLoader.h b/src/bun.js/bindings/ModuleLoader.h index e6070d5385028..d3bfec337c750 100644 --- a/src/bun.js/bindings/ModuleLoader.h +++ b/src/bun.js/bindings/ModuleLoader.h @@ -1,7 +1,7 @@ #include "root.h" #include "headers-handwritten.h" -#include "JavaScriptCore/JSCInlines.h" +#include #include "BunClientData.h" extern "C" JSC::EncodedJSValue jsFunctionOnLoadObjectResultResolve(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame); diff --git a/src/bun.js/bindings/NodeVMScript.cpp b/src/bun.js/bindings/NodeVMScript.cpp index e0e0dc93aa265..17a50f70608e7 100644 --- a/src/bun.js/bindings/NodeVMScript.cpp +++ b/src/bun.js/bindings/NodeVMScript.cpp @@ -20,9 +20,8 @@ #include "JavaScriptCore/JSWeakMapInlines.h" #include "JavaScriptCore/JSWithScope.h" #include "JavaScriptCore/JSGlobalProxyInlines.h" -#include "Buffer.h" #include "GCDefferalContext.h" -#include "Buffer.h" +#include "JSBuffer.h" #include #include "DOMJITIDLConvert.h" @@ -128,7 +127,7 @@ constructScript(JSGlobalObject* globalObject, CallFrame* callFrame, JSValue newT return JSValue::encode(JSValue(script)); } -static EncodedJSValue runInContext(JSGlobalObject* globalObject, NodeVMScript* script, JSObject* globalThis, JSScope* scope, JSValue optionsArg) +static JSC::EncodedJSValue runInContext(JSGlobalObject* globalObject, NodeVMScript* script, JSObject* globalThis, JSScope* scope, JSValue optionsArg) { auto& vm = globalObject->vm(); @@ -170,7 +169,7 @@ JSC_DEFINE_HOST_FUNCTION(scriptConstructorConstruct, (JSGlobalObject * globalObj return constructScript(globalObject, callFrame, callFrame->newTarget()); } -JSC_DEFINE_CUSTOM_GETTER(scriptGetCachedDataRejected, (JSGlobalObject * globalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(scriptGetCachedDataRejected, (JSGlobalObject * globalObject, JSC::EncodedJSValue thisValue, PropertyName)) { auto& vm = globalObject->vm(); return JSValue::encode(jsBoolean(true)); // TODO @@ -427,7 +426,7 @@ JSC_DEFINE_HOST_FUNCTION(scriptRunInThisContext, (JSGlobalObject * globalObject, return runInContext(globalObject, script, globalObject->globalThis(), contextScope, callFrame->argument(1)); } -JSC_DEFINE_CUSTOM_GETTER(scriptGetSourceMapURL, (JSGlobalObject * globalObject, EncodedJSValue thisValueEncoded, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(scriptGetSourceMapURL, (JSGlobalObject * globalObject, JSC::EncodedJSValue thisValueEncoded, PropertyName)) { auto& vm = globalObject->vm(); JSValue thisValue = JSValue::decode(thisValueEncoded); diff --git a/src/bun.js/bindings/NodeVMScript.h b/src/bun.js/bindings/NodeVMScript.h index 68ddd4c6a0434..cb1476b2683ca 100644 --- a/src/bun.js/bindings/NodeVMScript.h +++ b/src/bun.js/bindings/NodeVMScript.h @@ -3,12 +3,12 @@ #include "root.h" #include "ZigGlobalObject.h" -#include "JavaScriptCore/JSFunction.h" -#include "JavaScriptCore/VM.h" +#include +#include #include "headers-handwritten.h" #include "BunClientData.h" -#include "JavaScriptCore/CallFrame.h" +#include namespace WebCore { @@ -62,7 +62,7 @@ class NodeVMScript final : public JSC::JSDestructibleObject { const JSC::SourceCode& source() const { return m_source; } DECLARE_VISIT_CHILDREN; - mutable WriteBarrier m_cachedDirectExecutable; + mutable JSC::WriteBarrier m_cachedDirectExecutable; private: JSC::SourceCode m_source; diff --git a/src/bun.js/bindings/Path.cpp b/src/bun.js/bindings/Path.cpp index 6507b7122edcc..d9229a5065ee7 100644 --- a/src/bun.js/bindings/Path.cpp +++ b/src/bun.js/bindings/Path.cpp @@ -3,9 +3,9 @@ #include "headers.h" #include "BunClientData.h" -#include "JavaScriptCore/JSFunction.h" -#include "JavaScriptCore/JSMicrotask.h" -#include "JavaScriptCore/ObjectConstructor.h" +#include +#include +#include #pragma mark - Node.js Path @@ -57,69 +57,69 @@ using namespace JSC; // clang-format on -static JSC_DECLARE_HOST_FUNCTION(Path_functionBasename); -static JSC_DEFINE_HOST_FUNCTION(Path_functionBasename, +JSC_DECLARE_HOST_FUNCTION(Path_functionBasename); +JSC_DEFINE_HOST_FUNCTION(Path_functionBasename, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { DEFINE_CALLBACK_FUNCTION_BODY(Bun__Path__basename); } -static JSC_DECLARE_HOST_FUNCTION(Path_functionDirname); -static JSC_DEFINE_HOST_FUNCTION(Path_functionDirname, +JSC_DECLARE_HOST_FUNCTION(Path_functionDirname); +JSC_DEFINE_HOST_FUNCTION(Path_functionDirname, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { DEFINE_CALLBACK_FUNCTION_BODY(Bun__Path__dirname); } -static JSC_DECLARE_HOST_FUNCTION(Path_functionExtname); -static JSC_DEFINE_HOST_FUNCTION(Path_functionExtname, + +JSC_DEFINE_HOST_FUNCTION(Path_functionExtname, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { DEFINE_CALLBACK_FUNCTION_BODY(Bun__Path__extname); } -static JSC_DECLARE_HOST_FUNCTION(Path_functionFormat); -static JSC_DEFINE_HOST_FUNCTION(Path_functionFormat, + +JSC_DEFINE_HOST_FUNCTION(Path_functionFormat, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { DEFINE_CALLBACK_FUNCTION_BODY(Bun__Path__format); } -static JSC_DECLARE_HOST_FUNCTION(Path_functionIsAbsolute); -static JSC_DEFINE_HOST_FUNCTION(Path_functionIsAbsolute, + +JSC_DEFINE_HOST_FUNCTION(Path_functionIsAbsolute, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { DEFINE_CALLBACK_FUNCTION_BODY(Bun__Path__isAbsolute); } -static JSC_DECLARE_HOST_FUNCTION(Path_functionJoin); -static JSC_DEFINE_HOST_FUNCTION(Path_functionJoin, + +JSC_DEFINE_HOST_FUNCTION(Path_functionJoin, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { DEFINE_CALLBACK_FUNCTION_BODY(Bun__Path__join); } -static JSC_DECLARE_HOST_FUNCTION(Path_functionNormalize); -static JSC_DEFINE_HOST_FUNCTION(Path_functionNormalize, + +JSC_DEFINE_HOST_FUNCTION(Path_functionNormalize, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { DEFINE_CALLBACK_FUNCTION_BODY(Bun__Path__normalize); } -static JSC_DECLARE_HOST_FUNCTION(Path_functionParse); -static JSC_DEFINE_HOST_FUNCTION(Path_functionParse, + +JSC_DEFINE_HOST_FUNCTION(Path_functionParse, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { DEFINE_CALLBACK_FUNCTION_BODY(Bun__Path__parse); } -static JSC_DECLARE_HOST_FUNCTION(Path_functionRelative); -static JSC_DEFINE_HOST_FUNCTION(Path_functionRelative, + +JSC_DEFINE_HOST_FUNCTION(Path_functionRelative, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { DEFINE_CALLBACK_FUNCTION_BODY(Bun__Path__relative); } -static JSC_DECLARE_HOST_FUNCTION(Path_functionResolve); -static JSC_DEFINE_HOST_FUNCTION(Path_functionResolve, + +JSC_DEFINE_HOST_FUNCTION(Path_functionResolve, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { DEFINE_CALLBACK_FUNCTION_BODY(Bun__Path__resolve); } -static JSC_DECLARE_HOST_FUNCTION(Path_functionToNamespacedPath); -static JSC_DEFINE_HOST_FUNCTION(Path_functionToNamespacedPath, + +JSC_DEFINE_HOST_FUNCTION(Path_functionToNamespacedPath, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { auto argCount = static_cast(callFrame->argumentCount()); diff --git a/src/bun.js/bindings/Process.lut.h b/src/bun.js/bindings/Process.lut.h deleted file mode 100644 index 6016466c2e40e..0000000000000 --- a/src/bun.js/bindings/Process.lut.h +++ /dev/null @@ -1,343 +0,0 @@ -// File generated via `make static-hash-table` / `make cpp` -static const struct CompactHashIndex processObjectTableIndex[268] = { - { 48, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 21, -1 }, - { -1, -1 }, - { 50, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 8, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 35, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 30, -1 }, - { 14, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 60, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 56, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 44, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 0, -1 }, - { 29, -1 }, - { 38, -1 }, - { 43, -1 }, - { -1, -1 }, - { 26, -1 }, - { 13, -1 }, - { -1, -1 }, - { -1, -1 }, - { 63, -1 }, - { -1, -1 }, - { -1, -1 }, - { 34, -1 }, - { 45, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 27, -1 }, - { -1, -1 }, - { -1, -1 }, - { 23, -1 }, - { -1, -1 }, - { 5, -1 }, - { -1, -1 }, - { 65, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 28, 262 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 24, 263 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 51, 266 }, - { -1, -1 }, - { 20, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 18, 257 }, - { -1, -1 }, - { 15, -1 }, - { 58, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 3, 267 }, - { 1, -1 }, - { -1, -1 }, - { 64, -1 }, - { -1, -1 }, - { 12, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 57, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 10, 256 }, - { -1, -1 }, - { 17, 264 }, - { -1, -1 }, - { 40, -1 }, - { -1, -1 }, - { 42, -1 }, - { -1, -1 }, - { 11, 260 }, - { 6, 265 }, - { -1, -1 }, - { -1, -1 }, - { 4, -1 }, - { 52, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 2, -1 }, - { 7, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 32, 261 }, - { -1, -1 }, - { -1, -1 }, - { 49, -1 }, - { 19, 258 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 54, -1 }, - { -1, -1 }, - { 33, -1 }, - { 25, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 53, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 16, 259 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 9, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 22, -1 }, - { 31, -1 }, - { 36, -1 }, - { 37, -1 }, - { 39, -1 }, - { 41, -1 }, - { 46, -1 }, - { 47, -1 }, - { 55, -1 }, - { 59, -1 }, - { 61, -1 }, - { 62, -1 }, -}; - -static const struct HashTableValue processObjectTableValues[66] = { - { "abort"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_functionAbort, 1 } }, - { "allowedNodeEnvironmentFlags"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, Process_stubEmptySet } }, - { "arch"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructArch } }, - { "argv"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructArgv } }, - { "argv0"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructArgv0 } }, - { "assert"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_functionAssert, 1 } }, - { "binding"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_functionBinding, 1 } }, - { "browser"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructBrowser } }, - { "chdir"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_functionChdir, 1 } }, - { "config"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructProcessConfigObject } }, - { "connected"_s, static_cast(PropertyAttribute::CustomAccessor), NoIntrinsic, { HashTableValue::GetterSetterType, processConnected, setProcessConnected } }, - { "constrainedMemory"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_functionConstrainedMemory, 0 } }, - { "cpuUsage"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_functionCpuUsage, 1 } }, - { "cwd"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_functionCwd, 1 } }, - { "debugPort"_s, static_cast(PropertyAttribute::CustomAccessor), NoIntrinsic, { HashTableValue::GetterSetterType, processDebugPort, setProcessDebugPort } }, - { "disconnect"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructProcessDisconnect } }, - { "dlopen"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_functionDlopen, 1 } }, - { "emitWarning"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_emitWarning, 1 } }, - { "env"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructEnv } }, - { "execArgv"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructExecArgv } }, - { "execPath"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructExecPath } }, - { "exit"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_functionExit, 1 } }, - { "exitCode"_s, static_cast(PropertyAttribute::CustomAccessor), NoIntrinsic, { HashTableValue::GetterSetterType, processExitCode, setProcessExitCode } }, - { "features"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructFeatures } }, - { "getActiveResourcesInfo"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_stubFunctionReturningArray, 0 } }, - { "getegid"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_functiongetegid, 0 } }, - { "geteuid"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_functiongeteuid, 0 } }, - { "getgid"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_functiongetgid, 0 } }, - { "getgroups"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_functiongetgroups, 0 } }, - { "getuid"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_functiongetuid, 0 } }, - { "hrtime"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructProcessHrtimeObject } }, - { "isBun"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructIsBun } }, - { "kill"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_functionKill, 2 } }, - { "mainModule"_s, ((static_cast(PropertyAttribute::ReadOnly|PropertyAttribute::Builtin|PropertyAttribute::Accessor|PropertyAttribute::Function)) & ~PropertyAttribute::Function) | PropertyAttribute::Builtin, NoIntrinsic, { HashTableValue::BuiltinGeneratorType, processObjectMainModuleCodeGenerator, 0 } }, - { "memoryUsage"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructMemoryUsage } }, - { "moduleLoadList"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, Process_stubEmptyArray } }, - { "nextTick"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructProcessNextTickFn } }, - { "openStdin"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_functionOpenStdin, 0 } }, - { "pid"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructPid } }, - { "platform"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructPlatform } }, - { "ppid"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructPpid } }, - { "reallyExit"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_functionReallyExit, 1 } }, - { "release"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructProcessReleaseObject } }, - { "revision"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructRevision } }, - { "setSourceMapsEnabled"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_stubEmptyFunction, 1 } }, - { "send"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructProcessSend } }, - { "stderr"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructStderr } }, - { "stdin"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructStdin } }, - { "stdout"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructStdout } }, - { "title"_s, static_cast(PropertyAttribute::CustomAccessor), NoIntrinsic, { HashTableValue::GetterSetterType, processTitle, setProcessTitle } }, - { "umask"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_functionUmask, 1 } }, - { "uptime"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_functionUptime, 1 } }, - { "version"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructVersion } }, - { "versions"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructVersions } }, - { "_debugEnd"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_stubEmptyFunction, 0 } }, - { "_debugProcess"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_stubEmptyFunction, 0 } }, - { "_fatalException"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_stubEmptyFunction, 1 } }, - { "_getActiveRequests"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_stubFunctionReturningArray, 0 } }, - { "_getActiveHandles"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_stubFunctionReturningArray, 0 } }, - { "_linkedBinding"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_stubEmptyFunction, 0 } }, - { "_preload_modules"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, Process_stubEmptyArray } }, - { "_rawDebug"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_stubEmptyFunction, 0 } }, - { "_startProfilerIdleNotifier"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_stubEmptyFunction, 0 } }, - { "_stopProfilerIdleNotifier"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_stubEmptyFunction, 0 } }, - { "_tickCallback"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_stubEmptyFunction, 0 } }, - { "_kill"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_functionReallyKill, 2 } }, -}; - -static const struct HashTable processObjectTable = - { 66, 255, true, nullptr, processObjectTableValues, processObjectTableIndex }; diff --git a/src/bun.js/bindings/ProcessBindingConstants.cpp b/src/bun.js/bindings/ProcessBindingConstants.cpp index 8544b2f2082e1..2b67febb87f06 100644 --- a/src/bun.js/bindings/ProcessBindingConstants.cpp +++ b/src/bun.js/bindings/ProcessBindingConstants.cpp @@ -1,7 +1,7 @@ // Modelled off of https://github.com/nodejs/node/blob/main/src/node_constants.cc // Note that if you change any of this code, you probably also have to change NodeConstantsModule.h #include "ProcessBindingConstants.h" -#include "JavaScriptCore/ObjectConstructor.h" +#include // These headers may not all be needed, but they are the ones node references. // Most of the constants are defined with #if checks on existing #defines, instead of platform-checks diff --git a/src/bun.js/bindings/ProcessBindingConstants.lut.h b/src/bun.js/bindings/ProcessBindingConstants.lut.h deleted file mode 100644 index 4ad86860d7d2d..0000000000000 --- a/src/bun.js/bindings/ProcessBindingConstants.lut.h +++ /dev/null @@ -1,31 +0,0 @@ -// File generated via `make static-hash-table` / `make cpp` -static const struct CompactHashIndex processBindingConstantsTableIndex[17] = { - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 2, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 0, 16 }, - { -1, -1 }, - { -1, -1 }, - { 4, -1 }, - { 3, -1 }, -}; - -static const struct HashTableValue processBindingConstantsTableValues[5] = { - { "os"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingConstantsGetOs } }, - { "fs"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingConstantsGetFs } }, - { "crypto"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingConstantsGetCrypto } }, - { "zlib"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingConstantsGetZlib } }, - { "trace"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingConstantsGetTrace } }, -}; - -static const struct HashTable processBindingConstantsTable = - { 5, 15, false, nullptr, processBindingConstantsTableValues, processBindingConstantsTableIndex }; diff --git a/src/bun.js/bindings/RegularExpression.cpp b/src/bun.js/bindings/RegularExpression.cpp index c59e6fa4cd9ca..e812722b5f920 100644 --- a/src/bun.js/bindings/RegularExpression.cpp +++ b/src/bun.js/bindings/RegularExpression.cpp @@ -1,7 +1,7 @@ #include "root.h" #include "headers-handwritten.h" -#include "JavaScriptCore/RegularExpression.h" -#include "JavaScriptCore/Options.h" +#include +#include using namespace JSC; using namespace JSC::Yarr; diff --git a/src/bun.js/bindings/ScriptExecutionContext.h b/src/bun.js/bindings/ScriptExecutionContext.h index 5a43544dfbea9..9dc70bfd74557 100644 --- a/src/bun.js/bindings/ScriptExecutionContext.h +++ b/src/bun.js/bindings/ScriptExecutionContext.h @@ -12,7 +12,7 @@ #include #include #include "CachedScript.h" -#include "wtf/URL.h" +#include namespace uWS { template diff --git a/src/bun.js/bindings/StringAdaptors.h b/src/bun.js/bindings/StringAdaptors.h index 28a732a423545..cceaa3a3b3e8a 100644 --- a/src/bun.js/bindings/StringAdaptors.h +++ b/src/bun.js/bindings/StringAdaptors.h @@ -25,7 +25,7 @@ #pragma once -#include "wtf/text/WTFString.h" +#include namespace WebCore { diff --git a/src/bun.js/bindings/Strong.h b/src/bun.js/bindings/Strong.h index f39d1c6115c64..fe7bfa9e81098 100644 --- a/src/bun.js/bindings/Strong.h +++ b/src/bun.js/bindings/Strong.h @@ -1,7 +1,7 @@ #pragma once #include "root.h" -#include "JavaScriptCore/Strong.h" +#include namespace Bun { diff --git a/src/bun.js/bindings/URLDecomposition.cpp b/src/bun.js/bindings/URLDecomposition.cpp index 21168f70fa52d..8655358b58a83 100644 --- a/src/bun.js/bindings/URLDecomposition.cpp +++ b/src/bun.js/bindings/URLDecomposition.cpp @@ -25,7 +25,7 @@ #include "URLDecomposition.h" -#include "wtf/text/StringToIntegerConversion.h" +#include namespace WebCore { diff --git a/src/bun.js/bindings/URLDecomposition.h b/src/bun.js/bindings/URLDecomposition.h index 15ae093847208..bf9473dcb2304 100644 --- a/src/bun.js/bindings/URLDecomposition.h +++ b/src/bun.js/bindings/URLDecomposition.h @@ -27,9 +27,9 @@ #include "root.h" -#include "wtf/URL.h" +#include -#include "wtf/Forward.h" +#include namespace WebCore { diff --git a/src/bun.js/bindings/URLSearchParams.cpp b/src/bun.js/bindings/URLSearchParams.cpp index 37f7d0eafb357..a949648a182a6 100644 --- a/src/bun.js/bindings/URLSearchParams.cpp +++ b/src/bun.js/bindings/URLSearchParams.cpp @@ -25,7 +25,7 @@ #include "URLSearchParams.h" #include "DOMURL.h" -#include "wtf/URLParser.h" +#include #include "helpers.h" #include "JSURLSearchParams.h" diff --git a/src/bun.js/bindings/URLSearchParams.h b/src/bun.js/bindings/URLSearchParams.h index 7f9926a3a9afd..ad6dc380efbf4 100644 --- a/src/bun.js/bindings/URLSearchParams.h +++ b/src/bun.js/bindings/URLSearchParams.h @@ -26,9 +26,9 @@ #include "root.h" #include "ExceptionOr.h" -#include "wtf/Vector.h" -#include "wtf/WeakPtr.h" -#include "wtf/text/WTFString.h" +#include +#include +#include #include namespace WebCore { diff --git a/src/bun.js/bindings/ZigConsoleClient.cpp b/src/bun.js/bindings/ZigConsoleClient.cpp index 6fb364d937a9e..2cca989d9205a 100644 --- a/src/bun.js/bindings/ZigConsoleClient.cpp +++ b/src/bun.js/bindings/ZigConsoleClient.cpp @@ -1,18 +1,18 @@ #include "helpers.h" #include "headers.h" -#include "JavaScriptCore/ConsoleClient.h" -#include "JavaScriptCore/ConsoleMessage.h" -#include "JavaScriptCore/JSString.h" -#include "JavaScriptCore/ScriptArguments.h" +#include +#include +#include +#include #include "ZigConsoleClient.h" -#include "wtf/text/WTFString.h" +#include #undef ENABLE_INSPECTOR_ALTERNATE_DISPATCHERS -#include "JavaScriptCore/JSGlobalObjectInspectorController.h" -#include "JavaScriptCore/JSGlobalObjectDebuggable.h" -#include "JavaScriptCore/ConsoleClient.h" +#include +#include +#include #include "GCDefferalContext.h" diff --git a/src/bun.js/bindings/ZigConsoleClient.h b/src/bun.js/bindings/ZigConsoleClient.h index 684e928fd4feb..f8c0731de0c40 100644 --- a/src/bun.js/bindings/ZigConsoleClient.h +++ b/src/bun.js/bindings/ZigConsoleClient.h @@ -1,8 +1,8 @@ #pragma once -#include "JavaScriptCore/ConsoleClient.h" -#include "wtf/Vector.h" -#include "wtf/text/WTFString.h" +#include +#include +#include namespace Inspector { class InspectorConsoleAgent; diff --git a/src/bun.js/bindings/ZigGeneratedClasses+DOMClientIsoSubspaces.h b/src/bun.js/bindings/ZigGeneratedClasses+DOMClientIsoSubspaces.h deleted file mode 100644 index cef5c512a7c59..0000000000000 --- a/src/bun.js/bindings/ZigGeneratedClasses+DOMClientIsoSubspaces.h +++ /dev/null @@ -1,52 +0,0 @@ -std::unique_ptr m_clientSubspaceForAttributeIterator; -std::unique_ptr m_clientSubspaceForBigIntStats; -std::unique_ptr m_clientSubspaceForBigIntStatsConstructor;std::unique_ptr m_clientSubspaceForBlob; -std::unique_ptr m_clientSubspaceForBlobConstructor;std::unique_ptr m_clientSubspaceForBuildArtifact; -std::unique_ptr m_clientSubspaceForBuildMessage; -std::unique_ptr m_clientSubspaceForBuildMessageConstructor;std::unique_ptr m_clientSubspaceForComment; -std::unique_ptr m_clientSubspaceForCrypto; -std::unique_ptr m_clientSubspaceForCryptoConstructor;std::unique_ptr m_clientSubspaceForCryptoHasher; -std::unique_ptr m_clientSubspaceForCryptoHasherConstructor;std::unique_ptr m_clientSubspaceForDebugHTTPSServer; -std::unique_ptr m_clientSubspaceForDebugHTTPServer; -std::unique_ptr m_clientSubspaceForDirent; -std::unique_ptr m_clientSubspaceForDirentConstructor;std::unique_ptr m_clientSubspaceForDocEnd; -std::unique_ptr m_clientSubspaceForDocType; -std::unique_ptr m_clientSubspaceForElement; -std::unique_ptr m_clientSubspaceForEndTag; -std::unique_ptr m_clientSubspaceForExpect; -std::unique_ptr m_clientSubspaceForExpectConstructor;std::unique_ptr m_clientSubspaceForExpectAny; -std::unique_ptr m_clientSubspaceForExpectAnything; -std::unique_ptr m_clientSubspaceForExpectArrayContaining; -std::unique_ptr m_clientSubspaceForExpectStringContaining; -std::unique_ptr m_clientSubspaceForExpectStringMatching; -std::unique_ptr m_clientSubspaceForFFI; -std::unique_ptr m_clientSubspaceForFSWatcher; -std::unique_ptr m_clientSubspaceForFileSystemRouter; -std::unique_ptr m_clientSubspaceForFileSystemRouterConstructor;std::unique_ptr m_clientSubspaceForHTMLRewriter; -std::unique_ptr m_clientSubspaceForHTMLRewriterConstructor;std::unique_ptr m_clientSubspaceForHTTPSServer; -std::unique_ptr m_clientSubspaceForHTTPServer; -std::unique_ptr m_clientSubspaceForListener; -std::unique_ptr m_clientSubspaceForMD4; -std::unique_ptr m_clientSubspaceForMD4Constructor;std::unique_ptr m_clientSubspaceForMD5; -std::unique_ptr m_clientSubspaceForMD5Constructor;std::unique_ptr m_clientSubspaceForMatchedRoute; -std::unique_ptr m_clientSubspaceForNodeJSFS; -std::unique_ptr m_clientSubspaceForNodeJSFSConstructor;std::unique_ptr m_clientSubspaceForRequest; -std::unique_ptr m_clientSubspaceForRequestConstructor;std::unique_ptr m_clientSubspaceForResolveMessage; -std::unique_ptr m_clientSubspaceForResolveMessageConstructor;std::unique_ptr m_clientSubspaceForResponse; -std::unique_ptr m_clientSubspaceForResponseConstructor;std::unique_ptr m_clientSubspaceForSHA1; -std::unique_ptr m_clientSubspaceForSHA1Constructor;std::unique_ptr m_clientSubspaceForSHA224; -std::unique_ptr m_clientSubspaceForSHA224Constructor;std::unique_ptr m_clientSubspaceForSHA256; -std::unique_ptr m_clientSubspaceForSHA256Constructor;std::unique_ptr m_clientSubspaceForSHA384; -std::unique_ptr m_clientSubspaceForSHA384Constructor;std::unique_ptr m_clientSubspaceForSHA512; -std::unique_ptr m_clientSubspaceForSHA512Constructor;std::unique_ptr m_clientSubspaceForSHA512_256; -std::unique_ptr m_clientSubspaceForSHA512_256Constructor;std::unique_ptr m_clientSubspaceForServerWebSocket; -std::unique_ptr m_clientSubspaceForServerWebSocketConstructor;std::unique_ptr m_clientSubspaceForStatWatcher; -std::unique_ptr m_clientSubspaceForStats; -std::unique_ptr m_clientSubspaceForStatsConstructor;std::unique_ptr m_clientSubspaceForSubprocess; -std::unique_ptr m_clientSubspaceForTCPSocket; -std::unique_ptr m_clientSubspaceForTLSSocket; -std::unique_ptr m_clientSubspaceForTextChunk; -std::unique_ptr m_clientSubspaceForTextDecoder; -std::unique_ptr m_clientSubspaceForTextDecoderConstructor;std::unique_ptr m_clientSubspaceForTimeout; -std::unique_ptr m_clientSubspaceForTranspiler; -std::unique_ptr m_clientSubspaceForTranspilerConstructor; \ No newline at end of file diff --git a/src/bun.js/bindings/ZigGeneratedClasses+DOMIsoSubspaces.h b/src/bun.js/bindings/ZigGeneratedClasses+DOMIsoSubspaces.h deleted file mode 100644 index d06451eda0449..0000000000000 --- a/src/bun.js/bindings/ZigGeneratedClasses+DOMIsoSubspaces.h +++ /dev/null @@ -1,52 +0,0 @@ -std::unique_ptr m_subspaceForAttributeIterator; -std::unique_ptr m_subspaceForBigIntStats; -std::unique_ptr m_subspaceForBigIntStatsConstructor;std::unique_ptr m_subspaceForBlob; -std::unique_ptr m_subspaceForBlobConstructor;std::unique_ptr m_subspaceForBuildArtifact; -std::unique_ptr m_subspaceForBuildMessage; -std::unique_ptr m_subspaceForBuildMessageConstructor;std::unique_ptr m_subspaceForComment; -std::unique_ptr m_subspaceForCrypto; -std::unique_ptr m_subspaceForCryptoConstructor;std::unique_ptr m_subspaceForCryptoHasher; -std::unique_ptr m_subspaceForCryptoHasherConstructor;std::unique_ptr m_subspaceForDebugHTTPSServer; -std::unique_ptr m_subspaceForDebugHTTPServer; -std::unique_ptr m_subspaceForDirent; -std::unique_ptr m_subspaceForDirentConstructor;std::unique_ptr m_subspaceForDocEnd; -std::unique_ptr m_subspaceForDocType; -std::unique_ptr m_subspaceForElement; -std::unique_ptr m_subspaceForEndTag; -std::unique_ptr m_subspaceForExpect; -std::unique_ptr m_subspaceForExpectConstructor;std::unique_ptr m_subspaceForExpectAny; -std::unique_ptr m_subspaceForExpectAnything; -std::unique_ptr m_subspaceForExpectArrayContaining; -std::unique_ptr m_subspaceForExpectStringContaining; -std::unique_ptr m_subspaceForExpectStringMatching; -std::unique_ptr m_subspaceForFFI; -std::unique_ptr m_subspaceForFSWatcher; -std::unique_ptr m_subspaceForFileSystemRouter; -std::unique_ptr m_subspaceForFileSystemRouterConstructor;std::unique_ptr m_subspaceForHTMLRewriter; -std::unique_ptr m_subspaceForHTMLRewriterConstructor;std::unique_ptr m_subspaceForHTTPSServer; -std::unique_ptr m_subspaceForHTTPServer; -std::unique_ptr m_subspaceForListener; -std::unique_ptr m_subspaceForMD4; -std::unique_ptr m_subspaceForMD4Constructor;std::unique_ptr m_subspaceForMD5; -std::unique_ptr m_subspaceForMD5Constructor;std::unique_ptr m_subspaceForMatchedRoute; -std::unique_ptr m_subspaceForNodeJSFS; -std::unique_ptr m_subspaceForNodeJSFSConstructor;std::unique_ptr m_subspaceForRequest; -std::unique_ptr m_subspaceForRequestConstructor;std::unique_ptr m_subspaceForResolveMessage; -std::unique_ptr m_subspaceForResolveMessageConstructor;std::unique_ptr m_subspaceForResponse; -std::unique_ptr m_subspaceForResponseConstructor;std::unique_ptr m_subspaceForSHA1; -std::unique_ptr m_subspaceForSHA1Constructor;std::unique_ptr m_subspaceForSHA224; -std::unique_ptr m_subspaceForSHA224Constructor;std::unique_ptr m_subspaceForSHA256; -std::unique_ptr m_subspaceForSHA256Constructor;std::unique_ptr m_subspaceForSHA384; -std::unique_ptr m_subspaceForSHA384Constructor;std::unique_ptr m_subspaceForSHA512; -std::unique_ptr m_subspaceForSHA512Constructor;std::unique_ptr m_subspaceForSHA512_256; -std::unique_ptr m_subspaceForSHA512_256Constructor;std::unique_ptr m_subspaceForServerWebSocket; -std::unique_ptr m_subspaceForServerWebSocketConstructor;std::unique_ptr m_subspaceForStatWatcher; -std::unique_ptr m_subspaceForStats; -std::unique_ptr m_subspaceForStatsConstructor;std::unique_ptr m_subspaceForSubprocess; -std::unique_ptr m_subspaceForTCPSocket; -std::unique_ptr m_subspaceForTLSSocket; -std::unique_ptr m_subspaceForTextChunk; -std::unique_ptr m_subspaceForTextDecoder; -std::unique_ptr m_subspaceForTextDecoderConstructor;std::unique_ptr m_subspaceForTimeout; -std::unique_ptr m_subspaceForTranspiler; -std::unique_ptr m_subspaceForTranspilerConstructor; \ No newline at end of file diff --git a/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h b/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h deleted file mode 100644 index 381378262f363..0000000000000 --- a/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h +++ /dev/null @@ -1,204 +0,0 @@ -JSC::Structure* JSAttributeIteratorStructure() { return m_JSAttributeIterator.getInitializedOnMainThread(this); } - JSC::JSObject* JSAttributeIteratorConstructor() { return m_JSAttributeIterator.constructorInitializedOnMainThread(this); } - JSC::JSValue JSAttributeIteratorPrototype() { return m_JSAttributeIterator.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSAttributeIterator; -JSC::Structure* JSBigIntStatsStructure() { return m_JSBigIntStats.getInitializedOnMainThread(this); } - JSC::JSObject* JSBigIntStatsConstructor() { return m_JSBigIntStats.constructorInitializedOnMainThread(this); } - JSC::JSValue JSBigIntStatsPrototype() { return m_JSBigIntStats.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSBigIntStats; -JSC::Structure* JSBlobStructure() { return m_JSBlob.getInitializedOnMainThread(this); } - JSC::JSObject* JSBlobConstructor() { return m_JSBlob.constructorInitializedOnMainThread(this); } - JSC::JSValue JSBlobPrototype() { return m_JSBlob.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSBlob; -JSC::Structure* JSBuildArtifactStructure() { return m_JSBuildArtifact.getInitializedOnMainThread(this); } - JSC::JSObject* JSBuildArtifactConstructor() { return m_JSBuildArtifact.constructorInitializedOnMainThread(this); } - JSC::JSValue JSBuildArtifactPrototype() { return m_JSBuildArtifact.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSBuildArtifact; -JSC::Structure* JSBuildMessageStructure() { return m_JSBuildMessage.getInitializedOnMainThread(this); } - JSC::JSObject* JSBuildMessageConstructor() { return m_JSBuildMessage.constructorInitializedOnMainThread(this); } - JSC::JSValue JSBuildMessagePrototype() { return m_JSBuildMessage.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSBuildMessage; -JSC::Structure* JSCommentStructure() { return m_JSComment.getInitializedOnMainThread(this); } - JSC::JSObject* JSCommentConstructor() { return m_JSComment.constructorInitializedOnMainThread(this); } - JSC::JSValue JSCommentPrototype() { return m_JSComment.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSComment; -JSC::Structure* JSCryptoStructure() { return m_JSCrypto.getInitializedOnMainThread(this); } - JSC::JSObject* JSCryptoConstructor() { return m_JSCrypto.constructorInitializedOnMainThread(this); } - JSC::JSValue JSCryptoPrototype() { return m_JSCrypto.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSCrypto; -JSC::Structure* JSCryptoHasherStructure() { return m_JSCryptoHasher.getInitializedOnMainThread(this); } - JSC::JSObject* JSCryptoHasherConstructor() { return m_JSCryptoHasher.constructorInitializedOnMainThread(this); } - JSC::JSValue JSCryptoHasherPrototype() { return m_JSCryptoHasher.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSCryptoHasher; -JSC::Structure* JSDebugHTTPSServerStructure() { return m_JSDebugHTTPSServer.getInitializedOnMainThread(this); } - JSC::JSObject* JSDebugHTTPSServerConstructor() { return m_JSDebugHTTPSServer.constructorInitializedOnMainThread(this); } - JSC::JSValue JSDebugHTTPSServerPrototype() { return m_JSDebugHTTPSServer.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSDebugHTTPSServer; -JSC::Structure* JSDebugHTTPServerStructure() { return m_JSDebugHTTPServer.getInitializedOnMainThread(this); } - JSC::JSObject* JSDebugHTTPServerConstructor() { return m_JSDebugHTTPServer.constructorInitializedOnMainThread(this); } - JSC::JSValue JSDebugHTTPServerPrototype() { return m_JSDebugHTTPServer.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSDebugHTTPServer; -JSC::Structure* JSDirentStructure() { return m_JSDirent.getInitializedOnMainThread(this); } - JSC::JSObject* JSDirentConstructor() { return m_JSDirent.constructorInitializedOnMainThread(this); } - JSC::JSValue JSDirentPrototype() { return m_JSDirent.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSDirent; -JSC::Structure* JSDocEndStructure() { return m_JSDocEnd.getInitializedOnMainThread(this); } - JSC::JSObject* JSDocEndConstructor() { return m_JSDocEnd.constructorInitializedOnMainThread(this); } - JSC::JSValue JSDocEndPrototype() { return m_JSDocEnd.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSDocEnd; -JSC::Structure* JSDocTypeStructure() { return m_JSDocType.getInitializedOnMainThread(this); } - JSC::JSObject* JSDocTypeConstructor() { return m_JSDocType.constructorInitializedOnMainThread(this); } - JSC::JSValue JSDocTypePrototype() { return m_JSDocType.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSDocType; -JSC::Structure* JSElementStructure() { return m_JSElement.getInitializedOnMainThread(this); } - JSC::JSObject* JSElementConstructor() { return m_JSElement.constructorInitializedOnMainThread(this); } - JSC::JSValue JSElementPrototype() { return m_JSElement.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSElement; -JSC::Structure* JSEndTagStructure() { return m_JSEndTag.getInitializedOnMainThread(this); } - JSC::JSObject* JSEndTagConstructor() { return m_JSEndTag.constructorInitializedOnMainThread(this); } - JSC::JSValue JSEndTagPrototype() { return m_JSEndTag.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSEndTag; -JSC::Structure* JSExpectStructure() { return m_JSExpect.getInitializedOnMainThread(this); } - JSC::JSObject* JSExpectConstructor() { return m_JSExpect.constructorInitializedOnMainThread(this); } - JSC::JSValue JSExpectPrototype() { return m_JSExpect.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSExpect; -JSC::Structure* JSExpectAnyStructure() { return m_JSExpectAny.getInitializedOnMainThread(this); } - JSC::JSObject* JSExpectAnyConstructor() { return m_JSExpectAny.constructorInitializedOnMainThread(this); } - JSC::JSValue JSExpectAnyPrototype() { return m_JSExpectAny.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSExpectAny; -JSC::Structure* JSExpectAnythingStructure() { return m_JSExpectAnything.getInitializedOnMainThread(this); } - JSC::JSObject* JSExpectAnythingConstructor() { return m_JSExpectAnything.constructorInitializedOnMainThread(this); } - JSC::JSValue JSExpectAnythingPrototype() { return m_JSExpectAnything.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSExpectAnything; -JSC::Structure* JSExpectArrayContainingStructure() { return m_JSExpectArrayContaining.getInitializedOnMainThread(this); } - JSC::JSObject* JSExpectArrayContainingConstructor() { return m_JSExpectArrayContaining.constructorInitializedOnMainThread(this); } - JSC::JSValue JSExpectArrayContainingPrototype() { return m_JSExpectArrayContaining.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSExpectArrayContaining; -JSC::Structure* JSExpectStringContainingStructure() { return m_JSExpectStringContaining.getInitializedOnMainThread(this); } - JSC::JSObject* JSExpectStringContainingConstructor() { return m_JSExpectStringContaining.constructorInitializedOnMainThread(this); } - JSC::JSValue JSExpectStringContainingPrototype() { return m_JSExpectStringContaining.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSExpectStringContaining; -JSC::Structure* JSExpectStringMatchingStructure() { return m_JSExpectStringMatching.getInitializedOnMainThread(this); } - JSC::JSObject* JSExpectStringMatchingConstructor() { return m_JSExpectStringMatching.constructorInitializedOnMainThread(this); } - JSC::JSValue JSExpectStringMatchingPrototype() { return m_JSExpectStringMatching.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSExpectStringMatching; -JSC::Structure* JSFFIStructure() { return m_JSFFI.getInitializedOnMainThread(this); } - JSC::JSObject* JSFFIConstructor() { return m_JSFFI.constructorInitializedOnMainThread(this); } - JSC::JSValue JSFFIPrototype() { return m_JSFFI.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSFFI; -JSC::Structure* JSFSWatcherStructure() { return m_JSFSWatcher.getInitializedOnMainThread(this); } - JSC::JSObject* JSFSWatcherConstructor() { return m_JSFSWatcher.constructorInitializedOnMainThread(this); } - JSC::JSValue JSFSWatcherPrototype() { return m_JSFSWatcher.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSFSWatcher; -JSC::Structure* JSFileSystemRouterStructure() { return m_JSFileSystemRouter.getInitializedOnMainThread(this); } - JSC::JSObject* JSFileSystemRouterConstructor() { return m_JSFileSystemRouter.constructorInitializedOnMainThread(this); } - JSC::JSValue JSFileSystemRouterPrototype() { return m_JSFileSystemRouter.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSFileSystemRouter; -JSC::Structure* JSHTMLRewriterStructure() { return m_JSHTMLRewriter.getInitializedOnMainThread(this); } - JSC::JSObject* JSHTMLRewriterConstructor() { return m_JSHTMLRewriter.constructorInitializedOnMainThread(this); } - JSC::JSValue JSHTMLRewriterPrototype() { return m_JSHTMLRewriter.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSHTMLRewriter; -JSC::Structure* JSHTTPSServerStructure() { return m_JSHTTPSServer.getInitializedOnMainThread(this); } - JSC::JSObject* JSHTTPSServerConstructor() { return m_JSHTTPSServer.constructorInitializedOnMainThread(this); } - JSC::JSValue JSHTTPSServerPrototype() { return m_JSHTTPSServer.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSHTTPSServer; -JSC::Structure* JSHTTPServerStructure() { return m_JSHTTPServer.getInitializedOnMainThread(this); } - JSC::JSObject* JSHTTPServerConstructor() { return m_JSHTTPServer.constructorInitializedOnMainThread(this); } - JSC::JSValue JSHTTPServerPrototype() { return m_JSHTTPServer.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSHTTPServer; -JSC::Structure* JSListenerStructure() { return m_JSListener.getInitializedOnMainThread(this); } - JSC::JSObject* JSListenerConstructor() { return m_JSListener.constructorInitializedOnMainThread(this); } - JSC::JSValue JSListenerPrototype() { return m_JSListener.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSListener; -JSC::Structure* JSMD4Structure() { return m_JSMD4.getInitializedOnMainThread(this); } - JSC::JSObject* JSMD4Constructor() { return m_JSMD4.constructorInitializedOnMainThread(this); } - JSC::JSValue JSMD4Prototype() { return m_JSMD4.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSMD4; -JSC::Structure* JSMD5Structure() { return m_JSMD5.getInitializedOnMainThread(this); } - JSC::JSObject* JSMD5Constructor() { return m_JSMD5.constructorInitializedOnMainThread(this); } - JSC::JSValue JSMD5Prototype() { return m_JSMD5.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSMD5; -JSC::Structure* JSMatchedRouteStructure() { return m_JSMatchedRoute.getInitializedOnMainThread(this); } - JSC::JSObject* JSMatchedRouteConstructor() { return m_JSMatchedRoute.constructorInitializedOnMainThread(this); } - JSC::JSValue JSMatchedRoutePrototype() { return m_JSMatchedRoute.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSMatchedRoute; -JSC::Structure* JSNodeJSFSStructure() { return m_JSNodeJSFS.getInitializedOnMainThread(this); } - JSC::JSObject* JSNodeJSFSConstructor() { return m_JSNodeJSFS.constructorInitializedOnMainThread(this); } - JSC::JSValue JSNodeJSFSPrototype() { return m_JSNodeJSFS.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSNodeJSFS; -JSC::Structure* JSRequestStructure() { return m_JSRequest.getInitializedOnMainThread(this); } - JSC::JSObject* JSRequestConstructor() { return m_JSRequest.constructorInitializedOnMainThread(this); } - JSC::JSValue JSRequestPrototype() { return m_JSRequest.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSRequest; -JSC::Structure* JSResolveMessageStructure() { return m_JSResolveMessage.getInitializedOnMainThread(this); } - JSC::JSObject* JSResolveMessageConstructor() { return m_JSResolveMessage.constructorInitializedOnMainThread(this); } - JSC::JSValue JSResolveMessagePrototype() { return m_JSResolveMessage.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSResolveMessage; -JSC::Structure* JSResponseStructure() { return m_JSResponse.getInitializedOnMainThread(this); } - JSC::JSObject* JSResponseConstructor() { return m_JSResponse.constructorInitializedOnMainThread(this); } - JSC::JSValue JSResponsePrototype() { return m_JSResponse.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSResponse; -JSC::Structure* JSSHA1Structure() { return m_JSSHA1.getInitializedOnMainThread(this); } - JSC::JSObject* JSSHA1Constructor() { return m_JSSHA1.constructorInitializedOnMainThread(this); } - JSC::JSValue JSSHA1Prototype() { return m_JSSHA1.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSSHA1; -JSC::Structure* JSSHA224Structure() { return m_JSSHA224.getInitializedOnMainThread(this); } - JSC::JSObject* JSSHA224Constructor() { return m_JSSHA224.constructorInitializedOnMainThread(this); } - JSC::JSValue JSSHA224Prototype() { return m_JSSHA224.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSSHA224; -JSC::Structure* JSSHA256Structure() { return m_JSSHA256.getInitializedOnMainThread(this); } - JSC::JSObject* JSSHA256Constructor() { return m_JSSHA256.constructorInitializedOnMainThread(this); } - JSC::JSValue JSSHA256Prototype() { return m_JSSHA256.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSSHA256; -JSC::Structure* JSSHA384Structure() { return m_JSSHA384.getInitializedOnMainThread(this); } - JSC::JSObject* JSSHA384Constructor() { return m_JSSHA384.constructorInitializedOnMainThread(this); } - JSC::JSValue JSSHA384Prototype() { return m_JSSHA384.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSSHA384; -JSC::Structure* JSSHA512Structure() { return m_JSSHA512.getInitializedOnMainThread(this); } - JSC::JSObject* JSSHA512Constructor() { return m_JSSHA512.constructorInitializedOnMainThread(this); } - JSC::JSValue JSSHA512Prototype() { return m_JSSHA512.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSSHA512; -JSC::Structure* JSSHA512_256Structure() { return m_JSSHA512_256.getInitializedOnMainThread(this); } - JSC::JSObject* JSSHA512_256Constructor() { return m_JSSHA512_256.constructorInitializedOnMainThread(this); } - JSC::JSValue JSSHA512_256Prototype() { return m_JSSHA512_256.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSSHA512_256; -JSC::Structure* JSServerWebSocketStructure() { return m_JSServerWebSocket.getInitializedOnMainThread(this); } - JSC::JSObject* JSServerWebSocketConstructor() { return m_JSServerWebSocket.constructorInitializedOnMainThread(this); } - JSC::JSValue JSServerWebSocketPrototype() { return m_JSServerWebSocket.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSServerWebSocket; -JSC::Structure* JSStatWatcherStructure() { return m_JSStatWatcher.getInitializedOnMainThread(this); } - JSC::JSObject* JSStatWatcherConstructor() { return m_JSStatWatcher.constructorInitializedOnMainThread(this); } - JSC::JSValue JSStatWatcherPrototype() { return m_JSStatWatcher.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSStatWatcher; -JSC::Structure* JSStatsStructure() { return m_JSStats.getInitializedOnMainThread(this); } - JSC::JSObject* JSStatsConstructor() { return m_JSStats.constructorInitializedOnMainThread(this); } - JSC::JSValue JSStatsPrototype() { return m_JSStats.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSStats; -JSC::Structure* JSSubprocessStructure() { return m_JSSubprocess.getInitializedOnMainThread(this); } - JSC::JSObject* JSSubprocessConstructor() { return m_JSSubprocess.constructorInitializedOnMainThread(this); } - JSC::JSValue JSSubprocessPrototype() { return m_JSSubprocess.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSSubprocess; -JSC::Structure* JSTCPSocketStructure() { return m_JSTCPSocket.getInitializedOnMainThread(this); } - JSC::JSObject* JSTCPSocketConstructor() { return m_JSTCPSocket.constructorInitializedOnMainThread(this); } - JSC::JSValue JSTCPSocketPrototype() { return m_JSTCPSocket.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSTCPSocket; -JSC::Structure* JSTLSSocketStructure() { return m_JSTLSSocket.getInitializedOnMainThread(this); } - JSC::JSObject* JSTLSSocketConstructor() { return m_JSTLSSocket.constructorInitializedOnMainThread(this); } - JSC::JSValue JSTLSSocketPrototype() { return m_JSTLSSocket.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSTLSSocket; -JSC::Structure* JSTextChunkStructure() { return m_JSTextChunk.getInitializedOnMainThread(this); } - JSC::JSObject* JSTextChunkConstructor() { return m_JSTextChunk.constructorInitializedOnMainThread(this); } - JSC::JSValue JSTextChunkPrototype() { return m_JSTextChunk.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSTextChunk; -JSC::Structure* JSTextDecoderStructure() { return m_JSTextDecoder.getInitializedOnMainThread(this); } - JSC::JSObject* JSTextDecoderConstructor() { return m_JSTextDecoder.constructorInitializedOnMainThread(this); } - JSC::JSValue JSTextDecoderPrototype() { return m_JSTextDecoder.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSTextDecoder; -JSC::Structure* JSTimeoutStructure() { return m_JSTimeout.getInitializedOnMainThread(this); } - JSC::JSObject* JSTimeoutConstructor() { return m_JSTimeout.constructorInitializedOnMainThread(this); } - JSC::JSValue JSTimeoutPrototype() { return m_JSTimeout.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSTimeout; -JSC::Structure* JSTranspilerStructure() { return m_JSTranspiler.getInitializedOnMainThread(this); } - JSC::JSObject* JSTranspilerConstructor() { return m_JSTranspiler.constructorInitializedOnMainThread(this); } - JSC::JSValue JSTranspilerPrototype() { return m_JSTranspiler.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSTranspiler; \ No newline at end of file diff --git a/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h b/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h deleted file mode 100644 index 84d3df7a05429..0000000000000 --- a/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h +++ /dev/null @@ -1,363 +0,0 @@ -ALWAYS_INLINE void GlobalObject::initGeneratedLazyClasses() { - m_JSAttributeIterator.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSAttributeIterator::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSAttributeIterator::createStructure(init.vm, init.global, init.prototype)); - - }); - m_JSBigIntStats.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSBigIntStats::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSBigIntStats::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSBigIntStats::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSBlob.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSBlob::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSBlob::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSBlob::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSBuildArtifact.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSBuildArtifact::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSBuildArtifact::createStructure(init.vm, init.global, init.prototype)); - - }); - m_JSBuildMessage.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSBuildMessage::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSBuildMessage::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSBuildMessage::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSComment.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSComment::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSComment::createStructure(init.vm, init.global, init.prototype)); - - }); - m_JSCrypto.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSCrypto::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSCrypto::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSCrypto::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSCryptoHasher.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSCryptoHasher::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSCryptoHasher::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSCryptoHasher::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSDebugHTTPSServer.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSDebugHTTPSServer::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSDebugHTTPSServer::createStructure(init.vm, init.global, init.prototype)); - - }); - m_JSDebugHTTPServer.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSDebugHTTPServer::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSDebugHTTPServer::createStructure(init.vm, init.global, init.prototype)); - - }); - m_JSDirent.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSDirent::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSDirent::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSDirent::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSDocEnd.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSDocEnd::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSDocEnd::createStructure(init.vm, init.global, init.prototype)); - - }); - m_JSDocType.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSDocType::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSDocType::createStructure(init.vm, init.global, init.prototype)); - - }); - m_JSElement.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSElement::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSElement::createStructure(init.vm, init.global, init.prototype)); - - }); - m_JSEndTag.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSEndTag::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSEndTag::createStructure(init.vm, init.global, init.prototype)); - - }); - m_JSExpect.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSExpect::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSExpect::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSExpect::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSExpectAny.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSExpectAny::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSExpectAny::createStructure(init.vm, init.global, init.prototype)); - - }); - m_JSExpectAnything.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSExpectAnything::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSExpectAnything::createStructure(init.vm, init.global, init.prototype)); - - }); - m_JSExpectArrayContaining.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSExpectArrayContaining::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSExpectArrayContaining::createStructure(init.vm, init.global, init.prototype)); - - }); - m_JSExpectStringContaining.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSExpectStringContaining::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSExpectStringContaining::createStructure(init.vm, init.global, init.prototype)); - - }); - m_JSExpectStringMatching.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSExpectStringMatching::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSExpectStringMatching::createStructure(init.vm, init.global, init.prototype)); - - }); - m_JSFFI.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSFFI::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSFFI::createStructure(init.vm, init.global, init.prototype)); - - }); - m_JSFSWatcher.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSFSWatcher::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSFSWatcher::createStructure(init.vm, init.global, init.prototype)); - - }); - m_JSFileSystemRouter.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSFileSystemRouter::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSFileSystemRouter::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSFileSystemRouter::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSHTMLRewriter.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSHTMLRewriter::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSHTMLRewriter::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSHTMLRewriter::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSHTTPSServer.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSHTTPSServer::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSHTTPSServer::createStructure(init.vm, init.global, init.prototype)); - - }); - m_JSHTTPServer.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSHTTPServer::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSHTTPServer::createStructure(init.vm, init.global, init.prototype)); - - }); - m_JSListener.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSListener::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSListener::createStructure(init.vm, init.global, init.prototype)); - - }); - m_JSMD4.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSMD4::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSMD4::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSMD4::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSMD5.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSMD5::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSMD5::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSMD5::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSMatchedRoute.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSMatchedRoute::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSMatchedRoute::createStructure(init.vm, init.global, init.prototype)); - - }); - m_JSNodeJSFS.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSNodeJSFS::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSNodeJSFS::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSNodeJSFS::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSRequest.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSRequest::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSRequest::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSRequest::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSResolveMessage.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSResolveMessage::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSResolveMessage::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSResolveMessage::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSResponse.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSResponse::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSResponse::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSResponse::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSSHA1.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSSHA1::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSSHA1::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSSHA1::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSSHA224.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSSHA224::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSSHA224::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSSHA224::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSSHA256.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSSHA256::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSSHA256::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSSHA256::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSSHA384.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSSHA384::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSSHA384::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSSHA384::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSSHA512.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSSHA512::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSSHA512::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSSHA512::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSSHA512_256.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSSHA512_256::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSSHA512_256::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSSHA512_256::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSServerWebSocket.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSServerWebSocket::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSServerWebSocket::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSServerWebSocket::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSStatWatcher.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSStatWatcher::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSStatWatcher::createStructure(init.vm, init.global, init.prototype)); - - }); - m_JSStats.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSStats::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSStats::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSStats::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSSubprocess.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSSubprocess::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSSubprocess::createStructure(init.vm, init.global, init.prototype)); - - }); - m_JSTCPSocket.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSTCPSocket::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSTCPSocket::createStructure(init.vm, init.global, init.prototype)); - - }); - m_JSTLSSocket.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSTLSSocket::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSTLSSocket::createStructure(init.vm, init.global, init.prototype)); - - }); - m_JSTextChunk.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSTextChunk::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSTextChunk::createStructure(init.vm, init.global, init.prototype)); - - }); - m_JSTextDecoder.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSTextDecoder::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSTextDecoder::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSTextDecoder::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSTimeout.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSTimeout::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSTimeout::createStructure(init.vm, init.global, init.prototype)); - - }); - m_JSTranspiler.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSTranspiler::createPrototype(init.vm, reinterpret_cast(init.global))); - init.setStructure(WebCore::JSTranspiler::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSTranspiler::createConstructor(init.vm, init.global, init.prototype)); - }); -} -template -void GlobalObject::visitGeneratedLazyClasses(GlobalObject *thisObject, Visitor& visitor) -{ - thisObject->m_JSAttributeIterator.visit(visitor); - thisObject->m_JSBigIntStats.visit(visitor); - thisObject->m_JSBlob.visit(visitor); - thisObject->m_JSBuildArtifact.visit(visitor); - thisObject->m_JSBuildMessage.visit(visitor); - thisObject->m_JSComment.visit(visitor); - thisObject->m_JSCrypto.visit(visitor); - thisObject->m_JSCryptoHasher.visit(visitor); - thisObject->m_JSDebugHTTPSServer.visit(visitor); - thisObject->m_JSDebugHTTPServer.visit(visitor); - thisObject->m_JSDirent.visit(visitor); - thisObject->m_JSDocEnd.visit(visitor); - thisObject->m_JSDocType.visit(visitor); - thisObject->m_JSElement.visit(visitor); - thisObject->m_JSEndTag.visit(visitor); - thisObject->m_JSExpect.visit(visitor); - thisObject->m_JSExpectAny.visit(visitor); - thisObject->m_JSExpectAnything.visit(visitor); - thisObject->m_JSExpectArrayContaining.visit(visitor); - thisObject->m_JSExpectStringContaining.visit(visitor); - thisObject->m_JSExpectStringMatching.visit(visitor); - thisObject->m_JSFFI.visit(visitor); - thisObject->m_JSFSWatcher.visit(visitor); - thisObject->m_JSFileSystemRouter.visit(visitor); - thisObject->m_JSHTMLRewriter.visit(visitor); - thisObject->m_JSHTTPSServer.visit(visitor); - thisObject->m_JSHTTPServer.visit(visitor); - thisObject->m_JSListener.visit(visitor); - thisObject->m_JSMD4.visit(visitor); - thisObject->m_JSMD5.visit(visitor); - thisObject->m_JSMatchedRoute.visit(visitor); - thisObject->m_JSNodeJSFS.visit(visitor); - thisObject->m_JSRequest.visit(visitor); - thisObject->m_JSResolveMessage.visit(visitor); - thisObject->m_JSResponse.visit(visitor); - thisObject->m_JSSHA1.visit(visitor); - thisObject->m_JSSHA224.visit(visitor); - thisObject->m_JSSHA256.visit(visitor); - thisObject->m_JSSHA384.visit(visitor); - thisObject->m_JSSHA512.visit(visitor); - thisObject->m_JSSHA512_256.visit(visitor); - thisObject->m_JSServerWebSocket.visit(visitor); - thisObject->m_JSStatWatcher.visit(visitor); - thisObject->m_JSStats.visit(visitor); - thisObject->m_JSSubprocess.visit(visitor); - thisObject->m_JSTCPSocket.visit(visitor); - thisObject->m_JSTLSSocket.visit(visitor); - thisObject->m_JSTextChunk.visit(visitor); - thisObject->m_JSTextDecoder.visit(visitor); - thisObject->m_JSTimeout.visit(visitor); - thisObject->m_JSTranspiler.visit(visitor); -} \ No newline at end of file diff --git a/src/bun.js/bindings/ZigGeneratedClasses.cpp b/src/bun.js/bindings/ZigGeneratedClasses.cpp deleted file mode 100644 index f709d572ad79a..0000000000000 --- a/src/bun.js/bindings/ZigGeneratedClasses.cpp +++ /dev/null @@ -1,27955 +0,0 @@ - -// GENERATED CODE - DO NOT MODIFY BY HAND -// Generated by make codegen -#include "root.h" -#include "headers.h" - -#include "BunClientData.h" -#include "ZigGlobalObject.h" - -#include -#include -#include -#include -#include - -#include -#include "DOMJITIDLConvert.h" -#include "DOMJITIDLType.h" -#include "DOMJITIDLTypeFilter.h" -#include "DOMJITHelpers.h" -#include - -#include "JSDOMConvertBufferSource.h" -#include "ZigGeneratedClasses.h" - -namespace WebCore { - -using namespace JSC; -using namespace Zig; - -class JSAttributeIteratorPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSAttributeIteratorPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSAttributeIteratorPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSAttributeIteratorPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSAttributeIteratorPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSAttributeIteratorPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -extern "C" void* AttributeIteratorClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsAttributeIteratorConstructor); - -extern "C" void AttributeIteratorClass__finalize(void*); - -extern "C" EncodedJSValue AttributeIteratorPrototype__getThis(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(AttributeIteratorPrototype__iteratorCallback); - -extern "C" EncodedJSValue AttributeIteratorPrototype__next(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(AttributeIteratorPrototype__nextCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSAttributeIteratorPrototype, JSAttributeIteratorPrototype::Base); - -static const HashTableValue JSAttributeIteratorPrototypeTableValues[] = { - { "next"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, AttributeIteratorPrototype__nextCallback, 0 } } -}; - -const ClassInfo JSAttributeIteratorPrototype::s_info = { "AttributeIterator"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAttributeIteratorPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsAttributeIteratorConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for AttributeIterator"_s); - return JSValue::encode(globalObject->JSAttributeIteratorConstructor()); -} - -JSC_DEFINE_HOST_FUNCTION(AttributeIteratorPrototype__iteratorCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSAttributeIterator* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof AttributeIterator"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return AttributeIteratorPrototype__getThis(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(AttributeIteratorPrototype__nextCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSAttributeIterator* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof AttributeIterator"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return AttributeIteratorPrototype__next(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSAttributeIteratorPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSAttributeIterator::info(), JSAttributeIteratorPrototypeTableValues, *this); - this->putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject, 1, String("iterator"_s), AttributeIteratorPrototype__iteratorCallback, ImplementationVisibility::Public), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | 0); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -JSAttributeIterator::~JSAttributeIterator() -{ - if (m_ctx) { - AttributeIteratorClass__finalize(m_ctx); - } -} -void JSAttributeIterator::destroy(JSCell* cell) -{ - static_cast(cell)->JSAttributeIterator::~JSAttributeIterator(); -} - -const ClassInfo JSAttributeIterator::s_info = { "AttributeIterator"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAttributeIterator) }; - -void JSAttributeIterator::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSAttributeIterator* JSAttributeIterator::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSAttributeIterator* ptr = new (NotNull, JSC::allocateCell(vm)) JSAttributeIterator(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* AttributeIterator__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSAttributeIterator* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool AttributeIterator__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSAttributeIterator* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t AttributeIterator__ptrOffset = JSAttributeIterator::offsetOfWrapped(); - -void JSAttributeIterator::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSAttributeIterator::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSAttributeIteratorPrototype::create(vm, globalObject, JSAttributeIteratorPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue AttributeIterator__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSAttributeIteratorStructure(); - JSAttributeIterator* instance = JSAttributeIterator::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -class JSBigIntStatsPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSBigIntStatsPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSBigIntStatsPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSBigIntStatsPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSBigIntStatsPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSBigIntStatsPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -class JSBigIntStatsConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSBigIntStatsConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSBigIntStatsPrototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForBigIntStatsConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForBigIntStatsConstructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForBigIntStatsConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForBigIntStatsConstructor = std::forward(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSBigIntStatsPrototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSBigIntStatsConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSBigIntStatsPrototype* prototype); -}; - -extern "C" void* BigIntStatsClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsBigIntStatsConstructor); - -extern "C" void BigIntStatsClass__finalize(void*); - -extern "C" JSC::EncodedJSValue BigIntStatsPrototype__atime(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BigIntStatsPrototype__atimeGetterWrap); - -extern "C" JSC::EncodedJSValue BigIntStatsPrototype__atimeMs(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BigIntStatsPrototype__atimeMsGetterWrap); - -extern "C" JSC::EncodedJSValue BigIntStatsPrototype__atimeNs(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BigIntStatsPrototype__atimeNsGetterWrap); - -extern "C" JSC::EncodedJSValue BigIntStatsPrototype__birthtime(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BigIntStatsPrototype__birthtimeGetterWrap); - -extern "C" JSC::EncodedJSValue BigIntStatsPrototype__birthtimeMs(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BigIntStatsPrototype__birthtimeMsGetterWrap); - -extern "C" JSC::EncodedJSValue BigIntStatsPrototype__birthtimeNs(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BigIntStatsPrototype__birthtimeNsGetterWrap); - -extern "C" JSC::EncodedJSValue BigIntStatsPrototype__blksize(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BigIntStatsPrototype__blksizeGetterWrap); - -extern "C" JSC::EncodedJSValue BigIntStatsPrototype__blocks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BigIntStatsPrototype__blocksGetterWrap); - -extern "C" JSC::EncodedJSValue BigIntStatsPrototype__ctime(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BigIntStatsPrototype__ctimeGetterWrap); - -extern "C" JSC::EncodedJSValue BigIntStatsPrototype__ctimeMs(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BigIntStatsPrototype__ctimeMsGetterWrap); - -extern "C" JSC::EncodedJSValue BigIntStatsPrototype__ctimeNs(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BigIntStatsPrototype__ctimeNsGetterWrap); - -extern "C" JSC::EncodedJSValue BigIntStatsPrototype__dev(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BigIntStatsPrototype__devGetterWrap); - -extern "C" JSC::EncodedJSValue BigIntStatsPrototype__gid(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BigIntStatsPrototype__gidGetterWrap); - -extern "C" JSC::EncodedJSValue BigIntStatsPrototype__ino(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BigIntStatsPrototype__inoGetterWrap); - -extern "C" EncodedJSValue BigIntStatsPrototype__isBlockDevice_(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(BigIntStatsPrototype__isBlockDeviceCallback); - -extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(BigIntStatsPrototype__isBlockDeviceWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)); -extern "C" EncodedJSValue BigIntStatsPrototype__isBlockDevice_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); - -static const JSC::DOMJIT::Signature DOMJITSignatureForBigIntStatsPrototype__isBlockDevice(BigIntStatsPrototype__isBlockDeviceWithoutTypeChecksWrapper, - JSBigIntStats::info(), - JSC::DOMJIT::Effect::forPure(), - JSC::SpecHeapTop); - -JSC_DEFINE_JIT_OPERATION(BigIntStatsPrototype__isBlockDeviceWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - IGNORE_WARNINGS_BEGIN("frame-address") - CallFrame* callFrame = DECLARE_CALL_FRAME(vm); - IGNORE_WARNINGS_END - JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); - return BigIntStatsPrototype__isBlockDevice_WithoutTypeChecks(reinterpret_cast(thisValue)->wrapped(), lexicalGlobalObject); -} - -extern "C" EncodedJSValue BigIntStatsPrototype__isCharacterDevice_(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(BigIntStatsPrototype__isCharacterDeviceCallback); - -extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(BigIntStatsPrototype__isCharacterDeviceWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)); -extern "C" EncodedJSValue BigIntStatsPrototype__isCharacterDevice_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); - -static const JSC::DOMJIT::Signature DOMJITSignatureForBigIntStatsPrototype__isCharacterDevice(BigIntStatsPrototype__isCharacterDeviceWithoutTypeChecksWrapper, - JSBigIntStats::info(), - JSC::DOMJIT::Effect::forPure(), - JSC::SpecHeapTop); - -JSC_DEFINE_JIT_OPERATION(BigIntStatsPrototype__isCharacterDeviceWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - IGNORE_WARNINGS_BEGIN("frame-address") - CallFrame* callFrame = DECLARE_CALL_FRAME(vm); - IGNORE_WARNINGS_END - JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); - return BigIntStatsPrototype__isCharacterDevice_WithoutTypeChecks(reinterpret_cast(thisValue)->wrapped(), lexicalGlobalObject); -} - -extern "C" EncodedJSValue BigIntStatsPrototype__isDirectory_(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(BigIntStatsPrototype__isDirectoryCallback); - -extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(BigIntStatsPrototype__isDirectoryWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)); -extern "C" EncodedJSValue BigIntStatsPrototype__isDirectory_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); - -static const JSC::DOMJIT::Signature DOMJITSignatureForBigIntStatsPrototype__isDirectory(BigIntStatsPrototype__isDirectoryWithoutTypeChecksWrapper, - JSBigIntStats::info(), - JSC::DOMJIT::Effect::forPure(), - JSC::SpecHeapTop); - -JSC_DEFINE_JIT_OPERATION(BigIntStatsPrototype__isDirectoryWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - IGNORE_WARNINGS_BEGIN("frame-address") - CallFrame* callFrame = DECLARE_CALL_FRAME(vm); - IGNORE_WARNINGS_END - JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); - return BigIntStatsPrototype__isDirectory_WithoutTypeChecks(reinterpret_cast(thisValue)->wrapped(), lexicalGlobalObject); -} - -extern "C" EncodedJSValue BigIntStatsPrototype__isFIFO_(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(BigIntStatsPrototype__isFIFOCallback); - -extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(BigIntStatsPrototype__isFIFOWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)); -extern "C" EncodedJSValue BigIntStatsPrototype__isFIFO_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); - -static const JSC::DOMJIT::Signature DOMJITSignatureForBigIntStatsPrototype__isFIFO(BigIntStatsPrototype__isFIFOWithoutTypeChecksWrapper, - JSBigIntStats::info(), - JSC::DOMJIT::Effect::forPure(), - JSC::SpecHeapTop); - -JSC_DEFINE_JIT_OPERATION(BigIntStatsPrototype__isFIFOWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - IGNORE_WARNINGS_BEGIN("frame-address") - CallFrame* callFrame = DECLARE_CALL_FRAME(vm); - IGNORE_WARNINGS_END - JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); - return BigIntStatsPrototype__isFIFO_WithoutTypeChecks(reinterpret_cast(thisValue)->wrapped(), lexicalGlobalObject); -} - -extern "C" EncodedJSValue BigIntStatsPrototype__isFile_(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(BigIntStatsPrototype__isFileCallback); - -extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(BigIntStatsPrototype__isFileWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)); -extern "C" EncodedJSValue BigIntStatsPrototype__isFile_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); - -static const JSC::DOMJIT::Signature DOMJITSignatureForBigIntStatsPrototype__isFile(BigIntStatsPrototype__isFileWithoutTypeChecksWrapper, - JSBigIntStats::info(), - JSC::DOMJIT::Effect::forPure(), - JSC::SpecHeapTop); - -JSC_DEFINE_JIT_OPERATION(BigIntStatsPrototype__isFileWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - IGNORE_WARNINGS_BEGIN("frame-address") - CallFrame* callFrame = DECLARE_CALL_FRAME(vm); - IGNORE_WARNINGS_END - JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); - return BigIntStatsPrototype__isFile_WithoutTypeChecks(reinterpret_cast(thisValue)->wrapped(), lexicalGlobalObject); -} - -extern "C" EncodedJSValue BigIntStatsPrototype__isSocket_(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(BigIntStatsPrototype__isSocketCallback); - -extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(BigIntStatsPrototype__isSocketWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)); -extern "C" EncodedJSValue BigIntStatsPrototype__isSocket_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); - -static const JSC::DOMJIT::Signature DOMJITSignatureForBigIntStatsPrototype__isSocket(BigIntStatsPrototype__isSocketWithoutTypeChecksWrapper, - JSBigIntStats::info(), - JSC::DOMJIT::Effect::forPure(), - JSC::SpecHeapTop); - -JSC_DEFINE_JIT_OPERATION(BigIntStatsPrototype__isSocketWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - IGNORE_WARNINGS_BEGIN("frame-address") - CallFrame* callFrame = DECLARE_CALL_FRAME(vm); - IGNORE_WARNINGS_END - JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); - return BigIntStatsPrototype__isSocket_WithoutTypeChecks(reinterpret_cast(thisValue)->wrapped(), lexicalGlobalObject); -} - -extern "C" EncodedJSValue BigIntStatsPrototype__isSymbolicLink_(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(BigIntStatsPrototype__isSymbolicLinkCallback); - -extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(BigIntStatsPrototype__isSymbolicLinkWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)); -extern "C" EncodedJSValue BigIntStatsPrototype__isSymbolicLink_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); - -static const JSC::DOMJIT::Signature DOMJITSignatureForBigIntStatsPrototype__isSymbolicLink(BigIntStatsPrototype__isSymbolicLinkWithoutTypeChecksWrapper, - JSBigIntStats::info(), - JSC::DOMJIT::Effect::forPure(), - JSC::SpecHeapTop); - -JSC_DEFINE_JIT_OPERATION(BigIntStatsPrototype__isSymbolicLinkWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - IGNORE_WARNINGS_BEGIN("frame-address") - CallFrame* callFrame = DECLARE_CALL_FRAME(vm); - IGNORE_WARNINGS_END - JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); - return BigIntStatsPrototype__isSymbolicLink_WithoutTypeChecks(reinterpret_cast(thisValue)->wrapped(), lexicalGlobalObject); -} - -extern "C" JSC::EncodedJSValue BigIntStatsPrototype__mode(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BigIntStatsPrototype__modeGetterWrap); - -extern "C" JSC::EncodedJSValue BigIntStatsPrototype__mtime(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BigIntStatsPrototype__mtimeGetterWrap); - -extern "C" JSC::EncodedJSValue BigIntStatsPrototype__mtimeMs(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BigIntStatsPrototype__mtimeMsGetterWrap); - -extern "C" JSC::EncodedJSValue BigIntStatsPrototype__mtimeNs(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BigIntStatsPrototype__mtimeNsGetterWrap); - -extern "C" JSC::EncodedJSValue BigIntStatsPrototype__nlink(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BigIntStatsPrototype__nlinkGetterWrap); - -extern "C" JSC::EncodedJSValue BigIntStatsPrototype__rdev(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BigIntStatsPrototype__rdevGetterWrap); - -extern "C" JSC::EncodedJSValue BigIntStatsPrototype__size(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BigIntStatsPrototype__sizeGetterWrap); - -extern "C" JSC::EncodedJSValue BigIntStatsPrototype__uid(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BigIntStatsPrototype__uidGetterWrap); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSBigIntStatsPrototype, JSBigIntStatsPrototype::Base); - -static const HashTableValue JSBigIntStatsPrototypeTableValues[] = { - { "atime"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BigIntStatsPrototype__atimeGetterWrap, 0 } }, - { "atimeMs"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BigIntStatsPrototype__atimeMsGetterWrap, 0 } }, - { "atimeNs"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BigIntStatsPrototype__atimeNsGetterWrap, 0 } }, - { "birthtime"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BigIntStatsPrototype__birthtimeGetterWrap, 0 } }, - { "birthtimeMs"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BigIntStatsPrototype__birthtimeMsGetterWrap, 0 } }, - { "birthtimeNs"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BigIntStatsPrototype__birthtimeNsGetterWrap, 0 } }, - { "blksize"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BigIntStatsPrototype__blksizeGetterWrap, 0 } }, - { "blocks"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BigIntStatsPrototype__blocksGetterWrap, 0 } }, - { "ctime"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BigIntStatsPrototype__ctimeGetterWrap, 0 } }, - { "ctimeMs"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BigIntStatsPrototype__ctimeMsGetterWrap, 0 } }, - { "ctimeNs"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BigIntStatsPrototype__ctimeNsGetterWrap, 0 } }, - { "dev"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BigIntStatsPrototype__devGetterWrap, 0 } }, - { "gid"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BigIntStatsPrototype__gidGetterWrap, 0 } }, - { "ino"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BigIntStatsPrototype__inoGetterWrap, 0 } }, - { "isBlockDevice"_s, static_cast(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, BigIntStatsPrototype__isBlockDeviceCallback, &DOMJITSignatureForBigIntStatsPrototype__isBlockDevice } }, - { "isCharacterDevice"_s, static_cast(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, BigIntStatsPrototype__isCharacterDeviceCallback, &DOMJITSignatureForBigIntStatsPrototype__isCharacterDevice } }, - { "isDirectory"_s, static_cast(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, BigIntStatsPrototype__isDirectoryCallback, &DOMJITSignatureForBigIntStatsPrototype__isDirectory } }, - { "isFIFO"_s, static_cast(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, BigIntStatsPrototype__isFIFOCallback, &DOMJITSignatureForBigIntStatsPrototype__isFIFO } }, - { "isFile"_s, static_cast(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, BigIntStatsPrototype__isFileCallback, &DOMJITSignatureForBigIntStatsPrototype__isFile } }, - { "isSocket"_s, static_cast(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, BigIntStatsPrototype__isSocketCallback, &DOMJITSignatureForBigIntStatsPrototype__isSocket } }, - { "isSymbolicLink"_s, static_cast(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, BigIntStatsPrototype__isSymbolicLinkCallback, &DOMJITSignatureForBigIntStatsPrototype__isSymbolicLink } }, - { "mode"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BigIntStatsPrototype__modeGetterWrap, 0 } }, - { "mtime"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BigIntStatsPrototype__mtimeGetterWrap, 0 } }, - { "mtimeMs"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BigIntStatsPrototype__mtimeMsGetterWrap, 0 } }, - { "mtimeNs"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BigIntStatsPrototype__mtimeNsGetterWrap, 0 } }, - { "nlink"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BigIntStatsPrototype__nlinkGetterWrap, 0 } }, - { "rdev"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BigIntStatsPrototype__rdevGetterWrap, 0 } }, - { "size"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BigIntStatsPrototype__sizeGetterWrap, 0 } }, - { "uid"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BigIntStatsPrototype__uidGetterWrap, 0 } } -}; - -const ClassInfo JSBigIntStatsPrototype::s_info = { "BigIntStats"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBigIntStatsPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsBigIntStatsConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for BigIntStats"_s); - return JSValue::encode(globalObject->JSBigIntStatsConstructor()); -} - -JSC_DEFINE_CUSTOM_GETTER(BigIntStatsPrototype__atimeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBigIntStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_atime.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - BigIntStatsPrototype__atime(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_atime.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void BigIntStatsPrototype__atimeSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_atime.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue BigIntStatsPrototype__atimeGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_atime.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(BigIntStatsPrototype__atimeMsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBigIntStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = BigIntStatsPrototype__atimeMs(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(BigIntStatsPrototype__atimeNsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBigIntStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = BigIntStatsPrototype__atimeNs(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(BigIntStatsPrototype__birthtimeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBigIntStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_birthtime.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - BigIntStatsPrototype__birthtime(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_birthtime.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void BigIntStatsPrototype__birthtimeSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_birthtime.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue BigIntStatsPrototype__birthtimeGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_birthtime.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(BigIntStatsPrototype__birthtimeMsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBigIntStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = BigIntStatsPrototype__birthtimeMs(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(BigIntStatsPrototype__birthtimeNsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBigIntStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = BigIntStatsPrototype__birthtimeNs(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(BigIntStatsPrototype__blksizeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBigIntStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = BigIntStatsPrototype__blksize(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(BigIntStatsPrototype__blocksGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBigIntStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = BigIntStatsPrototype__blocks(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(BigIntStatsPrototype__ctimeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBigIntStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_ctime.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - BigIntStatsPrototype__ctime(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_ctime.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void BigIntStatsPrototype__ctimeSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_ctime.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue BigIntStatsPrototype__ctimeGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_ctime.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(BigIntStatsPrototype__ctimeMsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBigIntStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = BigIntStatsPrototype__ctimeMs(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(BigIntStatsPrototype__ctimeNsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBigIntStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = BigIntStatsPrototype__ctimeNs(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(BigIntStatsPrototype__devGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBigIntStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = BigIntStatsPrototype__dev(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(BigIntStatsPrototype__gidGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBigIntStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = BigIntStatsPrototype__gid(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(BigIntStatsPrototype__inoGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBigIntStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = BigIntStatsPrototype__ino(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(BigIntStatsPrototype__isBlockDeviceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSBigIntStats* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof BigIntStats"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return BigIntStatsPrototype__isBlockDevice_(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(BigIntStatsPrototype__isCharacterDeviceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSBigIntStats* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof BigIntStats"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return BigIntStatsPrototype__isCharacterDevice_(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(BigIntStatsPrototype__isDirectoryCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSBigIntStats* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof BigIntStats"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return BigIntStatsPrototype__isDirectory_(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(BigIntStatsPrototype__isFIFOCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSBigIntStats* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof BigIntStats"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return BigIntStatsPrototype__isFIFO_(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(BigIntStatsPrototype__isFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSBigIntStats* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof BigIntStats"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return BigIntStatsPrototype__isFile_(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(BigIntStatsPrototype__isSocketCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSBigIntStats* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof BigIntStats"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return BigIntStatsPrototype__isSocket_(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(BigIntStatsPrototype__isSymbolicLinkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSBigIntStats* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof BigIntStats"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return BigIntStatsPrototype__isSymbolicLink_(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(BigIntStatsPrototype__modeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBigIntStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = BigIntStatsPrototype__mode(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(BigIntStatsPrototype__mtimeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBigIntStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_mtime.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - BigIntStatsPrototype__mtime(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_mtime.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void BigIntStatsPrototype__mtimeSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_mtime.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue BigIntStatsPrototype__mtimeGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_mtime.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(BigIntStatsPrototype__mtimeMsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBigIntStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = BigIntStatsPrototype__mtimeMs(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(BigIntStatsPrototype__mtimeNsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBigIntStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = BigIntStatsPrototype__mtimeNs(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(BigIntStatsPrototype__nlinkGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBigIntStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = BigIntStatsPrototype__nlink(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(BigIntStatsPrototype__rdevGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBigIntStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = BigIntStatsPrototype__rdev(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(BigIntStatsPrototype__sizeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBigIntStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = BigIntStatsPrototype__size(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(BigIntStatsPrototype__uidGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBigIntStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = BigIntStatsPrototype__uid(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -void JSBigIntStatsPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSBigIntStats::info(), JSBigIntStatsPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -void JSBigIntStatsConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSBigIntStatsPrototype* prototype) -{ - Base::finishCreation(vm, 0, "BigIntStats"_s, PropertyAdditionMode::WithoutStructureTransition); - - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} - -JSBigIntStatsConstructor::JSBigIntStatsConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} - -JSBigIntStatsConstructor* JSBigIntStatsConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSBigIntStatsPrototype* prototype) -{ - JSBigIntStatsConstructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSBigIntStatsConstructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSBigIntStatsConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) -{ - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); - JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSBigIntStatsConstructor(); - Structure* structure = globalObject->JSBigIntStatsStructure(); - if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); - - auto* functionGlobalObject = reinterpret_cast( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSBigIntStatsStructure()); - } - - void* ptr = BigIntStatsClass__construct(globalObject, callFrame); - - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); - } - - JSBigIntStats* instance = JSBigIntStats::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -void JSBigIntStatsConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSBigIntStatsPrototype* prototype) -{ -} - -const ClassInfo JSBigIntStatsConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBigIntStatsConstructor) }; - -extern "C" EncodedJSValue BigIntStats__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSBigIntStatsConstructor()); -} - -JSBigIntStats::~JSBigIntStats() -{ - if (m_ctx) { - BigIntStatsClass__finalize(m_ctx); - } -} -void JSBigIntStats::destroy(JSCell* cell) -{ - static_cast(cell)->JSBigIntStats::~JSBigIntStats(); -} - -const ClassInfo JSBigIntStats::s_info = { "BigIntStats"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBigIntStats) }; - -void JSBigIntStats::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSBigIntStats* JSBigIntStats::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSBigIntStats* ptr = new (NotNull, JSC::allocateCell(vm)) JSBigIntStats(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* BigIntStats__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSBigIntStats* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool BigIntStats__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSBigIntStats* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t BigIntStats__ptrOffset = JSBigIntStats::offsetOfWrapped(); - -void JSBigIntStats::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSBigIntStats::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) -{ - return WebCore::JSBigIntStatsConstructor::create(vm, globalObject, WebCore::JSBigIntStatsConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast(prototype)); -} - -JSObject* JSBigIntStats::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSBigIntStatsPrototype::create(vm, globalObject, JSBigIntStatsPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue BigIntStats__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSBigIntStatsStructure(); - JSBigIntStats* instance = JSBigIntStats::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSBigIntStats::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSBigIntStats* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSBigIntStats); - -template -void JSBigIntStats::visitAdditionalChildren(Visitor& visitor) -{ - JSBigIntStats* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_atime); - visitor.append(thisObject->m_birthtime); - visitor.append(thisObject->m_ctime); - visitor.append(thisObject->m_mtime); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSBigIntStats); - -template -void JSBigIntStats::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSBigIntStats* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSBigIntStats); -class JSBlobPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSBlobPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSBlobPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSBlobPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSBlobPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSBlobPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -class JSBlobConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSBlobConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSBlobPrototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForBlobConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForBlobConstructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForBlobConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForBlobConstructor = std::forward(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSBlobPrototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSBlobConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSBlobPrototype* prototype); -}; - -extern "C" void* BlobClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsBlobConstructor); - -extern "C" void Blob__onStructuredCloneSerialize(void*, JSC::JSGlobalObject*, void*, void (*)(CloneSerializer*, const uint8_t*, uint32_t)); - -extern "C" JSC::EncodedJSValue Blob__onStructuredCloneDeserialize(JSC::JSGlobalObject*, const uint8_t*, const uint8_t*); - -extern "C" void BlobClass__finalize(void*); - -extern "C" EncodedJSValue BlobPrototype__getArrayBuffer(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(BlobPrototype__arrayBufferCallback); - -extern "C" EncodedJSValue BlobPrototype__getExists(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(BlobPrototype__existsCallback); - -extern "C" EncodedJSValue BlobPrototype__getFormData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(BlobPrototype__formDataCallback); - -extern "C" EncodedJSValue BlobPrototype__getJSON(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(BlobPrototype__jsonCallback); - -extern "C" JSC::EncodedJSValue BlobPrototype__getLastModified(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BlobPrototype__lastModifiedGetterWrap); - -extern "C" JSC::EncodedJSValue BlobPrototype__getName(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BlobPrototype__nameGetterWrap); - -extern "C" JSC::EncodedJSValue BlobPrototype__getSize(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BlobPrototype__sizeGetterWrap); - -extern "C" EncodedJSValue BlobPrototype__getSlice(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(BlobPrototype__sliceCallback); - -extern "C" EncodedJSValue BlobPrototype__getStream(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(BlobPrototype__streamCallback); - -extern "C" EncodedJSValue BlobPrototype__getText(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(BlobPrototype__textCallback); - -extern "C" JSC::EncodedJSValue BlobPrototype__getType(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BlobPrototype__typeGetterWrap); - -extern "C" EncodedJSValue BlobPrototype__getWriter(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(BlobPrototype__writerCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSBlobPrototype, JSBlobPrototype::Base); - -static const HashTableValue JSBlobPrototypeTableValues[] = { - { "arrayBuffer"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__arrayBufferCallback, 0 } }, - { "exists"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__existsCallback, 0 } }, - { "formData"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__formDataCallback, 0 } }, - { "json"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__jsonCallback, 0 } }, - { "lastModified"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BlobPrototype__lastModifiedGetterWrap, 0 } }, - { "name"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BlobPrototype__nameGetterWrap, 0 } }, - { "size"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BlobPrototype__sizeGetterWrap, 0 } }, - { "slice"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__sliceCallback, 2 } }, - { "stream"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__streamCallback, 1 } }, - { "text"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__textCallback, 0 } }, - { "type"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BlobPrototype__typeGetterWrap, 0 } }, - { "writer"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__writerCallback, 1 } } -}; - -const ClassInfo JSBlobPrototype::s_info = { "Blob"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBlobPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsBlobConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for Blob"_s); - return JSValue::encode(globalObject->JSBlobConstructor()); -} - -JSC_DEFINE_HOST_FUNCTION(BlobPrototype__arrayBufferCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSBlob* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Blob"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return BlobPrototype__getArrayBuffer(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(BlobPrototype__existsCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSBlob* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Blob"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return BlobPrototype__getExists(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(BlobPrototype__formDataCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSBlob* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Blob"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return BlobPrototype__getFormData(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(BlobPrototype__jsonCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSBlob* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Blob"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return BlobPrototype__getJSON(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(BlobPrototype__lastModifiedGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBlob* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = BlobPrototype__getLastModified(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(BlobPrototype__nameGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBlob* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_name.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - BlobPrototype__getName(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_name.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void BlobPrototype__nameSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_name.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue BlobPrototype__nameGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_name.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(BlobPrototype__sizeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBlob* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = BlobPrototype__getSize(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(BlobPrototype__sliceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSBlob* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Blob"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return BlobPrototype__getSlice(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(BlobPrototype__streamCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSBlob* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Blob"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return BlobPrototype__getStream(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(BlobPrototype__textCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSBlob* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Blob"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return BlobPrototype__getText(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(BlobPrototype__typeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBlob* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = BlobPrototype__getType(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(BlobPrototype__writerCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSBlob* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Blob"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return BlobPrototype__getWriter(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSBlobPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSBlob::info(), JSBlobPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -extern "C" size_t Blob__estimatedSize(void* ptr); - -void JSBlobConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSBlobPrototype* prototype) -{ - Base::finishCreation(vm, 0, "Blob"_s, PropertyAdditionMode::WithoutStructureTransition); - - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} - -JSBlobConstructor::JSBlobConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} - -JSBlobConstructor* JSBlobConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSBlobPrototype* prototype) -{ - JSBlobConstructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSBlobConstructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSBlobConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) -{ - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); - JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSBlobConstructor(); - Structure* structure = globalObject->JSBlobStructure(); - if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); - - auto* functionGlobalObject = reinterpret_cast( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSBlobStructure()); - } - - void* ptr = BlobClass__construct(globalObject, callFrame); - - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); - } - - JSBlob* instance = JSBlob::create(vm, globalObject, structure, ptr); - vm.heap.reportExtraMemoryAllocated(instance, Blob__estimatedSize(instance->wrapped())); - - return JSValue::encode(instance); -} - -void JSBlobConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSBlobPrototype* prototype) -{ -} - -const ClassInfo JSBlobConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBlobConstructor) }; - -extern "C" EncodedJSValue Blob__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSBlobConstructor()); -} - -JSBlob::~JSBlob() -{ - if (m_ctx) { - BlobClass__finalize(m_ctx); - } -} -void JSBlob::destroy(JSCell* cell) -{ - static_cast(cell)->JSBlob::~JSBlob(); -} - -const ClassInfo JSBlob::s_info = { "Blob"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBlob) }; - -void JSBlob::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSBlob* JSBlob::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSBlob* ptr = new (NotNull, JSC::allocateCell(vm)) JSBlob(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* Blob__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSBlob* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool Blob__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSBlob* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t Blob__ptrOffset = JSBlob::offsetOfWrapped(); - -void JSBlob::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSBlob::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) -{ - return WebCore::JSBlobConstructor::create(vm, globalObject, WebCore::JSBlobConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast(prototype)); -} - -JSObject* JSBlob::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSBlobPrototype::create(vm, globalObject, JSBlobPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue Blob__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSBlobStructure(); - JSBlob* instance = JSBlob::create(vm, globalObject, structure, ptr); - vm.heap.reportExtraMemoryAllocated(instance, Blob__estimatedSize(ptr)); - return JSValue::encode(instance); -} - -template -void JSBlob::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSBlob* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - if (auto* ptr = thisObject->wrapped()) { - visitor.reportExtraMemoryVisited(Blob__estimatedSize(ptr)); - } - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSBlob); - -template -void JSBlob::visitAdditionalChildren(Visitor& visitor) -{ - JSBlob* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_name); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSBlob); - -template -void JSBlob::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSBlob* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSBlob); -class JSBuildArtifactPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSBuildArtifactPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSBuildArtifactPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSBuildArtifactPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSBuildArtifactPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSBuildArtifactPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -extern "C" void BuildArtifactClass__finalize(void*); - -extern "C" EncodedJSValue BuildArtifactPrototype__getArrayBuffer(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(BuildArtifactPrototype__arrayBufferCallback); - -extern "C" JSC::EncodedJSValue BuildArtifactPrototype__getHash(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BuildArtifactPrototype__hashGetterWrap); - -extern "C" EncodedJSValue BuildArtifactPrototype__getJSON(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(BuildArtifactPrototype__jsonCallback); - -extern "C" JSC::EncodedJSValue BuildArtifactPrototype__getOutputKind(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BuildArtifactPrototype__kindGetterWrap); - -extern "C" JSC::EncodedJSValue BuildArtifactPrototype__getLoader(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BuildArtifactPrototype__loaderGetterWrap); - -extern "C" JSC::EncodedJSValue BuildArtifactPrototype__getPath(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BuildArtifactPrototype__pathGetterWrap); - -extern "C" JSC::EncodedJSValue BuildArtifactPrototype__getSize(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BuildArtifactPrototype__sizeGetterWrap); - -extern "C" EncodedJSValue BuildArtifactPrototype__getSlice(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(BuildArtifactPrototype__sliceCallback); - -extern "C" JSC::EncodedJSValue BuildArtifactPrototype__getSourceMap(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BuildArtifactPrototype__sourcemapGetterWrap); - -extern "C" EncodedJSValue BuildArtifactPrototype__getStream(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(BuildArtifactPrototype__streamCallback); - -extern "C" EncodedJSValue BuildArtifactPrototype__getText(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(BuildArtifactPrototype__textCallback); - -extern "C" JSC::EncodedJSValue BuildArtifactPrototype__getMimeType(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BuildArtifactPrototype__typeGetterWrap); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSBuildArtifactPrototype, JSBuildArtifactPrototype::Base); - -static const HashTableValue JSBuildArtifactPrototypeTableValues[] = { - { "arrayBuffer"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BuildArtifactPrototype__arrayBufferCallback, 0 } }, - { "hash"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BuildArtifactPrototype__hashGetterWrap, 0 } }, - { "json"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BuildArtifactPrototype__jsonCallback, 0 } }, - { "kind"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BuildArtifactPrototype__kindGetterWrap, 0 } }, - { "loader"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BuildArtifactPrototype__loaderGetterWrap, 0 } }, - { "path"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BuildArtifactPrototype__pathGetterWrap, 0 } }, - { "size"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BuildArtifactPrototype__sizeGetterWrap, 0 } }, - { "slice"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BuildArtifactPrototype__sliceCallback, 2 } }, - { "sourcemap"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BuildArtifactPrototype__sourcemapGetterWrap, 0 } }, - { "stream"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BuildArtifactPrototype__streamCallback, 1 } }, - { "text"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BuildArtifactPrototype__textCallback, 0 } }, - { "type"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BuildArtifactPrototype__typeGetterWrap, 0 } } -}; - -const ClassInfo JSBuildArtifactPrototype::s_info = { "BuildArtifact"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBuildArtifactPrototype) }; - -JSC_DEFINE_HOST_FUNCTION(BuildArtifactPrototype__arrayBufferCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSBuildArtifact* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof BuildArtifact"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return BuildArtifactPrototype__getArrayBuffer(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(BuildArtifactPrototype__hashGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBuildArtifact* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_hash.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - BuildArtifactPrototype__getHash(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_hash.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void BuildArtifactPrototype__hashSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_hash.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue BuildArtifactPrototype__hashGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_hash.get()); -} - -JSC_DEFINE_HOST_FUNCTION(BuildArtifactPrototype__jsonCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSBuildArtifact* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof BuildArtifact"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return BuildArtifactPrototype__getJSON(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(BuildArtifactPrototype__kindGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBuildArtifact* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_kind.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - BuildArtifactPrototype__getOutputKind(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_kind.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void BuildArtifactPrototype__kindSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_kind.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue BuildArtifactPrototype__kindGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_kind.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(BuildArtifactPrototype__loaderGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBuildArtifact* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_loader.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - BuildArtifactPrototype__getLoader(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_loader.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void BuildArtifactPrototype__loaderSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_loader.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue BuildArtifactPrototype__loaderGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_loader.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(BuildArtifactPrototype__pathGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBuildArtifact* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_path.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - BuildArtifactPrototype__getPath(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_path.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void BuildArtifactPrototype__pathSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_path.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue BuildArtifactPrototype__pathGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_path.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(BuildArtifactPrototype__sizeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBuildArtifact* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = BuildArtifactPrototype__getSize(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(BuildArtifactPrototype__sliceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSBuildArtifact* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof BuildArtifact"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return BuildArtifactPrototype__getSlice(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(BuildArtifactPrototype__sourcemapGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBuildArtifact* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_sourcemap.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - BuildArtifactPrototype__getSourceMap(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_sourcemap.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void BuildArtifactPrototype__sourcemapSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_sourcemap.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue BuildArtifactPrototype__sourcemapGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_sourcemap.get()); -} - -JSC_DEFINE_HOST_FUNCTION(BuildArtifactPrototype__streamCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSBuildArtifact* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof BuildArtifact"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return BuildArtifactPrototype__getStream(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(BuildArtifactPrototype__textCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSBuildArtifact* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof BuildArtifact"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return BuildArtifactPrototype__getText(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(BuildArtifactPrototype__typeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBuildArtifact* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_type.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - BuildArtifactPrototype__getMimeType(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_type.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void BuildArtifactPrototype__typeSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_type.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue BuildArtifactPrototype__typeGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_type.get()); -} - -void JSBuildArtifactPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSBuildArtifact::info(), JSBuildArtifactPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -JSBuildArtifact::~JSBuildArtifact() -{ - if (m_ctx) { - BuildArtifactClass__finalize(m_ctx); - } -} -void JSBuildArtifact::destroy(JSCell* cell) -{ - static_cast(cell)->JSBuildArtifact::~JSBuildArtifact(); -} - -const ClassInfo JSBuildArtifact::s_info = { "BuildArtifact"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBuildArtifact) }; - -void JSBuildArtifact::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSBuildArtifact* JSBuildArtifact::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSBuildArtifact* ptr = new (NotNull, JSC::allocateCell(vm)) JSBuildArtifact(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* BuildArtifact__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSBuildArtifact* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool BuildArtifact__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSBuildArtifact* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t BuildArtifact__ptrOffset = JSBuildArtifact::offsetOfWrapped(); - -void JSBuildArtifact::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSBuildArtifact::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSBuildArtifactPrototype::create(vm, globalObject, JSBuildArtifactPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue BuildArtifact__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSBuildArtifactStructure(); - JSBuildArtifact* instance = JSBuildArtifact::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSBuildArtifact::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSBuildArtifact* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSBuildArtifact); - -template -void JSBuildArtifact::visitAdditionalChildren(Visitor& visitor) -{ - JSBuildArtifact* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_hash); - visitor.append(thisObject->m_kind); - visitor.append(thisObject->m_loader); - visitor.append(thisObject->m_path); - visitor.append(thisObject->m_sourcemap); - visitor.append(thisObject->m_type); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSBuildArtifact); - -template -void JSBuildArtifact::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSBuildArtifact* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSBuildArtifact); -class JSBuildMessagePrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSBuildMessagePrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSBuildMessagePrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSBuildMessagePrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSBuildMessagePrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSBuildMessagePrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -class JSBuildMessageConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSBuildMessageConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSBuildMessagePrototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForBuildMessageConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForBuildMessageConstructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForBuildMessageConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForBuildMessageConstructor = std::forward(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSBuildMessagePrototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSBuildMessageConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSBuildMessagePrototype* prototype); -}; - -extern "C" void* BuildMessageClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsBuildMessageConstructor); - -extern "C" void BuildMessageClass__finalize(void*); - -extern "C" EncodedJSValue BuildMessagePrototype__toPrimitive(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(BuildMessagePrototype__toPrimitiveCallback); - -extern "C" JSC::EncodedJSValue BuildMessagePrototype__getLevel(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BuildMessagePrototype__levelGetterWrap); - -extern "C" JSC::EncodedJSValue BuildMessagePrototype__getMessage(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BuildMessagePrototype__messageGetterWrap); - -extern "C" JSC::EncodedJSValue BuildMessagePrototype__getPosition(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BuildMessagePrototype__positionGetterWrap); - -extern "C" EncodedJSValue BuildMessagePrototype__toJSON(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(BuildMessagePrototype__toJSONCallback); - -extern "C" EncodedJSValue BuildMessagePrototype__toString(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(BuildMessagePrototype__toStringCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSBuildMessagePrototype, JSBuildMessagePrototype::Base); - -static const HashTableValue JSBuildMessagePrototypeTableValues[] = { - { "level"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BuildMessagePrototype__levelGetterWrap, 0 } }, - { "message"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BuildMessagePrototype__messageGetterWrap, 0 } }, - { "position"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BuildMessagePrototype__positionGetterWrap, 0 } }, - { "toJSON"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BuildMessagePrototype__toJSONCallback, 0 } }, - { "toString"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BuildMessagePrototype__toStringCallback, 0 } } -}; - -const ClassInfo JSBuildMessagePrototype::s_info = { "BuildMessage"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBuildMessagePrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsBuildMessageConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for BuildMessage"_s); - return JSValue::encode(globalObject->JSBuildMessageConstructor()); -} - -JSC_DEFINE_HOST_FUNCTION(BuildMessagePrototype__toPrimitiveCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSBuildMessage* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof BuildMessage"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return BuildMessagePrototype__toPrimitive(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(BuildMessagePrototype__levelGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBuildMessage* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_level.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - BuildMessagePrototype__getLevel(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_level.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void BuildMessagePrototype__levelSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_level.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue BuildMessagePrototype__levelGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_level.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(BuildMessagePrototype__messageGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBuildMessage* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_message.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - BuildMessagePrototype__getMessage(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_message.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void BuildMessagePrototype__messageSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_message.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue BuildMessagePrototype__messageGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_message.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(BuildMessagePrototype__positionGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBuildMessage* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_position.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - BuildMessagePrototype__getPosition(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_position.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void BuildMessagePrototype__positionSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_position.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue BuildMessagePrototype__positionGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_position.get()); -} - -JSC_DEFINE_HOST_FUNCTION(BuildMessagePrototype__toJSONCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSBuildMessage* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof BuildMessage"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return BuildMessagePrototype__toJSON(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(BuildMessagePrototype__toStringCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSBuildMessage* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof BuildMessage"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return BuildMessagePrototype__toString(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSBuildMessagePrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSBuildMessage::info(), JSBuildMessagePrototypeTableValues, *this); - this->putDirect(vm, vm.propertyNames->toPrimitiveSymbol, JSFunction::create(vm, globalObject, 1, String("toPrimitive"_s), BuildMessagePrototype__toPrimitiveCallback, ImplementationVisibility::Public), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | 0); - this->putDirect(vm, vm.propertyNames->name, jsString(vm, String("BuildMessage"_s)), PropertyAttribute::ReadOnly | 0); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -void JSBuildMessageConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSBuildMessagePrototype* prototype) -{ - Base::finishCreation(vm, 0, "BuildMessage"_s, PropertyAdditionMode::WithoutStructureTransition); - - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} - -JSBuildMessageConstructor::JSBuildMessageConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} - -JSBuildMessageConstructor* JSBuildMessageConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSBuildMessagePrototype* prototype) -{ - JSBuildMessageConstructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSBuildMessageConstructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSBuildMessageConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) -{ - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); - JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSBuildMessageConstructor(); - Structure* structure = globalObject->JSBuildMessageStructure(); - if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); - - auto* functionGlobalObject = reinterpret_cast( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSBuildMessageStructure()); - } - - void* ptr = BuildMessageClass__construct(globalObject, callFrame); - - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); - } - - JSBuildMessage* instance = JSBuildMessage::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -void JSBuildMessageConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSBuildMessagePrototype* prototype) -{ -} - -const ClassInfo JSBuildMessageConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBuildMessageConstructor) }; - -extern "C" EncodedJSValue BuildMessage__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSBuildMessageConstructor()); -} - -JSBuildMessage::~JSBuildMessage() -{ - if (m_ctx) { - BuildMessageClass__finalize(m_ctx); - } -} -void JSBuildMessage::destroy(JSCell* cell) -{ - static_cast(cell)->JSBuildMessage::~JSBuildMessage(); -} - -const ClassInfo JSBuildMessage::s_info = { "BuildMessage"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBuildMessage) }; - -void JSBuildMessage::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSBuildMessage* JSBuildMessage::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSBuildMessage* ptr = new (NotNull, JSC::allocateCell(vm)) JSBuildMessage(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* BuildMessage__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSBuildMessage* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool BuildMessage__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSBuildMessage* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t BuildMessage__ptrOffset = JSBuildMessage::offsetOfWrapped(); - -void JSBuildMessage::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSBuildMessage::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) -{ - return WebCore::JSBuildMessageConstructor::create(vm, globalObject, WebCore::JSBuildMessageConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast(prototype)); -} - -JSObject* JSBuildMessage::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSBuildMessagePrototype::create(vm, globalObject, JSBuildMessagePrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue BuildMessage__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSBuildMessageStructure(); - JSBuildMessage* instance = JSBuildMessage::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSBuildMessage::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSBuildMessage* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSBuildMessage); - -template -void JSBuildMessage::visitAdditionalChildren(Visitor& visitor) -{ - JSBuildMessage* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_level); - visitor.append(thisObject->m_message); - visitor.append(thisObject->m_position); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSBuildMessage); - -template -void JSBuildMessage::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSBuildMessage* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSBuildMessage); -class JSCommentPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSCommentPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSCommentPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSCommentPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSCommentPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSCommentPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -extern "C" void* CommentClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsCommentConstructor); - -extern "C" void CommentClass__finalize(void*); - -extern "C" EncodedJSValue CommentPrototype__after(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(CommentPrototype__afterCallback); - -extern "C" EncodedJSValue CommentPrototype__before(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(CommentPrototype__beforeCallback); - -extern "C" EncodedJSValue CommentPrototype__remove(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(CommentPrototype__removeCallback); - -extern "C" JSC::EncodedJSValue CommentPrototype__removed(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(CommentPrototype__removedGetterWrap); - -extern "C" EncodedJSValue CommentPrototype__replace(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(CommentPrototype__replaceCallback); - -extern "C" JSC::EncodedJSValue CommentPrototype__getText(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(CommentPrototype__textGetterWrap); - -extern "C" bool CommentPrototype__setText(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::EncodedJSValue value); -JSC_DECLARE_CUSTOM_SETTER(CommentPrototype__textSetterWrap); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSCommentPrototype, JSCommentPrototype::Base); - -static const HashTableValue JSCommentPrototypeTableValues[] = { - { "after"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, CommentPrototype__afterCallback, 1 } }, - { "before"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, CommentPrototype__beforeCallback, 1 } }, - { "remove"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, CommentPrototype__removeCallback, 0 } }, - { "removed"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, CommentPrototype__removedGetterWrap, 0 } }, - { "replace"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, CommentPrototype__replaceCallback, 1 } }, - { "text"_s, static_cast(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, CommentPrototype__textGetterWrap, CommentPrototype__textSetterWrap } } -}; - -const ClassInfo JSCommentPrototype::s_info = { "Comment"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCommentPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsCommentConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for Comment"_s); - return JSValue::encode(globalObject->JSCommentConstructor()); -} - -JSC_DEFINE_HOST_FUNCTION(CommentPrototype__afterCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSComment* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Comment"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return CommentPrototype__after(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(CommentPrototype__beforeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSComment* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Comment"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return CommentPrototype__before(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(CommentPrototype__removeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSComment* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Comment"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return CommentPrototype__remove(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(CommentPrototype__removedGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSComment* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = CommentPrototype__removed(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(CommentPrototype__replaceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSComment* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Comment"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return CommentPrototype__replace(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(CommentPrototype__textGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSComment* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = CommentPrototype__getText(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_SETTER(CommentPrototype__textSetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSComment* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - auto result = CommentPrototype__setText(thisObject->wrapped(), lexicalGlobalObject, encodedValue); - - RELEASE_AND_RETURN(throwScope, result); -} - -void JSCommentPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSComment::info(), JSCommentPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -JSComment::~JSComment() -{ - if (m_ctx) { - CommentClass__finalize(m_ctx); - } -} -void JSComment::destroy(JSCell* cell) -{ - static_cast(cell)->JSComment::~JSComment(); -} - -const ClassInfo JSComment::s_info = { "Comment"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSComment) }; - -void JSComment::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSComment* JSComment::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSComment* ptr = new (NotNull, JSC::allocateCell(vm)) JSComment(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* Comment__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSComment* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool Comment__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSComment* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t Comment__ptrOffset = JSComment::offsetOfWrapped(); - -void JSComment::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSComment::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSCommentPrototype::create(vm, globalObject, JSCommentPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue Comment__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSCommentStructure(); - JSComment* instance = JSComment::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -class JSCryptoPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSCryptoPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSCryptoPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSCryptoPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSCryptoPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSCryptoPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -class JSCryptoConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSCryptoConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSCryptoPrototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForCryptoConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForCryptoConstructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForCryptoConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForCryptoConstructor = std::forward(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSCryptoPrototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSCryptoConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSCryptoPrototype* prototype); -}; - -extern "C" void* CryptoClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsCryptoConstructor); - -extern "C" void CryptoClass__finalize(void*); - -extern "C" EncodedJSValue CryptoPrototype__getRandomValues(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(CryptoPrototype__getRandomValuesCallback); - -extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(CryptoPrototype__getRandomValuesWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSUint8Array* arg0)); -extern "C" EncodedJSValue CryptoPrototype__getRandomValuesWithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSUint8Array* arg0); - -static const JSC::DOMJIT::Signature DOMJITSignatureForCryptoPrototype__getRandomValues(CryptoPrototype__getRandomValuesWithoutTypeChecksWrapper, - JSCrypto::info(), - JSC::DOMJIT::Effect::forReadWrite(JSC::DOMJIT::HeapRange::top(), JSC::DOMJIT::HeapRange::top()), - JSC::SpecHeapTop, JSC::SpecUint8Array); - -JSC_DEFINE_JIT_OPERATION(CryptoPrototype__getRandomValuesWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSUint8Array* arg0)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - IGNORE_WARNINGS_BEGIN("frame-address") - CallFrame* callFrame = DECLARE_CALL_FRAME(vm); - IGNORE_WARNINGS_END - JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); - return CryptoPrototype__getRandomValuesWithoutTypeChecks(reinterpret_cast(thisValue)->wrapped(), lexicalGlobalObject, arg0); -} - -extern "C" EncodedJSValue CryptoPrototype__randomInt(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(CryptoPrototype__randomIntCallback); - -extern "C" EncodedJSValue CryptoPrototype__randomUUID(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(CryptoPrototype__randomUUIDCallback); - -extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(CryptoPrototype__randomUUIDWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)); -extern "C" EncodedJSValue CryptoPrototype__randomUUIDWithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); - -static const JSC::DOMJIT::Signature DOMJITSignatureForCryptoPrototype__randomUUID(CryptoPrototype__randomUUIDWithoutTypeChecksWrapper, - JSCrypto::info(), - JSC::DOMJIT::Effect::forReadWrite(JSC::DOMJIT::HeapRange::top(), JSC::DOMJIT::HeapRange::top()), - JSC::SpecString); - -JSC_DEFINE_JIT_OPERATION(CryptoPrototype__randomUUIDWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - IGNORE_WARNINGS_BEGIN("frame-address") - CallFrame* callFrame = DECLARE_CALL_FRAME(vm); - IGNORE_WARNINGS_END - JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); - return CryptoPrototype__randomUUIDWithoutTypeChecks(reinterpret_cast(thisValue)->wrapped(), lexicalGlobalObject); -} - -extern "C" EncodedJSValue CryptoPrototype__doScryptSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(CryptoPrototype__scryptSyncCallback); - -extern "C" EncodedJSValue CryptoPrototype__timingSafeEqual(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(CryptoPrototype__timingSafeEqualCallback); - -extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(CryptoPrototype__timingSafeEqualWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSUint8Array* arg0, JSC::JSUint8Array* arg1)); -extern "C" EncodedJSValue CryptoPrototype__timingSafeEqualWithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSUint8Array* arg0, JSC::JSUint8Array* arg1); - -static const JSC::DOMJIT::Signature DOMJITSignatureForCryptoPrototype__timingSafeEqual(CryptoPrototype__timingSafeEqualWithoutTypeChecksWrapper, - JSCrypto::info(), - JSC::DOMJIT::Effect::forReadWrite(JSC::DOMJIT::HeapRange::top(), JSC::DOMJIT::HeapRange::top()), - JSC::SpecHeapTop, JSC::SpecUint8Array, JSC::SpecUint8Array); - -JSC_DEFINE_JIT_OPERATION(CryptoPrototype__timingSafeEqualWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSUint8Array* arg0, JSC::JSUint8Array* arg1)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - IGNORE_WARNINGS_BEGIN("frame-address") - CallFrame* callFrame = DECLARE_CALL_FRAME(vm); - IGNORE_WARNINGS_END - JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); - return CryptoPrototype__timingSafeEqualWithoutTypeChecks(reinterpret_cast(thisValue)->wrapped(), lexicalGlobalObject, arg0, arg1); -} - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSCryptoPrototype, JSCryptoPrototype::Base); - -static const HashTableValue JSCryptoPrototypeTableValues[] = { - { "getRandomValues"_s, static_cast(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, CryptoPrototype__getRandomValuesCallback, &DOMJITSignatureForCryptoPrototype__getRandomValues } }, - { "randomInt"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, CryptoPrototype__randomIntCallback, 2 } }, - { "randomUUID"_s, static_cast(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, CryptoPrototype__randomUUIDCallback, &DOMJITSignatureForCryptoPrototype__randomUUID } }, - { "scryptSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, CryptoPrototype__scryptSyncCallback, 2 } }, - { "timingSafeEqual"_s, static_cast(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, CryptoPrototype__timingSafeEqualCallback, &DOMJITSignatureForCryptoPrototype__timingSafeEqual } } -}; - -const ClassInfo JSCryptoPrototype::s_info = { "Crypto"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCryptoPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsCryptoConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for Crypto"_s); - return JSValue::encode(globalObject->JSCryptoConstructor()); -} - -JSC_DEFINE_HOST_FUNCTION(CryptoPrototype__getRandomValuesCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSCrypto* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Crypto"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return CryptoPrototype__getRandomValues(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(CryptoPrototype__randomIntCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSCrypto* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Crypto"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return CryptoPrototype__randomInt(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(CryptoPrototype__randomUUIDCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSCrypto* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Crypto"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return CryptoPrototype__randomUUID(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(CryptoPrototype__scryptSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSCrypto* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Crypto"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return CryptoPrototype__doScryptSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(CryptoPrototype__timingSafeEqualCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSCrypto* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Crypto"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return CryptoPrototype__timingSafeEqual(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSCryptoPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSCrypto::info(), JSCryptoPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -void JSCryptoConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSCryptoPrototype* prototype) -{ - Base::finishCreation(vm, 0, "Crypto"_s, PropertyAdditionMode::WithoutStructureTransition); - - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} - -JSCryptoConstructor::JSCryptoConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} - -JSCryptoConstructor* JSCryptoConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSCryptoPrototype* prototype) -{ - JSCryptoConstructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSCryptoConstructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSCryptoConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) -{ - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); - JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSCryptoConstructor(); - Structure* structure = globalObject->JSCryptoStructure(); - if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); - - auto* functionGlobalObject = reinterpret_cast( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSCryptoStructure()); - } - - void* ptr = CryptoClass__construct(globalObject, callFrame); - - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); - } - - JSCrypto* instance = JSCrypto::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -void JSCryptoConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSCryptoPrototype* prototype) -{ -} - -const ClassInfo JSCryptoConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCryptoConstructor) }; - -extern "C" EncodedJSValue Crypto__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSCryptoConstructor()); -} - -JSCrypto::~JSCrypto() -{ -} -void JSCrypto::destroy(JSCell* cell) -{ - static_cast(cell)->JSCrypto::~JSCrypto(); -} - -const ClassInfo JSCrypto::s_info = { "Crypto"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCrypto) }; - -void JSCrypto::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSCrypto* JSCrypto::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSCrypto* ptr = new (NotNull, JSC::allocateCell(vm)) JSCrypto(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* Crypto__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSCrypto* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool Crypto__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSCrypto* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t Crypto__ptrOffset = JSCrypto::offsetOfWrapped(); - -void JSCrypto::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSCrypto::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) -{ - return WebCore::JSCryptoConstructor::create(vm, globalObject, WebCore::JSCryptoConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast(prototype)); -} - -JSObject* JSCrypto::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSCryptoPrototype::create(vm, globalObject, JSCryptoPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue Crypto__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSCryptoStructure(); - JSCrypto* instance = JSCrypto::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -class JSCryptoHasherPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSCryptoHasherPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSCryptoHasherPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSCryptoHasherPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSCryptoHasherPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSCryptoHasherPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -class JSCryptoHasherConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSCryptoHasherConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSCryptoHasherPrototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForCryptoHasherConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForCryptoHasherConstructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForCryptoHasherConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForCryptoHasherConstructor = std::forward(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSCryptoHasherPrototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSCryptoHasherConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSCryptoHasherPrototype* prototype); -}; - -extern "C" void* CryptoHasherClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsCryptoHasherConstructor); - -extern "C" void CryptoHasherClass__finalize(void*); - -extern "C" JSC::EncodedJSValue CryptoHasherPrototype__getAlgorithm(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(CryptoHasherPrototype__algorithmGetterWrap); - -extern "C" JSC::EncodedJSValue CryptoHasherPrototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(CryptoHasherPrototype__byteLengthGetterWrap); - -extern "C" EncodedJSValue CryptoHasherPrototype__copy(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(CryptoHasherPrototype__copyCallback); - -extern "C" EncodedJSValue CryptoHasherPrototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(CryptoHasherPrototype__digestCallback); - -extern "C" EncodedJSValue CryptoHasherPrototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(CryptoHasherPrototype__updateCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSCryptoHasherPrototype, JSCryptoHasherPrototype::Base); - -static const HashTableValue JSCryptoHasherPrototypeTableValues[] = { - { "algorithm"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, CryptoHasherPrototype__algorithmGetterWrap, 0 } }, - { "byteLength"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, CryptoHasherPrototype__byteLengthGetterWrap, 0 } }, - { "copy"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, CryptoHasherPrototype__copyCallback, 0 } }, - { "digest"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, CryptoHasherPrototype__digestCallback, 0 } }, - { "update"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, CryptoHasherPrototype__updateCallback, 2 } } -}; - -const ClassInfo JSCryptoHasherPrototype::s_info = { "CryptoHasher"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCryptoHasherPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsCryptoHasherConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for CryptoHasher"_s); - return JSValue::encode(globalObject->JSCryptoHasherConstructor()); -} - -JSC_DEFINE_CUSTOM_GETTER(CryptoHasherPrototype__algorithmGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSCryptoHasher* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_algorithm.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - CryptoHasherPrototype__getAlgorithm(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_algorithm.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void CryptoHasherPrototype__algorithmSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_algorithm.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue CryptoHasherPrototype__algorithmGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_algorithm.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(CryptoHasherPrototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSCryptoHasher* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = CryptoHasherPrototype__getByteLength(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(CryptoHasherPrototype__copyCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSCryptoHasher* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof CryptoHasher"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return CryptoHasherPrototype__copy(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(CryptoHasherPrototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSCryptoHasher* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof CryptoHasher"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return CryptoHasherPrototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(CryptoHasherPrototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSCryptoHasher* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof CryptoHasher"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return CryptoHasherPrototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSCryptoHasherPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSCryptoHasher::info(), JSCryptoHasherPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -extern "C" JSC_DECLARE_CUSTOM_GETTER(CryptoHasherClass__getAlgorithms); -extern "C" JSC_DECLARE_HOST_FUNCTION(CryptoHasherClass__hash); - -static const HashTableValue JSCryptoHasherConstructorTableValues[] = { - { "algorithms"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, CryptoHasherClass__getAlgorithms, 0 } }, - { "hash"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, CryptoHasherClass__hash, 2 } } -}; - -void JSCryptoHasherConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSCryptoHasherPrototype* prototype) -{ - Base::finishCreation(vm, 0, "CryptoHasher"_s, PropertyAdditionMode::WithoutStructureTransition); - reifyStaticProperties(vm, &JSCryptoHasherConstructor::s_info, JSCryptoHasherConstructorTableValues, *this); - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} - -JSCryptoHasherConstructor::JSCryptoHasherConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} - -JSCryptoHasherConstructor* JSCryptoHasherConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSCryptoHasherPrototype* prototype) -{ - JSCryptoHasherConstructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSCryptoHasherConstructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSCryptoHasherConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) -{ - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); - JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSCryptoHasherConstructor(); - Structure* structure = globalObject->JSCryptoHasherStructure(); - if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); - - auto* functionGlobalObject = reinterpret_cast( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSCryptoHasherStructure()); - } - - void* ptr = CryptoHasherClass__construct(globalObject, callFrame); - - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); - } - - JSCryptoHasher* instance = JSCryptoHasher::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -void JSCryptoHasherConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSCryptoHasherPrototype* prototype) -{ -} - -const ClassInfo JSCryptoHasherConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCryptoHasherConstructor) }; - -extern "C" EncodedJSValue CryptoHasher__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSCryptoHasherConstructor()); -} - -JSCryptoHasher::~JSCryptoHasher() -{ - if (m_ctx) { - CryptoHasherClass__finalize(m_ctx); - } -} -void JSCryptoHasher::destroy(JSCell* cell) -{ - static_cast(cell)->JSCryptoHasher::~JSCryptoHasher(); -} - -const ClassInfo JSCryptoHasher::s_info = { "CryptoHasher"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCryptoHasher) }; - -void JSCryptoHasher::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSCryptoHasher* JSCryptoHasher::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSCryptoHasher* ptr = new (NotNull, JSC::allocateCell(vm)) JSCryptoHasher(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* CryptoHasher__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSCryptoHasher* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool CryptoHasher__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSCryptoHasher* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t CryptoHasher__ptrOffset = JSCryptoHasher::offsetOfWrapped(); - -void JSCryptoHasher::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSCryptoHasher::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) -{ - return WebCore::JSCryptoHasherConstructor::create(vm, globalObject, WebCore::JSCryptoHasherConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast(prototype)); -} - -JSObject* JSCryptoHasher::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSCryptoHasherPrototype::create(vm, globalObject, JSCryptoHasherPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue CryptoHasher__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSCryptoHasherStructure(); - JSCryptoHasher* instance = JSCryptoHasher::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSCryptoHasher::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSCryptoHasher* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSCryptoHasher); - -template -void JSCryptoHasher::visitAdditionalChildren(Visitor& visitor) -{ - JSCryptoHasher* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_algorithms); - visitor.append(thisObject->m_algorithm); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSCryptoHasher); - -template -void JSCryptoHasher::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSCryptoHasher* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSCryptoHasher); -class JSDebugHTTPSServerPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSDebugHTTPSServerPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSDebugHTTPSServerPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSDebugHTTPSServerPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSDebugHTTPSServerPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSDebugHTTPSServerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -extern "C" void* DebugHTTPSServerClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsDebugHTTPSServerConstructor); - -extern "C" void DebugHTTPSServerClass__finalize(void*); - -extern "C" JSC::EncodedJSValue DebugHTTPSServerPrototype__getAddress(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(DebugHTTPSServerPrototype__addressGetterWrap); - -extern "C" JSC::EncodedJSValue DebugHTTPSServerPrototype__getDevelopment(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(DebugHTTPSServerPrototype__developmentGetterWrap); - -extern "C" EncodedJSValue DebugHTTPSServerPrototype__doFetch(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(DebugHTTPSServerPrototype__fetchCallback); - -extern "C" JSC::EncodedJSValue DebugHTTPSServerPrototype__getHostname(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(DebugHTTPSServerPrototype__hostnameGetterWrap); - -extern "C" JSC::EncodedJSValue DebugHTTPSServerPrototype__getId(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(DebugHTTPSServerPrototype__idGetterWrap); - -extern "C" JSC::EncodedJSValue DebugHTTPSServerPrototype__getPendingRequests(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(DebugHTTPSServerPrototype__pendingRequestsGetterWrap); - -extern "C" JSC::EncodedJSValue DebugHTTPSServerPrototype__getPendingWebSockets(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(DebugHTTPSServerPrototype__pendingWebSocketsGetterWrap); - -extern "C" JSC::EncodedJSValue DebugHTTPSServerPrototype__getPort(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(DebugHTTPSServerPrototype__portGetterWrap); - -extern "C" JSC::EncodedJSValue DebugHTTPSServerPrototype__getProtocol(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(DebugHTTPSServerPrototype__protocolGetterWrap); - -extern "C" EncodedJSValue DebugHTTPSServerPrototype__doPublish(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(DebugHTTPSServerPrototype__publishCallback); - -extern "C" EncodedJSValue DebugHTTPSServerPrototype__doReload(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(DebugHTTPSServerPrototype__reloadCallback); - -extern "C" EncodedJSValue DebugHTTPSServerPrototype__doRequestIP(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(DebugHTTPSServerPrototype__requestIPCallback); - -extern "C" EncodedJSValue DebugHTTPSServerPrototype__doStop(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(DebugHTTPSServerPrototype__stopCallback); - -extern "C" EncodedJSValue DebugHTTPSServerPrototype__doUpgrade(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(DebugHTTPSServerPrototype__upgradeCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSDebugHTTPSServerPrototype, JSDebugHTTPSServerPrototype::Base); - -static const HashTableValue JSDebugHTTPSServerPrototypeTableValues[] = { - { "address"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DebugHTTPSServerPrototype__addressGetterWrap, 0 } }, - { "development"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DebugHTTPSServerPrototype__developmentGetterWrap, 0 } }, - { "fetch"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DebugHTTPSServerPrototype__fetchCallback, 1 } }, - { "hostname"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DebugHTTPSServerPrototype__hostnameGetterWrap, 0 } }, - { "id"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DebugHTTPSServerPrototype__idGetterWrap, 0 } }, - { "pendingRequests"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DebugHTTPSServerPrototype__pendingRequestsGetterWrap, 0 } }, - { "pendingWebSockets"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DebugHTTPSServerPrototype__pendingWebSocketsGetterWrap, 0 } }, - { "port"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DebugHTTPSServerPrototype__portGetterWrap, 0 } }, - { "protocol"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DebugHTTPSServerPrototype__protocolGetterWrap, 0 } }, - { "publish"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DebugHTTPSServerPrototype__publishCallback, 3 } }, - { "reload"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DebugHTTPSServerPrototype__reloadCallback, 2 } }, - { "requestIP"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DebugHTTPSServerPrototype__requestIPCallback, 1 } }, - { "stop"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DebugHTTPSServerPrototype__stopCallback, 1 } }, - { "upgrade"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DebugHTTPSServerPrototype__upgradeCallback, 1 } } -}; - -const ClassInfo JSDebugHTTPSServerPrototype::s_info = { "DebugHTTPSServer"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDebugHTTPSServerPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsDebugHTTPSServerConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for DebugHTTPSServer"_s); - return JSValue::encode(globalObject->JSDebugHTTPSServerConstructor()); -} - -JSC_DEFINE_CUSTOM_GETTER(DebugHTTPSServerPrototype__addressGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSDebugHTTPSServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_address.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - DebugHTTPSServerPrototype__getAddress(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_address.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void DebugHTTPSServerPrototype__addressSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_address.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue DebugHTTPSServerPrototype__addressGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_address.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(DebugHTTPSServerPrototype__developmentGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSDebugHTTPSServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = DebugHTTPSServerPrototype__getDevelopment(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(DebugHTTPSServerPrototype__fetchCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSDebugHTTPSServer* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof DebugHTTPSServer"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return DebugHTTPSServerPrototype__doFetch(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(DebugHTTPSServerPrototype__hostnameGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSDebugHTTPSServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_hostname.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - DebugHTTPSServerPrototype__getHostname(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_hostname.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void DebugHTTPSServerPrototype__hostnameSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_hostname.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue DebugHTTPSServerPrototype__hostnameGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_hostname.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(DebugHTTPSServerPrototype__idGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSDebugHTTPSServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_id.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - DebugHTTPSServerPrototype__getId(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_id.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void DebugHTTPSServerPrototype__idSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_id.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue DebugHTTPSServerPrototype__idGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_id.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(DebugHTTPSServerPrototype__pendingRequestsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSDebugHTTPSServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = DebugHTTPSServerPrototype__getPendingRequests(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(DebugHTTPSServerPrototype__pendingWebSocketsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSDebugHTTPSServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = DebugHTTPSServerPrototype__getPendingWebSockets(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(DebugHTTPSServerPrototype__portGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSDebugHTTPSServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = DebugHTTPSServerPrototype__getPort(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(DebugHTTPSServerPrototype__protocolGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSDebugHTTPSServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = DebugHTTPSServerPrototype__getProtocol(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(DebugHTTPSServerPrototype__publishCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSDebugHTTPSServer* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof DebugHTTPSServer"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return DebugHTTPSServerPrototype__doPublish(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(DebugHTTPSServerPrototype__reloadCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSDebugHTTPSServer* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof DebugHTTPSServer"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return DebugHTTPSServerPrototype__doReload(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(DebugHTTPSServerPrototype__requestIPCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSDebugHTTPSServer* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof DebugHTTPSServer"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return DebugHTTPSServerPrototype__doRequestIP(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(DebugHTTPSServerPrototype__stopCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSDebugHTTPSServer* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof DebugHTTPSServer"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return DebugHTTPSServerPrototype__doStop(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(DebugHTTPSServerPrototype__upgradeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSDebugHTTPSServer* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof DebugHTTPSServer"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return DebugHTTPSServerPrototype__doUpgrade(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSDebugHTTPSServerPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSDebugHTTPSServer::info(), JSDebugHTTPSServerPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -JSDebugHTTPSServer::~JSDebugHTTPSServer() -{ - if (m_ctx) { - DebugHTTPSServerClass__finalize(m_ctx); - } -} -void JSDebugHTTPSServer::destroy(JSCell* cell) -{ - static_cast(cell)->JSDebugHTTPSServer::~JSDebugHTTPSServer(); -} - -const ClassInfo JSDebugHTTPSServer::s_info = { "DebugHTTPSServer"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDebugHTTPSServer) }; - -void JSDebugHTTPSServer::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSDebugHTTPSServer* JSDebugHTTPSServer::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSDebugHTTPSServer* ptr = new (NotNull, JSC::allocateCell(vm)) JSDebugHTTPSServer(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* DebugHTTPSServer__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSDebugHTTPSServer* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool DebugHTTPSServer__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSDebugHTTPSServer* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t DebugHTTPSServer__ptrOffset = JSDebugHTTPSServer::offsetOfWrapped(); - -void JSDebugHTTPSServer::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSDebugHTTPSServer::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSDebugHTTPSServerPrototype::create(vm, globalObject, JSDebugHTTPSServerPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue DebugHTTPSServer__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSDebugHTTPSServerStructure(); - JSDebugHTTPSServer* instance = JSDebugHTTPSServer::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSDebugHTTPSServer::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSDebugHTTPSServer* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSDebugHTTPSServer); - -template -void JSDebugHTTPSServer::visitAdditionalChildren(Visitor& visitor) -{ - JSDebugHTTPSServer* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_address); - visitor.append(thisObject->m_hostname); - visitor.append(thisObject->m_id); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSDebugHTTPSServer); - -template -void JSDebugHTTPSServer::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSDebugHTTPSServer* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSDebugHTTPSServer); -class JSDebugHTTPServerPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSDebugHTTPServerPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSDebugHTTPServerPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSDebugHTTPServerPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSDebugHTTPServerPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSDebugHTTPServerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -extern "C" void* DebugHTTPServerClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsDebugHTTPServerConstructor); - -extern "C" void DebugHTTPServerClass__finalize(void*); - -extern "C" JSC::EncodedJSValue DebugHTTPServerPrototype__getAddress(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(DebugHTTPServerPrototype__addressGetterWrap); - -extern "C" JSC::EncodedJSValue DebugHTTPServerPrototype__getDevelopment(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(DebugHTTPServerPrototype__developmentGetterWrap); - -extern "C" EncodedJSValue DebugHTTPServerPrototype__doFetch(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(DebugHTTPServerPrototype__fetchCallback); - -extern "C" JSC::EncodedJSValue DebugHTTPServerPrototype__getHostname(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(DebugHTTPServerPrototype__hostnameGetterWrap); - -extern "C" JSC::EncodedJSValue DebugHTTPServerPrototype__getId(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(DebugHTTPServerPrototype__idGetterWrap); - -extern "C" JSC::EncodedJSValue DebugHTTPServerPrototype__getPendingRequests(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(DebugHTTPServerPrototype__pendingRequestsGetterWrap); - -extern "C" JSC::EncodedJSValue DebugHTTPServerPrototype__getPendingWebSockets(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(DebugHTTPServerPrototype__pendingWebSocketsGetterWrap); - -extern "C" JSC::EncodedJSValue DebugHTTPServerPrototype__getPort(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(DebugHTTPServerPrototype__portGetterWrap); - -extern "C" JSC::EncodedJSValue DebugHTTPServerPrototype__getProtocol(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(DebugHTTPServerPrototype__protocolGetterWrap); - -extern "C" EncodedJSValue DebugHTTPServerPrototype__doPublish(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(DebugHTTPServerPrototype__publishCallback); - -extern "C" EncodedJSValue DebugHTTPServerPrototype__doReload(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(DebugHTTPServerPrototype__reloadCallback); - -extern "C" EncodedJSValue DebugHTTPServerPrototype__doRequestIP(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(DebugHTTPServerPrototype__requestIPCallback); - -extern "C" EncodedJSValue DebugHTTPServerPrototype__doStop(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(DebugHTTPServerPrototype__stopCallback); - -extern "C" EncodedJSValue DebugHTTPServerPrototype__doUpgrade(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(DebugHTTPServerPrototype__upgradeCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSDebugHTTPServerPrototype, JSDebugHTTPServerPrototype::Base); - -static const HashTableValue JSDebugHTTPServerPrototypeTableValues[] = { - { "address"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DebugHTTPServerPrototype__addressGetterWrap, 0 } }, - { "development"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DebugHTTPServerPrototype__developmentGetterWrap, 0 } }, - { "fetch"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DebugHTTPServerPrototype__fetchCallback, 1 } }, - { "hostname"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DebugHTTPServerPrototype__hostnameGetterWrap, 0 } }, - { "id"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DebugHTTPServerPrototype__idGetterWrap, 0 } }, - { "pendingRequests"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DebugHTTPServerPrototype__pendingRequestsGetterWrap, 0 } }, - { "pendingWebSockets"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DebugHTTPServerPrototype__pendingWebSocketsGetterWrap, 0 } }, - { "port"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DebugHTTPServerPrototype__portGetterWrap, 0 } }, - { "protocol"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DebugHTTPServerPrototype__protocolGetterWrap, 0 } }, - { "publish"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DebugHTTPServerPrototype__publishCallback, 3 } }, - { "reload"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DebugHTTPServerPrototype__reloadCallback, 2 } }, - { "requestIP"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DebugHTTPServerPrototype__requestIPCallback, 1 } }, - { "stop"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DebugHTTPServerPrototype__stopCallback, 1 } }, - { "upgrade"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DebugHTTPServerPrototype__upgradeCallback, 1 } } -}; - -const ClassInfo JSDebugHTTPServerPrototype::s_info = { "DebugHTTPServer"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDebugHTTPServerPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsDebugHTTPServerConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for DebugHTTPServer"_s); - return JSValue::encode(globalObject->JSDebugHTTPServerConstructor()); -} - -JSC_DEFINE_CUSTOM_GETTER(DebugHTTPServerPrototype__addressGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSDebugHTTPServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_address.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - DebugHTTPServerPrototype__getAddress(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_address.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void DebugHTTPServerPrototype__addressSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_address.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue DebugHTTPServerPrototype__addressGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_address.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(DebugHTTPServerPrototype__developmentGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSDebugHTTPServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = DebugHTTPServerPrototype__getDevelopment(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(DebugHTTPServerPrototype__fetchCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSDebugHTTPServer* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof DebugHTTPServer"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return DebugHTTPServerPrototype__doFetch(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(DebugHTTPServerPrototype__hostnameGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSDebugHTTPServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_hostname.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - DebugHTTPServerPrototype__getHostname(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_hostname.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void DebugHTTPServerPrototype__hostnameSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_hostname.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue DebugHTTPServerPrototype__hostnameGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_hostname.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(DebugHTTPServerPrototype__idGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSDebugHTTPServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_id.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - DebugHTTPServerPrototype__getId(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_id.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void DebugHTTPServerPrototype__idSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_id.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue DebugHTTPServerPrototype__idGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_id.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(DebugHTTPServerPrototype__pendingRequestsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSDebugHTTPServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = DebugHTTPServerPrototype__getPendingRequests(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(DebugHTTPServerPrototype__pendingWebSocketsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSDebugHTTPServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = DebugHTTPServerPrototype__getPendingWebSockets(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(DebugHTTPServerPrototype__portGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSDebugHTTPServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = DebugHTTPServerPrototype__getPort(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(DebugHTTPServerPrototype__protocolGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSDebugHTTPServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = DebugHTTPServerPrototype__getProtocol(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(DebugHTTPServerPrototype__publishCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSDebugHTTPServer* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof DebugHTTPServer"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return DebugHTTPServerPrototype__doPublish(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(DebugHTTPServerPrototype__reloadCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSDebugHTTPServer* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof DebugHTTPServer"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return DebugHTTPServerPrototype__doReload(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(DebugHTTPServerPrototype__requestIPCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSDebugHTTPServer* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof DebugHTTPServer"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return DebugHTTPServerPrototype__doRequestIP(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(DebugHTTPServerPrototype__stopCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSDebugHTTPServer* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof DebugHTTPServer"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return DebugHTTPServerPrototype__doStop(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(DebugHTTPServerPrototype__upgradeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSDebugHTTPServer* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof DebugHTTPServer"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return DebugHTTPServerPrototype__doUpgrade(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSDebugHTTPServerPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSDebugHTTPServer::info(), JSDebugHTTPServerPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -JSDebugHTTPServer::~JSDebugHTTPServer() -{ - if (m_ctx) { - DebugHTTPServerClass__finalize(m_ctx); - } -} -void JSDebugHTTPServer::destroy(JSCell* cell) -{ - static_cast(cell)->JSDebugHTTPServer::~JSDebugHTTPServer(); -} - -const ClassInfo JSDebugHTTPServer::s_info = { "DebugHTTPServer"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDebugHTTPServer) }; - -void JSDebugHTTPServer::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSDebugHTTPServer* JSDebugHTTPServer::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSDebugHTTPServer* ptr = new (NotNull, JSC::allocateCell(vm)) JSDebugHTTPServer(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* DebugHTTPServer__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSDebugHTTPServer* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool DebugHTTPServer__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSDebugHTTPServer* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t DebugHTTPServer__ptrOffset = JSDebugHTTPServer::offsetOfWrapped(); - -void JSDebugHTTPServer::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSDebugHTTPServer::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSDebugHTTPServerPrototype::create(vm, globalObject, JSDebugHTTPServerPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue DebugHTTPServer__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSDebugHTTPServerStructure(); - JSDebugHTTPServer* instance = JSDebugHTTPServer::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSDebugHTTPServer::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSDebugHTTPServer* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSDebugHTTPServer); - -template -void JSDebugHTTPServer::visitAdditionalChildren(Visitor& visitor) -{ - JSDebugHTTPServer* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_address); - visitor.append(thisObject->m_hostname); - visitor.append(thisObject->m_id); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSDebugHTTPServer); - -template -void JSDebugHTTPServer::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSDebugHTTPServer* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSDebugHTTPServer); -class JSDirentPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSDirentPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSDirentPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSDirentPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSDirentPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSDirentPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -class JSDirentConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSDirentConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSDirentPrototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForDirentConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForDirentConstructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForDirentConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForDirentConstructor = std::forward(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSDirentPrototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSDirentConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSDirentPrototype* prototype); -}; - -extern "C" void* DirentClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsDirentConstructor); - -extern "C" void DirentClass__finalize(void*); - -extern "C" EncodedJSValue DirentPrototype__isBlockDevice(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(DirentPrototype__isBlockDeviceCallback); - -extern "C" EncodedJSValue DirentPrototype__isCharacterDevice(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(DirentPrototype__isCharacterDeviceCallback); - -extern "C" EncodedJSValue DirentPrototype__isDirectory(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(DirentPrototype__isDirectoryCallback); - -extern "C" EncodedJSValue DirentPrototype__isFIFO(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(DirentPrototype__isFIFOCallback); - -extern "C" EncodedJSValue DirentPrototype__isFile(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(DirentPrototype__isFileCallback); - -extern "C" EncodedJSValue DirentPrototype__isSocket(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(DirentPrototype__isSocketCallback); - -extern "C" EncodedJSValue DirentPrototype__isSymbolicLink(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(DirentPrototype__isSymbolicLinkCallback); - -extern "C" JSC::EncodedJSValue DirentPrototype__getName(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(DirentPrototype__nameGetterWrap); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSDirentPrototype, JSDirentPrototype::Base); - -static const HashTableValue JSDirentPrototypeTableValues[] = { - { "isBlockDevice"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isBlockDeviceCallback, 0 } }, - { "isCharacterDevice"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isCharacterDeviceCallback, 0 } }, - { "isDirectory"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isDirectoryCallback, 0 } }, - { "isFIFO"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isFIFOCallback, 0 } }, - { "isFile"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isFileCallback, 0 } }, - { "isSocket"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isSocketCallback, 0 } }, - { "isSymbolicLink"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isSymbolicLinkCallback, 0 } }, - { "name"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DirentPrototype__nameGetterWrap, 0 } } -}; - -const ClassInfo JSDirentPrototype::s_info = { "Dirent"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDirentPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsDirentConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for Dirent"_s); - return JSValue::encode(globalObject->JSDirentConstructor()); -} - -JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isBlockDeviceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSDirent* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Dirent"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return DirentPrototype__isBlockDevice(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isCharacterDeviceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSDirent* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Dirent"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return DirentPrototype__isCharacterDevice(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isDirectoryCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSDirent* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Dirent"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return DirentPrototype__isDirectory(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isFIFOCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSDirent* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Dirent"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return DirentPrototype__isFIFO(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSDirent* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Dirent"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return DirentPrototype__isFile(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isSocketCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSDirent* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Dirent"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return DirentPrototype__isSocket(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isSymbolicLinkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSDirent* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Dirent"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return DirentPrototype__isSymbolicLink(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(DirentPrototype__nameGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSDirent* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_name.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - DirentPrototype__getName(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_name.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void DirentPrototype__nameSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_name.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue DirentPrototype__nameGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_name.get()); -} - -void JSDirentPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSDirent::info(), JSDirentPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -void JSDirentConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSDirentPrototype* prototype) -{ - Base::finishCreation(vm, 0, "Dirent"_s, PropertyAdditionMode::WithoutStructureTransition); - - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} - -JSDirentConstructor::JSDirentConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} - -JSDirentConstructor* JSDirentConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSDirentPrototype* prototype) -{ - JSDirentConstructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSDirentConstructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSDirentConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) -{ - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); - JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSDirentConstructor(); - Structure* structure = globalObject->JSDirentStructure(); - if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); - - auto* functionGlobalObject = reinterpret_cast( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSDirentStructure()); - } - - void* ptr = DirentClass__construct(globalObject, callFrame); - - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); - } - - JSDirent* instance = JSDirent::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -void JSDirentConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSDirentPrototype* prototype) -{ -} - -const ClassInfo JSDirentConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDirentConstructor) }; - -extern "C" EncodedJSValue Dirent__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSDirentConstructor()); -} - -JSDirent::~JSDirent() -{ - if (m_ctx) { - DirentClass__finalize(m_ctx); - } -} -void JSDirent::destroy(JSCell* cell) -{ - static_cast(cell)->JSDirent::~JSDirent(); -} - -const ClassInfo JSDirent::s_info = { "Dirent"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDirent) }; - -void JSDirent::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSDirent* JSDirent::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSDirent* ptr = new (NotNull, JSC::allocateCell(vm)) JSDirent(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* Dirent__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSDirent* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool Dirent__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSDirent* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t Dirent__ptrOffset = JSDirent::offsetOfWrapped(); - -void JSDirent::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSDirent::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) -{ - return WebCore::JSDirentConstructor::create(vm, globalObject, WebCore::JSDirentConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast(prototype)); -} - -JSObject* JSDirent::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSDirentPrototype::create(vm, globalObject, JSDirentPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue Dirent__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSDirentStructure(); - JSDirent* instance = JSDirent::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSDirent::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSDirent* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSDirent); - -template -void JSDirent::visitAdditionalChildren(Visitor& visitor) -{ - JSDirent* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_name); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSDirent); - -template -void JSDirent::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSDirent* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSDirent); -class JSDocEndPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSDocEndPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSDocEndPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSDocEndPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSDocEndPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSDocEndPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -extern "C" void* DocEndClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsDocEndConstructor); - -extern "C" void DocEndClass__finalize(void*); - -extern "C" EncodedJSValue DocEndPrototype__append(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(DocEndPrototype__appendCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSDocEndPrototype, JSDocEndPrototype::Base); - -static const HashTableValue JSDocEndPrototypeTableValues[] = { - { "append"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DocEndPrototype__appendCallback, 1 } } -}; - -const ClassInfo JSDocEndPrototype::s_info = { "DocEnd"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDocEndPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsDocEndConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for DocEnd"_s); - return JSValue::encode(globalObject->JSDocEndConstructor()); -} - -JSC_DEFINE_HOST_FUNCTION(DocEndPrototype__appendCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSDocEnd* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof DocEnd"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return DocEndPrototype__append(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSDocEndPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSDocEnd::info(), JSDocEndPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -JSDocEnd::~JSDocEnd() -{ - if (m_ctx) { - DocEndClass__finalize(m_ctx); - } -} -void JSDocEnd::destroy(JSCell* cell) -{ - static_cast(cell)->JSDocEnd::~JSDocEnd(); -} - -const ClassInfo JSDocEnd::s_info = { "DocEnd"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDocEnd) }; - -void JSDocEnd::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSDocEnd* JSDocEnd::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSDocEnd* ptr = new (NotNull, JSC::allocateCell(vm)) JSDocEnd(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* DocEnd__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSDocEnd* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool DocEnd__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSDocEnd* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t DocEnd__ptrOffset = JSDocEnd::offsetOfWrapped(); - -void JSDocEnd::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSDocEnd::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSDocEndPrototype::create(vm, globalObject, JSDocEndPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue DocEnd__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSDocEndStructure(); - JSDocEnd* instance = JSDocEnd::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -class JSDocTypePrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSDocTypePrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSDocTypePrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSDocTypePrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSDocTypePrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSDocTypePrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -extern "C" void* DocTypeClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsDocTypeConstructor); - -extern "C" void DocTypeClass__finalize(void*); - -extern "C" JSC::EncodedJSValue DocTypePrototype__name(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(DocTypePrototype__nameGetterWrap); - -extern "C" JSC::EncodedJSValue DocTypePrototype__publicId(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(DocTypePrototype__publicIdGetterWrap); - -extern "C" JSC::EncodedJSValue DocTypePrototype__systemId(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(DocTypePrototype__systemIdGetterWrap); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSDocTypePrototype, JSDocTypePrototype::Base); - -static const HashTableValue JSDocTypePrototypeTableValues[] = { - { "name"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DocTypePrototype__nameGetterWrap, 0 } }, - { "publicId"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DocTypePrototype__publicIdGetterWrap, 0 } }, - { "systemId"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DocTypePrototype__systemIdGetterWrap, 0 } } -}; - -const ClassInfo JSDocTypePrototype::s_info = { "DocType"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDocTypePrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsDocTypeConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for DocType"_s); - return JSValue::encode(globalObject->JSDocTypeConstructor()); -} - -JSC_DEFINE_CUSTOM_GETTER(DocTypePrototype__nameGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSDocType* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_name.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - DocTypePrototype__name(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_name.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void DocTypePrototype__nameSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_name.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue DocTypePrototype__nameGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_name.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(DocTypePrototype__publicIdGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSDocType* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_publicId.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - DocTypePrototype__publicId(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_publicId.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void DocTypePrototype__publicIdSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_publicId.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue DocTypePrototype__publicIdGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_publicId.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(DocTypePrototype__systemIdGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSDocType* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_systemId.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - DocTypePrototype__systemId(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_systemId.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void DocTypePrototype__systemIdSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_systemId.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue DocTypePrototype__systemIdGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_systemId.get()); -} - -void JSDocTypePrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSDocType::info(), JSDocTypePrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -JSDocType::~JSDocType() -{ - if (m_ctx) { - DocTypeClass__finalize(m_ctx); - } -} -void JSDocType::destroy(JSCell* cell) -{ - static_cast(cell)->JSDocType::~JSDocType(); -} - -const ClassInfo JSDocType::s_info = { "DocType"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDocType) }; - -void JSDocType::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSDocType* JSDocType::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSDocType* ptr = new (NotNull, JSC::allocateCell(vm)) JSDocType(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* DocType__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSDocType* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool DocType__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSDocType* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t DocType__ptrOffset = JSDocType::offsetOfWrapped(); - -void JSDocType::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSDocType::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSDocTypePrototype::create(vm, globalObject, JSDocTypePrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue DocType__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSDocTypeStructure(); - JSDocType* instance = JSDocType::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSDocType::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSDocType* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSDocType); - -template -void JSDocType::visitAdditionalChildren(Visitor& visitor) -{ - JSDocType* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_name); - visitor.append(thisObject->m_publicId); - visitor.append(thisObject->m_systemId); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSDocType); - -template -void JSDocType::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSDocType* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSDocType); -class JSElementPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSElementPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSElementPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSElementPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSElementPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSElementPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -extern "C" void* ElementClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsElementConstructor); - -extern "C" void ElementClass__finalize(void*); - -extern "C" EncodedJSValue ElementPrototype__after(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ElementPrototype__afterCallback); - -extern "C" EncodedJSValue ElementPrototype__append(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ElementPrototype__appendCallback); - -extern "C" JSC::EncodedJSValue ElementPrototype__getAttributes(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ElementPrototype__attributesGetterWrap); - -extern "C" EncodedJSValue ElementPrototype__before(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ElementPrototype__beforeCallback); - -extern "C" JSC::EncodedJSValue ElementPrototype__getCanHaveContent(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ElementPrototype__canHaveContentGetterWrap); - -extern "C" EncodedJSValue ElementPrototype__getAttribute(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ElementPrototype__getAttributeCallback); - -extern "C" EncodedJSValue ElementPrototype__hasAttribute(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ElementPrototype__hasAttributeCallback); - -extern "C" JSC::EncodedJSValue ElementPrototype__getNamespaceURI(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ElementPrototype__namespaceURIGetterWrap); - -extern "C" EncodedJSValue ElementPrototype__onEndTag(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ElementPrototype__onEndTagCallback); - -extern "C" EncodedJSValue ElementPrototype__prepend(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ElementPrototype__prependCallback); - -extern "C" EncodedJSValue ElementPrototype__remove(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ElementPrototype__removeCallback); - -extern "C" EncodedJSValue ElementPrototype__removeAndKeepContent(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ElementPrototype__removeAndKeepContentCallback); - -extern "C" EncodedJSValue ElementPrototype__removeAttribute(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ElementPrototype__removeAttributeCallback); - -extern "C" JSC::EncodedJSValue ElementPrototype__getRemoved(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ElementPrototype__removedGetterWrap); - -extern "C" EncodedJSValue ElementPrototype__replace(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ElementPrototype__replaceCallback); - -extern "C" JSC::EncodedJSValue ElementPrototype__getSelfClosing(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ElementPrototype__selfClosingGetterWrap); - -extern "C" EncodedJSValue ElementPrototype__setAttribute(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ElementPrototype__setAttributeCallback); - -extern "C" EncodedJSValue ElementPrototype__setInnerContent(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ElementPrototype__setInnerContentCallback); - -extern "C" JSC::EncodedJSValue ElementPrototype__getTagName(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ElementPrototype__tagNameGetterWrap); - -extern "C" bool ElementPrototype__setTagName(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::EncodedJSValue value); -JSC_DECLARE_CUSTOM_SETTER(ElementPrototype__tagNameSetterWrap); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSElementPrototype, JSElementPrototype::Base); - -static const HashTableValue JSElementPrototypeTableValues[] = { - { "after"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ElementPrototype__afterCallback, 1 } }, - { "append"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ElementPrototype__appendCallback, 1 } }, - { "attributes"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ElementPrototype__attributesGetterWrap, 0 } }, - { "before"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ElementPrototype__beforeCallback, 1 } }, - { "canHaveContent"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ElementPrototype__canHaveContentGetterWrap, 0 } }, - { "getAttribute"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ElementPrototype__getAttributeCallback, 1 } }, - { "hasAttribute"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ElementPrototype__hasAttributeCallback, 1 } }, - { "namespaceURI"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ElementPrototype__namespaceURIGetterWrap, 0 } }, - { "onEndTag"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ElementPrototype__onEndTagCallback, 1 } }, - { "prepend"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ElementPrototype__prependCallback, 1 } }, - { "remove"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ElementPrototype__removeCallback, 0 } }, - { "removeAndKeepContent"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ElementPrototype__removeAndKeepContentCallback, 0 } }, - { "removeAttribute"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ElementPrototype__removeAttributeCallback, 1 } }, - { "removed"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ElementPrototype__removedGetterWrap, 0 } }, - { "replace"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ElementPrototype__replaceCallback, 1 } }, - { "selfClosing"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ElementPrototype__selfClosingGetterWrap, 0 } }, - { "setAttribute"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ElementPrototype__setAttributeCallback, 2 } }, - { "setInnerContent"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ElementPrototype__setInnerContentCallback, 1 } }, - { "tagName"_s, static_cast(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ElementPrototype__tagNameGetterWrap, ElementPrototype__tagNameSetterWrap } } -}; - -const ClassInfo JSElementPrototype::s_info = { "Element"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSElementPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsElementConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for Element"_s); - return JSValue::encode(globalObject->JSElementConstructor()); -} - -JSC_DEFINE_HOST_FUNCTION(ElementPrototype__afterCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSElement* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Element"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ElementPrototype__after(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ElementPrototype__appendCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSElement* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Element"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ElementPrototype__append(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(ElementPrototype__attributesGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSElement* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = ElementPrototype__getAttributes(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(ElementPrototype__beforeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSElement* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Element"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ElementPrototype__before(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(ElementPrototype__canHaveContentGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSElement* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = ElementPrototype__getCanHaveContent(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(ElementPrototype__getAttributeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSElement* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Element"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ElementPrototype__getAttribute(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ElementPrototype__hasAttributeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSElement* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Element"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ElementPrototype__hasAttribute(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(ElementPrototype__namespaceURIGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSElement* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_namespaceURI.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - ElementPrototype__getNamespaceURI(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_namespaceURI.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void ElementPrototype__namespaceURISetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_namespaceURI.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue ElementPrototype__namespaceURIGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_namespaceURI.get()); -} - -JSC_DEFINE_HOST_FUNCTION(ElementPrototype__onEndTagCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSElement* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Element"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ElementPrototype__onEndTag(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ElementPrototype__prependCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSElement* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Element"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ElementPrototype__prepend(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ElementPrototype__removeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSElement* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Element"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ElementPrototype__remove(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ElementPrototype__removeAndKeepContentCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSElement* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Element"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ElementPrototype__removeAndKeepContent(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ElementPrototype__removeAttributeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSElement* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Element"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ElementPrototype__removeAttribute(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(ElementPrototype__removedGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSElement* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = ElementPrototype__getRemoved(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(ElementPrototype__replaceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSElement* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Element"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ElementPrototype__replace(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(ElementPrototype__selfClosingGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSElement* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = ElementPrototype__getSelfClosing(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(ElementPrototype__setAttributeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSElement* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Element"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ElementPrototype__setAttribute(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ElementPrototype__setInnerContentCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSElement* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Element"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ElementPrototype__setInnerContent(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(ElementPrototype__tagNameGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSElement* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = ElementPrototype__getTagName(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_SETTER(ElementPrototype__tagNameSetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSElement* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - auto result = ElementPrototype__setTagName(thisObject->wrapped(), lexicalGlobalObject, encodedValue); - - RELEASE_AND_RETURN(throwScope, result); -} - -void JSElementPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSElement::info(), JSElementPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -JSElement::~JSElement() -{ - if (m_ctx) { - ElementClass__finalize(m_ctx); - } -} -void JSElement::destroy(JSCell* cell) -{ - static_cast(cell)->JSElement::~JSElement(); -} - -const ClassInfo JSElement::s_info = { "Element"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSElement) }; - -void JSElement::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSElement* JSElement::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSElement* ptr = new (NotNull, JSC::allocateCell(vm)) JSElement(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* Element__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSElement* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool Element__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSElement* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t Element__ptrOffset = JSElement::offsetOfWrapped(); - -void JSElement::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSElement::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSElementPrototype::create(vm, globalObject, JSElementPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue Element__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSElementStructure(); - JSElement* instance = JSElement::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSElement::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSElement* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSElement); - -template -void JSElement::visitAdditionalChildren(Visitor& visitor) -{ - JSElement* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_namespaceURI); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSElement); - -template -void JSElement::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSElement* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSElement); -class JSEndTagPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSEndTagPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSEndTagPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSEndTagPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSEndTagPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSEndTagPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -extern "C" void* EndTagClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsEndTagConstructor); - -extern "C" void EndTagClass__finalize(void*); - -extern "C" EncodedJSValue EndTagPrototype__after(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(EndTagPrototype__afterCallback); - -extern "C" EncodedJSValue EndTagPrototype__before(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(EndTagPrototype__beforeCallback); - -extern "C" JSC::EncodedJSValue EndTagPrototype__getName(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(EndTagPrototype__nameGetterWrap); - -extern "C" bool EndTagPrototype__setName(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::EncodedJSValue value); -JSC_DECLARE_CUSTOM_SETTER(EndTagPrototype__nameSetterWrap); - -extern "C" EncodedJSValue EndTagPrototype__remove(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(EndTagPrototype__removeCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSEndTagPrototype, JSEndTagPrototype::Base); - -static const HashTableValue JSEndTagPrototypeTableValues[] = { - { "after"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, EndTagPrototype__afterCallback, 1 } }, - { "before"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, EndTagPrototype__beforeCallback, 1 } }, - { "name"_s, static_cast(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, EndTagPrototype__nameGetterWrap, EndTagPrototype__nameSetterWrap } }, - { "remove"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, EndTagPrototype__removeCallback, 0 } } -}; - -const ClassInfo JSEndTagPrototype::s_info = { "EndTag"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSEndTagPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsEndTagConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for EndTag"_s); - return JSValue::encode(globalObject->JSEndTagConstructor()); -} - -JSC_DEFINE_HOST_FUNCTION(EndTagPrototype__afterCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSEndTag* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof EndTag"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return EndTagPrototype__after(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(EndTagPrototype__beforeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSEndTag* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof EndTag"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return EndTagPrototype__before(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(EndTagPrototype__nameGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSEndTag* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = EndTagPrototype__getName(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_SETTER(EndTagPrototype__nameSetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSEndTag* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - auto result = EndTagPrototype__setName(thisObject->wrapped(), lexicalGlobalObject, encodedValue); - - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(EndTagPrototype__removeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSEndTag* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof EndTag"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return EndTagPrototype__remove(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSEndTagPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSEndTag::info(), JSEndTagPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -JSEndTag::~JSEndTag() -{ - if (m_ctx) { - EndTagClass__finalize(m_ctx); - } -} -void JSEndTag::destroy(JSCell* cell) -{ - static_cast(cell)->JSEndTag::~JSEndTag(); -} - -const ClassInfo JSEndTag::s_info = { "EndTag"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSEndTag) }; - -void JSEndTag::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSEndTag* JSEndTag::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSEndTag* ptr = new (NotNull, JSC::allocateCell(vm)) JSEndTag(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* EndTag__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSEndTag* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool EndTag__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSEndTag* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t EndTag__ptrOffset = JSEndTag::offsetOfWrapped(); - -void JSEndTag::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSEndTag::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSEndTagPrototype::create(vm, globalObject, JSEndTagPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue EndTag__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSEndTagStructure(); - JSEndTag* instance = JSEndTag::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -class JSExpectPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSExpectPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSExpectPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSExpectPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSExpectPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSExpectPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -class JSExpectConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSExpectConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSExpectPrototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForExpectConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForExpectConstructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForExpectConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForExpectConstructor = std::forward(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSExpectPrototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSExpectConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSExpectPrototype* prototype); -}; - -extern "C" void* ExpectClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsExpectConstructor); - -extern "C" void ExpectClass__finalize(void*); -extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__call); - -extern "C" EncodedJSValue ExpectPrototype__fail(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__failCallback); - -extern "C" JSC::EncodedJSValue ExpectPrototype__getNot(void* ptr, JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ExpectPrototype__notGetterWrap); - -extern "C" EncodedJSValue ExpectPrototype___pass(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__passCallback); - -extern "C" JSC::EncodedJSValue ExpectPrototype__getRejects(void* ptr, JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ExpectPrototype__rejectsGetterWrap); - -extern "C" JSC::EncodedJSValue ExpectPrototype__getResolves(void* ptr, JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ExpectPrototype__resolvesGetterWrap); - -extern "C" EncodedJSValue ExpectPrototype__toBe(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeArray(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeArrayCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeArrayOfSize(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeArrayOfSizeCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeBoolean(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeBooleanCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeCloseTo(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeCloseToCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeDate(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeDateCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeDefined(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeDefinedCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeEmpty(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeEmptyCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeEven(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeEvenCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeFalse(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeFalseCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeFalsy(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeFalsyCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeFinite(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeFiniteCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeFunction(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeFunctionCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeGreaterThan(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeGreaterThanCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeGreaterThanOrEqual(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeGreaterThanOrEqualCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeInstanceOf(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeInstanceOfCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeInteger(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeIntegerCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeLessThan(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeLessThanCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeLessThanOrEqual(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeLessThanOrEqualCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeNaN(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeNaNCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeNegative(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeNegativeCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeNil(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeNilCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeNull(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeNullCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeNumber(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeNumberCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeOdd(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeOddCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBePositive(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBePositiveCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeString(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeStringCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeSymbol(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeSymbolCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeTrue(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeTrueCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeTruthy(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeTruthyCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeTypeOf(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeTypeOfCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeUndefined(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeUndefinedCallback); - -extern "C" EncodedJSValue ExpectPrototype__toBeWithin(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeWithinCallback); - -extern "C" EncodedJSValue ExpectPrototype__toContain(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toContainCallback); - -extern "C" EncodedJSValue ExpectPrototype__toContainEqual(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toContainEqualCallback); - -extern "C" EncodedJSValue ExpectPrototype__toEndWith(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toEndWithCallback); - -extern "C" EncodedJSValue ExpectPrototype__toEqual(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toEqualCallback); - -extern "C" EncodedJSValue ExpectPrototype__toEqualIgnoringWhitespace(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toEqualIgnoringWhitespaceCallback); - -extern "C" EncodedJSValue ExpectPrototype__toHaveBeenCalled(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveBeenCalledCallback); - -extern "C" EncodedJSValue ExpectPrototype__toHaveBeenCalledTimes(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveBeenCalledTimesCallback); - -extern "C" EncodedJSValue ExpectPrototype__toHaveBeenCalledWith(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveBeenCalledWithCallback); - -extern "C" EncodedJSValue ExpectPrototype__toHaveBeenLastCalledWith(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveBeenLastCalledWithCallback); - -extern "C" EncodedJSValue ExpectPrototype__toHaveBeenNthCalledWith(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveBeenNthCalledWithCallback); - -extern "C" EncodedJSValue ExpectPrototype__toHaveLastReturnedWith(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveLastReturnedWithCallback); - -extern "C" EncodedJSValue ExpectPrototype__toHaveLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveLengthCallback); - -extern "C" EncodedJSValue ExpectPrototype__toHaveNthReturnedWith(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveNthReturnedWithCallback); - -extern "C" EncodedJSValue ExpectPrototype__toHaveProperty(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHavePropertyCallback); - -extern "C" EncodedJSValue ExpectPrototype__toHaveReturnedTimes(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveReturnedTimesCallback); - -extern "C" EncodedJSValue ExpectPrototype__toHaveReturnedWith(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveReturnedWithCallback); - -extern "C" EncodedJSValue ExpectPrototype__toInclude(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toIncludeCallback); - -extern "C" EncodedJSValue ExpectPrototype__toIncludeRepeated(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toIncludeRepeatedCallback); - -extern "C" EncodedJSValue ExpectPrototype__toMatch(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toMatchCallback); - -extern "C" EncodedJSValue ExpectPrototype__toMatchInlineSnapshot(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toMatchInlineSnapshotCallback); - -extern "C" EncodedJSValue ExpectPrototype__toMatchObject(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toMatchObjectCallback); - -extern "C" EncodedJSValue ExpectPrototype__toMatchSnapshot(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toMatchSnapshotCallback); - -extern "C" EncodedJSValue ExpectPrototype__toSatisfy(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toSatisfyCallback); - -extern "C" EncodedJSValue ExpectPrototype__toStartWith(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toStartWithCallback); - -extern "C" EncodedJSValue ExpectPrototype__toStrictEqual(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toStrictEqualCallback); - -extern "C" EncodedJSValue ExpectPrototype__toThrow(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toThrowCallback); - -extern "C" EncodedJSValue ExpectPrototype__toThrowErrorMatchingInlineSnapshot(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toThrowErrorMatchingInlineSnapshotCallback); - -extern "C" EncodedJSValue ExpectPrototype__toThrowErrorMatchingSnapshot(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toThrowErrorMatchingSnapshotCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSExpectPrototype, JSExpectPrototype::Base); - -static const HashTableValue JSExpectPrototypeTableValues[] = { - { "fail"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__failCallback, 1 } }, - { "not"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectPrototype__notGetterWrap, 0 } }, - { "pass"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__passCallback, 1 } }, - { "rejects"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectPrototype__rejectsGetterWrap, 0 } }, - { "resolves"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectPrototype__resolvesGetterWrap, 0 } }, - { "toBe"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeCallback, 1 } }, - { "toBeArray"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeArrayCallback, 0 } }, - { "toBeArrayOfSize"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeArrayOfSizeCallback, 1 } }, - { "toBeBoolean"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeBooleanCallback, 0 } }, - { "toBeCloseTo"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeCloseToCallback, 1 } }, - { "toBeDate"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeDateCallback, 0 } }, - { "toBeDefined"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeDefinedCallback, 0 } }, - { "toBeEmpty"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeEmptyCallback, 0 } }, - { "toBeEven"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeEvenCallback, 0 } }, - { "toBeFalse"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeFalseCallback, 0 } }, - { "toBeFalsy"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeFalsyCallback, 0 } }, - { "toBeFinite"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeFiniteCallback, 0 } }, - { "toBeFunction"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeFunctionCallback, 0 } }, - { "toBeGreaterThan"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeGreaterThanCallback, 1 } }, - { "toBeGreaterThanOrEqual"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeGreaterThanOrEqualCallback, 1 } }, - { "toBeInstanceOf"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeInstanceOfCallback, 1 } }, - { "toBeInteger"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeIntegerCallback, 0 } }, - { "toBeLessThan"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeLessThanCallback, 1 } }, - { "toBeLessThanOrEqual"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeLessThanOrEqualCallback, 1 } }, - { "toBeNaN"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeNaNCallback, 0 } }, - { "toBeNegative"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeNegativeCallback, 0 } }, - { "toBeNil"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeNilCallback, 0 } }, - { "toBeNull"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeNullCallback, 0 } }, - { "toBeNumber"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeNumberCallback, 0 } }, - { "toBeOdd"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeOddCallback, 0 } }, - { "toBePositive"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBePositiveCallback, 0 } }, - { "toBeString"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeStringCallback, 0 } }, - { "toBeSymbol"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeSymbolCallback, 0 } }, - { "toBeTrue"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeTrueCallback, 0 } }, - { "toBeTruthy"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeTruthyCallback, 0 } }, - { "toBeTypeOf"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeTypeOfCallback, 1 } }, - { "toBeUndefined"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeUndefinedCallback, 0 } }, - { "toBeWithin"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeWithinCallback, 2 } }, - { "toContain"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toContainCallback, 1 } }, - { "toContainEqual"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toContainEqualCallback, 1 } }, - { "toEndWith"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toEndWithCallback, 1 } }, - { "toEqual"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toEqualCallback, 1 } }, - { "toEqualIgnoringWhitespace"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toEqualIgnoringWhitespaceCallback, 1 } }, - { "toHaveBeenCalled"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveBeenCalledCallback, 0 } }, - { "toHaveBeenCalledTimes"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveBeenCalledTimesCallback, 1 } }, - { "toHaveBeenCalledWith"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveBeenCalledWithCallback, 1 } }, - { "toHaveBeenLastCalledWith"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveBeenLastCalledWithCallback, 1 } }, - { "toHaveBeenNthCalledWith"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveBeenNthCalledWithCallback, 1 } }, - { "toHaveLastReturnedWith"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveLastReturnedWithCallback, 1 } }, - { "toHaveLength"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveLengthCallback, 1 } }, - { "toHaveNthReturnedWith"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveNthReturnedWithCallback, 1 } }, - { "toHaveProperty"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHavePropertyCallback, 2 } }, - { "toHaveReturnedTimes"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveReturnedTimesCallback, 1 } }, - { "toHaveReturnedWith"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveReturnedWithCallback, 1 } }, - { "toInclude"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toIncludeCallback, 1 } }, - { "toIncludeRepeated"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toIncludeRepeatedCallback, 2 } }, - { "toMatch"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toMatchCallback, 1 } }, - { "toMatchInlineSnapshot"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toMatchInlineSnapshotCallback, 1 } }, - { "toMatchObject"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toMatchObjectCallback, 1 } }, - { "toMatchSnapshot"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toMatchSnapshotCallback, 1 } }, - { "toSatisfy"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toSatisfyCallback, 1 } }, - { "toStartWith"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toStartWithCallback, 1 } }, - { "toStrictEqual"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toStrictEqualCallback, 1 } }, - { "toThrow"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toThrowCallback, 1 } }, - { "toThrowErrorMatchingInlineSnapshot"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toThrowErrorMatchingInlineSnapshotCallback, 1 } }, - { "toThrowErrorMatchingSnapshot"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toThrowErrorMatchingSnapshotCallback, 1 } } -}; - -const ClassInfo JSExpectPrototype::s_info = { "Expect"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSExpectPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsExpectConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for Expect"_s); - return JSValue::encode(globalObject->JSExpectConstructor()); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__failCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__fail(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(ExpectPrototype__notGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSExpect* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = ExpectPrototype__getNot(thisObject->wrapped(), thisValue, globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__passCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype___pass(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(ExpectPrototype__rejectsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSExpect* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = ExpectPrototype__getRejects(thisObject->wrapped(), thisValue, globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(ExpectPrototype__resolvesGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSExpect* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = ExpectPrototype__getResolves(thisObject->wrapped(), thisValue, globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBe(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeArrayCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeArray(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeArrayOfSizeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeArrayOfSize(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeBooleanCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeBoolean(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeCloseToCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeCloseTo(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeDateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeDate(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeDefinedCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeDefined(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeEmptyCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeEmpty(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeEvenCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeEven(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeFalseCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeFalse(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeFalsyCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeFalsy(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeFiniteCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeFinite(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeFunctionCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeFunction(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeGreaterThanCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeGreaterThan(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeGreaterThanOrEqualCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeGreaterThanOrEqual(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeInstanceOfCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeInstanceOf(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeIntegerCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeInteger(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeLessThanCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeLessThan(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeLessThanOrEqualCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeLessThanOrEqual(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeNaNCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeNaN(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeNegativeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeNegative(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeNilCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeNil(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeNullCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeNull(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeNumberCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeNumber(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeOddCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeOdd(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBePositiveCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBePositive(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeStringCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeString(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeSymbolCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeSymbol(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeTrueCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeTrue(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeTruthyCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeTruthy(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeTypeOfCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeTypeOf(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeUndefinedCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeUndefined(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeWithinCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toBeWithin(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toContainCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toContain(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toContainEqualCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toContainEqual(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toEndWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toEndWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toEqualCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toEqual(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toEqualIgnoringWhitespaceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toEqualIgnoringWhitespace(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveBeenCalledCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toHaveBeenCalled(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveBeenCalledTimesCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toHaveBeenCalledTimes(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveBeenCalledWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toHaveBeenCalledWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveBeenLastCalledWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toHaveBeenLastCalledWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveBeenNthCalledWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toHaveBeenNthCalledWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveLastReturnedWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toHaveLastReturnedWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveLengthCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toHaveLength(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveNthReturnedWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toHaveNthReturnedWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHavePropertyCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toHaveProperty(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveReturnedTimesCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toHaveReturnedTimes(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveReturnedWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toHaveReturnedWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toIncludeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toInclude(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toIncludeRepeatedCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toIncludeRepeated(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toMatchCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toMatch(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toMatchInlineSnapshotCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toMatchInlineSnapshot(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toMatchObjectCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toMatchObject(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toMatchSnapshotCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toMatchSnapshot(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toSatisfyCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toSatisfy(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toStartWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toStartWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toStrictEqualCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toStrictEqual(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toThrowCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toThrow(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toThrowErrorMatchingInlineSnapshotCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toThrowErrorMatchingInlineSnapshot(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toThrowErrorMatchingSnapshotCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSExpect* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Expect"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ExpectPrototype__toThrowErrorMatchingSnapshot(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -extern "C" void ExpectPrototype__capturedValueSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_capturedValue.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue ExpectPrototype__capturedValueGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_capturedValue.get()); -} - -extern "C" void ExpectPrototype__resultValueSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_resultValue.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue ExpectPrototype__resultValueGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_resultValue.get()); -} - -void JSExpectPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSExpect::info(), JSExpectPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__addSnapshotSerializer); -extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__any); -extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__anything); -extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__arrayContaining); -extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__assertions); -extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__extend); -extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__hasAssertions); -extern "C" JSC_DECLARE_CUSTOM_GETTER(ExpectClass__getStaticNot); -extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__objectContaining); -extern "C" JSC_DECLARE_CUSTOM_GETTER(ExpectClass__getStaticRejects); -extern "C" JSC_DECLARE_CUSTOM_GETTER(ExpectClass__getStaticResolves); -extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__stringContaining); -extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__stringMatching); - -static const HashTableValue JSExpectConstructorTableValues[] = { - { "addSnapshotSerializer"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__addSnapshotSerializer, 1 } }, - { "any"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__any, 1 } }, - { "anything"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__anything, 1 } }, - { "arrayContaining"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__arrayContaining, 1 } }, - { "assertions"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__assertions, 1 } }, - { "extend"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__extend, 1 } }, - { "hasAssertions"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__hasAssertions, 1 } }, - { "not"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectClass__getStaticNot, 0 } }, - { "objectContaining"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__objectContaining, 1 } }, - { "rejects"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectClass__getStaticRejects, 0 } }, - { "resolves"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectClass__getStaticResolves, 0 } }, - { "stringContaining"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__stringContaining, 1 } }, - { "stringMatching"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__stringMatching, 1 } } -}; - -void JSExpectConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSExpectPrototype* prototype) -{ - Base::finishCreation(vm, 0, "Expect"_s, PropertyAdditionMode::WithoutStructureTransition); - reifyStaticProperties(vm, &JSExpectConstructor::s_info, JSExpectConstructorTableValues, *this); - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} - -JSExpectConstructor::JSExpectConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, ExpectClass__call, construct) -{ -} - -JSExpectConstructor* JSExpectConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSExpectPrototype* prototype) -{ - JSExpectConstructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSExpectConstructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSExpectConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) -{ - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); - JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSExpectConstructor(); - Structure* structure = globalObject->JSExpectStructure(); - if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); - - auto* functionGlobalObject = reinterpret_cast( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSExpectStructure()); - } - - void* ptr = ExpectClass__construct(globalObject, callFrame); - - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); - } - - JSExpect* instance = JSExpect::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -void JSExpectConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSExpectPrototype* prototype) -{ -} - -const ClassInfo JSExpectConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSExpectConstructor) }; - -extern "C" EncodedJSValue Expect__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSExpectConstructor()); -} - -JSExpect::~JSExpect() -{ - if (m_ctx) { - ExpectClass__finalize(m_ctx); - } -} -void JSExpect::destroy(JSCell* cell) -{ - static_cast(cell)->JSExpect::~JSExpect(); -} - -const ClassInfo JSExpect::s_info = { "Expect"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSExpect) }; - -void JSExpect::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSExpect* JSExpect::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSExpect* ptr = new (NotNull, JSC::allocateCell(vm)) JSExpect(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* Expect__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSExpect* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool Expect__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSExpect* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t Expect__ptrOffset = JSExpect::offsetOfWrapped(); - -void JSExpect::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSExpect::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) -{ - return WebCore::JSExpectConstructor::create(vm, globalObject, WebCore::JSExpectConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast(prototype)); -} - -JSObject* JSExpect::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSExpectPrototype::create(vm, globalObject, JSExpectPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue Expect__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSExpectStructure(); - JSExpect* instance = JSExpect::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSExpect::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSExpect* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSExpect); - -template -void JSExpect::visitAdditionalChildren(Visitor& visitor) -{ - JSExpect* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - visitor.append(thisObject->m_capturedValue); - visitor.append(thisObject->m_resultValue); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSExpect); - -template -void JSExpect::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSExpect* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSExpect); -class JSExpectAnyPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSExpectAnyPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSExpectAnyPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSExpectAnyPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSExpectAnyPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSExpectAnyPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -extern "C" void ExpectAnyClass__finalize(void*); -extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectAnyClass__call); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSExpectAnyPrototype, JSExpectAnyPrototype::Base); - -static const HashTableValue JSExpectAnyPrototypeTableValues[] = {}; - -const ClassInfo JSExpectAnyPrototype::s_info = { "ExpectAny"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSExpectAnyPrototype) }; - -extern "C" void ExpectAnyPrototype__constructorValueSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_constructorValue.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue ExpectAnyPrototype__constructorValueGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_constructorValue.get()); -} - -void JSExpectAnyPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -JSExpectAny::~JSExpectAny() -{ - if (m_ctx) { - ExpectAnyClass__finalize(m_ctx); - } -} -void JSExpectAny::destroy(JSCell* cell) -{ - static_cast(cell)->JSExpectAny::~JSExpectAny(); -} - -const ClassInfo JSExpectAny::s_info = { "ExpectAny"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSExpectAny) }; - -void JSExpectAny::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSExpectAny* JSExpectAny::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSExpectAny* ptr = new (NotNull, JSC::allocateCell(vm)) JSExpectAny(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* ExpectAny__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSExpectAny* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool ExpectAny__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSExpectAny* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t ExpectAny__ptrOffset = JSExpectAny::offsetOfWrapped(); - -void JSExpectAny::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSExpectAny::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSExpectAnyPrototype::create(vm, globalObject, JSExpectAnyPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue ExpectAny__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSExpectAnyStructure(); - JSExpectAny* instance = JSExpectAny::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSExpectAny::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSExpectAny* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSExpectAny); - -template -void JSExpectAny::visitAdditionalChildren(Visitor& visitor) -{ - JSExpectAny* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - visitor.append(thisObject->m_constructorValue); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSExpectAny); - -template -void JSExpectAny::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSExpectAny* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSExpectAny); -class JSExpectAnythingPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSExpectAnythingPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSExpectAnythingPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSExpectAnythingPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSExpectAnythingPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSExpectAnythingPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -extern "C" void ExpectAnythingClass__finalize(void*); -extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectAnythingClass__call); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSExpectAnythingPrototype, JSExpectAnythingPrototype::Base); - -static const HashTableValue JSExpectAnythingPrototypeTableValues[] = {}; - -const ClassInfo JSExpectAnythingPrototype::s_info = { "ExpectAnything"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSExpectAnythingPrototype) }; - -void JSExpectAnythingPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -JSExpectAnything::~JSExpectAnything() -{ - if (m_ctx) { - ExpectAnythingClass__finalize(m_ctx); - } -} -void JSExpectAnything::destroy(JSCell* cell) -{ - static_cast(cell)->JSExpectAnything::~JSExpectAnything(); -} - -const ClassInfo JSExpectAnything::s_info = { "ExpectAnything"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSExpectAnything) }; - -void JSExpectAnything::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSExpectAnything* JSExpectAnything::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSExpectAnything* ptr = new (NotNull, JSC::allocateCell(vm)) JSExpectAnything(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* ExpectAnything__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSExpectAnything* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool ExpectAnything__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSExpectAnything* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t ExpectAnything__ptrOffset = JSExpectAnything::offsetOfWrapped(); - -void JSExpectAnything::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSExpectAnything::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSExpectAnythingPrototype::create(vm, globalObject, JSExpectAnythingPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue ExpectAnything__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSExpectAnythingStructure(); - JSExpectAnything* instance = JSExpectAnything::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -class JSExpectArrayContainingPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSExpectArrayContainingPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSExpectArrayContainingPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSExpectArrayContainingPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSExpectArrayContainingPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSExpectArrayContainingPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -extern "C" void ExpectArrayContainingClass__finalize(void*); -extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectArrayContainingClass__call); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSExpectArrayContainingPrototype, JSExpectArrayContainingPrototype::Base); - -static const HashTableValue JSExpectArrayContainingPrototypeTableValues[] = {}; - -const ClassInfo JSExpectArrayContainingPrototype::s_info = { "ExpectArrayContaining"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSExpectArrayContainingPrototype) }; - -extern "C" void ExpectArrayContainingPrototype__arrayValueSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_arrayValue.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue ExpectArrayContainingPrototype__arrayValueGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_arrayValue.get()); -} - -void JSExpectArrayContainingPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -JSExpectArrayContaining::~JSExpectArrayContaining() -{ - if (m_ctx) { - ExpectArrayContainingClass__finalize(m_ctx); - } -} -void JSExpectArrayContaining::destroy(JSCell* cell) -{ - static_cast(cell)->JSExpectArrayContaining::~JSExpectArrayContaining(); -} - -const ClassInfo JSExpectArrayContaining::s_info = { "ExpectArrayContaining"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSExpectArrayContaining) }; - -void JSExpectArrayContaining::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSExpectArrayContaining* JSExpectArrayContaining::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSExpectArrayContaining* ptr = new (NotNull, JSC::allocateCell(vm)) JSExpectArrayContaining(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* ExpectArrayContaining__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSExpectArrayContaining* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool ExpectArrayContaining__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSExpectArrayContaining* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t ExpectArrayContaining__ptrOffset = JSExpectArrayContaining::offsetOfWrapped(); - -void JSExpectArrayContaining::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSExpectArrayContaining::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSExpectArrayContainingPrototype::create(vm, globalObject, JSExpectArrayContainingPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue ExpectArrayContaining__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSExpectArrayContainingStructure(); - JSExpectArrayContaining* instance = JSExpectArrayContaining::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSExpectArrayContaining::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSExpectArrayContaining* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSExpectArrayContaining); - -template -void JSExpectArrayContaining::visitAdditionalChildren(Visitor& visitor) -{ - JSExpectArrayContaining* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - visitor.append(thisObject->m_arrayValue); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSExpectArrayContaining); - -template -void JSExpectArrayContaining::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSExpectArrayContaining* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSExpectArrayContaining); -class JSExpectStringContainingPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSExpectStringContainingPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSExpectStringContainingPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSExpectStringContainingPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSExpectStringContainingPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSExpectStringContainingPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -extern "C" void ExpectStringContainingClass__finalize(void*); -extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectStringContainingClass__call); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSExpectStringContainingPrototype, JSExpectStringContainingPrototype::Base); - -static const HashTableValue JSExpectStringContainingPrototypeTableValues[] = {}; - -const ClassInfo JSExpectStringContainingPrototype::s_info = { "ExpectStringContaining"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSExpectStringContainingPrototype) }; - -extern "C" void ExpectStringContainingPrototype__stringValueSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_stringValue.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue ExpectStringContainingPrototype__stringValueGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_stringValue.get()); -} - -void JSExpectStringContainingPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -JSExpectStringContaining::~JSExpectStringContaining() -{ - if (m_ctx) { - ExpectStringContainingClass__finalize(m_ctx); - } -} -void JSExpectStringContaining::destroy(JSCell* cell) -{ - static_cast(cell)->JSExpectStringContaining::~JSExpectStringContaining(); -} - -const ClassInfo JSExpectStringContaining::s_info = { "ExpectStringContaining"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSExpectStringContaining) }; - -void JSExpectStringContaining::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSExpectStringContaining* JSExpectStringContaining::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSExpectStringContaining* ptr = new (NotNull, JSC::allocateCell(vm)) JSExpectStringContaining(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* ExpectStringContaining__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSExpectStringContaining* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool ExpectStringContaining__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSExpectStringContaining* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t ExpectStringContaining__ptrOffset = JSExpectStringContaining::offsetOfWrapped(); - -void JSExpectStringContaining::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSExpectStringContaining::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSExpectStringContainingPrototype::create(vm, globalObject, JSExpectStringContainingPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue ExpectStringContaining__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSExpectStringContainingStructure(); - JSExpectStringContaining* instance = JSExpectStringContaining::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSExpectStringContaining::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSExpectStringContaining* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSExpectStringContaining); - -template -void JSExpectStringContaining::visitAdditionalChildren(Visitor& visitor) -{ - JSExpectStringContaining* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - visitor.append(thisObject->m_stringValue); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSExpectStringContaining); - -template -void JSExpectStringContaining::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSExpectStringContaining* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSExpectStringContaining); -class JSExpectStringMatchingPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSExpectStringMatchingPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSExpectStringMatchingPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSExpectStringMatchingPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSExpectStringMatchingPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSExpectStringMatchingPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -extern "C" void ExpectStringMatchingClass__finalize(void*); -extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectStringMatchingClass__call); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSExpectStringMatchingPrototype, JSExpectStringMatchingPrototype::Base); - -static const HashTableValue JSExpectStringMatchingPrototypeTableValues[] = {}; - -const ClassInfo JSExpectStringMatchingPrototype::s_info = { "ExpectStringMatching"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSExpectStringMatchingPrototype) }; - -extern "C" void ExpectStringMatchingPrototype__testValueSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_testValue.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue ExpectStringMatchingPrototype__testValueGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_testValue.get()); -} - -void JSExpectStringMatchingPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -JSExpectStringMatching::~JSExpectStringMatching() -{ - if (m_ctx) { - ExpectStringMatchingClass__finalize(m_ctx); - } -} -void JSExpectStringMatching::destroy(JSCell* cell) -{ - static_cast(cell)->JSExpectStringMatching::~JSExpectStringMatching(); -} - -const ClassInfo JSExpectStringMatching::s_info = { "ExpectStringMatching"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSExpectStringMatching) }; - -void JSExpectStringMatching::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSExpectStringMatching* JSExpectStringMatching::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSExpectStringMatching* ptr = new (NotNull, JSC::allocateCell(vm)) JSExpectStringMatching(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* ExpectStringMatching__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSExpectStringMatching* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool ExpectStringMatching__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSExpectStringMatching* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t ExpectStringMatching__ptrOffset = JSExpectStringMatching::offsetOfWrapped(); - -void JSExpectStringMatching::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSExpectStringMatching::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSExpectStringMatchingPrototype::create(vm, globalObject, JSExpectStringMatchingPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue ExpectStringMatching__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSExpectStringMatchingStructure(); - JSExpectStringMatching* instance = JSExpectStringMatching::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSExpectStringMatching::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSExpectStringMatching* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSExpectStringMatching); - -template -void JSExpectStringMatching::visitAdditionalChildren(Visitor& visitor) -{ - JSExpectStringMatching* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - visitor.append(thisObject->m_testValue); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSExpectStringMatching); - -template -void JSExpectStringMatching::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSExpectStringMatching* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSExpectStringMatching); -class JSFFIPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSFFIPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSFFIPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSFFIPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSFFIPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSFFIPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -extern "C" void* FFIClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsFFIConstructor); - -extern "C" void FFIClass__finalize(void*); - -extern "C" EncodedJSValue FFIPrototype__close(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(FFIPrototype__closeCallback); - -extern "C" JSC::EncodedJSValue FFIPrototype__getSymbols(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(FFIPrototype__symbolsGetterWrap); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSFFIPrototype, JSFFIPrototype::Base); - -static const HashTableValue JSFFIPrototypeTableValues[] = { - { "close"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, FFIPrototype__closeCallback, 0 } }, - { "symbols"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, FFIPrototype__symbolsGetterWrap, 0 } } -}; - -const ClassInfo JSFFIPrototype::s_info = { "FFI"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSFFIPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsFFIConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for FFI"_s); - return JSValue::encode(globalObject->JSFFIConstructor()); -} - -JSC_DEFINE_HOST_FUNCTION(FFIPrototype__closeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSFFI* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof FFI"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return FFIPrototype__close(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(FFIPrototype__symbolsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSFFI* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_symbolsValue.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - FFIPrototype__getSymbols(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_symbolsValue.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void FFIPrototype__symbolsSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_symbolsValue.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue FFIPrototype__symbolsGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_symbolsValue.get()); -} - -extern "C" void FFIPrototype__symbolsValueSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_symbolsValue.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue FFIPrototype__symbolsValueGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_symbolsValue.get()); -} - -void JSFFIPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSFFI::info(), JSFFIPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -JSFFI::~JSFFI() -{ - if (m_ctx) { - FFIClass__finalize(m_ctx); - } -} -void JSFFI::destroy(JSCell* cell) -{ - static_cast(cell)->JSFFI::~JSFFI(); -} - -const ClassInfo JSFFI::s_info = { "FFI"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSFFI) }; - -void JSFFI::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSFFI* JSFFI::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSFFI* ptr = new (NotNull, JSC::allocateCell(vm)) JSFFI(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* FFI__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSFFI* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool FFI__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSFFI* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t FFI__ptrOffset = JSFFI::offsetOfWrapped(); - -void JSFFI::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSFFI::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSFFIPrototype::create(vm, globalObject, JSFFIPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue FFI__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSFFIStructure(); - JSFFI* instance = JSFFI::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSFFI::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSFFI* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSFFI); - -template -void JSFFI::visitAdditionalChildren(Visitor& visitor) -{ - JSFFI* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - visitor.append(thisObject->m_symbolsValue); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSFFI); - -template -void JSFFI::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSFFI* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSFFI); -class JSFSWatcherPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSFSWatcherPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSFSWatcherPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSFSWatcherPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSFSWatcherPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSFSWatcherPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -extern "C" void FSWatcherClass__finalize(void*); - -extern "C" EncodedJSValue FSWatcherPrototype__doClose(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(FSWatcherPrototype__closeCallback); - -extern "C" EncodedJSValue FSWatcherPrototype__hasRef(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(FSWatcherPrototype__hasRefCallback); - -extern "C" EncodedJSValue FSWatcherPrototype__doRef(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(FSWatcherPrototype__refCallback); - -extern "C" EncodedJSValue FSWatcherPrototype__doUnref(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(FSWatcherPrototype__unrefCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSFSWatcherPrototype, JSFSWatcherPrototype::Base); - -static const HashTableValue JSFSWatcherPrototypeTableValues[] = { - { "close"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, FSWatcherPrototype__closeCallback, 0 } }, - { "hasRef"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, FSWatcherPrototype__hasRefCallback, 0 } }, - { "ref"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, FSWatcherPrototype__refCallback, 0 } }, - { "unref"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, FSWatcherPrototype__unrefCallback, 0 } } -}; - -const ClassInfo JSFSWatcherPrototype::s_info = { "FSWatcher"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSFSWatcherPrototype) }; - -JSC_DEFINE_HOST_FUNCTION(FSWatcherPrototype__closeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSFSWatcher* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof FSWatcher"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return FSWatcherPrototype__doClose(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(FSWatcherPrototype__hasRefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSFSWatcher* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof FSWatcher"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return FSWatcherPrototype__hasRef(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(FSWatcherPrototype__refCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSFSWatcher* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof FSWatcher"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return FSWatcherPrototype__doRef(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(FSWatcherPrototype__unrefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSFSWatcher* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof FSWatcher"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return FSWatcherPrototype__doUnref(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -extern "C" void FSWatcherPrototype__listenerSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_listener.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue FSWatcherPrototype__listenerGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_listener.get()); -} - -void JSFSWatcherPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSFSWatcher::info(), JSFSWatcherPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -extern "C" bool FSWatcher__hasPendingActivity(void* ptr); -bool JSFSWatcher::hasPendingActivity(void* ctx) -{ - return FSWatcher__hasPendingActivity(ctx); -} - -JSFSWatcher::~JSFSWatcher() -{ - if (m_ctx) { - FSWatcherClass__finalize(m_ctx); - } -} -void JSFSWatcher::destroy(JSCell* cell) -{ - static_cast(cell)->JSFSWatcher::~JSFSWatcher(); -} - -const ClassInfo JSFSWatcher::s_info = { "FSWatcher"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSFSWatcher) }; - -void JSFSWatcher::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSFSWatcher* JSFSWatcher::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSFSWatcher* ptr = new (NotNull, JSC::allocateCell(vm)) JSFSWatcher(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* FSWatcher__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSFSWatcher* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool FSWatcher__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSFSWatcher* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t FSWatcher__ptrOffset = JSFSWatcher::offsetOfWrapped(); - -void JSFSWatcher::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSFSWatcher::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSFSWatcherPrototype::create(vm, globalObject, JSFSWatcherPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue FSWatcher__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSFSWatcherStructure(); - JSFSWatcher* instance = JSFSWatcher::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSFSWatcher::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSFSWatcher* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSFSWatcher); - -template -void JSFSWatcher::visitAdditionalChildren(Visitor& visitor) -{ - JSFSWatcher* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - visitor.append(thisObject->m_listener); - - visitor.addOpaqueRoot(this->wrapped()); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSFSWatcher); - -template -void JSFSWatcher::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSFSWatcher* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSFSWatcher); -class JSFileSystemRouterPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSFileSystemRouterPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSFileSystemRouterPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSFileSystemRouterPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSFileSystemRouterPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSFileSystemRouterPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -class JSFileSystemRouterConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSFileSystemRouterConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSFileSystemRouterPrototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForFileSystemRouterConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForFileSystemRouterConstructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForFileSystemRouterConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForFileSystemRouterConstructor = std::forward(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSFileSystemRouterPrototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSFileSystemRouterConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSFileSystemRouterPrototype* prototype); -}; - -extern "C" void* FileSystemRouterClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsFileSystemRouterConstructor); - -extern "C" void FileSystemRouterClass__finalize(void*); - -extern "C" EncodedJSValue FileSystemRouterPrototype__match(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(FileSystemRouterPrototype__matchCallback); - -extern "C" JSC::EncodedJSValue FileSystemRouterPrototype__getOrigin(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(FileSystemRouterPrototype__originGetterWrap); - -extern "C" EncodedJSValue FileSystemRouterPrototype__reload(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(FileSystemRouterPrototype__reloadCallback); - -extern "C" JSC::EncodedJSValue FileSystemRouterPrototype__getRoutes(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(FileSystemRouterPrototype__routesGetterWrap); - -extern "C" JSC::EncodedJSValue FileSystemRouterPrototype__getStyle(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(FileSystemRouterPrototype__styleGetterWrap); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSFileSystemRouterPrototype, JSFileSystemRouterPrototype::Base); - -static const HashTableValue JSFileSystemRouterPrototypeTableValues[] = { - { "match"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSystemRouterPrototype__matchCallback, 1 } }, - { "origin"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, FileSystemRouterPrototype__originGetterWrap, 0 } }, - { "reload"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSystemRouterPrototype__reloadCallback, 0 } }, - { "routes"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, FileSystemRouterPrototype__routesGetterWrap, 0 } }, - { "style"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, FileSystemRouterPrototype__styleGetterWrap, 0 } } -}; - -const ClassInfo JSFileSystemRouterPrototype::s_info = { "FileSystemRouter"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSFileSystemRouterPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsFileSystemRouterConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for FileSystemRouter"_s); - return JSValue::encode(globalObject->JSFileSystemRouterConstructor()); -} - -JSC_DEFINE_HOST_FUNCTION(FileSystemRouterPrototype__matchCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSFileSystemRouter* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof FileSystemRouter"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return FileSystemRouterPrototype__match(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(FileSystemRouterPrototype__originGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSFileSystemRouter* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_origin.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - FileSystemRouterPrototype__getOrigin(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_origin.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void FileSystemRouterPrototype__originSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_origin.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue FileSystemRouterPrototype__originGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_origin.get()); -} - -JSC_DEFINE_HOST_FUNCTION(FileSystemRouterPrototype__reloadCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSFileSystemRouter* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof FileSystemRouter"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return FileSystemRouterPrototype__reload(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(FileSystemRouterPrototype__routesGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSFileSystemRouter* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_routes.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - FileSystemRouterPrototype__getRoutes(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_routes.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void FileSystemRouterPrototype__routesSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_routes.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue FileSystemRouterPrototype__routesGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_routes.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(FileSystemRouterPrototype__styleGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSFileSystemRouter* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_style.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - FileSystemRouterPrototype__getStyle(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_style.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void FileSystemRouterPrototype__styleSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_style.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue FileSystemRouterPrototype__styleGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_style.get()); -} - -void JSFileSystemRouterPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSFileSystemRouter::info(), JSFileSystemRouterPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -void JSFileSystemRouterConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSFileSystemRouterPrototype* prototype) -{ - Base::finishCreation(vm, 0, "FileSystemRouter"_s, PropertyAdditionMode::WithoutStructureTransition); - - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} - -JSFileSystemRouterConstructor::JSFileSystemRouterConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} - -JSFileSystemRouterConstructor* JSFileSystemRouterConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSFileSystemRouterPrototype* prototype) -{ - JSFileSystemRouterConstructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSFileSystemRouterConstructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSFileSystemRouterConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) -{ - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); - JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSFileSystemRouterConstructor(); - Structure* structure = globalObject->JSFileSystemRouterStructure(); - if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); - - auto* functionGlobalObject = reinterpret_cast( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSFileSystemRouterStructure()); - } - - void* ptr = FileSystemRouterClass__construct(globalObject, callFrame); - - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); - } - - JSFileSystemRouter* instance = JSFileSystemRouter::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -void JSFileSystemRouterConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSFileSystemRouterPrototype* prototype) -{ -} - -const ClassInfo JSFileSystemRouterConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSFileSystemRouterConstructor) }; - -extern "C" EncodedJSValue FileSystemRouter__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSFileSystemRouterConstructor()); -} - -JSFileSystemRouter::~JSFileSystemRouter() -{ - if (m_ctx) { - FileSystemRouterClass__finalize(m_ctx); - } -} -void JSFileSystemRouter::destroy(JSCell* cell) -{ - static_cast(cell)->JSFileSystemRouter::~JSFileSystemRouter(); -} - -const ClassInfo JSFileSystemRouter::s_info = { "FileSystemRouter"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSFileSystemRouter) }; - -void JSFileSystemRouter::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSFileSystemRouter* JSFileSystemRouter::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSFileSystemRouter* ptr = new (NotNull, JSC::allocateCell(vm)) JSFileSystemRouter(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* FileSystemRouter__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSFileSystemRouter* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool FileSystemRouter__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSFileSystemRouter* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t FileSystemRouter__ptrOffset = JSFileSystemRouter::offsetOfWrapped(); - -void JSFileSystemRouter::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSFileSystemRouter::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) -{ - return WebCore::JSFileSystemRouterConstructor::create(vm, globalObject, WebCore::JSFileSystemRouterConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast(prototype)); -} - -JSObject* JSFileSystemRouter::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSFileSystemRouterPrototype::create(vm, globalObject, JSFileSystemRouterPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue FileSystemRouter__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSFileSystemRouterStructure(); - JSFileSystemRouter* instance = JSFileSystemRouter::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSFileSystemRouter::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSFileSystemRouter* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSFileSystemRouter); - -template -void JSFileSystemRouter::visitAdditionalChildren(Visitor& visitor) -{ - JSFileSystemRouter* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_origin); - visitor.append(thisObject->m_routes); - visitor.append(thisObject->m_style); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSFileSystemRouter); - -template -void JSFileSystemRouter::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSFileSystemRouter* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSFileSystemRouter); -class JSHTMLRewriterPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSHTMLRewriterPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSHTMLRewriterPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSHTMLRewriterPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSHTMLRewriterPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSHTMLRewriterPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -class JSHTMLRewriterConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSHTMLRewriterConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSHTMLRewriterPrototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForHTMLRewriterConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForHTMLRewriterConstructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForHTMLRewriterConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForHTMLRewriterConstructor = std::forward(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSHTMLRewriterPrototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSHTMLRewriterConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSHTMLRewriterPrototype* prototype); -}; - -extern "C" void* HTMLRewriterClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsHTMLRewriterConstructor); - -extern "C" void HTMLRewriterClass__finalize(void*); - -extern "C" EncodedJSValue HTMLRewriterPrototype__on(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(HTMLRewriterPrototype__onCallback); - -extern "C" EncodedJSValue HTMLRewriterPrototype__onDocument(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(HTMLRewriterPrototype__onDocumentCallback); - -extern "C" EncodedJSValue HTMLRewriterPrototype__transform(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(HTMLRewriterPrototype__transformCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSHTMLRewriterPrototype, JSHTMLRewriterPrototype::Base); - -static const HashTableValue JSHTMLRewriterPrototypeTableValues[] = { - { "on"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, HTMLRewriterPrototype__onCallback, 2 } }, - { "onDocument"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, HTMLRewriterPrototype__onDocumentCallback, 1 } }, - { "transform"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, HTMLRewriterPrototype__transformCallback, 1 } } -}; - -const ClassInfo JSHTMLRewriterPrototype::s_info = { "HTMLRewriter"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLRewriterPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsHTMLRewriterConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for HTMLRewriter"_s); - return JSValue::encode(globalObject->JSHTMLRewriterConstructor()); -} - -JSC_DEFINE_HOST_FUNCTION(HTMLRewriterPrototype__onCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSHTMLRewriter* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof HTMLRewriter"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return HTMLRewriterPrototype__on(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(HTMLRewriterPrototype__onDocumentCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSHTMLRewriter* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof HTMLRewriter"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return HTMLRewriterPrototype__onDocument(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(HTMLRewriterPrototype__transformCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSHTMLRewriter* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof HTMLRewriter"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return HTMLRewriterPrototype__transform(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSHTMLRewriterPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSHTMLRewriter::info(), JSHTMLRewriterPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -void JSHTMLRewriterConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSHTMLRewriterPrototype* prototype) -{ - Base::finishCreation(vm, 0, "HTMLRewriter"_s, PropertyAdditionMode::WithoutStructureTransition); - - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} - -JSHTMLRewriterConstructor::JSHTMLRewriterConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} - -JSHTMLRewriterConstructor* JSHTMLRewriterConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSHTMLRewriterPrototype* prototype) -{ - JSHTMLRewriterConstructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSHTMLRewriterConstructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSHTMLRewriterConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) -{ - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); - JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSHTMLRewriterConstructor(); - Structure* structure = globalObject->JSHTMLRewriterStructure(); - if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); - - auto* functionGlobalObject = reinterpret_cast( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSHTMLRewriterStructure()); - } - - void* ptr = HTMLRewriterClass__construct(globalObject, callFrame); - - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); - } - - JSHTMLRewriter* instance = JSHTMLRewriter::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -void JSHTMLRewriterConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSHTMLRewriterPrototype* prototype) -{ -} - -const ClassInfo JSHTMLRewriterConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLRewriterConstructor) }; - -extern "C" EncodedJSValue HTMLRewriter__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSHTMLRewriterConstructor()); -} - -JSHTMLRewriter::~JSHTMLRewriter() -{ - if (m_ctx) { - HTMLRewriterClass__finalize(m_ctx); - } -} -void JSHTMLRewriter::destroy(JSCell* cell) -{ - static_cast(cell)->JSHTMLRewriter::~JSHTMLRewriter(); -} - -const ClassInfo JSHTMLRewriter::s_info = { "HTMLRewriter"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLRewriter) }; - -void JSHTMLRewriter::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSHTMLRewriter* JSHTMLRewriter::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSHTMLRewriter* ptr = new (NotNull, JSC::allocateCell(vm)) JSHTMLRewriter(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* HTMLRewriter__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSHTMLRewriter* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool HTMLRewriter__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSHTMLRewriter* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t HTMLRewriter__ptrOffset = JSHTMLRewriter::offsetOfWrapped(); - -void JSHTMLRewriter::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSHTMLRewriter::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) -{ - return WebCore::JSHTMLRewriterConstructor::create(vm, globalObject, WebCore::JSHTMLRewriterConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast(prototype)); -} - -JSObject* JSHTMLRewriter::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSHTMLRewriterPrototype::create(vm, globalObject, JSHTMLRewriterPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue HTMLRewriter__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSHTMLRewriterStructure(); - JSHTMLRewriter* instance = JSHTMLRewriter::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -class JSHTTPSServerPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSHTTPSServerPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSHTTPSServerPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSHTTPSServerPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSHTTPSServerPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSHTTPSServerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -extern "C" void* HTTPSServerClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsHTTPSServerConstructor); - -extern "C" void HTTPSServerClass__finalize(void*); - -extern "C" JSC::EncodedJSValue HTTPSServerPrototype__getAddress(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(HTTPSServerPrototype__addressGetterWrap); - -extern "C" JSC::EncodedJSValue HTTPSServerPrototype__getDevelopment(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(HTTPSServerPrototype__developmentGetterWrap); - -extern "C" EncodedJSValue HTTPSServerPrototype__doFetch(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(HTTPSServerPrototype__fetchCallback); - -extern "C" JSC::EncodedJSValue HTTPSServerPrototype__getHostname(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(HTTPSServerPrototype__hostnameGetterWrap); - -extern "C" JSC::EncodedJSValue HTTPSServerPrototype__getId(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(HTTPSServerPrototype__idGetterWrap); - -extern "C" JSC::EncodedJSValue HTTPSServerPrototype__getPendingRequests(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(HTTPSServerPrototype__pendingRequestsGetterWrap); - -extern "C" JSC::EncodedJSValue HTTPSServerPrototype__getPendingWebSockets(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(HTTPSServerPrototype__pendingWebSocketsGetterWrap); - -extern "C" JSC::EncodedJSValue HTTPSServerPrototype__getPort(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(HTTPSServerPrototype__portGetterWrap); - -extern "C" JSC::EncodedJSValue HTTPSServerPrototype__getProtocol(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(HTTPSServerPrototype__protocolGetterWrap); - -extern "C" EncodedJSValue HTTPSServerPrototype__doPublish(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(HTTPSServerPrototype__publishCallback); - -extern "C" EncodedJSValue HTTPSServerPrototype__doReload(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(HTTPSServerPrototype__reloadCallback); - -extern "C" EncodedJSValue HTTPSServerPrototype__doRequestIP(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(HTTPSServerPrototype__requestIPCallback); - -extern "C" EncodedJSValue HTTPSServerPrototype__doStop(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(HTTPSServerPrototype__stopCallback); - -extern "C" EncodedJSValue HTTPSServerPrototype__doUpgrade(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(HTTPSServerPrototype__upgradeCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSHTTPSServerPrototype, JSHTTPSServerPrototype::Base); - -static const HashTableValue JSHTTPSServerPrototypeTableValues[] = { - { "address"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, HTTPSServerPrototype__addressGetterWrap, 0 } }, - { "development"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, HTTPSServerPrototype__developmentGetterWrap, 0 } }, - { "fetch"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSServerPrototype__fetchCallback, 1 } }, - { "hostname"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, HTTPSServerPrototype__hostnameGetterWrap, 0 } }, - { "id"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, HTTPSServerPrototype__idGetterWrap, 0 } }, - { "pendingRequests"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, HTTPSServerPrototype__pendingRequestsGetterWrap, 0 } }, - { "pendingWebSockets"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, HTTPSServerPrototype__pendingWebSocketsGetterWrap, 0 } }, - { "port"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, HTTPSServerPrototype__portGetterWrap, 0 } }, - { "protocol"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, HTTPSServerPrototype__protocolGetterWrap, 0 } }, - { "publish"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSServerPrototype__publishCallback, 3 } }, - { "reload"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSServerPrototype__reloadCallback, 2 } }, - { "requestIP"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSServerPrototype__requestIPCallback, 1 } }, - { "stop"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSServerPrototype__stopCallback, 1 } }, - { "upgrade"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSServerPrototype__upgradeCallback, 1 } } -}; - -const ClassInfo JSHTTPSServerPrototype::s_info = { "HTTPSServer"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTTPSServerPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsHTTPSServerConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for HTTPSServer"_s); - return JSValue::encode(globalObject->JSHTTPSServerConstructor()); -} - -JSC_DEFINE_CUSTOM_GETTER(HTTPSServerPrototype__addressGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSHTTPSServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_address.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - HTTPSServerPrototype__getAddress(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_address.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void HTTPSServerPrototype__addressSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_address.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue HTTPSServerPrototype__addressGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_address.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(HTTPSServerPrototype__developmentGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSHTTPSServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = HTTPSServerPrototype__getDevelopment(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(HTTPSServerPrototype__fetchCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSHTTPSServer* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof HTTPSServer"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return HTTPSServerPrototype__doFetch(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(HTTPSServerPrototype__hostnameGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSHTTPSServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_hostname.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - HTTPSServerPrototype__getHostname(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_hostname.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void HTTPSServerPrototype__hostnameSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_hostname.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue HTTPSServerPrototype__hostnameGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_hostname.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(HTTPSServerPrototype__idGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSHTTPSServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_id.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - HTTPSServerPrototype__getId(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_id.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void HTTPSServerPrototype__idSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_id.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue HTTPSServerPrototype__idGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_id.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(HTTPSServerPrototype__pendingRequestsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSHTTPSServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = HTTPSServerPrototype__getPendingRequests(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(HTTPSServerPrototype__pendingWebSocketsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSHTTPSServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = HTTPSServerPrototype__getPendingWebSockets(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(HTTPSServerPrototype__portGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSHTTPSServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = HTTPSServerPrototype__getPort(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(HTTPSServerPrototype__protocolGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSHTTPSServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = HTTPSServerPrototype__getProtocol(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(HTTPSServerPrototype__publishCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSHTTPSServer* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof HTTPSServer"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return HTTPSServerPrototype__doPublish(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(HTTPSServerPrototype__reloadCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSHTTPSServer* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof HTTPSServer"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return HTTPSServerPrototype__doReload(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(HTTPSServerPrototype__requestIPCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSHTTPSServer* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof HTTPSServer"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return HTTPSServerPrototype__doRequestIP(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(HTTPSServerPrototype__stopCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSHTTPSServer* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof HTTPSServer"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return HTTPSServerPrototype__doStop(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(HTTPSServerPrototype__upgradeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSHTTPSServer* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof HTTPSServer"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return HTTPSServerPrototype__doUpgrade(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSHTTPSServerPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSHTTPSServer::info(), JSHTTPSServerPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -JSHTTPSServer::~JSHTTPSServer() -{ - if (m_ctx) { - HTTPSServerClass__finalize(m_ctx); - } -} -void JSHTTPSServer::destroy(JSCell* cell) -{ - static_cast(cell)->JSHTTPSServer::~JSHTTPSServer(); -} - -const ClassInfo JSHTTPSServer::s_info = { "HTTPSServer"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTTPSServer) }; - -void JSHTTPSServer::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSHTTPSServer* JSHTTPSServer::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSHTTPSServer* ptr = new (NotNull, JSC::allocateCell(vm)) JSHTTPSServer(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* HTTPSServer__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSHTTPSServer* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool HTTPSServer__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSHTTPSServer* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t HTTPSServer__ptrOffset = JSHTTPSServer::offsetOfWrapped(); - -void JSHTTPSServer::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSHTTPSServer::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSHTTPSServerPrototype::create(vm, globalObject, JSHTTPSServerPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue HTTPSServer__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSHTTPSServerStructure(); - JSHTTPSServer* instance = JSHTTPSServer::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSHTTPSServer::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSHTTPSServer* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSHTTPSServer); - -template -void JSHTTPSServer::visitAdditionalChildren(Visitor& visitor) -{ - JSHTTPSServer* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_address); - visitor.append(thisObject->m_hostname); - visitor.append(thisObject->m_id); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSHTTPSServer); - -template -void JSHTTPSServer::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSHTTPSServer* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSHTTPSServer); -class JSHTTPServerPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSHTTPServerPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSHTTPServerPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSHTTPServerPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSHTTPServerPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSHTTPServerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -extern "C" void* HTTPServerClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsHTTPServerConstructor); - -extern "C" void HTTPServerClass__finalize(void*); - -extern "C" JSC::EncodedJSValue HTTPServerPrototype__getAddress(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(HTTPServerPrototype__addressGetterWrap); - -extern "C" JSC::EncodedJSValue HTTPServerPrototype__getDevelopment(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(HTTPServerPrototype__developmentGetterWrap); - -extern "C" EncodedJSValue HTTPServerPrototype__doFetch(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(HTTPServerPrototype__fetchCallback); - -extern "C" JSC::EncodedJSValue HTTPServerPrototype__getHostname(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(HTTPServerPrototype__hostnameGetterWrap); - -extern "C" JSC::EncodedJSValue HTTPServerPrototype__getId(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(HTTPServerPrototype__idGetterWrap); - -extern "C" JSC::EncodedJSValue HTTPServerPrototype__getPendingRequests(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(HTTPServerPrototype__pendingRequestsGetterWrap); - -extern "C" JSC::EncodedJSValue HTTPServerPrototype__getPendingWebSockets(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(HTTPServerPrototype__pendingWebSocketsGetterWrap); - -extern "C" JSC::EncodedJSValue HTTPServerPrototype__getPort(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(HTTPServerPrototype__portGetterWrap); - -extern "C" JSC::EncodedJSValue HTTPServerPrototype__getProtocol(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(HTTPServerPrototype__protocolGetterWrap); - -extern "C" EncodedJSValue HTTPServerPrototype__doPublish(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(HTTPServerPrototype__publishCallback); - -extern "C" EncodedJSValue HTTPServerPrototype__doReload(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(HTTPServerPrototype__reloadCallback); - -extern "C" EncodedJSValue HTTPServerPrototype__doRequestIP(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(HTTPServerPrototype__requestIPCallback); - -extern "C" EncodedJSValue HTTPServerPrototype__doStop(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(HTTPServerPrototype__stopCallback); - -extern "C" EncodedJSValue HTTPServerPrototype__doUpgrade(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(HTTPServerPrototype__upgradeCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSHTTPServerPrototype, JSHTTPServerPrototype::Base); - -static const HashTableValue JSHTTPServerPrototypeTableValues[] = { - { "address"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, HTTPServerPrototype__addressGetterWrap, 0 } }, - { "development"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, HTTPServerPrototype__developmentGetterWrap, 0 } }, - { "fetch"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPServerPrototype__fetchCallback, 1 } }, - { "hostname"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, HTTPServerPrototype__hostnameGetterWrap, 0 } }, - { "id"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, HTTPServerPrototype__idGetterWrap, 0 } }, - { "pendingRequests"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, HTTPServerPrototype__pendingRequestsGetterWrap, 0 } }, - { "pendingWebSockets"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, HTTPServerPrototype__pendingWebSocketsGetterWrap, 0 } }, - { "port"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, HTTPServerPrototype__portGetterWrap, 0 } }, - { "protocol"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, HTTPServerPrototype__protocolGetterWrap, 0 } }, - { "publish"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPServerPrototype__publishCallback, 3 } }, - { "reload"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPServerPrototype__reloadCallback, 2 } }, - { "requestIP"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPServerPrototype__requestIPCallback, 1 } }, - { "stop"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPServerPrototype__stopCallback, 1 } }, - { "upgrade"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPServerPrototype__upgradeCallback, 1 } } -}; - -const ClassInfo JSHTTPServerPrototype::s_info = { "HTTPServer"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTTPServerPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsHTTPServerConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for HTTPServer"_s); - return JSValue::encode(globalObject->JSHTTPServerConstructor()); -} - -JSC_DEFINE_CUSTOM_GETTER(HTTPServerPrototype__addressGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSHTTPServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_address.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - HTTPServerPrototype__getAddress(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_address.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void HTTPServerPrototype__addressSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_address.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue HTTPServerPrototype__addressGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_address.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(HTTPServerPrototype__developmentGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSHTTPServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = HTTPServerPrototype__getDevelopment(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(HTTPServerPrototype__fetchCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSHTTPServer* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof HTTPServer"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return HTTPServerPrototype__doFetch(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(HTTPServerPrototype__hostnameGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSHTTPServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_hostname.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - HTTPServerPrototype__getHostname(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_hostname.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void HTTPServerPrototype__hostnameSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_hostname.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue HTTPServerPrototype__hostnameGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_hostname.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(HTTPServerPrototype__idGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSHTTPServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_id.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - HTTPServerPrototype__getId(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_id.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void HTTPServerPrototype__idSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_id.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue HTTPServerPrototype__idGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_id.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(HTTPServerPrototype__pendingRequestsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSHTTPServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = HTTPServerPrototype__getPendingRequests(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(HTTPServerPrototype__pendingWebSocketsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSHTTPServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = HTTPServerPrototype__getPendingWebSockets(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(HTTPServerPrototype__portGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSHTTPServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = HTTPServerPrototype__getPort(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(HTTPServerPrototype__protocolGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSHTTPServer* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = HTTPServerPrototype__getProtocol(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(HTTPServerPrototype__publishCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSHTTPServer* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof HTTPServer"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return HTTPServerPrototype__doPublish(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(HTTPServerPrototype__reloadCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSHTTPServer* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof HTTPServer"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return HTTPServerPrototype__doReload(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(HTTPServerPrototype__requestIPCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSHTTPServer* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof HTTPServer"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return HTTPServerPrototype__doRequestIP(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(HTTPServerPrototype__stopCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSHTTPServer* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof HTTPServer"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return HTTPServerPrototype__doStop(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(HTTPServerPrototype__upgradeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSHTTPServer* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof HTTPServer"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return HTTPServerPrototype__doUpgrade(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSHTTPServerPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSHTTPServer::info(), JSHTTPServerPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -JSHTTPServer::~JSHTTPServer() -{ - if (m_ctx) { - HTTPServerClass__finalize(m_ctx); - } -} -void JSHTTPServer::destroy(JSCell* cell) -{ - static_cast(cell)->JSHTTPServer::~JSHTTPServer(); -} - -const ClassInfo JSHTTPServer::s_info = { "HTTPServer"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTTPServer) }; - -void JSHTTPServer::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSHTTPServer* JSHTTPServer::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSHTTPServer* ptr = new (NotNull, JSC::allocateCell(vm)) JSHTTPServer(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* HTTPServer__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSHTTPServer* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool HTTPServer__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSHTTPServer* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t HTTPServer__ptrOffset = JSHTTPServer::offsetOfWrapped(); - -void JSHTTPServer::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSHTTPServer::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSHTTPServerPrototype::create(vm, globalObject, JSHTTPServerPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue HTTPServer__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSHTTPServerStructure(); - JSHTTPServer* instance = JSHTTPServer::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSHTTPServer::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSHTTPServer* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSHTTPServer); - -template -void JSHTTPServer::visitAdditionalChildren(Visitor& visitor) -{ - JSHTTPServer* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_address); - visitor.append(thisObject->m_hostname); - visitor.append(thisObject->m_id); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSHTTPServer); - -template -void JSHTTPServer::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSHTTPServer* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSHTTPServer); -class JSListenerPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSListenerPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSListenerPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSListenerPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSListenerPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSListenerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -extern "C" void* ListenerClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsListenerConstructor); - -extern "C" void ListenerClass__finalize(void*); - -extern "C" JSC::EncodedJSValue ListenerPrototype__getData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ListenerPrototype__dataGetterWrap); - -extern "C" bool ListenerPrototype__setData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::EncodedJSValue value); -JSC_DECLARE_CUSTOM_SETTER(ListenerPrototype__dataSetterWrap); - -extern "C" JSC::EncodedJSValue ListenerPrototype__getHostname(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ListenerPrototype__hostnameGetterWrap); - -extern "C" JSC::EncodedJSValue ListenerPrototype__getPort(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ListenerPrototype__portGetterWrap); - -extern "C" EncodedJSValue ListenerPrototype__ref(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ListenerPrototype__refCallback); - -extern "C" EncodedJSValue ListenerPrototype__reload(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ListenerPrototype__reloadCallback); - -extern "C" EncodedJSValue ListenerPrototype__stop(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ListenerPrototype__stopCallback); - -extern "C" JSC::EncodedJSValue ListenerPrototype__getUnix(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ListenerPrototype__unixGetterWrap); - -extern "C" EncodedJSValue ListenerPrototype__unref(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ListenerPrototype__unrefCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSListenerPrototype, JSListenerPrototype::Base); - -static const HashTableValue JSListenerPrototypeTableValues[] = { - { "data"_s, static_cast(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ListenerPrototype__dataGetterWrap, ListenerPrototype__dataSetterWrap } }, - { "hostname"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ListenerPrototype__hostnameGetterWrap, 0 } }, - { "port"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ListenerPrototype__portGetterWrap, 0 } }, - { "ref"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ListenerPrototype__refCallback, 0 } }, - { "reload"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ListenerPrototype__reloadCallback, 1 } }, - { "stop"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ListenerPrototype__stopCallback, 1 } }, - { "unix"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ListenerPrototype__unixGetterWrap, 0 } }, - { "unref"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ListenerPrototype__unrefCallback, 0 } } -}; - -const ClassInfo JSListenerPrototype::s_info = { "Listener"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSListenerPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsListenerConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for Listener"_s); - return JSValue::encode(globalObject->JSListenerConstructor()); -} - -JSC_DEFINE_CUSTOM_GETTER(ListenerPrototype__dataGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSListener* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = ListenerPrototype__getData(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_SETTER(ListenerPrototype__dataSetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSListener* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - auto result = ListenerPrototype__setData(thisObject->wrapped(), lexicalGlobalObject, encodedValue); - - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(ListenerPrototype__hostnameGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSListener* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_hostname.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - ListenerPrototype__getHostname(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_hostname.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void ListenerPrototype__hostnameSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_hostname.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue ListenerPrototype__hostnameGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_hostname.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(ListenerPrototype__portGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSListener* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = ListenerPrototype__getPort(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(ListenerPrototype__refCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSListener* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Listener"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ListenerPrototype__ref(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ListenerPrototype__reloadCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSListener* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Listener"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ListenerPrototype__reload(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ListenerPrototype__stopCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSListener* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Listener"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ListenerPrototype__stop(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(ListenerPrototype__unixGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSListener* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_unix.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - ListenerPrototype__getUnix(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_unix.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void ListenerPrototype__unixSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_unix.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue ListenerPrototype__unixGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_unix.get()); -} - -JSC_DEFINE_HOST_FUNCTION(ListenerPrototype__unrefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSListener* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Listener"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ListenerPrototype__unref(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSListenerPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSListener::info(), JSListenerPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -JSListener::~JSListener() -{ - if (m_ctx) { - ListenerClass__finalize(m_ctx); - } -} -void JSListener::destroy(JSCell* cell) -{ - static_cast(cell)->JSListener::~JSListener(); -} - -const ClassInfo JSListener::s_info = { "Listener"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSListener) }; - -void JSListener::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSListener* JSListener::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSListener* ptr = new (NotNull, JSC::allocateCell(vm)) JSListener(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* Listener__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSListener* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool Listener__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSListener* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t Listener__ptrOffset = JSListener::offsetOfWrapped(); - -void JSListener::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSListener::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSListenerPrototype::create(vm, globalObject, JSListenerPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue Listener__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSListenerStructure(); - JSListener* instance = JSListener::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSListener::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSListener* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSListener); - -template -void JSListener::visitAdditionalChildren(Visitor& visitor) -{ - JSListener* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_hostname); - visitor.append(thisObject->m_unix); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSListener); - -template -void JSListener::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSListener* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSListener); -class JSMD4Prototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSMD4Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSMD4Prototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSMD4Prototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSMD4Prototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSMD4Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -class JSMD4Constructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSMD4Constructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSMD4Prototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForMD4Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForMD4Constructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForMD4Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForMD4Constructor = std::forward(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSMD4Prototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSMD4Constructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSMD4Prototype* prototype); -}; - -extern "C" void* MD4Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsMD4Constructor); - -extern "C" void MD4Class__finalize(void*); - -extern "C" JSC::EncodedJSValue MD4Prototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(MD4Prototype__byteLengthGetterWrap); - -extern "C" EncodedJSValue MD4Prototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(MD4Prototype__digestCallback); - -extern "C" EncodedJSValue MD4Prototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(MD4Prototype__updateCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSMD4Prototype, JSMD4Prototype::Base); - -static const HashTableValue JSMD4PrototypeTableValues[] = { - { "byteLength"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MD4Prototype__byteLengthGetterWrap, 0 } }, - { "digest"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, MD4Prototype__digestCallback, 0 } }, - { "update"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, MD4Prototype__updateCallback, 1 } } -}; - -const ClassInfo JSMD4Prototype::s_info = { "MD4"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD4Prototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsMD4Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for MD4"_s); - return JSValue::encode(globalObject->JSMD4Constructor()); -} - -JSC_DEFINE_CUSTOM_GETTER(MD4Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSMD4* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = MD4Prototype__getByteLength(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(MD4Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSMD4* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof MD4"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return MD4Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(MD4Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSMD4* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof MD4"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return MD4Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSMD4Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSMD4::info(), JSMD4PrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -extern "C" JSC_DECLARE_CUSTOM_GETTER(MD4Class__getByteLengthStatic); -extern "C" JSC_DECLARE_HOST_FUNCTION(MD4Class__hash); - -static const HashTableValue JSMD4ConstructorTableValues[] = { - { "byteLength"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MD4Class__getByteLengthStatic, 0 } }, - { "hash"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, MD4Class__hash, 2 } } -}; - -void JSMD4Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSMD4Prototype* prototype) -{ - Base::finishCreation(vm, 0, "MD4"_s, PropertyAdditionMode::WithoutStructureTransition); - reifyStaticProperties(vm, &JSMD4Constructor::s_info, JSMD4ConstructorTableValues, *this); - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} - -JSMD4Constructor::JSMD4Constructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} - -JSMD4Constructor* JSMD4Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSMD4Prototype* prototype) -{ - JSMD4Constructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSMD4Constructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSMD4Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) -{ - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); - JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSMD4Constructor(); - Structure* structure = globalObject->JSMD4Structure(); - if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); - - auto* functionGlobalObject = reinterpret_cast( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSMD4Structure()); - } - - void* ptr = MD4Class__construct(globalObject, callFrame); - - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); - } - - JSMD4* instance = JSMD4::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -void JSMD4Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSMD4Prototype* prototype) -{ -} - -const ClassInfo JSMD4Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD4Constructor) }; - -extern "C" EncodedJSValue MD4__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSMD4Constructor()); -} - -JSMD4::~JSMD4() -{ - if (m_ctx) { - MD4Class__finalize(m_ctx); - } -} -void JSMD4::destroy(JSCell* cell) -{ - static_cast(cell)->JSMD4::~JSMD4(); -} - -const ClassInfo JSMD4::s_info = { "MD4"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD4) }; - -void JSMD4::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSMD4* JSMD4::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSMD4* ptr = new (NotNull, JSC::allocateCell(vm)) JSMD4(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* MD4__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSMD4* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool MD4__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSMD4* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t MD4__ptrOffset = JSMD4::offsetOfWrapped(); - -void JSMD4::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSMD4::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) -{ - return WebCore::JSMD4Constructor::create(vm, globalObject, WebCore::JSMD4Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast(prototype)); -} - -JSObject* JSMD4::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSMD4Prototype::create(vm, globalObject, JSMD4Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue MD4__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSMD4Structure(); - JSMD4* instance = JSMD4::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -class JSMD5Prototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSMD5Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSMD5Prototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSMD5Prototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSMD5Prototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSMD5Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -class JSMD5Constructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSMD5Constructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSMD5Prototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForMD5Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForMD5Constructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForMD5Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForMD5Constructor = std::forward(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSMD5Prototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSMD5Constructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSMD5Prototype* prototype); -}; - -extern "C" void* MD5Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsMD5Constructor); - -extern "C" void MD5Class__finalize(void*); - -extern "C" JSC::EncodedJSValue MD5Prototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(MD5Prototype__byteLengthGetterWrap); - -extern "C" EncodedJSValue MD5Prototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(MD5Prototype__digestCallback); - -extern "C" EncodedJSValue MD5Prototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(MD5Prototype__updateCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSMD5Prototype, JSMD5Prototype::Base); - -static const HashTableValue JSMD5PrototypeTableValues[] = { - { "byteLength"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MD5Prototype__byteLengthGetterWrap, 0 } }, - { "digest"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, MD5Prototype__digestCallback, 0 } }, - { "update"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, MD5Prototype__updateCallback, 1 } } -}; - -const ClassInfo JSMD5Prototype::s_info = { "MD5"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD5Prototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsMD5Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for MD5"_s); - return JSValue::encode(globalObject->JSMD5Constructor()); -} - -JSC_DEFINE_CUSTOM_GETTER(MD5Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSMD5* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = MD5Prototype__getByteLength(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(MD5Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSMD5* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof MD5"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return MD5Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(MD5Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSMD5* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof MD5"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return MD5Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSMD5Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSMD5::info(), JSMD5PrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -extern "C" JSC_DECLARE_CUSTOM_GETTER(MD5Class__getByteLengthStatic); -extern "C" JSC_DECLARE_HOST_FUNCTION(MD5Class__hash); - -static const HashTableValue JSMD5ConstructorTableValues[] = { - { "byteLength"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MD5Class__getByteLengthStatic, 0 } }, - { "hash"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, MD5Class__hash, 2 } } -}; - -void JSMD5Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSMD5Prototype* prototype) -{ - Base::finishCreation(vm, 0, "MD5"_s, PropertyAdditionMode::WithoutStructureTransition); - reifyStaticProperties(vm, &JSMD5Constructor::s_info, JSMD5ConstructorTableValues, *this); - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} - -JSMD5Constructor::JSMD5Constructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} - -JSMD5Constructor* JSMD5Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSMD5Prototype* prototype) -{ - JSMD5Constructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSMD5Constructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSMD5Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) -{ - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); - JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSMD5Constructor(); - Structure* structure = globalObject->JSMD5Structure(); - if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); - - auto* functionGlobalObject = reinterpret_cast( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSMD5Structure()); - } - - void* ptr = MD5Class__construct(globalObject, callFrame); - - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); - } - - JSMD5* instance = JSMD5::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -void JSMD5Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSMD5Prototype* prototype) -{ -} - -const ClassInfo JSMD5Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD5Constructor) }; - -extern "C" EncodedJSValue MD5__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSMD5Constructor()); -} - -JSMD5::~JSMD5() -{ - if (m_ctx) { - MD5Class__finalize(m_ctx); - } -} -void JSMD5::destroy(JSCell* cell) -{ - static_cast(cell)->JSMD5::~JSMD5(); -} - -const ClassInfo JSMD5::s_info = { "MD5"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD5) }; - -void JSMD5::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSMD5* JSMD5::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSMD5* ptr = new (NotNull, JSC::allocateCell(vm)) JSMD5(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* MD5__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSMD5* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool MD5__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSMD5* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t MD5__ptrOffset = JSMD5::offsetOfWrapped(); - -void JSMD5::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSMD5::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) -{ - return WebCore::JSMD5Constructor::create(vm, globalObject, WebCore::JSMD5Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast(prototype)); -} - -JSObject* JSMD5::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSMD5Prototype::create(vm, globalObject, JSMD5Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue MD5__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSMD5Structure(); - JSMD5* instance = JSMD5::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -class JSMatchedRoutePrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSMatchedRoutePrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSMatchedRoutePrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSMatchedRoutePrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSMatchedRoutePrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSMatchedRoutePrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -extern "C" void* MatchedRouteClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsMatchedRouteConstructor); - -extern "C" void MatchedRouteClass__finalize(void*); - -extern "C" JSC::EncodedJSValue MatchedRoutePrototype__getFilePath(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(MatchedRoutePrototype__filePathGetterWrap); - -extern "C" JSC::EncodedJSValue MatchedRoutePrototype__getKind(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(MatchedRoutePrototype__kindGetterWrap); - -extern "C" JSC::EncodedJSValue MatchedRoutePrototype__getName(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(MatchedRoutePrototype__nameGetterWrap); - -extern "C" JSC::EncodedJSValue MatchedRoutePrototype__getParams(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(MatchedRoutePrototype__paramsGetterWrap); - -extern "C" JSC::EncodedJSValue MatchedRoutePrototype__getPathname(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(MatchedRoutePrototype__pathnameGetterWrap); - -extern "C" JSC::EncodedJSValue MatchedRoutePrototype__getQuery(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(MatchedRoutePrototype__queryGetterWrap); - -extern "C" JSC::EncodedJSValue MatchedRoutePrototype__getScriptSrc(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(MatchedRoutePrototype__scriptSrcGetterWrap); - -extern "C" JSC::EncodedJSValue MatchedRoutePrototype__getScriptSrc(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(MatchedRoutePrototype__srcGetterWrap); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSMatchedRoutePrototype, JSMatchedRoutePrototype::Base); - -static const HashTableValue JSMatchedRoutePrototypeTableValues[] = { - { "filePath"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MatchedRoutePrototype__filePathGetterWrap, 0 } }, - { "kind"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MatchedRoutePrototype__kindGetterWrap, 0 } }, - { "name"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MatchedRoutePrototype__nameGetterWrap, 0 } }, - { "params"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MatchedRoutePrototype__paramsGetterWrap, 0 } }, - { "pathname"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MatchedRoutePrototype__pathnameGetterWrap, 0 } }, - { "query"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MatchedRoutePrototype__queryGetterWrap, 0 } }, - { "scriptSrc"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MatchedRoutePrototype__scriptSrcGetterWrap, 0 } }, - { "src"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MatchedRoutePrototype__srcGetterWrap, 0 } } -}; - -const ClassInfo JSMatchedRoutePrototype::s_info = { "MatchedRoute"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMatchedRoutePrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsMatchedRouteConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for MatchedRoute"_s); - return JSValue::encode(globalObject->JSMatchedRouteConstructor()); -} - -JSC_DEFINE_CUSTOM_GETTER(MatchedRoutePrototype__filePathGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSMatchedRoute* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_filePath.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - MatchedRoutePrototype__getFilePath(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_filePath.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void MatchedRoutePrototype__filePathSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_filePath.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue MatchedRoutePrototype__filePathGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_filePath.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(MatchedRoutePrototype__kindGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSMatchedRoute* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_kind.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - MatchedRoutePrototype__getKind(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_kind.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void MatchedRoutePrototype__kindSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_kind.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue MatchedRoutePrototype__kindGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_kind.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(MatchedRoutePrototype__nameGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSMatchedRoute* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_name.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - MatchedRoutePrototype__getName(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_name.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void MatchedRoutePrototype__nameSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_name.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue MatchedRoutePrototype__nameGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_name.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(MatchedRoutePrototype__paramsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSMatchedRoute* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_params.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - MatchedRoutePrototype__getParams(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_params.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void MatchedRoutePrototype__paramsSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_params.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue MatchedRoutePrototype__paramsGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_params.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(MatchedRoutePrototype__pathnameGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSMatchedRoute* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_pathname.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - MatchedRoutePrototype__getPathname(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_pathname.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void MatchedRoutePrototype__pathnameSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_pathname.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue MatchedRoutePrototype__pathnameGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_pathname.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(MatchedRoutePrototype__queryGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSMatchedRoute* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_query.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - MatchedRoutePrototype__getQuery(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_query.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void MatchedRoutePrototype__querySetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_query.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue MatchedRoutePrototype__queryGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_query.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(MatchedRoutePrototype__scriptSrcGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSMatchedRoute* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_scriptSrc.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - MatchedRoutePrototype__getScriptSrc(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_scriptSrc.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void MatchedRoutePrototype__scriptSrcSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_scriptSrc.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue MatchedRoutePrototype__scriptSrcGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_scriptSrc.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(MatchedRoutePrototype__srcGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSMatchedRoute* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_scriptSrc.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - MatchedRoutePrototype__getScriptSrc(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_scriptSrc.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void MatchedRoutePrototype__srcSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_scriptSrc.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue MatchedRoutePrototype__srcGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_scriptSrc.get()); -} - -void JSMatchedRoutePrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSMatchedRoute::info(), JSMatchedRoutePrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -JSMatchedRoute::~JSMatchedRoute() -{ - if (m_ctx) { - MatchedRouteClass__finalize(m_ctx); - } -} -void JSMatchedRoute::destroy(JSCell* cell) -{ - static_cast(cell)->JSMatchedRoute::~JSMatchedRoute(); -} - -const ClassInfo JSMatchedRoute::s_info = { "MatchedRoute"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMatchedRoute) }; - -void JSMatchedRoute::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSMatchedRoute* JSMatchedRoute::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSMatchedRoute* ptr = new (NotNull, JSC::allocateCell(vm)) JSMatchedRoute(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* MatchedRoute__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSMatchedRoute* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool MatchedRoute__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSMatchedRoute* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t MatchedRoute__ptrOffset = JSMatchedRoute::offsetOfWrapped(); - -void JSMatchedRoute::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSMatchedRoute::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSMatchedRoutePrototype::create(vm, globalObject, JSMatchedRoutePrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue MatchedRoute__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSMatchedRouteStructure(); - JSMatchedRoute* instance = JSMatchedRoute::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSMatchedRoute::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSMatchedRoute* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSMatchedRoute); - -template -void JSMatchedRoute::visitAdditionalChildren(Visitor& visitor) -{ - JSMatchedRoute* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_filePath); - visitor.append(thisObject->m_kind); - visitor.append(thisObject->m_name); - visitor.append(thisObject->m_params); - visitor.append(thisObject->m_pathname); - visitor.append(thisObject->m_query); - visitor.append(thisObject->m_scriptSrc); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSMatchedRoute); - -template -void JSMatchedRoute::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSMatchedRoute* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSMatchedRoute); -class JSNodeJSFSPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSNodeJSFSPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSNodeJSFSPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSNodeJSFSPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSNodeJSFSPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSNodeJSFSPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -class JSNodeJSFSConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSNodeJSFSConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSNodeJSFSPrototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForNodeJSFSConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForNodeJSFSConstructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForNodeJSFSConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForNodeJSFSConstructor = std::forward(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSNodeJSFSPrototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSNodeJSFSConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSNodeJSFSPrototype* prototype); -}; - -extern "C" void* NodeJSFSClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsNodeJSFSConstructor); - -extern "C" void NodeJSFSClass__finalize(void*); - -extern "C" EncodedJSValue NodeJSFSPrototype__access(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__accessCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__accessSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__accessSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__appendFile(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__appendFileCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__appendFileSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__appendFileSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__chmod(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__chmodCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__chmodSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__chmodSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__chown(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__chownCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__chownSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__chownSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__close(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__closeCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__closeSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__closeSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__copyFile(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__copyFileCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__copyFileSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__copyFileSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__cp(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__cpCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__cpSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__cpSyncCallback); - -extern "C" JSC::EncodedJSValue NodeJSFSPrototype__getDirent(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(NodeJSFSPrototype__DirentGetterWrap); - -extern "C" EncodedJSValue NodeJSFSPrototype__exists(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__existsCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__existsSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__existsSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__fchmod(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fchmodCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__fchmodSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fchmodSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__fchown(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fchownCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__fchownSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fchownSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__fdatasync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fdatasyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__fdatasyncSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fdatasyncSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__fstat(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fstatCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__fstatSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fstatSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__fsync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fsyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__fsyncSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fsyncSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__ftruncate(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__ftruncateCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__ftruncateSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__ftruncateSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__futimes(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__futimesCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__futimesSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__futimesSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__lchmod(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lchmodCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__lchmodSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lchmodSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__lchown(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lchownCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__lchownSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lchownSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__link(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__linkCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__linkSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__linkSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__lstat(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lstatCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__lstatSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lstatSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__lutimes(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lutimesCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__lutimesSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lutimesSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__mkdir(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__mkdirCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__mkdirSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__mkdirSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__mkdtemp(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__mkdtempCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__mkdtempSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__mkdtempSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__open(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__openCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__opendir(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__opendirCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__opendirSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__opendirSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__openSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__openSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__read(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__readdir(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readdirCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__readdirSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readdirSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__readFile(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readFileCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__readFileSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readFileSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__readlink(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readlinkCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__readlinkSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readlinkSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__readSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__readv(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readvCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__readvSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readvSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__realpath(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__realpathCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__realpathSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__realpathSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__rename(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__renameCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__renameSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__renameSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__rm(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__rmCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__rmdir(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__rmdirCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__rmdirSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__rmdirSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__rmSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__rmSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__stat(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__statCallback); - -extern "C" JSC::EncodedJSValue NodeJSFSPrototype__getStats(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(NodeJSFSPrototype__StatsGetterWrap); - -extern "C" EncodedJSValue NodeJSFSPrototype__statSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__statSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__symlink(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__symlinkCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__symlinkSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__symlinkSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__truncate(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__truncateCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__truncateSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__truncateSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__unlink(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__unlinkCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__unlinkSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__unlinkSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__unwatchFile(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__unwatchFileCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__utimes(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__utimesCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__utimesSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__utimesSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__watch(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__watchCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__watchFile(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__watchFileCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__write(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__writeCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__writeFile(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__writeFileCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__writeFileSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__writeFileSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__writeSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__writeSyncCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__writev(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__writevCallback); - -extern "C" EncodedJSValue NodeJSFSPrototype__writevSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__writevSyncCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSNodeJSFSPrototype, JSNodeJSFSPrototype::Base); - -static const HashTableValue JSNodeJSFSPrototypeTableValues[] = { - { "access"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__accessCallback, 3 } }, - { "accessSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__accessSyncCallback, 2 } }, - { "appendFile"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__appendFileCallback, 4 } }, - { "appendFileSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__appendFileSyncCallback, 3 } }, - { "chmod"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__chmodCallback, 3 } }, - { "chmodSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__chmodSyncCallback, 2 } }, - { "chown"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__chownCallback, 4 } }, - { "chownSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__chownSyncCallback, 3 } }, - { "close"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__closeCallback, 1 } }, - { "closeSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__closeSyncCallback, 1 } }, - { "copyFile"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__copyFileCallback, 4 } }, - { "copyFileSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__copyFileSyncCallback, 3 } }, - { "cp"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__cpCallback, 2 } }, - { "cpSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__cpSyncCallback, 2 } }, - { "Dirent"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, NodeJSFSPrototype__DirentGetterWrap, 0 } }, - { "exists"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__existsCallback, 2 } }, - { "existsSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__existsSyncCallback, 1 } }, - { "fchmod"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fchmodCallback, 3 } }, - { "fchmodSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fchmodSyncCallback, 2 } }, - { "fchown"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fchownCallback, 4 } }, - { "fchownSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fchownSyncCallback, 3 } }, - { "fdatasync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fdatasyncCallback, 2 } }, - { "fdatasyncSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fdatasyncSyncCallback, 1 } }, - { "fstat"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fstatCallback, 1 } }, - { "fstatSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fstatSyncCallback, 1 } }, - { "fsync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fsyncCallback, 2 } }, - { "fsyncSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fsyncSyncCallback, 1 } }, - { "ftruncate"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__ftruncateCallback, 1 } }, - { "ftruncateSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__ftruncateSyncCallback, 1 } }, - { "futimes"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__futimesCallback, 4 } }, - { "futimesSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__futimesSyncCallback, 3 } }, - { "lchmod"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lchmodCallback, 3 } }, - { "lchmodSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lchmodSyncCallback, 2 } }, - { "lchown"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lchownCallback, 4 } }, - { "lchownSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lchownSyncCallback, 3 } }, - { "link"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__linkCallback, 3 } }, - { "linkSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__linkSyncCallback, 2 } }, - { "lstat"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lstatCallback, 1 } }, - { "lstatSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lstatSyncCallback, 1 } }, - { "lutimes"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lutimesCallback, 4 } }, - { "lutimesSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lutimesSyncCallback, 3 } }, - { "mkdir"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__mkdirCallback, 3 } }, - { "mkdirSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__mkdirSyncCallback, 2 } }, - { "mkdtemp"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__mkdtempCallback, 3 } }, - { "mkdtempSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__mkdtempSyncCallback, 2 } }, - { "open"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__openCallback, 4 } }, - { "opendir"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__opendirCallback, 3 } }, - { "opendirSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__opendirSyncCallback, 2 } }, - { "openSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__openSyncCallback, 3 } }, - { "read"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readCallback, 6 } }, - { "readdir"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readdirCallback, 3 } }, - { "readdirSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readdirSyncCallback, 2 } }, - { "readFile"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readFileCallback, 3 } }, - { "readFileSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readFileSyncCallback, 2 } }, - { "readlink"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readlinkCallback, 3 } }, - { "readlinkSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readlinkSyncCallback, 2 } }, - { "readSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readSyncCallback, 5 } }, - { "readv"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readvCallback, 4 } }, - { "readvSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readvSyncCallback, 3 } }, - { "realpath"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__realpathCallback, 3 } }, - { "realpathSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__realpathSyncCallback, 2 } }, - { "rename"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__renameCallback, 3 } }, - { "renameSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__renameSyncCallback, 2 } }, - { "rm"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__rmCallback, 3 } }, - { "rmdir"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__rmdirCallback, 3 } }, - { "rmdirSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__rmdirSyncCallback, 2 } }, - { "rmSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__rmSyncCallback, 2 } }, - { "stat"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__statCallback, 1 } }, - { "Stats"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, NodeJSFSPrototype__StatsGetterWrap, 0 } }, - { "statSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__statSyncCallback, 1 } }, - { "symlink"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__symlinkCallback, 4 } }, - { "symlinkSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__symlinkSyncCallback, 3 } }, - { "truncate"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__truncateCallback, 3 } }, - { "truncateSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__truncateSyncCallback, 2 } }, - { "unlink"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__unlinkCallback, 2 } }, - { "unlinkSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__unlinkSyncCallback, 1 } }, - { "unwatchFile"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__unwatchFileCallback, 2 } }, - { "utimes"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__utimesCallback, 4 } }, - { "utimesSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__utimesSyncCallback, 3 } }, - { "watch"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__watchCallback, 3 } }, - { "watchFile"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__watchFileCallback, 3 } }, - { "write"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writeCallback, 6 } }, - { "writeFile"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writeFileCallback, 4 } }, - { "writeFileSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writeFileSyncCallback, 3 } }, - { "writeSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writeSyncCallback, 5 } }, - { "writev"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writevCallback, 4 } }, - { "writevSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writevSyncCallback, 3 } } -}; - -const ClassInfo JSNodeJSFSPrototype::s_info = { "NodeJSFS"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSNodeJSFSPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsNodeJSFSConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for NodeJSFS"_s); - return JSValue::encode(globalObject->JSNodeJSFSConstructor()); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__accessCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__access(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__accessSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__accessSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__appendFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__appendFile(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__appendFileSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__appendFileSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__chmodCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__chmod(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__chmodSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__chmodSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__chownCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__chown(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__chownSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__chownSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__closeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__close(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__closeSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__closeSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__copyFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__copyFile(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__copyFileSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__copyFileSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__cpCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__cp(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__cpSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__cpSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(NodeJSFSPrototype__DirentGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSNodeJSFS* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = NodeJSFSPrototype__getDirent(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__existsCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__exists(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__existsSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__existsSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fchmodCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__fchmod(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fchmodSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__fchmodSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fchownCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__fchown(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fchownSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__fchownSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fdatasyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__fdatasync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fdatasyncSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__fdatasyncSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fstatCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__fstat(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fstatSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__fstatSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fsyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__fsync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fsyncSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__fsyncSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__ftruncateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__ftruncate(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__ftruncateSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__ftruncateSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__futimesCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__futimes(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__futimesSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__futimesSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lchmodCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__lchmod(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lchmodSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__lchmodSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lchownCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__lchown(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lchownSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__lchownSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__linkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__link(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__linkSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__linkSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lstatCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__lstat(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lstatSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__lstatSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lutimesCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__lutimes(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lutimesSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__lutimesSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__mkdirCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__mkdir(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__mkdirSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__mkdirSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__mkdtempCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__mkdtemp(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__mkdtempSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__mkdtempSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__openCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__open(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__opendirCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__opendir(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__opendirSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__opendirSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__openSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__openSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__read(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readdirCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__readdir(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readdirSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__readdirSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__readFile(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readFileSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__readFileSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readlinkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__readlink(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readlinkSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__readlinkSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__readSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readvCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__readv(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readvSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__readvSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__realpathCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__realpath(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__realpathSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__realpathSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__renameCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__rename(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__renameSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__renameSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__rmCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__rm(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__rmdirCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__rmdir(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__rmdirSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__rmdirSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__rmSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__rmSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__statCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__stat(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(NodeJSFSPrototype__StatsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSNodeJSFS* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = NodeJSFSPrototype__getStats(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__statSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__statSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__symlinkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__symlink(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__symlinkSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__symlinkSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__truncateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__truncate(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__truncateSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__truncateSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__unlinkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__unlink(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__unlinkSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__unlinkSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__unwatchFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__unwatchFile(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__utimesCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__utimes(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__utimesSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__utimesSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__watchCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__watch(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__watchFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__watchFile(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__write(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writeFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__writeFile(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writeFileSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__writeFileSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writeSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__writeSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writevCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__writev(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writevSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof NodeJSFS"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return NodeJSFSPrototype__writevSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSNodeJSFSPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSNodeJSFS::info(), JSNodeJSFSPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -void JSNodeJSFSConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSNodeJSFSPrototype* prototype) -{ - Base::finishCreation(vm, 0, "NodeJSFS"_s, PropertyAdditionMode::WithoutStructureTransition); - - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} - -JSNodeJSFSConstructor::JSNodeJSFSConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} - -JSNodeJSFSConstructor* JSNodeJSFSConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSNodeJSFSPrototype* prototype) -{ - JSNodeJSFSConstructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSNodeJSFSConstructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSNodeJSFSConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) -{ - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); - JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSNodeJSFSConstructor(); - Structure* structure = globalObject->JSNodeJSFSStructure(); - if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); - - auto* functionGlobalObject = reinterpret_cast( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSNodeJSFSStructure()); - } - - void* ptr = NodeJSFSClass__construct(globalObject, callFrame); - - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); - } - - JSNodeJSFS* instance = JSNodeJSFS::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -void JSNodeJSFSConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSNodeJSFSPrototype* prototype) -{ -} - -const ClassInfo JSNodeJSFSConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSNodeJSFSConstructor) }; - -extern "C" EncodedJSValue NodeJSFS__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSNodeJSFSConstructor()); -} - -JSNodeJSFS::~JSNodeJSFS() -{ -} -void JSNodeJSFS::destroy(JSCell* cell) -{ - static_cast(cell)->JSNodeJSFS::~JSNodeJSFS(); -} - -const ClassInfo JSNodeJSFS::s_info = { "NodeJSFS"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSNodeJSFS) }; - -void JSNodeJSFS::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSNodeJSFS* JSNodeJSFS::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSNodeJSFS* ptr = new (NotNull, JSC::allocateCell(vm)) JSNodeJSFS(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* NodeJSFS__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSNodeJSFS* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool NodeJSFS__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSNodeJSFS* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t NodeJSFS__ptrOffset = JSNodeJSFS::offsetOfWrapped(); - -void JSNodeJSFS::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSNodeJSFS::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) -{ - return WebCore::JSNodeJSFSConstructor::create(vm, globalObject, WebCore::JSNodeJSFSConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast(prototype)); -} - -JSObject* JSNodeJSFS::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSNodeJSFSPrototype::create(vm, globalObject, JSNodeJSFSPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue NodeJSFS__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSNodeJSFSStructure(); - JSNodeJSFS* instance = JSNodeJSFS::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -class JSRequestPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSRequestPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSRequestPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSRequestPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSRequestPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSRequestPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -class JSRequestConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSRequestConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSRequestPrototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForRequestConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForRequestConstructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForRequestConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForRequestConstructor = std::forward(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSRequestPrototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSRequestConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSRequestPrototype* prototype); -}; - -extern "C" void* RequestClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsRequestConstructor); - -extern "C" void RequestClass__finalize(void*); - -extern "C" EncodedJSValue RequestPrototype__getArrayBuffer(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(RequestPrototype__arrayBufferCallback); - -extern "C" EncodedJSValue RequestPrototype__getBlob(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(RequestPrototype__blobCallback); - -extern "C" JSC::EncodedJSValue RequestPrototype__getBody(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__bodyGetterWrap); - -extern "C" JSC::EncodedJSValue RequestPrototype__getBodyUsed(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__bodyUsedGetterWrap); - -extern "C" JSC::EncodedJSValue RequestPrototype__getCache(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__cacheGetterWrap); - -extern "C" EncodedJSValue RequestPrototype__doClone(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(RequestPrototype__cloneCallback); - -extern "C" JSC::EncodedJSValue RequestPrototype__getCredentials(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__credentialsGetterWrap); - -extern "C" JSC::EncodedJSValue RequestPrototype__getDestination(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__destinationGetterWrap); - -extern "C" EncodedJSValue RequestPrototype__getFormData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(RequestPrototype__formDataCallback); - -extern "C" JSC::EncodedJSValue RequestPrototype__getHeaders(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__headersGetterWrap); - -extern "C" JSC::EncodedJSValue RequestPrototype__getIntegrity(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__integrityGetterWrap); - -extern "C" EncodedJSValue RequestPrototype__getJSON(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(RequestPrototype__jsonCallback); - -extern "C" JSC::EncodedJSValue RequestPrototype__getMethod(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__methodGetterWrap); - -extern "C" JSC::EncodedJSValue RequestPrototype__getMode(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__modeGetterWrap); - -extern "C" JSC::EncodedJSValue RequestPrototype__getRedirect(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__redirectGetterWrap); - -extern "C" JSC::EncodedJSValue RequestPrototype__getReferrer(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__referrerGetterWrap); - -extern "C" JSC::EncodedJSValue RequestPrototype__getReferrerPolicy(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__referrerPolicyGetterWrap); - -extern "C" JSC::EncodedJSValue RequestPrototype__getSignal(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__signalGetterWrap); - -extern "C" EncodedJSValue RequestPrototype__getText(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(RequestPrototype__textCallback); - -extern "C" JSC::EncodedJSValue RequestPrototype__getUrl(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__urlGetterWrap); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSRequestPrototype, JSRequestPrototype::Base); - -static const HashTableValue JSRequestPrototypeTableValues[] = { - { "arrayBuffer"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, RequestPrototype__arrayBufferCallback, 0 } }, - { "blob"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, RequestPrototype__blobCallback, 0 } }, - { "body"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__bodyGetterWrap, 0 } }, - { "bodyUsed"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__bodyUsedGetterWrap, 0 } }, - { "cache"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__cacheGetterWrap, 0 } }, - { "clone"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, RequestPrototype__cloneCallback, 1 } }, - { "credentials"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__credentialsGetterWrap, 0 } }, - { "destination"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__destinationGetterWrap, 0 } }, - { "formData"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, RequestPrototype__formDataCallback, 0 } }, - { "headers"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__headersGetterWrap, 0 } }, - { "integrity"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__integrityGetterWrap, 0 } }, - { "json"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, RequestPrototype__jsonCallback, 0 } }, - { "method"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__methodGetterWrap, 0 } }, - { "mode"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__modeGetterWrap, 0 } }, - { "redirect"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__redirectGetterWrap, 0 } }, - { "referrer"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__referrerGetterWrap, 0 } }, - { "referrerPolicy"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__referrerPolicyGetterWrap, 0 } }, - { "signal"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__signalGetterWrap, 0 } }, - { "text"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, RequestPrototype__textCallback, 0 } }, - { "url"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__urlGetterWrap, 0 } } -}; - -const ClassInfo JSRequestPrototype::s_info = { "Request"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSRequestPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsRequestConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for Request"_s); - return JSValue::encode(globalObject->JSRequestConstructor()); -} - -JSC_DEFINE_HOST_FUNCTION(RequestPrototype__arrayBufferCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSRequest* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Request"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return RequestPrototype__getArrayBuffer(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(RequestPrototype__blobCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSRequest* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Request"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return RequestPrototype__getBlob(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__bodyGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSRequest* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_body.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - RequestPrototype__getBody(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_body.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void RequestPrototype__bodySetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_body.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue RequestPrototype__bodyGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_body.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__bodyUsedGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSRequest* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = RequestPrototype__getBodyUsed(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__cacheGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSRequest* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = RequestPrototype__getCache(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(RequestPrototype__cloneCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSRequest* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Request"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return RequestPrototype__doClone(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__credentialsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSRequest* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = RequestPrototype__getCredentials(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__destinationGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSRequest* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = RequestPrototype__getDestination(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(RequestPrototype__formDataCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSRequest* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Request"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return RequestPrototype__getFormData(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__headersGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSRequest* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_headers.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - RequestPrototype__getHeaders(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_headers.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void RequestPrototype__headersSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_headers.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue RequestPrototype__headersGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_headers.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__integrityGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSRequest* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = RequestPrototype__getIntegrity(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(RequestPrototype__jsonCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSRequest* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Request"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return RequestPrototype__getJSON(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__methodGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSRequest* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = RequestPrototype__getMethod(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__modeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSRequest* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = RequestPrototype__getMode(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__redirectGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSRequest* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = RequestPrototype__getRedirect(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__referrerGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSRequest* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = RequestPrototype__getReferrer(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__referrerPolicyGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSRequest* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = RequestPrototype__getReferrerPolicy(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__signalGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSRequest* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_signal.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - RequestPrototype__getSignal(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_signal.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void RequestPrototype__signalSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_signal.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue RequestPrototype__signalGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_signal.get()); -} - -JSC_DEFINE_HOST_FUNCTION(RequestPrototype__textCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSRequest* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Request"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return RequestPrototype__getText(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__urlGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSRequest* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_url.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - RequestPrototype__getUrl(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_url.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void RequestPrototype__urlSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_url.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue RequestPrototype__urlGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_url.get()); -} - -void JSRequestPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSRequest::info(), JSRequestPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -extern "C" size_t Request__estimatedSize(void* ptr); - -void JSRequestConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSRequestPrototype* prototype) -{ - Base::finishCreation(vm, 0, "Request"_s, PropertyAdditionMode::WithoutStructureTransition); - - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} - -JSRequestConstructor::JSRequestConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} - -JSRequestConstructor* JSRequestConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSRequestPrototype* prototype) -{ - JSRequestConstructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSRequestConstructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSRequestConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) -{ - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); - JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSRequestConstructor(); - Structure* structure = globalObject->JSRequestStructure(); - if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); - - auto* functionGlobalObject = reinterpret_cast( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSRequestStructure()); - } - - void* ptr = RequestClass__construct(globalObject, callFrame); - - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); - } - - JSRequest* instance = JSRequest::create(vm, globalObject, structure, ptr); - vm.heap.reportExtraMemoryAllocated(instance, Request__estimatedSize(instance->wrapped())); - - return JSValue::encode(instance); -} - -void JSRequestConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSRequestPrototype* prototype) -{ -} - -const ClassInfo JSRequestConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSRequestConstructor) }; - -extern "C" EncodedJSValue Request__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSRequestConstructor()); -} - -JSRequest::~JSRequest() -{ - if (m_ctx) { - RequestClass__finalize(m_ctx); - } -} -void JSRequest::destroy(JSCell* cell) -{ - static_cast(cell)->JSRequest::~JSRequest(); -} - -const ClassInfo JSRequest::s_info = { "Request"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSRequest) }; - -void JSRequest::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSRequest* JSRequest::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSRequest* ptr = new (NotNull, JSC::allocateCell(vm)) JSRequest(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* Request__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSRequest* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool Request__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSRequest* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t Request__ptrOffset = JSRequest::offsetOfWrapped(); - -void JSRequest::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSRequest::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) -{ - return WebCore::JSRequestConstructor::create(vm, globalObject, WebCore::JSRequestConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast(prototype)); -} - -JSObject* JSRequest::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSRequestPrototype::create(vm, globalObject, JSRequestPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue Request__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSRequestStructure(); - JSRequest* instance = JSRequest::create(vm, globalObject, structure, ptr); - vm.heap.reportExtraMemoryAllocated(instance, Request__estimatedSize(ptr)); - return JSValue::encode(instance); -} - -template -void JSRequest::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSRequest* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - if (auto* ptr = thisObject->wrapped()) { - visitor.reportExtraMemoryVisited(Request__estimatedSize(ptr)); - } - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSRequest); - -template -void JSRequest::visitAdditionalChildren(Visitor& visitor) -{ - JSRequest* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_body); - visitor.append(thisObject->m_headers); - visitor.append(thisObject->m_signal); - visitor.append(thisObject->m_url); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSRequest); - -template -void JSRequest::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSRequest* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSRequest); -class JSResolveMessagePrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSResolveMessagePrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSResolveMessagePrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSResolveMessagePrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSResolveMessagePrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSResolveMessagePrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -class JSResolveMessageConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSResolveMessageConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSResolveMessagePrototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForResolveMessageConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForResolveMessageConstructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForResolveMessageConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForResolveMessageConstructor = std::forward(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSResolveMessagePrototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSResolveMessageConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSResolveMessagePrototype* prototype); -}; - -extern "C" void* ResolveMessageClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsResolveMessageConstructor); - -extern "C" void ResolveMessageClass__finalize(void*); - -extern "C" EncodedJSValue ResolveMessagePrototype__toPrimitive(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ResolveMessagePrototype__toPrimitiveCallback); - -extern "C" JSC::EncodedJSValue ResolveMessagePrototype__getCode(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ResolveMessagePrototype__codeGetterWrap); - -extern "C" JSC::EncodedJSValue ResolveMessagePrototype__getImportKind(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ResolveMessagePrototype__importKindGetterWrap); - -extern "C" JSC::EncodedJSValue ResolveMessagePrototype__getLevel(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ResolveMessagePrototype__levelGetterWrap); - -extern "C" JSC::EncodedJSValue ResolveMessagePrototype__getMessage(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ResolveMessagePrototype__messageGetterWrap); - -extern "C" JSC::EncodedJSValue ResolveMessagePrototype__getPosition(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ResolveMessagePrototype__positionGetterWrap); - -extern "C" JSC::EncodedJSValue ResolveMessagePrototype__getReferrer(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ResolveMessagePrototype__referrerGetterWrap); - -extern "C" JSC::EncodedJSValue ResolveMessagePrototype__getSpecifier(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ResolveMessagePrototype__specifierGetterWrap); - -extern "C" EncodedJSValue ResolveMessagePrototype__toJSON(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ResolveMessagePrototype__toJSONCallback); - -extern "C" EncodedJSValue ResolveMessagePrototype__toString(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ResolveMessagePrototype__toStringCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSResolveMessagePrototype, JSResolveMessagePrototype::Base); - -static const HashTableValue JSResolveMessagePrototypeTableValues[] = { - { "code"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResolveMessagePrototype__codeGetterWrap, 0 } }, - { "importKind"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResolveMessagePrototype__importKindGetterWrap, 0 } }, - { "level"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResolveMessagePrototype__levelGetterWrap, 0 } }, - { "message"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResolveMessagePrototype__messageGetterWrap, 0 } }, - { "position"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResolveMessagePrototype__positionGetterWrap, 0 } }, - { "referrer"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResolveMessagePrototype__referrerGetterWrap, 0 } }, - { "specifier"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResolveMessagePrototype__specifierGetterWrap, 0 } }, - { "toJSON"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResolveMessagePrototype__toJSONCallback, 0 } }, - { "toString"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResolveMessagePrototype__toStringCallback, 0 } } -}; - -const ClassInfo JSResolveMessagePrototype::s_info = { "ResolveMessage"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSResolveMessagePrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsResolveMessageConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for ResolveMessage"_s); - return JSValue::encode(globalObject->JSResolveMessageConstructor()); -} - -JSC_DEFINE_HOST_FUNCTION(ResolveMessagePrototype__toPrimitiveCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSResolveMessage* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof ResolveMessage"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ResolveMessagePrototype__toPrimitive(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(ResolveMessagePrototype__codeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSResolveMessage* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_code.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - ResolveMessagePrototype__getCode(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_code.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void ResolveMessagePrototype__codeSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_code.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue ResolveMessagePrototype__codeGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_code.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(ResolveMessagePrototype__importKindGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSResolveMessage* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_importKind.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - ResolveMessagePrototype__getImportKind(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_importKind.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void ResolveMessagePrototype__importKindSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_importKind.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue ResolveMessagePrototype__importKindGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_importKind.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(ResolveMessagePrototype__levelGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSResolveMessage* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_level.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - ResolveMessagePrototype__getLevel(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_level.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void ResolveMessagePrototype__levelSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_level.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue ResolveMessagePrototype__levelGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_level.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(ResolveMessagePrototype__messageGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSResolveMessage* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_message.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - ResolveMessagePrototype__getMessage(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_message.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void ResolveMessagePrototype__messageSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_message.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue ResolveMessagePrototype__messageGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_message.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(ResolveMessagePrototype__positionGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSResolveMessage* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_position.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - ResolveMessagePrototype__getPosition(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_position.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void ResolveMessagePrototype__positionSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_position.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue ResolveMessagePrototype__positionGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_position.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(ResolveMessagePrototype__referrerGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSResolveMessage* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_referrer.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - ResolveMessagePrototype__getReferrer(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_referrer.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void ResolveMessagePrototype__referrerSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_referrer.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue ResolveMessagePrototype__referrerGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_referrer.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(ResolveMessagePrototype__specifierGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSResolveMessage* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_specifier.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - ResolveMessagePrototype__getSpecifier(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_specifier.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void ResolveMessagePrototype__specifierSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_specifier.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue ResolveMessagePrototype__specifierGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_specifier.get()); -} - -JSC_DEFINE_HOST_FUNCTION(ResolveMessagePrototype__toJSONCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSResolveMessage* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof ResolveMessage"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ResolveMessagePrototype__toJSON(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ResolveMessagePrototype__toStringCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSResolveMessage* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof ResolveMessage"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ResolveMessagePrototype__toString(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSResolveMessagePrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSResolveMessage::info(), JSResolveMessagePrototypeTableValues, *this); - this->putDirect(vm, vm.propertyNames->toPrimitiveSymbol, JSFunction::create(vm, globalObject, 1, String("toPrimitive"_s), ResolveMessagePrototype__toPrimitiveCallback, ImplementationVisibility::Public), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | 0); - this->putDirect(vm, vm.propertyNames->name, jsString(vm, String("ResolveMessage"_s)), PropertyAttribute::ReadOnly | 0); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -void JSResolveMessageConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSResolveMessagePrototype* prototype) -{ - Base::finishCreation(vm, 0, "ResolveMessage"_s, PropertyAdditionMode::WithoutStructureTransition); - - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} - -JSResolveMessageConstructor::JSResolveMessageConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} - -JSResolveMessageConstructor* JSResolveMessageConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSResolveMessagePrototype* prototype) -{ - JSResolveMessageConstructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSResolveMessageConstructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSResolveMessageConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) -{ - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); - JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSResolveMessageConstructor(); - Structure* structure = globalObject->JSResolveMessageStructure(); - if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); - - auto* functionGlobalObject = reinterpret_cast( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSResolveMessageStructure()); - } - - void* ptr = ResolveMessageClass__construct(globalObject, callFrame); - - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); - } - - JSResolveMessage* instance = JSResolveMessage::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -void JSResolveMessageConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSResolveMessagePrototype* prototype) -{ -} - -const ClassInfo JSResolveMessageConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSResolveMessageConstructor) }; - -extern "C" EncodedJSValue ResolveMessage__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSResolveMessageConstructor()); -} - -JSResolveMessage::~JSResolveMessage() -{ - if (m_ctx) { - ResolveMessageClass__finalize(m_ctx); - } -} -void JSResolveMessage::destroy(JSCell* cell) -{ - static_cast(cell)->JSResolveMessage::~JSResolveMessage(); -} - -const ClassInfo JSResolveMessage::s_info = { "ResolveMessage"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSResolveMessage) }; - -void JSResolveMessage::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSResolveMessage* JSResolveMessage::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSResolveMessage* ptr = new (NotNull, JSC::allocateCell(vm)) JSResolveMessage(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* ResolveMessage__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSResolveMessage* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool ResolveMessage__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSResolveMessage* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t ResolveMessage__ptrOffset = JSResolveMessage::offsetOfWrapped(); - -void JSResolveMessage::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSResolveMessage::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) -{ - return WebCore::JSResolveMessageConstructor::create(vm, globalObject, WebCore::JSResolveMessageConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast(prototype)); -} - -JSObject* JSResolveMessage::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSResolveMessagePrototype::create(vm, globalObject, JSResolveMessagePrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue ResolveMessage__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSResolveMessageStructure(); - JSResolveMessage* instance = JSResolveMessage::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSResolveMessage::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSResolveMessage* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSResolveMessage); - -template -void JSResolveMessage::visitAdditionalChildren(Visitor& visitor) -{ - JSResolveMessage* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_code); - visitor.append(thisObject->m_importKind); - visitor.append(thisObject->m_level); - visitor.append(thisObject->m_message); - visitor.append(thisObject->m_position); - visitor.append(thisObject->m_referrer); - visitor.append(thisObject->m_specifier); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSResolveMessage); - -template -void JSResolveMessage::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSResolveMessage* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSResolveMessage); -class JSResponsePrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSResponsePrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSResponsePrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSResponsePrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSResponsePrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSResponsePrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -class JSResponseConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSResponseConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSResponsePrototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForResponseConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForResponseConstructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForResponseConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForResponseConstructor = std::forward(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSResponsePrototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSResponseConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSResponsePrototype* prototype); -}; - -extern "C" void* ResponseClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsResponseConstructor); - -extern "C" void ResponseClass__finalize(void*); - -extern "C" EncodedJSValue ResponsePrototype__getArrayBuffer(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ResponsePrototype__arrayBufferCallback); - -extern "C" EncodedJSValue ResponsePrototype__getBlob(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ResponsePrototype__blobCallback); - -extern "C" JSC::EncodedJSValue ResponsePrototype__getBody(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ResponsePrototype__bodyGetterWrap); - -extern "C" JSC::EncodedJSValue ResponsePrototype__getBodyUsed(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ResponsePrototype__bodyUsedGetterWrap); - -extern "C" EncodedJSValue ResponsePrototype__doClone(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ResponsePrototype__cloneCallback); - -extern "C" EncodedJSValue ResponsePrototype__getFormData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ResponsePrototype__formDataCallback); - -extern "C" JSC::EncodedJSValue ResponsePrototype__getHeaders(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ResponsePrototype__headersGetterWrap); - -extern "C" EncodedJSValue ResponsePrototype__getJSON(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ResponsePrototype__jsonCallback); - -extern "C" JSC::EncodedJSValue ResponsePrototype__getOK(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ResponsePrototype__okGetterWrap); - -extern "C" JSC::EncodedJSValue ResponsePrototype__getRedirected(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ResponsePrototype__redirectedGetterWrap); - -extern "C" JSC::EncodedJSValue ResponsePrototype__getStatus(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ResponsePrototype__statusGetterWrap); - -extern "C" JSC::EncodedJSValue ResponsePrototype__getStatusText(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ResponsePrototype__statusTextGetterWrap); - -extern "C" EncodedJSValue ResponsePrototype__getText(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ResponsePrototype__textCallback); - -extern "C" JSC::EncodedJSValue ResponsePrototype__getResponseType(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ResponsePrototype__typeGetterWrap); - -extern "C" JSC::EncodedJSValue ResponsePrototype__getURL(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ResponsePrototype__urlGetterWrap); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSResponsePrototype, JSResponsePrototype::Base); - -static const HashTableValue JSResponsePrototypeTableValues[] = { - { "arrayBuffer"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResponsePrototype__arrayBufferCallback, 0 } }, - { "blob"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResponsePrototype__blobCallback, 0 } }, - { "body"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResponsePrototype__bodyGetterWrap, 0 } }, - { "bodyUsed"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResponsePrototype__bodyUsedGetterWrap, 0 } }, - { "clone"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResponsePrototype__cloneCallback, 1 } }, - { "formData"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResponsePrototype__formDataCallback, 0 } }, - { "headers"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResponsePrototype__headersGetterWrap, 0 } }, - { "json"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResponsePrototype__jsonCallback, 0 } }, - { "ok"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResponsePrototype__okGetterWrap, 0 } }, - { "redirected"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResponsePrototype__redirectedGetterWrap, 0 } }, - { "status"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResponsePrototype__statusGetterWrap, 0 } }, - { "statusText"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResponsePrototype__statusTextGetterWrap, 0 } }, - { "text"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResponsePrototype__textCallback, 0 } }, - { "type"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResponsePrototype__typeGetterWrap, 0 } }, - { "url"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResponsePrototype__urlGetterWrap, 0 } } -}; - -const ClassInfo JSResponsePrototype::s_info = { "Response"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSResponsePrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsResponseConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for Response"_s); - return JSValue::encode(globalObject->JSResponseConstructor()); -} - -JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__arrayBufferCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSResponse* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Response"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ResponsePrototype__getArrayBuffer(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__blobCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSResponse* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Response"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ResponsePrototype__getBlob(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__bodyGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSResponse* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_body.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - ResponsePrototype__getBody(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_body.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void ResponsePrototype__bodySetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_body.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue ResponsePrototype__bodyGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_body.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__bodyUsedGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSResponse* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = ResponsePrototype__getBodyUsed(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__cloneCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSResponse* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Response"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ResponsePrototype__doClone(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__formDataCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSResponse* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Response"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ResponsePrototype__getFormData(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__headersGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSResponse* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_headers.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - ResponsePrototype__getHeaders(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_headers.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void ResponsePrototype__headersSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_headers.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue ResponsePrototype__headersGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_headers.get()); -} - -JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__jsonCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSResponse* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Response"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ResponsePrototype__getJSON(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__okGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSResponse* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = ResponsePrototype__getOK(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__redirectedGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSResponse* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = ResponsePrototype__getRedirected(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__statusGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSResponse* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = ResponsePrototype__getStatus(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__statusTextGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSResponse* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_statusText.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - ResponsePrototype__getStatusText(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_statusText.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void ResponsePrototype__statusTextSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_statusText.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue ResponsePrototype__statusTextGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_statusText.get()); -} - -JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__textCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSResponse* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Response"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ResponsePrototype__getText(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__typeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSResponse* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = ResponsePrototype__getResponseType(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__urlGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSResponse* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_url.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - ResponsePrototype__getURL(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_url.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void ResponsePrototype__urlSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_url.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue ResponsePrototype__urlGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_url.get()); -} - -void JSResponsePrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSResponse::info(), JSResponsePrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -extern "C" size_t Response__estimatedSize(void* ptr); -extern "C" JSC_DECLARE_HOST_FUNCTION(ResponseClass__constructError); -extern "C" JSC_DECLARE_HOST_FUNCTION(ResponseClass__constructJSON); -extern "C" JSC_DECLARE_HOST_FUNCTION(ResponseClass__constructRedirect); - -static const HashTableValue JSResponseConstructorTableValues[] = { - { "error"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResponseClass__constructError, 0 } }, - { "json"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResponseClass__constructJSON, 0 } }, - { "redirect"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResponseClass__constructRedirect, 0 } } -}; - -void JSResponseConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSResponsePrototype* prototype) -{ - Base::finishCreation(vm, 0, "Response"_s, PropertyAdditionMode::WithoutStructureTransition); - reifyStaticProperties(vm, &JSResponseConstructor::s_info, JSResponseConstructorTableValues, *this); - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} - -JSResponseConstructor::JSResponseConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} - -JSResponseConstructor* JSResponseConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSResponsePrototype* prototype) -{ - JSResponseConstructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSResponseConstructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSResponseConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) -{ - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); - JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSResponseConstructor(); - Structure* structure = globalObject->JSResponseStructure(); - if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); - - auto* functionGlobalObject = reinterpret_cast( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSResponseStructure()); - } - - void* ptr = ResponseClass__construct(globalObject, callFrame); - - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); - } - - JSResponse* instance = JSResponse::create(vm, globalObject, structure, ptr); - vm.heap.reportExtraMemoryAllocated(instance, Response__estimatedSize(instance->wrapped())); - - return JSValue::encode(instance); -} - -void JSResponseConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSResponsePrototype* prototype) -{ -} - -const ClassInfo JSResponseConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSResponseConstructor) }; - -extern "C" EncodedJSValue Response__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSResponseConstructor()); -} - -JSResponse::~JSResponse() -{ - if (m_ctx) { - ResponseClass__finalize(m_ctx); - } -} -void JSResponse::destroy(JSCell* cell) -{ - static_cast(cell)->JSResponse::~JSResponse(); -} - -const ClassInfo JSResponse::s_info = { "Response"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSResponse) }; - -void JSResponse::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSResponse* JSResponse::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSResponse* ptr = new (NotNull, JSC::allocateCell(vm)) JSResponse(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* Response__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSResponse* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool Response__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSResponse* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t Response__ptrOffset = JSResponse::offsetOfWrapped(); - -void JSResponse::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSResponse::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) -{ - return WebCore::JSResponseConstructor::create(vm, globalObject, WebCore::JSResponseConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast(prototype)); -} - -JSObject* JSResponse::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSResponsePrototype::create(vm, globalObject, JSResponsePrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue Response__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSResponseStructure(); - JSResponse* instance = JSResponse::create(vm, globalObject, structure, ptr); - vm.heap.reportExtraMemoryAllocated(instance, Response__estimatedSize(ptr)); - return JSValue::encode(instance); -} - -template -void JSResponse::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSResponse* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - if (auto* ptr = thisObject->wrapped()) { - visitor.reportExtraMemoryVisited(Response__estimatedSize(ptr)); - } - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSResponse); - -template -void JSResponse::visitAdditionalChildren(Visitor& visitor) -{ - JSResponse* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_body); - visitor.append(thisObject->m_headers); - visitor.append(thisObject->m_statusText); - visitor.append(thisObject->m_url); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSResponse); - -template -void JSResponse::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSResponse* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSResponse); -class JSSHA1Prototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSSHA1Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSSHA1Prototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSSHA1Prototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA1Prototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSSHA1Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -class JSSHA1Constructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSSHA1Constructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA1Prototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA1Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA1Constructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA1Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA1Constructor = std::forward(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSSHA1Prototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSSHA1Constructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSSHA1Prototype* prototype); -}; - -extern "C" void* SHA1Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsSHA1Constructor); - -extern "C" void SHA1Class__finalize(void*); - -extern "C" JSC::EncodedJSValue SHA1Prototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(SHA1Prototype__byteLengthGetterWrap); - -extern "C" EncodedJSValue SHA1Prototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(SHA1Prototype__digestCallback); - -extern "C" EncodedJSValue SHA1Prototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(SHA1Prototype__updateCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA1Prototype, JSSHA1Prototype::Base); - -static const HashTableValue JSSHA1PrototypeTableValues[] = { - { "byteLength"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA1Prototype__byteLengthGetterWrap, 0 } }, - { "digest"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA1Prototype__digestCallback, 0 } }, - { "update"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA1Prototype__updateCallback, 1 } } -}; - -const ClassInfo JSSHA1Prototype::s_info = { "SHA1"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA1Prototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsSHA1Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for SHA1"_s); - return JSValue::encode(globalObject->JSSHA1Constructor()); -} - -JSC_DEFINE_CUSTOM_GETTER(SHA1Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSHA1* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = SHA1Prototype__getByteLength(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(SHA1Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSSHA1* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof SHA1"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return SHA1Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(SHA1Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSSHA1* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof SHA1"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return SHA1Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSSHA1Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSSHA1::info(), JSSHA1PrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -extern "C" JSC_DECLARE_CUSTOM_GETTER(SHA1Class__getByteLengthStatic); -extern "C" JSC_DECLARE_HOST_FUNCTION(SHA1Class__hash); - -static const HashTableValue JSSHA1ConstructorTableValues[] = { - { "byteLength"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA1Class__getByteLengthStatic, 0 } }, - { "hash"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA1Class__hash, 2 } } -}; - -void JSSHA1Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA1Prototype* prototype) -{ - Base::finishCreation(vm, 0, "SHA1"_s, PropertyAdditionMode::WithoutStructureTransition); - reifyStaticProperties(vm, &JSSHA1Constructor::s_info, JSSHA1ConstructorTableValues, *this); - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} - -JSSHA1Constructor::JSSHA1Constructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} - -JSSHA1Constructor* JSSHA1Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA1Prototype* prototype) -{ - JSSHA1Constructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSSHA1Constructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA1Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) -{ - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); - JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSSHA1Constructor(); - Structure* structure = globalObject->JSSHA1Structure(); - if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); - - auto* functionGlobalObject = reinterpret_cast( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSSHA1Structure()); - } - - void* ptr = SHA1Class__construct(globalObject, callFrame); - - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); - } - - JSSHA1* instance = JSSHA1::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -void JSSHA1Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA1Prototype* prototype) -{ -} - -const ClassInfo JSSHA1Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA1Constructor) }; - -extern "C" EncodedJSValue SHA1__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSSHA1Constructor()); -} - -JSSHA1::~JSSHA1() -{ - if (m_ctx) { - SHA1Class__finalize(m_ctx); - } -} -void JSSHA1::destroy(JSCell* cell) -{ - static_cast(cell)->JSSHA1::~JSSHA1(); -} - -const ClassInfo JSSHA1::s_info = { "SHA1"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA1) }; - -void JSSHA1::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSSHA1* JSSHA1::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSSHA1* ptr = new (NotNull, JSC::allocateCell(vm)) JSSHA1(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* SHA1__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSSHA1* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool SHA1__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSSHA1* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t SHA1__ptrOffset = JSSHA1::offsetOfWrapped(); - -void JSSHA1::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSSHA1::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) -{ - return WebCore::JSSHA1Constructor::create(vm, globalObject, WebCore::JSSHA1Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast(prototype)); -} - -JSObject* JSSHA1::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSSHA1Prototype::create(vm, globalObject, JSSHA1Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue SHA1__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSSHA1Structure(); - JSSHA1* instance = JSSHA1::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -class JSSHA224Prototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSSHA224Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSSHA224Prototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSSHA224Prototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA224Prototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSSHA224Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -class JSSHA224Constructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSSHA224Constructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA224Prototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA224Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA224Constructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA224Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA224Constructor = std::forward(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSSHA224Prototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSSHA224Constructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSSHA224Prototype* prototype); -}; - -extern "C" void* SHA224Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsSHA224Constructor); - -extern "C" void SHA224Class__finalize(void*); - -extern "C" JSC::EncodedJSValue SHA224Prototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(SHA224Prototype__byteLengthGetterWrap); - -extern "C" EncodedJSValue SHA224Prototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(SHA224Prototype__digestCallback); - -extern "C" EncodedJSValue SHA224Prototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(SHA224Prototype__updateCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA224Prototype, JSSHA224Prototype::Base); - -static const HashTableValue JSSHA224PrototypeTableValues[] = { - { "byteLength"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA224Prototype__byteLengthGetterWrap, 0 } }, - { "digest"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA224Prototype__digestCallback, 0 } }, - { "update"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA224Prototype__updateCallback, 1 } } -}; - -const ClassInfo JSSHA224Prototype::s_info = { "SHA224"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA224Prototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsSHA224Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for SHA224"_s); - return JSValue::encode(globalObject->JSSHA224Constructor()); -} - -JSC_DEFINE_CUSTOM_GETTER(SHA224Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSHA224* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = SHA224Prototype__getByteLength(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(SHA224Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSSHA224* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof SHA224"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return SHA224Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(SHA224Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSSHA224* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof SHA224"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return SHA224Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSSHA224Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSSHA224::info(), JSSHA224PrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -extern "C" JSC_DECLARE_CUSTOM_GETTER(SHA224Class__getByteLengthStatic); -extern "C" JSC_DECLARE_HOST_FUNCTION(SHA224Class__hash); - -static const HashTableValue JSSHA224ConstructorTableValues[] = { - { "byteLength"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA224Class__getByteLengthStatic, 0 } }, - { "hash"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA224Class__hash, 2 } } -}; - -void JSSHA224Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA224Prototype* prototype) -{ - Base::finishCreation(vm, 0, "SHA224"_s, PropertyAdditionMode::WithoutStructureTransition); - reifyStaticProperties(vm, &JSSHA224Constructor::s_info, JSSHA224ConstructorTableValues, *this); - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} - -JSSHA224Constructor::JSSHA224Constructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} - -JSSHA224Constructor* JSSHA224Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA224Prototype* prototype) -{ - JSSHA224Constructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSSHA224Constructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA224Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) -{ - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); - JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSSHA224Constructor(); - Structure* structure = globalObject->JSSHA224Structure(); - if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); - - auto* functionGlobalObject = reinterpret_cast( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSSHA224Structure()); - } - - void* ptr = SHA224Class__construct(globalObject, callFrame); - - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); - } - - JSSHA224* instance = JSSHA224::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -void JSSHA224Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA224Prototype* prototype) -{ -} - -const ClassInfo JSSHA224Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA224Constructor) }; - -extern "C" EncodedJSValue SHA224__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSSHA224Constructor()); -} - -JSSHA224::~JSSHA224() -{ - if (m_ctx) { - SHA224Class__finalize(m_ctx); - } -} -void JSSHA224::destroy(JSCell* cell) -{ - static_cast(cell)->JSSHA224::~JSSHA224(); -} - -const ClassInfo JSSHA224::s_info = { "SHA224"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA224) }; - -void JSSHA224::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSSHA224* JSSHA224::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSSHA224* ptr = new (NotNull, JSC::allocateCell(vm)) JSSHA224(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* SHA224__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSSHA224* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool SHA224__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSSHA224* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t SHA224__ptrOffset = JSSHA224::offsetOfWrapped(); - -void JSSHA224::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSSHA224::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) -{ - return WebCore::JSSHA224Constructor::create(vm, globalObject, WebCore::JSSHA224Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast(prototype)); -} - -JSObject* JSSHA224::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSSHA224Prototype::create(vm, globalObject, JSSHA224Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue SHA224__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSSHA224Structure(); - JSSHA224* instance = JSSHA224::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -class JSSHA256Prototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSSHA256Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSSHA256Prototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSSHA256Prototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA256Prototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSSHA256Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -class JSSHA256Constructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSSHA256Constructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA256Prototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA256Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA256Constructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA256Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA256Constructor = std::forward(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSSHA256Prototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSSHA256Constructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSSHA256Prototype* prototype); -}; - -extern "C" void* SHA256Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsSHA256Constructor); - -extern "C" void SHA256Class__finalize(void*); - -extern "C" JSC::EncodedJSValue SHA256Prototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(SHA256Prototype__byteLengthGetterWrap); - -extern "C" EncodedJSValue SHA256Prototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(SHA256Prototype__digestCallback); - -extern "C" EncodedJSValue SHA256Prototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(SHA256Prototype__updateCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA256Prototype, JSSHA256Prototype::Base); - -static const HashTableValue JSSHA256PrototypeTableValues[] = { - { "byteLength"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA256Prototype__byteLengthGetterWrap, 0 } }, - { "digest"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA256Prototype__digestCallback, 0 } }, - { "update"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA256Prototype__updateCallback, 1 } } -}; - -const ClassInfo JSSHA256Prototype::s_info = { "SHA256"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA256Prototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsSHA256Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for SHA256"_s); - return JSValue::encode(globalObject->JSSHA256Constructor()); -} - -JSC_DEFINE_CUSTOM_GETTER(SHA256Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSHA256* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = SHA256Prototype__getByteLength(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(SHA256Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSSHA256* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof SHA256"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return SHA256Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(SHA256Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSSHA256* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof SHA256"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return SHA256Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSSHA256Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSSHA256::info(), JSSHA256PrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -extern "C" JSC_DECLARE_CUSTOM_GETTER(SHA256Class__getByteLengthStatic); -extern "C" JSC_DECLARE_HOST_FUNCTION(SHA256Class__hash); - -static const HashTableValue JSSHA256ConstructorTableValues[] = { - { "byteLength"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA256Class__getByteLengthStatic, 0 } }, - { "hash"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA256Class__hash, 2 } } -}; - -void JSSHA256Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA256Prototype* prototype) -{ - Base::finishCreation(vm, 0, "SHA256"_s, PropertyAdditionMode::WithoutStructureTransition); - reifyStaticProperties(vm, &JSSHA256Constructor::s_info, JSSHA256ConstructorTableValues, *this); - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} - -JSSHA256Constructor::JSSHA256Constructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} - -JSSHA256Constructor* JSSHA256Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA256Prototype* prototype) -{ - JSSHA256Constructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSSHA256Constructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA256Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) -{ - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); - JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSSHA256Constructor(); - Structure* structure = globalObject->JSSHA256Structure(); - if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); - - auto* functionGlobalObject = reinterpret_cast( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSSHA256Structure()); - } - - void* ptr = SHA256Class__construct(globalObject, callFrame); - - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); - } - - JSSHA256* instance = JSSHA256::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -void JSSHA256Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA256Prototype* prototype) -{ -} - -const ClassInfo JSSHA256Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA256Constructor) }; - -extern "C" EncodedJSValue SHA256__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSSHA256Constructor()); -} - -JSSHA256::~JSSHA256() -{ - if (m_ctx) { - SHA256Class__finalize(m_ctx); - } -} -void JSSHA256::destroy(JSCell* cell) -{ - static_cast(cell)->JSSHA256::~JSSHA256(); -} - -const ClassInfo JSSHA256::s_info = { "SHA256"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA256) }; - -void JSSHA256::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSSHA256* JSSHA256::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSSHA256* ptr = new (NotNull, JSC::allocateCell(vm)) JSSHA256(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* SHA256__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSSHA256* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool SHA256__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSSHA256* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t SHA256__ptrOffset = JSSHA256::offsetOfWrapped(); - -void JSSHA256::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSSHA256::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) -{ - return WebCore::JSSHA256Constructor::create(vm, globalObject, WebCore::JSSHA256Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast(prototype)); -} - -JSObject* JSSHA256::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSSHA256Prototype::create(vm, globalObject, JSSHA256Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue SHA256__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSSHA256Structure(); - JSSHA256* instance = JSSHA256::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -class JSSHA384Prototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSSHA384Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSSHA384Prototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSSHA384Prototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA384Prototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSSHA384Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -class JSSHA384Constructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSSHA384Constructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA384Prototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA384Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA384Constructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA384Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA384Constructor = std::forward(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSSHA384Prototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSSHA384Constructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSSHA384Prototype* prototype); -}; - -extern "C" void* SHA384Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsSHA384Constructor); - -extern "C" void SHA384Class__finalize(void*); - -extern "C" JSC::EncodedJSValue SHA384Prototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(SHA384Prototype__byteLengthGetterWrap); - -extern "C" EncodedJSValue SHA384Prototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(SHA384Prototype__digestCallback); - -extern "C" EncodedJSValue SHA384Prototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(SHA384Prototype__updateCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA384Prototype, JSSHA384Prototype::Base); - -static const HashTableValue JSSHA384PrototypeTableValues[] = { - { "byteLength"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA384Prototype__byteLengthGetterWrap, 0 } }, - { "digest"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA384Prototype__digestCallback, 0 } }, - { "update"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA384Prototype__updateCallback, 1 } } -}; - -const ClassInfo JSSHA384Prototype::s_info = { "SHA384"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA384Prototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsSHA384Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for SHA384"_s); - return JSValue::encode(globalObject->JSSHA384Constructor()); -} - -JSC_DEFINE_CUSTOM_GETTER(SHA384Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSHA384* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = SHA384Prototype__getByteLength(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(SHA384Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSSHA384* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof SHA384"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return SHA384Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(SHA384Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSSHA384* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof SHA384"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return SHA384Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSSHA384Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSSHA384::info(), JSSHA384PrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -extern "C" JSC_DECLARE_CUSTOM_GETTER(SHA384Class__getByteLengthStatic); -extern "C" JSC_DECLARE_HOST_FUNCTION(SHA384Class__hash); - -static const HashTableValue JSSHA384ConstructorTableValues[] = { - { "byteLength"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA384Class__getByteLengthStatic, 0 } }, - { "hash"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA384Class__hash, 2 } } -}; - -void JSSHA384Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA384Prototype* prototype) -{ - Base::finishCreation(vm, 0, "SHA384"_s, PropertyAdditionMode::WithoutStructureTransition); - reifyStaticProperties(vm, &JSSHA384Constructor::s_info, JSSHA384ConstructorTableValues, *this); - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} - -JSSHA384Constructor::JSSHA384Constructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} - -JSSHA384Constructor* JSSHA384Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA384Prototype* prototype) -{ - JSSHA384Constructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSSHA384Constructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA384Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) -{ - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); - JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSSHA384Constructor(); - Structure* structure = globalObject->JSSHA384Structure(); - if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); - - auto* functionGlobalObject = reinterpret_cast( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSSHA384Structure()); - } - - void* ptr = SHA384Class__construct(globalObject, callFrame); - - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); - } - - JSSHA384* instance = JSSHA384::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -void JSSHA384Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA384Prototype* prototype) -{ -} - -const ClassInfo JSSHA384Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA384Constructor) }; - -extern "C" EncodedJSValue SHA384__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSSHA384Constructor()); -} - -JSSHA384::~JSSHA384() -{ - if (m_ctx) { - SHA384Class__finalize(m_ctx); - } -} -void JSSHA384::destroy(JSCell* cell) -{ - static_cast(cell)->JSSHA384::~JSSHA384(); -} - -const ClassInfo JSSHA384::s_info = { "SHA384"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA384) }; - -void JSSHA384::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSSHA384* JSSHA384::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSSHA384* ptr = new (NotNull, JSC::allocateCell(vm)) JSSHA384(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* SHA384__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSSHA384* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool SHA384__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSSHA384* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t SHA384__ptrOffset = JSSHA384::offsetOfWrapped(); - -void JSSHA384::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSSHA384::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) -{ - return WebCore::JSSHA384Constructor::create(vm, globalObject, WebCore::JSSHA384Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast(prototype)); -} - -JSObject* JSSHA384::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSSHA384Prototype::create(vm, globalObject, JSSHA384Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue SHA384__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSSHA384Structure(); - JSSHA384* instance = JSSHA384::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -class JSSHA512Prototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSSHA512Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSSHA512Prototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSSHA512Prototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA512Prototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSSHA512Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -class JSSHA512Constructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSSHA512Constructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA512Prototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA512Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA512Constructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA512Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA512Constructor = std::forward(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSSHA512Prototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSSHA512Constructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSSHA512Prototype* prototype); -}; - -extern "C" void* SHA512Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsSHA512Constructor); - -extern "C" void SHA512Class__finalize(void*); - -extern "C" JSC::EncodedJSValue SHA512Prototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(SHA512Prototype__byteLengthGetterWrap); - -extern "C" EncodedJSValue SHA512Prototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(SHA512Prototype__digestCallback); - -extern "C" EncodedJSValue SHA512Prototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(SHA512Prototype__updateCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA512Prototype, JSSHA512Prototype::Base); - -static const HashTableValue JSSHA512PrototypeTableValues[] = { - { "byteLength"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA512Prototype__byteLengthGetterWrap, 0 } }, - { "digest"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512Prototype__digestCallback, 0 } }, - { "update"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512Prototype__updateCallback, 1 } } -}; - -const ClassInfo JSSHA512Prototype::s_info = { "SHA512"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512Prototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsSHA512Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for SHA512"_s); - return JSValue::encode(globalObject->JSSHA512Constructor()); -} - -JSC_DEFINE_CUSTOM_GETTER(SHA512Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSHA512* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = SHA512Prototype__getByteLength(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(SHA512Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSSHA512* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof SHA512"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return SHA512Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(SHA512Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSSHA512* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof SHA512"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return SHA512Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSSHA512Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSSHA512::info(), JSSHA512PrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -extern "C" JSC_DECLARE_CUSTOM_GETTER(SHA512Class__getByteLengthStatic); -extern "C" JSC_DECLARE_HOST_FUNCTION(SHA512Class__hash); - -static const HashTableValue JSSHA512ConstructorTableValues[] = { - { "byteLength"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA512Class__getByteLengthStatic, 0 } }, - { "hash"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512Class__hash, 2 } } -}; - -void JSSHA512Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA512Prototype* prototype) -{ - Base::finishCreation(vm, 0, "SHA512"_s, PropertyAdditionMode::WithoutStructureTransition); - reifyStaticProperties(vm, &JSSHA512Constructor::s_info, JSSHA512ConstructorTableValues, *this); - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} - -JSSHA512Constructor::JSSHA512Constructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} - -JSSHA512Constructor* JSSHA512Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA512Prototype* prototype) -{ - JSSHA512Constructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSSHA512Constructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA512Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) -{ - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); - JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSSHA512Constructor(); - Structure* structure = globalObject->JSSHA512Structure(); - if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); - - auto* functionGlobalObject = reinterpret_cast( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSSHA512Structure()); - } - - void* ptr = SHA512Class__construct(globalObject, callFrame); - - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); - } - - JSSHA512* instance = JSSHA512::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -void JSSHA512Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA512Prototype* prototype) -{ -} - -const ClassInfo JSSHA512Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512Constructor) }; - -extern "C" EncodedJSValue SHA512__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSSHA512Constructor()); -} - -JSSHA512::~JSSHA512() -{ - if (m_ctx) { - SHA512Class__finalize(m_ctx); - } -} -void JSSHA512::destroy(JSCell* cell) -{ - static_cast(cell)->JSSHA512::~JSSHA512(); -} - -const ClassInfo JSSHA512::s_info = { "SHA512"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512) }; - -void JSSHA512::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSSHA512* JSSHA512::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSSHA512* ptr = new (NotNull, JSC::allocateCell(vm)) JSSHA512(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* SHA512__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSSHA512* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool SHA512__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSSHA512* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t SHA512__ptrOffset = JSSHA512::offsetOfWrapped(); - -void JSSHA512::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSSHA512::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) -{ - return WebCore::JSSHA512Constructor::create(vm, globalObject, WebCore::JSSHA512Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast(prototype)); -} - -JSObject* JSSHA512::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSSHA512Prototype::create(vm, globalObject, JSSHA512Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue SHA512__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSSHA512Structure(); - JSSHA512* instance = JSSHA512::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -class JSSHA512_256Prototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSSHA512_256Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSSHA512_256Prototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSSHA512_256Prototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA512_256Prototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSSHA512_256Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -class JSSHA512_256Constructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSSHA512_256Constructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA512_256Prototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA512_256Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA512_256Constructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA512_256Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA512_256Constructor = std::forward(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSSHA512_256Prototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSSHA512_256Constructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSSHA512_256Prototype* prototype); -}; - -extern "C" void* SHA512_256Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsSHA512_256Constructor); - -extern "C" void SHA512_256Class__finalize(void*); - -extern "C" JSC::EncodedJSValue SHA512_256Prototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(SHA512_256Prototype__byteLengthGetterWrap); - -extern "C" EncodedJSValue SHA512_256Prototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(SHA512_256Prototype__digestCallback); - -extern "C" EncodedJSValue SHA512_256Prototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(SHA512_256Prototype__updateCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA512_256Prototype, JSSHA512_256Prototype::Base); - -static const HashTableValue JSSHA512_256PrototypeTableValues[] = { - { "byteLength"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA512_256Prototype__byteLengthGetterWrap, 0 } }, - { "digest"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512_256Prototype__digestCallback, 0 } }, - { "update"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512_256Prototype__updateCallback, 1 } } -}; - -const ClassInfo JSSHA512_256Prototype::s_info = { "SHA512_256"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512_256Prototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsSHA512_256Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for SHA512_256"_s); - return JSValue::encode(globalObject->JSSHA512_256Constructor()); -} - -JSC_DEFINE_CUSTOM_GETTER(SHA512_256Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSHA512_256* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = SHA512_256Prototype__getByteLength(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(SHA512_256Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSSHA512_256* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof SHA512_256"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return SHA512_256Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(SHA512_256Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSSHA512_256* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof SHA512_256"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return SHA512_256Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSSHA512_256Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSSHA512_256::info(), JSSHA512_256PrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -extern "C" JSC_DECLARE_CUSTOM_GETTER(SHA512_256Class__getByteLengthStatic); -extern "C" JSC_DECLARE_HOST_FUNCTION(SHA512_256Class__hash); - -static const HashTableValue JSSHA512_256ConstructorTableValues[] = { - { "byteLength"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA512_256Class__getByteLengthStatic, 0 } }, - { "hash"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512_256Class__hash, 2 } } -}; - -void JSSHA512_256Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA512_256Prototype* prototype) -{ - Base::finishCreation(vm, 0, "SHA512_256"_s, PropertyAdditionMode::WithoutStructureTransition); - reifyStaticProperties(vm, &JSSHA512_256Constructor::s_info, JSSHA512_256ConstructorTableValues, *this); - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} - -JSSHA512_256Constructor::JSSHA512_256Constructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} - -JSSHA512_256Constructor* JSSHA512_256Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA512_256Prototype* prototype) -{ - JSSHA512_256Constructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSSHA512_256Constructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA512_256Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) -{ - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); - JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSSHA512_256Constructor(); - Structure* structure = globalObject->JSSHA512_256Structure(); - if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); - - auto* functionGlobalObject = reinterpret_cast( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSSHA512_256Structure()); - } - - void* ptr = SHA512_256Class__construct(globalObject, callFrame); - - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); - } - - JSSHA512_256* instance = JSSHA512_256::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -void JSSHA512_256Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA512_256Prototype* prototype) -{ -} - -const ClassInfo JSSHA512_256Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512_256Constructor) }; - -extern "C" EncodedJSValue SHA512_256__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSSHA512_256Constructor()); -} - -JSSHA512_256::~JSSHA512_256() -{ - if (m_ctx) { - SHA512_256Class__finalize(m_ctx); - } -} -void JSSHA512_256::destroy(JSCell* cell) -{ - static_cast(cell)->JSSHA512_256::~JSSHA512_256(); -} - -const ClassInfo JSSHA512_256::s_info = { "SHA512_256"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512_256) }; - -void JSSHA512_256::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSSHA512_256* JSSHA512_256::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSSHA512_256* ptr = new (NotNull, JSC::allocateCell(vm)) JSSHA512_256(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* SHA512_256__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSSHA512_256* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool SHA512_256__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSSHA512_256* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t SHA512_256__ptrOffset = JSSHA512_256::offsetOfWrapped(); - -void JSSHA512_256::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSSHA512_256::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) -{ - return WebCore::JSSHA512_256Constructor::create(vm, globalObject, WebCore::JSSHA512_256Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast(prototype)); -} - -JSObject* JSSHA512_256::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSSHA512_256Prototype::create(vm, globalObject, JSSHA512_256Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue SHA512_256__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSSHA512_256Structure(); - JSSHA512_256* instance = JSSHA512_256::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -class JSServerWebSocketPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSServerWebSocketPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSServerWebSocketPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSServerWebSocketPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSServerWebSocketPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSServerWebSocketPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -class JSServerWebSocketConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSServerWebSocketConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSServerWebSocketPrototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForServerWebSocketConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForServerWebSocketConstructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForServerWebSocketConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForServerWebSocketConstructor = std::forward(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSServerWebSocketPrototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSServerWebSocketConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSServerWebSocketPrototype* prototype); -}; - -extern "C" void* ServerWebSocketClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsServerWebSocketConstructor); - -extern "C" void ServerWebSocketClass__finalize(void*); - -extern "C" JSC::EncodedJSValue ServerWebSocketPrototype__getBinaryType(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ServerWebSocketPrototype__binaryTypeGetterWrap); - -extern "C" bool ServerWebSocketPrototype__setBinaryType(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::EncodedJSValue value); -JSC_DECLARE_CUSTOM_SETTER(ServerWebSocketPrototype__binaryTypeSetterWrap); - -extern "C" EncodedJSValue ServerWebSocketPrototype__close(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__closeCallback); - -extern "C" EncodedJSValue ServerWebSocketPrototype__cork(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__corkCallback); - -extern "C" JSC::EncodedJSValue ServerWebSocketPrototype__getData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ServerWebSocketPrototype__dataGetterWrap); - -extern "C" bool ServerWebSocketPrototype__setData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::EncodedJSValue value); -JSC_DECLARE_CUSTOM_SETTER(ServerWebSocketPrototype__dataSetterWrap); - -extern "C" EncodedJSValue ServerWebSocketPrototype__getBufferedAmount(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__getBufferedAmountCallback); - -extern "C" EncodedJSValue ServerWebSocketPrototype__isSubscribed(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__isSubscribedCallback); - -extern "C" EncodedJSValue ServerWebSocketPrototype__ping(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__pingCallback); - -extern "C" EncodedJSValue ServerWebSocketPrototype__pong(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__pongCallback); - -extern "C" EncodedJSValue ServerWebSocketPrototype__publish(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__publishCallback); - -extern "C" EncodedJSValue ServerWebSocketPrototype__publishBinary(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__publishBinaryCallback); - -extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(ServerWebSocketPrototype__publishBinaryWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSString* arg0, JSC::JSUint8Array* arg1)); -extern "C" EncodedJSValue ServerWebSocketPrototype__publishBinaryWithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSString* arg0, JSC::JSUint8Array* arg1); - -static const JSC::DOMJIT::Signature DOMJITSignatureForServerWebSocketPrototype__publishBinary(ServerWebSocketPrototype__publishBinaryWithoutTypeChecksWrapper, - JSServerWebSocket::info(), - JSC::DOMJIT::Effect::forReadWrite(JSC::DOMJIT::HeapRange::top(), JSC::DOMJIT::HeapRange::top()), - JSC::SpecHeapTop, JSC::SpecString, JSC::SpecUint8Array); - -JSC_DEFINE_JIT_OPERATION(ServerWebSocketPrototype__publishBinaryWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSString* arg0, JSC::JSUint8Array* arg1)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - IGNORE_WARNINGS_BEGIN("frame-address") - CallFrame* callFrame = DECLARE_CALL_FRAME(vm); - IGNORE_WARNINGS_END - JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); - return ServerWebSocketPrototype__publishBinaryWithoutTypeChecks(reinterpret_cast(thisValue)->wrapped(), lexicalGlobalObject, arg0, arg1); -} - -extern "C" EncodedJSValue ServerWebSocketPrototype__publishText(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__publishTextCallback); - -extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(ServerWebSocketPrototype__publishTextWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSString* arg0, JSC::JSString* arg1)); -extern "C" EncodedJSValue ServerWebSocketPrototype__publishTextWithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSString* arg0, JSC::JSString* arg1); - -static const JSC::DOMJIT::Signature DOMJITSignatureForServerWebSocketPrototype__publishText(ServerWebSocketPrototype__publishTextWithoutTypeChecksWrapper, - JSServerWebSocket::info(), - JSC::DOMJIT::Effect::forReadWrite(JSC::DOMJIT::HeapRange::top(), JSC::DOMJIT::HeapRange::top()), - JSC::SpecHeapTop, JSC::SpecString, JSC::SpecString); - -JSC_DEFINE_JIT_OPERATION(ServerWebSocketPrototype__publishTextWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSString* arg0, JSC::JSString* arg1)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - IGNORE_WARNINGS_BEGIN("frame-address") - CallFrame* callFrame = DECLARE_CALL_FRAME(vm); - IGNORE_WARNINGS_END - JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); - return ServerWebSocketPrototype__publishTextWithoutTypeChecks(reinterpret_cast(thisValue)->wrapped(), lexicalGlobalObject, arg0, arg1); -} - -extern "C" JSC::EncodedJSValue ServerWebSocketPrototype__getReadyState(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ServerWebSocketPrototype__readyStateGetterWrap); - -extern "C" JSC::EncodedJSValue ServerWebSocketPrototype__getRemoteAddress(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ServerWebSocketPrototype__remoteAddressGetterWrap); - -extern "C" EncodedJSValue ServerWebSocketPrototype__send(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__sendCallback); - -extern "C" EncodedJSValue ServerWebSocketPrototype__sendBinary(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__sendBinaryCallback); - -extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(ServerWebSocketPrototype__sendBinaryWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSUint8Array* arg0, bool arg1)); -extern "C" EncodedJSValue ServerWebSocketPrototype__sendBinaryWithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSUint8Array* arg0, bool arg1); - -static const JSC::DOMJIT::Signature DOMJITSignatureForServerWebSocketPrototype__sendBinary(ServerWebSocketPrototype__sendBinaryWithoutTypeChecksWrapper, - JSServerWebSocket::info(), - JSC::DOMJIT::Effect::forReadWrite(JSC::DOMJIT::HeapRange::top(), JSC::DOMJIT::HeapRange::top()), - JSC::SpecHeapTop, JSC::SpecUint8Array, JSC::SpecBoolean); - -JSC_DEFINE_JIT_OPERATION(ServerWebSocketPrototype__sendBinaryWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSUint8Array* arg0, bool arg1)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - IGNORE_WARNINGS_BEGIN("frame-address") - CallFrame* callFrame = DECLARE_CALL_FRAME(vm); - IGNORE_WARNINGS_END - JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); - return ServerWebSocketPrototype__sendBinaryWithoutTypeChecks(reinterpret_cast(thisValue)->wrapped(), lexicalGlobalObject, arg0, arg1); -} - -extern "C" EncodedJSValue ServerWebSocketPrototype__sendText(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__sendTextCallback); - -extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(ServerWebSocketPrototype__sendTextWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSString* arg0, bool arg1)); -extern "C" EncodedJSValue ServerWebSocketPrototype__sendTextWithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSString* arg0, bool arg1); - -static const JSC::DOMJIT::Signature DOMJITSignatureForServerWebSocketPrototype__sendText(ServerWebSocketPrototype__sendTextWithoutTypeChecksWrapper, - JSServerWebSocket::info(), - JSC::DOMJIT::Effect::forReadWrite(JSC::DOMJIT::HeapRange::top(), JSC::DOMJIT::HeapRange::top()), - JSC::SpecHeapTop, JSC::SpecString, JSC::SpecBoolean); - -JSC_DEFINE_JIT_OPERATION(ServerWebSocketPrototype__sendTextWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSString* arg0, bool arg1)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - IGNORE_WARNINGS_BEGIN("frame-address") - CallFrame* callFrame = DECLARE_CALL_FRAME(vm); - IGNORE_WARNINGS_END - JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); - return ServerWebSocketPrototype__sendTextWithoutTypeChecks(reinterpret_cast(thisValue)->wrapped(), lexicalGlobalObject, arg0, arg1); -} - -extern "C" EncodedJSValue ServerWebSocketPrototype__subscribe(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__subscribeCallback); - -extern "C" EncodedJSValue ServerWebSocketPrototype__terminate(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__terminateCallback); - -extern "C" EncodedJSValue ServerWebSocketPrototype__unsubscribe(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__unsubscribeCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSServerWebSocketPrototype, JSServerWebSocketPrototype::Base); - -static const HashTableValue JSServerWebSocketPrototypeTableValues[] = { - { "binaryType"_s, static_cast(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ServerWebSocketPrototype__binaryTypeGetterWrap, ServerWebSocketPrototype__binaryTypeSetterWrap } }, - { "close"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__closeCallback, 3 } }, - { "cork"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__corkCallback, 1 } }, - { "data"_s, static_cast(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ServerWebSocketPrototype__dataGetterWrap, ServerWebSocketPrototype__dataSetterWrap } }, - { "getBufferedAmount"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__getBufferedAmountCallback, 0 } }, - { "isSubscribed"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__isSubscribedCallback, 1 } }, - { "ping"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__pingCallback, 1 } }, - { "pong"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__pongCallback, 1 } }, - { "publish"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__publishCallback, 3 } }, - { "publishBinary"_s, static_cast(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, ServerWebSocketPrototype__publishBinaryCallback, &DOMJITSignatureForServerWebSocketPrototype__publishBinary } }, - { "publishText"_s, static_cast(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, ServerWebSocketPrototype__publishTextCallback, &DOMJITSignatureForServerWebSocketPrototype__publishText } }, - { "readyState"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ServerWebSocketPrototype__readyStateGetterWrap, 0 } }, - { "remoteAddress"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ServerWebSocketPrototype__remoteAddressGetterWrap, 0 } }, - { "send"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__sendCallback, 2 } }, - { "sendBinary"_s, static_cast(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, ServerWebSocketPrototype__sendBinaryCallback, &DOMJITSignatureForServerWebSocketPrototype__sendBinary } }, - { "sendText"_s, static_cast(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, ServerWebSocketPrototype__sendTextCallback, &DOMJITSignatureForServerWebSocketPrototype__sendText } }, - { "subscribe"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__subscribeCallback, 1 } }, - { "terminate"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__terminateCallback, 0 } }, - { "unsubscribe"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__unsubscribeCallback, 1 } } -}; - -const ClassInfo JSServerWebSocketPrototype::s_info = { "ServerWebSocket"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSServerWebSocketPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsServerWebSocketConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for ServerWebSocket"_s); - return JSValue::encode(globalObject->JSServerWebSocketConstructor()); -} - -JSC_DEFINE_CUSTOM_GETTER(ServerWebSocketPrototype__binaryTypeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSServerWebSocket* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = ServerWebSocketPrototype__getBinaryType(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_SETTER(ServerWebSocketPrototype__binaryTypeSetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSServerWebSocket* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - auto result = ServerWebSocketPrototype__setBinaryType(thisObject->wrapped(), lexicalGlobalObject, encodedValue); - - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__closeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSServerWebSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof ServerWebSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ServerWebSocketPrototype__close(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__corkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSServerWebSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof ServerWebSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ServerWebSocketPrototype__cork(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(ServerWebSocketPrototype__dataGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSServerWebSocket* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_data.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - ServerWebSocketPrototype__getData(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_data.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void ServerWebSocketPrototype__dataSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_data.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue ServerWebSocketPrototype__dataGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_data.get()); -} - -JSC_DEFINE_CUSTOM_SETTER(ServerWebSocketPrototype__dataSetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSServerWebSocket* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - auto result = ServerWebSocketPrototype__setData(thisObject->wrapped(), lexicalGlobalObject, encodedValue); - - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__getBufferedAmountCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSServerWebSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof ServerWebSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ServerWebSocketPrototype__getBufferedAmount(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__isSubscribedCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSServerWebSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof ServerWebSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ServerWebSocketPrototype__isSubscribed(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__pingCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSServerWebSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof ServerWebSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ServerWebSocketPrototype__ping(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__pongCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSServerWebSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof ServerWebSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ServerWebSocketPrototype__pong(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__publishCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSServerWebSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof ServerWebSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ServerWebSocketPrototype__publish(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__publishBinaryCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSServerWebSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof ServerWebSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ServerWebSocketPrototype__publishBinary(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__publishTextCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSServerWebSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof ServerWebSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ServerWebSocketPrototype__publishText(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(ServerWebSocketPrototype__readyStateGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSServerWebSocket* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = ServerWebSocketPrototype__getReadyState(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(ServerWebSocketPrototype__remoteAddressGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSServerWebSocket* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_remoteAddress.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - ServerWebSocketPrototype__getRemoteAddress(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_remoteAddress.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void ServerWebSocketPrototype__remoteAddressSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_remoteAddress.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue ServerWebSocketPrototype__remoteAddressGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_remoteAddress.get()); -} - -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__sendCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSServerWebSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof ServerWebSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ServerWebSocketPrototype__send(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__sendBinaryCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSServerWebSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof ServerWebSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ServerWebSocketPrototype__sendBinary(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__sendTextCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSServerWebSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof ServerWebSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ServerWebSocketPrototype__sendText(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__subscribeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSServerWebSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof ServerWebSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ServerWebSocketPrototype__subscribe(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__terminateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSServerWebSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof ServerWebSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ServerWebSocketPrototype__terminate(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__unsubscribeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSServerWebSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof ServerWebSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return ServerWebSocketPrototype__unsubscribe(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSServerWebSocketPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSServerWebSocket::info(), JSServerWebSocketPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -void JSServerWebSocketConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSServerWebSocketPrototype* prototype) -{ - Base::finishCreation(vm, 0, "ServerWebSocket"_s, PropertyAdditionMode::WithoutStructureTransition); - - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} - -JSServerWebSocketConstructor::JSServerWebSocketConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} - -JSServerWebSocketConstructor* JSServerWebSocketConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSServerWebSocketPrototype* prototype) -{ - JSServerWebSocketConstructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSServerWebSocketConstructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSServerWebSocketConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) -{ - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); - JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSServerWebSocketConstructor(); - Structure* structure = globalObject->JSServerWebSocketStructure(); - if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); - - auto* functionGlobalObject = reinterpret_cast( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSServerWebSocketStructure()); - } - - void* ptr = ServerWebSocketClass__construct(globalObject, callFrame); - - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); - } - - JSServerWebSocket* instance = JSServerWebSocket::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -void JSServerWebSocketConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSServerWebSocketPrototype* prototype) -{ -} - -const ClassInfo JSServerWebSocketConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSServerWebSocketConstructor) }; - -extern "C" EncodedJSValue ServerWebSocket__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSServerWebSocketConstructor()); -} - -JSServerWebSocket::~JSServerWebSocket() -{ - if (m_ctx) { - ServerWebSocketClass__finalize(m_ctx); - } -} -void JSServerWebSocket::destroy(JSCell* cell) -{ - static_cast(cell)->JSServerWebSocket::~JSServerWebSocket(); -} - -const ClassInfo JSServerWebSocket::s_info = { "ServerWebSocket"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSServerWebSocket) }; - -void JSServerWebSocket::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSServerWebSocket* JSServerWebSocket::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSServerWebSocket* ptr = new (NotNull, JSC::allocateCell(vm)) JSServerWebSocket(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* ServerWebSocket__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSServerWebSocket* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool ServerWebSocket__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSServerWebSocket* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t ServerWebSocket__ptrOffset = JSServerWebSocket::offsetOfWrapped(); - -void JSServerWebSocket::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSServerWebSocket::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) -{ - return WebCore::JSServerWebSocketConstructor::create(vm, globalObject, WebCore::JSServerWebSocketConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast(prototype)); -} - -JSObject* JSServerWebSocket::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSServerWebSocketPrototype::create(vm, globalObject, JSServerWebSocketPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue ServerWebSocket__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSServerWebSocketStructure(); - JSServerWebSocket* instance = JSServerWebSocket::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSServerWebSocket::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSServerWebSocket* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSServerWebSocket); - -template -void JSServerWebSocket::visitAdditionalChildren(Visitor& visitor) -{ - JSServerWebSocket* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_data); - visitor.append(thisObject->m_remoteAddress); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSServerWebSocket); - -template -void JSServerWebSocket::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSServerWebSocket* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSServerWebSocket); -class JSStatWatcherPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSStatWatcherPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSStatWatcherPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSStatWatcherPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSStatWatcherPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSStatWatcherPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -extern "C" void StatWatcherClass__finalize(void*); - -extern "C" EncodedJSValue StatWatcherPrototype__doClose(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(StatWatcherPrototype__closeCallback); - -extern "C" EncodedJSValue StatWatcherPrototype__doRef(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(StatWatcherPrototype__refCallback); - -extern "C" EncodedJSValue StatWatcherPrototype__doUnref(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(StatWatcherPrototype__unrefCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSStatWatcherPrototype, JSStatWatcherPrototype::Base); - -static const HashTableValue JSStatWatcherPrototypeTableValues[] = { - { "close"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, StatWatcherPrototype__closeCallback, 0 } }, - { "ref"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, StatWatcherPrototype__refCallback, 0 } }, - { "unref"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, StatWatcherPrototype__unrefCallback, 0 } } -}; - -const ClassInfo JSStatWatcherPrototype::s_info = { "StatWatcher"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSStatWatcherPrototype) }; - -JSC_DEFINE_HOST_FUNCTION(StatWatcherPrototype__closeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSStatWatcher* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof StatWatcher"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return StatWatcherPrototype__doClose(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(StatWatcherPrototype__refCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSStatWatcher* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof StatWatcher"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return StatWatcherPrototype__doRef(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(StatWatcherPrototype__unrefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSStatWatcher* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof StatWatcher"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return StatWatcherPrototype__doUnref(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -extern "C" void StatWatcherPrototype__listenerSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_listener.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue StatWatcherPrototype__listenerGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_listener.get()); -} - -void JSStatWatcherPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSStatWatcher::info(), JSStatWatcherPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -extern "C" bool StatWatcher__hasPendingActivity(void* ptr); -bool JSStatWatcher::hasPendingActivity(void* ctx) -{ - return StatWatcher__hasPendingActivity(ctx); -} - -JSStatWatcher::~JSStatWatcher() -{ - if (m_ctx) { - StatWatcherClass__finalize(m_ctx); - } -} -void JSStatWatcher::destroy(JSCell* cell) -{ - static_cast(cell)->JSStatWatcher::~JSStatWatcher(); -} - -const ClassInfo JSStatWatcher::s_info = { "StatWatcher"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSStatWatcher) }; - -void JSStatWatcher::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSStatWatcher* JSStatWatcher::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSStatWatcher* ptr = new (NotNull, JSC::allocateCell(vm)) JSStatWatcher(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* StatWatcher__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSStatWatcher* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool StatWatcher__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSStatWatcher* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t StatWatcher__ptrOffset = JSStatWatcher::offsetOfWrapped(); - -void JSStatWatcher::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSStatWatcher::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSStatWatcherPrototype::create(vm, globalObject, JSStatWatcherPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue StatWatcher__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSStatWatcherStructure(); - JSStatWatcher* instance = JSStatWatcher::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSStatWatcher::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSStatWatcher* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSStatWatcher); - -template -void JSStatWatcher::visitAdditionalChildren(Visitor& visitor) -{ - JSStatWatcher* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - visitor.append(thisObject->m_listener); - - visitor.addOpaqueRoot(this->wrapped()); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSStatWatcher); - -template -void JSStatWatcher::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSStatWatcher* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSStatWatcher); -class JSStatsPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSStatsPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSStatsPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSStatsPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSStatsPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSStatsPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -class JSStatsConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSStatsConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSStatsPrototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForStatsConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForStatsConstructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForStatsConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForStatsConstructor = std::forward(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSStatsPrototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSStatsConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSStatsPrototype* prototype); -}; - -extern "C" void* StatsClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsStatsConstructor); - -extern "C" void StatsClass__finalize(void*); - -extern "C" JSC::EncodedJSValue StatsPrototype__atime(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__atimeGetterWrap); - -extern "C" JSC::EncodedJSValue StatsPrototype__atimeMs(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__atimeMsGetterWrap); - -extern "C" JSC::EncodedJSValue StatsPrototype__birthtime(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__birthtimeGetterWrap); - -extern "C" JSC::EncodedJSValue StatsPrototype__birthtimeMs(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__birthtimeMsGetterWrap); - -extern "C" JSC::EncodedJSValue StatsPrototype__blksize(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__blksizeGetterWrap); - -extern "C" JSC::EncodedJSValue StatsPrototype__blocks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__blocksGetterWrap); - -extern "C" JSC::EncodedJSValue StatsPrototype__ctime(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__ctimeGetterWrap); - -extern "C" JSC::EncodedJSValue StatsPrototype__ctimeMs(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__ctimeMsGetterWrap); - -extern "C" JSC::EncodedJSValue StatsPrototype__dev(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__devGetterWrap); - -extern "C" JSC::EncodedJSValue StatsPrototype__gid(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__gidGetterWrap); - -extern "C" JSC::EncodedJSValue StatsPrototype__ino(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__inoGetterWrap); - -extern "C" EncodedJSValue StatsPrototype__isBlockDevice_(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(StatsPrototype__isBlockDeviceCallback); - -extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(StatsPrototype__isBlockDeviceWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)); -extern "C" EncodedJSValue StatsPrototype__isBlockDevice_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); - -static const JSC::DOMJIT::Signature DOMJITSignatureForStatsPrototype__isBlockDevice(StatsPrototype__isBlockDeviceWithoutTypeChecksWrapper, - JSStats::info(), - JSC::DOMJIT::Effect::forPure(), - JSC::SpecHeapTop); - -JSC_DEFINE_JIT_OPERATION(StatsPrototype__isBlockDeviceWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - IGNORE_WARNINGS_BEGIN("frame-address") - CallFrame* callFrame = DECLARE_CALL_FRAME(vm); - IGNORE_WARNINGS_END - JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); - return StatsPrototype__isBlockDevice_WithoutTypeChecks(reinterpret_cast(thisValue)->wrapped(), lexicalGlobalObject); -} - -extern "C" EncodedJSValue StatsPrototype__isCharacterDevice_(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(StatsPrototype__isCharacterDeviceCallback); - -extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(StatsPrototype__isCharacterDeviceWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)); -extern "C" EncodedJSValue StatsPrototype__isCharacterDevice_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); - -static const JSC::DOMJIT::Signature DOMJITSignatureForStatsPrototype__isCharacterDevice(StatsPrototype__isCharacterDeviceWithoutTypeChecksWrapper, - JSStats::info(), - JSC::DOMJIT::Effect::forPure(), - JSC::SpecHeapTop); - -JSC_DEFINE_JIT_OPERATION(StatsPrototype__isCharacterDeviceWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - IGNORE_WARNINGS_BEGIN("frame-address") - CallFrame* callFrame = DECLARE_CALL_FRAME(vm); - IGNORE_WARNINGS_END - JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); - return StatsPrototype__isCharacterDevice_WithoutTypeChecks(reinterpret_cast(thisValue)->wrapped(), lexicalGlobalObject); -} - -extern "C" EncodedJSValue StatsPrototype__isDirectory_(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(StatsPrototype__isDirectoryCallback); - -extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(StatsPrototype__isDirectoryWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)); -extern "C" EncodedJSValue StatsPrototype__isDirectory_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); - -static const JSC::DOMJIT::Signature DOMJITSignatureForStatsPrototype__isDirectory(StatsPrototype__isDirectoryWithoutTypeChecksWrapper, - JSStats::info(), - JSC::DOMJIT::Effect::forPure(), - JSC::SpecHeapTop); - -JSC_DEFINE_JIT_OPERATION(StatsPrototype__isDirectoryWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - IGNORE_WARNINGS_BEGIN("frame-address") - CallFrame* callFrame = DECLARE_CALL_FRAME(vm); - IGNORE_WARNINGS_END - JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); - return StatsPrototype__isDirectory_WithoutTypeChecks(reinterpret_cast(thisValue)->wrapped(), lexicalGlobalObject); -} - -extern "C" EncodedJSValue StatsPrototype__isFIFO_(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(StatsPrototype__isFIFOCallback); - -extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(StatsPrototype__isFIFOWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)); -extern "C" EncodedJSValue StatsPrototype__isFIFO_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); - -static const JSC::DOMJIT::Signature DOMJITSignatureForStatsPrototype__isFIFO(StatsPrototype__isFIFOWithoutTypeChecksWrapper, - JSStats::info(), - JSC::DOMJIT::Effect::forPure(), - JSC::SpecHeapTop); - -JSC_DEFINE_JIT_OPERATION(StatsPrototype__isFIFOWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - IGNORE_WARNINGS_BEGIN("frame-address") - CallFrame* callFrame = DECLARE_CALL_FRAME(vm); - IGNORE_WARNINGS_END - JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); - return StatsPrototype__isFIFO_WithoutTypeChecks(reinterpret_cast(thisValue)->wrapped(), lexicalGlobalObject); -} - -extern "C" EncodedJSValue StatsPrototype__isFile_(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(StatsPrototype__isFileCallback); - -extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(StatsPrototype__isFileWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)); -extern "C" EncodedJSValue StatsPrototype__isFile_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); - -static const JSC::DOMJIT::Signature DOMJITSignatureForStatsPrototype__isFile(StatsPrototype__isFileWithoutTypeChecksWrapper, - JSStats::info(), - JSC::DOMJIT::Effect::forPure(), - JSC::SpecHeapTop); - -JSC_DEFINE_JIT_OPERATION(StatsPrototype__isFileWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - IGNORE_WARNINGS_BEGIN("frame-address") - CallFrame* callFrame = DECLARE_CALL_FRAME(vm); - IGNORE_WARNINGS_END - JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); - return StatsPrototype__isFile_WithoutTypeChecks(reinterpret_cast(thisValue)->wrapped(), lexicalGlobalObject); -} - -extern "C" EncodedJSValue StatsPrototype__isSocket_(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(StatsPrototype__isSocketCallback); - -extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(StatsPrototype__isSocketWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)); -extern "C" EncodedJSValue StatsPrototype__isSocket_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); - -static const JSC::DOMJIT::Signature DOMJITSignatureForStatsPrototype__isSocket(StatsPrototype__isSocketWithoutTypeChecksWrapper, - JSStats::info(), - JSC::DOMJIT::Effect::forPure(), - JSC::SpecHeapTop); - -JSC_DEFINE_JIT_OPERATION(StatsPrototype__isSocketWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - IGNORE_WARNINGS_BEGIN("frame-address") - CallFrame* callFrame = DECLARE_CALL_FRAME(vm); - IGNORE_WARNINGS_END - JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); - return StatsPrototype__isSocket_WithoutTypeChecks(reinterpret_cast(thisValue)->wrapped(), lexicalGlobalObject); -} - -extern "C" EncodedJSValue StatsPrototype__isSymbolicLink_(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(StatsPrototype__isSymbolicLinkCallback); - -extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(StatsPrototype__isSymbolicLinkWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)); -extern "C" EncodedJSValue StatsPrototype__isSymbolicLink_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); - -static const JSC::DOMJIT::Signature DOMJITSignatureForStatsPrototype__isSymbolicLink(StatsPrototype__isSymbolicLinkWithoutTypeChecksWrapper, - JSStats::info(), - JSC::DOMJIT::Effect::forPure(), - JSC::SpecHeapTop); - -JSC_DEFINE_JIT_OPERATION(StatsPrototype__isSymbolicLinkWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - IGNORE_WARNINGS_BEGIN("frame-address") - CallFrame* callFrame = DECLARE_CALL_FRAME(vm); - IGNORE_WARNINGS_END - JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); - return StatsPrototype__isSymbolicLink_WithoutTypeChecks(reinterpret_cast(thisValue)->wrapped(), lexicalGlobalObject); -} - -extern "C" JSC::EncodedJSValue StatsPrototype__mode(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__modeGetterWrap); - -extern "C" JSC::EncodedJSValue StatsPrototype__mtime(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__mtimeGetterWrap); - -extern "C" JSC::EncodedJSValue StatsPrototype__mtimeMs(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__mtimeMsGetterWrap); - -extern "C" JSC::EncodedJSValue StatsPrototype__nlink(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__nlinkGetterWrap); - -extern "C" JSC::EncodedJSValue StatsPrototype__rdev(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__rdevGetterWrap); - -extern "C" JSC::EncodedJSValue StatsPrototype__size(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__sizeGetterWrap); - -extern "C" JSC::EncodedJSValue StatsPrototype__uid(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__uidGetterWrap); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSStatsPrototype, JSStatsPrototype::Base); - -static const HashTableValue JSStatsPrototypeTableValues[] = { - { "atime"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__atimeGetterWrap, 0 } }, - { "atimeMs"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__atimeMsGetterWrap, 0 } }, - { "birthtime"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__birthtimeGetterWrap, 0 } }, - { "birthtimeMs"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__birthtimeMsGetterWrap, 0 } }, - { "blksize"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__blksizeGetterWrap, 0 } }, - { "blocks"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__blocksGetterWrap, 0 } }, - { "ctime"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__ctimeGetterWrap, 0 } }, - { "ctimeMs"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__ctimeMsGetterWrap, 0 } }, - { "dev"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__devGetterWrap, 0 } }, - { "gid"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__gidGetterWrap, 0 } }, - { "ino"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__inoGetterWrap, 0 } }, - { "isBlockDevice"_s, static_cast(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, StatsPrototype__isBlockDeviceCallback, &DOMJITSignatureForStatsPrototype__isBlockDevice } }, - { "isCharacterDevice"_s, static_cast(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, StatsPrototype__isCharacterDeviceCallback, &DOMJITSignatureForStatsPrototype__isCharacterDevice } }, - { "isDirectory"_s, static_cast(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, StatsPrototype__isDirectoryCallback, &DOMJITSignatureForStatsPrototype__isDirectory } }, - { "isFIFO"_s, static_cast(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, StatsPrototype__isFIFOCallback, &DOMJITSignatureForStatsPrototype__isFIFO } }, - { "isFile"_s, static_cast(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, StatsPrototype__isFileCallback, &DOMJITSignatureForStatsPrototype__isFile } }, - { "isSocket"_s, static_cast(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, StatsPrototype__isSocketCallback, &DOMJITSignatureForStatsPrototype__isSocket } }, - { "isSymbolicLink"_s, static_cast(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, StatsPrototype__isSymbolicLinkCallback, &DOMJITSignatureForStatsPrototype__isSymbolicLink } }, - { "mode"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__modeGetterWrap, 0 } }, - { "mtime"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__mtimeGetterWrap, 0 } }, - { "mtimeMs"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__mtimeMsGetterWrap, 0 } }, - { "nlink"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__nlinkGetterWrap, 0 } }, - { "rdev"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__rdevGetterWrap, 0 } }, - { "size"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__sizeGetterWrap, 0 } }, - { "uid"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__uidGetterWrap, 0 } } -}; - -const ClassInfo JSStatsPrototype::s_info = { "Stats"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSStatsPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsStatsConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for Stats"_s); - return JSValue::encode(globalObject->JSStatsConstructor()); -} - -JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__atimeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_atime.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - StatsPrototype__atime(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_atime.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void StatsPrototype__atimeSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_atime.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue StatsPrototype__atimeGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_atime.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__atimeMsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = StatsPrototype__atimeMs(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__birthtimeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = StatsPrototype__birthtime(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__birthtimeMsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = StatsPrototype__birthtimeMs(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__blksizeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = StatsPrototype__blksize(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__blocksGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = StatsPrototype__blocks(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__ctimeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_ctime.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - StatsPrototype__ctime(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_ctime.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void StatsPrototype__ctimeSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_ctime.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue StatsPrototype__ctimeGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_ctime.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__ctimeMsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = StatsPrototype__ctimeMs(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__devGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = StatsPrototype__dev(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__gidGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = StatsPrototype__gid(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__inoGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = StatsPrototype__ino(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(StatsPrototype__isBlockDeviceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSStats* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Stats"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return StatsPrototype__isBlockDevice_(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(StatsPrototype__isCharacterDeviceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSStats* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Stats"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return StatsPrototype__isCharacterDevice_(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(StatsPrototype__isDirectoryCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSStats* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Stats"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return StatsPrototype__isDirectory_(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(StatsPrototype__isFIFOCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSStats* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Stats"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return StatsPrototype__isFIFO_(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(StatsPrototype__isFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSStats* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Stats"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return StatsPrototype__isFile_(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(StatsPrototype__isSocketCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSStats* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Stats"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return StatsPrototype__isSocket_(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(StatsPrototype__isSymbolicLinkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSStats* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Stats"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return StatsPrototype__isSymbolicLink_(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__modeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = StatsPrototype__mode(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__mtimeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_mtime.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - StatsPrototype__mtime(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_mtime.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void StatsPrototype__mtimeSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_mtime.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue StatsPrototype__mtimeGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_mtime.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__mtimeMsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = StatsPrototype__mtimeMs(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__nlinkGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = StatsPrototype__nlink(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__rdevGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = StatsPrototype__rdev(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__sizeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = StatsPrototype__size(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__uidGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSStats* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = StatsPrototype__uid(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -void JSStatsPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSStats::info(), JSStatsPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -void JSStatsConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSStatsPrototype* prototype) -{ - Base::finishCreation(vm, 0, "Stats"_s, PropertyAdditionMode::WithoutStructureTransition); - - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} - -JSStatsConstructor::JSStatsConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} - -JSStatsConstructor* JSStatsConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSStatsPrototype* prototype) -{ - JSStatsConstructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSStatsConstructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSStatsConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) -{ - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); - JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSStatsConstructor(); - Structure* structure = globalObject->JSStatsStructure(); - if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); - - auto* functionGlobalObject = reinterpret_cast( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSStatsStructure()); - } - - void* ptr = StatsClass__construct(globalObject, callFrame); - - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); - } - - JSStats* instance = JSStats::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -void JSStatsConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSStatsPrototype* prototype) -{ -} - -const ClassInfo JSStatsConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSStatsConstructor) }; - -extern "C" EncodedJSValue Stats__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSStatsConstructor()); -} - -JSStats::~JSStats() -{ - if (m_ctx) { - StatsClass__finalize(m_ctx); - } -} -void JSStats::destroy(JSCell* cell) -{ - static_cast(cell)->JSStats::~JSStats(); -} - -const ClassInfo JSStats::s_info = { "Stats"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSStats) }; - -void JSStats::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSStats* JSStats::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSStats* ptr = new (NotNull, JSC::allocateCell(vm)) JSStats(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* Stats__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSStats* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool Stats__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSStats* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t Stats__ptrOffset = JSStats::offsetOfWrapped(); - -void JSStats::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSStats::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) -{ - return WebCore::JSStatsConstructor::create(vm, globalObject, WebCore::JSStatsConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast(prototype)); -} - -JSObject* JSStats::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSStatsPrototype::create(vm, globalObject, JSStatsPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue Stats__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSStatsStructure(); - JSStats* instance = JSStats::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSStats::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSStats* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSStats); - -template -void JSStats::visitAdditionalChildren(Visitor& visitor) -{ - JSStats* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_atime); - visitor.append(thisObject->m_ctime); - visitor.append(thisObject->m_mtime); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSStats); - -template -void JSStats::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSStats* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSStats); -class JSSubprocessPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSSubprocessPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSSubprocessPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSSubprocessPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSubprocessPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSSubprocessPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -extern "C" void* SubprocessClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsSubprocessConstructor); - -extern "C" void SubprocessClass__finalize(void*); - -extern "C" JSC::EncodedJSValue SubprocessPrototype__getExitCode(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(SubprocessPrototype__exitCodeGetterWrap); - -extern "C" JSC::EncodedJSValue SubprocessPrototype__getExited(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(SubprocessPrototype__exitedGetterWrap); - -extern "C" EncodedJSValue SubprocessPrototype__kill(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(SubprocessPrototype__killCallback); - -extern "C" JSC::EncodedJSValue SubprocessPrototype__getKilled(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(SubprocessPrototype__killedGetterWrap); - -extern "C" JSC::EncodedJSValue SubprocessPrototype__getPid(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(SubprocessPrototype__pidGetterWrap); - -extern "C" JSC::EncodedJSValue SubprocessPrototype__getStdout(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(SubprocessPrototype__readableGetterWrap); - -extern "C" EncodedJSValue SubprocessPrototype__doRef(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(SubprocessPrototype__refCallback); - -extern "C" EncodedJSValue SubprocessPrototype__doSend(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(SubprocessPrototype__sendCallback); - -extern "C" JSC::EncodedJSValue SubprocessPrototype__getSignalCode(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(SubprocessPrototype__signalCodeGetterWrap); - -extern "C" JSC::EncodedJSValue SubprocessPrototype__getStderr(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(SubprocessPrototype__stderrGetterWrap); - -extern "C" JSC::EncodedJSValue SubprocessPrototype__getStdin(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(SubprocessPrototype__stdinGetterWrap); - -extern "C" JSC::EncodedJSValue SubprocessPrototype__getStdout(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(SubprocessPrototype__stdoutGetterWrap); - -extern "C" EncodedJSValue SubprocessPrototype__doUnref(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(SubprocessPrototype__unrefCallback); - -extern "C" JSC::EncodedJSValue SubprocessPrototype__getStdin(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(SubprocessPrototype__writableGetterWrap); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSubprocessPrototype, JSSubprocessPrototype::Base); - -static const HashTableValue JSSubprocessPrototypeTableValues[] = { - { "exitCode"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__exitCodeGetterWrap, 0 } }, - { "exited"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__exitedGetterWrap, 0 } }, - { "kill"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SubprocessPrototype__killCallback, 1 } }, - { "killed"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__killedGetterWrap, 0 } }, - { "pid"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__pidGetterWrap, 0 } }, - { "readable"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__readableGetterWrap, 0 } }, - { "ref"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SubprocessPrototype__refCallback, 0 } }, - { "send"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SubprocessPrototype__sendCallback, 1 } }, - { "signalCode"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__signalCodeGetterWrap, 0 } }, - { "stderr"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__stderrGetterWrap, 0 } }, - { "stdin"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__stdinGetterWrap, 0 } }, - { "stdout"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__stdoutGetterWrap, 0 } }, - { "unref"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SubprocessPrototype__unrefCallback, 0 } }, - { "writable"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__writableGetterWrap, 0 } } -}; - -const ClassInfo JSSubprocessPrototype::s_info = { "Subprocess"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSubprocessPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsSubprocessConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for Subprocess"_s); - return JSValue::encode(globalObject->JSSubprocessConstructor()); -} - -JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__exitCodeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSubprocess* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = SubprocessPrototype__getExitCode(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__exitedGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSubprocess* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = SubprocessPrototype__getExited(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(SubprocessPrototype__killCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSSubprocess* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Subprocess"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return SubprocessPrototype__kill(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__killedGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSubprocess* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = SubprocessPrototype__getKilled(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__pidGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSubprocess* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = SubprocessPrototype__getPid(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__readableGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSubprocess* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_stdout.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - SubprocessPrototype__getStdout(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_stdout.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void SubprocessPrototype__readableSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_stdout.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue SubprocessPrototype__readableGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_stdout.get()); -} - -JSC_DEFINE_HOST_FUNCTION(SubprocessPrototype__refCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSSubprocess* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Subprocess"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return SubprocessPrototype__doRef(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(SubprocessPrototype__sendCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSSubprocess* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Subprocess"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return SubprocessPrototype__doSend(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__signalCodeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSubprocess* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = SubprocessPrototype__getSignalCode(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__stderrGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSubprocess* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_stderr.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - SubprocessPrototype__getStderr(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_stderr.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void SubprocessPrototype__stderrSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_stderr.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue SubprocessPrototype__stderrGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_stderr.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__stdinGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSubprocess* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_stdin.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - SubprocessPrototype__getStdin(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_stdin.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void SubprocessPrototype__stdinSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_stdin.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue SubprocessPrototype__stdinGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_stdin.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__stdoutGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSubprocess* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_stdout.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - SubprocessPrototype__getStdout(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_stdout.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void SubprocessPrototype__stdoutSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_stdout.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue SubprocessPrototype__stdoutGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_stdout.get()); -} - -JSC_DEFINE_HOST_FUNCTION(SubprocessPrototype__unrefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSSubprocess* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Subprocess"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return SubprocessPrototype__doUnref(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__writableGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSubprocess* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_stdin.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - SubprocessPrototype__getStdin(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_stdin.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void SubprocessPrototype__writableSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_stdin.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue SubprocessPrototype__writableGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_stdin.get()); -} - -void JSSubprocessPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSSubprocess::info(), JSSubprocessPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -extern "C" bool Subprocess__hasPendingActivity(void* ptr); -bool JSSubprocess::hasPendingActivity(void* ctx) -{ - return Subprocess__hasPendingActivity(ctx); -} - -JSSubprocess::~JSSubprocess() -{ - if (m_ctx) { - SubprocessClass__finalize(m_ctx); - } -} -void JSSubprocess::destroy(JSCell* cell) -{ - static_cast(cell)->JSSubprocess::~JSSubprocess(); -} - -const ClassInfo JSSubprocess::s_info = { "Subprocess"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSubprocess) }; - -void JSSubprocess::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSSubprocess* JSSubprocess::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSSubprocess* ptr = new (NotNull, JSC::allocateCell(vm)) JSSubprocess(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* Subprocess__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSSubprocess* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool Subprocess__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSSubprocess* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t Subprocess__ptrOffset = JSSubprocess::offsetOfWrapped(); - -void JSSubprocess::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSSubprocess::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSSubprocessPrototype::create(vm, globalObject, JSSubprocessPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue Subprocess__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSSubprocessStructure(); - JSSubprocess* instance = JSSubprocess::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSSubprocess::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSSubprocess* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSSubprocess); - -template -void JSSubprocess::visitAdditionalChildren(Visitor& visitor) -{ - JSSubprocess* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_stderr); - visitor.append(thisObject->m_stdin); - visitor.append(thisObject->m_stdout); - visitor.addOpaqueRoot(this->wrapped()); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSSubprocess); - -template -void JSSubprocess::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSSubprocess* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSSubprocess); -class JSTCPSocketPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSTCPSocketPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSTCPSocketPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSTCPSocketPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTCPSocketPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSTCPSocketPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -extern "C" void* TCPSocketClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsTCPSocketConstructor); - -extern "C" void TCPSocketClass__finalize(void*); - -extern "C" JSC::EncodedJSValue TCPSocketPrototype__getALPNProtocol(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TCPSocketPrototype__alpnProtocolGetterWrap); - -extern "C" JSC::EncodedJSValue TCPSocketPrototype__getAuthorized(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TCPSocketPrototype__authorizedGetterWrap); - -extern "C" JSC::EncodedJSValue TCPSocketPrototype__getData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TCPSocketPrototype__dataGetterWrap); - -extern "C" bool TCPSocketPrototype__setData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::EncodedJSValue value); -JSC_DECLARE_CUSTOM_SETTER(TCPSocketPrototype__dataSetterWrap); - -extern "C" EncodedJSValue TCPSocketPrototype__end(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__endCallback); - -extern "C" EncodedJSValue TCPSocketPrototype__exportKeyingMaterial(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__exportKeyingMaterialCallback); - -extern "C" EncodedJSValue TCPSocketPrototype__flush(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__flushCallback); - -extern "C" EncodedJSValue TCPSocketPrototype__getAuthorizationError(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__getAuthorizationErrorCallback); - -extern "C" EncodedJSValue TCPSocketPrototype__getCertificate(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__getCertificateCallback); - -extern "C" EncodedJSValue TCPSocketPrototype__getCipher(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__getCipherCallback); - -extern "C" EncodedJSValue TCPSocketPrototype__getEphemeralKeyInfo(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__getEphemeralKeyInfoCallback); - -extern "C" EncodedJSValue TCPSocketPrototype__getPeerCertificate(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__getPeerCertificateCallback); - -extern "C" EncodedJSValue TCPSocketPrototype__getSession(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__getSessionCallback); - -extern "C" EncodedJSValue TCPSocketPrototype__getSharedSigalgs(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__getSharedSigalgsCallback); - -extern "C" EncodedJSValue TCPSocketPrototype__getTLSFinishedMessage(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__getTLSFinishedMessageCallback); - -extern "C" EncodedJSValue TCPSocketPrototype__getTLSPeerFinishedMessage(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__getTLSPeerFinishedMessageCallback); - -extern "C" EncodedJSValue TCPSocketPrototype__getTLSTicket(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__getTLSTicketCallback); - -extern "C" EncodedJSValue TCPSocketPrototype__getTLSVersion(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__getTLSVersionCallback); - -extern "C" JSC::EncodedJSValue TCPSocketPrototype__getListener(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TCPSocketPrototype__listenerGetterWrap); - -extern "C" JSC::EncodedJSValue TCPSocketPrototype__getLocalPort(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TCPSocketPrototype__localPortGetterWrap); - -extern "C" JSC::EncodedJSValue TCPSocketPrototype__getReadyState(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TCPSocketPrototype__readyStateGetterWrap); - -extern "C" EncodedJSValue TCPSocketPrototype__ref(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__refCallback); - -extern "C" EncodedJSValue TCPSocketPrototype__reload(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__reloadCallback); - -extern "C" JSC::EncodedJSValue TCPSocketPrototype__getRemoteAddress(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TCPSocketPrototype__remoteAddressGetterWrap); - -extern "C" EncodedJSValue TCPSocketPrototype__setMaxSendFragment(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__setMaxSendFragmentCallback); - -extern "C" EncodedJSValue TCPSocketPrototype__setServername(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__setServernameCallback); - -extern "C" EncodedJSValue TCPSocketPrototype__setSession(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__setSessionCallback); - -extern "C" EncodedJSValue TCPSocketPrototype__shutdown(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__shutdownCallback); - -extern "C" EncodedJSValue TCPSocketPrototype__timeout(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__timeoutCallback); - -extern "C" EncodedJSValue TCPSocketPrototype__unref(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__unrefCallback); - -extern "C" EncodedJSValue TCPSocketPrototype__upgradeTLS(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__upgradeTLSCallback); - -extern "C" EncodedJSValue TCPSocketPrototype__write(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__writeCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTCPSocketPrototype, JSTCPSocketPrototype::Base); - -static const HashTableValue JSTCPSocketPrototypeTableValues[] = { - { "alpnProtocol"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__alpnProtocolGetterWrap, 0 } }, - { "authorized"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__authorizedGetterWrap, 0 } }, - { "data"_s, static_cast(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__dataGetterWrap, TCPSocketPrototype__dataSetterWrap } }, - { "end"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__endCallback, 3 } }, - { "exportKeyingMaterial"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__exportKeyingMaterialCallback, 3 } }, - { "flush"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__flushCallback, 0 } }, - { "getAuthorizationError"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__getAuthorizationErrorCallback, 0 } }, - { "getCertificate"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__getCertificateCallback, 0 } }, - { "getCipher"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__getCipherCallback, 0 } }, - { "getEphemeralKeyInfo"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__getEphemeralKeyInfoCallback, 0 } }, - { "getPeerCertificate"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__getPeerCertificateCallback, 1 } }, - { "getSession"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__getSessionCallback, 0 } }, - { "getSharedSigalgs"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__getSharedSigalgsCallback, 0 } }, - { "getTLSFinishedMessage"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__getTLSFinishedMessageCallback, 0 } }, - { "getTLSPeerFinishedMessage"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__getTLSPeerFinishedMessageCallback, 0 } }, - { "getTLSTicket"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__getTLSTicketCallback, 0 } }, - { "getTLSVersion"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__getTLSVersionCallback, 0 } }, - { "listener"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__listenerGetterWrap, 0 } }, - { "localPort"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__localPortGetterWrap, 0 } }, - { "readyState"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__readyStateGetterWrap, 0 } }, - { "ref"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__refCallback, 0 } }, - { "reload"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__reloadCallback, 1 } }, - { "remoteAddress"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__remoteAddressGetterWrap, 0 } }, - { "setMaxSendFragment"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__setMaxSendFragmentCallback, 1 } }, - { "setServername"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__setServernameCallback, 1 } }, - { "setSession"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__setSessionCallback, 0 } }, - { "shutdown"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__shutdownCallback, 1 } }, - { "timeout"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__timeoutCallback, 1 } }, - { "unref"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__unrefCallback, 0 } }, - { "upgradeTLS"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__upgradeTLSCallback, 1 } }, - { "write"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__writeCallback, 3 } } -}; - -const ClassInfo JSTCPSocketPrototype::s_info = { "TCPSocket"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTCPSocketPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsTCPSocketConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for TCPSocket"_s); - return JSValue::encode(globalObject->JSTCPSocketConstructor()); -} - -JSC_DEFINE_CUSTOM_GETTER(TCPSocketPrototype__alpnProtocolGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTCPSocket* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = TCPSocketPrototype__getALPNProtocol(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(TCPSocketPrototype__authorizedGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTCPSocket* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = TCPSocketPrototype__getAuthorized(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(TCPSocketPrototype__dataGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTCPSocket* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_data.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - TCPSocketPrototype__getData(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_data.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void TCPSocketPrototype__dataSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_data.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue TCPSocketPrototype__dataGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_data.get()); -} - -JSC_DEFINE_CUSTOM_SETTER(TCPSocketPrototype__dataSetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTCPSocket* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - auto result = TCPSocketPrototype__setData(thisObject->wrapped(), lexicalGlobalObject, encodedValue); - - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__endCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTCPSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TCPSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TCPSocketPrototype__end(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__exportKeyingMaterialCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTCPSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TCPSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TCPSocketPrototype__exportKeyingMaterial(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__flushCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTCPSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TCPSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TCPSocketPrototype__flush(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__getAuthorizationErrorCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTCPSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TCPSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TCPSocketPrototype__getAuthorizationError(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__getCertificateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTCPSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TCPSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TCPSocketPrototype__getCertificate(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__getCipherCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTCPSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TCPSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TCPSocketPrototype__getCipher(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__getEphemeralKeyInfoCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTCPSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TCPSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TCPSocketPrototype__getEphemeralKeyInfo(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__getPeerCertificateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTCPSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TCPSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TCPSocketPrototype__getPeerCertificate(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__getSessionCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTCPSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TCPSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TCPSocketPrototype__getSession(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__getSharedSigalgsCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTCPSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TCPSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TCPSocketPrototype__getSharedSigalgs(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__getTLSFinishedMessageCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTCPSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TCPSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TCPSocketPrototype__getTLSFinishedMessage(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__getTLSPeerFinishedMessageCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTCPSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TCPSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TCPSocketPrototype__getTLSPeerFinishedMessage(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__getTLSTicketCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTCPSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TCPSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TCPSocketPrototype__getTLSTicket(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__getTLSVersionCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTCPSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TCPSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TCPSocketPrototype__getTLSVersion(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(TCPSocketPrototype__listenerGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTCPSocket* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = TCPSocketPrototype__getListener(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(TCPSocketPrototype__localPortGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTCPSocket* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = TCPSocketPrototype__getLocalPort(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(TCPSocketPrototype__readyStateGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTCPSocket* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = TCPSocketPrototype__getReadyState(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__refCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTCPSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TCPSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TCPSocketPrototype__ref(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__reloadCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTCPSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TCPSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TCPSocketPrototype__reload(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(TCPSocketPrototype__remoteAddressGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTCPSocket* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_remoteAddress.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - TCPSocketPrototype__getRemoteAddress(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_remoteAddress.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void TCPSocketPrototype__remoteAddressSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_remoteAddress.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue TCPSocketPrototype__remoteAddressGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_remoteAddress.get()); -} - -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__setMaxSendFragmentCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTCPSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TCPSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TCPSocketPrototype__setMaxSendFragment(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__setServernameCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTCPSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TCPSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TCPSocketPrototype__setServername(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__setSessionCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTCPSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TCPSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TCPSocketPrototype__setSession(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__shutdownCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTCPSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TCPSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TCPSocketPrototype__shutdown(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__timeoutCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTCPSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TCPSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TCPSocketPrototype__timeout(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__unrefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTCPSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TCPSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TCPSocketPrototype__unref(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__upgradeTLSCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTCPSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TCPSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TCPSocketPrototype__upgradeTLS(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__writeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTCPSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TCPSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TCPSocketPrototype__write(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSTCPSocketPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSTCPSocket::info(), JSTCPSocketPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -extern "C" bool TCPSocket__hasPendingActivity(void* ptr); -bool JSTCPSocket::hasPendingActivity(void* ctx) -{ - return TCPSocket__hasPendingActivity(ctx); -} - -JSTCPSocket::~JSTCPSocket() -{ - if (m_ctx) { - TCPSocketClass__finalize(m_ctx); - } -} -void JSTCPSocket::destroy(JSCell* cell) -{ - static_cast(cell)->JSTCPSocket::~JSTCPSocket(); -} - -const ClassInfo JSTCPSocket::s_info = { "TCPSocket"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTCPSocket) }; - -void JSTCPSocket::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSTCPSocket* JSTCPSocket::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSTCPSocket* ptr = new (NotNull, JSC::allocateCell(vm)) JSTCPSocket(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* TCPSocket__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSTCPSocket* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool TCPSocket__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSTCPSocket* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t TCPSocket__ptrOffset = JSTCPSocket::offsetOfWrapped(); - -void JSTCPSocket::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSTCPSocket::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSTCPSocketPrototype::create(vm, globalObject, JSTCPSocketPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue TCPSocket__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSTCPSocketStructure(); - JSTCPSocket* instance = JSTCPSocket::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSTCPSocket::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSTCPSocket* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSTCPSocket); - -template -void JSTCPSocket::visitAdditionalChildren(Visitor& visitor) -{ - JSTCPSocket* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_data); - visitor.append(thisObject->m_remoteAddress); - visitor.addOpaqueRoot(this->wrapped()); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSTCPSocket); - -template -void JSTCPSocket::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSTCPSocket* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSTCPSocket); -class JSTLSSocketPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSTLSSocketPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSTLSSocketPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSTLSSocketPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTLSSocketPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSTLSSocketPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -extern "C" void* TLSSocketClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsTLSSocketConstructor); - -extern "C" void TLSSocketClass__finalize(void*); - -extern "C" JSC::EncodedJSValue TLSSocketPrototype__getALPNProtocol(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TLSSocketPrototype__alpnProtocolGetterWrap); - -extern "C" JSC::EncodedJSValue TLSSocketPrototype__getAuthorized(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TLSSocketPrototype__authorizedGetterWrap); - -extern "C" JSC::EncodedJSValue TLSSocketPrototype__getData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TLSSocketPrototype__dataGetterWrap); - -extern "C" bool TLSSocketPrototype__setData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::EncodedJSValue value); -JSC_DECLARE_CUSTOM_SETTER(TLSSocketPrototype__dataSetterWrap); - -extern "C" EncodedJSValue TLSSocketPrototype__end(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__endCallback); - -extern "C" EncodedJSValue TLSSocketPrototype__exportKeyingMaterial(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__exportKeyingMaterialCallback); - -extern "C" EncodedJSValue TLSSocketPrototype__flush(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__flushCallback); - -extern "C" EncodedJSValue TLSSocketPrototype__getAuthorizationError(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__getAuthorizationErrorCallback); - -extern "C" EncodedJSValue TLSSocketPrototype__getCertificate(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__getCertificateCallback); - -extern "C" EncodedJSValue TLSSocketPrototype__getCipher(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__getCipherCallback); - -extern "C" EncodedJSValue TLSSocketPrototype__getEphemeralKeyInfo(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__getEphemeralKeyInfoCallback); - -extern "C" EncodedJSValue TLSSocketPrototype__getPeerCertificate(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__getPeerCertificateCallback); - -extern "C" EncodedJSValue TLSSocketPrototype__getSession(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__getSessionCallback); - -extern "C" EncodedJSValue TLSSocketPrototype__getSharedSigalgs(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__getSharedSigalgsCallback); - -extern "C" EncodedJSValue TLSSocketPrototype__getTLSFinishedMessage(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__getTLSFinishedMessageCallback); - -extern "C" EncodedJSValue TLSSocketPrototype__getTLSPeerFinishedMessage(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__getTLSPeerFinishedMessageCallback); - -extern "C" EncodedJSValue TLSSocketPrototype__getTLSTicket(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__getTLSTicketCallback); - -extern "C" EncodedJSValue TLSSocketPrototype__getTLSVersion(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__getTLSVersionCallback); - -extern "C" JSC::EncodedJSValue TLSSocketPrototype__getListener(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TLSSocketPrototype__listenerGetterWrap); - -extern "C" JSC::EncodedJSValue TLSSocketPrototype__getLocalPort(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TLSSocketPrototype__localPortGetterWrap); - -extern "C" JSC::EncodedJSValue TLSSocketPrototype__getReadyState(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TLSSocketPrototype__readyStateGetterWrap); - -extern "C" EncodedJSValue TLSSocketPrototype__ref(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__refCallback); - -extern "C" EncodedJSValue TLSSocketPrototype__reload(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__reloadCallback); - -extern "C" JSC::EncodedJSValue TLSSocketPrototype__getRemoteAddress(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TLSSocketPrototype__remoteAddressGetterWrap); - -extern "C" EncodedJSValue TLSSocketPrototype__setMaxSendFragment(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__setMaxSendFragmentCallback); - -extern "C" EncodedJSValue TLSSocketPrototype__setServername(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__setServernameCallback); - -extern "C" EncodedJSValue TLSSocketPrototype__setSession(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__setSessionCallback); - -extern "C" EncodedJSValue TLSSocketPrototype__shutdown(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__shutdownCallback); - -extern "C" EncodedJSValue TLSSocketPrototype__timeout(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__timeoutCallback); - -extern "C" EncodedJSValue TLSSocketPrototype__unref(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__unrefCallback); - -extern "C" EncodedJSValue TLSSocketPrototype__upgradeTLS(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__upgradeTLSCallback); - -extern "C" EncodedJSValue TLSSocketPrototype__write(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__writeCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTLSSocketPrototype, JSTLSSocketPrototype::Base); - -static const HashTableValue JSTLSSocketPrototypeTableValues[] = { - { "alpnProtocol"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__alpnProtocolGetterWrap, 0 } }, - { "authorized"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__authorizedGetterWrap, 0 } }, - { "data"_s, static_cast(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__dataGetterWrap, TLSSocketPrototype__dataSetterWrap } }, - { "end"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__endCallback, 3 } }, - { "exportKeyingMaterial"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__exportKeyingMaterialCallback, 3 } }, - { "flush"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__flushCallback, 0 } }, - { "getAuthorizationError"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__getAuthorizationErrorCallback, 0 } }, - { "getCertificate"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__getCertificateCallback, 0 } }, - { "getCipher"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__getCipherCallback, 0 } }, - { "getEphemeralKeyInfo"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__getEphemeralKeyInfoCallback, 0 } }, - { "getPeerCertificate"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__getPeerCertificateCallback, 1 } }, - { "getSession"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__getSessionCallback, 0 } }, - { "getSharedSigalgs"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__getSharedSigalgsCallback, 0 } }, - { "getTLSFinishedMessage"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__getTLSFinishedMessageCallback, 0 } }, - { "getTLSPeerFinishedMessage"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__getTLSPeerFinishedMessageCallback, 0 } }, - { "getTLSTicket"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__getTLSTicketCallback, 0 } }, - { "getTLSVersion"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__getTLSVersionCallback, 0 } }, - { "listener"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__listenerGetterWrap, 0 } }, - { "localPort"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__localPortGetterWrap, 0 } }, - { "readyState"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__readyStateGetterWrap, 0 } }, - { "ref"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__refCallback, 0 } }, - { "reload"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__reloadCallback, 1 } }, - { "remoteAddress"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__remoteAddressGetterWrap, 0 } }, - { "setMaxSendFragment"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__setMaxSendFragmentCallback, 1 } }, - { "setServername"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__setServernameCallback, 1 } }, - { "setSession"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__setSessionCallback, 0 } }, - { "shutdown"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__shutdownCallback, 1 } }, - { "timeout"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__timeoutCallback, 1 } }, - { "unref"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__unrefCallback, 0 } }, - { "upgradeTLS"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__upgradeTLSCallback, 1 } }, - { "write"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__writeCallback, 3 } } -}; - -const ClassInfo JSTLSSocketPrototype::s_info = { "TLSSocket"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTLSSocketPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsTLSSocketConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for TLSSocket"_s); - return JSValue::encode(globalObject->JSTLSSocketConstructor()); -} - -JSC_DEFINE_CUSTOM_GETTER(TLSSocketPrototype__alpnProtocolGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTLSSocket* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = TLSSocketPrototype__getALPNProtocol(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(TLSSocketPrototype__authorizedGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTLSSocket* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = TLSSocketPrototype__getAuthorized(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(TLSSocketPrototype__dataGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTLSSocket* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_data.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - TLSSocketPrototype__getData(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_data.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void TLSSocketPrototype__dataSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_data.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue TLSSocketPrototype__dataGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_data.get()); -} - -JSC_DEFINE_CUSTOM_SETTER(TLSSocketPrototype__dataSetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTLSSocket* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - auto result = TLSSocketPrototype__setData(thisObject->wrapped(), lexicalGlobalObject, encodedValue); - - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__endCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTLSSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TLSSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TLSSocketPrototype__end(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__exportKeyingMaterialCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTLSSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TLSSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TLSSocketPrototype__exportKeyingMaterial(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__flushCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTLSSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TLSSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TLSSocketPrototype__flush(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__getAuthorizationErrorCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTLSSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TLSSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TLSSocketPrototype__getAuthorizationError(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__getCertificateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTLSSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TLSSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TLSSocketPrototype__getCertificate(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__getCipherCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTLSSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TLSSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TLSSocketPrototype__getCipher(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__getEphemeralKeyInfoCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTLSSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TLSSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TLSSocketPrototype__getEphemeralKeyInfo(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__getPeerCertificateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTLSSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TLSSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TLSSocketPrototype__getPeerCertificate(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__getSessionCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTLSSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TLSSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TLSSocketPrototype__getSession(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__getSharedSigalgsCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTLSSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TLSSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TLSSocketPrototype__getSharedSigalgs(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__getTLSFinishedMessageCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTLSSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TLSSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TLSSocketPrototype__getTLSFinishedMessage(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__getTLSPeerFinishedMessageCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTLSSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TLSSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TLSSocketPrototype__getTLSPeerFinishedMessage(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__getTLSTicketCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTLSSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TLSSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TLSSocketPrototype__getTLSTicket(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__getTLSVersionCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTLSSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TLSSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TLSSocketPrototype__getTLSVersion(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(TLSSocketPrototype__listenerGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTLSSocket* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = TLSSocketPrototype__getListener(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(TLSSocketPrototype__localPortGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTLSSocket* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = TLSSocketPrototype__getLocalPort(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(TLSSocketPrototype__readyStateGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTLSSocket* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = TLSSocketPrototype__getReadyState(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__refCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTLSSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TLSSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TLSSocketPrototype__ref(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__reloadCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTLSSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TLSSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TLSSocketPrototype__reload(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(TLSSocketPrototype__remoteAddressGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTLSSocket* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_remoteAddress.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - TLSSocketPrototype__getRemoteAddress(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_remoteAddress.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void TLSSocketPrototype__remoteAddressSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_remoteAddress.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue TLSSocketPrototype__remoteAddressGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_remoteAddress.get()); -} - -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__setMaxSendFragmentCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTLSSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TLSSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TLSSocketPrototype__setMaxSendFragment(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__setServernameCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTLSSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TLSSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TLSSocketPrototype__setServername(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__setSessionCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTLSSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TLSSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TLSSocketPrototype__setSession(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__shutdownCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTLSSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TLSSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TLSSocketPrototype__shutdown(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__timeoutCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTLSSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TLSSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TLSSocketPrototype__timeout(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__unrefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTLSSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TLSSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TLSSocketPrototype__unref(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__upgradeTLSCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTLSSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TLSSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TLSSocketPrototype__upgradeTLS(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__writeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTLSSocket* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TLSSocket"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TLSSocketPrototype__write(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSTLSSocketPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSTLSSocket::info(), JSTLSSocketPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -extern "C" bool TLSSocket__hasPendingActivity(void* ptr); -bool JSTLSSocket::hasPendingActivity(void* ctx) -{ - return TLSSocket__hasPendingActivity(ctx); -} - -JSTLSSocket::~JSTLSSocket() -{ - if (m_ctx) { - TLSSocketClass__finalize(m_ctx); - } -} -void JSTLSSocket::destroy(JSCell* cell) -{ - static_cast(cell)->JSTLSSocket::~JSTLSSocket(); -} - -const ClassInfo JSTLSSocket::s_info = { "TLSSocket"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTLSSocket) }; - -void JSTLSSocket::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSTLSSocket* JSTLSSocket::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSTLSSocket* ptr = new (NotNull, JSC::allocateCell(vm)) JSTLSSocket(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* TLSSocket__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSTLSSocket* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool TLSSocket__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSTLSSocket* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t TLSSocket__ptrOffset = JSTLSSocket::offsetOfWrapped(); - -void JSTLSSocket::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSTLSSocket::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSTLSSocketPrototype::create(vm, globalObject, JSTLSSocketPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue TLSSocket__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSTLSSocketStructure(); - JSTLSSocket* instance = JSTLSSocket::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSTLSSocket::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSTLSSocket* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSTLSSocket); - -template -void JSTLSSocket::visitAdditionalChildren(Visitor& visitor) -{ - JSTLSSocket* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_data); - visitor.append(thisObject->m_remoteAddress); - visitor.addOpaqueRoot(this->wrapped()); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSTLSSocket); - -template -void JSTLSSocket::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSTLSSocket* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSTLSSocket); -class JSTextChunkPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSTextChunkPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSTextChunkPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSTextChunkPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTextChunkPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSTextChunkPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -extern "C" void* TextChunkClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsTextChunkConstructor); - -extern "C" void TextChunkClass__finalize(void*); - -extern "C" EncodedJSValue TextChunkPrototype__after(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TextChunkPrototype__afterCallback); - -extern "C" EncodedJSValue TextChunkPrototype__before(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TextChunkPrototype__beforeCallback); - -extern "C" JSC::EncodedJSValue TextChunkPrototype__lastInTextNode(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TextChunkPrototype__lastInTextNodeGetterWrap); - -extern "C" EncodedJSValue TextChunkPrototype__remove(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TextChunkPrototype__removeCallback); - -extern "C" JSC::EncodedJSValue TextChunkPrototype__removed(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TextChunkPrototype__removedGetterWrap); - -extern "C" EncodedJSValue TextChunkPrototype__replace(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TextChunkPrototype__replaceCallback); - -extern "C" JSC::EncodedJSValue TextChunkPrototype__getText(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TextChunkPrototype__textGetterWrap); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTextChunkPrototype, JSTextChunkPrototype::Base); - -static const HashTableValue JSTextChunkPrototypeTableValues[] = { - { "after"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TextChunkPrototype__afterCallback, 1 } }, - { "before"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TextChunkPrototype__beforeCallback, 1 } }, - { "lastInTextNode"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TextChunkPrototype__lastInTextNodeGetterWrap, 0 } }, - { "remove"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TextChunkPrototype__removeCallback, 0 } }, - { "removed"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TextChunkPrototype__removedGetterWrap, 0 } }, - { "replace"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TextChunkPrototype__replaceCallback, 1 } }, - { "text"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TextChunkPrototype__textGetterWrap, 0 } } -}; - -const ClassInfo JSTextChunkPrototype::s_info = { "TextChunk"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTextChunkPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsTextChunkConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for TextChunk"_s); - return JSValue::encode(globalObject->JSTextChunkConstructor()); -} - -JSC_DEFINE_HOST_FUNCTION(TextChunkPrototype__afterCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTextChunk* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TextChunk"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TextChunkPrototype__after(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TextChunkPrototype__beforeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTextChunk* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TextChunk"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TextChunkPrototype__before(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(TextChunkPrototype__lastInTextNodeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTextChunk* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_lastInTextNode.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - TextChunkPrototype__lastInTextNode(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_lastInTextNode.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void TextChunkPrototype__lastInTextNodeSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_lastInTextNode.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue TextChunkPrototype__lastInTextNodeGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_lastInTextNode.get()); -} - -JSC_DEFINE_HOST_FUNCTION(TextChunkPrototype__removeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTextChunk* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TextChunk"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TextChunkPrototype__remove(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(TextChunkPrototype__removedGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTextChunk* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = TextChunkPrototype__removed(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_HOST_FUNCTION(TextChunkPrototype__replaceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTextChunk* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TextChunk"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TextChunkPrototype__replace(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(TextChunkPrototype__textGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTextChunk* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = TextChunkPrototype__getText(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -void JSTextChunkPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSTextChunk::info(), JSTextChunkPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -JSTextChunk::~JSTextChunk() -{ - if (m_ctx) { - TextChunkClass__finalize(m_ctx); - } -} -void JSTextChunk::destroy(JSCell* cell) -{ - static_cast(cell)->JSTextChunk::~JSTextChunk(); -} - -const ClassInfo JSTextChunk::s_info = { "TextChunk"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTextChunk) }; - -void JSTextChunk::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSTextChunk* JSTextChunk::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSTextChunk* ptr = new (NotNull, JSC::allocateCell(vm)) JSTextChunk(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* TextChunk__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSTextChunk* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool TextChunk__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSTextChunk* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t TextChunk__ptrOffset = JSTextChunk::offsetOfWrapped(); - -void JSTextChunk::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSTextChunk::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSTextChunkPrototype::create(vm, globalObject, JSTextChunkPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue TextChunk__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSTextChunkStructure(); - JSTextChunk* instance = JSTextChunk::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSTextChunk::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSTextChunk* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSTextChunk); - -template -void JSTextChunk::visitAdditionalChildren(Visitor& visitor) -{ - JSTextChunk* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_lastInTextNode); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSTextChunk); - -template -void JSTextChunk::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSTextChunk* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSTextChunk); -class JSTextDecoderPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSTextDecoderPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSTextDecoderPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSTextDecoderPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTextDecoderPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSTextDecoderPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -class JSTextDecoderConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSTextDecoderConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSTextDecoderPrototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForTextDecoderConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTextDecoderConstructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForTextDecoderConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForTextDecoderConstructor = std::forward(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSTextDecoderPrototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSTextDecoderConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSTextDecoderPrototype* prototype); -}; - -extern "C" void* TextDecoderClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsTextDecoderConstructor); - -extern "C" void TextDecoderClass__finalize(void*); - -extern "C" EncodedJSValue TextDecoderPrototype__decode(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TextDecoderPrototype__decodeCallback); - -extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(TextDecoderPrototype__decodeWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSUint8Array* arg0)); -extern "C" EncodedJSValue TextDecoderPrototype__decodeWithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSUint8Array* arg0); - -static const JSC::DOMJIT::Signature DOMJITSignatureForTextDecoderPrototype__decode(TextDecoderPrototype__decodeWithoutTypeChecksWrapper, - JSTextDecoder::info(), - JSC::DOMJIT::Effect::forReadWrite(JSC::DOMJIT::HeapRange::top(), JSC::DOMJIT::HeapRange::top()), - JSC::SpecString, JSC::SpecUint8Array); - -JSC_DEFINE_JIT_OPERATION(TextDecoderPrototype__decodeWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSUint8Array* arg0)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - IGNORE_WARNINGS_BEGIN("frame-address") - CallFrame* callFrame = DECLARE_CALL_FRAME(vm); - IGNORE_WARNINGS_END - JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); - return TextDecoderPrototype__decodeWithoutTypeChecks(reinterpret_cast(thisValue)->wrapped(), lexicalGlobalObject, arg0); -} - -extern "C" JSC::EncodedJSValue TextDecoderPrototype__getEncoding(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TextDecoderPrototype__encodingGetterWrap); - -extern "C" JSC::EncodedJSValue TextDecoderPrototype__getFatal(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TextDecoderPrototype__fatalGetterWrap); - -extern "C" JSC::EncodedJSValue TextDecoderPrototype__getIgnoreBOM(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TextDecoderPrototype__ignoreBOMGetterWrap); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTextDecoderPrototype, JSTextDecoderPrototype::Base); - -static const HashTableValue JSTextDecoderPrototypeTableValues[] = { - { "decode"_s, static_cast(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, TextDecoderPrototype__decodeCallback, &DOMJITSignatureForTextDecoderPrototype__decode } }, - { "encoding"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TextDecoderPrototype__encodingGetterWrap, 0 } }, - { "fatal"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TextDecoderPrototype__fatalGetterWrap, 0 } }, - { "ignoreBOM"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TextDecoderPrototype__ignoreBOMGetterWrap, 0 } } -}; - -const ClassInfo JSTextDecoderPrototype::s_info = { "TextDecoder"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTextDecoderPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsTextDecoderConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for TextDecoder"_s); - return JSValue::encode(globalObject->JSTextDecoderConstructor()); -} - -JSC_DEFINE_HOST_FUNCTION(TextDecoderPrototype__decodeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTextDecoder* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof TextDecoder"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TextDecoderPrototype__decode(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_CUSTOM_GETTER(TextDecoderPrototype__encodingGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTextDecoder* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - if (JSValue cachedValue = thisObject->m_encoding.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - TextDecoderPrototype__getEncoding(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_encoding.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} - -extern "C" void TextDecoderPrototype__encodingSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_encoding.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue TextDecoderPrototype__encodingGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_encoding.get()); -} - -JSC_DEFINE_CUSTOM_GETTER(TextDecoderPrototype__fatalGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTextDecoder* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = TextDecoderPrototype__getFatal(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_GETTER(TextDecoderPrototype__ignoreBOMGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTextDecoder* thisObject = jsCast(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = TextDecoderPrototype__getIgnoreBOM(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -void JSTextDecoderPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSTextDecoder::info(), JSTextDecoderPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -void JSTextDecoderConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSTextDecoderPrototype* prototype) -{ - Base::finishCreation(vm, 0, "TextDecoder"_s, PropertyAdditionMode::WithoutStructureTransition); - - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} - -JSTextDecoderConstructor::JSTextDecoderConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} - -JSTextDecoderConstructor* JSTextDecoderConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSTextDecoderPrototype* prototype) -{ - JSTextDecoderConstructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSTextDecoderConstructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSTextDecoderConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) -{ - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); - JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSTextDecoderConstructor(); - Structure* structure = globalObject->JSTextDecoderStructure(); - if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); - - auto* functionGlobalObject = reinterpret_cast( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSTextDecoderStructure()); - } - - void* ptr = TextDecoderClass__construct(globalObject, callFrame); - - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); - } - - JSTextDecoder* instance = JSTextDecoder::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -void JSTextDecoderConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSTextDecoderPrototype* prototype) -{ -} - -const ClassInfo JSTextDecoderConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTextDecoderConstructor) }; - -extern "C" EncodedJSValue TextDecoder__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSTextDecoderConstructor()); -} - -JSTextDecoder::~JSTextDecoder() -{ - if (m_ctx) { - TextDecoderClass__finalize(m_ctx); - } -} -void JSTextDecoder::destroy(JSCell* cell) -{ - static_cast(cell)->JSTextDecoder::~JSTextDecoder(); -} - -const ClassInfo JSTextDecoder::s_info = { "TextDecoder"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTextDecoder) }; - -void JSTextDecoder::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSTextDecoder* JSTextDecoder::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSTextDecoder* ptr = new (NotNull, JSC::allocateCell(vm)) JSTextDecoder(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* TextDecoder__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSTextDecoder* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool TextDecoder__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSTextDecoder* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t TextDecoder__ptrOffset = JSTextDecoder::offsetOfWrapped(); - -void JSTextDecoder::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSTextDecoder::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) -{ - return WebCore::JSTextDecoderConstructor::create(vm, globalObject, WebCore::JSTextDecoderConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast(prototype)); -} - -JSObject* JSTextDecoder::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSTextDecoderPrototype::create(vm, globalObject, JSTextDecoderPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue TextDecoder__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSTextDecoderStructure(); - JSTextDecoder* instance = JSTextDecoder::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSTextDecoder::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSTextDecoder* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSTextDecoder); - -template -void JSTextDecoder::visitAdditionalChildren(Visitor& visitor) -{ - JSTextDecoder* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_encoding); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSTextDecoder); - -template -void JSTextDecoder::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSTextDecoder* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSTextDecoder); -class JSTimeoutPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSTimeoutPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSTimeoutPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSTimeoutPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTimeoutPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSTimeoutPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -extern "C" void TimeoutClass__finalize(void*); - -extern "C" EncodedJSValue TimeoutPrototype__toPrimitive(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TimeoutPrototype__toPrimitiveCallback); - -extern "C" EncodedJSValue TimeoutPrototype__hasRef(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TimeoutPrototype__hasRefCallback); - -extern "C" EncodedJSValue TimeoutPrototype__doRef(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TimeoutPrototype__refCallback); - -extern "C" EncodedJSValue TimeoutPrototype__doRefresh(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TimeoutPrototype__refreshCallback); - -extern "C" EncodedJSValue TimeoutPrototype__doUnref(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TimeoutPrototype__unrefCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTimeoutPrototype, JSTimeoutPrototype::Base); - -static const HashTableValue JSTimeoutPrototypeTableValues[] = { - { "hasRef"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TimeoutPrototype__hasRefCallback, 0 } }, - { "ref"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TimeoutPrototype__refCallback, 0 } }, - { "refresh"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TimeoutPrototype__refreshCallback, 0 } }, - { "unref"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TimeoutPrototype__unrefCallback, 0 } } -}; - -const ClassInfo JSTimeoutPrototype::s_info = { "Timeout"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTimeoutPrototype) }; - -JSC_DEFINE_HOST_FUNCTION(TimeoutPrototype__toPrimitiveCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTimeout* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Timeout"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TimeoutPrototype__toPrimitive(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TimeoutPrototype__hasRefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTimeout* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Timeout"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TimeoutPrototype__hasRef(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TimeoutPrototype__refCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTimeout* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Timeout"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TimeoutPrototype__doRef(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TimeoutPrototype__refreshCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTimeout* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Timeout"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TimeoutPrototype__doRefresh(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TimeoutPrototype__unrefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTimeout* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Timeout"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TimeoutPrototype__doUnref(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -extern "C" void TimeoutPrototype__argumentsSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_arguments.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue TimeoutPrototype__argumentsGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_arguments.get()); -} - -extern "C" void TimeoutPrototype__callbackSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast(JSValue::decode(thisValue)); - thisObject->m_callback.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue TimeoutPrototype__callbackGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_callback.get()); -} - -void JSTimeoutPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSTimeout::info(), JSTimeoutPrototypeTableValues, *this); - this->putDirect(vm, vm.propertyNames->toPrimitiveSymbol, JSFunction::create(vm, globalObject, 1, String("toPrimitive"_s), TimeoutPrototype__toPrimitiveCallback, ImplementationVisibility::Public), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | 0); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -JSTimeout::~JSTimeout() -{ - if (m_ctx) { - TimeoutClass__finalize(m_ctx); - } -} -void JSTimeout::destroy(JSCell* cell) -{ - static_cast(cell)->JSTimeout::~JSTimeout(); -} - -const ClassInfo JSTimeout::s_info = { "Timeout"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTimeout) }; - -void JSTimeout::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSTimeout* JSTimeout::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSTimeout* ptr = new (NotNull, JSC::allocateCell(vm)) JSTimeout(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* Timeout__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSTimeout* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool Timeout__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSTimeout* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t Timeout__ptrOffset = JSTimeout::offsetOfWrapped(); - -void JSTimeout::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSTimeout::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSTimeoutPrototype::create(vm, globalObject, JSTimeoutPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue Timeout__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSTimeoutStructure(); - JSTimeout* instance = JSTimeout::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -template -void JSTimeout::visitChildrenImpl(JSCell* cell, Visitor& visitor) -{ - JSTimeout* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_CHILDREN(JSTimeout); - -template -void JSTimeout::visitAdditionalChildren(Visitor& visitor) -{ - JSTimeout* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - visitor.append(thisObject->m_arguments); - visitor.append(thisObject->m_callback); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSTimeout); - -template -void JSTimeout::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSTimeout* thisObject = jsCast(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSTimeout); -class JSTranspilerPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSTranspilerPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSTranspilerPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSTranspilerPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTranspilerPrototype, Base); - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSTranspilerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; - -class JSTranspilerConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSTranspilerConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSTranspilerPrototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForTranspilerConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTranspilerConstructor = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForTranspilerConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForTranspilerConstructor = std::forward(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSTranspilerPrototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSTranspilerConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSTranspilerPrototype* prototype); -}; - -extern "C" void* TranspilerClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsTranspilerConstructor); - -extern "C" void TranspilerClass__finalize(void*); - -extern "C" EncodedJSValue TranspilerPrototype__scan(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TranspilerPrototype__scanCallback); - -extern "C" EncodedJSValue TranspilerPrototype__scanImports(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TranspilerPrototype__scanImportsCallback); - -extern "C" EncodedJSValue TranspilerPrototype__transform(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TranspilerPrototype__transformCallback); - -extern "C" EncodedJSValue TranspilerPrototype__transformSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TranspilerPrototype__transformSyncCallback); - -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTranspilerPrototype, JSTranspilerPrototype::Base); - -static const HashTableValue JSTranspilerPrototypeTableValues[] = { - { "scan"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TranspilerPrototype__scanCallback, 2 } }, - { "scanImports"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TranspilerPrototype__scanImportsCallback, 2 } }, - { "transform"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TranspilerPrototype__transformCallback, 2 } }, - { "transformSync"_s, static_cast(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TranspilerPrototype__transformSyncCallback, 2 } } -}; - -const ClassInfo JSTranspilerPrototype::s_info = { "Transpiler"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTranspilerPrototype) }; - -JSC_DEFINE_CUSTOM_GETTER(jsTranspilerConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); - auto* prototype = jsDynamicCast(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope, "Cannot get constructor for Transpiler"_s); - return JSValue::encode(globalObject->JSTranspilerConstructor()); -} - -JSC_DEFINE_HOST_FUNCTION(TranspilerPrototype__scanCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTranspiler* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Transpiler"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TranspilerPrototype__scan(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TranspilerPrototype__scanImportsCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTranspiler* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Transpiler"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TranspilerPrototype__scanImports(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TranspilerPrototype__transformCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTranspiler* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Transpiler"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TranspilerPrototype__transform(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TranspilerPrototype__transformSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTranspiler* thisObject = jsDynamicCast(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - throwVMTypeError(lexicalGlobalObject, throwScope, "Expected 'this' to be instanceof Transpiler"_s); - return JSValue::encode({}); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return TranspilerPrototype__transformSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSTranspilerPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSTranspiler::info(), JSTranspilerPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -void JSTranspilerConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSTranspilerPrototype* prototype) -{ - Base::finishCreation(vm, 0, "Transpiler"_s, PropertyAdditionMode::WithoutStructureTransition); - - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} - -JSTranspilerConstructor::JSTranspilerConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} - -JSTranspilerConstructor* JSTranspilerConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSTranspilerPrototype* prototype) -{ - JSTranspilerConstructor* ptr = new (NotNull, JSC::allocateCell(vm)) JSTranspilerConstructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; -} - -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSTranspilerConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) -{ - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); - JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSTranspilerConstructor(); - Structure* structure = globalObject->JSTranspilerStructure(); - if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); - - auto* functionGlobalObject = reinterpret_cast( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSTranspilerStructure()); - } - - void* ptr = TranspilerClass__construct(globalObject, callFrame); - - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); - } - - JSTranspiler* instance = JSTranspiler::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} - -void JSTranspilerConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSTranspilerPrototype* prototype) -{ -} - -const ClassInfo JSTranspilerConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTranspilerConstructor) }; - -extern "C" EncodedJSValue Transpiler__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSTranspilerConstructor()); -} - -JSTranspiler::~JSTranspiler() -{ - if (m_ctx) { - TranspilerClass__finalize(m_ctx); - } -} -void JSTranspiler::destroy(JSCell* cell) -{ - static_cast(cell)->JSTranspiler::~JSTranspiler(); -} - -const ClassInfo JSTranspiler::s_info = { "Transpiler"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTranspiler) }; - -void JSTranspiler::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} - -JSTranspiler* JSTranspiler::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSTranspiler* ptr = new (NotNull, JSC::allocateCell(vm)) JSTranspiler(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} - -extern "C" void* Transpiler__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; - - JSC::JSCell* cell = decodedValue.asCell(); - JSTranspiler* object = JSC::jsDynamicCast(cell); - - if (!object) - return nullptr; - - return object->wrapped(); -} - -extern "C" bool Transpiler__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSTranspiler* object = JSC::jsDynamicCast(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} - -extern "C" const size_t Transpiler__ptrOffset = JSTranspiler::offsetOfWrapped(); - -void JSTranspiler::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} - -JSObject* JSTranspiler::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) -{ - return WebCore::JSTranspilerConstructor::create(vm, globalObject, WebCore::JSTranspilerConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast(prototype)); -} - -JSObject* JSTranspiler::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSTranspilerPrototype::create(vm, globalObject, JSTranspilerPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} - -extern "C" EncodedJSValue Transpiler__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSTranspilerStructure(); - JSTranspiler* instance = JSTranspiler::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -std::optional StructuredCloneableSerialize::fromJS(JSC::JSValue value) -{ - if (auto* result = jsDynamicCast(value)) { - return StructuredCloneableSerialize { .cppWriteBytes = SerializedScriptValue::writeBytesForBun, .zigFunction = Blob__onStructuredCloneSerialize, .tag = 254, .impl = result->wrapped() }; - } - return std::nullopt; -} - -std::optional StructuredCloneableDeserialize::fromTagDeserialize(uint8_t tag, JSC::JSGlobalObject* globalObject, const uint8_t* ptr, const uint8_t* end) -{ - if (tag == 254) { - return Blob__onStructuredCloneDeserialize(globalObject, ptr, end); - } - return std::nullopt; -} - -} // namespace WebCore diff --git a/src/bun.js/bindings/ZigGeneratedClasses.h b/src/bun.js/bindings/ZigGeneratedClasses.h deleted file mode 100644 index c1d7ca99e7ae5..0000000000000 --- a/src/bun.js/bindings/ZigGeneratedClasses.h +++ /dev/null @@ -1,2982 +0,0 @@ - -// GENERATED CODE - DO NOT MODIFY BY HAND -// Generated by make codegen -#pragma once - -#include "root.h" - -namespace Zig { -} - -#include "JSDOMWrapper.h" -#include -#include "SerializedScriptValue.h" - -namespace WebCore { -using namespace Zig; -using namespace JSC; - -class JSAttributeIterator final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSAttributeIterator* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForAttributeIterator.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForAttributeIterator = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForAttributeIterator.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForAttributeIterator = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSAttributeIterator(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSAttributeIterator, m_ctx); } - - void* m_ctx { nullptr }; - - JSAttributeIterator(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -class JSBigIntStats final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSBigIntStats* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForBigIntStats.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForBigIntStats = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForBigIntStats.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForBigIntStats = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSBigIntStats(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSBigIntStats, m_ctx); } - - void* m_ctx { nullptr }; - - JSBigIntStats(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_atime; - mutable JSC::WriteBarrier m_birthtime; - mutable JSC::WriteBarrier m_ctime; - mutable JSC::WriteBarrier m_mtime; -}; - -class JSBlob final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSBlob* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForBlob.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForBlob = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForBlob.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForBlob = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSBlob(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSBlob, m_ctx); } - - void* m_ctx { nullptr }; - - JSBlob(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_name; -}; - -class JSBuildArtifact final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSBuildArtifact* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForBuildArtifact.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForBuildArtifact = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForBuildArtifact.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForBuildArtifact = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSBuildArtifact(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSBuildArtifact, m_ctx); } - - void* m_ctx { nullptr }; - - JSBuildArtifact(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_hash; - mutable JSC::WriteBarrier m_kind; - mutable JSC::WriteBarrier m_loader; - mutable JSC::WriteBarrier m_path; - mutable JSC::WriteBarrier m_sourcemap; - mutable JSC::WriteBarrier m_type; -}; - -class JSBuildMessage final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSBuildMessage* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForBuildMessage.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForBuildMessage = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForBuildMessage.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForBuildMessage = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSBuildMessage(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSBuildMessage, m_ctx); } - - void* m_ctx { nullptr }; - - JSBuildMessage(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_level; - mutable JSC::WriteBarrier m_message; - mutable JSC::WriteBarrier m_position; -}; - -class JSComment final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSComment* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForComment.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForComment = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForComment.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForComment = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSComment(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSComment, m_ctx); } - - void* m_ctx { nullptr }; - - JSComment(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -class JSCrypto final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSCrypto* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForCrypto.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForCrypto = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForCrypto.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForCrypto = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(ObjectType), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSCrypto(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSCrypto, m_ctx); } - - void* m_ctx { nullptr }; - - JSCrypto(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -class JSCryptoHasher final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSCryptoHasher* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForCryptoHasher.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForCryptoHasher = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForCryptoHasher.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForCryptoHasher = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSCryptoHasher(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSCryptoHasher, m_ctx); } - - void* m_ctx { nullptr }; - - JSCryptoHasher(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_algorithms; - mutable JSC::WriteBarrier m_algorithm; -}; - -class JSDebugHTTPSServer final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSDebugHTTPSServer* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForDebugHTTPSServer.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForDebugHTTPSServer = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForDebugHTTPSServer.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForDebugHTTPSServer = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(ObjectType), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSDebugHTTPSServer(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSDebugHTTPSServer, m_ctx); } - - void* m_ctx { nullptr }; - - JSDebugHTTPSServer(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_address; - mutable JSC::WriteBarrier m_hostname; - mutable JSC::WriteBarrier m_id; -}; - -class JSDebugHTTPServer final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSDebugHTTPServer* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForDebugHTTPServer.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForDebugHTTPServer = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForDebugHTTPServer.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForDebugHTTPServer = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(ObjectType), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSDebugHTTPServer(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSDebugHTTPServer, m_ctx); } - - void* m_ctx { nullptr }; - - JSDebugHTTPServer(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_address; - mutable JSC::WriteBarrier m_hostname; - mutable JSC::WriteBarrier m_id; -}; - -class JSDirent final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSDirent* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForDirent.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForDirent = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForDirent.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForDirent = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(ObjectType), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSDirent(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSDirent, m_ctx); } - - void* m_ctx { nullptr }; - - JSDirent(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_name; -}; - -class JSDocEnd final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSDocEnd* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForDocEnd.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForDocEnd = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForDocEnd.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForDocEnd = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSDocEnd(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSDocEnd, m_ctx); } - - void* m_ctx { nullptr }; - - JSDocEnd(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -class JSDocType final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSDocType* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForDocType.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForDocType = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForDocType.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForDocType = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSDocType(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSDocType, m_ctx); } - - void* m_ctx { nullptr }; - - JSDocType(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_name; - mutable JSC::WriteBarrier m_publicId; - mutable JSC::WriteBarrier m_systemId; -}; - -class JSElement final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSElement* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForElement.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForElement = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForElement.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForElement = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSElement(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSElement, m_ctx); } - - void* m_ctx { nullptr }; - - JSElement(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_namespaceURI; -}; - -class JSEndTag final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSEndTag* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForEndTag.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForEndTag = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForEndTag.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForEndTag = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSEndTag(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSEndTag, m_ctx); } - - void* m_ctx { nullptr }; - - JSEndTag(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -class JSExpect final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSExpect* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForExpect.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForExpect = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForExpect.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForExpect = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSExpect(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSExpect, m_ctx); } - - void* m_ctx { nullptr }; - - JSExpect(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_capturedValue; - mutable JSC::WriteBarrier m_resultValue; -}; - -class JSExpectAny final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSExpectAny* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForExpectAny.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForExpectAny = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForExpectAny.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForExpectAny = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSExpectAny(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSExpectAny, m_ctx); } - - void* m_ctx { nullptr }; - - JSExpectAny(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_constructorValue; -}; - -class JSExpectAnything final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSExpectAnything* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForExpectAnything.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForExpectAnything = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForExpectAnything.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForExpectAnything = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSExpectAnything(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSExpectAnything, m_ctx); } - - void* m_ctx { nullptr }; - - JSExpectAnything(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -class JSExpectArrayContaining final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSExpectArrayContaining* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForExpectArrayContaining.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForExpectArrayContaining = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForExpectArrayContaining.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForExpectArrayContaining = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSExpectArrayContaining(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSExpectArrayContaining, m_ctx); } - - void* m_ctx { nullptr }; - - JSExpectArrayContaining(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_arrayValue; -}; - -class JSExpectStringContaining final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSExpectStringContaining* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForExpectStringContaining.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForExpectStringContaining = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForExpectStringContaining.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForExpectStringContaining = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSExpectStringContaining(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSExpectStringContaining, m_ctx); } - - void* m_ctx { nullptr }; - - JSExpectStringContaining(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_stringValue; -}; - -class JSExpectStringMatching final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSExpectStringMatching* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForExpectStringMatching.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForExpectStringMatching = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForExpectStringMatching.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForExpectStringMatching = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSExpectStringMatching(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSExpectStringMatching, m_ctx); } - - void* m_ctx { nullptr }; - - JSExpectStringMatching(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_testValue; -}; - -class JSFFI final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSFFI* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForFFI.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForFFI = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForFFI.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForFFI = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(ObjectType), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSFFI(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSFFI, m_ctx); } - - void* m_ctx { nullptr }; - - JSFFI(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_symbolsValue; -}; - -class JSFSWatcher final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSFSWatcher* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForFSWatcher.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForFSWatcher = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForFSWatcher.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForFSWatcher = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSFSWatcher(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSFSWatcher, m_ctx); } - - void* m_ctx { nullptr }; - - JSFSWatcher(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - m_weakThis = JSC::Weak(this, getOwner()); - } - - void finishCreation(JSC::VM&); - - JSC::Weak m_weakThis; - - static bool hasPendingActivity(void* ctx); - - class Owner final : public JSC::WeakHandleOwner { - public: - bool isReachableFromOpaqueRoots(JSC::Handle handle, void* context, JSC::AbstractSlotVisitor& visitor, const char** reason) final - { - auto* controller = JSC::jsCast(handle.slot()->asCell()); - if (JSFSWatcher::hasPendingActivity(controller->wrapped())) { - if (UNLIKELY(reason)) - *reason = "has pending activity"; - return true; - } - - return visitor.containsOpaqueRoot(context); - } - void finalize(JSC::Handle, void* context) final {} - }; - - static JSC::WeakHandleOwner* getOwner() - { - static NeverDestroyed m_owner; - return &m_owner.get(); - } - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_listener; -}; - -class JSFileSystemRouter final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSFileSystemRouter* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForFileSystemRouter.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForFileSystemRouter = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForFileSystemRouter.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForFileSystemRouter = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSFileSystemRouter(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSFileSystemRouter, m_ctx); } - - void* m_ctx { nullptr }; - - JSFileSystemRouter(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_origin; - mutable JSC::WriteBarrier m_routes; - mutable JSC::WriteBarrier m_style; -}; - -class JSHTMLRewriter final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSHTMLRewriter* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForHTMLRewriter.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForHTMLRewriter = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForHTMLRewriter.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForHTMLRewriter = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSHTMLRewriter(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSHTMLRewriter, m_ctx); } - - void* m_ctx { nullptr }; - - JSHTMLRewriter(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -class JSHTTPSServer final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSHTTPSServer* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForHTTPSServer.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForHTTPSServer = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForHTTPSServer.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForHTTPSServer = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(ObjectType), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSHTTPSServer(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSHTTPSServer, m_ctx); } - - void* m_ctx { nullptr }; - - JSHTTPSServer(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_address; - mutable JSC::WriteBarrier m_hostname; - mutable JSC::WriteBarrier m_id; -}; - -class JSHTTPServer final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSHTTPServer* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForHTTPServer.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForHTTPServer = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForHTTPServer.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForHTTPServer = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(ObjectType), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSHTTPServer(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSHTTPServer, m_ctx); } - - void* m_ctx { nullptr }; - - JSHTTPServer(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_address; - mutable JSC::WriteBarrier m_hostname; - mutable JSC::WriteBarrier m_id; -}; - -class JSListener final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSListener* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForListener.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForListener = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForListener.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForListener = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSListener(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSListener, m_ctx); } - - void* m_ctx { nullptr }; - - JSListener(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_hostname; - mutable JSC::WriteBarrier m_unix; -}; - -class JSMD4 final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSMD4* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForMD4.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForMD4 = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForMD4.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForMD4 = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSMD4(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSMD4, m_ctx); } - - void* m_ctx { nullptr }; - - JSMD4(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -class JSMD5 final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSMD5* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForMD5.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForMD5 = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForMD5.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForMD5 = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSMD5(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSMD5, m_ctx); } - - void* m_ctx { nullptr }; - - JSMD5(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -class JSMatchedRoute final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSMatchedRoute* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForMatchedRoute.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForMatchedRoute = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForMatchedRoute.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForMatchedRoute = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSMatchedRoute(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSMatchedRoute, m_ctx); } - - void* m_ctx { nullptr }; - - JSMatchedRoute(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_filePath; - mutable JSC::WriteBarrier m_kind; - mutable JSC::WriteBarrier m_name; - mutable JSC::WriteBarrier m_params; - mutable JSC::WriteBarrier m_pathname; - mutable JSC::WriteBarrier m_query; - mutable JSC::WriteBarrier m_scriptSrc; -}; - -class JSNodeJSFS final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSNodeJSFS* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForNodeJSFS.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForNodeJSFS = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForNodeJSFS.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForNodeJSFS = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(ObjectType), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSNodeJSFS(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSNodeJSFS, m_ctx); } - - void* m_ctx { nullptr }; - - JSNodeJSFS(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -class JSRequest final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSRequest* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForRequest.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForRequest = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForRequest.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForRequest = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSRequest(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSRequest, m_ctx); } - - void* m_ctx { nullptr }; - - JSRequest(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_body; - mutable JSC::WriteBarrier m_headers; - mutable JSC::WriteBarrier m_signal; - mutable JSC::WriteBarrier m_url; -}; - -class JSResolveMessage final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSResolveMessage* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForResolveMessage.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForResolveMessage = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForResolveMessage.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForResolveMessage = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSResolveMessage(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSResolveMessage, m_ctx); } - - void* m_ctx { nullptr }; - - JSResolveMessage(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_code; - mutable JSC::WriteBarrier m_importKind; - mutable JSC::WriteBarrier m_level; - mutable JSC::WriteBarrier m_message; - mutable JSC::WriteBarrier m_position; - mutable JSC::WriteBarrier m_referrer; - mutable JSC::WriteBarrier m_specifier; -}; - -class JSResponse final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSResponse* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForResponse.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForResponse = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForResponse.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForResponse = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSResponse(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSResponse, m_ctx); } - - void* m_ctx { nullptr }; - - JSResponse(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_body; - mutable JSC::WriteBarrier m_headers; - mutable JSC::WriteBarrier m_statusText; - mutable JSC::WriteBarrier m_url; -}; - -class JSSHA1 final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSSHA1* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA1.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA1 = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA1.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA1 = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSSHA1(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA1, m_ctx); } - - void* m_ctx { nullptr }; - - JSSHA1(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -class JSSHA224 final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSSHA224* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA224.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA224 = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA224.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA224 = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSSHA224(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA224, m_ctx); } - - void* m_ctx { nullptr }; - - JSSHA224(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -class JSSHA256 final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSSHA256* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA256.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA256 = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA256.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA256 = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSSHA256(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA256, m_ctx); } - - void* m_ctx { nullptr }; - - JSSHA256(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -class JSSHA384 final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSSHA384* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA384.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA384 = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA384.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA384 = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSSHA384(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA384, m_ctx); } - - void* m_ctx { nullptr }; - - JSSHA384(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -class JSSHA512 final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSSHA512* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA512.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA512 = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA512.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA512 = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSSHA512(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA512, m_ctx); } - - void* m_ctx { nullptr }; - - JSSHA512(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -class JSSHA512_256 final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSSHA512_256* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA512_256.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA512_256 = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA512_256.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA512_256 = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSSHA512_256(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA512_256, m_ctx); } - - void* m_ctx { nullptr }; - - JSSHA512_256(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -class JSServerWebSocket final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSServerWebSocket* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForServerWebSocket.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForServerWebSocket = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForServerWebSocket.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForServerWebSocket = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSServerWebSocket(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSServerWebSocket, m_ctx); } - - void* m_ctx { nullptr }; - - JSServerWebSocket(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_data; - mutable JSC::WriteBarrier m_remoteAddress; -}; - -class JSStatWatcher final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSStatWatcher* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForStatWatcher.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForStatWatcher = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForStatWatcher.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForStatWatcher = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSStatWatcher(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSStatWatcher, m_ctx); } - - void* m_ctx { nullptr }; - - JSStatWatcher(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - m_weakThis = JSC::Weak(this, getOwner()); - } - - void finishCreation(JSC::VM&); - - JSC::Weak m_weakThis; - - static bool hasPendingActivity(void* ctx); - - class Owner final : public JSC::WeakHandleOwner { - public: - bool isReachableFromOpaqueRoots(JSC::Handle handle, void* context, JSC::AbstractSlotVisitor& visitor, const char** reason) final - { - auto* controller = JSC::jsCast(handle.slot()->asCell()); - if (JSStatWatcher::hasPendingActivity(controller->wrapped())) { - if (UNLIKELY(reason)) - *reason = "has pending activity"; - return true; - } - - return visitor.containsOpaqueRoot(context); - } - void finalize(JSC::Handle, void* context) final {} - }; - - static JSC::WeakHandleOwner* getOwner() - { - static NeverDestroyed m_owner; - return &m_owner.get(); - } - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_listener; -}; - -class JSStats final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSStats* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForStats.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForStats = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForStats.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForStats = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSStats(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSStats, m_ctx); } - - void* m_ctx { nullptr }; - - JSStats(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_atime; - mutable JSC::WriteBarrier m_ctime; - mutable JSC::WriteBarrier m_mtime; -}; - -class JSSubprocess final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSSubprocess* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSubprocess.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSubprocess = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForSubprocess.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSubprocess = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSSubprocess(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSubprocess, m_ctx); } - - void* m_ctx { nullptr }; - - JSSubprocess(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - m_weakThis = JSC::Weak(this, getOwner()); - } - - void finishCreation(JSC::VM&); - - JSC::Weak m_weakThis; - - static bool hasPendingActivity(void* ctx); - - class Owner final : public JSC::WeakHandleOwner { - public: - bool isReachableFromOpaqueRoots(JSC::Handle handle, void* context, JSC::AbstractSlotVisitor& visitor, const char** reason) final - { - auto* controller = JSC::jsCast(handle.slot()->asCell()); - if (JSSubprocess::hasPendingActivity(controller->wrapped())) { - if (UNLIKELY(reason)) - *reason = "has pending activity"; - return true; - } - - return visitor.containsOpaqueRoot(context); - } - void finalize(JSC::Handle, void* context) final {} - }; - - static JSC::WeakHandleOwner* getOwner() - { - static NeverDestroyed m_owner; - return &m_owner.get(); - } - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_stderr; - mutable JSC::WriteBarrier m_stdin; - mutable JSC::WriteBarrier m_stdout; -}; - -class JSTCPSocket final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSTCPSocket* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForTCPSocket.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTCPSocket = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForTCPSocket.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForTCPSocket = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSTCPSocket(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSTCPSocket, m_ctx); } - - void* m_ctx { nullptr }; - - JSTCPSocket(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - m_weakThis = JSC::Weak(this, getOwner()); - } - - void finishCreation(JSC::VM&); - - JSC::Weak m_weakThis; - - static bool hasPendingActivity(void* ctx); - - class Owner final : public JSC::WeakHandleOwner { - public: - bool isReachableFromOpaqueRoots(JSC::Handle handle, void* context, JSC::AbstractSlotVisitor& visitor, const char** reason) final - { - auto* controller = JSC::jsCast(handle.slot()->asCell()); - if (JSTCPSocket::hasPendingActivity(controller->wrapped())) { - if (UNLIKELY(reason)) - *reason = "has pending activity"; - return true; - } - - return visitor.containsOpaqueRoot(context); - } - void finalize(JSC::Handle, void* context) final {} - }; - - static JSC::WeakHandleOwner* getOwner() - { - static NeverDestroyed m_owner; - return &m_owner.get(); - } - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_data; - mutable JSC::WriteBarrier m_remoteAddress; -}; - -class JSTLSSocket final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSTLSSocket* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForTLSSocket.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTLSSocket = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForTLSSocket.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForTLSSocket = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSTLSSocket(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSTLSSocket, m_ctx); } - - void* m_ctx { nullptr }; - - JSTLSSocket(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - m_weakThis = JSC::Weak(this, getOwner()); - } - - void finishCreation(JSC::VM&); - - JSC::Weak m_weakThis; - - static bool hasPendingActivity(void* ctx); - - class Owner final : public JSC::WeakHandleOwner { - public: - bool isReachableFromOpaqueRoots(JSC::Handle handle, void* context, JSC::AbstractSlotVisitor& visitor, const char** reason) final - { - auto* controller = JSC::jsCast(handle.slot()->asCell()); - if (JSTLSSocket::hasPendingActivity(controller->wrapped())) { - if (UNLIKELY(reason)) - *reason = "has pending activity"; - return true; - } - - return visitor.containsOpaqueRoot(context); - } - void finalize(JSC::Handle, void* context) final {} - }; - - static JSC::WeakHandleOwner* getOwner() - { - static NeverDestroyed m_owner; - return &m_owner.get(); - } - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_data; - mutable JSC::WriteBarrier m_remoteAddress; -}; - -class JSTextChunk final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSTextChunk* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForTextChunk.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTextChunk = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForTextChunk.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForTextChunk = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSTextChunk(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSTextChunk, m_ctx); } - - void* m_ctx { nullptr }; - - JSTextChunk(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_lastInTextNode; -}; - -class JSTextDecoder final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSTextDecoder* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForTextDecoder.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTextDecoder = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForTextDecoder.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForTextDecoder = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSTextDecoder(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSTextDecoder, m_ctx); } - - void* m_ctx { nullptr }; - - JSTextDecoder(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_encoding; -}; - -class JSTimeout final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSTimeout* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForTimeout.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTimeout = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForTimeout.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForTimeout = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSTimeout(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSTimeout, m_ctx); } - - void* m_ctx { nullptr }; - - JSTimeout(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier m_arguments; - mutable JSC::WriteBarrier m_callback; -}; - -class JSTranspiler final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSTranspiler* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForTranspiler.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTranspiler = std::forward(space); }, - [](auto& spaces) { return spaces.m_subspaceForTranspiler.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForTranspiler = std::forward(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSTranspiler(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSTranspiler, m_ctx); } - - void* m_ctx { nullptr }; - - JSTranspiler(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -class StructuredCloneableSerialize { -public: - void (*cppWriteBytes)(CloneSerializer*, const uint8_t*, uint32_t); - - std::function zigFunction; - - uint8_t tag; - - // the type from zig - void* impl; - - static std::optional fromJS(JSC::JSValue); - void write(CloneSerializer* serializer, JSC::JSGlobalObject* globalObject) - { - zigFunction(impl, globalObject, serializer, cppWriteBytes); - } -}; - -class StructuredCloneableDeserialize { -public: - static std::optional fromTagDeserialize(uint8_t tag, JSC::JSGlobalObject*, const uint8_t*, const uint8_t*); -}; - -} diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp index 06014665e361b..97dfcb100b5c0 100644 --- a/src/bun.js/bindings/ZigGlobalObject.cpp +++ b/src/bun.js/bindings/ZigGlobalObject.cpp @@ -94,7 +94,7 @@ #include "JSStringDecoder.h" #include "JSReadableState.h" #include "JSReadableHelper.h" -#include "Process.h" +#include "BunProcess.h" #include "AsyncContextFrame.h" #include "WebCoreJSBuiltins.h" @@ -154,7 +154,10 @@ using SourceOrigin = JSC::SourceOrigin; using JSObject = JSC::JSObject; using JSNonFinalObject = JSC::JSNonFinalObject; namespace JSCastingHelpers = JSC::JSCastingHelpers; + +#if !OS(WINDOWS) #include +#endif #include "IDLTypes.h" @@ -222,7 +225,7 @@ constexpr size_t DEFAULT_ERROR_STACK_TRACE_LIMIT = 10; #ifdef __APPLE__ #include -#else +#elif defined(__linux__) // for sysconf #include #endif @@ -348,7 +351,8 @@ static String computeErrorInfoWithoutPrepareStackTrace(JSC::VM& vm, Vector 64 ? 64 : framesCount; bool hasSet = false; for (size_t i = 0; i < framesCount; i++) { @@ -448,7 +452,11 @@ static String computeErrorInfoWithPrepareStackTrace(JSC::VM& vm, Zig::GlobalObje // We need to sourcemap it if it's a GlobalObject. if (globalObject == lexicalGlobalObject) { size_t framesCount = stackTrace.size(); +#if OS(WINDOWS) // MSVC workaround + ZigStackFrame* remappedFrames = new ZigStackFrame[framesCount]; +#else ZigStackFrame remappedFrames[framesCount]; +#endif for (int i = 0; i < framesCount; i++) { memset(remappedFrames + i, 0, sizeof(ZigStackFrame)); remappedFrames[i].source_url = Bun::toString(lexicalGlobalObject, stackTrace.at(i).sourceURL()); @@ -476,6 +484,9 @@ static String computeErrorInfoWithPrepareStackTrace(JSC::VM& vm, Zig::GlobalObje callSite->setLineNumber(lineNumber); } } +#if OS(WINDOWS) // MSVC workaround + delete remappedFrames; +#endif } globalObject->formatStackTrace(vm, lexicalGlobalObject, errorObject, callSites, prepareStackTrace); @@ -2196,7 +2207,7 @@ extern "C" JSC__JSValue ZigGlobalObject__createNativeReadableStream(Zig::GlobalO extern "C" uint64_t Bun__readOriginTimer(void*); extern "C" double Bun__readOriginTimerStart(void*); -static inline EncodedJSValue functionPerformanceNowBody(JSGlobalObject* globalObject) +static inline JSC::EncodedJSValue functionPerformanceNowBody(JSGlobalObject* globalObject) { auto* global = reinterpret_cast(globalObject); // nanoseconds to seconds @@ -2756,7 +2767,9 @@ JSC_DEFINE_HOST_FUNCTION(errorConstructorFuncCaptureStackTrace, (JSC::JSGlobalOb * node are interested in the (formatted) stack. */ size_t framesCount = stackTrace.size(); - ZigStackFrame remappedFrames[framesCount]; + ZigStackFrame remappedFrames[64]; + framesCount = framesCount > 64 ? 64 : framesCount; + for (int i = 0; i < framesCount; i++) { memset(remappedFrames + i, 0, sizeof(ZigStackFrame)); remappedFrames[i].source_url = Bun::toString(lexicalGlobalObject, stackTrace.at(i).sourceURL()); @@ -2806,7 +2819,7 @@ JSC_DEFINE_HOST_FUNCTION(errorConstructorFuncCaptureStackTrace, (JSC::JSGlobalOb return JSC::JSValue::encode(JSC::jsUndefined()); } -extern "C" EncodedJSValue CryptoObject__create(JSGlobalObject*); +extern "C" JSC::EncodedJSValue CryptoObject__create(JSGlobalObject*); void GlobalObject::finishCreation(VM& vm) { @@ -3022,6 +3035,10 @@ void GlobalObject::finishCreation(VM& vm) #ifdef __APPLE__ size_t count_len = sizeof(cpuCount); sysctlbyname("hw.logicalcpu", &cpuCount, &count_len, NULL, 0); +#elif OS(WINDOWS) + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + cpuCount = sysinfo.dwNumberOfProcessors; #else // TODO: windows cpuCount = sysconf(_SC_NPROCESSORS_ONLN); @@ -3427,7 +3444,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionPostMessage, return JSValue::encode(jsUndefined()); } -JSC_DEFINE_CUSTOM_GETTER(JSDOMFileConstructor_getter, (JSGlobalObject * globalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(JSDOMFileConstructor_getter, (JSGlobalObject * globalObject, JSC::EncodedJSValue thisValue, PropertyName)) { Zig::GlobalObject* bunGlobalObject = jsCast(globalObject); return JSValue::encode( @@ -3447,7 +3464,7 @@ JSC_DEFINE_CUSTOM_SETTER(JSDOMFileConstructor_setter, return true; } -JSC_DEFINE_CUSTOM_GETTER(BunCommonJSModule_getter, (JSGlobalObject * globalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(BunCommonJSModule_getter, (JSGlobalObject * globalObject, JSC::EncodedJSValue thisValue, PropertyName)) { Zig::GlobalObject* bunGlobalObject = jsCast(globalObject); JSValue returnValue = bunGlobalObject->m_BunCommonJSModuleValue.get(); @@ -3553,12 +3570,12 @@ JSC_DEFINE_CUSTOM_GETTER(getConsoleStdout, (JSGlobalObject * globalObject, Encod auto global = jsCast(globalObject); // instead of calling the constructor builtin, go through the process.stdout getter to ensure it's only created once. - auto stdout = global->processObject()->get(globalObject, Identifier::fromString(vm, "stdout"_s)); - if (!stdout) + auto stdoutValue = global->processObject()->get(globalObject, Identifier::fromString(vm, "stdout"_s)); + if (!stdoutValue) return JSValue::encode({}); - console->putDirect(vm, property, stdout, PropertyAttribute::DontEnum | 0); - return JSValue::encode(stdout); + console->putDirect(vm, property, stdoutValue, PropertyAttribute::DontEnum | 0); + return JSValue::encode(stdoutValue); } // `console._stderr` is equal to `process.stderr` @@ -3569,12 +3586,12 @@ JSC_DEFINE_CUSTOM_GETTER(getConsoleStderr, (JSGlobalObject * globalObject, Encod auto global = jsCast(globalObject); // instead of calling the constructor builtin, go through the process.stdout getter to ensure it's only created once. - auto stdout = global->processObject()->get(globalObject, Identifier::fromString(vm, "stderr"_s)); - if (!stdout) + auto stderrValue = global->processObject()->get(globalObject, Identifier::fromString(vm, "stderr"_s)); + if (!stderrValue) return JSValue::encode({}); - console->putDirect(vm, property, stdout, PropertyAttribute::DontEnum | 0); - return JSValue::encode(stdout); + console->putDirect(vm, property, stderrValue, PropertyAttribute::DontEnum | 0); + return JSValue::encode(stderrValue); } JSC_DEFINE_CUSTOM_SETTER(EventSource_setter, @@ -3607,8 +3624,7 @@ EncodedJSValue GlobalObject::assignToStream(JSValue stream, JSValue controller) WTF::NakedPtr returnedException = nullptr; auto result = JSC::profiledCall(this, ProfilingReason::API, function, callData, JSC::jsUndefined(), arguments, returnedException); - if (returnedException.get()) { - auto* exception = WTFMove(returnedException.get()); + if (auto* exception = returnedException.get()) { return JSC::JSValue::encode(exception); } @@ -3678,9 +3694,9 @@ JSC::GCClient::IsoSubspace* GlobalObject::subspaceForImpl(JSC::VM& vm) [](auto& server) -> JSC::HeapCellType& { return server.m_heapCellTypeForJSWorkerGlobalScope; }); } -extern "C" EncodedJSValue WebCore__alert(JSC::JSGlobalObject*, JSC::CallFrame*); -extern "C" EncodedJSValue WebCore__prompt(JSC::JSGlobalObject*, JSC::CallFrame*); -extern "C" EncodedJSValue WebCore__confirm(JSC::JSGlobalObject*, JSC::CallFrame*); +extern "C" JSC::EncodedJSValue WebCore__alert(JSC::JSGlobalObject*, JSC::CallFrame*); +extern "C" JSC::EncodedJSValue WebCore__prompt(JSC::JSGlobalObject*, JSC::CallFrame*); +extern "C" JSC::EncodedJSValue WebCore__confirm(JSC::JSGlobalObject*, JSC::CallFrame*); JSValue GlobalObject_getPerformanceObject(VM& vm, JSObject* globalObject) { diff --git a/src/bun.js/bindings/ZigGlobalObject.h b/src/bun.js/bindings/ZigGlobalObject.h index 86cfb04e423b6..b1eab732dfd6f 100644 --- a/src/bun.js/bindings/ZigGlobalObject.h +++ b/src/bun.js/bindings/ZigGlobalObject.h @@ -31,19 +31,24 @@ class InternalModuleRegistry; } // namespace Bun #include "root.h" - #include "headers-handwritten.h" - -#include "JavaScriptCore/CatchScope.h" -#include "JavaScriptCore/JSGlobalObject.h" -#include "JavaScriptCore/JSTypeInfo.h" -#include "JavaScriptCore/Structure.h" -#include "WebCoreJSBuiltins.h" - +#include +#include +#include +#include #include "DOMConstructors.h" #include "BunPlugin.h" #include "JSMockFunction.h" #include "InternalModuleRegistry.h" +#include "ProcessBindingConstants.h" +#include "WebCoreJSBuiltins.h" +#include "headers-handwritten.h" + +namespace WebCore { +class GlobalScope; +class SubtleCrypto; +class EventTarget; +} extern "C" void Bun__reportError(JSC__JSGlobalObject*, JSC__JSValue); extern "C" void Bun__reportUnhandledError(JSC__JSGlobalObject*, JSC::EncodedJSValue); @@ -271,7 +276,7 @@ class GlobalObject : public JSC::JSGlobalObject { JSObject* subtleCrypto() { return m_subtleCryptoObject.getInitializedOnMainThread(this); } - EncodedJSValue assignToStream(JSValue stream, JSValue controller); + JSC::EncodedJSValue assignToStream(JSValue stream, JSValue controller); WebCore::EventTarget& eventTarget(); Bun::GlobalScope& globalEventScope; diff --git a/src/bun.js/bindings/ZigGlobalObject.lut.h b/src/bun.js/bindings/ZigGlobalObject.lut.h deleted file mode 100644 index 6516648e8e1e1..0000000000000 --- a/src/bun.js/bindings/ZigGlobalObject.lut.h +++ /dev/null @@ -1,341 +0,0 @@ -// File generated via `make static-hash-table` / `make cpp` -static const struct CompactHashIndex bunGlobalObjectTableIndex[260] = { - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 42, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 6, -1 }, - { 3, -1 }, - { -1, -1 }, - { 34, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 29, 258 }, - { -1, -1 }, - { -1, -1 }, - { 54, 257 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 51, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 2, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 18, -1 }, - { 56, -1 }, - { -1, -1 }, - { -1, -1 }, - { 14, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 41, -1 }, - { 47, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 69, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 39, -1 }, - { -1, -1 }, - { -1, -1 }, - { 38, -1 }, - { 63, -1 }, - { -1, -1 }, - { 57, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 49, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 58, -1 }, - { 11, -1 }, - { -1, -1 }, - { -1, -1 }, - { 0, -1 }, - { -1, -1 }, - { 37, -1 }, - { 21, -1 }, - { 66, -1 }, - { -1, -1 }, - { -1, -1 }, - { 70, -1 }, - { -1, -1 }, - { 45, -1 }, - { -1, -1 }, - { 48, -1 }, - { -1, -1 }, - { -1, -1 }, - { 24, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 33, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 50, -1 }, - { 46, -1 }, - { -1, -1 }, - { 13, -1 }, - { -1, -1 }, - { -1, -1 }, - { 43, -1 }, - { -1, -1 }, - { 1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 32, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 28, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 26, -1 }, - { -1, -1 }, - { -1, -1 }, - { 17, -1 }, - { -1, -1 }, - { 31, -1 }, - { -1, -1 }, - { -1, -1 }, - { 35, -1 }, - { 71, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 22, -1 }, - { -1, -1 }, - { -1, -1 }, - { 4, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 23, -1 }, - { -1, -1 }, - { -1, -1 }, - { 55, -1 }, - { -1, -1 }, - { 53, -1 }, - { -1, -1 }, - { 12, -1 }, - { 25, -1 }, - { 7, -1 }, - { -1, -1 }, - { 9, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 61, -1 }, - { 60, -1 }, - { -1, -1 }, - { 5, 256 }, - { -1, -1 }, - { 64, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 36, -1 }, - { -1, -1 }, - { 15, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 40, 259 }, - { -1, -1 }, - { -1, -1 }, - { 68, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 52, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 30, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 27, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 44, -1 }, - { -1, -1 }, - { -1, -1 }, - { 65, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 20, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 10, -1 }, - { 16, -1 }, - { -1, -1 }, - { -1, -1 }, - { -1, -1 }, - { 19, -1 }, - { -1, -1 }, - { 8, -1 }, - { 59, -1 }, - { 62, -1 }, - { 67, -1 }, -}; - -static const struct HashTableValue bunGlobalObjectTableValues[72] = { - { "addEventListener"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsFunctionAddEventListener, 2 } }, - { "alert"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, WebCore__alert, 1 } }, - { "atob"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionATOB, 1 } }, - { "btoa"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionBTOA, 1 } }, - { "clearImmediate"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionClearTimeout, 1 } }, - { "clearInterval"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionClearInterval, 1 } }, - { "clearTimeout"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionClearTimeout, 1 } }, - { "confirm"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, WebCore__confirm, 1 } }, - { "dispatchEvent"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsFunctionDispatchEvent, 1 } }, - { "fetch"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Bun__fetch, 2 } }, - { "postMessage"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsFunctionPostMessage, 1 } }, - { "prompt"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, WebCore__prompt, 1 } }, - { "queueMicrotask"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionQueueMicrotask, 2 } }, - { "removeEventListener"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsFunctionRemoveEventListener, 2 } }, - { "reportError"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionReportError, 1 } }, - { "setImmediate"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionSetImmediate, 1 } }, - { "setInterval"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionSetInterval, 1 } }, - { "setTimeout"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionSetTimeout, 1 } }, - { "structuredClone"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionStructuredClone, 2 } }, - { "global"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, GlobalObject_getGlobalThis } }, - { "EventSource"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, getEventSourceConstructor } }, - { "Bun"_s, static_cast(PropertyAttribute::CellProperty|PropertyAttribute::DontDelete|PropertyAttribute::ReadOnly), NoIntrinsic, { HashTableValue::LazyCellPropertyType, OBJECT_OFFSETOF(GlobalObject, m_bunObject) } }, - { "File"_s, static_cast(PropertyAttribute::CellProperty), NoIntrinsic, { HashTableValue::LazyCellPropertyType, OBJECT_OFFSETOF(GlobalObject, m_JSDOMFileConstructor) } }, - { "crypto"_s, static_cast(PropertyAttribute::CellProperty), NoIntrinsic, { HashTableValue::LazyCellPropertyType, OBJECT_OFFSETOF(GlobalObject, m_cryptoObject) } }, - { "navigator"_s, static_cast(PropertyAttribute::CellProperty), NoIntrinsic, { HashTableValue::LazyCellPropertyType, OBJECT_OFFSETOF(GlobalObject, m_navigatorObject) } }, - { "performance"_s, static_cast(PropertyAttribute::CellProperty), NoIntrinsic, { HashTableValue::LazyCellPropertyType, OBJECT_OFFSETOF(GlobalObject, m_performanceObject) } }, - { "process"_s, static_cast(PropertyAttribute::CellProperty), NoIntrinsic, { HashTableValue::LazyCellPropertyType, OBJECT_OFFSETOF(GlobalObject, m_processObject) } }, - { "Blob"_s, static_cast(PropertyAttribute::ClassStructure), NoIntrinsic, { HashTableValue::LazyClassStructureType, OBJECT_OFFSETOF(GlobalObject, m_JSBlob) } }, - { "Buffer"_s, static_cast(PropertyAttribute::ClassStructure), NoIntrinsic, { HashTableValue::LazyClassStructureType, OBJECT_OFFSETOF(GlobalObject, m_JSBufferClassStructure) } }, - { "BuildError"_s, static_cast(PropertyAttribute::ClassStructure), NoIntrinsic, { HashTableValue::LazyClassStructureType, OBJECT_OFFSETOF(GlobalObject, m_JSBuildMessage) } }, - { "BuildMessage"_s, static_cast(PropertyAttribute::ClassStructure), NoIntrinsic, { HashTableValue::LazyClassStructureType, OBJECT_OFFSETOF(GlobalObject, m_JSBuildMessage) } }, - { "Crypto"_s, static_cast(PropertyAttribute::ClassStructure), NoIntrinsic, { HashTableValue::LazyClassStructureType, OBJECT_OFFSETOF(GlobalObject, m_JSCrypto) } }, - { "HTMLRewriter"_s, static_cast(PropertyAttribute::ClassStructure), NoIntrinsic, { HashTableValue::LazyClassStructureType, OBJECT_OFFSETOF(GlobalObject, m_JSHTMLRewriter) } }, - { "Request"_s, static_cast(PropertyAttribute::ClassStructure), NoIntrinsic, { HashTableValue::LazyClassStructureType, OBJECT_OFFSETOF(GlobalObject, m_JSRequest) } }, - { "ResolveError"_s, static_cast(PropertyAttribute::ClassStructure), NoIntrinsic, { HashTableValue::LazyClassStructureType, OBJECT_OFFSETOF(GlobalObject, m_JSResolveMessage) } }, - { "ResolveMessage"_s, static_cast(PropertyAttribute::ClassStructure), NoIntrinsic, { HashTableValue::LazyClassStructureType, OBJECT_OFFSETOF(GlobalObject, m_JSResolveMessage) } }, - { "Response"_s, static_cast(PropertyAttribute::ClassStructure), NoIntrinsic, { HashTableValue::LazyClassStructureType, OBJECT_OFFSETOF(GlobalObject, m_JSResponse) } }, - { "TextDecoder"_s, static_cast(PropertyAttribute::ClassStructure), NoIntrinsic, { HashTableValue::LazyClassStructureType, OBJECT_OFFSETOF(GlobalObject, m_JSTextDecoder) } }, - { "AbortController"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, AbortControllerConstructorCallback } }, - { "AbortSignal"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, AbortSignalConstructorCallback } }, - { "BroadcastChannel"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BroadcastChannelConstructorCallback } }, - { "ByteLengthQueuingStrategy"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, ByteLengthQueuingStrategyConstructorCallback } }, - { "CloseEvent"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, CloseEventConstructorCallback } }, - { "CountQueuingStrategy"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, CountQueuingStrategyConstructorCallback } }, - { "CryptoKey"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, CryptoKeyConstructorCallback } }, - { "CustomEvent"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, CustomEventConstructorCallback } }, - { "DOMException"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, DOMExceptionConstructorCallback } }, - { "ErrorEvent"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, ErrorEventConstructorCallback } }, - { "Event"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, EventConstructorCallback } }, - { "EventTarget"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, EventTargetConstructorCallback } }, - { "FormData"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, DOMFormDataConstructorCallback } }, - { "Headers"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, FetchHeadersConstructorCallback } }, - { "MessageChannel"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, MessageChannelConstructorCallback } }, - { "MessageEvent"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, MessageEventConstructorCallback } }, - { "MessagePort"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, MessagePortConstructorCallback } }, - { "ReadableByteStreamController"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, ReadableByteStreamControllerConstructorCallback } }, - { "ReadableStream"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, ReadableStreamConstructorCallback } }, - { "ReadableStreamBYOBReader"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, ReadableStreamBYOBReaderConstructorCallback } }, - { "ReadableStreamBYOBRequest"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, ReadableStreamBYOBRequestConstructorCallback } }, - { "ReadableStreamDefaultController"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, ReadableStreamDefaultControllerConstructorCallback } }, - { "ReadableStreamDefaultReader"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, ReadableStreamDefaultReaderConstructorCallback } }, - { "SubtleCrypto"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, SubtleCryptoConstructorCallback } }, - { "TextEncoder"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, TextEncoderConstructorCallback } }, - { "TransformStream"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, TransformStreamConstructorCallback } }, - { "URL"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, DOMURLConstructorCallback } }, - { "URLSearchParams"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, URLSearchParamsConstructorCallback } }, - { "WebSocket"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, WebSocketConstructorCallback } }, - { "Worker"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, WorkerConstructorCallback } }, - { "WritableStream"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, WritableStreamConstructorCallback } }, - { "WritableStreamDefaultController"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, WritableStreamDefaultControllerConstructorCallback } }, - { "WritableStreamDefaultWriter"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, WritableStreamDefaultWriterConstructorCallback } }, - { "TransformStreamDefaultController"_s, static_cast(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, TransformStreamDefaultControllerConstructorCallback } }, -}; - -static const struct HashTable bunGlobalObjectTable = - { 72, 255, false, nullptr, bunGlobalObjectTableValues, bunGlobalObjectTableIndex }; diff --git a/src/bun.js/bindings/ZigSourceProvider.cpp b/src/bun.js/bindings/ZigSourceProvider.cpp index 960e577b9d99c..2c82d2ea76eb7 100644 --- a/src/bun.js/bindings/ZigSourceProvider.cpp +++ b/src/bun.js/bindings/ZigSourceProvider.cpp @@ -4,12 +4,12 @@ #include "ZigSourceProvider.h" -#include "JavaScriptCore/BytecodeCacheError.h" +#include #include "ZigGlobalObject.h" -#include "JavaScriptCore/Completion.h" -#include "wtf/Scope.h" -#include "wtf/text/StringHash.h" +#include +#include +#include #include extern "C" void RefString__free(void*, void*, unsigned); diff --git a/src/bun.js/bindings/ZigSourceProvider.h b/src/bun.js/bindings/ZigSourceProvider.h index b7574c7a47554..418490e45cf31 100644 --- a/src/bun.js/bindings/ZigSourceProvider.h +++ b/src/bun.js/bindings/ZigSourceProvider.h @@ -10,13 +10,13 @@ class SourceCodeKey; class SourceProvider; } // namespace JSC -#include "JavaScriptCore/CachedBytecode.h" -#include "JavaScriptCore/JSGlobalObject.h" -#include "JavaScriptCore/JSTypeInfo.h" +#include +#include +#include #include "ZigConsoleClient.h" -// #include "JavaScriptCore/SourceCodeKey.h" -#include "JavaScriptCore/SourceProvider.h" -#include "JavaScriptCore/Structure.h" +// #include +#include +#include namespace Zig { diff --git a/src/bun.js/bindings/bindings.cpp b/src/bun.js/bindings/bindings.cpp index 58c5ae4d7d0d3..ee65180d69ead 100644 --- a/src/bun.js/bindings/bindings.cpp +++ b/src/bun.js/bindings/bindings.cpp @@ -1542,7 +1542,7 @@ double JSC__JSValue__getLengthIfPropertyExistsInternal(JSC__JSValue value, JSC__ return 0; } - case WebCore::JSDOMWrapperType: { + case static_cast(WebCore::JSDOMWrapperType): { if (auto* headers = jsDynamicCast(cell)) return static_cast(jsCast(cell)->wrapped().size()); @@ -2032,76 +2032,6 @@ JSC__JSObject* JSC__JSString__toObject(JSC__JSString* arg0, JSC__JSGlobalObject* // arg2->depen // } -class JSMicrotaskCallbackDefaultGlobal final : public RefCounted { -public: - static Ref create(Ref&& task) - { - return adoptRef(*new JSMicrotaskCallbackDefaultGlobal(WTFMove(task).leakRef())); - } - - void call(JSC::JSGlobalObject* globalObject) - { - - JSC::VM& vm = globalObject->vm(); - auto task = &m_task.leakRef(); - task->run(globalObject); - - delete this; - } - -private: - JSMicrotaskCallbackDefaultGlobal(Ref&& task) - : m_task { WTFMove(task) } - { - } - - Ref m_task; -}; - -class JSMicrotaskCallback final : public RefCounted { -public: - static Ref create(JSC::JSGlobalObject& globalObject, - Ref&& task) - { - return adoptRef(*new JSMicrotaskCallback(globalObject, WTFMove(task).leakRef())); - } - - void call() - { - auto* globalObject = m_globalObject.get(); - if (UNLIKELY(!globalObject)) { - delete this; - return; - } - - JSC::VM& vm = m_globalObject->vm(); - auto task = &m_task.leakRef(); - task->run(globalObject); - - delete this; - } - -private: - JSMicrotaskCallback(JSC::JSGlobalObject& globalObject, Ref&& task) - : m_globalObject { &globalObject } - , m_task { WTFMove(task) } - { - } - - JSC::Weak m_globalObject; - Ref m_task; -}; - -void Microtask__run(void* microtask, void* global) -{ - reinterpret_cast(microtask)->call(); -} - -void Microtask__run_default(void* microtask, void* global) -{ - reinterpret_cast(microtask)->call(reinterpret_cast(global)); -} - JSC__JSValue JSC__JSModuleLoader__evaluate(JSC__JSGlobalObject* globalObject, const unsigned char* arg1, size_t arg2, const unsigned char* originUrlPtr, size_t originURLLen, const unsigned char* referrerUrlPtr, size_t referrerUrlLen, JSC__JSValue JSValue5, JSC__JSValue* arg6) @@ -2324,6 +2254,9 @@ bool JSC__JSValue__asArrayBuffer_(JSC__JSValue JSValue0, JSC__JSGlobalObject* ar } break; } + default: { + break; + } } return false; @@ -2944,6 +2877,8 @@ bool JSC__JSValue__isClass(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1) if (callData.native.isBoundFunction) return false; return value.isConstructor(); + default: + return false; } return false; } @@ -4027,10 +3962,6 @@ bool JSC__JSValue__isTerminationException(JSC__JSValue JSValue0, JSC__VM* arg1) void JSC__VM__shrinkFootprint(JSC__VM* arg0) { arg0->shrinkFootprintWhenIdle(); }; void JSC__VM__whenIdle(JSC__VM* arg0, void (*ArgFn1)()) { arg0->whenIdle(ArgFn1); }; -JSC__VM* JSC__VM__create(unsigned char HeapType0) -{ -} - void JSC__VM__holdAPILock(JSC__VM* arg0, void* ctx, void (*callback)(void* arg0)) { JSC::JSLockHolder locker(arg0); @@ -4175,7 +4106,7 @@ static JSC::Identifier builtinNameMap(JSC::JSGlobalObject* globalObject, unsigne } } -extern "C" EncodedJSValue JSC__JSValue__callCustomInspectFunction( +extern "C" JSC::EncodedJSValue JSC__JSValue__callCustomInspectFunction( JSC::JSGlobalObject* lexicalGlobalObject, JSC__JSValue encodedFunctionValue, JSC__JSValue encodedThisValue, diff --git a/src/bun.js/bindings/bindings.zig b/src/bun.js/bindings/bindings.zig index 3b6ab6af836a4..0cba01b714902 100644 --- a/src/bun.js/bindings/bindings.zig +++ b/src/bun.js/bindings/bindings.zig @@ -2874,7 +2874,7 @@ pub const JSGlobalObject = extern struct { return cppFn("deleteModuleRegistryEntry", .{ this, name_ }); } - pub fn bunVM_(this: *JSGlobalObject) *anyopaque { + fn bunVM_(this: *JSGlobalObject) *anyopaque { return cppFn("bunVM", .{this}); } @@ -4968,32 +4968,6 @@ pub const JSValue = enum(JSValueReprInt) { extern "c" fn AsyncContextFrame__withAsyncContextIfNeeded(global: *JSGlobalObject, callback: JSValue) JSValue; -extern "c" fn Microtask__run(*Microtask, *JSGlobalObject) void; -extern "c" fn Microtask__run_default(*MicrotaskForDefaultGlobalObject, *JSGlobalObject) void; - -pub const Microtask = opaque { - pub const name = "Zig::JSMicrotaskCallback"; - pub const namespace = "Zig"; - - pub fn run(this: *Microtask, global_object: *JSGlobalObject) void { - if (comptime is_bindgen) { - return; - } - - return Microtask__run(this, global_object); - } -}; - -pub const MicrotaskForDefaultGlobalObject = opaque { - pub fn run(this: *MicrotaskForDefaultGlobalObject, global_object: *JSGlobalObject) void { - if (comptime is_bindgen) { - return; - } - - return Microtask__run_default(this, global_object); - } -}; - pub const Exception = extern struct { pub const shim = Shimmer("JSC", "Exception", @This()); bytes: shim.Bytes, @@ -5637,7 +5611,7 @@ pub const URLSearchParams = opaque { extern fn URLSearchParams__toString( self: *URLSearchParams, ctx: *anyopaque, - callback: *const fn (ctx: *anyopaque, str: *const ZigString) void, + callback: *const fn (ctx: *anyopaque, str: *const ZigString) callconv(.C) void, ) void; pub fn toString( @@ -5649,7 +5623,7 @@ pub const URLSearchParams = opaque { JSC.markBinding(@src()); const Wrap = struct { const cb_ = callback; - pub fn cb(c: *anyopaque, str: *const ZigString) void { + pub fn cb(c: *anyopaque, str: *const ZigString) callconv(.C) void { cb_( bun.cast(*Ctx, c), str.*, diff --git a/src/bun.js/bindings/blob.cpp b/src/bun.js/bindings/blob.cpp index 0f255d7c89602..dfd98d45ba2e7 100644 --- a/src/bun.js/bindings/blob.cpp +++ b/src/bun.js/bindings/blob.cpp @@ -19,7 +19,7 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlo auto fileNameStr = impl->fileName(); BunString filename = Bun::toString(fileNameStr); - EncodedJSValue encoded = Blob__create(lexicalGlobalObject, impl->impl()); + JSC::EncodedJSValue encoded = Blob__create(lexicalGlobalObject, impl->impl()); JSBlob* blob = jsCast(JSC::JSValue::decode(encoded)); Blob__setAsFile(blob->wrapped(), &filename); diff --git a/src/bun.js/bindings/c-bindings.cpp b/src/bun.js/bindings/c-bindings.cpp index f53ff52ccf786..9015c44e1ba27 100644 --- a/src/bun.js/bindings/c-bindings.cpp +++ b/src/bun.js/bindings/c-bindings.cpp @@ -1,16 +1,19 @@ // when we don't want to use @cInclude, we can just stick wrapper functions here #include "root.h" -#include #include -#include + +#if !OS(WINDOWS) +#include #include #include #include - -#if CPU(X86_64) +#include #include -#include +#else +#include +#endif // !OS(WINDOWS) +#if CPU(X86_64) && !OS(WINDOWS) extern "C" void bun_warn_avx_missing(const char* url) { __builtin_cpu_init(); @@ -31,20 +34,34 @@ extern "C" void bun_warn_avx_missing(const char* url) extern "C" void bun_warn_avx_missing(char* url) { } -#endif +#endif // CPU(X86_64) extern "C" int32_t get_process_priority(uint32_t pid) { +#if OS(WINDOWS) + int priority = 0; + if (uv_os_getpriority(pid, &priority)) + return 0; + return priority; +#else return getpriority(PRIO_PROCESS, pid); +#endif // OS(WINDOWS) } extern "C" int32_t set_process_priority(uint32_t pid, int32_t priority) { +#if OS(WINDOWS) + return uv_os_setpriority(pid, priority); +#else return setpriority(PRIO_PROCESS, pid, priority); +#endif // OS(WINDOWS) } extern "C" bool is_executable_file(const char* path) { +#if OS(WINDOWS) + return false; +#else #if defined(O_EXEC) // O_EXEC is macOS specific @@ -53,7 +70,7 @@ extern "C" bool is_executable_file(const char* path) return false; close(fd); return true; -#endif +#endif // defined(O_EXEC) struct stat st; if (stat(path, &st) != 0) @@ -61,12 +78,15 @@ extern "C" bool is_executable_file(const char* path) // regular file and user can execute return S_ISREG(st.st_mode) && (st.st_mode & S_IXUSR); +#endif // OS(WINDOWS) } extern "C" void bun_ignore_sigpipe() { +#if !OS(WINDOWS) // ignore SIGPIPE signal(SIGPIPE, SIG_IGN); +#endif } extern "C" ssize_t bun_sysconf__SC_CLK_TCK() { diff --git a/src/bun.js/bindings/coroutine.cpp b/src/bun.js/bindings/coroutine.cpp index a58804d7ae76e..bf3ebea3f936f 100644 --- a/src/bun.js/bindings/coroutine.cpp +++ b/src/bun.js/bindings/coroutine.cpp @@ -1,7 +1,7 @@ #include "root.h" // #include "mimalloc.h" -#include "JavaScriptCore/VM.h" +#include // #define MCO_API // #define MCO_MALLOC mi_malloc diff --git a/src/bun.js/bindings/debug-helpers.h b/src/bun.js/bindings/debug-helpers.h index a0fc9986804ec..01dc92df8fe91 100644 --- a/src/bun.js/bindings/debug-helpers.h +++ b/src/bun.js/bindings/debug-helpers.h @@ -1,6 +1,6 @@ #include "root.h" -#include "JavaScriptCore/InspectorDebuggerAgent.h" +#include namespace JSC { Inspector::InspectorDebuggerAgent* debuggerAgent(JSC::JSGlobalObject* globalObject) diff --git a/src/bun.js/bindings/exports.zig b/src/bun.js/bindings/exports.zig index ec679f42d131b..3f857853353db 100644 --- a/src/bun.js/bindings/exports.zig +++ b/src/bun.js/bindings/exports.zig @@ -206,7 +206,7 @@ pub const ResolvedSource = extern struct { tag: Tag = Tag.javascript, - pub const Tag = @import("../../js/out/ResolvedSourceTag.zig").ResolvedSourceTag; + pub const Tag = @import("generated/ResolvedSourceTag.zig").ResolvedSourceTag; }; const Mimalloc = @import("../../allocators/mimalloc.zig"); diff --git a/src/bun.js/bindings/generated_classes.zig b/src/bun.js/bindings/generated_classes.zig deleted file mode 100644 index c4f63084b7a88..0000000000000 --- a/src/bun.js/bindings/generated_classes.zig +++ /dev/null @@ -1,7246 +0,0 @@ -/// Generated code! To regenerate, run: -/// -/// make codegen -/// -/// This file is generated by: -/// 1. `bun src/bun.js/scripts/generate-classes.ts` -/// 2. Scan for **/*.classes.ts files in src/bun.js/src -/// 3. Generate a JS wrapper for each class in: -/// - Zig: generated_classes.zig -/// - C++: ZigGeneratedClasses.h, ZigGeneratedClasses.cpp -/// 4. For the Zig code to successfully compile: -/// - Add it to generated_classes_list.zig -/// - pub usingnamespace JSC.Codegen.JSMyClassName; -/// 5. make clean-bindings && make bindings -j10 -/// -const JSC = @import("root").bun.JSC; -const Classes = @import("./generated_classes_list.zig").Classes; -const Environment = @import("../../env.zig"); -const std = @import("std"); - -pub const StaticGetterType = fn (*JSC.JSGlobalObject, JSC.JSValue, JSC.JSValue) callconv(.C) JSC.JSValue; -pub const StaticSetterType = fn (*JSC.JSGlobalObject, JSC.JSValue, JSC.JSValue, JSC.JSValue) callconv(.C) bool; -pub const StaticCallbackType = fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - -pub const JSAttributeIterator = struct { - const AttributeIterator = Classes.AttributeIterator; - const GetterType = fn (*AttributeIterator, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*AttributeIterator, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*AttributeIterator, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*AttributeIterator, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*AttributeIterator, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*AttributeIterator { - JSC.markBinding(@src()); - return AttributeIterator__fromJS(value); - } - - /// Create a new instance of AttributeIterator - pub fn toJS(this: *AttributeIterator, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = AttributeIterator__create(globalObject, this); - std.debug.assert(value__.as(AttributeIterator).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return AttributeIterator__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of AttributeIterator. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*AttributeIterator) bool { - JSC.markBinding(@src()); - return AttributeIterator__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *AttributeIterator, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(AttributeIterator__dangerouslySetPtr(value, null)); - } - - extern fn AttributeIterator__fromJS(JSC.JSValue) ?*AttributeIterator; - extern fn AttributeIterator__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn AttributeIterator__create(globalObject: *JSC.JSGlobalObject, ptr: ?*AttributeIterator) JSC.JSValue; - - extern fn AttributeIterator__dangerouslySetPtr(JSC.JSValue, ?*AttributeIterator) bool; - - comptime { - if (@TypeOf(AttributeIterator.finalize) != (fn (*AttributeIterator) callconv(.C) void)) { - @compileLog("AttributeIterator.finalize is not a finalizer"); - } - - if (@TypeOf(AttributeIterator.getThis) != CallbackType) - @compileLog("Expected AttributeIterator.getThis to be a callback but received " ++ @typeName(@TypeOf(AttributeIterator.getThis))); - if (@TypeOf(AttributeIterator.next) != CallbackType) - @compileLog("Expected AttributeIterator.next to be a callback but received " ++ @typeName(@TypeOf(AttributeIterator.next))); - if (!JSC.is_bindgen) { - @export(AttributeIterator.finalize, .{ .name = "AttributeIteratorClass__finalize" }); - @export(AttributeIterator.getThis, .{ .name = "AttributeIteratorPrototype__getThis" }); - @export(AttributeIterator.next, .{ .name = "AttributeIteratorPrototype__next" }); - } - } -}; -pub const JSBigIntStats = struct { - const BigIntStats = Classes.BigIntStats; - const GetterType = fn (*BigIntStats, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*BigIntStats, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*BigIntStats, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*BigIntStats, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*BigIntStats, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*BigIntStats { - JSC.markBinding(@src()); - return BigIntStats__fromJS(value); - } - - extern fn BigIntStatsPrototype__atimeSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn BigIntStatsPrototype__atimeGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `BigIntStats.atime` setter - /// This value will be visited by the garbage collector. - pub fn atimeSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - BigIntStatsPrototype__atimeSetCachedValue(thisValue, globalObject, value); - } - - /// `BigIntStats.atime` getter - /// This value will be visited by the garbage collector. - pub fn atimeGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = BigIntStatsPrototype__atimeGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn BigIntStatsPrototype__birthtimeSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn BigIntStatsPrototype__birthtimeGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `BigIntStats.birthtime` setter - /// This value will be visited by the garbage collector. - pub fn birthtimeSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - BigIntStatsPrototype__birthtimeSetCachedValue(thisValue, globalObject, value); - } - - /// `BigIntStats.birthtime` getter - /// This value will be visited by the garbage collector. - pub fn birthtimeGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = BigIntStatsPrototype__birthtimeGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn BigIntStatsPrototype__ctimeSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn BigIntStatsPrototype__ctimeGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `BigIntStats.ctime` setter - /// This value will be visited by the garbage collector. - pub fn ctimeSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - BigIntStatsPrototype__ctimeSetCachedValue(thisValue, globalObject, value); - } - - /// `BigIntStats.ctime` getter - /// This value will be visited by the garbage collector. - pub fn ctimeGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = BigIntStatsPrototype__ctimeGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn BigIntStatsPrototype__mtimeSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn BigIntStatsPrototype__mtimeGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `BigIntStats.mtime` setter - /// This value will be visited by the garbage collector. - pub fn mtimeSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - BigIntStatsPrototype__mtimeSetCachedValue(thisValue, globalObject, value); - } - - /// `BigIntStats.mtime` getter - /// This value will be visited by the garbage collector. - pub fn mtimeGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = BigIntStatsPrototype__mtimeGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Get the BigIntStats constructor value. - /// This loads lazily from the global object. - pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - return BigIntStats__getConstructor(globalObject); - } - - /// Create a new instance of BigIntStats - pub fn toJS(this: *BigIntStats, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = BigIntStats__create(globalObject, this); - std.debug.assert(value__.as(BigIntStats).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return BigIntStats__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of BigIntStats. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*BigIntStats) bool { - JSC.markBinding(@src()); - return BigIntStats__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *BigIntStats, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(BigIntStats__dangerouslySetPtr(value, null)); - } - - extern fn BigIntStats__fromJS(JSC.JSValue) ?*BigIntStats; - extern fn BigIntStats__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn BigIntStats__create(globalObject: *JSC.JSGlobalObject, ptr: ?*BigIntStats) JSC.JSValue; - - extern fn BigIntStats__dangerouslySetPtr(JSC.JSValue, ?*BigIntStats) bool; - - comptime { - if (@TypeOf(BigIntStats.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*BigIntStats)) { - @compileLog("BigIntStats.constructor is not a constructor"); - } - - if (@TypeOf(BigIntStats.finalize) != (fn (*BigIntStats) callconv(.C) void)) { - @compileLog("BigIntStats.finalize is not a finalizer"); - } - - if (@TypeOf(BigIntStats.atime) != GetterType) - @compileLog("Expected BigIntStats.atime to be a getter"); - - if (@TypeOf(BigIntStats.atimeMs) != GetterType) - @compileLog("Expected BigIntStats.atimeMs to be a getter"); - - if (@TypeOf(BigIntStats.atimeNs) != GetterType) - @compileLog("Expected BigIntStats.atimeNs to be a getter"); - - if (@TypeOf(BigIntStats.birthtime) != GetterType) - @compileLog("Expected BigIntStats.birthtime to be a getter"); - - if (@TypeOf(BigIntStats.birthtimeMs) != GetterType) - @compileLog("Expected BigIntStats.birthtimeMs to be a getter"); - - if (@TypeOf(BigIntStats.birthtimeNs) != GetterType) - @compileLog("Expected BigIntStats.birthtimeNs to be a getter"); - - if (@TypeOf(BigIntStats.blksize) != GetterType) - @compileLog("Expected BigIntStats.blksize to be a getter"); - - if (@TypeOf(BigIntStats.blocks) != GetterType) - @compileLog("Expected BigIntStats.blocks to be a getter"); - - if (@TypeOf(BigIntStats.ctime) != GetterType) - @compileLog("Expected BigIntStats.ctime to be a getter"); - - if (@TypeOf(BigIntStats.ctimeMs) != GetterType) - @compileLog("Expected BigIntStats.ctimeMs to be a getter"); - - if (@TypeOf(BigIntStats.ctimeNs) != GetterType) - @compileLog("Expected BigIntStats.ctimeNs to be a getter"); - - if (@TypeOf(BigIntStats.dev) != GetterType) - @compileLog("Expected BigIntStats.dev to be a getter"); - - if (@TypeOf(BigIntStats.gid) != GetterType) - @compileLog("Expected BigIntStats.gid to be a getter"); - - if (@TypeOf(BigIntStats.ino) != GetterType) - @compileLog("Expected BigIntStats.ino to be a getter"); - - if (@TypeOf(BigIntStats.isBlockDevice_WithoutTypeChecks) != fn ( - *BigIntStats, - *JSC.JSGlobalObject, - ) callconv(.C) JSC.JSValue) - @compileLog("Expected BigIntStats.isBlockDevice_WithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(BigIntStats.isBlockDevice_) != CallbackType) - @compileLog("Expected BigIntStats.isBlockDevice_ to be a callback but received " ++ @typeName(@TypeOf(BigIntStats.isBlockDevice_))); - if (@TypeOf(BigIntStats.isCharacterDevice_WithoutTypeChecks) != fn ( - *BigIntStats, - *JSC.JSGlobalObject, - ) callconv(.C) JSC.JSValue) - @compileLog("Expected BigIntStats.isCharacterDevice_WithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(BigIntStats.isCharacterDevice_) != CallbackType) - @compileLog("Expected BigIntStats.isCharacterDevice_ to be a callback but received " ++ @typeName(@TypeOf(BigIntStats.isCharacterDevice_))); - if (@TypeOf(BigIntStats.isDirectory_WithoutTypeChecks) != fn ( - *BigIntStats, - *JSC.JSGlobalObject, - ) callconv(.C) JSC.JSValue) - @compileLog("Expected BigIntStats.isDirectory_WithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(BigIntStats.isDirectory_) != CallbackType) - @compileLog("Expected BigIntStats.isDirectory_ to be a callback but received " ++ @typeName(@TypeOf(BigIntStats.isDirectory_))); - if (@TypeOf(BigIntStats.isFIFO_WithoutTypeChecks) != fn ( - *BigIntStats, - *JSC.JSGlobalObject, - ) callconv(.C) JSC.JSValue) - @compileLog("Expected BigIntStats.isFIFO_WithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(BigIntStats.isFIFO_) != CallbackType) - @compileLog("Expected BigIntStats.isFIFO_ to be a callback but received " ++ @typeName(@TypeOf(BigIntStats.isFIFO_))); - if (@TypeOf(BigIntStats.isFile_WithoutTypeChecks) != fn ( - *BigIntStats, - *JSC.JSGlobalObject, - ) callconv(.C) JSC.JSValue) - @compileLog("Expected BigIntStats.isFile_WithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(BigIntStats.isFile_) != CallbackType) - @compileLog("Expected BigIntStats.isFile_ to be a callback but received " ++ @typeName(@TypeOf(BigIntStats.isFile_))); - if (@TypeOf(BigIntStats.isSocket_WithoutTypeChecks) != fn ( - *BigIntStats, - *JSC.JSGlobalObject, - ) callconv(.C) JSC.JSValue) - @compileLog("Expected BigIntStats.isSocket_WithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(BigIntStats.isSocket_) != CallbackType) - @compileLog("Expected BigIntStats.isSocket_ to be a callback but received " ++ @typeName(@TypeOf(BigIntStats.isSocket_))); - if (@TypeOf(BigIntStats.isSymbolicLink_WithoutTypeChecks) != fn ( - *BigIntStats, - *JSC.JSGlobalObject, - ) callconv(.C) JSC.JSValue) - @compileLog("Expected BigIntStats.isSymbolicLink_WithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(BigIntStats.isSymbolicLink_) != CallbackType) - @compileLog("Expected BigIntStats.isSymbolicLink_ to be a callback but received " ++ @typeName(@TypeOf(BigIntStats.isSymbolicLink_))); - if (@TypeOf(BigIntStats.mode) != GetterType) - @compileLog("Expected BigIntStats.mode to be a getter"); - - if (@TypeOf(BigIntStats.mtime) != GetterType) - @compileLog("Expected BigIntStats.mtime to be a getter"); - - if (@TypeOf(BigIntStats.mtimeMs) != GetterType) - @compileLog("Expected BigIntStats.mtimeMs to be a getter"); - - if (@TypeOf(BigIntStats.mtimeNs) != GetterType) - @compileLog("Expected BigIntStats.mtimeNs to be a getter"); - - if (@TypeOf(BigIntStats.nlink) != GetterType) - @compileLog("Expected BigIntStats.nlink to be a getter"); - - if (@TypeOf(BigIntStats.rdev) != GetterType) - @compileLog("Expected BigIntStats.rdev to be a getter"); - - if (@TypeOf(BigIntStats.size) != GetterType) - @compileLog("Expected BigIntStats.size to be a getter"); - - if (@TypeOf(BigIntStats.uid) != GetterType) - @compileLog("Expected BigIntStats.uid to be a getter"); - - if (!JSC.is_bindgen) { - @export(BigIntStats.atime, .{ .name = "BigIntStatsPrototype__atime" }); - @export(BigIntStats.atimeMs, .{ .name = "BigIntStatsPrototype__atimeMs" }); - @export(BigIntStats.atimeNs, .{ .name = "BigIntStatsPrototype__atimeNs" }); - @export(BigIntStats.birthtime, .{ .name = "BigIntStatsPrototype__birthtime" }); - @export(BigIntStats.birthtimeMs, .{ .name = "BigIntStatsPrototype__birthtimeMs" }); - @export(BigIntStats.birthtimeNs, .{ .name = "BigIntStatsPrototype__birthtimeNs" }); - @export(BigIntStats.blksize, .{ .name = "BigIntStatsPrototype__blksize" }); - @export(BigIntStats.blocks, .{ .name = "BigIntStatsPrototype__blocks" }); - @export(BigIntStats.constructor, .{ .name = "BigIntStatsClass__construct" }); - @export(BigIntStats.ctime, .{ .name = "BigIntStatsPrototype__ctime" }); - @export(BigIntStats.ctimeMs, .{ .name = "BigIntStatsPrototype__ctimeMs" }); - @export(BigIntStats.ctimeNs, .{ .name = "BigIntStatsPrototype__ctimeNs" }); - @export(BigIntStats.dev, .{ .name = "BigIntStatsPrototype__dev" }); - @export(BigIntStats.finalize, .{ .name = "BigIntStatsClass__finalize" }); - @export(BigIntStats.gid, .{ .name = "BigIntStatsPrototype__gid" }); - @export(BigIntStats.ino, .{ .name = "BigIntStatsPrototype__ino" }); - @export(BigIntStats.isBlockDevice_, .{ .name = "BigIntStatsPrototype__isBlockDevice_" }); - @export(BigIntStats.isBlockDevice_WithoutTypeChecks, .{ .name = "BigIntStatsPrototype__isBlockDevice_WithoutTypeChecks" }); - @export(BigIntStats.isCharacterDevice_, .{ .name = "BigIntStatsPrototype__isCharacterDevice_" }); - @export(BigIntStats.isCharacterDevice_WithoutTypeChecks, .{ .name = "BigIntStatsPrototype__isCharacterDevice_WithoutTypeChecks" }); - @export(BigIntStats.isDirectory_, .{ .name = "BigIntStatsPrototype__isDirectory_" }); - @export(BigIntStats.isDirectory_WithoutTypeChecks, .{ .name = "BigIntStatsPrototype__isDirectory_WithoutTypeChecks" }); - @export(BigIntStats.isFIFO_, .{ .name = "BigIntStatsPrototype__isFIFO_" }); - @export(BigIntStats.isFIFO_WithoutTypeChecks, .{ .name = "BigIntStatsPrototype__isFIFO_WithoutTypeChecks" }); - @export(BigIntStats.isFile_, .{ .name = "BigIntStatsPrototype__isFile_" }); - @export(BigIntStats.isFile_WithoutTypeChecks, .{ .name = "BigIntStatsPrototype__isFile_WithoutTypeChecks" }); - @export(BigIntStats.isSocket_, .{ .name = "BigIntStatsPrototype__isSocket_" }); - @export(BigIntStats.isSocket_WithoutTypeChecks, .{ .name = "BigIntStatsPrototype__isSocket_WithoutTypeChecks" }); - @export(BigIntStats.isSymbolicLink_, .{ .name = "BigIntStatsPrototype__isSymbolicLink_" }); - @export(BigIntStats.isSymbolicLink_WithoutTypeChecks, .{ .name = "BigIntStatsPrototype__isSymbolicLink_WithoutTypeChecks" }); - @export(BigIntStats.mode, .{ .name = "BigIntStatsPrototype__mode" }); - @export(BigIntStats.mtime, .{ .name = "BigIntStatsPrototype__mtime" }); - @export(BigIntStats.mtimeMs, .{ .name = "BigIntStatsPrototype__mtimeMs" }); - @export(BigIntStats.mtimeNs, .{ .name = "BigIntStatsPrototype__mtimeNs" }); - @export(BigIntStats.nlink, .{ .name = "BigIntStatsPrototype__nlink" }); - @export(BigIntStats.rdev, .{ .name = "BigIntStatsPrototype__rdev" }); - @export(BigIntStats.size, .{ .name = "BigIntStatsPrototype__size" }); - @export(BigIntStats.uid, .{ .name = "BigIntStatsPrototype__uid" }); - } - } -}; -pub const JSBlob = struct { - const Blob = Classes.Blob; - const GetterType = fn (*Blob, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*Blob, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*Blob, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*Blob, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*Blob, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*Blob { - JSC.markBinding(@src()); - return Blob__fromJS(value); - } - - extern fn BlobPrototype__nameSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn BlobPrototype__nameGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Blob.name` setter - /// This value will be visited by the garbage collector. - pub fn nameSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - BlobPrototype__nameSetCachedValue(thisValue, globalObject, value); - } - - /// `Blob.name` getter - /// This value will be visited by the garbage collector. - pub fn nameGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = BlobPrototype__nameGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Get the Blob constructor value. - /// This loads lazily from the global object. - pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - return Blob__getConstructor(globalObject); - } - - /// Create a new instance of Blob - pub fn toJS(this: *Blob, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = Blob__create(globalObject, this); - std.debug.assert(value__.as(Blob).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return Blob__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of Blob. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Blob) bool { - JSC.markBinding(@src()); - return Blob__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *Blob, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(Blob__dangerouslySetPtr(value, null)); - } - - extern fn Blob__fromJS(JSC.JSValue) ?*Blob; - extern fn Blob__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn Blob__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Blob) JSC.JSValue; - - extern fn Blob__dangerouslySetPtr(JSC.JSValue, ?*Blob) bool; - - comptime { - if (@TypeOf(Blob.estimatedSize) != (fn (*Blob) callconv(.C) usize)) { - @compileLog("Blob.estimatedSize is not a size function"); - } - - if (@TypeOf(Blob.onStructuredCloneSerialize) != (fn (*Blob, globalThis: *JSC.JSGlobalObject, ctx: *anyopaque, writeBytes: *const fn (*anyopaque, ptr: [*]const u8, len: u32) callconv(.C) void) callconv(.C) void)) { - @compileLog("Blob.onStructuredCloneSerialize is not a structured clone serialize function"); - } - - if (@TypeOf(Blob.onStructuredCloneDeserialize) != (fn (globalThis: *JSC.JSGlobalObject, ptr: [*]u8, end: [*]u8) callconv(.C) JSC.JSValue)) { - @compileLog("Blob.onStructuredCloneDeserialize is not a structured clone deserialize function"); - } - - if (@TypeOf(Blob.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Blob)) { - @compileLog("Blob.constructor is not a constructor"); - } - - if (@TypeOf(Blob.finalize) != (fn (*Blob) callconv(.C) void)) { - @compileLog("Blob.finalize is not a finalizer"); - } - - if (@TypeOf(Blob.getArrayBuffer) != CallbackType) - @compileLog("Expected Blob.getArrayBuffer to be a callback but received " ++ @typeName(@TypeOf(Blob.getArrayBuffer))); - if (@TypeOf(Blob.getExists) != CallbackType) - @compileLog("Expected Blob.getExists to be a callback but received " ++ @typeName(@TypeOf(Blob.getExists))); - if (@TypeOf(Blob.getFormData) != CallbackType) - @compileLog("Expected Blob.getFormData to be a callback but received " ++ @typeName(@TypeOf(Blob.getFormData))); - if (@TypeOf(Blob.getJSON) != CallbackType) - @compileLog("Expected Blob.getJSON to be a callback but received " ++ @typeName(@TypeOf(Blob.getJSON))); - if (@TypeOf(Blob.getLastModified) != GetterType) - @compileLog("Expected Blob.getLastModified to be a getter"); - - if (@TypeOf(Blob.getName) != GetterType) - @compileLog("Expected Blob.getName to be a getter"); - - if (@TypeOf(Blob.getSize) != GetterType) - @compileLog("Expected Blob.getSize to be a getter"); - - if (@TypeOf(Blob.getSlice) != CallbackType) - @compileLog("Expected Blob.getSlice to be a callback but received " ++ @typeName(@TypeOf(Blob.getSlice))); - if (@TypeOf(Blob.getStream) != CallbackType) - @compileLog("Expected Blob.getStream to be a callback but received " ++ @typeName(@TypeOf(Blob.getStream))); - if (@TypeOf(Blob.getText) != CallbackType) - @compileLog("Expected Blob.getText to be a callback but received " ++ @typeName(@TypeOf(Blob.getText))); - if (@TypeOf(Blob.getType) != GetterType) - @compileLog("Expected Blob.getType to be a getter"); - - if (@TypeOf(Blob.getWriter) != CallbackType) - @compileLog("Expected Blob.getWriter to be a callback but received " ++ @typeName(@TypeOf(Blob.getWriter))); - if (!JSC.is_bindgen) { - @export(Blob.constructor, .{ .name = "BlobClass__construct" }); - @export(Blob.estimatedSize, .{ .name = "Blob__estimatedSize" }); - @export(Blob.finalize, .{ .name = "BlobClass__finalize" }); - @export(Blob.getArrayBuffer, .{ .name = "BlobPrototype__getArrayBuffer" }); - @export(Blob.getExists, .{ .name = "BlobPrototype__getExists" }); - @export(Blob.getFormData, .{ .name = "BlobPrototype__getFormData" }); - @export(Blob.getJSON, .{ .name = "BlobPrototype__getJSON" }); - @export(Blob.getLastModified, .{ .name = "BlobPrototype__getLastModified" }); - @export(Blob.getName, .{ .name = "BlobPrototype__getName" }); - @export(Blob.getSize, .{ .name = "BlobPrototype__getSize" }); - @export(Blob.getSlice, .{ .name = "BlobPrototype__getSlice" }); - @export(Blob.getStream, .{ .name = "BlobPrototype__getStream" }); - @export(Blob.getText, .{ .name = "BlobPrototype__getText" }); - @export(Blob.getType, .{ .name = "BlobPrototype__getType" }); - @export(Blob.getWriter, .{ .name = "BlobPrototype__getWriter" }); - @export(Blob.onStructuredCloneDeserialize, .{ .name = "Blob__onStructuredCloneDeserialize" }); - @export(Blob.onStructuredCloneSerialize, .{ .name = "Blob__onStructuredCloneSerialize" }); - } - } -}; -pub const JSBuildArtifact = struct { - const BuildArtifact = Classes.BuildArtifact; - const GetterType = fn (*BuildArtifact, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*BuildArtifact, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*BuildArtifact, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*BuildArtifact, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*BuildArtifact, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*BuildArtifact { - JSC.markBinding(@src()); - return BuildArtifact__fromJS(value); - } - - extern fn BuildArtifactPrototype__hashSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn BuildArtifactPrototype__hashGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `BuildArtifact.hash` setter - /// This value will be visited by the garbage collector. - pub fn hashSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - BuildArtifactPrototype__hashSetCachedValue(thisValue, globalObject, value); - } - - /// `BuildArtifact.hash` getter - /// This value will be visited by the garbage collector. - pub fn hashGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = BuildArtifactPrototype__hashGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn BuildArtifactPrototype__kindSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn BuildArtifactPrototype__kindGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `BuildArtifact.kind` setter - /// This value will be visited by the garbage collector. - pub fn kindSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - BuildArtifactPrototype__kindSetCachedValue(thisValue, globalObject, value); - } - - /// `BuildArtifact.kind` getter - /// This value will be visited by the garbage collector. - pub fn kindGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = BuildArtifactPrototype__kindGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn BuildArtifactPrototype__loaderSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn BuildArtifactPrototype__loaderGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `BuildArtifact.loader` setter - /// This value will be visited by the garbage collector. - pub fn loaderSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - BuildArtifactPrototype__loaderSetCachedValue(thisValue, globalObject, value); - } - - /// `BuildArtifact.loader` getter - /// This value will be visited by the garbage collector. - pub fn loaderGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = BuildArtifactPrototype__loaderGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn BuildArtifactPrototype__pathSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn BuildArtifactPrototype__pathGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `BuildArtifact.path` setter - /// This value will be visited by the garbage collector. - pub fn pathSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - BuildArtifactPrototype__pathSetCachedValue(thisValue, globalObject, value); - } - - /// `BuildArtifact.path` getter - /// This value will be visited by the garbage collector. - pub fn pathGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = BuildArtifactPrototype__pathGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn BuildArtifactPrototype__sourcemapSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn BuildArtifactPrototype__sourcemapGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `BuildArtifact.sourcemap` setter - /// This value will be visited by the garbage collector. - pub fn sourcemapSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - BuildArtifactPrototype__sourcemapSetCachedValue(thisValue, globalObject, value); - } - - /// `BuildArtifact.sourcemap` getter - /// This value will be visited by the garbage collector. - pub fn sourcemapGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = BuildArtifactPrototype__sourcemapGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn BuildArtifactPrototype__typeSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn BuildArtifactPrototype__typeGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `BuildArtifact.type` setter - /// This value will be visited by the garbage collector. - pub fn typeSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - BuildArtifactPrototype__typeSetCachedValue(thisValue, globalObject, value); - } - - /// `BuildArtifact.type` getter - /// This value will be visited by the garbage collector. - pub fn typeGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = BuildArtifactPrototype__typeGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Create a new instance of BuildArtifact - pub fn toJS(this: *BuildArtifact, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = BuildArtifact__create(globalObject, this); - std.debug.assert(value__.as(BuildArtifact).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return BuildArtifact__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of BuildArtifact. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*BuildArtifact) bool { - JSC.markBinding(@src()); - return BuildArtifact__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *BuildArtifact, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(BuildArtifact__dangerouslySetPtr(value, null)); - } - - extern fn BuildArtifact__fromJS(JSC.JSValue) ?*BuildArtifact; - extern fn BuildArtifact__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn BuildArtifact__create(globalObject: *JSC.JSGlobalObject, ptr: ?*BuildArtifact) JSC.JSValue; - - extern fn BuildArtifact__dangerouslySetPtr(JSC.JSValue, ?*BuildArtifact) bool; - - comptime { - if (@TypeOf(BuildArtifact.finalize) != (fn (*BuildArtifact) callconv(.C) void)) { - @compileLog("BuildArtifact.finalize is not a finalizer"); - } - - if (@TypeOf(BuildArtifact.getArrayBuffer) != CallbackType) - @compileLog("Expected BuildArtifact.getArrayBuffer to be a callback but received " ++ @typeName(@TypeOf(BuildArtifact.getArrayBuffer))); - if (@TypeOf(BuildArtifact.getHash) != GetterType) - @compileLog("Expected BuildArtifact.getHash to be a getter"); - - if (@TypeOf(BuildArtifact.getJSON) != CallbackType) - @compileLog("Expected BuildArtifact.getJSON to be a callback but received " ++ @typeName(@TypeOf(BuildArtifact.getJSON))); - if (@TypeOf(BuildArtifact.getOutputKind) != GetterType) - @compileLog("Expected BuildArtifact.getOutputKind to be a getter"); - - if (@TypeOf(BuildArtifact.getLoader) != GetterType) - @compileLog("Expected BuildArtifact.getLoader to be a getter"); - - if (@TypeOf(BuildArtifact.getPath) != GetterType) - @compileLog("Expected BuildArtifact.getPath to be a getter"); - - if (@TypeOf(BuildArtifact.getSize) != GetterType) - @compileLog("Expected BuildArtifact.getSize to be a getter"); - - if (@TypeOf(BuildArtifact.getSlice) != CallbackType) - @compileLog("Expected BuildArtifact.getSlice to be a callback but received " ++ @typeName(@TypeOf(BuildArtifact.getSlice))); - if (@TypeOf(BuildArtifact.getSourceMap) != GetterType) - @compileLog("Expected BuildArtifact.getSourceMap to be a getter"); - - if (@TypeOf(BuildArtifact.getStream) != CallbackType) - @compileLog("Expected BuildArtifact.getStream to be a callback but received " ++ @typeName(@TypeOf(BuildArtifact.getStream))); - if (@TypeOf(BuildArtifact.getText) != CallbackType) - @compileLog("Expected BuildArtifact.getText to be a callback but received " ++ @typeName(@TypeOf(BuildArtifact.getText))); - if (@TypeOf(BuildArtifact.getMimeType) != GetterType) - @compileLog("Expected BuildArtifact.getMimeType to be a getter"); - - if (!JSC.is_bindgen) { - @export(BuildArtifact.finalize, .{ .name = "BuildArtifactClass__finalize" }); - @export(BuildArtifact.getArrayBuffer, .{ .name = "BuildArtifactPrototype__getArrayBuffer" }); - @export(BuildArtifact.getHash, .{ .name = "BuildArtifactPrototype__getHash" }); - @export(BuildArtifact.getJSON, .{ .name = "BuildArtifactPrototype__getJSON" }); - @export(BuildArtifact.getLoader, .{ .name = "BuildArtifactPrototype__getLoader" }); - @export(BuildArtifact.getMimeType, .{ .name = "BuildArtifactPrototype__getMimeType" }); - @export(BuildArtifact.getOutputKind, .{ .name = "BuildArtifactPrototype__getOutputKind" }); - @export(BuildArtifact.getPath, .{ .name = "BuildArtifactPrototype__getPath" }); - @export(BuildArtifact.getSize, .{ .name = "BuildArtifactPrototype__getSize" }); - @export(BuildArtifact.getSlice, .{ .name = "BuildArtifactPrototype__getSlice" }); - @export(BuildArtifact.getSourceMap, .{ .name = "BuildArtifactPrototype__getSourceMap" }); - @export(BuildArtifact.getStream, .{ .name = "BuildArtifactPrototype__getStream" }); - @export(BuildArtifact.getText, .{ .name = "BuildArtifactPrototype__getText" }); - } - } -}; -pub const JSBuildMessage = struct { - const BuildMessage = Classes.BuildMessage; - const GetterType = fn (*BuildMessage, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*BuildMessage, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*BuildMessage, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*BuildMessage, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*BuildMessage, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*BuildMessage { - JSC.markBinding(@src()); - return BuildMessage__fromJS(value); - } - - extern fn BuildMessagePrototype__levelSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn BuildMessagePrototype__levelGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `BuildMessage.level` setter - /// This value will be visited by the garbage collector. - pub fn levelSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - BuildMessagePrototype__levelSetCachedValue(thisValue, globalObject, value); - } - - /// `BuildMessage.level` getter - /// This value will be visited by the garbage collector. - pub fn levelGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = BuildMessagePrototype__levelGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn BuildMessagePrototype__messageSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn BuildMessagePrototype__messageGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `BuildMessage.message` setter - /// This value will be visited by the garbage collector. - pub fn messageSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - BuildMessagePrototype__messageSetCachedValue(thisValue, globalObject, value); - } - - /// `BuildMessage.message` getter - /// This value will be visited by the garbage collector. - pub fn messageGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = BuildMessagePrototype__messageGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn BuildMessagePrototype__positionSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn BuildMessagePrototype__positionGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `BuildMessage.position` setter - /// This value will be visited by the garbage collector. - pub fn positionSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - BuildMessagePrototype__positionSetCachedValue(thisValue, globalObject, value); - } - - /// `BuildMessage.position` getter - /// This value will be visited by the garbage collector. - pub fn positionGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = BuildMessagePrototype__positionGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Get the BuildMessage constructor value. - /// This loads lazily from the global object. - pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - return BuildMessage__getConstructor(globalObject); - } - - /// Create a new instance of BuildMessage - pub fn toJS(this: *BuildMessage, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = BuildMessage__create(globalObject, this); - std.debug.assert(value__.as(BuildMessage).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return BuildMessage__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of BuildMessage. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*BuildMessage) bool { - JSC.markBinding(@src()); - return BuildMessage__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *BuildMessage, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(BuildMessage__dangerouslySetPtr(value, null)); - } - - extern fn BuildMessage__fromJS(JSC.JSValue) ?*BuildMessage; - extern fn BuildMessage__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn BuildMessage__create(globalObject: *JSC.JSGlobalObject, ptr: ?*BuildMessage) JSC.JSValue; - - extern fn BuildMessage__dangerouslySetPtr(JSC.JSValue, ?*BuildMessage) bool; - - comptime { - if (@TypeOf(BuildMessage.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*BuildMessage)) { - @compileLog("BuildMessage.constructor is not a constructor"); - } - - if (@TypeOf(BuildMessage.finalize) != (fn (*BuildMessage) callconv(.C) void)) { - @compileLog("BuildMessage.finalize is not a finalizer"); - } - - if (@TypeOf(BuildMessage.toPrimitive) != CallbackType) - @compileLog("Expected BuildMessage.toPrimitive to be a callback but received " ++ @typeName(@TypeOf(BuildMessage.toPrimitive))); - if (@TypeOf(BuildMessage.getLevel) != GetterType) - @compileLog("Expected BuildMessage.getLevel to be a getter"); - - if (@TypeOf(BuildMessage.getMessage) != GetterType) - @compileLog("Expected BuildMessage.getMessage to be a getter"); - - if (@TypeOf(BuildMessage.getPosition) != GetterType) - @compileLog("Expected BuildMessage.getPosition to be a getter"); - - if (@TypeOf(BuildMessage.toJSON) != CallbackType) - @compileLog("Expected BuildMessage.toJSON to be a callback but received " ++ @typeName(@TypeOf(BuildMessage.toJSON))); - if (@TypeOf(BuildMessage.toString) != CallbackType) - @compileLog("Expected BuildMessage.toString to be a callback but received " ++ @typeName(@TypeOf(BuildMessage.toString))); - if (!JSC.is_bindgen) { - @export(BuildMessage.constructor, .{ .name = "BuildMessageClass__construct" }); - @export(BuildMessage.finalize, .{ .name = "BuildMessageClass__finalize" }); - @export(BuildMessage.getLevel, .{ .name = "BuildMessagePrototype__getLevel" }); - @export(BuildMessage.getMessage, .{ .name = "BuildMessagePrototype__getMessage" }); - @export(BuildMessage.getPosition, .{ .name = "BuildMessagePrototype__getPosition" }); - @export(BuildMessage.toJSON, .{ .name = "BuildMessagePrototype__toJSON" }); - @export(BuildMessage.toPrimitive, .{ .name = "BuildMessagePrototype__toPrimitive" }); - @export(BuildMessage.toString, .{ .name = "BuildMessagePrototype__toString" }); - } - } -}; -pub const JSComment = struct { - const Comment = Classes.Comment; - const GetterType = fn (*Comment, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*Comment, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*Comment, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*Comment, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*Comment, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*Comment { - JSC.markBinding(@src()); - return Comment__fromJS(value); - } - - /// Create a new instance of Comment - pub fn toJS(this: *Comment, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = Comment__create(globalObject, this); - std.debug.assert(value__.as(Comment).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return Comment__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of Comment. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Comment) bool { - JSC.markBinding(@src()); - return Comment__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *Comment, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(Comment__dangerouslySetPtr(value, null)); - } - - extern fn Comment__fromJS(JSC.JSValue) ?*Comment; - extern fn Comment__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn Comment__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Comment) JSC.JSValue; - - extern fn Comment__dangerouslySetPtr(JSC.JSValue, ?*Comment) bool; - - comptime { - if (@TypeOf(Comment.finalize) != (fn (*Comment) callconv(.C) void)) { - @compileLog("Comment.finalize is not a finalizer"); - } - - if (@TypeOf(Comment.after) != CallbackType) - @compileLog("Expected Comment.after to be a callback but received " ++ @typeName(@TypeOf(Comment.after))); - if (@TypeOf(Comment.before) != CallbackType) - @compileLog("Expected Comment.before to be a callback but received " ++ @typeName(@TypeOf(Comment.before))); - if (@TypeOf(Comment.remove) != CallbackType) - @compileLog("Expected Comment.remove to be a callback but received " ++ @typeName(@TypeOf(Comment.remove))); - if (@TypeOf(Comment.removed) != GetterType) - @compileLog("Expected Comment.removed to be a getter"); - - if (@TypeOf(Comment.replace) != CallbackType) - @compileLog("Expected Comment.replace to be a callback but received " ++ @typeName(@TypeOf(Comment.replace))); - if (@TypeOf(Comment.getText) != GetterType) - @compileLog("Expected Comment.getText to be a getter"); - - if (@TypeOf(Comment.setText) != SetterType) - @compileLog("Expected Comment.setText to be a setter"); - if (!JSC.is_bindgen) { - @export(Comment.after, .{ .name = "CommentPrototype__after" }); - @export(Comment.before, .{ .name = "CommentPrototype__before" }); - @export(Comment.finalize, .{ .name = "CommentClass__finalize" }); - @export(Comment.getText, .{ .name = "CommentPrototype__getText" }); - @export(Comment.remove, .{ .name = "CommentPrototype__remove" }); - @export(Comment.removed, .{ .name = "CommentPrototype__removed" }); - @export(Comment.replace, .{ .name = "CommentPrototype__replace" }); - @export(Comment.setText, .{ .name = "CommentPrototype__setText" }); - } - } -}; -pub const JSCrypto = struct { - const Crypto = Classes.Crypto; - const GetterType = fn (*Crypto, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*Crypto, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*Crypto, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*Crypto, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*Crypto, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*Crypto { - JSC.markBinding(@src()); - return Crypto__fromJS(value); - } - - /// Get the Crypto constructor value. - /// This loads lazily from the global object. - pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - return Crypto__getConstructor(globalObject); - } - - /// Create a new instance of Crypto - pub fn toJS(this: *Crypto, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = Crypto__create(globalObject, this); - std.debug.assert(value__.as(Crypto).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return Crypto__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of Crypto. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Crypto) bool { - JSC.markBinding(@src()); - return Crypto__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *Crypto, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(Crypto__dangerouslySetPtr(value, null)); - } - - extern fn Crypto__fromJS(JSC.JSValue) ?*Crypto; - extern fn Crypto__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn Crypto__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Crypto) JSC.JSValue; - - extern fn Crypto__dangerouslySetPtr(JSC.JSValue, ?*Crypto) bool; - - comptime { - if (@TypeOf(Crypto.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Crypto)) { - @compileLog("Crypto.constructor is not a constructor"); - } - - if (@TypeOf(Crypto.getRandomValuesWithoutTypeChecks) != fn (*Crypto, *JSC.JSGlobalObject, *JSC.JSUint8Array) callconv(.C) JSC.JSValue) - @compileLog("Expected Crypto.getRandomValuesWithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(Crypto.getRandomValues) != CallbackType) - @compileLog("Expected Crypto.getRandomValues to be a callback but received " ++ @typeName(@TypeOf(Crypto.getRandomValues))); - if (@TypeOf(Crypto.randomInt) != CallbackType) - @compileLog("Expected Crypto.randomInt to be a callback but received " ++ @typeName(@TypeOf(Crypto.randomInt))); - if (@TypeOf(Crypto.randomUUIDWithoutTypeChecks) != fn ( - *Crypto, - *JSC.JSGlobalObject, - ) callconv(.C) JSC.JSValue) - @compileLog("Expected Crypto.randomUUIDWithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(Crypto.randomUUID) != CallbackType) - @compileLog("Expected Crypto.randomUUID to be a callback but received " ++ @typeName(@TypeOf(Crypto.randomUUID))); - if (@TypeOf(Crypto.doScryptSync) != CallbackType) - @compileLog("Expected Crypto.doScryptSync to be a callback but received " ++ @typeName(@TypeOf(Crypto.doScryptSync))); - if (@TypeOf(Crypto.timingSafeEqualWithoutTypeChecks) != fn (*Crypto, *JSC.JSGlobalObject, *JSC.JSUint8Array, *JSC.JSUint8Array) callconv(.C) JSC.JSValue) - @compileLog("Expected Crypto.timingSafeEqualWithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(Crypto.timingSafeEqual) != CallbackType) - @compileLog("Expected Crypto.timingSafeEqual to be a callback but received " ++ @typeName(@TypeOf(Crypto.timingSafeEqual))); - if (!JSC.is_bindgen) { - @export(Crypto.constructor, .{ .name = "CryptoClass__construct" }); - @export(Crypto.doScryptSync, .{ .name = "CryptoPrototype__doScryptSync" }); - @export(Crypto.getRandomValues, .{ .name = "CryptoPrototype__getRandomValues" }); - @export(Crypto.getRandomValuesWithoutTypeChecks, .{ .name = "CryptoPrototype__getRandomValuesWithoutTypeChecks" }); - @export(Crypto.randomInt, .{ .name = "CryptoPrototype__randomInt" }); - @export(Crypto.randomUUID, .{ .name = "CryptoPrototype__randomUUID" }); - @export(Crypto.randomUUIDWithoutTypeChecks, .{ .name = "CryptoPrototype__randomUUIDWithoutTypeChecks" }); - @export(Crypto.timingSafeEqual, .{ .name = "CryptoPrototype__timingSafeEqual" }); - @export(Crypto.timingSafeEqualWithoutTypeChecks, .{ .name = "CryptoPrototype__timingSafeEqualWithoutTypeChecks" }); - } - } -}; -pub const JSCryptoHasher = struct { - const CryptoHasher = Classes.CryptoHasher; - const GetterType = fn (*CryptoHasher, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*CryptoHasher, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*CryptoHasher, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*CryptoHasher, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*CryptoHasher, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*CryptoHasher { - JSC.markBinding(@src()); - return CryptoHasher__fromJS(value); - } - - extern fn CryptoHasherPrototype__algorithmSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn CryptoHasherPrototype__algorithmGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `CryptoHasher.algorithm` setter - /// This value will be visited by the garbage collector. - pub fn algorithmSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - CryptoHasherPrototype__algorithmSetCachedValue(thisValue, globalObject, value); - } - - /// `CryptoHasher.algorithm` getter - /// This value will be visited by the garbage collector. - pub fn algorithmGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = CryptoHasherPrototype__algorithmGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Get the CryptoHasher constructor value. - /// This loads lazily from the global object. - pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - return CryptoHasher__getConstructor(globalObject); - } - - /// Create a new instance of CryptoHasher - pub fn toJS(this: *CryptoHasher, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = CryptoHasher__create(globalObject, this); - std.debug.assert(value__.as(CryptoHasher).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return CryptoHasher__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of CryptoHasher. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*CryptoHasher) bool { - JSC.markBinding(@src()); - return CryptoHasher__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *CryptoHasher, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(CryptoHasher__dangerouslySetPtr(value, null)); - } - - extern fn CryptoHasher__fromJS(JSC.JSValue) ?*CryptoHasher; - extern fn CryptoHasher__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn CryptoHasher__create(globalObject: *JSC.JSGlobalObject, ptr: ?*CryptoHasher) JSC.JSValue; - - extern fn CryptoHasher__dangerouslySetPtr(JSC.JSValue, ?*CryptoHasher) bool; - - comptime { - if (@TypeOf(CryptoHasher.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*CryptoHasher)) { - @compileLog("CryptoHasher.constructor is not a constructor"); - } - - if (@TypeOf(CryptoHasher.finalize) != (fn (*CryptoHasher) callconv(.C) void)) { - @compileLog("CryptoHasher.finalize is not a finalizer"); - } - - if (@TypeOf(CryptoHasher.getAlgorithm) != GetterType) - @compileLog("Expected CryptoHasher.getAlgorithm to be a getter"); - - if (@TypeOf(CryptoHasher.getByteLength) != GetterType) - @compileLog("Expected CryptoHasher.getByteLength to be a getter"); - - if (@TypeOf(CryptoHasher.copy) != CallbackType) - @compileLog("Expected CryptoHasher.copy to be a callback but received " ++ @typeName(@TypeOf(CryptoHasher.copy))); - if (@TypeOf(CryptoHasher.digest) != CallbackType) - @compileLog("Expected CryptoHasher.digest to be a callback but received " ++ @typeName(@TypeOf(CryptoHasher.digest))); - if (@TypeOf(CryptoHasher.update) != CallbackType) - @compileLog("Expected CryptoHasher.update to be a callback but received " ++ @typeName(@TypeOf(CryptoHasher.update))); - if (@TypeOf(CryptoHasher.getAlgorithms) != StaticGetterType) - @compileLog("Expected CryptoHasher.getAlgorithms to be a static getter"); - - if (@TypeOf(CryptoHasher.hash) != StaticCallbackType) - @compileLog("Expected CryptoHasher.hash to be a static callback"); - if (!JSC.is_bindgen) { - @export(CryptoHasher.constructor, .{ .name = "CryptoHasherClass__construct" }); - @export(CryptoHasher.copy, .{ .name = "CryptoHasherPrototype__copy" }); - @export(CryptoHasher.digest, .{ .name = "CryptoHasherPrototype__digest" }); - @export(CryptoHasher.finalize, .{ .name = "CryptoHasherClass__finalize" }); - @export(CryptoHasher.getAlgorithm, .{ .name = "CryptoHasherPrototype__getAlgorithm" }); - @export(CryptoHasher.getAlgorithms, .{ .name = "CryptoHasherClass__getAlgorithms" }); - @export(CryptoHasher.getByteLength, .{ .name = "CryptoHasherPrototype__getByteLength" }); - @export(CryptoHasher.hash, .{ .name = "CryptoHasherClass__hash" }); - @export(CryptoHasher.update, .{ .name = "CryptoHasherPrototype__update" }); - } - } -}; -pub const JSDebugHTTPSServer = struct { - const DebugHTTPSServer = Classes.DebugHTTPSServer; - const GetterType = fn (*DebugHTTPSServer, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*DebugHTTPSServer, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*DebugHTTPSServer, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*DebugHTTPSServer, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*DebugHTTPSServer, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*DebugHTTPSServer { - JSC.markBinding(@src()); - return DebugHTTPSServer__fromJS(value); - } - - extern fn DebugHTTPSServerPrototype__addressSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn DebugHTTPSServerPrototype__addressGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `DebugHTTPSServer.address` setter - /// This value will be visited by the garbage collector. - pub fn addressSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - DebugHTTPSServerPrototype__addressSetCachedValue(thisValue, globalObject, value); - } - - /// `DebugHTTPSServer.address` getter - /// This value will be visited by the garbage collector. - pub fn addressGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = DebugHTTPSServerPrototype__addressGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn DebugHTTPSServerPrototype__hostnameSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn DebugHTTPSServerPrototype__hostnameGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `DebugHTTPSServer.hostname` setter - /// This value will be visited by the garbage collector. - pub fn hostnameSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - DebugHTTPSServerPrototype__hostnameSetCachedValue(thisValue, globalObject, value); - } - - /// `DebugHTTPSServer.hostname` getter - /// This value will be visited by the garbage collector. - pub fn hostnameGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = DebugHTTPSServerPrototype__hostnameGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn DebugHTTPSServerPrototype__idSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn DebugHTTPSServerPrototype__idGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `DebugHTTPSServer.id` setter - /// This value will be visited by the garbage collector. - pub fn idSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - DebugHTTPSServerPrototype__idSetCachedValue(thisValue, globalObject, value); - } - - /// `DebugHTTPSServer.id` getter - /// This value will be visited by the garbage collector. - pub fn idGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = DebugHTTPSServerPrototype__idGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Create a new instance of DebugHTTPSServer - pub fn toJS(this: *DebugHTTPSServer, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = DebugHTTPSServer__create(globalObject, this); - std.debug.assert(value__.as(DebugHTTPSServer).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return DebugHTTPSServer__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of DebugHTTPSServer. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*DebugHTTPSServer) bool { - JSC.markBinding(@src()); - return DebugHTTPSServer__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *DebugHTTPSServer, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(DebugHTTPSServer__dangerouslySetPtr(value, null)); - } - - extern fn DebugHTTPSServer__fromJS(JSC.JSValue) ?*DebugHTTPSServer; - extern fn DebugHTTPSServer__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn DebugHTTPSServer__create(globalObject: *JSC.JSGlobalObject, ptr: ?*DebugHTTPSServer) JSC.JSValue; - - extern fn DebugHTTPSServer__dangerouslySetPtr(JSC.JSValue, ?*DebugHTTPSServer) bool; - - comptime { - if (@TypeOf(DebugHTTPSServer.finalize) != (fn (*DebugHTTPSServer) callconv(.C) void)) { - @compileLog("DebugHTTPSServer.finalize is not a finalizer"); - } - - if (@TypeOf(DebugHTTPSServer.getAddress) != GetterType) - @compileLog("Expected DebugHTTPSServer.getAddress to be a getter"); - - if (@TypeOf(DebugHTTPSServer.getDevelopment) != GetterType) - @compileLog("Expected DebugHTTPSServer.getDevelopment to be a getter"); - - if (@TypeOf(DebugHTTPSServer.doFetch) != CallbackType) - @compileLog("Expected DebugHTTPSServer.doFetch to be a callback but received " ++ @typeName(@TypeOf(DebugHTTPSServer.doFetch))); - if (@TypeOf(DebugHTTPSServer.getHostname) != GetterType) - @compileLog("Expected DebugHTTPSServer.getHostname to be a getter"); - - if (@TypeOf(DebugHTTPSServer.getId) != GetterType) - @compileLog("Expected DebugHTTPSServer.getId to be a getter"); - - if (@TypeOf(DebugHTTPSServer.getPendingRequests) != GetterType) - @compileLog("Expected DebugHTTPSServer.getPendingRequests to be a getter"); - - if (@TypeOf(DebugHTTPSServer.getPendingWebSockets) != GetterType) - @compileLog("Expected DebugHTTPSServer.getPendingWebSockets to be a getter"); - - if (@TypeOf(DebugHTTPSServer.getPort) != GetterType) - @compileLog("Expected DebugHTTPSServer.getPort to be a getter"); - - if (@TypeOf(DebugHTTPSServer.getProtocol) != GetterType) - @compileLog("Expected DebugHTTPSServer.getProtocol to be a getter"); - - if (@TypeOf(DebugHTTPSServer.doPublish) != CallbackType) - @compileLog("Expected DebugHTTPSServer.doPublish to be a callback but received " ++ @typeName(@TypeOf(DebugHTTPSServer.doPublish))); - if (@TypeOf(DebugHTTPSServer.doReload) != CallbackType) - @compileLog("Expected DebugHTTPSServer.doReload to be a callback but received " ++ @typeName(@TypeOf(DebugHTTPSServer.doReload))); - if (@TypeOf(DebugHTTPSServer.doRequestIP) != CallbackType) - @compileLog("Expected DebugHTTPSServer.doRequestIP to be a callback but received " ++ @typeName(@TypeOf(DebugHTTPSServer.doRequestIP))); - if (@TypeOf(DebugHTTPSServer.doStop) != CallbackType) - @compileLog("Expected DebugHTTPSServer.doStop to be a callback but received " ++ @typeName(@TypeOf(DebugHTTPSServer.doStop))); - if (@TypeOf(DebugHTTPSServer.doUpgrade) != CallbackType) - @compileLog("Expected DebugHTTPSServer.doUpgrade to be a callback but received " ++ @typeName(@TypeOf(DebugHTTPSServer.doUpgrade))); - if (!JSC.is_bindgen) { - @export(DebugHTTPSServer.doFetch, .{ .name = "DebugHTTPSServerPrototype__doFetch" }); - @export(DebugHTTPSServer.doPublish, .{ .name = "DebugHTTPSServerPrototype__doPublish" }); - @export(DebugHTTPSServer.doReload, .{ .name = "DebugHTTPSServerPrototype__doReload" }); - @export(DebugHTTPSServer.doRequestIP, .{ .name = "DebugHTTPSServerPrototype__doRequestIP" }); - @export(DebugHTTPSServer.doStop, .{ .name = "DebugHTTPSServerPrototype__doStop" }); - @export(DebugHTTPSServer.doUpgrade, .{ .name = "DebugHTTPSServerPrototype__doUpgrade" }); - @export(DebugHTTPSServer.finalize, .{ .name = "DebugHTTPSServerClass__finalize" }); - @export(DebugHTTPSServer.getAddress, .{ .name = "DebugHTTPSServerPrototype__getAddress" }); - @export(DebugHTTPSServer.getDevelopment, .{ .name = "DebugHTTPSServerPrototype__getDevelopment" }); - @export(DebugHTTPSServer.getHostname, .{ .name = "DebugHTTPSServerPrototype__getHostname" }); - @export(DebugHTTPSServer.getId, .{ .name = "DebugHTTPSServerPrototype__getId" }); - @export(DebugHTTPSServer.getPendingRequests, .{ .name = "DebugHTTPSServerPrototype__getPendingRequests" }); - @export(DebugHTTPSServer.getPendingWebSockets, .{ .name = "DebugHTTPSServerPrototype__getPendingWebSockets" }); - @export(DebugHTTPSServer.getPort, .{ .name = "DebugHTTPSServerPrototype__getPort" }); - @export(DebugHTTPSServer.getProtocol, .{ .name = "DebugHTTPSServerPrototype__getProtocol" }); - } - } -}; -pub const JSDebugHTTPServer = struct { - const DebugHTTPServer = Classes.DebugHTTPServer; - const GetterType = fn (*DebugHTTPServer, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*DebugHTTPServer, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*DebugHTTPServer, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*DebugHTTPServer, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*DebugHTTPServer, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*DebugHTTPServer { - JSC.markBinding(@src()); - return DebugHTTPServer__fromJS(value); - } - - extern fn DebugHTTPServerPrototype__addressSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn DebugHTTPServerPrototype__addressGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `DebugHTTPServer.address` setter - /// This value will be visited by the garbage collector. - pub fn addressSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - DebugHTTPServerPrototype__addressSetCachedValue(thisValue, globalObject, value); - } - - /// `DebugHTTPServer.address` getter - /// This value will be visited by the garbage collector. - pub fn addressGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = DebugHTTPServerPrototype__addressGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn DebugHTTPServerPrototype__hostnameSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn DebugHTTPServerPrototype__hostnameGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `DebugHTTPServer.hostname` setter - /// This value will be visited by the garbage collector. - pub fn hostnameSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - DebugHTTPServerPrototype__hostnameSetCachedValue(thisValue, globalObject, value); - } - - /// `DebugHTTPServer.hostname` getter - /// This value will be visited by the garbage collector. - pub fn hostnameGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = DebugHTTPServerPrototype__hostnameGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn DebugHTTPServerPrototype__idSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn DebugHTTPServerPrototype__idGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `DebugHTTPServer.id` setter - /// This value will be visited by the garbage collector. - pub fn idSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - DebugHTTPServerPrototype__idSetCachedValue(thisValue, globalObject, value); - } - - /// `DebugHTTPServer.id` getter - /// This value will be visited by the garbage collector. - pub fn idGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = DebugHTTPServerPrototype__idGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Create a new instance of DebugHTTPServer - pub fn toJS(this: *DebugHTTPServer, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = DebugHTTPServer__create(globalObject, this); - std.debug.assert(value__.as(DebugHTTPServer).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return DebugHTTPServer__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of DebugHTTPServer. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*DebugHTTPServer) bool { - JSC.markBinding(@src()); - return DebugHTTPServer__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *DebugHTTPServer, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(DebugHTTPServer__dangerouslySetPtr(value, null)); - } - - extern fn DebugHTTPServer__fromJS(JSC.JSValue) ?*DebugHTTPServer; - extern fn DebugHTTPServer__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn DebugHTTPServer__create(globalObject: *JSC.JSGlobalObject, ptr: ?*DebugHTTPServer) JSC.JSValue; - - extern fn DebugHTTPServer__dangerouslySetPtr(JSC.JSValue, ?*DebugHTTPServer) bool; - - comptime { - if (@TypeOf(DebugHTTPServer.finalize) != (fn (*DebugHTTPServer) callconv(.C) void)) { - @compileLog("DebugHTTPServer.finalize is not a finalizer"); - } - - if (@TypeOf(DebugHTTPServer.getAddress) != GetterType) - @compileLog("Expected DebugHTTPServer.getAddress to be a getter"); - - if (@TypeOf(DebugHTTPServer.getDevelopment) != GetterType) - @compileLog("Expected DebugHTTPServer.getDevelopment to be a getter"); - - if (@TypeOf(DebugHTTPServer.doFetch) != CallbackType) - @compileLog("Expected DebugHTTPServer.doFetch to be a callback but received " ++ @typeName(@TypeOf(DebugHTTPServer.doFetch))); - if (@TypeOf(DebugHTTPServer.getHostname) != GetterType) - @compileLog("Expected DebugHTTPServer.getHostname to be a getter"); - - if (@TypeOf(DebugHTTPServer.getId) != GetterType) - @compileLog("Expected DebugHTTPServer.getId to be a getter"); - - if (@TypeOf(DebugHTTPServer.getPendingRequests) != GetterType) - @compileLog("Expected DebugHTTPServer.getPendingRequests to be a getter"); - - if (@TypeOf(DebugHTTPServer.getPendingWebSockets) != GetterType) - @compileLog("Expected DebugHTTPServer.getPendingWebSockets to be a getter"); - - if (@TypeOf(DebugHTTPServer.getPort) != GetterType) - @compileLog("Expected DebugHTTPServer.getPort to be a getter"); - - if (@TypeOf(DebugHTTPServer.getProtocol) != GetterType) - @compileLog("Expected DebugHTTPServer.getProtocol to be a getter"); - - if (@TypeOf(DebugHTTPServer.doPublish) != CallbackType) - @compileLog("Expected DebugHTTPServer.doPublish to be a callback but received " ++ @typeName(@TypeOf(DebugHTTPServer.doPublish))); - if (@TypeOf(DebugHTTPServer.doReload) != CallbackType) - @compileLog("Expected DebugHTTPServer.doReload to be a callback but received " ++ @typeName(@TypeOf(DebugHTTPServer.doReload))); - if (@TypeOf(DebugHTTPServer.doRequestIP) != CallbackType) - @compileLog("Expected DebugHTTPServer.doRequestIP to be a callback but received " ++ @typeName(@TypeOf(DebugHTTPServer.doRequestIP))); - if (@TypeOf(DebugHTTPServer.doStop) != CallbackType) - @compileLog("Expected DebugHTTPServer.doStop to be a callback but received " ++ @typeName(@TypeOf(DebugHTTPServer.doStop))); - if (@TypeOf(DebugHTTPServer.doUpgrade) != CallbackType) - @compileLog("Expected DebugHTTPServer.doUpgrade to be a callback but received " ++ @typeName(@TypeOf(DebugHTTPServer.doUpgrade))); - if (!JSC.is_bindgen) { - @export(DebugHTTPServer.doFetch, .{ .name = "DebugHTTPServerPrototype__doFetch" }); - @export(DebugHTTPServer.doPublish, .{ .name = "DebugHTTPServerPrototype__doPublish" }); - @export(DebugHTTPServer.doReload, .{ .name = "DebugHTTPServerPrototype__doReload" }); - @export(DebugHTTPServer.doRequestIP, .{ .name = "DebugHTTPServerPrototype__doRequestIP" }); - @export(DebugHTTPServer.doStop, .{ .name = "DebugHTTPServerPrototype__doStop" }); - @export(DebugHTTPServer.doUpgrade, .{ .name = "DebugHTTPServerPrototype__doUpgrade" }); - @export(DebugHTTPServer.finalize, .{ .name = "DebugHTTPServerClass__finalize" }); - @export(DebugHTTPServer.getAddress, .{ .name = "DebugHTTPServerPrototype__getAddress" }); - @export(DebugHTTPServer.getDevelopment, .{ .name = "DebugHTTPServerPrototype__getDevelopment" }); - @export(DebugHTTPServer.getHostname, .{ .name = "DebugHTTPServerPrototype__getHostname" }); - @export(DebugHTTPServer.getId, .{ .name = "DebugHTTPServerPrototype__getId" }); - @export(DebugHTTPServer.getPendingRequests, .{ .name = "DebugHTTPServerPrototype__getPendingRequests" }); - @export(DebugHTTPServer.getPendingWebSockets, .{ .name = "DebugHTTPServerPrototype__getPendingWebSockets" }); - @export(DebugHTTPServer.getPort, .{ .name = "DebugHTTPServerPrototype__getPort" }); - @export(DebugHTTPServer.getProtocol, .{ .name = "DebugHTTPServerPrototype__getProtocol" }); - } - } -}; -pub const JSDirent = struct { - const Dirent = Classes.Dirent; - const GetterType = fn (*Dirent, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*Dirent, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*Dirent, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*Dirent, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*Dirent, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*Dirent { - JSC.markBinding(@src()); - return Dirent__fromJS(value); - } - - extern fn DirentPrototype__nameSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn DirentPrototype__nameGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Dirent.name` setter - /// This value will be visited by the garbage collector. - pub fn nameSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - DirentPrototype__nameSetCachedValue(thisValue, globalObject, value); - } - - /// `Dirent.name` getter - /// This value will be visited by the garbage collector. - pub fn nameGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = DirentPrototype__nameGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Get the Dirent constructor value. - /// This loads lazily from the global object. - pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - return Dirent__getConstructor(globalObject); - } - - /// Create a new instance of Dirent - pub fn toJS(this: *Dirent, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = Dirent__create(globalObject, this); - std.debug.assert(value__.as(Dirent).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return Dirent__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of Dirent. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Dirent) bool { - JSC.markBinding(@src()); - return Dirent__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *Dirent, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(Dirent__dangerouslySetPtr(value, null)); - } - - extern fn Dirent__fromJS(JSC.JSValue) ?*Dirent; - extern fn Dirent__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn Dirent__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Dirent) JSC.JSValue; - - extern fn Dirent__dangerouslySetPtr(JSC.JSValue, ?*Dirent) bool; - - comptime { - if (@TypeOf(Dirent.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Dirent)) { - @compileLog("Dirent.constructor is not a constructor"); - } - - if (@TypeOf(Dirent.finalize) != (fn (*Dirent) callconv(.C) void)) { - @compileLog("Dirent.finalize is not a finalizer"); - } - - if (@TypeOf(Dirent.isBlockDevice) != CallbackType) - @compileLog("Expected Dirent.isBlockDevice to be a callback but received " ++ @typeName(@TypeOf(Dirent.isBlockDevice))); - if (@TypeOf(Dirent.isCharacterDevice) != CallbackType) - @compileLog("Expected Dirent.isCharacterDevice to be a callback but received " ++ @typeName(@TypeOf(Dirent.isCharacterDevice))); - if (@TypeOf(Dirent.isDirectory) != CallbackType) - @compileLog("Expected Dirent.isDirectory to be a callback but received " ++ @typeName(@TypeOf(Dirent.isDirectory))); - if (@TypeOf(Dirent.isFIFO) != CallbackType) - @compileLog("Expected Dirent.isFIFO to be a callback but received " ++ @typeName(@TypeOf(Dirent.isFIFO))); - if (@TypeOf(Dirent.isFile) != CallbackType) - @compileLog("Expected Dirent.isFile to be a callback but received " ++ @typeName(@TypeOf(Dirent.isFile))); - if (@TypeOf(Dirent.isSocket) != CallbackType) - @compileLog("Expected Dirent.isSocket to be a callback but received " ++ @typeName(@TypeOf(Dirent.isSocket))); - if (@TypeOf(Dirent.isSymbolicLink) != CallbackType) - @compileLog("Expected Dirent.isSymbolicLink to be a callback but received " ++ @typeName(@TypeOf(Dirent.isSymbolicLink))); - if (@TypeOf(Dirent.getName) != GetterType) - @compileLog("Expected Dirent.getName to be a getter"); - - if (!JSC.is_bindgen) { - @export(Dirent.constructor, .{ .name = "DirentClass__construct" }); - @export(Dirent.finalize, .{ .name = "DirentClass__finalize" }); - @export(Dirent.getName, .{ .name = "DirentPrototype__getName" }); - @export(Dirent.isBlockDevice, .{ .name = "DirentPrototype__isBlockDevice" }); - @export(Dirent.isCharacterDevice, .{ .name = "DirentPrototype__isCharacterDevice" }); - @export(Dirent.isDirectory, .{ .name = "DirentPrototype__isDirectory" }); - @export(Dirent.isFIFO, .{ .name = "DirentPrototype__isFIFO" }); - @export(Dirent.isFile, .{ .name = "DirentPrototype__isFile" }); - @export(Dirent.isSocket, .{ .name = "DirentPrototype__isSocket" }); - @export(Dirent.isSymbolicLink, .{ .name = "DirentPrototype__isSymbolicLink" }); - } - } -}; -pub const JSDocEnd = struct { - const DocEnd = Classes.DocEnd; - const GetterType = fn (*DocEnd, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*DocEnd, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*DocEnd, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*DocEnd, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*DocEnd, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*DocEnd { - JSC.markBinding(@src()); - return DocEnd__fromJS(value); - } - - /// Create a new instance of DocEnd - pub fn toJS(this: *DocEnd, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = DocEnd__create(globalObject, this); - std.debug.assert(value__.as(DocEnd).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return DocEnd__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of DocEnd. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*DocEnd) bool { - JSC.markBinding(@src()); - return DocEnd__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *DocEnd, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(DocEnd__dangerouslySetPtr(value, null)); - } - - extern fn DocEnd__fromJS(JSC.JSValue) ?*DocEnd; - extern fn DocEnd__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn DocEnd__create(globalObject: *JSC.JSGlobalObject, ptr: ?*DocEnd) JSC.JSValue; - - extern fn DocEnd__dangerouslySetPtr(JSC.JSValue, ?*DocEnd) bool; - - comptime { - if (@TypeOf(DocEnd.finalize) != (fn (*DocEnd) callconv(.C) void)) { - @compileLog("DocEnd.finalize is not a finalizer"); - } - - if (@TypeOf(DocEnd.append) != CallbackType) - @compileLog("Expected DocEnd.append to be a callback but received " ++ @typeName(@TypeOf(DocEnd.append))); - if (!JSC.is_bindgen) { - @export(DocEnd.append, .{ .name = "DocEndPrototype__append" }); - @export(DocEnd.finalize, .{ .name = "DocEndClass__finalize" }); - } - } -}; -pub const JSDocType = struct { - const DocType = Classes.DocType; - const GetterType = fn (*DocType, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*DocType, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*DocType, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*DocType, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*DocType, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*DocType { - JSC.markBinding(@src()); - return DocType__fromJS(value); - } - - extern fn DocTypePrototype__nameSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn DocTypePrototype__nameGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `DocType.name` setter - /// This value will be visited by the garbage collector. - pub fn nameSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - DocTypePrototype__nameSetCachedValue(thisValue, globalObject, value); - } - - /// `DocType.name` getter - /// This value will be visited by the garbage collector. - pub fn nameGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = DocTypePrototype__nameGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn DocTypePrototype__publicIdSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn DocTypePrototype__publicIdGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `DocType.publicId` setter - /// This value will be visited by the garbage collector. - pub fn publicIdSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - DocTypePrototype__publicIdSetCachedValue(thisValue, globalObject, value); - } - - /// `DocType.publicId` getter - /// This value will be visited by the garbage collector. - pub fn publicIdGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = DocTypePrototype__publicIdGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn DocTypePrototype__systemIdSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn DocTypePrototype__systemIdGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `DocType.systemId` setter - /// This value will be visited by the garbage collector. - pub fn systemIdSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - DocTypePrototype__systemIdSetCachedValue(thisValue, globalObject, value); - } - - /// `DocType.systemId` getter - /// This value will be visited by the garbage collector. - pub fn systemIdGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = DocTypePrototype__systemIdGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Create a new instance of DocType - pub fn toJS(this: *DocType, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = DocType__create(globalObject, this); - std.debug.assert(value__.as(DocType).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return DocType__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of DocType. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*DocType) bool { - JSC.markBinding(@src()); - return DocType__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *DocType, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(DocType__dangerouslySetPtr(value, null)); - } - - extern fn DocType__fromJS(JSC.JSValue) ?*DocType; - extern fn DocType__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn DocType__create(globalObject: *JSC.JSGlobalObject, ptr: ?*DocType) JSC.JSValue; - - extern fn DocType__dangerouslySetPtr(JSC.JSValue, ?*DocType) bool; - - comptime { - if (@TypeOf(DocType.finalize) != (fn (*DocType) callconv(.C) void)) { - @compileLog("DocType.finalize is not a finalizer"); - } - - if (@TypeOf(DocType.name) != GetterType) - @compileLog("Expected DocType.name to be a getter"); - - if (@TypeOf(DocType.publicId) != GetterType) - @compileLog("Expected DocType.publicId to be a getter"); - - if (@TypeOf(DocType.systemId) != GetterType) - @compileLog("Expected DocType.systemId to be a getter"); - - if (!JSC.is_bindgen) { - @export(DocType.finalize, .{ .name = "DocTypeClass__finalize" }); - @export(DocType.name, .{ .name = "DocTypePrototype__name" }); - @export(DocType.publicId, .{ .name = "DocTypePrototype__publicId" }); - @export(DocType.systemId, .{ .name = "DocTypePrototype__systemId" }); - } - } -}; -pub const JSElement = struct { - const Element = Classes.Element; - const GetterType = fn (*Element, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*Element, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*Element, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*Element, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*Element, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*Element { - JSC.markBinding(@src()); - return Element__fromJS(value); - } - - extern fn ElementPrototype__namespaceURISetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ElementPrototype__namespaceURIGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Element.namespaceURI` setter - /// This value will be visited by the garbage collector. - pub fn namespaceURISetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ElementPrototype__namespaceURISetCachedValue(thisValue, globalObject, value); - } - - /// `Element.namespaceURI` getter - /// This value will be visited by the garbage collector. - pub fn namespaceURIGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ElementPrototype__namespaceURIGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Create a new instance of Element - pub fn toJS(this: *Element, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = Element__create(globalObject, this); - std.debug.assert(value__.as(Element).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return Element__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of Element. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Element) bool { - JSC.markBinding(@src()); - return Element__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *Element, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(Element__dangerouslySetPtr(value, null)); - } - - extern fn Element__fromJS(JSC.JSValue) ?*Element; - extern fn Element__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn Element__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Element) JSC.JSValue; - - extern fn Element__dangerouslySetPtr(JSC.JSValue, ?*Element) bool; - - comptime { - if (@TypeOf(Element.finalize) != (fn (*Element) callconv(.C) void)) { - @compileLog("Element.finalize is not a finalizer"); - } - - if (@TypeOf(Element.after) != CallbackType) - @compileLog("Expected Element.after to be a callback but received " ++ @typeName(@TypeOf(Element.after))); - if (@TypeOf(Element.append) != CallbackType) - @compileLog("Expected Element.append to be a callback but received " ++ @typeName(@TypeOf(Element.append))); - if (@TypeOf(Element.getAttributes) != GetterType) - @compileLog("Expected Element.getAttributes to be a getter"); - - if (@TypeOf(Element.before) != CallbackType) - @compileLog("Expected Element.before to be a callback but received " ++ @typeName(@TypeOf(Element.before))); - if (@TypeOf(Element.getCanHaveContent) != GetterType) - @compileLog("Expected Element.getCanHaveContent to be a getter"); - - if (@TypeOf(Element.getAttribute) != CallbackType) - @compileLog("Expected Element.getAttribute to be a callback but received " ++ @typeName(@TypeOf(Element.getAttribute))); - if (@TypeOf(Element.hasAttribute) != CallbackType) - @compileLog("Expected Element.hasAttribute to be a callback but received " ++ @typeName(@TypeOf(Element.hasAttribute))); - if (@TypeOf(Element.getNamespaceURI) != GetterType) - @compileLog("Expected Element.getNamespaceURI to be a getter"); - - if (@TypeOf(Element.onEndTag) != CallbackType) - @compileLog("Expected Element.onEndTag to be a callback but received " ++ @typeName(@TypeOf(Element.onEndTag))); - if (@TypeOf(Element.prepend) != CallbackType) - @compileLog("Expected Element.prepend to be a callback but received " ++ @typeName(@TypeOf(Element.prepend))); - if (@TypeOf(Element.remove) != CallbackType) - @compileLog("Expected Element.remove to be a callback but received " ++ @typeName(@TypeOf(Element.remove))); - if (@TypeOf(Element.removeAndKeepContent) != CallbackType) - @compileLog("Expected Element.removeAndKeepContent to be a callback but received " ++ @typeName(@TypeOf(Element.removeAndKeepContent))); - if (@TypeOf(Element.removeAttribute) != CallbackType) - @compileLog("Expected Element.removeAttribute to be a callback but received " ++ @typeName(@TypeOf(Element.removeAttribute))); - if (@TypeOf(Element.getRemoved) != GetterType) - @compileLog("Expected Element.getRemoved to be a getter"); - - if (@TypeOf(Element.replace) != CallbackType) - @compileLog("Expected Element.replace to be a callback but received " ++ @typeName(@TypeOf(Element.replace))); - if (@TypeOf(Element.getSelfClosing) != GetterType) - @compileLog("Expected Element.getSelfClosing to be a getter"); - - if (@TypeOf(Element.setAttribute) != CallbackType) - @compileLog("Expected Element.setAttribute to be a callback but received " ++ @typeName(@TypeOf(Element.setAttribute))); - if (@TypeOf(Element.setInnerContent) != CallbackType) - @compileLog("Expected Element.setInnerContent to be a callback but received " ++ @typeName(@TypeOf(Element.setInnerContent))); - if (@TypeOf(Element.getTagName) != GetterType) - @compileLog("Expected Element.getTagName to be a getter"); - - if (@TypeOf(Element.setTagName) != SetterType) - @compileLog("Expected Element.setTagName to be a setter"); - if (!JSC.is_bindgen) { - @export(Element.after, .{ .name = "ElementPrototype__after" }); - @export(Element.append, .{ .name = "ElementPrototype__append" }); - @export(Element.before, .{ .name = "ElementPrototype__before" }); - @export(Element.finalize, .{ .name = "ElementClass__finalize" }); - @export(Element.getAttribute, .{ .name = "ElementPrototype__getAttribute" }); - @export(Element.getAttributes, .{ .name = "ElementPrototype__getAttributes" }); - @export(Element.getCanHaveContent, .{ .name = "ElementPrototype__getCanHaveContent" }); - @export(Element.getNamespaceURI, .{ .name = "ElementPrototype__getNamespaceURI" }); - @export(Element.getRemoved, .{ .name = "ElementPrototype__getRemoved" }); - @export(Element.getSelfClosing, .{ .name = "ElementPrototype__getSelfClosing" }); - @export(Element.getTagName, .{ .name = "ElementPrototype__getTagName" }); - @export(Element.hasAttribute, .{ .name = "ElementPrototype__hasAttribute" }); - @export(Element.onEndTag, .{ .name = "ElementPrototype__onEndTag" }); - @export(Element.prepend, .{ .name = "ElementPrototype__prepend" }); - @export(Element.remove, .{ .name = "ElementPrototype__remove" }); - @export(Element.removeAndKeepContent, .{ .name = "ElementPrototype__removeAndKeepContent" }); - @export(Element.removeAttribute, .{ .name = "ElementPrototype__removeAttribute" }); - @export(Element.replace, .{ .name = "ElementPrototype__replace" }); - @export(Element.setAttribute, .{ .name = "ElementPrototype__setAttribute" }); - @export(Element.setInnerContent, .{ .name = "ElementPrototype__setInnerContent" }); - @export(Element.setTagName, .{ .name = "ElementPrototype__setTagName" }); - } - } -}; -pub const JSEndTag = struct { - const EndTag = Classes.EndTag; - const GetterType = fn (*EndTag, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*EndTag, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*EndTag, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*EndTag, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*EndTag, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*EndTag { - JSC.markBinding(@src()); - return EndTag__fromJS(value); - } - - /// Create a new instance of EndTag - pub fn toJS(this: *EndTag, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = EndTag__create(globalObject, this); - std.debug.assert(value__.as(EndTag).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return EndTag__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of EndTag. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*EndTag) bool { - JSC.markBinding(@src()); - return EndTag__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *EndTag, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(EndTag__dangerouslySetPtr(value, null)); - } - - extern fn EndTag__fromJS(JSC.JSValue) ?*EndTag; - extern fn EndTag__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn EndTag__create(globalObject: *JSC.JSGlobalObject, ptr: ?*EndTag) JSC.JSValue; - - extern fn EndTag__dangerouslySetPtr(JSC.JSValue, ?*EndTag) bool; - - comptime { - if (@TypeOf(EndTag.finalize) != (fn (*EndTag) callconv(.C) void)) { - @compileLog("EndTag.finalize is not a finalizer"); - } - - if (@TypeOf(EndTag.after) != CallbackType) - @compileLog("Expected EndTag.after to be a callback but received " ++ @typeName(@TypeOf(EndTag.after))); - if (@TypeOf(EndTag.before) != CallbackType) - @compileLog("Expected EndTag.before to be a callback but received " ++ @typeName(@TypeOf(EndTag.before))); - if (@TypeOf(EndTag.getName) != GetterType) - @compileLog("Expected EndTag.getName to be a getter"); - - if (@TypeOf(EndTag.setName) != SetterType) - @compileLog("Expected EndTag.setName to be a setter"); - if (@TypeOf(EndTag.remove) != CallbackType) - @compileLog("Expected EndTag.remove to be a callback but received " ++ @typeName(@TypeOf(EndTag.remove))); - if (!JSC.is_bindgen) { - @export(EndTag.after, .{ .name = "EndTagPrototype__after" }); - @export(EndTag.before, .{ .name = "EndTagPrototype__before" }); - @export(EndTag.finalize, .{ .name = "EndTagClass__finalize" }); - @export(EndTag.getName, .{ .name = "EndTagPrototype__getName" }); - @export(EndTag.remove, .{ .name = "EndTagPrototype__remove" }); - @export(EndTag.setName, .{ .name = "EndTagPrototype__setName" }); - } - } -}; -pub const JSExpect = struct { - const Expect = Classes.Expect; - const GetterType = fn (*Expect, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*Expect, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*Expect, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*Expect, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*Expect, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*Expect { - JSC.markBinding(@src()); - return Expect__fromJS(value); - } - - extern fn ExpectPrototype__capturedValueSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ExpectPrototype__capturedValueGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Expect.capturedValue` setter - /// This value will be visited by the garbage collector. - pub fn capturedValueSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ExpectPrototype__capturedValueSetCachedValue(thisValue, globalObject, value); - } - - /// `Expect.capturedValue` getter - /// This value will be visited by the garbage collector. - pub fn capturedValueGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ExpectPrototype__capturedValueGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn ExpectPrototype__resultValueSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ExpectPrototype__resultValueGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Expect.resultValue` setter - /// This value will be visited by the garbage collector. - pub fn resultValueSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ExpectPrototype__resultValueSetCachedValue(thisValue, globalObject, value); - } - - /// `Expect.resultValue` getter - /// This value will be visited by the garbage collector. - pub fn resultValueGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ExpectPrototype__resultValueGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Get the Expect constructor value. - /// This loads lazily from the global object. - pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - return Expect__getConstructor(globalObject); - } - - /// Create a new instance of Expect - pub fn toJS(this: *Expect, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = Expect__create(globalObject, this); - std.debug.assert(value__.as(Expect).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return Expect__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of Expect. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Expect) bool { - JSC.markBinding(@src()); - return Expect__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *Expect, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(Expect__dangerouslySetPtr(value, null)); - } - - extern fn Expect__fromJS(JSC.JSValue) ?*Expect; - extern fn Expect__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn Expect__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Expect) JSC.JSValue; - - extern fn Expect__dangerouslySetPtr(JSC.JSValue, ?*Expect) bool; - - comptime { - if (@TypeOf(Expect.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Expect)) { - @compileLog("Expect.constructor is not a constructor"); - } - - if (@TypeOf(Expect.finalize) != (fn (*Expect) callconv(.C) void)) { - @compileLog("Expect.finalize is not a finalizer"); - } - - if (@TypeOf(Expect.fail) != CallbackType) - @compileLog("Expected Expect.fail to be a callback but received " ++ @typeName(@TypeOf(Expect.fail))); - if (@TypeOf(Expect.getNot) != GetterTypeWithThisValue) - @compileLog("Expected Expect.getNot to be a getter with thisValue"); - if (@TypeOf(Expect._pass) != CallbackType) - @compileLog("Expected Expect._pass to be a callback but received " ++ @typeName(@TypeOf(Expect._pass))); - if (@TypeOf(Expect.getRejects) != GetterTypeWithThisValue) - @compileLog("Expected Expect.getRejects to be a getter with thisValue"); - if (@TypeOf(Expect.getResolves) != GetterTypeWithThisValue) - @compileLog("Expected Expect.getResolves to be a getter with thisValue"); - if (@TypeOf(Expect.toBe) != CallbackType) - @compileLog("Expected Expect.toBe to be a callback but received " ++ @typeName(@TypeOf(Expect.toBe))); - if (@TypeOf(Expect.toBeArray) != CallbackType) - @compileLog("Expected Expect.toBeArray to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeArray))); - if (@TypeOf(Expect.toBeArrayOfSize) != CallbackType) - @compileLog("Expected Expect.toBeArrayOfSize to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeArrayOfSize))); - if (@TypeOf(Expect.toBeBoolean) != CallbackType) - @compileLog("Expected Expect.toBeBoolean to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeBoolean))); - if (@TypeOf(Expect.toBeCloseTo) != CallbackType) - @compileLog("Expected Expect.toBeCloseTo to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeCloseTo))); - if (@TypeOf(Expect.toBeDate) != CallbackType) - @compileLog("Expected Expect.toBeDate to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeDate))); - if (@TypeOf(Expect.toBeDefined) != CallbackType) - @compileLog("Expected Expect.toBeDefined to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeDefined))); - if (@TypeOf(Expect.toBeEmpty) != CallbackType) - @compileLog("Expected Expect.toBeEmpty to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeEmpty))); - if (@TypeOf(Expect.toBeEven) != CallbackType) - @compileLog("Expected Expect.toBeEven to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeEven))); - if (@TypeOf(Expect.toBeFalse) != CallbackType) - @compileLog("Expected Expect.toBeFalse to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeFalse))); - if (@TypeOf(Expect.toBeFalsy) != CallbackType) - @compileLog("Expected Expect.toBeFalsy to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeFalsy))); - if (@TypeOf(Expect.toBeFinite) != CallbackType) - @compileLog("Expected Expect.toBeFinite to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeFinite))); - if (@TypeOf(Expect.toBeFunction) != CallbackType) - @compileLog("Expected Expect.toBeFunction to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeFunction))); - if (@TypeOf(Expect.toBeGreaterThan) != CallbackType) - @compileLog("Expected Expect.toBeGreaterThan to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeGreaterThan))); - if (@TypeOf(Expect.toBeGreaterThanOrEqual) != CallbackType) - @compileLog("Expected Expect.toBeGreaterThanOrEqual to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeGreaterThanOrEqual))); - if (@TypeOf(Expect.toBeInstanceOf) != CallbackType) - @compileLog("Expected Expect.toBeInstanceOf to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeInstanceOf))); - if (@TypeOf(Expect.toBeInteger) != CallbackType) - @compileLog("Expected Expect.toBeInteger to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeInteger))); - if (@TypeOf(Expect.toBeLessThan) != CallbackType) - @compileLog("Expected Expect.toBeLessThan to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeLessThan))); - if (@TypeOf(Expect.toBeLessThanOrEqual) != CallbackType) - @compileLog("Expected Expect.toBeLessThanOrEqual to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeLessThanOrEqual))); - if (@TypeOf(Expect.toBeNaN) != CallbackType) - @compileLog("Expected Expect.toBeNaN to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeNaN))); - if (@TypeOf(Expect.toBeNegative) != CallbackType) - @compileLog("Expected Expect.toBeNegative to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeNegative))); - if (@TypeOf(Expect.toBeNil) != CallbackType) - @compileLog("Expected Expect.toBeNil to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeNil))); - if (@TypeOf(Expect.toBeNull) != CallbackType) - @compileLog("Expected Expect.toBeNull to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeNull))); - if (@TypeOf(Expect.toBeNumber) != CallbackType) - @compileLog("Expected Expect.toBeNumber to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeNumber))); - if (@TypeOf(Expect.toBeOdd) != CallbackType) - @compileLog("Expected Expect.toBeOdd to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeOdd))); - if (@TypeOf(Expect.toBePositive) != CallbackType) - @compileLog("Expected Expect.toBePositive to be a callback but received " ++ @typeName(@TypeOf(Expect.toBePositive))); - if (@TypeOf(Expect.toBeString) != CallbackType) - @compileLog("Expected Expect.toBeString to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeString))); - if (@TypeOf(Expect.toBeSymbol) != CallbackType) - @compileLog("Expected Expect.toBeSymbol to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeSymbol))); - if (@TypeOf(Expect.toBeTrue) != CallbackType) - @compileLog("Expected Expect.toBeTrue to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeTrue))); - if (@TypeOf(Expect.toBeTruthy) != CallbackType) - @compileLog("Expected Expect.toBeTruthy to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeTruthy))); - if (@TypeOf(Expect.toBeTypeOf) != CallbackType) - @compileLog("Expected Expect.toBeTypeOf to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeTypeOf))); - if (@TypeOf(Expect.toBeUndefined) != CallbackType) - @compileLog("Expected Expect.toBeUndefined to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeUndefined))); - if (@TypeOf(Expect.toBeWithin) != CallbackType) - @compileLog("Expected Expect.toBeWithin to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeWithin))); - if (@TypeOf(Expect.toContain) != CallbackType) - @compileLog("Expected Expect.toContain to be a callback but received " ++ @typeName(@TypeOf(Expect.toContain))); - if (@TypeOf(Expect.toContainEqual) != CallbackType) - @compileLog("Expected Expect.toContainEqual to be a callback but received " ++ @typeName(@TypeOf(Expect.toContainEqual))); - if (@TypeOf(Expect.toEndWith) != CallbackType) - @compileLog("Expected Expect.toEndWith to be a callback but received " ++ @typeName(@TypeOf(Expect.toEndWith))); - if (@TypeOf(Expect.toEqual) != CallbackType) - @compileLog("Expected Expect.toEqual to be a callback but received " ++ @typeName(@TypeOf(Expect.toEqual))); - if (@TypeOf(Expect.toEqualIgnoringWhitespace) != CallbackType) - @compileLog("Expected Expect.toEqualIgnoringWhitespace to be a callback but received " ++ @typeName(@TypeOf(Expect.toEqualIgnoringWhitespace))); - if (@TypeOf(Expect.toHaveBeenCalled) != CallbackType) - @compileLog("Expected Expect.toHaveBeenCalled to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveBeenCalled))); - if (@TypeOf(Expect.toHaveBeenCalledTimes) != CallbackType) - @compileLog("Expected Expect.toHaveBeenCalledTimes to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveBeenCalledTimes))); - if (@TypeOf(Expect.toHaveBeenCalledWith) != CallbackType) - @compileLog("Expected Expect.toHaveBeenCalledWith to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveBeenCalledWith))); - if (@TypeOf(Expect.toHaveBeenLastCalledWith) != CallbackType) - @compileLog("Expected Expect.toHaveBeenLastCalledWith to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveBeenLastCalledWith))); - if (@TypeOf(Expect.toHaveBeenNthCalledWith) != CallbackType) - @compileLog("Expected Expect.toHaveBeenNthCalledWith to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveBeenNthCalledWith))); - if (@TypeOf(Expect.toHaveLastReturnedWith) != CallbackType) - @compileLog("Expected Expect.toHaveLastReturnedWith to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveLastReturnedWith))); - if (@TypeOf(Expect.toHaveLength) != CallbackType) - @compileLog("Expected Expect.toHaveLength to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveLength))); - if (@TypeOf(Expect.toHaveNthReturnedWith) != CallbackType) - @compileLog("Expected Expect.toHaveNthReturnedWith to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveNthReturnedWith))); - if (@TypeOf(Expect.toHaveProperty) != CallbackType) - @compileLog("Expected Expect.toHaveProperty to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveProperty))); - if (@TypeOf(Expect.toHaveReturnedTimes) != CallbackType) - @compileLog("Expected Expect.toHaveReturnedTimes to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveReturnedTimes))); - if (@TypeOf(Expect.toHaveReturnedWith) != CallbackType) - @compileLog("Expected Expect.toHaveReturnedWith to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveReturnedWith))); - if (@TypeOf(Expect.toInclude) != CallbackType) - @compileLog("Expected Expect.toInclude to be a callback but received " ++ @typeName(@TypeOf(Expect.toInclude))); - if (@TypeOf(Expect.toIncludeRepeated) != CallbackType) - @compileLog("Expected Expect.toIncludeRepeated to be a callback but received " ++ @typeName(@TypeOf(Expect.toIncludeRepeated))); - if (@TypeOf(Expect.toMatch) != CallbackType) - @compileLog("Expected Expect.toMatch to be a callback but received " ++ @typeName(@TypeOf(Expect.toMatch))); - if (@TypeOf(Expect.toMatchInlineSnapshot) != CallbackType) - @compileLog("Expected Expect.toMatchInlineSnapshot to be a callback but received " ++ @typeName(@TypeOf(Expect.toMatchInlineSnapshot))); - if (@TypeOf(Expect.toMatchObject) != CallbackType) - @compileLog("Expected Expect.toMatchObject to be a callback but received " ++ @typeName(@TypeOf(Expect.toMatchObject))); - if (@TypeOf(Expect.toMatchSnapshot) != CallbackType) - @compileLog("Expected Expect.toMatchSnapshot to be a callback but received " ++ @typeName(@TypeOf(Expect.toMatchSnapshot))); - if (@TypeOf(Expect.toSatisfy) != CallbackType) - @compileLog("Expected Expect.toSatisfy to be a callback but received " ++ @typeName(@TypeOf(Expect.toSatisfy))); - if (@TypeOf(Expect.toStartWith) != CallbackType) - @compileLog("Expected Expect.toStartWith to be a callback but received " ++ @typeName(@TypeOf(Expect.toStartWith))); - if (@TypeOf(Expect.toStrictEqual) != CallbackType) - @compileLog("Expected Expect.toStrictEqual to be a callback but received " ++ @typeName(@TypeOf(Expect.toStrictEqual))); - if (@TypeOf(Expect.toThrow) != CallbackType) - @compileLog("Expected Expect.toThrow to be a callback but received " ++ @typeName(@TypeOf(Expect.toThrow))); - if (@TypeOf(Expect.toThrowErrorMatchingInlineSnapshot) != CallbackType) - @compileLog("Expected Expect.toThrowErrorMatchingInlineSnapshot to be a callback but received " ++ @typeName(@TypeOf(Expect.toThrowErrorMatchingInlineSnapshot))); - if (@TypeOf(Expect.toThrowErrorMatchingSnapshot) != CallbackType) - @compileLog("Expected Expect.toThrowErrorMatchingSnapshot to be a callback but received " ++ @typeName(@TypeOf(Expect.toThrowErrorMatchingSnapshot))); - if (@TypeOf(Expect.addSnapshotSerializer) != StaticCallbackType) - @compileLog("Expected Expect.addSnapshotSerializer to be a static callback"); - if (@TypeOf(Expect.any) != StaticCallbackType) - @compileLog("Expected Expect.any to be a static callback"); - if (@TypeOf(Expect.anything) != StaticCallbackType) - @compileLog("Expected Expect.anything to be a static callback"); - if (@TypeOf(Expect.arrayContaining) != StaticCallbackType) - @compileLog("Expected Expect.arrayContaining to be a static callback"); - if (@TypeOf(Expect.assertions) != StaticCallbackType) - @compileLog("Expected Expect.assertions to be a static callback"); - if (@TypeOf(Expect.extend) != StaticCallbackType) - @compileLog("Expected Expect.extend to be a static callback"); - if (@TypeOf(Expect.hasAssertions) != StaticCallbackType) - @compileLog("Expected Expect.hasAssertions to be a static callback"); - if (@TypeOf(Expect.getStaticNot) != StaticGetterType) - @compileLog("Expected Expect.getStaticNot to be a static getter"); - - if (@TypeOf(Expect.objectContaining) != StaticCallbackType) - @compileLog("Expected Expect.objectContaining to be a static callback"); - if (@TypeOf(Expect.getStaticRejects) != StaticGetterType) - @compileLog("Expected Expect.getStaticRejects to be a static getter"); - - if (@TypeOf(Expect.getStaticResolves) != StaticGetterType) - @compileLog("Expected Expect.getStaticResolves to be a static getter"); - - if (@TypeOf(Expect.stringContaining) != StaticCallbackType) - @compileLog("Expected Expect.stringContaining to be a static callback"); - if (@TypeOf(Expect.stringMatching) != StaticCallbackType) - @compileLog("Expected Expect.stringMatching to be a static callback"); - if (@TypeOf(Expect.call) != StaticCallbackType) - @compileLog("Expected Expect.call to be a static callback"); - if (!JSC.is_bindgen) { - @export(Expect._pass, .{ .name = "ExpectPrototype___pass" }); - @export(Expect.addSnapshotSerializer, .{ .name = "ExpectClass__addSnapshotSerializer" }); - @export(Expect.any, .{ .name = "ExpectClass__any" }); - @export(Expect.anything, .{ .name = "ExpectClass__anything" }); - @export(Expect.arrayContaining, .{ .name = "ExpectClass__arrayContaining" }); - @export(Expect.assertions, .{ .name = "ExpectClass__assertions" }); - @export(Expect.call, .{ .name = "ExpectClass__call" }); - @export(Expect.constructor, .{ .name = "ExpectClass__construct" }); - @export(Expect.extend, .{ .name = "ExpectClass__extend" }); - @export(Expect.fail, .{ .name = "ExpectPrototype__fail" }); - @export(Expect.finalize, .{ .name = "ExpectClass__finalize" }); - @export(Expect.getNot, .{ .name = "ExpectPrototype__getNot" }); - @export(Expect.getRejects, .{ .name = "ExpectPrototype__getRejects" }); - @export(Expect.getResolves, .{ .name = "ExpectPrototype__getResolves" }); - @export(Expect.getStaticNot, .{ .name = "ExpectClass__getStaticNot" }); - @export(Expect.getStaticRejects, .{ .name = "ExpectClass__getStaticRejects" }); - @export(Expect.getStaticResolves, .{ .name = "ExpectClass__getStaticResolves" }); - @export(Expect.hasAssertions, .{ .name = "ExpectClass__hasAssertions" }); - @export(Expect.objectContaining, .{ .name = "ExpectClass__objectContaining" }); - @export(Expect.stringContaining, .{ .name = "ExpectClass__stringContaining" }); - @export(Expect.stringMatching, .{ .name = "ExpectClass__stringMatching" }); - @export(Expect.toBe, .{ .name = "ExpectPrototype__toBe" }); - @export(Expect.toBeArray, .{ .name = "ExpectPrototype__toBeArray" }); - @export(Expect.toBeArrayOfSize, .{ .name = "ExpectPrototype__toBeArrayOfSize" }); - @export(Expect.toBeBoolean, .{ .name = "ExpectPrototype__toBeBoolean" }); - @export(Expect.toBeCloseTo, .{ .name = "ExpectPrototype__toBeCloseTo" }); - @export(Expect.toBeDate, .{ .name = "ExpectPrototype__toBeDate" }); - @export(Expect.toBeDefined, .{ .name = "ExpectPrototype__toBeDefined" }); - @export(Expect.toBeEmpty, .{ .name = "ExpectPrototype__toBeEmpty" }); - @export(Expect.toBeEven, .{ .name = "ExpectPrototype__toBeEven" }); - @export(Expect.toBeFalse, .{ .name = "ExpectPrototype__toBeFalse" }); - @export(Expect.toBeFalsy, .{ .name = "ExpectPrototype__toBeFalsy" }); - @export(Expect.toBeFinite, .{ .name = "ExpectPrototype__toBeFinite" }); - @export(Expect.toBeFunction, .{ .name = "ExpectPrototype__toBeFunction" }); - @export(Expect.toBeGreaterThan, .{ .name = "ExpectPrototype__toBeGreaterThan" }); - @export(Expect.toBeGreaterThanOrEqual, .{ .name = "ExpectPrototype__toBeGreaterThanOrEqual" }); - @export(Expect.toBeInstanceOf, .{ .name = "ExpectPrototype__toBeInstanceOf" }); - @export(Expect.toBeInteger, .{ .name = "ExpectPrototype__toBeInteger" }); - @export(Expect.toBeLessThan, .{ .name = "ExpectPrototype__toBeLessThan" }); - @export(Expect.toBeLessThanOrEqual, .{ .name = "ExpectPrototype__toBeLessThanOrEqual" }); - @export(Expect.toBeNaN, .{ .name = "ExpectPrototype__toBeNaN" }); - @export(Expect.toBeNegative, .{ .name = "ExpectPrototype__toBeNegative" }); - @export(Expect.toBeNil, .{ .name = "ExpectPrototype__toBeNil" }); - @export(Expect.toBeNull, .{ .name = "ExpectPrototype__toBeNull" }); - @export(Expect.toBeNumber, .{ .name = "ExpectPrototype__toBeNumber" }); - @export(Expect.toBeOdd, .{ .name = "ExpectPrototype__toBeOdd" }); - @export(Expect.toBePositive, .{ .name = "ExpectPrototype__toBePositive" }); - @export(Expect.toBeString, .{ .name = "ExpectPrototype__toBeString" }); - @export(Expect.toBeSymbol, .{ .name = "ExpectPrototype__toBeSymbol" }); - @export(Expect.toBeTrue, .{ .name = "ExpectPrototype__toBeTrue" }); - @export(Expect.toBeTruthy, .{ .name = "ExpectPrototype__toBeTruthy" }); - @export(Expect.toBeTypeOf, .{ .name = "ExpectPrototype__toBeTypeOf" }); - @export(Expect.toBeUndefined, .{ .name = "ExpectPrototype__toBeUndefined" }); - @export(Expect.toBeWithin, .{ .name = "ExpectPrototype__toBeWithin" }); - @export(Expect.toContain, .{ .name = "ExpectPrototype__toContain" }); - @export(Expect.toContainEqual, .{ .name = "ExpectPrototype__toContainEqual" }); - @export(Expect.toEndWith, .{ .name = "ExpectPrototype__toEndWith" }); - @export(Expect.toEqual, .{ .name = "ExpectPrototype__toEqual" }); - @export(Expect.toEqualIgnoringWhitespace, .{ .name = "ExpectPrototype__toEqualIgnoringWhitespace" }); - @export(Expect.toHaveBeenCalled, .{ .name = "ExpectPrototype__toHaveBeenCalled" }); - @export(Expect.toHaveBeenCalledTimes, .{ .name = "ExpectPrototype__toHaveBeenCalledTimes" }); - @export(Expect.toHaveBeenCalledWith, .{ .name = "ExpectPrototype__toHaveBeenCalledWith" }); - @export(Expect.toHaveBeenLastCalledWith, .{ .name = "ExpectPrototype__toHaveBeenLastCalledWith" }); - @export(Expect.toHaveBeenNthCalledWith, .{ .name = "ExpectPrototype__toHaveBeenNthCalledWith" }); - @export(Expect.toHaveLastReturnedWith, .{ .name = "ExpectPrototype__toHaveLastReturnedWith" }); - @export(Expect.toHaveLength, .{ .name = "ExpectPrototype__toHaveLength" }); - @export(Expect.toHaveNthReturnedWith, .{ .name = "ExpectPrototype__toHaveNthReturnedWith" }); - @export(Expect.toHaveProperty, .{ .name = "ExpectPrototype__toHaveProperty" }); - @export(Expect.toHaveReturnedTimes, .{ .name = "ExpectPrototype__toHaveReturnedTimes" }); - @export(Expect.toHaveReturnedWith, .{ .name = "ExpectPrototype__toHaveReturnedWith" }); - @export(Expect.toInclude, .{ .name = "ExpectPrototype__toInclude" }); - @export(Expect.toIncludeRepeated, .{ .name = "ExpectPrototype__toIncludeRepeated" }); - @export(Expect.toMatch, .{ .name = "ExpectPrototype__toMatch" }); - @export(Expect.toMatchInlineSnapshot, .{ .name = "ExpectPrototype__toMatchInlineSnapshot" }); - @export(Expect.toMatchObject, .{ .name = "ExpectPrototype__toMatchObject" }); - @export(Expect.toMatchSnapshot, .{ .name = "ExpectPrototype__toMatchSnapshot" }); - @export(Expect.toSatisfy, .{ .name = "ExpectPrototype__toSatisfy" }); - @export(Expect.toStartWith, .{ .name = "ExpectPrototype__toStartWith" }); - @export(Expect.toStrictEqual, .{ .name = "ExpectPrototype__toStrictEqual" }); - @export(Expect.toThrow, .{ .name = "ExpectPrototype__toThrow" }); - @export(Expect.toThrowErrorMatchingInlineSnapshot, .{ .name = "ExpectPrototype__toThrowErrorMatchingInlineSnapshot" }); - @export(Expect.toThrowErrorMatchingSnapshot, .{ .name = "ExpectPrototype__toThrowErrorMatchingSnapshot" }); - } - } -}; -pub const JSExpectAny = struct { - const ExpectAny = Classes.ExpectAny; - const GetterType = fn (*ExpectAny, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*ExpectAny, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*ExpectAny, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*ExpectAny, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*ExpectAny, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*ExpectAny { - JSC.markBinding(@src()); - return ExpectAny__fromJS(value); - } - - extern fn ExpectAnyPrototype__constructorValueSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ExpectAnyPrototype__constructorValueGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `ExpectAny.constructorValue` setter - /// This value will be visited by the garbage collector. - pub fn constructorValueSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ExpectAnyPrototype__constructorValueSetCachedValue(thisValue, globalObject, value); - } - - /// `ExpectAny.constructorValue` getter - /// This value will be visited by the garbage collector. - pub fn constructorValueGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ExpectAnyPrototype__constructorValueGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Create a new instance of ExpectAny - pub fn toJS(this: *ExpectAny, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = ExpectAny__create(globalObject, this); - std.debug.assert(value__.as(ExpectAny).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return ExpectAny__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of ExpectAny. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*ExpectAny) bool { - JSC.markBinding(@src()); - return ExpectAny__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *ExpectAny, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(ExpectAny__dangerouslySetPtr(value, null)); - } - - extern fn ExpectAny__fromJS(JSC.JSValue) ?*ExpectAny; - extern fn ExpectAny__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn ExpectAny__create(globalObject: *JSC.JSGlobalObject, ptr: ?*ExpectAny) JSC.JSValue; - - extern fn ExpectAny__dangerouslySetPtr(JSC.JSValue, ?*ExpectAny) bool; - - comptime { - if (@TypeOf(ExpectAny.finalize) != (fn (*ExpectAny) callconv(.C) void)) { - @compileLog("ExpectAny.finalize is not a finalizer"); - } - - if (@TypeOf(ExpectAny.call) != StaticCallbackType) - @compileLog("Expected ExpectAny.call to be a static callback"); - if (!JSC.is_bindgen) { - @export(ExpectAny.call, .{ .name = "ExpectAnyClass__call" }); - @export(ExpectAny.finalize, .{ .name = "ExpectAnyClass__finalize" }); - } - } -}; -pub const JSExpectAnything = struct { - const ExpectAnything = Classes.ExpectAnything; - const GetterType = fn (*ExpectAnything, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*ExpectAnything, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*ExpectAnything, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*ExpectAnything, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*ExpectAnything, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*ExpectAnything { - JSC.markBinding(@src()); - return ExpectAnything__fromJS(value); - } - - /// Create a new instance of ExpectAnything - pub fn toJS(this: *ExpectAnything, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = ExpectAnything__create(globalObject, this); - std.debug.assert(value__.as(ExpectAnything).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return ExpectAnything__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of ExpectAnything. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*ExpectAnything) bool { - JSC.markBinding(@src()); - return ExpectAnything__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *ExpectAnything, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(ExpectAnything__dangerouslySetPtr(value, null)); - } - - extern fn ExpectAnything__fromJS(JSC.JSValue) ?*ExpectAnything; - extern fn ExpectAnything__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn ExpectAnything__create(globalObject: *JSC.JSGlobalObject, ptr: ?*ExpectAnything) JSC.JSValue; - - extern fn ExpectAnything__dangerouslySetPtr(JSC.JSValue, ?*ExpectAnything) bool; - - comptime { - if (@TypeOf(ExpectAnything.finalize) != (fn (*ExpectAnything) callconv(.C) void)) { - @compileLog("ExpectAnything.finalize is not a finalizer"); - } - - if (@TypeOf(ExpectAnything.call) != StaticCallbackType) - @compileLog("Expected ExpectAnything.call to be a static callback"); - if (!JSC.is_bindgen) { - @export(ExpectAnything.call, .{ .name = "ExpectAnythingClass__call" }); - @export(ExpectAnything.finalize, .{ .name = "ExpectAnythingClass__finalize" }); - } - } -}; -pub const JSExpectArrayContaining = struct { - const ExpectArrayContaining = Classes.ExpectArrayContaining; - const GetterType = fn (*ExpectArrayContaining, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*ExpectArrayContaining, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*ExpectArrayContaining, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*ExpectArrayContaining, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*ExpectArrayContaining, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*ExpectArrayContaining { - JSC.markBinding(@src()); - return ExpectArrayContaining__fromJS(value); - } - - extern fn ExpectArrayContainingPrototype__arrayValueSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ExpectArrayContainingPrototype__arrayValueGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `ExpectArrayContaining.arrayValue` setter - /// This value will be visited by the garbage collector. - pub fn arrayValueSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ExpectArrayContainingPrototype__arrayValueSetCachedValue(thisValue, globalObject, value); - } - - /// `ExpectArrayContaining.arrayValue` getter - /// This value will be visited by the garbage collector. - pub fn arrayValueGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ExpectArrayContainingPrototype__arrayValueGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Create a new instance of ExpectArrayContaining - pub fn toJS(this: *ExpectArrayContaining, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = ExpectArrayContaining__create(globalObject, this); - std.debug.assert(value__.as(ExpectArrayContaining).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return ExpectArrayContaining__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of ExpectArrayContaining. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*ExpectArrayContaining) bool { - JSC.markBinding(@src()); - return ExpectArrayContaining__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *ExpectArrayContaining, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(ExpectArrayContaining__dangerouslySetPtr(value, null)); - } - - extern fn ExpectArrayContaining__fromJS(JSC.JSValue) ?*ExpectArrayContaining; - extern fn ExpectArrayContaining__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn ExpectArrayContaining__create(globalObject: *JSC.JSGlobalObject, ptr: ?*ExpectArrayContaining) JSC.JSValue; - - extern fn ExpectArrayContaining__dangerouslySetPtr(JSC.JSValue, ?*ExpectArrayContaining) bool; - - comptime { - if (@TypeOf(ExpectArrayContaining.finalize) != (fn (*ExpectArrayContaining) callconv(.C) void)) { - @compileLog("ExpectArrayContaining.finalize is not a finalizer"); - } - - if (@TypeOf(ExpectArrayContaining.call) != StaticCallbackType) - @compileLog("Expected ExpectArrayContaining.call to be a static callback"); - if (!JSC.is_bindgen) { - @export(ExpectArrayContaining.call, .{ .name = "ExpectArrayContainingClass__call" }); - @export(ExpectArrayContaining.finalize, .{ .name = "ExpectArrayContainingClass__finalize" }); - } - } -}; -pub const JSExpectStringContaining = struct { - const ExpectStringContaining = Classes.ExpectStringContaining; - const GetterType = fn (*ExpectStringContaining, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*ExpectStringContaining, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*ExpectStringContaining, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*ExpectStringContaining, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*ExpectStringContaining, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*ExpectStringContaining { - JSC.markBinding(@src()); - return ExpectStringContaining__fromJS(value); - } - - extern fn ExpectStringContainingPrototype__stringValueSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ExpectStringContainingPrototype__stringValueGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `ExpectStringContaining.stringValue` setter - /// This value will be visited by the garbage collector. - pub fn stringValueSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ExpectStringContainingPrototype__stringValueSetCachedValue(thisValue, globalObject, value); - } - - /// `ExpectStringContaining.stringValue` getter - /// This value will be visited by the garbage collector. - pub fn stringValueGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ExpectStringContainingPrototype__stringValueGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Create a new instance of ExpectStringContaining - pub fn toJS(this: *ExpectStringContaining, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = ExpectStringContaining__create(globalObject, this); - std.debug.assert(value__.as(ExpectStringContaining).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return ExpectStringContaining__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of ExpectStringContaining. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*ExpectStringContaining) bool { - JSC.markBinding(@src()); - return ExpectStringContaining__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *ExpectStringContaining, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(ExpectStringContaining__dangerouslySetPtr(value, null)); - } - - extern fn ExpectStringContaining__fromJS(JSC.JSValue) ?*ExpectStringContaining; - extern fn ExpectStringContaining__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn ExpectStringContaining__create(globalObject: *JSC.JSGlobalObject, ptr: ?*ExpectStringContaining) JSC.JSValue; - - extern fn ExpectStringContaining__dangerouslySetPtr(JSC.JSValue, ?*ExpectStringContaining) bool; - - comptime { - if (@TypeOf(ExpectStringContaining.finalize) != (fn (*ExpectStringContaining) callconv(.C) void)) { - @compileLog("ExpectStringContaining.finalize is not a finalizer"); - } - - if (@TypeOf(ExpectStringContaining.call) != StaticCallbackType) - @compileLog("Expected ExpectStringContaining.call to be a static callback"); - if (!JSC.is_bindgen) { - @export(ExpectStringContaining.call, .{ .name = "ExpectStringContainingClass__call" }); - @export(ExpectStringContaining.finalize, .{ .name = "ExpectStringContainingClass__finalize" }); - } - } -}; -pub const JSExpectStringMatching = struct { - const ExpectStringMatching = Classes.ExpectStringMatching; - const GetterType = fn (*ExpectStringMatching, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*ExpectStringMatching, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*ExpectStringMatching, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*ExpectStringMatching, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*ExpectStringMatching, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*ExpectStringMatching { - JSC.markBinding(@src()); - return ExpectStringMatching__fromJS(value); - } - - extern fn ExpectStringMatchingPrototype__testValueSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ExpectStringMatchingPrototype__testValueGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `ExpectStringMatching.testValue` setter - /// This value will be visited by the garbage collector. - pub fn testValueSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ExpectStringMatchingPrototype__testValueSetCachedValue(thisValue, globalObject, value); - } - - /// `ExpectStringMatching.testValue` getter - /// This value will be visited by the garbage collector. - pub fn testValueGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ExpectStringMatchingPrototype__testValueGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Create a new instance of ExpectStringMatching - pub fn toJS(this: *ExpectStringMatching, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = ExpectStringMatching__create(globalObject, this); - std.debug.assert(value__.as(ExpectStringMatching).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return ExpectStringMatching__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of ExpectStringMatching. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*ExpectStringMatching) bool { - JSC.markBinding(@src()); - return ExpectStringMatching__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *ExpectStringMatching, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(ExpectStringMatching__dangerouslySetPtr(value, null)); - } - - extern fn ExpectStringMatching__fromJS(JSC.JSValue) ?*ExpectStringMatching; - extern fn ExpectStringMatching__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn ExpectStringMatching__create(globalObject: *JSC.JSGlobalObject, ptr: ?*ExpectStringMatching) JSC.JSValue; - - extern fn ExpectStringMatching__dangerouslySetPtr(JSC.JSValue, ?*ExpectStringMatching) bool; - - comptime { - if (@TypeOf(ExpectStringMatching.finalize) != (fn (*ExpectStringMatching) callconv(.C) void)) { - @compileLog("ExpectStringMatching.finalize is not a finalizer"); - } - - if (@TypeOf(ExpectStringMatching.call) != StaticCallbackType) - @compileLog("Expected ExpectStringMatching.call to be a static callback"); - if (!JSC.is_bindgen) { - @export(ExpectStringMatching.call, .{ .name = "ExpectStringMatchingClass__call" }); - @export(ExpectStringMatching.finalize, .{ .name = "ExpectStringMatchingClass__finalize" }); - } - } -}; -pub const JSFFI = struct { - const FFI = Classes.FFI; - const GetterType = fn (*FFI, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*FFI, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*FFI, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*FFI, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*FFI, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*FFI { - JSC.markBinding(@src()); - return FFI__fromJS(value); - } - - extern fn FFIPrototype__symbolsValueSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn FFIPrototype__symbolsValueGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `FFI.symbolsValue` setter - /// This value will be visited by the garbage collector. - pub fn symbolsValueSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - FFIPrototype__symbolsValueSetCachedValue(thisValue, globalObject, value); - } - - /// `FFI.symbolsValue` getter - /// This value will be visited by the garbage collector. - pub fn symbolsValueGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = FFIPrototype__symbolsValueGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Create a new instance of FFI - pub fn toJS(this: *FFI, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = FFI__create(globalObject, this); - std.debug.assert(value__.as(FFI).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return FFI__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of FFI. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*FFI) bool { - JSC.markBinding(@src()); - return FFI__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *FFI, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(FFI__dangerouslySetPtr(value, null)); - } - - extern fn FFI__fromJS(JSC.JSValue) ?*FFI; - extern fn FFI__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn FFI__create(globalObject: *JSC.JSGlobalObject, ptr: ?*FFI) JSC.JSValue; - - extern fn FFI__dangerouslySetPtr(JSC.JSValue, ?*FFI) bool; - - comptime { - if (@TypeOf(FFI.finalize) != (fn (*FFI) callconv(.C) void)) { - @compileLog("FFI.finalize is not a finalizer"); - } - - if (@TypeOf(FFI.close) != CallbackType) - @compileLog("Expected FFI.close to be a callback but received " ++ @typeName(@TypeOf(FFI.close))); - if (@TypeOf(FFI.getSymbols) != GetterType) - @compileLog("Expected FFI.getSymbols to be a getter"); - - if (!JSC.is_bindgen) { - @export(FFI.close, .{ .name = "FFIPrototype__close" }); - @export(FFI.finalize, .{ .name = "FFIClass__finalize" }); - @export(FFI.getSymbols, .{ .name = "FFIPrototype__getSymbols" }); - } - } -}; -pub const JSFSWatcher = struct { - const FSWatcher = Classes.FSWatcher; - const GetterType = fn (*FSWatcher, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*FSWatcher, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*FSWatcher, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*FSWatcher, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*FSWatcher, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*FSWatcher { - JSC.markBinding(@src()); - return FSWatcher__fromJS(value); - } - - extern fn FSWatcherPrototype__listenerSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn FSWatcherPrototype__listenerGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `FSWatcher.listener` setter - /// This value will be visited by the garbage collector. - pub fn listenerSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - FSWatcherPrototype__listenerSetCachedValue(thisValue, globalObject, value); - } - - /// `FSWatcher.listener` getter - /// This value will be visited by the garbage collector. - pub fn listenerGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = FSWatcherPrototype__listenerGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Create a new instance of FSWatcher - pub fn toJS(this: *FSWatcher, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = FSWatcher__create(globalObject, this); - std.debug.assert(value__.as(FSWatcher).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return FSWatcher__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of FSWatcher. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*FSWatcher) bool { - JSC.markBinding(@src()); - return FSWatcher__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *FSWatcher, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(FSWatcher__dangerouslySetPtr(value, null)); - } - - extern fn FSWatcher__fromJS(JSC.JSValue) ?*FSWatcher; - extern fn FSWatcher__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn FSWatcher__create(globalObject: *JSC.JSGlobalObject, ptr: ?*FSWatcher) JSC.JSValue; - - extern fn FSWatcher__dangerouslySetPtr(JSC.JSValue, ?*FSWatcher) bool; - - comptime { - if (@TypeOf(FSWatcher.finalize) != (fn (*FSWatcher) callconv(.C) void)) { - @compileLog("FSWatcher.finalize is not a finalizer"); - } - - if (@TypeOf(FSWatcher.doClose) != CallbackType) - @compileLog("Expected FSWatcher.doClose to be a callback but received " ++ @typeName(@TypeOf(FSWatcher.doClose))); - if (@TypeOf(FSWatcher.hasRef) != CallbackType) - @compileLog("Expected FSWatcher.hasRef to be a callback but received " ++ @typeName(@TypeOf(FSWatcher.hasRef))); - if (@TypeOf(FSWatcher.doRef) != CallbackType) - @compileLog("Expected FSWatcher.doRef to be a callback but received " ++ @typeName(@TypeOf(FSWatcher.doRef))); - if (@TypeOf(FSWatcher.doUnref) != CallbackType) - @compileLog("Expected FSWatcher.doUnref to be a callback but received " ++ @typeName(@TypeOf(FSWatcher.doUnref))); - if (!JSC.is_bindgen) { - @export(FSWatcher.doClose, .{ .name = "FSWatcherPrototype__doClose" }); - @export(FSWatcher.doRef, .{ .name = "FSWatcherPrototype__doRef" }); - @export(FSWatcher.doUnref, .{ .name = "FSWatcherPrototype__doUnref" }); - @export(FSWatcher.finalize, .{ .name = "FSWatcherClass__finalize" }); - @export(FSWatcher.hasPendingActivity, .{ .name = "FSWatcher__hasPendingActivity" }); - @export(FSWatcher.hasRef, .{ .name = "FSWatcherPrototype__hasRef" }); - } - } -}; -pub const JSFileSystemRouter = struct { - const FileSystemRouter = Classes.FileSystemRouter; - const GetterType = fn (*FileSystemRouter, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*FileSystemRouter, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*FileSystemRouter, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*FileSystemRouter, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*FileSystemRouter, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*FileSystemRouter { - JSC.markBinding(@src()); - return FileSystemRouter__fromJS(value); - } - - extern fn FileSystemRouterPrototype__originSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn FileSystemRouterPrototype__originGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `FileSystemRouter.origin` setter - /// This value will be visited by the garbage collector. - pub fn originSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - FileSystemRouterPrototype__originSetCachedValue(thisValue, globalObject, value); - } - - /// `FileSystemRouter.origin` getter - /// This value will be visited by the garbage collector. - pub fn originGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = FileSystemRouterPrototype__originGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn FileSystemRouterPrototype__routesSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn FileSystemRouterPrototype__routesGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `FileSystemRouter.routes` setter - /// This value will be visited by the garbage collector. - pub fn routesSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - FileSystemRouterPrototype__routesSetCachedValue(thisValue, globalObject, value); - } - - /// `FileSystemRouter.routes` getter - /// This value will be visited by the garbage collector. - pub fn routesGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = FileSystemRouterPrototype__routesGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn FileSystemRouterPrototype__styleSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn FileSystemRouterPrototype__styleGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `FileSystemRouter.style` setter - /// This value will be visited by the garbage collector. - pub fn styleSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - FileSystemRouterPrototype__styleSetCachedValue(thisValue, globalObject, value); - } - - /// `FileSystemRouter.style` getter - /// This value will be visited by the garbage collector. - pub fn styleGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = FileSystemRouterPrototype__styleGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Get the FileSystemRouter constructor value. - /// This loads lazily from the global object. - pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - return FileSystemRouter__getConstructor(globalObject); - } - - /// Create a new instance of FileSystemRouter - pub fn toJS(this: *FileSystemRouter, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = FileSystemRouter__create(globalObject, this); - std.debug.assert(value__.as(FileSystemRouter).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return FileSystemRouter__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of FileSystemRouter. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*FileSystemRouter) bool { - JSC.markBinding(@src()); - return FileSystemRouter__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *FileSystemRouter, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(FileSystemRouter__dangerouslySetPtr(value, null)); - } - - extern fn FileSystemRouter__fromJS(JSC.JSValue) ?*FileSystemRouter; - extern fn FileSystemRouter__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn FileSystemRouter__create(globalObject: *JSC.JSGlobalObject, ptr: ?*FileSystemRouter) JSC.JSValue; - - extern fn FileSystemRouter__dangerouslySetPtr(JSC.JSValue, ?*FileSystemRouter) bool; - - comptime { - if (@TypeOf(FileSystemRouter.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*FileSystemRouter)) { - @compileLog("FileSystemRouter.constructor is not a constructor"); - } - - if (@TypeOf(FileSystemRouter.finalize) != (fn (*FileSystemRouter) callconv(.C) void)) { - @compileLog("FileSystemRouter.finalize is not a finalizer"); - } - - if (@TypeOf(FileSystemRouter.match) != CallbackType) - @compileLog("Expected FileSystemRouter.match to be a callback but received " ++ @typeName(@TypeOf(FileSystemRouter.match))); - if (@TypeOf(FileSystemRouter.getOrigin) != GetterType) - @compileLog("Expected FileSystemRouter.getOrigin to be a getter"); - - if (@TypeOf(FileSystemRouter.reload) != CallbackType) - @compileLog("Expected FileSystemRouter.reload to be a callback but received " ++ @typeName(@TypeOf(FileSystemRouter.reload))); - if (@TypeOf(FileSystemRouter.getRoutes) != GetterType) - @compileLog("Expected FileSystemRouter.getRoutes to be a getter"); - - if (@TypeOf(FileSystemRouter.getStyle) != GetterType) - @compileLog("Expected FileSystemRouter.getStyle to be a getter"); - - if (!JSC.is_bindgen) { - @export(FileSystemRouter.constructor, .{ .name = "FileSystemRouterClass__construct" }); - @export(FileSystemRouter.finalize, .{ .name = "FileSystemRouterClass__finalize" }); - @export(FileSystemRouter.getOrigin, .{ .name = "FileSystemRouterPrototype__getOrigin" }); - @export(FileSystemRouter.getRoutes, .{ .name = "FileSystemRouterPrototype__getRoutes" }); - @export(FileSystemRouter.getStyle, .{ .name = "FileSystemRouterPrototype__getStyle" }); - @export(FileSystemRouter.match, .{ .name = "FileSystemRouterPrototype__match" }); - @export(FileSystemRouter.reload, .{ .name = "FileSystemRouterPrototype__reload" }); - } - } -}; -pub const JSHTMLRewriter = struct { - const HTMLRewriter = Classes.HTMLRewriter; - const GetterType = fn (*HTMLRewriter, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*HTMLRewriter, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*HTMLRewriter, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*HTMLRewriter, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*HTMLRewriter, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*HTMLRewriter { - JSC.markBinding(@src()); - return HTMLRewriter__fromJS(value); - } - - /// Get the HTMLRewriter constructor value. - /// This loads lazily from the global object. - pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - return HTMLRewriter__getConstructor(globalObject); - } - - /// Create a new instance of HTMLRewriter - pub fn toJS(this: *HTMLRewriter, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = HTMLRewriter__create(globalObject, this); - std.debug.assert(value__.as(HTMLRewriter).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return HTMLRewriter__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of HTMLRewriter. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*HTMLRewriter) bool { - JSC.markBinding(@src()); - return HTMLRewriter__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *HTMLRewriter, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(HTMLRewriter__dangerouslySetPtr(value, null)); - } - - extern fn HTMLRewriter__fromJS(JSC.JSValue) ?*HTMLRewriter; - extern fn HTMLRewriter__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn HTMLRewriter__create(globalObject: *JSC.JSGlobalObject, ptr: ?*HTMLRewriter) JSC.JSValue; - - extern fn HTMLRewriter__dangerouslySetPtr(JSC.JSValue, ?*HTMLRewriter) bool; - - comptime { - if (@TypeOf(HTMLRewriter.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*HTMLRewriter)) { - @compileLog("HTMLRewriter.constructor is not a constructor"); - } - - if (@TypeOf(HTMLRewriter.finalize) != (fn (*HTMLRewriter) callconv(.C) void)) { - @compileLog("HTMLRewriter.finalize is not a finalizer"); - } - - if (@TypeOf(HTMLRewriter.on) != CallbackType) - @compileLog("Expected HTMLRewriter.on to be a callback but received " ++ @typeName(@TypeOf(HTMLRewriter.on))); - if (@TypeOf(HTMLRewriter.onDocument) != CallbackType) - @compileLog("Expected HTMLRewriter.onDocument to be a callback but received " ++ @typeName(@TypeOf(HTMLRewriter.onDocument))); - if (@TypeOf(HTMLRewriter.transform) != CallbackType) - @compileLog("Expected HTMLRewriter.transform to be a callback but received " ++ @typeName(@TypeOf(HTMLRewriter.transform))); - if (!JSC.is_bindgen) { - @export(HTMLRewriter.constructor, .{ .name = "HTMLRewriterClass__construct" }); - @export(HTMLRewriter.finalize, .{ .name = "HTMLRewriterClass__finalize" }); - @export(HTMLRewriter.on, .{ .name = "HTMLRewriterPrototype__on" }); - @export(HTMLRewriter.onDocument, .{ .name = "HTMLRewriterPrototype__onDocument" }); - @export(HTMLRewriter.transform, .{ .name = "HTMLRewriterPrototype__transform" }); - } - } -}; -pub const JSHTTPSServer = struct { - const HTTPSServer = Classes.HTTPSServer; - const GetterType = fn (*HTTPSServer, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*HTTPSServer, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*HTTPSServer, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*HTTPSServer, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*HTTPSServer, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*HTTPSServer { - JSC.markBinding(@src()); - return HTTPSServer__fromJS(value); - } - - extern fn HTTPSServerPrototype__addressSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn HTTPSServerPrototype__addressGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `HTTPSServer.address` setter - /// This value will be visited by the garbage collector. - pub fn addressSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - HTTPSServerPrototype__addressSetCachedValue(thisValue, globalObject, value); - } - - /// `HTTPSServer.address` getter - /// This value will be visited by the garbage collector. - pub fn addressGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = HTTPSServerPrototype__addressGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn HTTPSServerPrototype__hostnameSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn HTTPSServerPrototype__hostnameGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `HTTPSServer.hostname` setter - /// This value will be visited by the garbage collector. - pub fn hostnameSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - HTTPSServerPrototype__hostnameSetCachedValue(thisValue, globalObject, value); - } - - /// `HTTPSServer.hostname` getter - /// This value will be visited by the garbage collector. - pub fn hostnameGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = HTTPSServerPrototype__hostnameGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn HTTPSServerPrototype__idSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn HTTPSServerPrototype__idGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `HTTPSServer.id` setter - /// This value will be visited by the garbage collector. - pub fn idSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - HTTPSServerPrototype__idSetCachedValue(thisValue, globalObject, value); - } - - /// `HTTPSServer.id` getter - /// This value will be visited by the garbage collector. - pub fn idGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = HTTPSServerPrototype__idGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Create a new instance of HTTPSServer - pub fn toJS(this: *HTTPSServer, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = HTTPSServer__create(globalObject, this); - std.debug.assert(value__.as(HTTPSServer).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return HTTPSServer__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of HTTPSServer. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*HTTPSServer) bool { - JSC.markBinding(@src()); - return HTTPSServer__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *HTTPSServer, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(HTTPSServer__dangerouslySetPtr(value, null)); - } - - extern fn HTTPSServer__fromJS(JSC.JSValue) ?*HTTPSServer; - extern fn HTTPSServer__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn HTTPSServer__create(globalObject: *JSC.JSGlobalObject, ptr: ?*HTTPSServer) JSC.JSValue; - - extern fn HTTPSServer__dangerouslySetPtr(JSC.JSValue, ?*HTTPSServer) bool; - - comptime { - if (@TypeOf(HTTPSServer.finalize) != (fn (*HTTPSServer) callconv(.C) void)) { - @compileLog("HTTPSServer.finalize is not a finalizer"); - } - - if (@TypeOf(HTTPSServer.getAddress) != GetterType) - @compileLog("Expected HTTPSServer.getAddress to be a getter"); - - if (@TypeOf(HTTPSServer.getDevelopment) != GetterType) - @compileLog("Expected HTTPSServer.getDevelopment to be a getter"); - - if (@TypeOf(HTTPSServer.doFetch) != CallbackType) - @compileLog("Expected HTTPSServer.doFetch to be a callback but received " ++ @typeName(@TypeOf(HTTPSServer.doFetch))); - if (@TypeOf(HTTPSServer.getHostname) != GetterType) - @compileLog("Expected HTTPSServer.getHostname to be a getter"); - - if (@TypeOf(HTTPSServer.getId) != GetterType) - @compileLog("Expected HTTPSServer.getId to be a getter"); - - if (@TypeOf(HTTPSServer.getPendingRequests) != GetterType) - @compileLog("Expected HTTPSServer.getPendingRequests to be a getter"); - - if (@TypeOf(HTTPSServer.getPendingWebSockets) != GetterType) - @compileLog("Expected HTTPSServer.getPendingWebSockets to be a getter"); - - if (@TypeOf(HTTPSServer.getPort) != GetterType) - @compileLog("Expected HTTPSServer.getPort to be a getter"); - - if (@TypeOf(HTTPSServer.getProtocol) != GetterType) - @compileLog("Expected HTTPSServer.getProtocol to be a getter"); - - if (@TypeOf(HTTPSServer.doPublish) != CallbackType) - @compileLog("Expected HTTPSServer.doPublish to be a callback but received " ++ @typeName(@TypeOf(HTTPSServer.doPublish))); - if (@TypeOf(HTTPSServer.doReload) != CallbackType) - @compileLog("Expected HTTPSServer.doReload to be a callback but received " ++ @typeName(@TypeOf(HTTPSServer.doReload))); - if (@TypeOf(HTTPSServer.doRequestIP) != CallbackType) - @compileLog("Expected HTTPSServer.doRequestIP to be a callback but received " ++ @typeName(@TypeOf(HTTPSServer.doRequestIP))); - if (@TypeOf(HTTPSServer.doStop) != CallbackType) - @compileLog("Expected HTTPSServer.doStop to be a callback but received " ++ @typeName(@TypeOf(HTTPSServer.doStop))); - if (@TypeOf(HTTPSServer.doUpgrade) != CallbackType) - @compileLog("Expected HTTPSServer.doUpgrade to be a callback but received " ++ @typeName(@TypeOf(HTTPSServer.doUpgrade))); - if (!JSC.is_bindgen) { - @export(HTTPSServer.doFetch, .{ .name = "HTTPSServerPrototype__doFetch" }); - @export(HTTPSServer.doPublish, .{ .name = "HTTPSServerPrototype__doPublish" }); - @export(HTTPSServer.doReload, .{ .name = "HTTPSServerPrototype__doReload" }); - @export(HTTPSServer.doRequestIP, .{ .name = "HTTPSServerPrototype__doRequestIP" }); - @export(HTTPSServer.doStop, .{ .name = "HTTPSServerPrototype__doStop" }); - @export(HTTPSServer.doUpgrade, .{ .name = "HTTPSServerPrototype__doUpgrade" }); - @export(HTTPSServer.finalize, .{ .name = "HTTPSServerClass__finalize" }); - @export(HTTPSServer.getAddress, .{ .name = "HTTPSServerPrototype__getAddress" }); - @export(HTTPSServer.getDevelopment, .{ .name = "HTTPSServerPrototype__getDevelopment" }); - @export(HTTPSServer.getHostname, .{ .name = "HTTPSServerPrototype__getHostname" }); - @export(HTTPSServer.getId, .{ .name = "HTTPSServerPrototype__getId" }); - @export(HTTPSServer.getPendingRequests, .{ .name = "HTTPSServerPrototype__getPendingRequests" }); - @export(HTTPSServer.getPendingWebSockets, .{ .name = "HTTPSServerPrototype__getPendingWebSockets" }); - @export(HTTPSServer.getPort, .{ .name = "HTTPSServerPrototype__getPort" }); - @export(HTTPSServer.getProtocol, .{ .name = "HTTPSServerPrototype__getProtocol" }); - } - } -}; -pub const JSHTTPServer = struct { - const HTTPServer = Classes.HTTPServer; - const GetterType = fn (*HTTPServer, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*HTTPServer, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*HTTPServer, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*HTTPServer, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*HTTPServer, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*HTTPServer { - JSC.markBinding(@src()); - return HTTPServer__fromJS(value); - } - - extern fn HTTPServerPrototype__addressSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn HTTPServerPrototype__addressGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `HTTPServer.address` setter - /// This value will be visited by the garbage collector. - pub fn addressSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - HTTPServerPrototype__addressSetCachedValue(thisValue, globalObject, value); - } - - /// `HTTPServer.address` getter - /// This value will be visited by the garbage collector. - pub fn addressGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = HTTPServerPrototype__addressGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn HTTPServerPrototype__hostnameSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn HTTPServerPrototype__hostnameGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `HTTPServer.hostname` setter - /// This value will be visited by the garbage collector. - pub fn hostnameSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - HTTPServerPrototype__hostnameSetCachedValue(thisValue, globalObject, value); - } - - /// `HTTPServer.hostname` getter - /// This value will be visited by the garbage collector. - pub fn hostnameGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = HTTPServerPrototype__hostnameGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn HTTPServerPrototype__idSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn HTTPServerPrototype__idGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `HTTPServer.id` setter - /// This value will be visited by the garbage collector. - pub fn idSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - HTTPServerPrototype__idSetCachedValue(thisValue, globalObject, value); - } - - /// `HTTPServer.id` getter - /// This value will be visited by the garbage collector. - pub fn idGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = HTTPServerPrototype__idGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Create a new instance of HTTPServer - pub fn toJS(this: *HTTPServer, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = HTTPServer__create(globalObject, this); - std.debug.assert(value__.as(HTTPServer).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return HTTPServer__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of HTTPServer. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*HTTPServer) bool { - JSC.markBinding(@src()); - return HTTPServer__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *HTTPServer, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(HTTPServer__dangerouslySetPtr(value, null)); - } - - extern fn HTTPServer__fromJS(JSC.JSValue) ?*HTTPServer; - extern fn HTTPServer__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn HTTPServer__create(globalObject: *JSC.JSGlobalObject, ptr: ?*HTTPServer) JSC.JSValue; - - extern fn HTTPServer__dangerouslySetPtr(JSC.JSValue, ?*HTTPServer) bool; - - comptime { - if (@TypeOf(HTTPServer.finalize) != (fn (*HTTPServer) callconv(.C) void)) { - @compileLog("HTTPServer.finalize is not a finalizer"); - } - - if (@TypeOf(HTTPServer.getAddress) != GetterType) - @compileLog("Expected HTTPServer.getAddress to be a getter"); - - if (@TypeOf(HTTPServer.getDevelopment) != GetterType) - @compileLog("Expected HTTPServer.getDevelopment to be a getter"); - - if (@TypeOf(HTTPServer.doFetch) != CallbackType) - @compileLog("Expected HTTPServer.doFetch to be a callback but received " ++ @typeName(@TypeOf(HTTPServer.doFetch))); - if (@TypeOf(HTTPServer.getHostname) != GetterType) - @compileLog("Expected HTTPServer.getHostname to be a getter"); - - if (@TypeOf(HTTPServer.getId) != GetterType) - @compileLog("Expected HTTPServer.getId to be a getter"); - - if (@TypeOf(HTTPServer.getPendingRequests) != GetterType) - @compileLog("Expected HTTPServer.getPendingRequests to be a getter"); - - if (@TypeOf(HTTPServer.getPendingWebSockets) != GetterType) - @compileLog("Expected HTTPServer.getPendingWebSockets to be a getter"); - - if (@TypeOf(HTTPServer.getPort) != GetterType) - @compileLog("Expected HTTPServer.getPort to be a getter"); - - if (@TypeOf(HTTPServer.getProtocol) != GetterType) - @compileLog("Expected HTTPServer.getProtocol to be a getter"); - - if (@TypeOf(HTTPServer.doPublish) != CallbackType) - @compileLog("Expected HTTPServer.doPublish to be a callback but received " ++ @typeName(@TypeOf(HTTPServer.doPublish))); - if (@TypeOf(HTTPServer.doReload) != CallbackType) - @compileLog("Expected HTTPServer.doReload to be a callback but received " ++ @typeName(@TypeOf(HTTPServer.doReload))); - if (@TypeOf(HTTPServer.doRequestIP) != CallbackType) - @compileLog("Expected HTTPServer.doRequestIP to be a callback but received " ++ @typeName(@TypeOf(HTTPServer.doRequestIP))); - if (@TypeOf(HTTPServer.doStop) != CallbackType) - @compileLog("Expected HTTPServer.doStop to be a callback but received " ++ @typeName(@TypeOf(HTTPServer.doStop))); - if (@TypeOf(HTTPServer.doUpgrade) != CallbackType) - @compileLog("Expected HTTPServer.doUpgrade to be a callback but received " ++ @typeName(@TypeOf(HTTPServer.doUpgrade))); - if (!JSC.is_bindgen) { - @export(HTTPServer.doFetch, .{ .name = "HTTPServerPrototype__doFetch" }); - @export(HTTPServer.doPublish, .{ .name = "HTTPServerPrototype__doPublish" }); - @export(HTTPServer.doReload, .{ .name = "HTTPServerPrototype__doReload" }); - @export(HTTPServer.doRequestIP, .{ .name = "HTTPServerPrototype__doRequestIP" }); - @export(HTTPServer.doStop, .{ .name = "HTTPServerPrototype__doStop" }); - @export(HTTPServer.doUpgrade, .{ .name = "HTTPServerPrototype__doUpgrade" }); - @export(HTTPServer.finalize, .{ .name = "HTTPServerClass__finalize" }); - @export(HTTPServer.getAddress, .{ .name = "HTTPServerPrototype__getAddress" }); - @export(HTTPServer.getDevelopment, .{ .name = "HTTPServerPrototype__getDevelopment" }); - @export(HTTPServer.getHostname, .{ .name = "HTTPServerPrototype__getHostname" }); - @export(HTTPServer.getId, .{ .name = "HTTPServerPrototype__getId" }); - @export(HTTPServer.getPendingRequests, .{ .name = "HTTPServerPrototype__getPendingRequests" }); - @export(HTTPServer.getPendingWebSockets, .{ .name = "HTTPServerPrototype__getPendingWebSockets" }); - @export(HTTPServer.getPort, .{ .name = "HTTPServerPrototype__getPort" }); - @export(HTTPServer.getProtocol, .{ .name = "HTTPServerPrototype__getProtocol" }); - } - } -}; -pub const JSListener = struct { - const Listener = Classes.Listener; - const GetterType = fn (*Listener, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*Listener, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*Listener, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*Listener, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*Listener, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*Listener { - JSC.markBinding(@src()); - return Listener__fromJS(value); - } - - extern fn ListenerPrototype__hostnameSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ListenerPrototype__hostnameGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Listener.hostname` setter - /// This value will be visited by the garbage collector. - pub fn hostnameSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ListenerPrototype__hostnameSetCachedValue(thisValue, globalObject, value); - } - - /// `Listener.hostname` getter - /// This value will be visited by the garbage collector. - pub fn hostnameGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ListenerPrototype__hostnameGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn ListenerPrototype__unixSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ListenerPrototype__unixGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Listener.unix` setter - /// This value will be visited by the garbage collector. - pub fn unixSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ListenerPrototype__unixSetCachedValue(thisValue, globalObject, value); - } - - /// `Listener.unix` getter - /// This value will be visited by the garbage collector. - pub fn unixGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ListenerPrototype__unixGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Create a new instance of Listener - pub fn toJS(this: *Listener, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = Listener__create(globalObject, this); - std.debug.assert(value__.as(Listener).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return Listener__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of Listener. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Listener) bool { - JSC.markBinding(@src()); - return Listener__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *Listener, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(Listener__dangerouslySetPtr(value, null)); - } - - extern fn Listener__fromJS(JSC.JSValue) ?*Listener; - extern fn Listener__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn Listener__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Listener) JSC.JSValue; - - extern fn Listener__dangerouslySetPtr(JSC.JSValue, ?*Listener) bool; - - comptime { - if (@TypeOf(Listener.finalize) != (fn (*Listener) callconv(.C) void)) { - @compileLog("Listener.finalize is not a finalizer"); - } - - if (@TypeOf(Listener.getData) != GetterType) - @compileLog("Expected Listener.getData to be a getter"); - - if (@TypeOf(Listener.setData) != SetterType) - @compileLog("Expected Listener.setData to be a setter"); - if (@TypeOf(Listener.getHostname) != GetterType) - @compileLog("Expected Listener.getHostname to be a getter"); - - if (@TypeOf(Listener.getPort) != GetterType) - @compileLog("Expected Listener.getPort to be a getter"); - - if (@TypeOf(Listener.ref) != CallbackType) - @compileLog("Expected Listener.ref to be a callback but received " ++ @typeName(@TypeOf(Listener.ref))); - if (@TypeOf(Listener.reload) != CallbackType) - @compileLog("Expected Listener.reload to be a callback but received " ++ @typeName(@TypeOf(Listener.reload))); - if (@TypeOf(Listener.stop) != CallbackType) - @compileLog("Expected Listener.stop to be a callback but received " ++ @typeName(@TypeOf(Listener.stop))); - if (@TypeOf(Listener.getUnix) != GetterType) - @compileLog("Expected Listener.getUnix to be a getter"); - - if (@TypeOf(Listener.unref) != CallbackType) - @compileLog("Expected Listener.unref to be a callback but received " ++ @typeName(@TypeOf(Listener.unref))); - if (!JSC.is_bindgen) { - @export(Listener.finalize, .{ .name = "ListenerClass__finalize" }); - @export(Listener.getData, .{ .name = "ListenerPrototype__getData" }); - @export(Listener.getHostname, .{ .name = "ListenerPrototype__getHostname" }); - @export(Listener.getPort, .{ .name = "ListenerPrototype__getPort" }); - @export(Listener.getUnix, .{ .name = "ListenerPrototype__getUnix" }); - @export(Listener.ref, .{ .name = "ListenerPrototype__ref" }); - @export(Listener.reload, .{ .name = "ListenerPrototype__reload" }); - @export(Listener.setData, .{ .name = "ListenerPrototype__setData" }); - @export(Listener.stop, .{ .name = "ListenerPrototype__stop" }); - @export(Listener.unref, .{ .name = "ListenerPrototype__unref" }); - } - } -}; -pub const JSMD4 = struct { - const MD4 = Classes.MD4; - const GetterType = fn (*MD4, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*MD4, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*MD4, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*MD4, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*MD4, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*MD4 { - JSC.markBinding(@src()); - return MD4__fromJS(value); - } - - /// Get the MD4 constructor value. - /// This loads lazily from the global object. - pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - return MD4__getConstructor(globalObject); - } - - /// Create a new instance of MD4 - pub fn toJS(this: *MD4, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = MD4__create(globalObject, this); - std.debug.assert(value__.as(MD4).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return MD4__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of MD4. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*MD4) bool { - JSC.markBinding(@src()); - return MD4__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *MD4, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(MD4__dangerouslySetPtr(value, null)); - } - - extern fn MD4__fromJS(JSC.JSValue) ?*MD4; - extern fn MD4__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn MD4__create(globalObject: *JSC.JSGlobalObject, ptr: ?*MD4) JSC.JSValue; - - extern fn MD4__dangerouslySetPtr(JSC.JSValue, ?*MD4) bool; - - comptime { - if (@TypeOf(MD4.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*MD4)) { - @compileLog("MD4.constructor is not a constructor"); - } - - if (@TypeOf(MD4.finalize) != (fn (*MD4) callconv(.C) void)) { - @compileLog("MD4.finalize is not a finalizer"); - } - - if (@TypeOf(MD4.getByteLength) != GetterType) - @compileLog("Expected MD4.getByteLength to be a getter"); - - if (@TypeOf(MD4.digest) != CallbackType) - @compileLog("Expected MD4.digest to be a callback but received " ++ @typeName(@TypeOf(MD4.digest))); - if (@TypeOf(MD4.update) != CallbackType) - @compileLog("Expected MD4.update to be a callback but received " ++ @typeName(@TypeOf(MD4.update))); - if (@TypeOf(MD4.getByteLengthStatic) != StaticGetterType) - @compileLog("Expected MD4.getByteLengthStatic to be a static getter"); - - if (@TypeOf(MD4.hash) != StaticCallbackType) - @compileLog("Expected MD4.hash to be a static callback"); - if (!JSC.is_bindgen) { - @export(MD4.constructor, .{ .name = "MD4Class__construct" }); - @export(MD4.digest, .{ .name = "MD4Prototype__digest" }); - @export(MD4.finalize, .{ .name = "MD4Class__finalize" }); - @export(MD4.getByteLength, .{ .name = "MD4Prototype__getByteLength" }); - @export(MD4.getByteLengthStatic, .{ .name = "MD4Class__getByteLengthStatic" }); - @export(MD4.hash, .{ .name = "MD4Class__hash" }); - @export(MD4.update, .{ .name = "MD4Prototype__update" }); - } - } -}; -pub const JSMD5 = struct { - const MD5 = Classes.MD5; - const GetterType = fn (*MD5, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*MD5, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*MD5, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*MD5, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*MD5, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*MD5 { - JSC.markBinding(@src()); - return MD5__fromJS(value); - } - - /// Get the MD5 constructor value. - /// This loads lazily from the global object. - pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - return MD5__getConstructor(globalObject); - } - - /// Create a new instance of MD5 - pub fn toJS(this: *MD5, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = MD5__create(globalObject, this); - std.debug.assert(value__.as(MD5).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return MD5__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of MD5. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*MD5) bool { - JSC.markBinding(@src()); - return MD5__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *MD5, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(MD5__dangerouslySetPtr(value, null)); - } - - extern fn MD5__fromJS(JSC.JSValue) ?*MD5; - extern fn MD5__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn MD5__create(globalObject: *JSC.JSGlobalObject, ptr: ?*MD5) JSC.JSValue; - - extern fn MD5__dangerouslySetPtr(JSC.JSValue, ?*MD5) bool; - - comptime { - if (@TypeOf(MD5.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*MD5)) { - @compileLog("MD5.constructor is not a constructor"); - } - - if (@TypeOf(MD5.finalize) != (fn (*MD5) callconv(.C) void)) { - @compileLog("MD5.finalize is not a finalizer"); - } - - if (@TypeOf(MD5.getByteLength) != GetterType) - @compileLog("Expected MD5.getByteLength to be a getter"); - - if (@TypeOf(MD5.digest) != CallbackType) - @compileLog("Expected MD5.digest to be a callback but received " ++ @typeName(@TypeOf(MD5.digest))); - if (@TypeOf(MD5.update) != CallbackType) - @compileLog("Expected MD5.update to be a callback but received " ++ @typeName(@TypeOf(MD5.update))); - if (@TypeOf(MD5.getByteLengthStatic) != StaticGetterType) - @compileLog("Expected MD5.getByteLengthStatic to be a static getter"); - - if (@TypeOf(MD5.hash) != StaticCallbackType) - @compileLog("Expected MD5.hash to be a static callback"); - if (!JSC.is_bindgen) { - @export(MD5.constructor, .{ .name = "MD5Class__construct" }); - @export(MD5.digest, .{ .name = "MD5Prototype__digest" }); - @export(MD5.finalize, .{ .name = "MD5Class__finalize" }); - @export(MD5.getByteLength, .{ .name = "MD5Prototype__getByteLength" }); - @export(MD5.getByteLengthStatic, .{ .name = "MD5Class__getByteLengthStatic" }); - @export(MD5.hash, .{ .name = "MD5Class__hash" }); - @export(MD5.update, .{ .name = "MD5Prototype__update" }); - } - } -}; -pub const JSMatchedRoute = struct { - const MatchedRoute = Classes.MatchedRoute; - const GetterType = fn (*MatchedRoute, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*MatchedRoute, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*MatchedRoute, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*MatchedRoute, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*MatchedRoute, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*MatchedRoute { - JSC.markBinding(@src()); - return MatchedRoute__fromJS(value); - } - - extern fn MatchedRoutePrototype__filePathSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn MatchedRoutePrototype__filePathGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `MatchedRoute.filePath` setter - /// This value will be visited by the garbage collector. - pub fn filePathSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - MatchedRoutePrototype__filePathSetCachedValue(thisValue, globalObject, value); - } - - /// `MatchedRoute.filePath` getter - /// This value will be visited by the garbage collector. - pub fn filePathGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = MatchedRoutePrototype__filePathGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn MatchedRoutePrototype__kindSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn MatchedRoutePrototype__kindGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `MatchedRoute.kind` setter - /// This value will be visited by the garbage collector. - pub fn kindSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - MatchedRoutePrototype__kindSetCachedValue(thisValue, globalObject, value); - } - - /// `MatchedRoute.kind` getter - /// This value will be visited by the garbage collector. - pub fn kindGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = MatchedRoutePrototype__kindGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn MatchedRoutePrototype__nameSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn MatchedRoutePrototype__nameGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `MatchedRoute.name` setter - /// This value will be visited by the garbage collector. - pub fn nameSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - MatchedRoutePrototype__nameSetCachedValue(thisValue, globalObject, value); - } - - /// `MatchedRoute.name` getter - /// This value will be visited by the garbage collector. - pub fn nameGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = MatchedRoutePrototype__nameGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn MatchedRoutePrototype__paramsSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn MatchedRoutePrototype__paramsGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `MatchedRoute.params` setter - /// This value will be visited by the garbage collector. - pub fn paramsSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - MatchedRoutePrototype__paramsSetCachedValue(thisValue, globalObject, value); - } - - /// `MatchedRoute.params` getter - /// This value will be visited by the garbage collector. - pub fn paramsGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = MatchedRoutePrototype__paramsGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn MatchedRoutePrototype__pathnameSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn MatchedRoutePrototype__pathnameGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `MatchedRoute.pathname` setter - /// This value will be visited by the garbage collector. - pub fn pathnameSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - MatchedRoutePrototype__pathnameSetCachedValue(thisValue, globalObject, value); - } - - /// `MatchedRoute.pathname` getter - /// This value will be visited by the garbage collector. - pub fn pathnameGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = MatchedRoutePrototype__pathnameGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn MatchedRoutePrototype__querySetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn MatchedRoutePrototype__queryGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `MatchedRoute.query` setter - /// This value will be visited by the garbage collector. - pub fn querySetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - MatchedRoutePrototype__querySetCachedValue(thisValue, globalObject, value); - } - - /// `MatchedRoute.query` getter - /// This value will be visited by the garbage collector. - pub fn queryGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = MatchedRoutePrototype__queryGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn MatchedRoutePrototype__scriptSrcSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn MatchedRoutePrototype__scriptSrcGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `MatchedRoute.scriptSrc` setter - /// This value will be visited by the garbage collector. - pub fn scriptSrcSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - MatchedRoutePrototype__scriptSrcSetCachedValue(thisValue, globalObject, value); - } - - /// `MatchedRoute.scriptSrc` getter - /// This value will be visited by the garbage collector. - pub fn scriptSrcGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = MatchedRoutePrototype__scriptSrcGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Create a new instance of MatchedRoute - pub fn toJS(this: *MatchedRoute, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = MatchedRoute__create(globalObject, this); - std.debug.assert(value__.as(MatchedRoute).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return MatchedRoute__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of MatchedRoute. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*MatchedRoute) bool { - JSC.markBinding(@src()); - return MatchedRoute__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *MatchedRoute, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(MatchedRoute__dangerouslySetPtr(value, null)); - } - - extern fn MatchedRoute__fromJS(JSC.JSValue) ?*MatchedRoute; - extern fn MatchedRoute__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn MatchedRoute__create(globalObject: *JSC.JSGlobalObject, ptr: ?*MatchedRoute) JSC.JSValue; - - extern fn MatchedRoute__dangerouslySetPtr(JSC.JSValue, ?*MatchedRoute) bool; - - comptime { - if (@TypeOf(MatchedRoute.finalize) != (fn (*MatchedRoute) callconv(.C) void)) { - @compileLog("MatchedRoute.finalize is not a finalizer"); - } - - if (@TypeOf(MatchedRoute.getFilePath) != GetterType) - @compileLog("Expected MatchedRoute.getFilePath to be a getter"); - - if (@TypeOf(MatchedRoute.getKind) != GetterType) - @compileLog("Expected MatchedRoute.getKind to be a getter"); - - if (@TypeOf(MatchedRoute.getName) != GetterType) - @compileLog("Expected MatchedRoute.getName to be a getter"); - - if (@TypeOf(MatchedRoute.getParams) != GetterType) - @compileLog("Expected MatchedRoute.getParams to be a getter"); - - if (@TypeOf(MatchedRoute.getPathname) != GetterType) - @compileLog("Expected MatchedRoute.getPathname to be a getter"); - - if (@TypeOf(MatchedRoute.getQuery) != GetterType) - @compileLog("Expected MatchedRoute.getQuery to be a getter"); - - if (@TypeOf(MatchedRoute.getScriptSrc) != GetterType) - @compileLog("Expected MatchedRoute.getScriptSrc to be a getter"); - - if (@TypeOf(MatchedRoute.getScriptSrc) != GetterType) - @compileLog("Expected MatchedRoute.getScriptSrc to be a getter"); - - if (!JSC.is_bindgen) { - @export(MatchedRoute.finalize, .{ .name = "MatchedRouteClass__finalize" }); - @export(MatchedRoute.getFilePath, .{ .name = "MatchedRoutePrototype__getFilePath" }); - @export(MatchedRoute.getKind, .{ .name = "MatchedRoutePrototype__getKind" }); - @export(MatchedRoute.getName, .{ .name = "MatchedRoutePrototype__getName" }); - @export(MatchedRoute.getParams, .{ .name = "MatchedRoutePrototype__getParams" }); - @export(MatchedRoute.getPathname, .{ .name = "MatchedRoutePrototype__getPathname" }); - @export(MatchedRoute.getQuery, .{ .name = "MatchedRoutePrototype__getQuery" }); - @export(MatchedRoute.getScriptSrc, .{ .name = "MatchedRoutePrototype__getScriptSrc" }); - } - } -}; -pub const JSNodeJSFS = struct { - const NodeJSFS = Classes.NodeJSFS; - const GetterType = fn (*NodeJSFS, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*NodeJSFS, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*NodeJSFS, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*NodeJSFS, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*NodeJSFS, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*NodeJSFS { - JSC.markBinding(@src()); - return NodeJSFS__fromJS(value); - } - - /// Get the NodeJSFS constructor value. - /// This loads lazily from the global object. - pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - return NodeJSFS__getConstructor(globalObject); - } - - /// Create a new instance of NodeJSFS - pub fn toJS(this: *NodeJSFS, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = NodeJSFS__create(globalObject, this); - std.debug.assert(value__.as(NodeJSFS).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return NodeJSFS__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of NodeJSFS. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*NodeJSFS) bool { - JSC.markBinding(@src()); - return NodeJSFS__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *NodeJSFS, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(NodeJSFS__dangerouslySetPtr(value, null)); - } - - extern fn NodeJSFS__fromJS(JSC.JSValue) ?*NodeJSFS; - extern fn NodeJSFS__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn NodeJSFS__create(globalObject: *JSC.JSGlobalObject, ptr: ?*NodeJSFS) JSC.JSValue; - - extern fn NodeJSFS__dangerouslySetPtr(JSC.JSValue, ?*NodeJSFS) bool; - - comptime { - if (@TypeOf(NodeJSFS.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*NodeJSFS)) { - @compileLog("NodeJSFS.constructor is not a constructor"); - } - - if (@TypeOf(NodeJSFS.access) != CallbackType) - @compileLog("Expected NodeJSFS.access to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.access))); - if (@TypeOf(NodeJSFS.accessSync) != CallbackType) - @compileLog("Expected NodeJSFS.accessSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.accessSync))); - if (@TypeOf(NodeJSFS.appendFile) != CallbackType) - @compileLog("Expected NodeJSFS.appendFile to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.appendFile))); - if (@TypeOf(NodeJSFS.appendFileSync) != CallbackType) - @compileLog("Expected NodeJSFS.appendFileSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.appendFileSync))); - if (@TypeOf(NodeJSFS.chmod) != CallbackType) - @compileLog("Expected NodeJSFS.chmod to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.chmod))); - if (@TypeOf(NodeJSFS.chmodSync) != CallbackType) - @compileLog("Expected NodeJSFS.chmodSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.chmodSync))); - if (@TypeOf(NodeJSFS.chown) != CallbackType) - @compileLog("Expected NodeJSFS.chown to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.chown))); - if (@TypeOf(NodeJSFS.chownSync) != CallbackType) - @compileLog("Expected NodeJSFS.chownSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.chownSync))); - if (@TypeOf(NodeJSFS.close) != CallbackType) - @compileLog("Expected NodeJSFS.close to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.close))); - if (@TypeOf(NodeJSFS.closeSync) != CallbackType) - @compileLog("Expected NodeJSFS.closeSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.closeSync))); - if (@TypeOf(NodeJSFS.copyFile) != CallbackType) - @compileLog("Expected NodeJSFS.copyFile to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.copyFile))); - if (@TypeOf(NodeJSFS.copyFileSync) != CallbackType) - @compileLog("Expected NodeJSFS.copyFileSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.copyFileSync))); - if (@TypeOf(NodeJSFS.cp) != CallbackType) - @compileLog("Expected NodeJSFS.cp to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.cp))); - if (@TypeOf(NodeJSFS.cpSync) != CallbackType) - @compileLog("Expected NodeJSFS.cpSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.cpSync))); - if (@TypeOf(NodeJSFS.getDirent) != GetterType) - @compileLog("Expected NodeJSFS.getDirent to be a getter"); - - if (@TypeOf(NodeJSFS.exists) != CallbackType) - @compileLog("Expected NodeJSFS.exists to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.exists))); - if (@TypeOf(NodeJSFS.existsSync) != CallbackType) - @compileLog("Expected NodeJSFS.existsSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.existsSync))); - if (@TypeOf(NodeJSFS.fchmod) != CallbackType) - @compileLog("Expected NodeJSFS.fchmod to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fchmod))); - if (@TypeOf(NodeJSFS.fchmodSync) != CallbackType) - @compileLog("Expected NodeJSFS.fchmodSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fchmodSync))); - if (@TypeOf(NodeJSFS.fchown) != CallbackType) - @compileLog("Expected NodeJSFS.fchown to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fchown))); - if (@TypeOf(NodeJSFS.fchownSync) != CallbackType) - @compileLog("Expected NodeJSFS.fchownSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fchownSync))); - if (@TypeOf(NodeJSFS.fdatasync) != CallbackType) - @compileLog("Expected NodeJSFS.fdatasync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fdatasync))); - if (@TypeOf(NodeJSFS.fdatasyncSync) != CallbackType) - @compileLog("Expected NodeJSFS.fdatasyncSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fdatasyncSync))); - if (@TypeOf(NodeJSFS.fstat) != CallbackType) - @compileLog("Expected NodeJSFS.fstat to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fstat))); - if (@TypeOf(NodeJSFS.fstatSync) != CallbackType) - @compileLog("Expected NodeJSFS.fstatSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fstatSync))); - if (@TypeOf(NodeJSFS.fsync) != CallbackType) - @compileLog("Expected NodeJSFS.fsync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fsync))); - if (@TypeOf(NodeJSFS.fsyncSync) != CallbackType) - @compileLog("Expected NodeJSFS.fsyncSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fsyncSync))); - if (@TypeOf(NodeJSFS.ftruncate) != CallbackType) - @compileLog("Expected NodeJSFS.ftruncate to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.ftruncate))); - if (@TypeOf(NodeJSFS.ftruncateSync) != CallbackType) - @compileLog("Expected NodeJSFS.ftruncateSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.ftruncateSync))); - if (@TypeOf(NodeJSFS.futimes) != CallbackType) - @compileLog("Expected NodeJSFS.futimes to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.futimes))); - if (@TypeOf(NodeJSFS.futimesSync) != CallbackType) - @compileLog("Expected NodeJSFS.futimesSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.futimesSync))); - if (@TypeOf(NodeJSFS.lchmod) != CallbackType) - @compileLog("Expected NodeJSFS.lchmod to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.lchmod))); - if (@TypeOf(NodeJSFS.lchmodSync) != CallbackType) - @compileLog("Expected NodeJSFS.lchmodSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.lchmodSync))); - if (@TypeOf(NodeJSFS.lchown) != CallbackType) - @compileLog("Expected NodeJSFS.lchown to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.lchown))); - if (@TypeOf(NodeJSFS.lchownSync) != CallbackType) - @compileLog("Expected NodeJSFS.lchownSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.lchownSync))); - if (@TypeOf(NodeJSFS.link) != CallbackType) - @compileLog("Expected NodeJSFS.link to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.link))); - if (@TypeOf(NodeJSFS.linkSync) != CallbackType) - @compileLog("Expected NodeJSFS.linkSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.linkSync))); - if (@TypeOf(NodeJSFS.lstat) != CallbackType) - @compileLog("Expected NodeJSFS.lstat to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.lstat))); - if (@TypeOf(NodeJSFS.lstatSync) != CallbackType) - @compileLog("Expected NodeJSFS.lstatSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.lstatSync))); - if (@TypeOf(NodeJSFS.lutimes) != CallbackType) - @compileLog("Expected NodeJSFS.lutimes to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.lutimes))); - if (@TypeOf(NodeJSFS.lutimesSync) != CallbackType) - @compileLog("Expected NodeJSFS.lutimesSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.lutimesSync))); - if (@TypeOf(NodeJSFS.mkdir) != CallbackType) - @compileLog("Expected NodeJSFS.mkdir to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.mkdir))); - if (@TypeOf(NodeJSFS.mkdirSync) != CallbackType) - @compileLog("Expected NodeJSFS.mkdirSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.mkdirSync))); - if (@TypeOf(NodeJSFS.mkdtemp) != CallbackType) - @compileLog("Expected NodeJSFS.mkdtemp to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.mkdtemp))); - if (@TypeOf(NodeJSFS.mkdtempSync) != CallbackType) - @compileLog("Expected NodeJSFS.mkdtempSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.mkdtempSync))); - if (@TypeOf(NodeJSFS.open) != CallbackType) - @compileLog("Expected NodeJSFS.open to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.open))); - if (@TypeOf(NodeJSFS.opendir) != CallbackType) - @compileLog("Expected NodeJSFS.opendir to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.opendir))); - if (@TypeOf(NodeJSFS.opendirSync) != CallbackType) - @compileLog("Expected NodeJSFS.opendirSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.opendirSync))); - if (@TypeOf(NodeJSFS.openSync) != CallbackType) - @compileLog("Expected NodeJSFS.openSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.openSync))); - if (@TypeOf(NodeJSFS.read) != CallbackType) - @compileLog("Expected NodeJSFS.read to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.read))); - if (@TypeOf(NodeJSFS.readdir) != CallbackType) - @compileLog("Expected NodeJSFS.readdir to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.readdir))); - if (@TypeOf(NodeJSFS.readdirSync) != CallbackType) - @compileLog("Expected NodeJSFS.readdirSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.readdirSync))); - if (@TypeOf(NodeJSFS.readFile) != CallbackType) - @compileLog("Expected NodeJSFS.readFile to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.readFile))); - if (@TypeOf(NodeJSFS.readFileSync) != CallbackType) - @compileLog("Expected NodeJSFS.readFileSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.readFileSync))); - if (@TypeOf(NodeJSFS.readlink) != CallbackType) - @compileLog("Expected NodeJSFS.readlink to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.readlink))); - if (@TypeOf(NodeJSFS.readlinkSync) != CallbackType) - @compileLog("Expected NodeJSFS.readlinkSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.readlinkSync))); - if (@TypeOf(NodeJSFS.readSync) != CallbackType) - @compileLog("Expected NodeJSFS.readSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.readSync))); - if (@TypeOf(NodeJSFS.readv) != CallbackType) - @compileLog("Expected NodeJSFS.readv to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.readv))); - if (@TypeOf(NodeJSFS.readvSync) != CallbackType) - @compileLog("Expected NodeJSFS.readvSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.readvSync))); - if (@TypeOf(NodeJSFS.realpath) != CallbackType) - @compileLog("Expected NodeJSFS.realpath to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.realpath))); - if (@TypeOf(NodeJSFS.realpathSync) != CallbackType) - @compileLog("Expected NodeJSFS.realpathSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.realpathSync))); - if (@TypeOf(NodeJSFS.rename) != CallbackType) - @compileLog("Expected NodeJSFS.rename to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.rename))); - if (@TypeOf(NodeJSFS.renameSync) != CallbackType) - @compileLog("Expected NodeJSFS.renameSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.renameSync))); - if (@TypeOf(NodeJSFS.rm) != CallbackType) - @compileLog("Expected NodeJSFS.rm to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.rm))); - if (@TypeOf(NodeJSFS.rmdir) != CallbackType) - @compileLog("Expected NodeJSFS.rmdir to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.rmdir))); - if (@TypeOf(NodeJSFS.rmdirSync) != CallbackType) - @compileLog("Expected NodeJSFS.rmdirSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.rmdirSync))); - if (@TypeOf(NodeJSFS.rmSync) != CallbackType) - @compileLog("Expected NodeJSFS.rmSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.rmSync))); - if (@TypeOf(NodeJSFS.stat) != CallbackType) - @compileLog("Expected NodeJSFS.stat to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.stat))); - if (@TypeOf(NodeJSFS.getStats) != GetterType) - @compileLog("Expected NodeJSFS.getStats to be a getter"); - - if (@TypeOf(NodeJSFS.statSync) != CallbackType) - @compileLog("Expected NodeJSFS.statSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.statSync))); - if (@TypeOf(NodeJSFS.symlink) != CallbackType) - @compileLog("Expected NodeJSFS.symlink to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.symlink))); - if (@TypeOf(NodeJSFS.symlinkSync) != CallbackType) - @compileLog("Expected NodeJSFS.symlinkSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.symlinkSync))); - if (@TypeOf(NodeJSFS.truncate) != CallbackType) - @compileLog("Expected NodeJSFS.truncate to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.truncate))); - if (@TypeOf(NodeJSFS.truncateSync) != CallbackType) - @compileLog("Expected NodeJSFS.truncateSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.truncateSync))); - if (@TypeOf(NodeJSFS.unlink) != CallbackType) - @compileLog("Expected NodeJSFS.unlink to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.unlink))); - if (@TypeOf(NodeJSFS.unlinkSync) != CallbackType) - @compileLog("Expected NodeJSFS.unlinkSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.unlinkSync))); - if (@TypeOf(NodeJSFS.unwatchFile) != CallbackType) - @compileLog("Expected NodeJSFS.unwatchFile to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.unwatchFile))); - if (@TypeOf(NodeJSFS.utimes) != CallbackType) - @compileLog("Expected NodeJSFS.utimes to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.utimes))); - if (@TypeOf(NodeJSFS.utimesSync) != CallbackType) - @compileLog("Expected NodeJSFS.utimesSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.utimesSync))); - if (@TypeOf(NodeJSFS.watch) != CallbackType) - @compileLog("Expected NodeJSFS.watch to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.watch))); - if (@TypeOf(NodeJSFS.watchFile) != CallbackType) - @compileLog("Expected NodeJSFS.watchFile to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.watchFile))); - if (@TypeOf(NodeJSFS.write) != CallbackType) - @compileLog("Expected NodeJSFS.write to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.write))); - if (@TypeOf(NodeJSFS.writeFile) != CallbackType) - @compileLog("Expected NodeJSFS.writeFile to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.writeFile))); - if (@TypeOf(NodeJSFS.writeFileSync) != CallbackType) - @compileLog("Expected NodeJSFS.writeFileSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.writeFileSync))); - if (@TypeOf(NodeJSFS.writeSync) != CallbackType) - @compileLog("Expected NodeJSFS.writeSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.writeSync))); - if (@TypeOf(NodeJSFS.writev) != CallbackType) - @compileLog("Expected NodeJSFS.writev to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.writev))); - if (@TypeOf(NodeJSFS.writevSync) != CallbackType) - @compileLog("Expected NodeJSFS.writevSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.writevSync))); - if (!JSC.is_bindgen) { - @export(NodeJSFS.access, .{ .name = "NodeJSFSPrototype__access" }); - @export(NodeJSFS.accessSync, .{ .name = "NodeJSFSPrototype__accessSync" }); - @export(NodeJSFS.appendFile, .{ .name = "NodeJSFSPrototype__appendFile" }); - @export(NodeJSFS.appendFileSync, .{ .name = "NodeJSFSPrototype__appendFileSync" }); - @export(NodeJSFS.chmod, .{ .name = "NodeJSFSPrototype__chmod" }); - @export(NodeJSFS.chmodSync, .{ .name = "NodeJSFSPrototype__chmodSync" }); - @export(NodeJSFS.chown, .{ .name = "NodeJSFSPrototype__chown" }); - @export(NodeJSFS.chownSync, .{ .name = "NodeJSFSPrototype__chownSync" }); - @export(NodeJSFS.close, .{ .name = "NodeJSFSPrototype__close" }); - @export(NodeJSFS.closeSync, .{ .name = "NodeJSFSPrototype__closeSync" }); - @export(NodeJSFS.constructor, .{ .name = "NodeJSFSClass__construct" }); - @export(NodeJSFS.copyFile, .{ .name = "NodeJSFSPrototype__copyFile" }); - @export(NodeJSFS.copyFileSync, .{ .name = "NodeJSFSPrototype__copyFileSync" }); - @export(NodeJSFS.cp, .{ .name = "NodeJSFSPrototype__cp" }); - @export(NodeJSFS.cpSync, .{ .name = "NodeJSFSPrototype__cpSync" }); - @export(NodeJSFS.exists, .{ .name = "NodeJSFSPrototype__exists" }); - @export(NodeJSFS.existsSync, .{ .name = "NodeJSFSPrototype__existsSync" }); - @export(NodeJSFS.fchmod, .{ .name = "NodeJSFSPrototype__fchmod" }); - @export(NodeJSFS.fchmodSync, .{ .name = "NodeJSFSPrototype__fchmodSync" }); - @export(NodeJSFS.fchown, .{ .name = "NodeJSFSPrototype__fchown" }); - @export(NodeJSFS.fchownSync, .{ .name = "NodeJSFSPrototype__fchownSync" }); - @export(NodeJSFS.fdatasync, .{ .name = "NodeJSFSPrototype__fdatasync" }); - @export(NodeJSFS.fdatasyncSync, .{ .name = "NodeJSFSPrototype__fdatasyncSync" }); - @export(NodeJSFS.fstat, .{ .name = "NodeJSFSPrototype__fstat" }); - @export(NodeJSFS.fstatSync, .{ .name = "NodeJSFSPrototype__fstatSync" }); - @export(NodeJSFS.fsync, .{ .name = "NodeJSFSPrototype__fsync" }); - @export(NodeJSFS.fsyncSync, .{ .name = "NodeJSFSPrototype__fsyncSync" }); - @export(NodeJSFS.ftruncate, .{ .name = "NodeJSFSPrototype__ftruncate" }); - @export(NodeJSFS.ftruncateSync, .{ .name = "NodeJSFSPrototype__ftruncateSync" }); - @export(NodeJSFS.futimes, .{ .name = "NodeJSFSPrototype__futimes" }); - @export(NodeJSFS.futimesSync, .{ .name = "NodeJSFSPrototype__futimesSync" }); - @export(NodeJSFS.getDirent, .{ .name = "NodeJSFSPrototype__getDirent" }); - @export(NodeJSFS.getStats, .{ .name = "NodeJSFSPrototype__getStats" }); - @export(NodeJSFS.lchmod, .{ .name = "NodeJSFSPrototype__lchmod" }); - @export(NodeJSFS.lchmodSync, .{ .name = "NodeJSFSPrototype__lchmodSync" }); - @export(NodeJSFS.lchown, .{ .name = "NodeJSFSPrototype__lchown" }); - @export(NodeJSFS.lchownSync, .{ .name = "NodeJSFSPrototype__lchownSync" }); - @export(NodeJSFS.link, .{ .name = "NodeJSFSPrototype__link" }); - @export(NodeJSFS.linkSync, .{ .name = "NodeJSFSPrototype__linkSync" }); - @export(NodeJSFS.lstat, .{ .name = "NodeJSFSPrototype__lstat" }); - @export(NodeJSFS.lstatSync, .{ .name = "NodeJSFSPrototype__lstatSync" }); - @export(NodeJSFS.lutimes, .{ .name = "NodeJSFSPrototype__lutimes" }); - @export(NodeJSFS.lutimesSync, .{ .name = "NodeJSFSPrototype__lutimesSync" }); - @export(NodeJSFS.mkdir, .{ .name = "NodeJSFSPrototype__mkdir" }); - @export(NodeJSFS.mkdirSync, .{ .name = "NodeJSFSPrototype__mkdirSync" }); - @export(NodeJSFS.mkdtemp, .{ .name = "NodeJSFSPrototype__mkdtemp" }); - @export(NodeJSFS.mkdtempSync, .{ .name = "NodeJSFSPrototype__mkdtempSync" }); - @export(NodeJSFS.open, .{ .name = "NodeJSFSPrototype__open" }); - @export(NodeJSFS.opendir, .{ .name = "NodeJSFSPrototype__opendir" }); - @export(NodeJSFS.opendirSync, .{ .name = "NodeJSFSPrototype__opendirSync" }); - @export(NodeJSFS.openSync, .{ .name = "NodeJSFSPrototype__openSync" }); - @export(NodeJSFS.read, .{ .name = "NodeJSFSPrototype__read" }); - @export(NodeJSFS.readdir, .{ .name = "NodeJSFSPrototype__readdir" }); - @export(NodeJSFS.readdirSync, .{ .name = "NodeJSFSPrototype__readdirSync" }); - @export(NodeJSFS.readFile, .{ .name = "NodeJSFSPrototype__readFile" }); - @export(NodeJSFS.readFileSync, .{ .name = "NodeJSFSPrototype__readFileSync" }); - @export(NodeJSFS.readlink, .{ .name = "NodeJSFSPrototype__readlink" }); - @export(NodeJSFS.readlinkSync, .{ .name = "NodeJSFSPrototype__readlinkSync" }); - @export(NodeJSFS.readSync, .{ .name = "NodeJSFSPrototype__readSync" }); - @export(NodeJSFS.readv, .{ .name = "NodeJSFSPrototype__readv" }); - @export(NodeJSFS.readvSync, .{ .name = "NodeJSFSPrototype__readvSync" }); - @export(NodeJSFS.realpath, .{ .name = "NodeJSFSPrototype__realpath" }); - @export(NodeJSFS.realpathSync, .{ .name = "NodeJSFSPrototype__realpathSync" }); - @export(NodeJSFS.rename, .{ .name = "NodeJSFSPrototype__rename" }); - @export(NodeJSFS.renameSync, .{ .name = "NodeJSFSPrototype__renameSync" }); - @export(NodeJSFS.rm, .{ .name = "NodeJSFSPrototype__rm" }); - @export(NodeJSFS.rmdir, .{ .name = "NodeJSFSPrototype__rmdir" }); - @export(NodeJSFS.rmdirSync, .{ .name = "NodeJSFSPrototype__rmdirSync" }); - @export(NodeJSFS.rmSync, .{ .name = "NodeJSFSPrototype__rmSync" }); - @export(NodeJSFS.stat, .{ .name = "NodeJSFSPrototype__stat" }); - @export(NodeJSFS.statSync, .{ .name = "NodeJSFSPrototype__statSync" }); - @export(NodeJSFS.symlink, .{ .name = "NodeJSFSPrototype__symlink" }); - @export(NodeJSFS.symlinkSync, .{ .name = "NodeJSFSPrototype__symlinkSync" }); - @export(NodeJSFS.truncate, .{ .name = "NodeJSFSPrototype__truncate" }); - @export(NodeJSFS.truncateSync, .{ .name = "NodeJSFSPrototype__truncateSync" }); - @export(NodeJSFS.unlink, .{ .name = "NodeJSFSPrototype__unlink" }); - @export(NodeJSFS.unlinkSync, .{ .name = "NodeJSFSPrototype__unlinkSync" }); - @export(NodeJSFS.unwatchFile, .{ .name = "NodeJSFSPrototype__unwatchFile" }); - @export(NodeJSFS.utimes, .{ .name = "NodeJSFSPrototype__utimes" }); - @export(NodeJSFS.utimesSync, .{ .name = "NodeJSFSPrototype__utimesSync" }); - @export(NodeJSFS.watch, .{ .name = "NodeJSFSPrototype__watch" }); - @export(NodeJSFS.watchFile, .{ .name = "NodeJSFSPrototype__watchFile" }); - @export(NodeJSFS.write, .{ .name = "NodeJSFSPrototype__write" }); - @export(NodeJSFS.writeFile, .{ .name = "NodeJSFSPrototype__writeFile" }); - @export(NodeJSFS.writeFileSync, .{ .name = "NodeJSFSPrototype__writeFileSync" }); - @export(NodeJSFS.writeSync, .{ .name = "NodeJSFSPrototype__writeSync" }); - @export(NodeJSFS.writev, .{ .name = "NodeJSFSPrototype__writev" }); - @export(NodeJSFS.writevSync, .{ .name = "NodeJSFSPrototype__writevSync" }); - } - } -}; -pub const JSRequest = struct { - const Request = Classes.Request; - const GetterType = fn (*Request, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*Request, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*Request, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*Request, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*Request, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*Request { - JSC.markBinding(@src()); - return Request__fromJS(value); - } - - extern fn RequestPrototype__bodySetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn RequestPrototype__bodyGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Request.body` setter - /// This value will be visited by the garbage collector. - pub fn bodySetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - RequestPrototype__bodySetCachedValue(thisValue, globalObject, value); - } - - /// `Request.body` getter - /// This value will be visited by the garbage collector. - pub fn bodyGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = RequestPrototype__bodyGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn RequestPrototype__headersSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn RequestPrototype__headersGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Request.headers` setter - /// This value will be visited by the garbage collector. - pub fn headersSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - RequestPrototype__headersSetCachedValue(thisValue, globalObject, value); - } - - /// `Request.headers` getter - /// This value will be visited by the garbage collector. - pub fn headersGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = RequestPrototype__headersGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn RequestPrototype__signalSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn RequestPrototype__signalGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Request.signal` setter - /// This value will be visited by the garbage collector. - pub fn signalSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - RequestPrototype__signalSetCachedValue(thisValue, globalObject, value); - } - - /// `Request.signal` getter - /// This value will be visited by the garbage collector. - pub fn signalGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = RequestPrototype__signalGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn RequestPrototype__urlSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn RequestPrototype__urlGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Request.url` setter - /// This value will be visited by the garbage collector. - pub fn urlSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - RequestPrototype__urlSetCachedValue(thisValue, globalObject, value); - } - - /// `Request.url` getter - /// This value will be visited by the garbage collector. - pub fn urlGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = RequestPrototype__urlGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Get the Request constructor value. - /// This loads lazily from the global object. - pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - return Request__getConstructor(globalObject); - } - - /// Create a new instance of Request - pub fn toJS(this: *Request, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = Request__create(globalObject, this); - std.debug.assert(value__.as(Request).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return Request__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of Request. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Request) bool { - JSC.markBinding(@src()); - return Request__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *Request, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(Request__dangerouslySetPtr(value, null)); - } - - extern fn Request__fromJS(JSC.JSValue) ?*Request; - extern fn Request__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn Request__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Request) JSC.JSValue; - - extern fn Request__dangerouslySetPtr(JSC.JSValue, ?*Request) bool; - - comptime { - if (@TypeOf(Request.estimatedSize) != (fn (*Request) callconv(.C) usize)) { - @compileLog("Request.estimatedSize is not a size function"); - } - - if (@TypeOf(Request.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Request)) { - @compileLog("Request.constructor is not a constructor"); - } - - if (@TypeOf(Request.finalize) != (fn (*Request) callconv(.C) void)) { - @compileLog("Request.finalize is not a finalizer"); - } - - if (@TypeOf(Request.getArrayBuffer) != CallbackType) - @compileLog("Expected Request.getArrayBuffer to be a callback but received " ++ @typeName(@TypeOf(Request.getArrayBuffer))); - if (@TypeOf(Request.getBlob) != CallbackType) - @compileLog("Expected Request.getBlob to be a callback but received " ++ @typeName(@TypeOf(Request.getBlob))); - if (@TypeOf(Request.getBody) != GetterType) - @compileLog("Expected Request.getBody to be a getter"); - - if (@TypeOf(Request.getBodyUsed) != GetterType) - @compileLog("Expected Request.getBodyUsed to be a getter"); - - if (@TypeOf(Request.getCache) != GetterType) - @compileLog("Expected Request.getCache to be a getter"); - - if (@TypeOf(Request.doClone) != CallbackType) - @compileLog("Expected Request.doClone to be a callback but received " ++ @typeName(@TypeOf(Request.doClone))); - if (@TypeOf(Request.getCredentials) != GetterType) - @compileLog("Expected Request.getCredentials to be a getter"); - - if (@TypeOf(Request.getDestination) != GetterType) - @compileLog("Expected Request.getDestination to be a getter"); - - if (@TypeOf(Request.getFormData) != CallbackType) - @compileLog("Expected Request.getFormData to be a callback but received " ++ @typeName(@TypeOf(Request.getFormData))); - if (@TypeOf(Request.getHeaders) != GetterType) - @compileLog("Expected Request.getHeaders to be a getter"); - - if (@TypeOf(Request.getIntegrity) != GetterType) - @compileLog("Expected Request.getIntegrity to be a getter"); - - if (@TypeOf(Request.getJSON) != CallbackType) - @compileLog("Expected Request.getJSON to be a callback but received " ++ @typeName(@TypeOf(Request.getJSON))); - if (@TypeOf(Request.getMethod) != GetterType) - @compileLog("Expected Request.getMethod to be a getter"); - - if (@TypeOf(Request.getMode) != GetterType) - @compileLog("Expected Request.getMode to be a getter"); - - if (@TypeOf(Request.getRedirect) != GetterType) - @compileLog("Expected Request.getRedirect to be a getter"); - - if (@TypeOf(Request.getReferrer) != GetterType) - @compileLog("Expected Request.getReferrer to be a getter"); - - if (@TypeOf(Request.getReferrerPolicy) != GetterType) - @compileLog("Expected Request.getReferrerPolicy to be a getter"); - - if (@TypeOf(Request.getSignal) != GetterType) - @compileLog("Expected Request.getSignal to be a getter"); - - if (@TypeOf(Request.getText) != CallbackType) - @compileLog("Expected Request.getText to be a callback but received " ++ @typeName(@TypeOf(Request.getText))); - if (@TypeOf(Request.getUrl) != GetterType) - @compileLog("Expected Request.getUrl to be a getter"); - - if (!JSC.is_bindgen) { - @export(Request.constructor, .{ .name = "RequestClass__construct" }); - @export(Request.doClone, .{ .name = "RequestPrototype__doClone" }); - @export(Request.estimatedSize, .{ .name = "Request__estimatedSize" }); - @export(Request.finalize, .{ .name = "RequestClass__finalize" }); - @export(Request.getArrayBuffer, .{ .name = "RequestPrototype__getArrayBuffer" }); - @export(Request.getBlob, .{ .name = "RequestPrototype__getBlob" }); - @export(Request.getBody, .{ .name = "RequestPrototype__getBody" }); - @export(Request.getBodyUsed, .{ .name = "RequestPrototype__getBodyUsed" }); - @export(Request.getCache, .{ .name = "RequestPrototype__getCache" }); - @export(Request.getCredentials, .{ .name = "RequestPrototype__getCredentials" }); - @export(Request.getDestination, .{ .name = "RequestPrototype__getDestination" }); - @export(Request.getFormData, .{ .name = "RequestPrototype__getFormData" }); - @export(Request.getHeaders, .{ .name = "RequestPrototype__getHeaders" }); - @export(Request.getIntegrity, .{ .name = "RequestPrototype__getIntegrity" }); - @export(Request.getJSON, .{ .name = "RequestPrototype__getJSON" }); - @export(Request.getMethod, .{ .name = "RequestPrototype__getMethod" }); - @export(Request.getMode, .{ .name = "RequestPrototype__getMode" }); - @export(Request.getRedirect, .{ .name = "RequestPrototype__getRedirect" }); - @export(Request.getReferrer, .{ .name = "RequestPrototype__getReferrer" }); - @export(Request.getReferrerPolicy, .{ .name = "RequestPrototype__getReferrerPolicy" }); - @export(Request.getSignal, .{ .name = "RequestPrototype__getSignal" }); - @export(Request.getText, .{ .name = "RequestPrototype__getText" }); - @export(Request.getUrl, .{ .name = "RequestPrototype__getUrl" }); - } - } -}; -pub const JSResolveMessage = struct { - const ResolveMessage = Classes.ResolveMessage; - const GetterType = fn (*ResolveMessage, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*ResolveMessage, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*ResolveMessage, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*ResolveMessage, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*ResolveMessage, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*ResolveMessage { - JSC.markBinding(@src()); - return ResolveMessage__fromJS(value); - } - - extern fn ResolveMessagePrototype__codeSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ResolveMessagePrototype__codeGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `ResolveMessage.code` setter - /// This value will be visited by the garbage collector. - pub fn codeSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ResolveMessagePrototype__codeSetCachedValue(thisValue, globalObject, value); - } - - /// `ResolveMessage.code` getter - /// This value will be visited by the garbage collector. - pub fn codeGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ResolveMessagePrototype__codeGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn ResolveMessagePrototype__importKindSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ResolveMessagePrototype__importKindGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `ResolveMessage.importKind` setter - /// This value will be visited by the garbage collector. - pub fn importKindSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ResolveMessagePrototype__importKindSetCachedValue(thisValue, globalObject, value); - } - - /// `ResolveMessage.importKind` getter - /// This value will be visited by the garbage collector. - pub fn importKindGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ResolveMessagePrototype__importKindGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn ResolveMessagePrototype__levelSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ResolveMessagePrototype__levelGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `ResolveMessage.level` setter - /// This value will be visited by the garbage collector. - pub fn levelSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ResolveMessagePrototype__levelSetCachedValue(thisValue, globalObject, value); - } - - /// `ResolveMessage.level` getter - /// This value will be visited by the garbage collector. - pub fn levelGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ResolveMessagePrototype__levelGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn ResolveMessagePrototype__messageSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ResolveMessagePrototype__messageGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `ResolveMessage.message` setter - /// This value will be visited by the garbage collector. - pub fn messageSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ResolveMessagePrototype__messageSetCachedValue(thisValue, globalObject, value); - } - - /// `ResolveMessage.message` getter - /// This value will be visited by the garbage collector. - pub fn messageGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ResolveMessagePrototype__messageGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn ResolveMessagePrototype__positionSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ResolveMessagePrototype__positionGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `ResolveMessage.position` setter - /// This value will be visited by the garbage collector. - pub fn positionSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ResolveMessagePrototype__positionSetCachedValue(thisValue, globalObject, value); - } - - /// `ResolveMessage.position` getter - /// This value will be visited by the garbage collector. - pub fn positionGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ResolveMessagePrototype__positionGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn ResolveMessagePrototype__referrerSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ResolveMessagePrototype__referrerGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `ResolveMessage.referrer` setter - /// This value will be visited by the garbage collector. - pub fn referrerSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ResolveMessagePrototype__referrerSetCachedValue(thisValue, globalObject, value); - } - - /// `ResolveMessage.referrer` getter - /// This value will be visited by the garbage collector. - pub fn referrerGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ResolveMessagePrototype__referrerGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn ResolveMessagePrototype__specifierSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ResolveMessagePrototype__specifierGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `ResolveMessage.specifier` setter - /// This value will be visited by the garbage collector. - pub fn specifierSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ResolveMessagePrototype__specifierSetCachedValue(thisValue, globalObject, value); - } - - /// `ResolveMessage.specifier` getter - /// This value will be visited by the garbage collector. - pub fn specifierGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ResolveMessagePrototype__specifierGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Get the ResolveMessage constructor value. - /// This loads lazily from the global object. - pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - return ResolveMessage__getConstructor(globalObject); - } - - /// Create a new instance of ResolveMessage - pub fn toJS(this: *ResolveMessage, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = ResolveMessage__create(globalObject, this); - std.debug.assert(value__.as(ResolveMessage).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return ResolveMessage__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of ResolveMessage. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*ResolveMessage) bool { - JSC.markBinding(@src()); - return ResolveMessage__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *ResolveMessage, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(ResolveMessage__dangerouslySetPtr(value, null)); - } - - extern fn ResolveMessage__fromJS(JSC.JSValue) ?*ResolveMessage; - extern fn ResolveMessage__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn ResolveMessage__create(globalObject: *JSC.JSGlobalObject, ptr: ?*ResolveMessage) JSC.JSValue; - - extern fn ResolveMessage__dangerouslySetPtr(JSC.JSValue, ?*ResolveMessage) bool; - - comptime { - if (@TypeOf(ResolveMessage.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*ResolveMessage)) { - @compileLog("ResolveMessage.constructor is not a constructor"); - } - - if (@TypeOf(ResolveMessage.finalize) != (fn (*ResolveMessage) callconv(.C) void)) { - @compileLog("ResolveMessage.finalize is not a finalizer"); - } - - if (@TypeOf(ResolveMessage.toPrimitive) != CallbackType) - @compileLog("Expected ResolveMessage.toPrimitive to be a callback but received " ++ @typeName(@TypeOf(ResolveMessage.toPrimitive))); - if (@TypeOf(ResolveMessage.getCode) != GetterType) - @compileLog("Expected ResolveMessage.getCode to be a getter"); - - if (@TypeOf(ResolveMessage.getImportKind) != GetterType) - @compileLog("Expected ResolveMessage.getImportKind to be a getter"); - - if (@TypeOf(ResolveMessage.getLevel) != GetterType) - @compileLog("Expected ResolveMessage.getLevel to be a getter"); - - if (@TypeOf(ResolveMessage.getMessage) != GetterType) - @compileLog("Expected ResolveMessage.getMessage to be a getter"); - - if (@TypeOf(ResolveMessage.getPosition) != GetterType) - @compileLog("Expected ResolveMessage.getPosition to be a getter"); - - if (@TypeOf(ResolveMessage.getReferrer) != GetterType) - @compileLog("Expected ResolveMessage.getReferrer to be a getter"); - - if (@TypeOf(ResolveMessage.getSpecifier) != GetterType) - @compileLog("Expected ResolveMessage.getSpecifier to be a getter"); - - if (@TypeOf(ResolveMessage.toJSON) != CallbackType) - @compileLog("Expected ResolveMessage.toJSON to be a callback but received " ++ @typeName(@TypeOf(ResolveMessage.toJSON))); - if (@TypeOf(ResolveMessage.toString) != CallbackType) - @compileLog("Expected ResolveMessage.toString to be a callback but received " ++ @typeName(@TypeOf(ResolveMessage.toString))); - if (!JSC.is_bindgen) { - @export(ResolveMessage.constructor, .{ .name = "ResolveMessageClass__construct" }); - @export(ResolveMessage.finalize, .{ .name = "ResolveMessageClass__finalize" }); - @export(ResolveMessage.getCode, .{ .name = "ResolveMessagePrototype__getCode" }); - @export(ResolveMessage.getImportKind, .{ .name = "ResolveMessagePrototype__getImportKind" }); - @export(ResolveMessage.getLevel, .{ .name = "ResolveMessagePrototype__getLevel" }); - @export(ResolveMessage.getMessage, .{ .name = "ResolveMessagePrototype__getMessage" }); - @export(ResolveMessage.getPosition, .{ .name = "ResolveMessagePrototype__getPosition" }); - @export(ResolveMessage.getReferrer, .{ .name = "ResolveMessagePrototype__getReferrer" }); - @export(ResolveMessage.getSpecifier, .{ .name = "ResolveMessagePrototype__getSpecifier" }); - @export(ResolveMessage.toJSON, .{ .name = "ResolveMessagePrototype__toJSON" }); - @export(ResolveMessage.toPrimitive, .{ .name = "ResolveMessagePrototype__toPrimitive" }); - @export(ResolveMessage.toString, .{ .name = "ResolveMessagePrototype__toString" }); - } - } -}; -pub const JSResponse = struct { - const Response = Classes.Response; - const GetterType = fn (*Response, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*Response, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*Response, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*Response, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*Response, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*Response { - JSC.markBinding(@src()); - return Response__fromJS(value); - } - - extern fn ResponsePrototype__bodySetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ResponsePrototype__bodyGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Response.body` setter - /// This value will be visited by the garbage collector. - pub fn bodySetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ResponsePrototype__bodySetCachedValue(thisValue, globalObject, value); - } - - /// `Response.body` getter - /// This value will be visited by the garbage collector. - pub fn bodyGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ResponsePrototype__bodyGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn ResponsePrototype__headersSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ResponsePrototype__headersGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Response.headers` setter - /// This value will be visited by the garbage collector. - pub fn headersSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ResponsePrototype__headersSetCachedValue(thisValue, globalObject, value); - } - - /// `Response.headers` getter - /// This value will be visited by the garbage collector. - pub fn headersGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ResponsePrototype__headersGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn ResponsePrototype__statusTextSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ResponsePrototype__statusTextGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Response.statusText` setter - /// This value will be visited by the garbage collector. - pub fn statusTextSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ResponsePrototype__statusTextSetCachedValue(thisValue, globalObject, value); - } - - /// `Response.statusText` getter - /// This value will be visited by the garbage collector. - pub fn statusTextGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ResponsePrototype__statusTextGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn ResponsePrototype__urlSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ResponsePrototype__urlGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Response.url` setter - /// This value will be visited by the garbage collector. - pub fn urlSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ResponsePrototype__urlSetCachedValue(thisValue, globalObject, value); - } - - /// `Response.url` getter - /// This value will be visited by the garbage collector. - pub fn urlGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ResponsePrototype__urlGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Get the Response constructor value. - /// This loads lazily from the global object. - pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - return Response__getConstructor(globalObject); - } - - /// Create a new instance of Response - pub fn toJS(this: *Response, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = Response__create(globalObject, this); - std.debug.assert(value__.as(Response).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return Response__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of Response. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Response) bool { - JSC.markBinding(@src()); - return Response__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *Response, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(Response__dangerouslySetPtr(value, null)); - } - - extern fn Response__fromJS(JSC.JSValue) ?*Response; - extern fn Response__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn Response__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Response) JSC.JSValue; - - extern fn Response__dangerouslySetPtr(JSC.JSValue, ?*Response) bool; - - comptime { - if (@TypeOf(Response.estimatedSize) != (fn (*Response) callconv(.C) usize)) { - @compileLog("Response.estimatedSize is not a size function"); - } - - if (@TypeOf(Response.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Response)) { - @compileLog("Response.constructor is not a constructor"); - } - - if (@TypeOf(Response.finalize) != (fn (*Response) callconv(.C) void)) { - @compileLog("Response.finalize is not a finalizer"); - } - - if (@TypeOf(Response.getArrayBuffer) != CallbackType) - @compileLog("Expected Response.getArrayBuffer to be a callback but received " ++ @typeName(@TypeOf(Response.getArrayBuffer))); - if (@TypeOf(Response.getBlob) != CallbackType) - @compileLog("Expected Response.getBlob to be a callback but received " ++ @typeName(@TypeOf(Response.getBlob))); - if (@TypeOf(Response.getBody) != GetterType) - @compileLog("Expected Response.getBody to be a getter"); - - if (@TypeOf(Response.getBodyUsed) != GetterType) - @compileLog("Expected Response.getBodyUsed to be a getter"); - - if (@TypeOf(Response.doClone) != CallbackType) - @compileLog("Expected Response.doClone to be a callback but received " ++ @typeName(@TypeOf(Response.doClone))); - if (@TypeOf(Response.getFormData) != CallbackType) - @compileLog("Expected Response.getFormData to be a callback but received " ++ @typeName(@TypeOf(Response.getFormData))); - if (@TypeOf(Response.getHeaders) != GetterType) - @compileLog("Expected Response.getHeaders to be a getter"); - - if (@TypeOf(Response.getJSON) != CallbackType) - @compileLog("Expected Response.getJSON to be a callback but received " ++ @typeName(@TypeOf(Response.getJSON))); - if (@TypeOf(Response.getOK) != GetterType) - @compileLog("Expected Response.getOK to be a getter"); - - if (@TypeOf(Response.getRedirected) != GetterType) - @compileLog("Expected Response.getRedirected to be a getter"); - - if (@TypeOf(Response.getStatus) != GetterType) - @compileLog("Expected Response.getStatus to be a getter"); - - if (@TypeOf(Response.getStatusText) != GetterType) - @compileLog("Expected Response.getStatusText to be a getter"); - - if (@TypeOf(Response.getText) != CallbackType) - @compileLog("Expected Response.getText to be a callback but received " ++ @typeName(@TypeOf(Response.getText))); - if (@TypeOf(Response.getResponseType) != GetterType) - @compileLog("Expected Response.getResponseType to be a getter"); - - if (@TypeOf(Response.getURL) != GetterType) - @compileLog("Expected Response.getURL to be a getter"); - - if (@TypeOf(Response.constructError) != StaticCallbackType) - @compileLog("Expected Response.constructError to be a static callback"); - if (@TypeOf(Response.constructJSON) != StaticCallbackType) - @compileLog("Expected Response.constructJSON to be a static callback"); - if (@TypeOf(Response.constructRedirect) != StaticCallbackType) - @compileLog("Expected Response.constructRedirect to be a static callback"); - if (!JSC.is_bindgen) { - @export(Response.constructError, .{ .name = "ResponseClass__constructError" }); - @export(Response.constructJSON, .{ .name = "ResponseClass__constructJSON" }); - @export(Response.constructor, .{ .name = "ResponseClass__construct" }); - @export(Response.constructRedirect, .{ .name = "ResponseClass__constructRedirect" }); - @export(Response.doClone, .{ .name = "ResponsePrototype__doClone" }); - @export(Response.estimatedSize, .{ .name = "Response__estimatedSize" }); - @export(Response.finalize, .{ .name = "ResponseClass__finalize" }); - @export(Response.getArrayBuffer, .{ .name = "ResponsePrototype__getArrayBuffer" }); - @export(Response.getBlob, .{ .name = "ResponsePrototype__getBlob" }); - @export(Response.getBody, .{ .name = "ResponsePrototype__getBody" }); - @export(Response.getBodyUsed, .{ .name = "ResponsePrototype__getBodyUsed" }); - @export(Response.getFormData, .{ .name = "ResponsePrototype__getFormData" }); - @export(Response.getHeaders, .{ .name = "ResponsePrototype__getHeaders" }); - @export(Response.getJSON, .{ .name = "ResponsePrototype__getJSON" }); - @export(Response.getOK, .{ .name = "ResponsePrototype__getOK" }); - @export(Response.getRedirected, .{ .name = "ResponsePrototype__getRedirected" }); - @export(Response.getResponseType, .{ .name = "ResponsePrototype__getResponseType" }); - @export(Response.getStatus, .{ .name = "ResponsePrototype__getStatus" }); - @export(Response.getStatusText, .{ .name = "ResponsePrototype__getStatusText" }); - @export(Response.getText, .{ .name = "ResponsePrototype__getText" }); - @export(Response.getURL, .{ .name = "ResponsePrototype__getURL" }); - } - } -}; -pub const JSSHA1 = struct { - const SHA1 = Classes.SHA1; - const GetterType = fn (*SHA1, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*SHA1, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*SHA1, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*SHA1, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*SHA1, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*SHA1 { - JSC.markBinding(@src()); - return SHA1__fromJS(value); - } - - /// Get the SHA1 constructor value. - /// This loads lazily from the global object. - pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - return SHA1__getConstructor(globalObject); - } - - /// Create a new instance of SHA1 - pub fn toJS(this: *SHA1, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = SHA1__create(globalObject, this); - std.debug.assert(value__.as(SHA1).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return SHA1__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of SHA1. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*SHA1) bool { - JSC.markBinding(@src()); - return SHA1__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *SHA1, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(SHA1__dangerouslySetPtr(value, null)); - } - - extern fn SHA1__fromJS(JSC.JSValue) ?*SHA1; - extern fn SHA1__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn SHA1__create(globalObject: *JSC.JSGlobalObject, ptr: ?*SHA1) JSC.JSValue; - - extern fn SHA1__dangerouslySetPtr(JSC.JSValue, ?*SHA1) bool; - - comptime { - if (@TypeOf(SHA1.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA1)) { - @compileLog("SHA1.constructor is not a constructor"); - } - - if (@TypeOf(SHA1.finalize) != (fn (*SHA1) callconv(.C) void)) { - @compileLog("SHA1.finalize is not a finalizer"); - } - - if (@TypeOf(SHA1.getByteLength) != GetterType) - @compileLog("Expected SHA1.getByteLength to be a getter"); - - if (@TypeOf(SHA1.digest) != CallbackType) - @compileLog("Expected SHA1.digest to be a callback but received " ++ @typeName(@TypeOf(SHA1.digest))); - if (@TypeOf(SHA1.update) != CallbackType) - @compileLog("Expected SHA1.update to be a callback but received " ++ @typeName(@TypeOf(SHA1.update))); - if (@TypeOf(SHA1.getByteLengthStatic) != StaticGetterType) - @compileLog("Expected SHA1.getByteLengthStatic to be a static getter"); - - if (@TypeOf(SHA1.hash) != StaticCallbackType) - @compileLog("Expected SHA1.hash to be a static callback"); - if (!JSC.is_bindgen) { - @export(SHA1.constructor, .{ .name = "SHA1Class__construct" }); - @export(SHA1.digest, .{ .name = "SHA1Prototype__digest" }); - @export(SHA1.finalize, .{ .name = "SHA1Class__finalize" }); - @export(SHA1.getByteLength, .{ .name = "SHA1Prototype__getByteLength" }); - @export(SHA1.getByteLengthStatic, .{ .name = "SHA1Class__getByteLengthStatic" }); - @export(SHA1.hash, .{ .name = "SHA1Class__hash" }); - @export(SHA1.update, .{ .name = "SHA1Prototype__update" }); - } - } -}; -pub const JSSHA224 = struct { - const SHA224 = Classes.SHA224; - const GetterType = fn (*SHA224, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*SHA224, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*SHA224, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*SHA224, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*SHA224, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*SHA224 { - JSC.markBinding(@src()); - return SHA224__fromJS(value); - } - - /// Get the SHA224 constructor value. - /// This loads lazily from the global object. - pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - return SHA224__getConstructor(globalObject); - } - - /// Create a new instance of SHA224 - pub fn toJS(this: *SHA224, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = SHA224__create(globalObject, this); - std.debug.assert(value__.as(SHA224).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return SHA224__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of SHA224. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*SHA224) bool { - JSC.markBinding(@src()); - return SHA224__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *SHA224, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(SHA224__dangerouslySetPtr(value, null)); - } - - extern fn SHA224__fromJS(JSC.JSValue) ?*SHA224; - extern fn SHA224__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn SHA224__create(globalObject: *JSC.JSGlobalObject, ptr: ?*SHA224) JSC.JSValue; - - extern fn SHA224__dangerouslySetPtr(JSC.JSValue, ?*SHA224) bool; - - comptime { - if (@TypeOf(SHA224.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA224)) { - @compileLog("SHA224.constructor is not a constructor"); - } - - if (@TypeOf(SHA224.finalize) != (fn (*SHA224) callconv(.C) void)) { - @compileLog("SHA224.finalize is not a finalizer"); - } - - if (@TypeOf(SHA224.getByteLength) != GetterType) - @compileLog("Expected SHA224.getByteLength to be a getter"); - - if (@TypeOf(SHA224.digest) != CallbackType) - @compileLog("Expected SHA224.digest to be a callback but received " ++ @typeName(@TypeOf(SHA224.digest))); - if (@TypeOf(SHA224.update) != CallbackType) - @compileLog("Expected SHA224.update to be a callback but received " ++ @typeName(@TypeOf(SHA224.update))); - if (@TypeOf(SHA224.getByteLengthStatic) != StaticGetterType) - @compileLog("Expected SHA224.getByteLengthStatic to be a static getter"); - - if (@TypeOf(SHA224.hash) != StaticCallbackType) - @compileLog("Expected SHA224.hash to be a static callback"); - if (!JSC.is_bindgen) { - @export(SHA224.constructor, .{ .name = "SHA224Class__construct" }); - @export(SHA224.digest, .{ .name = "SHA224Prototype__digest" }); - @export(SHA224.finalize, .{ .name = "SHA224Class__finalize" }); - @export(SHA224.getByteLength, .{ .name = "SHA224Prototype__getByteLength" }); - @export(SHA224.getByteLengthStatic, .{ .name = "SHA224Class__getByteLengthStatic" }); - @export(SHA224.hash, .{ .name = "SHA224Class__hash" }); - @export(SHA224.update, .{ .name = "SHA224Prototype__update" }); - } - } -}; -pub const JSSHA256 = struct { - const SHA256 = Classes.SHA256; - const GetterType = fn (*SHA256, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*SHA256, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*SHA256, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*SHA256, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*SHA256, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*SHA256 { - JSC.markBinding(@src()); - return SHA256__fromJS(value); - } - - /// Get the SHA256 constructor value. - /// This loads lazily from the global object. - pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - return SHA256__getConstructor(globalObject); - } - - /// Create a new instance of SHA256 - pub fn toJS(this: *SHA256, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = SHA256__create(globalObject, this); - std.debug.assert(value__.as(SHA256).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return SHA256__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of SHA256. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*SHA256) bool { - JSC.markBinding(@src()); - return SHA256__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *SHA256, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(SHA256__dangerouslySetPtr(value, null)); - } - - extern fn SHA256__fromJS(JSC.JSValue) ?*SHA256; - extern fn SHA256__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn SHA256__create(globalObject: *JSC.JSGlobalObject, ptr: ?*SHA256) JSC.JSValue; - - extern fn SHA256__dangerouslySetPtr(JSC.JSValue, ?*SHA256) bool; - - comptime { - if (@TypeOf(SHA256.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA256)) { - @compileLog("SHA256.constructor is not a constructor"); - } - - if (@TypeOf(SHA256.finalize) != (fn (*SHA256) callconv(.C) void)) { - @compileLog("SHA256.finalize is not a finalizer"); - } - - if (@TypeOf(SHA256.getByteLength) != GetterType) - @compileLog("Expected SHA256.getByteLength to be a getter"); - - if (@TypeOf(SHA256.digest) != CallbackType) - @compileLog("Expected SHA256.digest to be a callback but received " ++ @typeName(@TypeOf(SHA256.digest))); - if (@TypeOf(SHA256.update) != CallbackType) - @compileLog("Expected SHA256.update to be a callback but received " ++ @typeName(@TypeOf(SHA256.update))); - if (@TypeOf(SHA256.getByteLengthStatic) != StaticGetterType) - @compileLog("Expected SHA256.getByteLengthStatic to be a static getter"); - - if (@TypeOf(SHA256.hash) != StaticCallbackType) - @compileLog("Expected SHA256.hash to be a static callback"); - if (!JSC.is_bindgen) { - @export(SHA256.constructor, .{ .name = "SHA256Class__construct" }); - @export(SHA256.digest, .{ .name = "SHA256Prototype__digest" }); - @export(SHA256.finalize, .{ .name = "SHA256Class__finalize" }); - @export(SHA256.getByteLength, .{ .name = "SHA256Prototype__getByteLength" }); - @export(SHA256.getByteLengthStatic, .{ .name = "SHA256Class__getByteLengthStatic" }); - @export(SHA256.hash, .{ .name = "SHA256Class__hash" }); - @export(SHA256.update, .{ .name = "SHA256Prototype__update" }); - } - } -}; -pub const JSSHA384 = struct { - const SHA384 = Classes.SHA384; - const GetterType = fn (*SHA384, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*SHA384, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*SHA384, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*SHA384, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*SHA384, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*SHA384 { - JSC.markBinding(@src()); - return SHA384__fromJS(value); - } - - /// Get the SHA384 constructor value. - /// This loads lazily from the global object. - pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - return SHA384__getConstructor(globalObject); - } - - /// Create a new instance of SHA384 - pub fn toJS(this: *SHA384, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = SHA384__create(globalObject, this); - std.debug.assert(value__.as(SHA384).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return SHA384__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of SHA384. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*SHA384) bool { - JSC.markBinding(@src()); - return SHA384__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *SHA384, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(SHA384__dangerouslySetPtr(value, null)); - } - - extern fn SHA384__fromJS(JSC.JSValue) ?*SHA384; - extern fn SHA384__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn SHA384__create(globalObject: *JSC.JSGlobalObject, ptr: ?*SHA384) JSC.JSValue; - - extern fn SHA384__dangerouslySetPtr(JSC.JSValue, ?*SHA384) bool; - - comptime { - if (@TypeOf(SHA384.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA384)) { - @compileLog("SHA384.constructor is not a constructor"); - } - - if (@TypeOf(SHA384.finalize) != (fn (*SHA384) callconv(.C) void)) { - @compileLog("SHA384.finalize is not a finalizer"); - } - - if (@TypeOf(SHA384.getByteLength) != GetterType) - @compileLog("Expected SHA384.getByteLength to be a getter"); - - if (@TypeOf(SHA384.digest) != CallbackType) - @compileLog("Expected SHA384.digest to be a callback but received " ++ @typeName(@TypeOf(SHA384.digest))); - if (@TypeOf(SHA384.update) != CallbackType) - @compileLog("Expected SHA384.update to be a callback but received " ++ @typeName(@TypeOf(SHA384.update))); - if (@TypeOf(SHA384.getByteLengthStatic) != StaticGetterType) - @compileLog("Expected SHA384.getByteLengthStatic to be a static getter"); - - if (@TypeOf(SHA384.hash) != StaticCallbackType) - @compileLog("Expected SHA384.hash to be a static callback"); - if (!JSC.is_bindgen) { - @export(SHA384.constructor, .{ .name = "SHA384Class__construct" }); - @export(SHA384.digest, .{ .name = "SHA384Prototype__digest" }); - @export(SHA384.finalize, .{ .name = "SHA384Class__finalize" }); - @export(SHA384.getByteLength, .{ .name = "SHA384Prototype__getByteLength" }); - @export(SHA384.getByteLengthStatic, .{ .name = "SHA384Class__getByteLengthStatic" }); - @export(SHA384.hash, .{ .name = "SHA384Class__hash" }); - @export(SHA384.update, .{ .name = "SHA384Prototype__update" }); - } - } -}; -pub const JSSHA512 = struct { - const SHA512 = Classes.SHA512; - const GetterType = fn (*SHA512, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*SHA512, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*SHA512, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*SHA512, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*SHA512, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*SHA512 { - JSC.markBinding(@src()); - return SHA512__fromJS(value); - } - - /// Get the SHA512 constructor value. - /// This loads lazily from the global object. - pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - return SHA512__getConstructor(globalObject); - } - - /// Create a new instance of SHA512 - pub fn toJS(this: *SHA512, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = SHA512__create(globalObject, this); - std.debug.assert(value__.as(SHA512).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return SHA512__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of SHA512. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*SHA512) bool { - JSC.markBinding(@src()); - return SHA512__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *SHA512, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(SHA512__dangerouslySetPtr(value, null)); - } - - extern fn SHA512__fromJS(JSC.JSValue) ?*SHA512; - extern fn SHA512__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn SHA512__create(globalObject: *JSC.JSGlobalObject, ptr: ?*SHA512) JSC.JSValue; - - extern fn SHA512__dangerouslySetPtr(JSC.JSValue, ?*SHA512) bool; - - comptime { - if (@TypeOf(SHA512.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA512)) { - @compileLog("SHA512.constructor is not a constructor"); - } - - if (@TypeOf(SHA512.finalize) != (fn (*SHA512) callconv(.C) void)) { - @compileLog("SHA512.finalize is not a finalizer"); - } - - if (@TypeOf(SHA512.getByteLength) != GetterType) - @compileLog("Expected SHA512.getByteLength to be a getter"); - - if (@TypeOf(SHA512.digest) != CallbackType) - @compileLog("Expected SHA512.digest to be a callback but received " ++ @typeName(@TypeOf(SHA512.digest))); - if (@TypeOf(SHA512.update) != CallbackType) - @compileLog("Expected SHA512.update to be a callback but received " ++ @typeName(@TypeOf(SHA512.update))); - if (@TypeOf(SHA512.getByteLengthStatic) != StaticGetterType) - @compileLog("Expected SHA512.getByteLengthStatic to be a static getter"); - - if (@TypeOf(SHA512.hash) != StaticCallbackType) - @compileLog("Expected SHA512.hash to be a static callback"); - if (!JSC.is_bindgen) { - @export(SHA512.constructor, .{ .name = "SHA512Class__construct" }); - @export(SHA512.digest, .{ .name = "SHA512Prototype__digest" }); - @export(SHA512.finalize, .{ .name = "SHA512Class__finalize" }); - @export(SHA512.getByteLength, .{ .name = "SHA512Prototype__getByteLength" }); - @export(SHA512.getByteLengthStatic, .{ .name = "SHA512Class__getByteLengthStatic" }); - @export(SHA512.hash, .{ .name = "SHA512Class__hash" }); - @export(SHA512.update, .{ .name = "SHA512Prototype__update" }); - } - } -}; -pub const JSSHA512_256 = struct { - const SHA512_256 = Classes.SHA512_256; - const GetterType = fn (*SHA512_256, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*SHA512_256, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*SHA512_256, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*SHA512_256, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*SHA512_256, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*SHA512_256 { - JSC.markBinding(@src()); - return SHA512_256__fromJS(value); - } - - /// Get the SHA512_256 constructor value. - /// This loads lazily from the global object. - pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - return SHA512_256__getConstructor(globalObject); - } - - /// Create a new instance of SHA512_256 - pub fn toJS(this: *SHA512_256, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = SHA512_256__create(globalObject, this); - std.debug.assert(value__.as(SHA512_256).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return SHA512_256__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of SHA512_256. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*SHA512_256) bool { - JSC.markBinding(@src()); - return SHA512_256__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *SHA512_256, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(SHA512_256__dangerouslySetPtr(value, null)); - } - - extern fn SHA512_256__fromJS(JSC.JSValue) ?*SHA512_256; - extern fn SHA512_256__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn SHA512_256__create(globalObject: *JSC.JSGlobalObject, ptr: ?*SHA512_256) JSC.JSValue; - - extern fn SHA512_256__dangerouslySetPtr(JSC.JSValue, ?*SHA512_256) bool; - - comptime { - if (@TypeOf(SHA512_256.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA512_256)) { - @compileLog("SHA512_256.constructor is not a constructor"); - } - - if (@TypeOf(SHA512_256.finalize) != (fn (*SHA512_256) callconv(.C) void)) { - @compileLog("SHA512_256.finalize is not a finalizer"); - } - - if (@TypeOf(SHA512_256.getByteLength) != GetterType) - @compileLog("Expected SHA512_256.getByteLength to be a getter"); - - if (@TypeOf(SHA512_256.digest) != CallbackType) - @compileLog("Expected SHA512_256.digest to be a callback but received " ++ @typeName(@TypeOf(SHA512_256.digest))); - if (@TypeOf(SHA512_256.update) != CallbackType) - @compileLog("Expected SHA512_256.update to be a callback but received " ++ @typeName(@TypeOf(SHA512_256.update))); - if (@TypeOf(SHA512_256.getByteLengthStatic) != StaticGetterType) - @compileLog("Expected SHA512_256.getByteLengthStatic to be a static getter"); - - if (@TypeOf(SHA512_256.hash) != StaticCallbackType) - @compileLog("Expected SHA512_256.hash to be a static callback"); - if (!JSC.is_bindgen) { - @export(SHA512_256.constructor, .{ .name = "SHA512_256Class__construct" }); - @export(SHA512_256.digest, .{ .name = "SHA512_256Prototype__digest" }); - @export(SHA512_256.finalize, .{ .name = "SHA512_256Class__finalize" }); - @export(SHA512_256.getByteLength, .{ .name = "SHA512_256Prototype__getByteLength" }); - @export(SHA512_256.getByteLengthStatic, .{ .name = "SHA512_256Class__getByteLengthStatic" }); - @export(SHA512_256.hash, .{ .name = "SHA512_256Class__hash" }); - @export(SHA512_256.update, .{ .name = "SHA512_256Prototype__update" }); - } - } -}; -pub const JSServerWebSocket = struct { - const ServerWebSocket = Classes.ServerWebSocket; - const GetterType = fn (*ServerWebSocket, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*ServerWebSocket, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*ServerWebSocket, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*ServerWebSocket, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*ServerWebSocket, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*ServerWebSocket { - JSC.markBinding(@src()); - return ServerWebSocket__fromJS(value); - } - - extern fn ServerWebSocketPrototype__dataSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ServerWebSocketPrototype__dataGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `ServerWebSocket.data` setter - /// This value will be visited by the garbage collector. - pub fn dataSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ServerWebSocketPrototype__dataSetCachedValue(thisValue, globalObject, value); - } - - /// `ServerWebSocket.data` getter - /// This value will be visited by the garbage collector. - pub fn dataGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ServerWebSocketPrototype__dataGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn ServerWebSocketPrototype__remoteAddressSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ServerWebSocketPrototype__remoteAddressGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `ServerWebSocket.remoteAddress` setter - /// This value will be visited by the garbage collector. - pub fn remoteAddressSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ServerWebSocketPrototype__remoteAddressSetCachedValue(thisValue, globalObject, value); - } - - /// `ServerWebSocket.remoteAddress` getter - /// This value will be visited by the garbage collector. - pub fn remoteAddressGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ServerWebSocketPrototype__remoteAddressGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Get the ServerWebSocket constructor value. - /// This loads lazily from the global object. - pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - return ServerWebSocket__getConstructor(globalObject); - } - - /// Create a new instance of ServerWebSocket - pub fn toJS(this: *ServerWebSocket, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = ServerWebSocket__create(globalObject, this); - std.debug.assert(value__.as(ServerWebSocket).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return ServerWebSocket__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of ServerWebSocket. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*ServerWebSocket) bool { - JSC.markBinding(@src()); - return ServerWebSocket__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *ServerWebSocket, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(ServerWebSocket__dangerouslySetPtr(value, null)); - } - - extern fn ServerWebSocket__fromJS(JSC.JSValue) ?*ServerWebSocket; - extern fn ServerWebSocket__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn ServerWebSocket__create(globalObject: *JSC.JSGlobalObject, ptr: ?*ServerWebSocket) JSC.JSValue; - - extern fn ServerWebSocket__dangerouslySetPtr(JSC.JSValue, ?*ServerWebSocket) bool; - - comptime { - if (@TypeOf(ServerWebSocket.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*ServerWebSocket)) { - @compileLog("ServerWebSocket.constructor is not a constructor"); - } - - if (@TypeOf(ServerWebSocket.finalize) != (fn (*ServerWebSocket) callconv(.C) void)) { - @compileLog("ServerWebSocket.finalize is not a finalizer"); - } - - if (@TypeOf(ServerWebSocket.getBinaryType) != GetterType) - @compileLog("Expected ServerWebSocket.getBinaryType to be a getter"); - - if (@TypeOf(ServerWebSocket.setBinaryType) != SetterType) - @compileLog("Expected ServerWebSocket.setBinaryType to be a setter"); - if (@TypeOf(ServerWebSocket.close) != CallbackType) - @compileLog("Expected ServerWebSocket.close to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.close))); - if (@TypeOf(ServerWebSocket.cork) != CallbackType) - @compileLog("Expected ServerWebSocket.cork to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.cork))); - if (@TypeOf(ServerWebSocket.getData) != GetterType) - @compileLog("Expected ServerWebSocket.getData to be a getter"); - - if (@TypeOf(ServerWebSocket.setData) != SetterType) - @compileLog("Expected ServerWebSocket.setData to be a setter"); - if (@TypeOf(ServerWebSocket.getBufferedAmount) != CallbackType) - @compileLog("Expected ServerWebSocket.getBufferedAmount to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.getBufferedAmount))); - if (@TypeOf(ServerWebSocket.isSubscribed) != CallbackType) - @compileLog("Expected ServerWebSocket.isSubscribed to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.isSubscribed))); - if (@TypeOf(ServerWebSocket.ping) != CallbackType) - @compileLog("Expected ServerWebSocket.ping to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.ping))); - if (@TypeOf(ServerWebSocket.pong) != CallbackType) - @compileLog("Expected ServerWebSocket.pong to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.pong))); - if (@TypeOf(ServerWebSocket.publish) != CallbackType) - @compileLog("Expected ServerWebSocket.publish to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.publish))); - if (@TypeOf(ServerWebSocket.publishBinaryWithoutTypeChecks) != fn (*ServerWebSocket, *JSC.JSGlobalObject, *JSC.JSString, *JSC.JSUint8Array) callconv(.C) JSC.JSValue) - @compileLog("Expected ServerWebSocket.publishBinaryWithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(ServerWebSocket.publishBinary) != CallbackType) - @compileLog("Expected ServerWebSocket.publishBinary to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.publishBinary))); - if (@TypeOf(ServerWebSocket.publishTextWithoutTypeChecks) != fn (*ServerWebSocket, *JSC.JSGlobalObject, *JSC.JSString, *JSC.JSString) callconv(.C) JSC.JSValue) - @compileLog("Expected ServerWebSocket.publishTextWithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(ServerWebSocket.publishText) != CallbackType) - @compileLog("Expected ServerWebSocket.publishText to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.publishText))); - if (@TypeOf(ServerWebSocket.getReadyState) != GetterType) - @compileLog("Expected ServerWebSocket.getReadyState to be a getter"); - - if (@TypeOf(ServerWebSocket.getRemoteAddress) != GetterType) - @compileLog("Expected ServerWebSocket.getRemoteAddress to be a getter"); - - if (@TypeOf(ServerWebSocket.send) != CallbackType) - @compileLog("Expected ServerWebSocket.send to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.send))); - if (@TypeOf(ServerWebSocket.sendBinaryWithoutTypeChecks) != fn (*ServerWebSocket, *JSC.JSGlobalObject, *JSC.JSUint8Array, bool) callconv(.C) JSC.JSValue) - @compileLog("Expected ServerWebSocket.sendBinaryWithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(ServerWebSocket.sendBinary) != CallbackType) - @compileLog("Expected ServerWebSocket.sendBinary to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.sendBinary))); - if (@TypeOf(ServerWebSocket.sendTextWithoutTypeChecks) != fn (*ServerWebSocket, *JSC.JSGlobalObject, *JSC.JSString, bool) callconv(.C) JSC.JSValue) - @compileLog("Expected ServerWebSocket.sendTextWithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(ServerWebSocket.sendText) != CallbackType) - @compileLog("Expected ServerWebSocket.sendText to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.sendText))); - if (@TypeOf(ServerWebSocket.subscribe) != CallbackType) - @compileLog("Expected ServerWebSocket.subscribe to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.subscribe))); - if (@TypeOf(ServerWebSocket.terminate) != CallbackType) - @compileLog("Expected ServerWebSocket.terminate to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.terminate))); - if (@TypeOf(ServerWebSocket.unsubscribe) != CallbackType) - @compileLog("Expected ServerWebSocket.unsubscribe to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.unsubscribe))); - if (!JSC.is_bindgen) { - @export(ServerWebSocket.close, .{ .name = "ServerWebSocketPrototype__close" }); - @export(ServerWebSocket.constructor, .{ .name = "ServerWebSocketClass__construct" }); - @export(ServerWebSocket.cork, .{ .name = "ServerWebSocketPrototype__cork" }); - @export(ServerWebSocket.finalize, .{ .name = "ServerWebSocketClass__finalize" }); - @export(ServerWebSocket.getBinaryType, .{ .name = "ServerWebSocketPrototype__getBinaryType" }); - @export(ServerWebSocket.getBufferedAmount, .{ .name = "ServerWebSocketPrototype__getBufferedAmount" }); - @export(ServerWebSocket.getData, .{ .name = "ServerWebSocketPrototype__getData" }); - @export(ServerWebSocket.getReadyState, .{ .name = "ServerWebSocketPrototype__getReadyState" }); - @export(ServerWebSocket.getRemoteAddress, .{ .name = "ServerWebSocketPrototype__getRemoteAddress" }); - @export(ServerWebSocket.isSubscribed, .{ .name = "ServerWebSocketPrototype__isSubscribed" }); - @export(ServerWebSocket.ping, .{ .name = "ServerWebSocketPrototype__ping" }); - @export(ServerWebSocket.pong, .{ .name = "ServerWebSocketPrototype__pong" }); - @export(ServerWebSocket.publish, .{ .name = "ServerWebSocketPrototype__publish" }); - @export(ServerWebSocket.publishBinary, .{ .name = "ServerWebSocketPrototype__publishBinary" }); - @export(ServerWebSocket.publishBinaryWithoutTypeChecks, .{ .name = "ServerWebSocketPrototype__publishBinaryWithoutTypeChecks" }); - @export(ServerWebSocket.publishText, .{ .name = "ServerWebSocketPrototype__publishText" }); - @export(ServerWebSocket.publishTextWithoutTypeChecks, .{ .name = "ServerWebSocketPrototype__publishTextWithoutTypeChecks" }); - @export(ServerWebSocket.send, .{ .name = "ServerWebSocketPrototype__send" }); - @export(ServerWebSocket.sendBinary, .{ .name = "ServerWebSocketPrototype__sendBinary" }); - @export(ServerWebSocket.sendBinaryWithoutTypeChecks, .{ .name = "ServerWebSocketPrototype__sendBinaryWithoutTypeChecks" }); - @export(ServerWebSocket.sendText, .{ .name = "ServerWebSocketPrototype__sendText" }); - @export(ServerWebSocket.sendTextWithoutTypeChecks, .{ .name = "ServerWebSocketPrototype__sendTextWithoutTypeChecks" }); - @export(ServerWebSocket.setBinaryType, .{ .name = "ServerWebSocketPrototype__setBinaryType" }); - @export(ServerWebSocket.setData, .{ .name = "ServerWebSocketPrototype__setData" }); - @export(ServerWebSocket.subscribe, .{ .name = "ServerWebSocketPrototype__subscribe" }); - @export(ServerWebSocket.terminate, .{ .name = "ServerWebSocketPrototype__terminate" }); - @export(ServerWebSocket.unsubscribe, .{ .name = "ServerWebSocketPrototype__unsubscribe" }); - } - } -}; -pub const JSStatWatcher = struct { - const StatWatcher = Classes.StatWatcher; - const GetterType = fn (*StatWatcher, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*StatWatcher, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*StatWatcher, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*StatWatcher, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*StatWatcher, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*StatWatcher { - JSC.markBinding(@src()); - return StatWatcher__fromJS(value); - } - - extern fn StatWatcherPrototype__listenerSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn StatWatcherPrototype__listenerGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `StatWatcher.listener` setter - /// This value will be visited by the garbage collector. - pub fn listenerSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - StatWatcherPrototype__listenerSetCachedValue(thisValue, globalObject, value); - } - - /// `StatWatcher.listener` getter - /// This value will be visited by the garbage collector. - pub fn listenerGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = StatWatcherPrototype__listenerGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Create a new instance of StatWatcher - pub fn toJS(this: *StatWatcher, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = StatWatcher__create(globalObject, this); - std.debug.assert(value__.as(StatWatcher).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return StatWatcher__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of StatWatcher. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*StatWatcher) bool { - JSC.markBinding(@src()); - return StatWatcher__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *StatWatcher, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(StatWatcher__dangerouslySetPtr(value, null)); - } - - extern fn StatWatcher__fromJS(JSC.JSValue) ?*StatWatcher; - extern fn StatWatcher__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn StatWatcher__create(globalObject: *JSC.JSGlobalObject, ptr: ?*StatWatcher) JSC.JSValue; - - extern fn StatWatcher__dangerouslySetPtr(JSC.JSValue, ?*StatWatcher) bool; - - comptime { - if (@TypeOf(StatWatcher.finalize) != (fn (*StatWatcher) callconv(.C) void)) { - @compileLog("StatWatcher.finalize is not a finalizer"); - } - - if (@TypeOf(StatWatcher.doClose) != CallbackType) - @compileLog("Expected StatWatcher.doClose to be a callback but received " ++ @typeName(@TypeOf(StatWatcher.doClose))); - if (@TypeOf(StatWatcher.doRef) != CallbackType) - @compileLog("Expected StatWatcher.doRef to be a callback but received " ++ @typeName(@TypeOf(StatWatcher.doRef))); - if (@TypeOf(StatWatcher.doUnref) != CallbackType) - @compileLog("Expected StatWatcher.doUnref to be a callback but received " ++ @typeName(@TypeOf(StatWatcher.doUnref))); - if (!JSC.is_bindgen) { - @export(StatWatcher.doClose, .{ .name = "StatWatcherPrototype__doClose" }); - @export(StatWatcher.doRef, .{ .name = "StatWatcherPrototype__doRef" }); - @export(StatWatcher.doUnref, .{ .name = "StatWatcherPrototype__doUnref" }); - @export(StatWatcher.finalize, .{ .name = "StatWatcherClass__finalize" }); - @export(StatWatcher.hasPendingActivity, .{ .name = "StatWatcher__hasPendingActivity" }); - } - } -}; -pub const JSStats = struct { - const Stats = Classes.Stats; - const GetterType = fn (*Stats, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*Stats, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*Stats, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*Stats, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*Stats, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*Stats { - JSC.markBinding(@src()); - return Stats__fromJS(value); - } - - extern fn StatsPrototype__atimeSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn StatsPrototype__atimeGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Stats.atime` setter - /// This value will be visited by the garbage collector. - pub fn atimeSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - StatsPrototype__atimeSetCachedValue(thisValue, globalObject, value); - } - - /// `Stats.atime` getter - /// This value will be visited by the garbage collector. - pub fn atimeGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = StatsPrototype__atimeGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn StatsPrototype__ctimeSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn StatsPrototype__ctimeGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Stats.ctime` setter - /// This value will be visited by the garbage collector. - pub fn ctimeSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - StatsPrototype__ctimeSetCachedValue(thisValue, globalObject, value); - } - - /// `Stats.ctime` getter - /// This value will be visited by the garbage collector. - pub fn ctimeGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = StatsPrototype__ctimeGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn StatsPrototype__mtimeSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn StatsPrototype__mtimeGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Stats.mtime` setter - /// This value will be visited by the garbage collector. - pub fn mtimeSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - StatsPrototype__mtimeSetCachedValue(thisValue, globalObject, value); - } - - /// `Stats.mtime` getter - /// This value will be visited by the garbage collector. - pub fn mtimeGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = StatsPrototype__mtimeGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Get the Stats constructor value. - /// This loads lazily from the global object. - pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - return Stats__getConstructor(globalObject); - } - - /// Create a new instance of Stats - pub fn toJS(this: *Stats, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = Stats__create(globalObject, this); - std.debug.assert(value__.as(Stats).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return Stats__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of Stats. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Stats) bool { - JSC.markBinding(@src()); - return Stats__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *Stats, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(Stats__dangerouslySetPtr(value, null)); - } - - extern fn Stats__fromJS(JSC.JSValue) ?*Stats; - extern fn Stats__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn Stats__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Stats) JSC.JSValue; - - extern fn Stats__dangerouslySetPtr(JSC.JSValue, ?*Stats) bool; - - comptime { - if (@TypeOf(Stats.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Stats)) { - @compileLog("Stats.constructor is not a constructor"); - } - - if (@TypeOf(Stats.finalize) != (fn (*Stats) callconv(.C) void)) { - @compileLog("Stats.finalize is not a finalizer"); - } - - if (@TypeOf(Stats.atime) != GetterType) - @compileLog("Expected Stats.atime to be a getter"); - - if (@TypeOf(Stats.atimeMs) != GetterType) - @compileLog("Expected Stats.atimeMs to be a getter"); - - if (@TypeOf(Stats.birthtime) != GetterType) - @compileLog("Expected Stats.birthtime to be a getter"); - - if (@TypeOf(Stats.birthtimeMs) != GetterType) - @compileLog("Expected Stats.birthtimeMs to be a getter"); - - if (@TypeOf(Stats.blksize) != GetterType) - @compileLog("Expected Stats.blksize to be a getter"); - - if (@TypeOf(Stats.blocks) != GetterType) - @compileLog("Expected Stats.blocks to be a getter"); - - if (@TypeOf(Stats.ctime) != GetterType) - @compileLog("Expected Stats.ctime to be a getter"); - - if (@TypeOf(Stats.ctimeMs) != GetterType) - @compileLog("Expected Stats.ctimeMs to be a getter"); - - if (@TypeOf(Stats.dev) != GetterType) - @compileLog("Expected Stats.dev to be a getter"); - - if (@TypeOf(Stats.gid) != GetterType) - @compileLog("Expected Stats.gid to be a getter"); - - if (@TypeOf(Stats.ino) != GetterType) - @compileLog("Expected Stats.ino to be a getter"); - - if (@TypeOf(Stats.isBlockDevice_WithoutTypeChecks) != fn ( - *Stats, - *JSC.JSGlobalObject, - ) callconv(.C) JSC.JSValue) - @compileLog("Expected Stats.isBlockDevice_WithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(Stats.isBlockDevice_) != CallbackType) - @compileLog("Expected Stats.isBlockDevice_ to be a callback but received " ++ @typeName(@TypeOf(Stats.isBlockDevice_))); - if (@TypeOf(Stats.isCharacterDevice_WithoutTypeChecks) != fn ( - *Stats, - *JSC.JSGlobalObject, - ) callconv(.C) JSC.JSValue) - @compileLog("Expected Stats.isCharacterDevice_WithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(Stats.isCharacterDevice_) != CallbackType) - @compileLog("Expected Stats.isCharacterDevice_ to be a callback but received " ++ @typeName(@TypeOf(Stats.isCharacterDevice_))); - if (@TypeOf(Stats.isDirectory_WithoutTypeChecks) != fn ( - *Stats, - *JSC.JSGlobalObject, - ) callconv(.C) JSC.JSValue) - @compileLog("Expected Stats.isDirectory_WithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(Stats.isDirectory_) != CallbackType) - @compileLog("Expected Stats.isDirectory_ to be a callback but received " ++ @typeName(@TypeOf(Stats.isDirectory_))); - if (@TypeOf(Stats.isFIFO_WithoutTypeChecks) != fn ( - *Stats, - *JSC.JSGlobalObject, - ) callconv(.C) JSC.JSValue) - @compileLog("Expected Stats.isFIFO_WithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(Stats.isFIFO_) != CallbackType) - @compileLog("Expected Stats.isFIFO_ to be a callback but received " ++ @typeName(@TypeOf(Stats.isFIFO_))); - if (@TypeOf(Stats.isFile_WithoutTypeChecks) != fn ( - *Stats, - *JSC.JSGlobalObject, - ) callconv(.C) JSC.JSValue) - @compileLog("Expected Stats.isFile_WithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(Stats.isFile_) != CallbackType) - @compileLog("Expected Stats.isFile_ to be a callback but received " ++ @typeName(@TypeOf(Stats.isFile_))); - if (@TypeOf(Stats.isSocket_WithoutTypeChecks) != fn ( - *Stats, - *JSC.JSGlobalObject, - ) callconv(.C) JSC.JSValue) - @compileLog("Expected Stats.isSocket_WithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(Stats.isSocket_) != CallbackType) - @compileLog("Expected Stats.isSocket_ to be a callback but received " ++ @typeName(@TypeOf(Stats.isSocket_))); - if (@TypeOf(Stats.isSymbolicLink_WithoutTypeChecks) != fn ( - *Stats, - *JSC.JSGlobalObject, - ) callconv(.C) JSC.JSValue) - @compileLog("Expected Stats.isSymbolicLink_WithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(Stats.isSymbolicLink_) != CallbackType) - @compileLog("Expected Stats.isSymbolicLink_ to be a callback but received " ++ @typeName(@TypeOf(Stats.isSymbolicLink_))); - if (@TypeOf(Stats.mode) != GetterType) - @compileLog("Expected Stats.mode to be a getter"); - - if (@TypeOf(Stats.mtime) != GetterType) - @compileLog("Expected Stats.mtime to be a getter"); - - if (@TypeOf(Stats.mtimeMs) != GetterType) - @compileLog("Expected Stats.mtimeMs to be a getter"); - - if (@TypeOf(Stats.nlink) != GetterType) - @compileLog("Expected Stats.nlink to be a getter"); - - if (@TypeOf(Stats.rdev) != GetterType) - @compileLog("Expected Stats.rdev to be a getter"); - - if (@TypeOf(Stats.size) != GetterType) - @compileLog("Expected Stats.size to be a getter"); - - if (@TypeOf(Stats.uid) != GetterType) - @compileLog("Expected Stats.uid to be a getter"); - - if (!JSC.is_bindgen) { - @export(Stats.atime, .{ .name = "StatsPrototype__atime" }); - @export(Stats.atimeMs, .{ .name = "StatsPrototype__atimeMs" }); - @export(Stats.birthtime, .{ .name = "StatsPrototype__birthtime" }); - @export(Stats.birthtimeMs, .{ .name = "StatsPrototype__birthtimeMs" }); - @export(Stats.blksize, .{ .name = "StatsPrototype__blksize" }); - @export(Stats.blocks, .{ .name = "StatsPrototype__blocks" }); - @export(Stats.constructor, .{ .name = "StatsClass__construct" }); - @export(Stats.ctime, .{ .name = "StatsPrototype__ctime" }); - @export(Stats.ctimeMs, .{ .name = "StatsPrototype__ctimeMs" }); - @export(Stats.dev, .{ .name = "StatsPrototype__dev" }); - @export(Stats.finalize, .{ .name = "StatsClass__finalize" }); - @export(Stats.gid, .{ .name = "StatsPrototype__gid" }); - @export(Stats.ino, .{ .name = "StatsPrototype__ino" }); - @export(Stats.isBlockDevice_, .{ .name = "StatsPrototype__isBlockDevice_" }); - @export(Stats.isBlockDevice_WithoutTypeChecks, .{ .name = "StatsPrototype__isBlockDevice_WithoutTypeChecks" }); - @export(Stats.isCharacterDevice_, .{ .name = "StatsPrototype__isCharacterDevice_" }); - @export(Stats.isCharacterDevice_WithoutTypeChecks, .{ .name = "StatsPrototype__isCharacterDevice_WithoutTypeChecks" }); - @export(Stats.isDirectory_, .{ .name = "StatsPrototype__isDirectory_" }); - @export(Stats.isDirectory_WithoutTypeChecks, .{ .name = "StatsPrototype__isDirectory_WithoutTypeChecks" }); - @export(Stats.isFIFO_, .{ .name = "StatsPrototype__isFIFO_" }); - @export(Stats.isFIFO_WithoutTypeChecks, .{ .name = "StatsPrototype__isFIFO_WithoutTypeChecks" }); - @export(Stats.isFile_, .{ .name = "StatsPrototype__isFile_" }); - @export(Stats.isFile_WithoutTypeChecks, .{ .name = "StatsPrototype__isFile_WithoutTypeChecks" }); - @export(Stats.isSocket_, .{ .name = "StatsPrototype__isSocket_" }); - @export(Stats.isSocket_WithoutTypeChecks, .{ .name = "StatsPrototype__isSocket_WithoutTypeChecks" }); - @export(Stats.isSymbolicLink_, .{ .name = "StatsPrototype__isSymbolicLink_" }); - @export(Stats.isSymbolicLink_WithoutTypeChecks, .{ .name = "StatsPrototype__isSymbolicLink_WithoutTypeChecks" }); - @export(Stats.mode, .{ .name = "StatsPrototype__mode" }); - @export(Stats.mtime, .{ .name = "StatsPrototype__mtime" }); - @export(Stats.mtimeMs, .{ .name = "StatsPrototype__mtimeMs" }); - @export(Stats.nlink, .{ .name = "StatsPrototype__nlink" }); - @export(Stats.rdev, .{ .name = "StatsPrototype__rdev" }); - @export(Stats.size, .{ .name = "StatsPrototype__size" }); - @export(Stats.uid, .{ .name = "StatsPrototype__uid" }); - } - } -}; -pub const JSSubprocess = struct { - const Subprocess = Classes.Subprocess; - const GetterType = fn (*Subprocess, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*Subprocess, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*Subprocess, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*Subprocess, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*Subprocess, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*Subprocess { - JSC.markBinding(@src()); - return Subprocess__fromJS(value); - } - - extern fn SubprocessPrototype__stderrSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn SubprocessPrototype__stderrGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Subprocess.stderr` setter - /// This value will be visited by the garbage collector. - pub fn stderrSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - SubprocessPrototype__stderrSetCachedValue(thisValue, globalObject, value); - } - - /// `Subprocess.stderr` getter - /// This value will be visited by the garbage collector. - pub fn stderrGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = SubprocessPrototype__stderrGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn SubprocessPrototype__stdinSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn SubprocessPrototype__stdinGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Subprocess.stdin` setter - /// This value will be visited by the garbage collector. - pub fn stdinSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - SubprocessPrototype__stdinSetCachedValue(thisValue, globalObject, value); - } - - /// `Subprocess.stdin` getter - /// This value will be visited by the garbage collector. - pub fn stdinGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = SubprocessPrototype__stdinGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn SubprocessPrototype__stdoutSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn SubprocessPrototype__stdoutGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Subprocess.stdout` setter - /// This value will be visited by the garbage collector. - pub fn stdoutSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - SubprocessPrototype__stdoutSetCachedValue(thisValue, globalObject, value); - } - - /// `Subprocess.stdout` getter - /// This value will be visited by the garbage collector. - pub fn stdoutGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = SubprocessPrototype__stdoutGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Create a new instance of Subprocess - pub fn toJS(this: *Subprocess, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = Subprocess__create(globalObject, this); - std.debug.assert(value__.as(Subprocess).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return Subprocess__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of Subprocess. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Subprocess) bool { - JSC.markBinding(@src()); - return Subprocess__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *Subprocess, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(Subprocess__dangerouslySetPtr(value, null)); - } - - extern fn Subprocess__fromJS(JSC.JSValue) ?*Subprocess; - extern fn Subprocess__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn Subprocess__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Subprocess) JSC.JSValue; - - extern fn Subprocess__dangerouslySetPtr(JSC.JSValue, ?*Subprocess) bool; - - comptime { - if (@TypeOf(Subprocess.finalize) != (fn (*Subprocess) callconv(.C) void)) { - @compileLog("Subprocess.finalize is not a finalizer"); - } - - if (@TypeOf(Subprocess.getExitCode) != GetterType) - @compileLog("Expected Subprocess.getExitCode to be a getter"); - - if (@TypeOf(Subprocess.getExited) != GetterType) - @compileLog("Expected Subprocess.getExited to be a getter"); - - if (@TypeOf(Subprocess.kill) != CallbackType) - @compileLog("Expected Subprocess.kill to be a callback but received " ++ @typeName(@TypeOf(Subprocess.kill))); - if (@TypeOf(Subprocess.getKilled) != GetterType) - @compileLog("Expected Subprocess.getKilled to be a getter"); - - if (@TypeOf(Subprocess.getPid) != GetterType) - @compileLog("Expected Subprocess.getPid to be a getter"); - - if (@TypeOf(Subprocess.getStdout) != GetterType) - @compileLog("Expected Subprocess.getStdout to be a getter"); - - if (@TypeOf(Subprocess.doRef) != CallbackType) - @compileLog("Expected Subprocess.doRef to be a callback but received " ++ @typeName(@TypeOf(Subprocess.doRef))); - if (@TypeOf(Subprocess.doSend) != CallbackType) - @compileLog("Expected Subprocess.doSend to be a callback but received " ++ @typeName(@TypeOf(Subprocess.doSend))); - if (@TypeOf(Subprocess.getSignalCode) != GetterType) - @compileLog("Expected Subprocess.getSignalCode to be a getter"); - - if (@TypeOf(Subprocess.getStderr) != GetterType) - @compileLog("Expected Subprocess.getStderr to be a getter"); - - if (@TypeOf(Subprocess.getStdin) != GetterType) - @compileLog("Expected Subprocess.getStdin to be a getter"); - - if (@TypeOf(Subprocess.getStdout) != GetterType) - @compileLog("Expected Subprocess.getStdout to be a getter"); - - if (@TypeOf(Subprocess.doUnref) != CallbackType) - @compileLog("Expected Subprocess.doUnref to be a callback but received " ++ @typeName(@TypeOf(Subprocess.doUnref))); - if (@TypeOf(Subprocess.getStdin) != GetterType) - @compileLog("Expected Subprocess.getStdin to be a getter"); - - if (!JSC.is_bindgen) { - @export(Subprocess.doRef, .{ .name = "SubprocessPrototype__doRef" }); - @export(Subprocess.doSend, .{ .name = "SubprocessPrototype__doSend" }); - @export(Subprocess.doUnref, .{ .name = "SubprocessPrototype__doUnref" }); - @export(Subprocess.finalize, .{ .name = "SubprocessClass__finalize" }); - @export(Subprocess.getExitCode, .{ .name = "SubprocessPrototype__getExitCode" }); - @export(Subprocess.getExited, .{ .name = "SubprocessPrototype__getExited" }); - @export(Subprocess.getKilled, .{ .name = "SubprocessPrototype__getKilled" }); - @export(Subprocess.getPid, .{ .name = "SubprocessPrototype__getPid" }); - @export(Subprocess.getSignalCode, .{ .name = "SubprocessPrototype__getSignalCode" }); - @export(Subprocess.getStderr, .{ .name = "SubprocessPrototype__getStderr" }); - @export(Subprocess.getStdin, .{ .name = "SubprocessPrototype__getStdin" }); - @export(Subprocess.getStdout, .{ .name = "SubprocessPrototype__getStdout" }); - @export(Subprocess.hasPendingActivity, .{ .name = "Subprocess__hasPendingActivity" }); - @export(Subprocess.kill, .{ .name = "SubprocessPrototype__kill" }); - } - } -}; -pub const JSTCPSocket = struct { - const TCPSocket = Classes.TCPSocket; - const GetterType = fn (*TCPSocket, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*TCPSocket, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*TCPSocket, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*TCPSocket, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*TCPSocket, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*TCPSocket { - JSC.markBinding(@src()); - return TCPSocket__fromJS(value); - } - - extern fn TCPSocketPrototype__dataSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn TCPSocketPrototype__dataGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `TCPSocket.data` setter - /// This value will be visited by the garbage collector. - pub fn dataSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - TCPSocketPrototype__dataSetCachedValue(thisValue, globalObject, value); - } - - /// `TCPSocket.data` getter - /// This value will be visited by the garbage collector. - pub fn dataGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = TCPSocketPrototype__dataGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn TCPSocketPrototype__remoteAddressSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn TCPSocketPrototype__remoteAddressGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `TCPSocket.remoteAddress` setter - /// This value will be visited by the garbage collector. - pub fn remoteAddressSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - TCPSocketPrototype__remoteAddressSetCachedValue(thisValue, globalObject, value); - } - - /// `TCPSocket.remoteAddress` getter - /// This value will be visited by the garbage collector. - pub fn remoteAddressGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = TCPSocketPrototype__remoteAddressGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Create a new instance of TCPSocket - pub fn toJS(this: *TCPSocket, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = TCPSocket__create(globalObject, this); - std.debug.assert(value__.as(TCPSocket).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return TCPSocket__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of TCPSocket. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*TCPSocket) bool { - JSC.markBinding(@src()); - return TCPSocket__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *TCPSocket, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(TCPSocket__dangerouslySetPtr(value, null)); - } - - extern fn TCPSocket__fromJS(JSC.JSValue) ?*TCPSocket; - extern fn TCPSocket__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn TCPSocket__create(globalObject: *JSC.JSGlobalObject, ptr: ?*TCPSocket) JSC.JSValue; - - extern fn TCPSocket__dangerouslySetPtr(JSC.JSValue, ?*TCPSocket) bool; - - comptime { - if (@TypeOf(TCPSocket.finalize) != (fn (*TCPSocket) callconv(.C) void)) { - @compileLog("TCPSocket.finalize is not a finalizer"); - } - - if (@TypeOf(TCPSocket.getALPNProtocol) != GetterType) - @compileLog("Expected TCPSocket.getALPNProtocol to be a getter"); - - if (@TypeOf(TCPSocket.getAuthorized) != GetterType) - @compileLog("Expected TCPSocket.getAuthorized to be a getter"); - - if (@TypeOf(TCPSocket.getData) != GetterType) - @compileLog("Expected TCPSocket.getData to be a getter"); - - if (@TypeOf(TCPSocket.setData) != SetterType) - @compileLog("Expected TCPSocket.setData to be a setter"); - if (@TypeOf(TCPSocket.end) != CallbackType) - @compileLog("Expected TCPSocket.end to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.end))); - if (@TypeOf(TCPSocket.exportKeyingMaterial) != CallbackType) - @compileLog("Expected TCPSocket.exportKeyingMaterial to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.exportKeyingMaterial))); - if (@TypeOf(TCPSocket.flush) != CallbackType) - @compileLog("Expected TCPSocket.flush to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.flush))); - if (@TypeOf(TCPSocket.getAuthorizationError) != CallbackType) - @compileLog("Expected TCPSocket.getAuthorizationError to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.getAuthorizationError))); - if (@TypeOf(TCPSocket.getCertificate) != CallbackType) - @compileLog("Expected TCPSocket.getCertificate to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.getCertificate))); - if (@TypeOf(TCPSocket.getCipher) != CallbackType) - @compileLog("Expected TCPSocket.getCipher to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.getCipher))); - if (@TypeOf(TCPSocket.getEphemeralKeyInfo) != CallbackType) - @compileLog("Expected TCPSocket.getEphemeralKeyInfo to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.getEphemeralKeyInfo))); - if (@TypeOf(TCPSocket.getPeerCertificate) != CallbackType) - @compileLog("Expected TCPSocket.getPeerCertificate to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.getPeerCertificate))); - if (@TypeOf(TCPSocket.getSession) != CallbackType) - @compileLog("Expected TCPSocket.getSession to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.getSession))); - if (@TypeOf(TCPSocket.getSharedSigalgs) != CallbackType) - @compileLog("Expected TCPSocket.getSharedSigalgs to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.getSharedSigalgs))); - if (@TypeOf(TCPSocket.getTLSFinishedMessage) != CallbackType) - @compileLog("Expected TCPSocket.getTLSFinishedMessage to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.getTLSFinishedMessage))); - if (@TypeOf(TCPSocket.getTLSPeerFinishedMessage) != CallbackType) - @compileLog("Expected TCPSocket.getTLSPeerFinishedMessage to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.getTLSPeerFinishedMessage))); - if (@TypeOf(TCPSocket.getTLSTicket) != CallbackType) - @compileLog("Expected TCPSocket.getTLSTicket to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.getTLSTicket))); - if (@TypeOf(TCPSocket.getTLSVersion) != CallbackType) - @compileLog("Expected TCPSocket.getTLSVersion to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.getTLSVersion))); - if (@TypeOf(TCPSocket.getListener) != GetterType) - @compileLog("Expected TCPSocket.getListener to be a getter"); - - if (@TypeOf(TCPSocket.getLocalPort) != GetterType) - @compileLog("Expected TCPSocket.getLocalPort to be a getter"); - - if (@TypeOf(TCPSocket.getReadyState) != GetterType) - @compileLog("Expected TCPSocket.getReadyState to be a getter"); - - if (@TypeOf(TCPSocket.ref) != CallbackType) - @compileLog("Expected TCPSocket.ref to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.ref))); - if (@TypeOf(TCPSocket.reload) != CallbackType) - @compileLog("Expected TCPSocket.reload to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.reload))); - if (@TypeOf(TCPSocket.getRemoteAddress) != GetterType) - @compileLog("Expected TCPSocket.getRemoteAddress to be a getter"); - - if (@TypeOf(TCPSocket.setMaxSendFragment) != CallbackType) - @compileLog("Expected TCPSocket.setMaxSendFragment to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.setMaxSendFragment))); - if (@TypeOf(TCPSocket.setServername) != CallbackType) - @compileLog("Expected TCPSocket.setServername to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.setServername))); - if (@TypeOf(TCPSocket.setSession) != CallbackType) - @compileLog("Expected TCPSocket.setSession to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.setSession))); - if (@TypeOf(TCPSocket.shutdown) != CallbackType) - @compileLog("Expected TCPSocket.shutdown to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.shutdown))); - if (@TypeOf(TCPSocket.timeout) != CallbackType) - @compileLog("Expected TCPSocket.timeout to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.timeout))); - if (@TypeOf(TCPSocket.unref) != CallbackType) - @compileLog("Expected TCPSocket.unref to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.unref))); - if (@TypeOf(TCPSocket.upgradeTLS) != CallbackType) - @compileLog("Expected TCPSocket.upgradeTLS to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.upgradeTLS))); - if (@TypeOf(TCPSocket.write) != CallbackType) - @compileLog("Expected TCPSocket.write to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.write))); - if (!JSC.is_bindgen) { - @export(TCPSocket.end, .{ .name = "TCPSocketPrototype__end" }); - @export(TCPSocket.exportKeyingMaterial, .{ .name = "TCPSocketPrototype__exportKeyingMaterial" }); - @export(TCPSocket.finalize, .{ .name = "TCPSocketClass__finalize" }); - @export(TCPSocket.flush, .{ .name = "TCPSocketPrototype__flush" }); - @export(TCPSocket.getALPNProtocol, .{ .name = "TCPSocketPrototype__getALPNProtocol" }); - @export(TCPSocket.getAuthorizationError, .{ .name = "TCPSocketPrototype__getAuthorizationError" }); - @export(TCPSocket.getAuthorized, .{ .name = "TCPSocketPrototype__getAuthorized" }); - @export(TCPSocket.getCertificate, .{ .name = "TCPSocketPrototype__getCertificate" }); - @export(TCPSocket.getCipher, .{ .name = "TCPSocketPrototype__getCipher" }); - @export(TCPSocket.getData, .{ .name = "TCPSocketPrototype__getData" }); - @export(TCPSocket.getEphemeralKeyInfo, .{ .name = "TCPSocketPrototype__getEphemeralKeyInfo" }); - @export(TCPSocket.getListener, .{ .name = "TCPSocketPrototype__getListener" }); - @export(TCPSocket.getLocalPort, .{ .name = "TCPSocketPrototype__getLocalPort" }); - @export(TCPSocket.getPeerCertificate, .{ .name = "TCPSocketPrototype__getPeerCertificate" }); - @export(TCPSocket.getReadyState, .{ .name = "TCPSocketPrototype__getReadyState" }); - @export(TCPSocket.getRemoteAddress, .{ .name = "TCPSocketPrototype__getRemoteAddress" }); - @export(TCPSocket.getSession, .{ .name = "TCPSocketPrototype__getSession" }); - @export(TCPSocket.getSharedSigalgs, .{ .name = "TCPSocketPrototype__getSharedSigalgs" }); - @export(TCPSocket.getTLSFinishedMessage, .{ .name = "TCPSocketPrototype__getTLSFinishedMessage" }); - @export(TCPSocket.getTLSPeerFinishedMessage, .{ .name = "TCPSocketPrototype__getTLSPeerFinishedMessage" }); - @export(TCPSocket.getTLSTicket, .{ .name = "TCPSocketPrototype__getTLSTicket" }); - @export(TCPSocket.getTLSVersion, .{ .name = "TCPSocketPrototype__getTLSVersion" }); - @export(TCPSocket.hasPendingActivity, .{ .name = "TCPSocket__hasPendingActivity" }); - @export(TCPSocket.ref, .{ .name = "TCPSocketPrototype__ref" }); - @export(TCPSocket.reload, .{ .name = "TCPSocketPrototype__reload" }); - @export(TCPSocket.setData, .{ .name = "TCPSocketPrototype__setData" }); - @export(TCPSocket.setMaxSendFragment, .{ .name = "TCPSocketPrototype__setMaxSendFragment" }); - @export(TCPSocket.setServername, .{ .name = "TCPSocketPrototype__setServername" }); - @export(TCPSocket.setSession, .{ .name = "TCPSocketPrototype__setSession" }); - @export(TCPSocket.shutdown, .{ .name = "TCPSocketPrototype__shutdown" }); - @export(TCPSocket.timeout, .{ .name = "TCPSocketPrototype__timeout" }); - @export(TCPSocket.unref, .{ .name = "TCPSocketPrototype__unref" }); - @export(TCPSocket.upgradeTLS, .{ .name = "TCPSocketPrototype__upgradeTLS" }); - @export(TCPSocket.write, .{ .name = "TCPSocketPrototype__write" }); - } - } -}; -pub const JSTLSSocket = struct { - const TLSSocket = Classes.TLSSocket; - const GetterType = fn (*TLSSocket, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*TLSSocket, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*TLSSocket, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*TLSSocket, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*TLSSocket, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*TLSSocket { - JSC.markBinding(@src()); - return TLSSocket__fromJS(value); - } - - extern fn TLSSocketPrototype__dataSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn TLSSocketPrototype__dataGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `TLSSocket.data` setter - /// This value will be visited by the garbage collector. - pub fn dataSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - TLSSocketPrototype__dataSetCachedValue(thisValue, globalObject, value); - } - - /// `TLSSocket.data` getter - /// This value will be visited by the garbage collector. - pub fn dataGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = TLSSocketPrototype__dataGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn TLSSocketPrototype__remoteAddressSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn TLSSocketPrototype__remoteAddressGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `TLSSocket.remoteAddress` setter - /// This value will be visited by the garbage collector. - pub fn remoteAddressSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - TLSSocketPrototype__remoteAddressSetCachedValue(thisValue, globalObject, value); - } - - /// `TLSSocket.remoteAddress` getter - /// This value will be visited by the garbage collector. - pub fn remoteAddressGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = TLSSocketPrototype__remoteAddressGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Create a new instance of TLSSocket - pub fn toJS(this: *TLSSocket, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = TLSSocket__create(globalObject, this); - std.debug.assert(value__.as(TLSSocket).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return TLSSocket__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of TLSSocket. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*TLSSocket) bool { - JSC.markBinding(@src()); - return TLSSocket__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *TLSSocket, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(TLSSocket__dangerouslySetPtr(value, null)); - } - - extern fn TLSSocket__fromJS(JSC.JSValue) ?*TLSSocket; - extern fn TLSSocket__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn TLSSocket__create(globalObject: *JSC.JSGlobalObject, ptr: ?*TLSSocket) JSC.JSValue; - - extern fn TLSSocket__dangerouslySetPtr(JSC.JSValue, ?*TLSSocket) bool; - - comptime { - if (@TypeOf(TLSSocket.finalize) != (fn (*TLSSocket) callconv(.C) void)) { - @compileLog("TLSSocket.finalize is not a finalizer"); - } - - if (@TypeOf(TLSSocket.getALPNProtocol) != GetterType) - @compileLog("Expected TLSSocket.getALPNProtocol to be a getter"); - - if (@TypeOf(TLSSocket.getAuthorized) != GetterType) - @compileLog("Expected TLSSocket.getAuthorized to be a getter"); - - if (@TypeOf(TLSSocket.getData) != GetterType) - @compileLog("Expected TLSSocket.getData to be a getter"); - - if (@TypeOf(TLSSocket.setData) != SetterType) - @compileLog("Expected TLSSocket.setData to be a setter"); - if (@TypeOf(TLSSocket.end) != CallbackType) - @compileLog("Expected TLSSocket.end to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.end))); - if (@TypeOf(TLSSocket.exportKeyingMaterial) != CallbackType) - @compileLog("Expected TLSSocket.exportKeyingMaterial to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.exportKeyingMaterial))); - if (@TypeOf(TLSSocket.flush) != CallbackType) - @compileLog("Expected TLSSocket.flush to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.flush))); - if (@TypeOf(TLSSocket.getAuthorizationError) != CallbackType) - @compileLog("Expected TLSSocket.getAuthorizationError to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.getAuthorizationError))); - if (@TypeOf(TLSSocket.getCertificate) != CallbackType) - @compileLog("Expected TLSSocket.getCertificate to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.getCertificate))); - if (@TypeOf(TLSSocket.getCipher) != CallbackType) - @compileLog("Expected TLSSocket.getCipher to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.getCipher))); - if (@TypeOf(TLSSocket.getEphemeralKeyInfo) != CallbackType) - @compileLog("Expected TLSSocket.getEphemeralKeyInfo to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.getEphemeralKeyInfo))); - if (@TypeOf(TLSSocket.getPeerCertificate) != CallbackType) - @compileLog("Expected TLSSocket.getPeerCertificate to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.getPeerCertificate))); - if (@TypeOf(TLSSocket.getSession) != CallbackType) - @compileLog("Expected TLSSocket.getSession to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.getSession))); - if (@TypeOf(TLSSocket.getSharedSigalgs) != CallbackType) - @compileLog("Expected TLSSocket.getSharedSigalgs to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.getSharedSigalgs))); - if (@TypeOf(TLSSocket.getTLSFinishedMessage) != CallbackType) - @compileLog("Expected TLSSocket.getTLSFinishedMessage to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.getTLSFinishedMessage))); - if (@TypeOf(TLSSocket.getTLSPeerFinishedMessage) != CallbackType) - @compileLog("Expected TLSSocket.getTLSPeerFinishedMessage to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.getTLSPeerFinishedMessage))); - if (@TypeOf(TLSSocket.getTLSTicket) != CallbackType) - @compileLog("Expected TLSSocket.getTLSTicket to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.getTLSTicket))); - if (@TypeOf(TLSSocket.getTLSVersion) != CallbackType) - @compileLog("Expected TLSSocket.getTLSVersion to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.getTLSVersion))); - if (@TypeOf(TLSSocket.getListener) != GetterType) - @compileLog("Expected TLSSocket.getListener to be a getter"); - - if (@TypeOf(TLSSocket.getLocalPort) != GetterType) - @compileLog("Expected TLSSocket.getLocalPort to be a getter"); - - if (@TypeOf(TLSSocket.getReadyState) != GetterType) - @compileLog("Expected TLSSocket.getReadyState to be a getter"); - - if (@TypeOf(TLSSocket.ref) != CallbackType) - @compileLog("Expected TLSSocket.ref to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.ref))); - if (@TypeOf(TLSSocket.reload) != CallbackType) - @compileLog("Expected TLSSocket.reload to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.reload))); - if (@TypeOf(TLSSocket.getRemoteAddress) != GetterType) - @compileLog("Expected TLSSocket.getRemoteAddress to be a getter"); - - if (@TypeOf(TLSSocket.setMaxSendFragment) != CallbackType) - @compileLog("Expected TLSSocket.setMaxSendFragment to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.setMaxSendFragment))); - if (@TypeOf(TLSSocket.setServername) != CallbackType) - @compileLog("Expected TLSSocket.setServername to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.setServername))); - if (@TypeOf(TLSSocket.setSession) != CallbackType) - @compileLog("Expected TLSSocket.setSession to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.setSession))); - if (@TypeOf(TLSSocket.shutdown) != CallbackType) - @compileLog("Expected TLSSocket.shutdown to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.shutdown))); - if (@TypeOf(TLSSocket.timeout) != CallbackType) - @compileLog("Expected TLSSocket.timeout to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.timeout))); - if (@TypeOf(TLSSocket.unref) != CallbackType) - @compileLog("Expected TLSSocket.unref to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.unref))); - if (@TypeOf(TLSSocket.upgradeTLS) != CallbackType) - @compileLog("Expected TLSSocket.upgradeTLS to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.upgradeTLS))); - if (@TypeOf(TLSSocket.write) != CallbackType) - @compileLog("Expected TLSSocket.write to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.write))); - if (!JSC.is_bindgen) { - @export(TLSSocket.end, .{ .name = "TLSSocketPrototype__end" }); - @export(TLSSocket.exportKeyingMaterial, .{ .name = "TLSSocketPrototype__exportKeyingMaterial" }); - @export(TLSSocket.finalize, .{ .name = "TLSSocketClass__finalize" }); - @export(TLSSocket.flush, .{ .name = "TLSSocketPrototype__flush" }); - @export(TLSSocket.getALPNProtocol, .{ .name = "TLSSocketPrototype__getALPNProtocol" }); - @export(TLSSocket.getAuthorizationError, .{ .name = "TLSSocketPrototype__getAuthorizationError" }); - @export(TLSSocket.getAuthorized, .{ .name = "TLSSocketPrototype__getAuthorized" }); - @export(TLSSocket.getCertificate, .{ .name = "TLSSocketPrototype__getCertificate" }); - @export(TLSSocket.getCipher, .{ .name = "TLSSocketPrototype__getCipher" }); - @export(TLSSocket.getData, .{ .name = "TLSSocketPrototype__getData" }); - @export(TLSSocket.getEphemeralKeyInfo, .{ .name = "TLSSocketPrototype__getEphemeralKeyInfo" }); - @export(TLSSocket.getListener, .{ .name = "TLSSocketPrototype__getListener" }); - @export(TLSSocket.getLocalPort, .{ .name = "TLSSocketPrototype__getLocalPort" }); - @export(TLSSocket.getPeerCertificate, .{ .name = "TLSSocketPrototype__getPeerCertificate" }); - @export(TLSSocket.getReadyState, .{ .name = "TLSSocketPrototype__getReadyState" }); - @export(TLSSocket.getRemoteAddress, .{ .name = "TLSSocketPrototype__getRemoteAddress" }); - @export(TLSSocket.getSession, .{ .name = "TLSSocketPrototype__getSession" }); - @export(TLSSocket.getSharedSigalgs, .{ .name = "TLSSocketPrototype__getSharedSigalgs" }); - @export(TLSSocket.getTLSFinishedMessage, .{ .name = "TLSSocketPrototype__getTLSFinishedMessage" }); - @export(TLSSocket.getTLSPeerFinishedMessage, .{ .name = "TLSSocketPrototype__getTLSPeerFinishedMessage" }); - @export(TLSSocket.getTLSTicket, .{ .name = "TLSSocketPrototype__getTLSTicket" }); - @export(TLSSocket.getTLSVersion, .{ .name = "TLSSocketPrototype__getTLSVersion" }); - @export(TLSSocket.hasPendingActivity, .{ .name = "TLSSocket__hasPendingActivity" }); - @export(TLSSocket.ref, .{ .name = "TLSSocketPrototype__ref" }); - @export(TLSSocket.reload, .{ .name = "TLSSocketPrototype__reload" }); - @export(TLSSocket.setData, .{ .name = "TLSSocketPrototype__setData" }); - @export(TLSSocket.setMaxSendFragment, .{ .name = "TLSSocketPrototype__setMaxSendFragment" }); - @export(TLSSocket.setServername, .{ .name = "TLSSocketPrototype__setServername" }); - @export(TLSSocket.setSession, .{ .name = "TLSSocketPrototype__setSession" }); - @export(TLSSocket.shutdown, .{ .name = "TLSSocketPrototype__shutdown" }); - @export(TLSSocket.timeout, .{ .name = "TLSSocketPrototype__timeout" }); - @export(TLSSocket.unref, .{ .name = "TLSSocketPrototype__unref" }); - @export(TLSSocket.upgradeTLS, .{ .name = "TLSSocketPrototype__upgradeTLS" }); - @export(TLSSocket.write, .{ .name = "TLSSocketPrototype__write" }); - } - } -}; -pub const JSTextChunk = struct { - const TextChunk = Classes.TextChunk; - const GetterType = fn (*TextChunk, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*TextChunk, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*TextChunk, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*TextChunk, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*TextChunk, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*TextChunk { - JSC.markBinding(@src()); - return TextChunk__fromJS(value); - } - - extern fn TextChunkPrototype__lastInTextNodeSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn TextChunkPrototype__lastInTextNodeGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `TextChunk.lastInTextNode` setter - /// This value will be visited by the garbage collector. - pub fn lastInTextNodeSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - TextChunkPrototype__lastInTextNodeSetCachedValue(thisValue, globalObject, value); - } - - /// `TextChunk.lastInTextNode` getter - /// This value will be visited by the garbage collector. - pub fn lastInTextNodeGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = TextChunkPrototype__lastInTextNodeGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Create a new instance of TextChunk - pub fn toJS(this: *TextChunk, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = TextChunk__create(globalObject, this); - std.debug.assert(value__.as(TextChunk).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return TextChunk__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of TextChunk. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*TextChunk) bool { - JSC.markBinding(@src()); - return TextChunk__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *TextChunk, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(TextChunk__dangerouslySetPtr(value, null)); - } - - extern fn TextChunk__fromJS(JSC.JSValue) ?*TextChunk; - extern fn TextChunk__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn TextChunk__create(globalObject: *JSC.JSGlobalObject, ptr: ?*TextChunk) JSC.JSValue; - - extern fn TextChunk__dangerouslySetPtr(JSC.JSValue, ?*TextChunk) bool; - - comptime { - if (@TypeOf(TextChunk.finalize) != (fn (*TextChunk) callconv(.C) void)) { - @compileLog("TextChunk.finalize is not a finalizer"); - } - - if (@TypeOf(TextChunk.after) != CallbackType) - @compileLog("Expected TextChunk.after to be a callback but received " ++ @typeName(@TypeOf(TextChunk.after))); - if (@TypeOf(TextChunk.before) != CallbackType) - @compileLog("Expected TextChunk.before to be a callback but received " ++ @typeName(@TypeOf(TextChunk.before))); - if (@TypeOf(TextChunk.lastInTextNode) != GetterType) - @compileLog("Expected TextChunk.lastInTextNode to be a getter"); - - if (@TypeOf(TextChunk.remove) != CallbackType) - @compileLog("Expected TextChunk.remove to be a callback but received " ++ @typeName(@TypeOf(TextChunk.remove))); - if (@TypeOf(TextChunk.removed) != GetterType) - @compileLog("Expected TextChunk.removed to be a getter"); - - if (@TypeOf(TextChunk.replace) != CallbackType) - @compileLog("Expected TextChunk.replace to be a callback but received " ++ @typeName(@TypeOf(TextChunk.replace))); - if (@TypeOf(TextChunk.getText) != GetterType) - @compileLog("Expected TextChunk.getText to be a getter"); - - if (!JSC.is_bindgen) { - @export(TextChunk.after, .{ .name = "TextChunkPrototype__after" }); - @export(TextChunk.before, .{ .name = "TextChunkPrototype__before" }); - @export(TextChunk.finalize, .{ .name = "TextChunkClass__finalize" }); - @export(TextChunk.getText, .{ .name = "TextChunkPrototype__getText" }); - @export(TextChunk.lastInTextNode, .{ .name = "TextChunkPrototype__lastInTextNode" }); - @export(TextChunk.remove, .{ .name = "TextChunkPrototype__remove" }); - @export(TextChunk.removed, .{ .name = "TextChunkPrototype__removed" }); - @export(TextChunk.replace, .{ .name = "TextChunkPrototype__replace" }); - } - } -}; -pub const JSTextDecoder = struct { - const TextDecoder = Classes.TextDecoder; - const GetterType = fn (*TextDecoder, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*TextDecoder, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*TextDecoder, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*TextDecoder, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*TextDecoder, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*TextDecoder { - JSC.markBinding(@src()); - return TextDecoder__fromJS(value); - } - - extern fn TextDecoderPrototype__encodingSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn TextDecoderPrototype__encodingGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `TextDecoder.encoding` setter - /// This value will be visited by the garbage collector. - pub fn encodingSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - TextDecoderPrototype__encodingSetCachedValue(thisValue, globalObject, value); - } - - /// `TextDecoder.encoding` getter - /// This value will be visited by the garbage collector. - pub fn encodingGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = TextDecoderPrototype__encodingGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Get the TextDecoder constructor value. - /// This loads lazily from the global object. - pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - return TextDecoder__getConstructor(globalObject); - } - - /// Create a new instance of TextDecoder - pub fn toJS(this: *TextDecoder, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = TextDecoder__create(globalObject, this); - std.debug.assert(value__.as(TextDecoder).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return TextDecoder__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of TextDecoder. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*TextDecoder) bool { - JSC.markBinding(@src()); - return TextDecoder__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *TextDecoder, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(TextDecoder__dangerouslySetPtr(value, null)); - } - - extern fn TextDecoder__fromJS(JSC.JSValue) ?*TextDecoder; - extern fn TextDecoder__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn TextDecoder__create(globalObject: *JSC.JSGlobalObject, ptr: ?*TextDecoder) JSC.JSValue; - - extern fn TextDecoder__dangerouslySetPtr(JSC.JSValue, ?*TextDecoder) bool; - - comptime { - if (@TypeOf(TextDecoder.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*TextDecoder)) { - @compileLog("TextDecoder.constructor is not a constructor"); - } - - if (@TypeOf(TextDecoder.finalize) != (fn (*TextDecoder) callconv(.C) void)) { - @compileLog("TextDecoder.finalize is not a finalizer"); - } - - if (@TypeOf(TextDecoder.decodeWithoutTypeChecks) != fn (*TextDecoder, *JSC.JSGlobalObject, *JSC.JSUint8Array) callconv(.C) JSC.JSValue) - @compileLog("Expected TextDecoder.decodeWithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(TextDecoder.decode) != CallbackType) - @compileLog("Expected TextDecoder.decode to be a callback but received " ++ @typeName(@TypeOf(TextDecoder.decode))); - if (@TypeOf(TextDecoder.getEncoding) != GetterType) - @compileLog("Expected TextDecoder.getEncoding to be a getter"); - - if (@TypeOf(TextDecoder.getFatal) != GetterType) - @compileLog("Expected TextDecoder.getFatal to be a getter"); - - if (@TypeOf(TextDecoder.getIgnoreBOM) != GetterType) - @compileLog("Expected TextDecoder.getIgnoreBOM to be a getter"); - - if (!JSC.is_bindgen) { - @export(TextDecoder.constructor, .{ .name = "TextDecoderClass__construct" }); - @export(TextDecoder.decode, .{ .name = "TextDecoderPrototype__decode" }); - @export(TextDecoder.decodeWithoutTypeChecks, .{ .name = "TextDecoderPrototype__decodeWithoutTypeChecks" }); - @export(TextDecoder.finalize, .{ .name = "TextDecoderClass__finalize" }); - @export(TextDecoder.getEncoding, .{ .name = "TextDecoderPrototype__getEncoding" }); - @export(TextDecoder.getFatal, .{ .name = "TextDecoderPrototype__getFatal" }); - @export(TextDecoder.getIgnoreBOM, .{ .name = "TextDecoderPrototype__getIgnoreBOM" }); - } - } -}; -pub const JSTimeout = struct { - const Timeout = Classes.Timeout; - const GetterType = fn (*Timeout, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*Timeout, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*Timeout, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*Timeout, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*Timeout, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*Timeout { - JSC.markBinding(@src()); - return Timeout__fromJS(value); - } - - extern fn TimeoutPrototype__argumentsSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn TimeoutPrototype__argumentsGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Timeout.arguments` setter - /// This value will be visited by the garbage collector. - pub fn argumentsSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - TimeoutPrototype__argumentsSetCachedValue(thisValue, globalObject, value); - } - - /// `Timeout.arguments` getter - /// This value will be visited by the garbage collector. - pub fn argumentsGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = TimeoutPrototype__argumentsGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - extern fn TimeoutPrototype__callbackSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn TimeoutPrototype__callbackGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Timeout.callback` setter - /// This value will be visited by the garbage collector. - pub fn callbackSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - TimeoutPrototype__callbackSetCachedValue(thisValue, globalObject, value); - } - - /// `Timeout.callback` getter - /// This value will be visited by the garbage collector. - pub fn callbackGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = TimeoutPrototype__callbackGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; - } - - /// Create a new instance of Timeout - pub fn toJS(this: *Timeout, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = Timeout__create(globalObject, this); - std.debug.assert(value__.as(Timeout).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return Timeout__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of Timeout. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Timeout) bool { - JSC.markBinding(@src()); - return Timeout__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *Timeout, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(Timeout__dangerouslySetPtr(value, null)); - } - - extern fn Timeout__fromJS(JSC.JSValue) ?*Timeout; - extern fn Timeout__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn Timeout__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Timeout) JSC.JSValue; - - extern fn Timeout__dangerouslySetPtr(JSC.JSValue, ?*Timeout) bool; - - comptime { - if (@TypeOf(Timeout.finalize) != (fn (*Timeout) callconv(.C) void)) { - @compileLog("Timeout.finalize is not a finalizer"); - } - - if (@TypeOf(Timeout.toPrimitive) != CallbackType) - @compileLog("Expected Timeout.toPrimitive to be a callback but received " ++ @typeName(@TypeOf(Timeout.toPrimitive))); - if (@TypeOf(Timeout.hasRef) != CallbackType) - @compileLog("Expected Timeout.hasRef to be a callback but received " ++ @typeName(@TypeOf(Timeout.hasRef))); - if (@TypeOf(Timeout.doRef) != CallbackType) - @compileLog("Expected Timeout.doRef to be a callback but received " ++ @typeName(@TypeOf(Timeout.doRef))); - if (@TypeOf(Timeout.doRefresh) != CallbackType) - @compileLog("Expected Timeout.doRefresh to be a callback but received " ++ @typeName(@TypeOf(Timeout.doRefresh))); - if (@TypeOf(Timeout.doUnref) != CallbackType) - @compileLog("Expected Timeout.doUnref to be a callback but received " ++ @typeName(@TypeOf(Timeout.doUnref))); - if (!JSC.is_bindgen) { - @export(Timeout.doRef, .{ .name = "TimeoutPrototype__doRef" }); - @export(Timeout.doRefresh, .{ .name = "TimeoutPrototype__doRefresh" }); - @export(Timeout.doUnref, .{ .name = "TimeoutPrototype__doUnref" }); - @export(Timeout.finalize, .{ .name = "TimeoutClass__finalize" }); - @export(Timeout.hasRef, .{ .name = "TimeoutPrototype__hasRef" }); - @export(Timeout.toPrimitive, .{ .name = "TimeoutPrototype__toPrimitive" }); - } - } -}; -pub const JSTranspiler = struct { - const Transpiler = Classes.Transpiler; - const GetterType = fn (*Transpiler, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*Transpiler, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*Transpiler, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*Transpiler, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*Transpiler, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*Transpiler { - JSC.markBinding(@src()); - return Transpiler__fromJS(value); - } - - /// Get the Transpiler constructor value. - /// This loads lazily from the global object. - pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - return Transpiler__getConstructor(globalObject); - } - - /// Create a new instance of Transpiler - pub fn toJS(this: *Transpiler, globalObject: *JSC.JSGlobalObject) JSC.JSValue { - JSC.markBinding(@src()); - if (comptime Environment.allow_assert) { - const value__ = Transpiler__create(globalObject, this); - std.debug.assert(value__.as(Transpiler).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return Transpiler__create(globalObject, this); - } - } - - /// Modify the internal ptr to point to a new instance of Transpiler. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Transpiler) bool { - JSC.markBinding(@src()); - return Transpiler__dangerouslySetPtr(value, ptr); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *Transpiler, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(Transpiler__dangerouslySetPtr(value, null)); - } - - extern fn Transpiler__fromJS(JSC.JSValue) ?*Transpiler; - extern fn Transpiler__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn Transpiler__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Transpiler) JSC.JSValue; - - extern fn Transpiler__dangerouslySetPtr(JSC.JSValue, ?*Transpiler) bool; - - comptime { - if (@TypeOf(Transpiler.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Transpiler)) { - @compileLog("Transpiler.constructor is not a constructor"); - } - - if (@TypeOf(Transpiler.finalize) != (fn (*Transpiler) callconv(.C) void)) { - @compileLog("Transpiler.finalize is not a finalizer"); - } - - if (@TypeOf(Transpiler.scan) != CallbackType) - @compileLog("Expected Transpiler.scan to be a callback but received " ++ @typeName(@TypeOf(Transpiler.scan))); - if (@TypeOf(Transpiler.scanImports) != CallbackType) - @compileLog("Expected Transpiler.scanImports to be a callback but received " ++ @typeName(@TypeOf(Transpiler.scanImports))); - if (@TypeOf(Transpiler.transform) != CallbackType) - @compileLog("Expected Transpiler.transform to be a callback but received " ++ @typeName(@TypeOf(Transpiler.transform))); - if (@TypeOf(Transpiler.transformSync) != CallbackType) - @compileLog("Expected Transpiler.transformSync to be a callback but received " ++ @typeName(@TypeOf(Transpiler.transformSync))); - if (!JSC.is_bindgen) { - @export(Transpiler.constructor, .{ .name = "TranspilerClass__construct" }); - @export(Transpiler.finalize, .{ .name = "TranspilerClass__finalize" }); - @export(Transpiler.scan, .{ .name = "TranspilerPrototype__scan" }); - @export(Transpiler.scanImports, .{ .name = "TranspilerPrototype__scanImports" }); - @export(Transpiler.transform, .{ .name = "TranspilerPrototype__transform" }); - @export(Transpiler.transformSync, .{ .name = "TranspilerPrototype__transformSync" }); - } - } -}; - -comptime { - _ = JSAttributeIterator; - _ = JSBigIntStats; - _ = JSBlob; - _ = JSBuildArtifact; - _ = JSBuildMessage; - _ = JSComment; - _ = JSCrypto; - _ = JSCryptoHasher; - _ = JSDebugHTTPSServer; - _ = JSDebugHTTPServer; - _ = JSDirent; - _ = JSDocEnd; - _ = JSDocType; - _ = JSElement; - _ = JSEndTag; - _ = JSExpect; - _ = JSExpectAny; - _ = JSExpectAnything; - _ = JSExpectArrayContaining; - _ = JSExpectStringContaining; - _ = JSExpectStringMatching; - _ = JSFFI; - _ = JSFSWatcher; - _ = JSFileSystemRouter; - _ = JSHTMLRewriter; - _ = JSHTTPSServer; - _ = JSHTTPServer; - _ = JSListener; - _ = JSMD4; - _ = JSMD5; - _ = JSMatchedRoute; - _ = JSNodeJSFS; - _ = JSRequest; - _ = JSResolveMessage; - _ = JSResponse; - _ = JSSHA1; - _ = JSSHA224; - _ = JSSHA256; - _ = JSSHA384; - _ = JSSHA512; - _ = JSSHA512_256; - _ = JSServerWebSocket; - _ = JSStatWatcher; - _ = JSStats; - _ = JSSubprocess; - _ = JSTCPSocket; - _ = JSTLSSocket; - _ = JSTextChunk; - _ = JSTextDecoder; - _ = JSTimeout; - _ = JSTranspiler; -} diff --git a/src/bun.js/bindings/header-gen.zig b/src/bun.js/bindings/header-gen.zig index 6f671e271a092..44656cf9ca25c 100644 --- a/src/bun.js/bindings/header-gen.zig +++ b/src/bun.js/bindings/header-gen.zig @@ -185,16 +185,7 @@ pub const C_Generator = struct { } self.write(")"); - const nonnull_slice = comptime nonnull.slice(); - if (comptime nonnull_slice.len > 0) { - self.write(" __attribute__((nonnull ("); - inline for (comptime nonnull_slice, 0..) |i, j| { - self.write(comptime std.fmt.comptimePrint("{d}", .{i})); - if (j != nonnull_slice.len - 1) - self.write(", "); - } - self.write(")))"); - } + // we don't handle nonnull due to MSVC not supporting it. defer self.write(";\n"); // const ReturnTypeInfo: std.builtin.Type = comptime @typeInfo(func.return_type); // switch (comptime ReturnTypeInfo) { @@ -640,7 +631,11 @@ pub fn HeaderGen(comptime first_import: type, comptime second_import: type, comp \\ \\#ifdef __cplusplus \\ #define AUTO_EXTERN_C extern "C" + \\ #ifdef WIN32 + \\ #define AUTO_EXTERN_C_ZIG extern "C" + \\ #else \\ #define AUTO_EXTERN_C_ZIG extern "C" __attribute__((weak)) + \\ #endif \\#else \\ #define AUTO_EXTERN_C \\ #define AUTO_EXTERN_C_ZIG __attribute__((weak)) @@ -655,7 +650,7 @@ pub fn HeaderGen(comptime first_import: type, comptime second_import: type, comp \\ \\#ifdef __cplusplus \\#include "root.h" - \\#include "JavaScriptCore/JSClassRef.h" + \\#include \\#endif \\#include "headers-handwritten.h" \\ diff --git a/src/bun.js/bindings/headers-cpp.h b/src/bun.js/bindings/headers-cpp.h index 9620a21e810b5..2754ba221dc3e 100644 --- a/src/bun.js/bindings/headers-cpp.h +++ b/src/bun.js/bindings/headers-cpp.h @@ -16,7 +16,7 @@ #ifndef INCLUDED_JavaScriptCore_JSObject_h #define INCLUDED_JavaScriptCore_JSObject_h -#include "JavaScriptCore/JSObject.h" +#include #endif extern "C" const size_t JSC__JSObject_object_size_ = sizeof(JSC::JSObject); @@ -40,7 +40,7 @@ extern "C" const size_t WebCore__FetchHeaders_object_align_ = alignof(WebCore::F #ifndef INCLUDED_JavaScriptCore_JSCell_h #define INCLUDED_JavaScriptCore_JSCell_h -#include "JavaScriptCore/JSCell.h" +#include #endif extern "C" const size_t JSC__JSCell_object_size_ = sizeof(JSC::JSCell); @@ -48,7 +48,7 @@ extern "C" const size_t JSC__JSCell_object_align_ = alignof(JSC::JSCell); #ifndef INCLUDED_JavaScriptCore_JSString_h #define INCLUDED_JavaScriptCore_JSString_h -#include "JavaScriptCore/JSString.h" +#include #endif extern "C" const size_t JSC__JSString_object_size_ = sizeof(JSC::JSString); @@ -56,7 +56,7 @@ extern "C" const size_t JSC__JSString_object_align_ = alignof(JSC::JSString); #ifndef INCLUDED_JavaScriptCore_JSModuleLoader_h #define INCLUDED_JavaScriptCore_JSModuleLoader_h -#include "JavaScriptCore/JSModuleLoader.h" +#include #endif extern "C" const size_t JSC__JSModuleLoader_object_size_ = sizeof(JSC::JSModuleLoader); @@ -72,7 +72,7 @@ extern "C" const size_t WebCore__AbortSignal_object_align_ = alignof(WebCore::Ab #ifndef INCLUDED_JavaScriptCore_JSPromise_h #define INCLUDED_JavaScriptCore_JSPromise_h -#include "JavaScriptCore/JSPromise.h" +#include #endif extern "C" const size_t JSC__JSPromise_object_size_ = sizeof(JSC::JSPromise); @@ -80,7 +80,7 @@ extern "C" const size_t JSC__JSPromise_object_align_ = alignof(JSC::JSPromise); #ifndef INCLUDED_JavaScriptCore_JSInternalPromise_h #define INCLUDED_JavaScriptCore_JSInternalPromise_h -#include "JavaScriptCore/JSInternalPromise.h" +#include #endif extern "C" const size_t JSC__JSInternalPromise_object_size_ = sizeof(JSC::JSInternalPromise); @@ -88,7 +88,7 @@ extern "C" const size_t JSC__JSInternalPromise_object_align_ = alignof(JSC::JSIn #ifndef INCLUDED_JavaScriptCore_JSFunction_h #define INCLUDED_JavaScriptCore_JSFunction_h -#include "JavaScriptCore/JSFunction.h" +#include #endif extern "C" const size_t JSC__JSFunction_object_size_ = sizeof(JSC::JSFunction); @@ -96,7 +96,7 @@ extern "C" const size_t JSC__JSFunction_object_align_ = alignof(JSC::JSFunction) #ifndef INCLUDED_JavaScriptCore_JSGlobalObject_h #define INCLUDED_JavaScriptCore_JSGlobalObject_h -#include "JavaScriptCore/JSGlobalObject.h" +#include #endif extern "C" const size_t JSC__JSGlobalObject_object_size_ = sizeof(JSC::JSGlobalObject); @@ -104,7 +104,7 @@ extern "C" const size_t JSC__JSGlobalObject_object_align_ = alignof(JSC::JSGloba #ifndef INCLUDED_JavaScriptCore_JSMap_h #define INCLUDED_JavaScriptCore_JSMap_h -#include "JavaScriptCore/JSMap.h" +#include #endif extern "C" const size_t JSC__JSMap_object_size_ = sizeof(JSC::JSMap); @@ -112,7 +112,7 @@ extern "C" const size_t JSC__JSMap_object_align_ = alignof(JSC::JSMap); #ifndef INCLUDED_JavaScriptCore_JSValue_h #define INCLUDED_JavaScriptCore_JSValue_h -#include "JavaScriptCore/JSValue.h" +#include #endif extern "C" const size_t JSC__JSValue_object_size_ = sizeof(JSC::JSValue); @@ -120,7 +120,7 @@ extern "C" const size_t JSC__JSValue_object_align_ = alignof(JSC::JSValue); #ifndef INCLUDED_JavaScriptCore_Exception_h #define INCLUDED_JavaScriptCore_Exception_h -#include "JavaScriptCore/Exception.h" +#include #endif extern "C" const size_t JSC__Exception_object_size_ = sizeof(JSC::Exception); @@ -128,7 +128,7 @@ extern "C" const size_t JSC__Exception_object_align_ = alignof(JSC::Exception); #ifndef INCLUDED_JavaScriptCore_VM_h #define INCLUDED_JavaScriptCore_VM_h -#include "JavaScriptCore/VM.h" +#include #endif extern "C" const size_t JSC__VM_object_size_ = sizeof(JSC::VM); @@ -136,7 +136,7 @@ extern "C" const size_t JSC__VM_object_align_ = alignof(JSC::VM); #ifndef INCLUDED_JavaScriptCore_ThrowScope_h #define INCLUDED_JavaScriptCore_ThrowScope_h -#include "JavaScriptCore/ThrowScope.h" +#include #endif extern "C" const size_t JSC__ThrowScope_object_size_ = sizeof(JSC::ThrowScope); @@ -144,7 +144,7 @@ extern "C" const size_t JSC__ThrowScope_object_align_ = alignof(JSC::ThrowScope) #ifndef INCLUDED_JavaScriptCore_CatchScope_h #define INCLUDED_JavaScriptCore_CatchScope_h -#include "JavaScriptCore/CatchScope.h" +#include #endif extern "C" const size_t JSC__CatchScope_object_size_ = sizeof(JSC::CatchScope); diff --git a/src/bun.js/bindings/headers-handwritten.h b/src/bun.js/bindings/headers-handwritten.h index d8cfa58ef6779..9dd0febb1060e 100644 --- a/src/bun.js/bindings/headers-handwritten.h +++ b/src/bun.js/bindings/headers-handwritten.h @@ -1,5 +1,6 @@ #pragma once - +#ifndef HEADERS_HANDWRITTEN +#define HEADERS_HANDWRITTEN typedef uint16_t ZigErrorCode; typedef struct VirtualMachine VirtualMachine; // exists to make headers.h happy @@ -18,6 +19,11 @@ typedef union BunStringImpl { } BunStringImpl; #else +namespace WTF { +class StringImpl; +class String; +} + typedef union BunStringImpl { ZigString zig; WTF::StringImpl* wtf; @@ -263,15 +269,13 @@ typedef struct { bool shared; } Bun__ArrayBuffer; -#include "../../../js/out/SyntheticModuleType.h" +#include "SyntheticModuleType.h" extern "C" const char* Bun__userAgent; extern "C" ZigErrorCode Zig_ErrorCodeParserError; extern "C" void ZigString__free(const unsigned char* ptr, size_t len, void* allocator); -extern "C" void Microtask__run(void* ptr, void* global); -extern "C" void Microtask__run_default(void* ptr, void* global); extern "C" bool Bun__transpileVirtualModule( JSC::JSGlobalObject* global, @@ -346,8 +350,6 @@ class ScriptArguments; using ScriptArguments = Inspector::ScriptArguments; -#endif - ALWAYS_INLINE void BunString::ref() { if (this->tag == BunStringTag::WTFStringImpl) { @@ -359,4 +361,7 @@ ALWAYS_INLINE void BunString::deref() if (this->tag == BunStringTag::WTFStringImpl) { this->impl.wtf->deref(); } -} \ No newline at end of file +} + +#endif // __cplusplus +#endif // HEADERS_HANDWRITTEN diff --git a/src/bun.js/bindings/headers.h b/src/bun.js/bindings/headers.h index cffb9f0c91622..a4c91cd9689cc 100644 --- a/src/bun.js/bindings/headers.h +++ b/src/bun.js/bindings/headers.h @@ -14,7 +14,11 @@ #ifdef __cplusplus #define AUTO_EXTERN_C extern "C" - #define AUTO_EXTERN_C_ZIG extern "C" __attribute__((weak)) + #ifdef WIN32 + #define AUTO_EXTERN_C_ZIG extern "C" + #else + #define AUTO_EXTERN_C_ZIG extern "C" __attribute__((weak)) + #endif #else #define AUTO_EXTERN_C #define AUTO_EXTERN_C_ZIG __attribute__((weak)) @@ -29,7 +33,7 @@ typedef void* JSClassRef; #ifdef __cplusplus #include "root.h" -#include "JavaScriptCore/JSClassRef.h" +#include #endif #include "headers-handwritten.h" typedef struct bJSC__JSPromise { unsigned char bytes[32]; } bJSC__JSPromise; @@ -143,18 +147,18 @@ typedef void* JSClassRef; #pragma mark - JSC::JSObject -CPP_DECL JSC__JSValue JSC__JSObject__create(JSC__JSGlobalObject* arg0, size_t arg1, void* arg2, void(* ArgFn3)(void* arg0, JSC__JSObject* arg1, JSC__JSGlobalObject* arg2)) __attribute__((nonnull (3))); +CPP_DECL JSC__JSValue JSC__JSObject__create(JSC__JSGlobalObject* arg0, size_t arg1, void* arg2, void(* ArgFn3)(void* arg0, JSC__JSObject* arg1, JSC__JSGlobalObject* arg2)); CPP_DECL size_t JSC__JSObject__getArrayLength(JSC__JSObject* arg0); CPP_DECL JSC__JSValue JSC__JSObject__getDirect(JSC__JSObject* arg0, JSC__JSGlobalObject* arg1, const ZigString* arg2); CPP_DECL JSC__JSValue JSC__JSObject__getIndex(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, uint32_t arg2); CPP_DECL void JSC__JSObject__putRecord(JSC__JSObject* arg0, JSC__JSGlobalObject* arg1, ZigString* arg2, ZigString* arg3, size_t arg4); -CPP_DECL JSC__JSValue ZigString__external(const ZigString* arg0, JSC__JSGlobalObject* arg1, void* arg2, void(* ArgFn3)(void* arg0, void* arg1, size_t arg2)) __attribute__((nonnull (3))); +CPP_DECL JSC__JSValue ZigString__external(const ZigString* arg0, JSC__JSGlobalObject* arg1, void* arg2, void(* ArgFn3)(void* arg0, void* arg1, size_t arg2)); CPP_DECL JSC__JSValue ZigString__to16BitValue(const ZigString* arg0, JSC__JSGlobalObject* arg1); CPP_DECL JSC__JSValue ZigString__toAtomicValue(const ZigString* arg0, JSC__JSGlobalObject* arg1); CPP_DECL JSC__JSValue ZigString__toErrorInstance(const ZigString* arg0, JSC__JSGlobalObject* arg1); CPP_DECL JSC__JSValue ZigString__toExternalU16(const uint16_t* arg0, size_t arg1, JSC__JSGlobalObject* arg2); CPP_DECL JSC__JSValue ZigString__toExternalValue(const ZigString* arg0, JSC__JSGlobalObject* arg1); -CPP_DECL JSC__JSValue ZigString__toExternalValueWithCallback(const ZigString* arg0, JSC__JSGlobalObject* arg1, void(* ArgFn2)(void* arg0, void* arg1, size_t arg2)) __attribute__((nonnull (2))); +CPP_DECL JSC__JSValue ZigString__toExternalValueWithCallback(const ZigString* arg0, JSC__JSGlobalObject* arg1, void(* ArgFn2)(void* arg0, void* arg1, size_t arg2)); CPP_DECL JSC__JSValue ZigString__toRangeErrorInstance(const ZigString* arg0, JSC__JSGlobalObject* arg1); CPP_DECL JSC__JSValue ZigString__toSyntaxErrorInstance(const ZigString* arg0, JSC__JSGlobalObject* arg1); CPP_DECL JSC__JSValue ZigString__toTypeErrorInstance(const ZigString* arg0, JSC__JSGlobalObject* arg1); @@ -223,7 +227,7 @@ CPP_DECL JSC__JSInternalPromise* JSC__JSModuleLoader__loadAndEvaluateModule(JSC_ CPP_DECL bool WebCore__AbortSignal__aborted(WebCore__AbortSignal* arg0); CPP_DECL JSC__JSValue WebCore__AbortSignal__abortReason(WebCore__AbortSignal* arg0); -CPP_DECL WebCore__AbortSignal* WebCore__AbortSignal__addListener(WebCore__AbortSignal* arg0, void* arg1, void(* ArgFn2)(void* arg0, JSC__JSValue JSValue1)) __attribute__((nonnull (2))); +CPP_DECL WebCore__AbortSignal* WebCore__AbortSignal__addListener(WebCore__AbortSignal* arg0, void* arg1, void(* ArgFn2)(void* arg0, JSC__JSValue JSValue1)); CPP_DECL void WebCore__AbortSignal__cleanNativeBindings(WebCore__AbortSignal* arg0, void* arg1); CPP_DECL JSC__JSValue WebCore__AbortSignal__create(JSC__JSGlobalObject* arg0); CPP_DECL JSC__JSValue WebCore__AbortSignal__createAbortError(const ZigString* arg0, const ZigString* arg1, JSC__JSGlobalObject* arg2); @@ -298,7 +302,7 @@ CPP_DECL void JSC__JSMap__set(JSC__JSMap* arg0, JSC__JSGlobalObject* arg1, JSC__ #pragma mark - JSC::JSValue -CPP_DECL void JSC__JSValue___then(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2, JSC__JSValue(* ArgFn3)(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1), JSC__JSValue(* ArgFn4)(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1)) __attribute__((nonnull (3, 4))); +CPP_DECL void JSC__JSValue___then(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2, JSC__JSValue(* ArgFn3)(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1), JSC__JSValue(* ArgFn4)(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1)); CPP_DECL bool JSC__JSValue__asArrayBuffer_(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, Bun__ArrayBuffer* arg2); CPP_DECL unsigned char JSC__JSValue__asBigIntCompare(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2); CPP_DECL JSC__JSCell* JSC__JSValue__asCell(JSC__JSValue JSValue0); @@ -325,9 +329,9 @@ CPP_DECL bool JSC__JSValue__eqlCell(JSC__JSValue JSValue0, JSC__JSCell* arg1); CPP_DECL bool JSC__JSValue__eqlValue(JSC__JSValue JSValue0, JSC__JSValue JSValue1); CPP_DECL JSC__JSValue JSC__JSValue__fastGet_(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, unsigned char arg2); CPP_DECL JSC__JSValue JSC__JSValue__fastGetDirect_(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, unsigned char arg2); -CPP_DECL void JSC__JSValue__forEach(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, void* arg2, void(* ArgFn3)(JSC__VM* arg0, JSC__JSGlobalObject* arg1, void* arg2, JSC__JSValue JSValue3)) __attribute__((nonnull (3))); -CPP_DECL void JSC__JSValue__forEachProperty(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, void* arg2, void(* ArgFn3)(JSC__JSGlobalObject* arg0, void* arg1, ZigString* arg2, JSC__JSValue JSValue3, bool arg4)) __attribute__((nonnull (3))); -CPP_DECL void JSC__JSValue__forEachPropertyOrdered(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, void* arg2, void(* ArgFn3)(JSC__JSGlobalObject* arg0, void* arg1, ZigString* arg2, JSC__JSValue JSValue3, bool arg4)) __attribute__((nonnull (3))); +CPP_DECL void JSC__JSValue__forEach(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, void* arg2, void(* ArgFn3)(JSC__VM* arg0, JSC__JSGlobalObject* arg1, void* arg2, JSC__JSValue JSValue3)); +CPP_DECL void JSC__JSValue__forEachProperty(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, void* arg2, void(* ArgFn3)(JSC__JSGlobalObject* arg0, void* arg1, ZigString* arg2, JSC__JSValue JSValue3, bool arg4)); +CPP_DECL void JSC__JSValue__forEachPropertyOrdered(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, void* arg2, void(* ArgFn3)(JSC__JSGlobalObject* arg0, void* arg1, ZigString* arg2, JSC__JSValue JSValue3, bool arg4)); CPP_DECL JSC__JSValue JSC__JSValue__fromEntries(JSC__JSGlobalObject* arg0, ZigString* arg1, ZigString* arg2, size_t arg3, bool arg4); CPP_DECL JSC__JSValue JSC__JSValue__fromInt64NoTruncate(JSC__JSGlobalObject* arg0, int64_t arg1); CPP_DECL JSC__JSValue JSC__JSValue__fromUInt64NoTruncate(JSC__JSGlobalObject* arg0, uint64_t arg1); @@ -414,14 +418,14 @@ CPP_DECL size_t JSC__VM__blockBytesAllocated(JSC__VM* arg0); CPP_DECL void JSC__VM__clearExecutionTimeLimit(JSC__VM* arg0); CPP_DECL void JSC__VM__collectAsync(JSC__VM* arg0); CPP_DECL JSC__VM* JSC__VM__create(unsigned char HeapType0); -CPP_DECL void JSC__VM__deferGC(JSC__VM* arg0, void* arg1, void(* ArgFn2)(void* arg0)) __attribute__((nonnull (2))); +CPP_DECL void JSC__VM__deferGC(JSC__VM* arg0, void* arg1, void(* ArgFn2)(void* arg0)); CPP_DECL void JSC__VM__deinit(JSC__VM* arg0, JSC__JSGlobalObject* arg1); CPP_DECL void JSC__VM__deleteAllCode(JSC__VM* arg0, JSC__JSGlobalObject* arg1); CPP_DECL void JSC__VM__drainMicrotasks(JSC__VM* arg0); CPP_DECL bool JSC__VM__executionForbidden(JSC__VM* arg0); CPP_DECL size_t JSC__VM__externalMemorySize(JSC__VM* arg0); CPP_DECL size_t JSC__VM__heapSize(JSC__VM* arg0); -CPP_DECL void JSC__VM__holdAPILock(JSC__VM* arg0, void* arg1, void(* ArgFn2)(void* arg0)) __attribute__((nonnull (2))); +CPP_DECL void JSC__VM__holdAPILock(JSC__VM* arg0, void* arg1, void(* ArgFn2)(void* arg0)); CPP_DECL bool JSC__VM__isEntered(JSC__VM* arg0); CPP_DECL bool JSC__VM__isJITEnabled(); CPP_DECL void JSC__VM__notifyNeedDebuggerBreak(JSC__VM* arg0); @@ -436,7 +440,7 @@ CPP_DECL void JSC__VM__setExecutionTimeLimit(JSC__VM* arg0, double arg1); CPP_DECL void JSC__VM__shrinkFootprint(JSC__VM* arg0); CPP_DECL void JSC__VM__throwError(JSC__VM* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2); CPP_DECL void JSC__VM__throwError(JSC__VM* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2); -CPP_DECL void JSC__VM__whenIdle(JSC__VM* arg0, void(* ArgFn1)()) __attribute__((nonnull (1))); +CPP_DECL void JSC__VM__whenIdle(JSC__VM* arg0, void(* ArgFn1)()); #pragma mark - JSC::ThrowScope diff --git a/src/bun.js/bindings/helpers.h b/src/bun.js/bindings/helpers.h index 702b0744b1050..835c55b6cddc6 100644 --- a/src/bun.js/bindings/helpers.h +++ b/src/bun.js/bindings/helpers.h @@ -7,7 +7,6 @@ #include #include #include -#include #include #include diff --git a/src/bun.js/bindings/isBuiltinModule.cpp b/src/bun.js/bindings/isBuiltinModule.cpp index b8e69f479d00c..ee1bd77a76913 100644 --- a/src/bun.js/bindings/isBuiltinModule.cpp +++ b/src/bun.js/bindings/isBuiltinModule.cpp @@ -83,16 +83,17 @@ static constexpr ASCIILiteral builtinModuleNamesSortedLength[] = { namespace Bun { -bool isBuiltinModule(const String &namePossiblyWithNodePrefix) { - String name = namePossiblyWithNodePrefix; - if (name.startsWith("node:"_s)) - name = name.substringSharingImpl(5); +bool isBuiltinModule(const String& namePossiblyWithNodePrefix) +{ + String name = namePossiblyWithNodePrefix; + if (name.startsWith("node:"_s)) + name = name.substringSharingImpl(5); - for (auto &builtinModule : builtinModuleNamesSortedLength) { - if (name == builtinModule) - return true; - } - return false; + for (auto& builtinModule : builtinModuleNamesSortedLength) { + if (name == builtinModule) + return true; + } + return false; } } // namespace Bun \ No newline at end of file diff --git a/src/bun.js/bindings/napi.cpp b/src/bun.js/bindings/napi.cpp index 29dcd3b60c683..0b514f58f6d49 100644 --- a/src/bun.js/bindings/napi.cpp +++ b/src/bun.js/bindings/napi.cpp @@ -3,55 +3,55 @@ #include "root.h" #include "ZigGlobalObject.h" #include "helpers.h" -#include "JavaScriptCore/JSObjectInlines.h" -#include "JavaScriptCore/JSCellInlines.h" -#include "wtf/text/ExternalStringImpl.h" -#include "wtf/text/StringCommon.h" -#include "wtf/text/StringImpl.h" -#include "JavaScriptCore/JSMicrotask.h" -#include "JavaScriptCore/ObjectConstructor.h" -#include "JavaScriptCore/JSModuleLoader.h" -#include "wtf/text/StringView.h" -#include "wtf/text/StringBuilder.h" -#include "wtf/text/WTFString.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "BufferEncodingType.h" -#include "JavaScriptCore/AggregateError.h" -#include "JavaScriptCore/BytecodeIndex.h" -#include "JavaScriptCore/CallFrame.h" -#include "JavaScriptCore/CallFrameInlines.h" -#include "JavaScriptCore/ClassInfo.h" -#include "JavaScriptCore/CodeBlock.h" -#include "JavaScriptCore/Completion.h" -#include "JavaScriptCore/Error.h" -#include "JavaScriptCore/ErrorInstance.h" -#include "JavaScriptCore/Exception.h" -#include "JavaScriptCore/ExceptionScope.h" -#include "JavaScriptCore/FunctionConstructor.h" -#include "JavaScriptCore/HashMapImpl.h" -#include "JavaScriptCore/HashMapImplInlines.h" -#include "JavaScriptCore/Heap.h" -#include "JavaScriptCore/Identifier.h" -#include "JavaScriptCore/InitializeThreading.h" -#include "JavaScriptCore/IteratorOperations.h" -#include "JavaScriptCore/JSArray.h" -#include "JavaScriptCore/JSInternalPromise.h" -#include "JavaScriptCore/ObjectConstructor.h" -#include "JavaScriptCore/ArrayBuffer.h" -#include "JavaScriptCore/JSArrayBuffer.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "JSFFIFunction.h" -#include "JavaScriptCore/JavaScript.h" -#include "JavaScriptCore/JSWeakValue.h" +#include +#include #include "napi.h" -#include "JavaScriptCore/GetterSetter.h" -#include "JavaScriptCore/JSSourceCode.h" -#include "JavaScriptCore/JSNativeStdFunction.h" -#include "JavaScriptCore/BigIntObject.h" +#include +#include +#include +#include #include "ScriptExecutionContext.h" #include "Strong.h" #include "../modules/ObjectModule.h" -#include "JavaScriptCore/JSSourceCode.h" +#include #include "napi_external.h" // #include diff --git a/src/bun.js/bindings/napi.h b/src/bun.js/bindings/napi.h index b157c43673276..da4b01c204f59 100644 --- a/src/bun.js/bindings/napi.h +++ b/src/bun.js/bindings/napi.h @@ -5,14 +5,14 @@ class GlobalObject; } #include "root.h" -#include "JavaScriptCore/JSFunction.h" -#include "JavaScriptCore/VM.h" +#include +#include #include "headers-handwritten.h" #include "BunClientData.h" -#include "JavaScriptCore/CallFrame.h" +#include #include "js_native_api_types.h" -#include "JavaScriptCore/JSWeakValue.h" +#include #include "JSFFIFunction.h" namespace JSC { diff --git a/src/bun.js/bindings/objects.h b/src/bun.js/bindings/objects.h index 622a468042c0c..caf520dd8eb5e 100644 --- a/src/bun.js/bindings/objects.h +++ b/src/bun.js/bindings/objects.h @@ -3,9 +3,9 @@ // #include "root.h" // #include "headers.h" -// #include "JavaScriptCore/JSObject.h" +// #include // -// #include "JavaScriptCore/InternalFunction.h" +// #include // namespace Zig { diff --git a/src/bun.js/bindings/root.h b/src/bun.js/bindings/root.h index 69698bf8c2b2e..6d1739b8821dc 100644 --- a/src/bun.js/bindings/root.h +++ b/src/bun.js/bindings/root.h @@ -23,6 +23,7 @@ * Boston, MA 02110-1301, USA. * */ + #define HAVE_CONFIG_H 1 #define BUILDING_WITH_CMAKE 1 @@ -37,25 +38,17 @@ #define JSC_MAC_VERSION_TBA 0 #define JSC_IOS_VERSION_TBA 0 -#include "wtf/ExportMacros.h" - -#if !defined(JS_EXPORT_PRIVATE) +#include -#if defined(BUILDING_JavaScriptCore) || defined(STATICALLY_LINKED_WITH_JavaScriptCore) -#define JS_EXPORT_PRIVATE WTF_EXPORT_DECLARATION -#else -#define JS_EXPORT_PRIVATE WTF_IMPORT_DECLARATION -#endif - -#endif +#define JS_EXPORT_PRIVATE #ifdef __cplusplus #undef new #undef delete -#include "wtf/FastMalloc.h" +#include #endif -#include "wtf/DisallowCType.h" +#include /* Disabling warning C4206: nonstandard extension used: translation unit is empty. By design, we rely on #define flags to make some translation units empty. @@ -63,26 +56,24 @@ */ #if COMPILER(MSVC) #pragma warning(disable : 4206) + +// __builtin_unreachable() polyfill +static __declspec(noreturn) void __builtin_unreachable() { __assume(0); } #endif #ifndef WEBCORE_EXPORT #define WEBCORE_EXPORT JS_EXPORT_PRIVATE #endif -#include "wtf/PlatformCallingConventions.h" -#include "JavaScriptCore/JSCInlines.h" -#include "wtf/IsoMalloc.h" -#include "wtf/IsoMallocInlines.h" +#include +#include +#include +#include +#include +#include #define ENABLE_WEB_CRYPTO 1 #define USE_OPENSSL 1 #define HAVE_RSA_PSS 1 -// #define WTF_MAKE_ISO_ALLOCATED(className) \ -// WTF_MAKE_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER(className) - -// #define WTF_MAKE_ISO_ALLOCATED_EXPORT(className, a) WTF_MAKE_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER(className); - -// #define WTF_MAKE_ISO_ALLOCATED_IMPL(className) - #endif \ No newline at end of file diff --git a/src/bun.js/bindings/spawn.cpp b/src/bun.js/bindings/spawn.cpp index 531941f8a4004..04570f4bab174 100644 --- a/src/bun.js/bindings/spawn.cpp +++ b/src/bun.js/bindings/spawn.cpp @@ -1,3 +1,5 @@ +#ifndef WIN32 + #include #include @@ -16,3 +18,5 @@ extern "C" int posix_spawnattr_reset_signals(posix_spawnattr_t* attr) return 0; } + +#endif \ No newline at end of file diff --git a/src/bun.js/bindings/sqlite/JSSQLStatement.cpp b/src/bun.js/bindings/sqlite/JSSQLStatement.cpp index 2ce4cc9a6a99e..e5c3c1d7f8b57 100644 --- a/src/bun.js/bindings/sqlite/JSSQLStatement.cpp +++ b/src/bun.js/bindings/sqlite/JSSQLStatement.cpp @@ -1,28 +1,27 @@ #include "root.h" #include "JSSQLStatement.h" -#include "JavaScriptCore/JSObjectInlines.h" -#include "wtf/text/ExternalStringImpl.h" - -#include "JavaScriptCore/FunctionPrototype.h" -#include "JavaScriptCore/HeapAnalyzer.h" - -#include "JavaScriptCore/JSDestructibleObjectHeapCellType.h" -#include "JavaScriptCore/SlotVisitorMacros.h" -#include "JavaScriptCore/ObjectConstructor.h" -#include "JavaScriptCore/SubspaceInlines.h" -#include "wtf/GetPtr.h" -#include "wtf/PointerPreparations.h" -#include "wtf/URL.h" -#include "JavaScriptCore/TypedArrayInlines.h" -#include "JavaScriptCore/PropertyNameArray.h" -#include "Buffer.h" +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "GCDefferalContext.h" -#include "Buffer.h" #include #include "DOMJITIDLConvert.h" #include "DOMJITIDLType.h" +#include "JSBuffer.h" #include "DOMJITIDLTypeFilter.h" #include "DOMJITHelpers.h" #include @@ -37,7 +36,7 @@ // we only call one pointer for the actual library // and it means there's less work for DYLD to do on startup // i.e. it shouldn't have any impact on startup time -#ifdef LAZY_LOAD_SQLITE +#if LAZY_LOAD_SQLITE #include "lazy_sqlite3.h" #else static inline int lazyLoadSQLite() @@ -201,8 +200,8 @@ class JSSQLStatement : public JSC::JSNonFinalObject { uint64_t version; bool hasExecuted = false; std::unique_ptr columnNames; - mutable WriteBarrier _prototype; - mutable WriteBarrier _structure; + mutable JSC::WriteBarrier _prototype; + mutable JSC::WriteBarrier _structure; protected: JSSQLStatement(JSC::Structure* structure, JSDOMGlobalObject& globalObject, sqlite3_stmt* stmt, VersionSqlite3* version_db) @@ -512,7 +511,7 @@ JSC_DEFINE_HOST_FUNCTION(jsSQLStatementSetCustomSQLite, (JSC::JSGlobalObject * l return JSValue::encode(JSC::jsUndefined()); } -#ifdef LAZY_LOAD_SQLITE +#if LAZY_LOAD_SQLITE if (sqlite3_handle) { throwException(lexicalGlobalObject, scope, createError(lexicalGlobalObject, "SQLite already loaded\nThis function can only be called before SQLite has been loaded and exactly once. SQLite auto-loads when the first time you open a Database."_s)); return JSValue::encode(JSC::jsUndefined()); @@ -1567,7 +1566,7 @@ JSC_DEFINE_HOST_FUNCTION(jsSQLStatementToStringFunction, (JSC::JSGlobalObject * RELEASE_AND_RETURN(scope, JSValue::encode(jsString)); } -JSC_DEFINE_CUSTOM_GETTER(jsSqlStatementGetColumnNames, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsSqlStatementGetColumnNames, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { JSC::VM& vm = lexicalGlobalObject->vm(); JSSQLStatement* castedThis = jsDynamicCast(JSValue::decode(thisValue)); @@ -1595,7 +1594,7 @@ JSC_DEFINE_CUSTOM_GETTER(jsSqlStatementGetColumnNames, (JSGlobalObject * lexical return JSC::JSValue::encode(array); } -JSC_DEFINE_CUSTOM_GETTER(jsSqlStatementGetColumnCount, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsSqlStatementGetColumnCount, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { JSC::VM& vm = lexicalGlobalObject->vm(); JSSQLStatement* castedThis = jsDynamicCast(JSValue::decode(thisValue)); @@ -1606,7 +1605,7 @@ JSC_DEFINE_CUSTOM_GETTER(jsSqlStatementGetColumnCount, (JSGlobalObject * lexical RELEASE_AND_RETURN(scope, JSValue::encode(JSC::jsNumber(sqlite3_column_count(castedThis->stmt)))); } -JSC_DEFINE_CUSTOM_GETTER(jsSqlStatementGetParamCount, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsSqlStatementGetParamCount, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { JSC::VM& vm = lexicalGlobalObject->vm(); JSSQLStatement* castedThis = jsDynamicCast(JSValue::decode(thisValue)); diff --git a/src/bun.js/bindings/sqlite/JSSQLStatement.h b/src/bun.js/bindings/sqlite/JSSQLStatement.h index b628f2a3875b1..20804bd3c3f62 100644 --- a/src/bun.js/bindings/sqlite/JSSQLStatement.h +++ b/src/bun.js/bindings/sqlite/JSSQLStatement.h @@ -28,18 +28,30 @@ #include "root.h" #include "ZigGlobalObject.h" -#include "JavaScriptCore/JSFunction.h" -#include "JavaScriptCore/VM.h" +#include +#include #include "headers-handwritten.h" #include "BunClientData.h" -#include "JavaScriptCore/CallFrame.h" +#include +#ifndef LAZY_LOAD_SQLITE_DEFAULT_SETTING #if defined(__APPLE__) -#define LAZY_LOAD_SQLITE 1 +#define LAZY_LOAD_SQLITE_DEFAULT_SETTING 1 +#endif +#endif + +#ifndef LAZY_LOAD_SQLITE +#ifdef LAZY_LOAD_SQLITE_DEFAULT_SETTING +#define LAZY_LOAD_SQLITE LAZY_LOAD_SQLITE_DEFAULT_SETTING +#endif +#endif + +#ifndef LAZY_LOAD_SQLITE +#define LAZY_LOAD_SQLITE 0 #endif -#ifdef LAZY_LOAD_SQLITE +#if LAZY_LOAD_SQLITE #include "sqlite3.h" #else #include "sqlite3_local.h" diff --git a/src/bun.js/bindings/sqlite/lazy_sqlite3.h b/src/bun.js/bindings/sqlite/lazy_sqlite3.h index a012f6ab62a3b..ad667866ced9b 100644 --- a/src/bun.js/bindings/sqlite/lazy_sqlite3.h +++ b/src/bun.js/bindings/sqlite/lazy_sqlite3.h @@ -1,4 +1,12 @@ +#pragma once + +#include "root.h" + +#if !OS(WINDOWS) #include +#else +#include +#endif typedef int (*lazy_sqlite3_bind_blob_type)(sqlite3_stmt*, int, const void*, int n, void (*)(void*)); typedef int (*lazy_sqlite3_bind_double_type)(sqlite3_stmt*, int, double); @@ -156,15 +164,33 @@ static lazy_sqlite3_compileoption_used_type lazy_sqlite3_compileoption_used; #define sqlite3_column_int64 lazy_sqlite3_column_int64 #define sqlite3_compileoption_used lazy_sqlite3_compileoption_used; -static void* sqlite3_handle = nullptr; +#if !OS(WINDOWS) +#define HMODULE void* +#else +static const char* dlerror() { return "Unknown error while loading sqlite"; } +#define dlsym GetProcAddress +#endif + +#if OS(WINDOWS) +static const char* sqlite3_lib_path = "sqlite3.dll"; +#elif OS(DARWIN) static const char* sqlite3_lib_path = "libsqlite3.dylib"; +#else +static const char* sqlite3_lib_path = "sqlite3"; +#endif + +static HMODULE sqlite3_handle = nullptr; static int lazyLoadSQLite() { if (sqlite3_handle) return 0; - +#if OS(WINDOWS) + sqlite3_handle = LoadLibraryA(sqlite3_lib_path); +#else sqlite3_handle = dlopen(sqlite3_lib_path, RTLD_LAZY); +#endif + if (!sqlite3_handle) { return -1; } @@ -211,3 +237,7 @@ static int lazyLoadSQLite() return 0; } + +#if OS(WINDOWS) +#undef dlsym +#endif \ No newline at end of file diff --git a/src/bun.js/bindings/sqlite/sqlite3.c b/src/bun.js/bindings/sqlite/sqlite3.c index 568f3c679b790..80a3ec1c1bb52 100644 --- a/src/bun.js/bindings/sqlite/sqlite3.c +++ b/src/bun.js/bindings/sqlite/sqlite3.c @@ -22,7 +22,7 @@ #define SQLITE_CORE 1 #define SQLITE_AMALGAMATION 1 #ifndef SQLITE_PRIVATE -# define SQLITE_PRIVATE static +#define SQLITE_PRIVATE static #endif /************** Begin file sqliteInt.h ***************************************/ /* diff --git a/src/bun.js/bindings/webcore/BufferSource.h b/src/bun.js/bindings/webcore/BufferSource.h index ee78e38d11e0f..3fed841d14e65 100644 --- a/src/bun.js/bindings/webcore/BufferSource.h +++ b/src/bun.js/bindings/webcore/BufferSource.h @@ -26,9 +26,9 @@ #pragma once -#include "JavaScriptCore/ArrayBuffer.h" -#include "JavaScriptCore/ArrayBufferView.h" -#include "wtf/RefPtr.h" +#include +#include +#include #include namespace WebCore { diff --git a/src/bun.js/bindings/webcore/BunBroadcastChannelRegistry.h b/src/bun.js/bindings/webcore/BunBroadcastChannelRegistry.h index 5576b732e5c89..c7eec916b8d90 100644 --- a/src/bun.js/bindings/webcore/BunBroadcastChannelRegistry.h +++ b/src/bun.js/bindings/webcore/BunBroadcastChannelRegistry.h @@ -1,9 +1,9 @@ #pragma once #include "BroadcastChannelRegistry.h" -#include "wtf/CallbackAggregator.h" -#include "wtf/Vector.h" -#include "wtf/HashMap.h" +#include +#include +#include namespace WebCore { diff --git a/src/bun.js/bindings/webcore/DOMClientIsoSubspaces.h b/src/bun.js/bindings/webcore/DOMClientIsoSubspaces.h index c6860580badf5..418baffa09c93 100644 --- a/src/bun.js/bindings/webcore/DOMClientIsoSubspaces.h +++ b/src/bun.js/bindings/webcore/DOMClientIsoSubspaces.h @@ -2,8 +2,8 @@ #include "root.h" -#include "wtf/FastMalloc.h" -#include "wtf/Noncopyable.h" +#include +#include namespace WebCore { using namespace JSC; diff --git a/src/bun.js/bindings/webcore/DOMConstructors.h b/src/bun.js/bindings/webcore/DOMConstructors.h index 37c5d92205bc1..89fe962110fd3 100644 --- a/src/bun.js/bindings/webcore/DOMConstructors.h +++ b/src/bun.js/bindings/webcore/DOMConstructors.h @@ -1,6 +1,6 @@ -#include "wtf/FastMalloc.h" -#include "wtf/Noncopyable.h" +#include +#include #pragma once diff --git a/src/bun.js/bindings/webcore/DOMIsoSubspaces.h b/src/bun.js/bindings/webcore/DOMIsoSubspaces.h index 6d7da432ee225..db093169f0e46 100644 --- a/src/bun.js/bindings/webcore/DOMIsoSubspaces.h +++ b/src/bun.js/bindings/webcore/DOMIsoSubspaces.h @@ -3,8 +3,8 @@ #include "root.h" -#include "wtf/FastMalloc.h" -#include "wtf/Noncopyable.h" +#include +#include namespace WebCore { using namespace JSC; diff --git a/src/bun.js/bindings/webcore/EventFactory.cpp b/src/bun.js/bindings/webcore/EventFactory.cpp index ccb5b41b49fd1..e920afe217516 100644 --- a/src/bun.js/bindings/webcore/EventFactory.cpp +++ b/src/bun.js/bindings/webcore/EventFactory.cpp @@ -159,159 +159,163 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj // #endif case MessageEventInterfaceType: return createWrapper(globalObject, WTFMove(impl)); - // case MouseEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // case MutationEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #if ENABLE(NOTIFICATION_EVENT) - // case NotificationEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // #if ENABLE(WEB_AUDIO) - // case OfflineAudioCompletionEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // #if ENABLE(MEDIA_STREAM) - // case OverconstrainedErrorEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // case OverflowEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // case PageTransitionEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #if ENABLE(PAYMENT_REQUEST) - // case PaymentMethodChangeEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // #if ENABLE(PAYMENT_REQUEST) - // case PaymentRequestUpdateEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // #if ENABLE(PICTURE_IN_PICTURE_API) - // case PictureInPictureEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // case PointerEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // case PopStateEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // case ProgressEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // case PromiseRejectionEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #if ENABLE(SERVICE_WORKER) - // case PushEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // #if ENABLE(SERVICE_WORKER) - // case PushSubscriptionChangeEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // #if ENABLE(WEB_RTC) - // case RTCDTMFToneChangeEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // #if ENABLE(WEB_RTC) - // case RTCDataChannelEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // #if ENABLE(WEB_RTC) - // case RTCErrorEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // #if ENABLE(WEB_RTC) - // case RTCPeerConnectionIceErrorEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // #if ENABLE(WEB_RTC) - // case RTCPeerConnectionIceEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // #if ENABLE(WEB_RTC) - // case RTCRtpSFrameTransformErrorEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // #if ENABLE(WEB_RTC) - // case RTCTrackEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // #if ENABLE(WEB_RTC) - // case RTCTransformEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // case SVGZoomEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // case SecurityPolicyViolationEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // case SpeechRecognitionErrorEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // case SpeechRecognitionEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #if ENABLE(SPEECH_SYNTHESIS) - // case SpeechSynthesisErrorEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // #if ENABLE(SPEECH_SYNTHESIS) - // case SpeechSynthesisEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // case StorageEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // case SubmitEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // case TextEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #if ENABLE(TOUCH_EVENTS) - // case TouchEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // #if ENABLE(VIDEO) - // case TrackEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // case TransitionEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // case UIEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #if ENABLE(WEBGL) - // case WebGLContextEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // #if ENABLE(LEGACY_ENCRYPTED_MEDIA) - // case WebKitMediaKeyMessageEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // #if ENABLE(LEGACY_ENCRYPTED_MEDIA) - // case WebKitMediaKeyNeededEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // #if ENABLE(WIRELESS_PLAYBACK_TARGET) - // case WebKitPlaybackTargetAvailabilityEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // case WheelEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // case XMLHttpRequestProgressEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #if ENABLE(WEBXR) - // case XRInputSourceEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // #if ENABLE(WEBXR) - // case XRInputSourcesChangeEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // #if ENABLE(WEBXR) - // case XRReferenceSpaceEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // #if ENABLE(WEBXR) - // case XRSessionEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); - // #endif - // } - return createWrapper(globalObject, WTFMove(impl)); + // case MouseEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // case MutationEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #if ENABLE(NOTIFICATION_EVENT) + // case NotificationEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // #if ENABLE(WEB_AUDIO) + // case OfflineAudioCompletionEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // #if ENABLE(MEDIA_STREAM) + // case OverconstrainedErrorEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // case OverflowEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // case PageTransitionEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #if ENABLE(PAYMENT_REQUEST) + // case PaymentMethodChangeEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // #if ENABLE(PAYMENT_REQUEST) + // case PaymentRequestUpdateEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // #if ENABLE(PICTURE_IN_PICTURE_API) + // case PictureInPictureEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // case PointerEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // case PopStateEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // case ProgressEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // case PromiseRejectionEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #if ENABLE(SERVICE_WORKER) + // case PushEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // #if ENABLE(SERVICE_WORKER) + // case PushSubscriptionChangeEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // #if ENABLE(WEB_RTC) + // case RTCDTMFToneChangeEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // #if ENABLE(WEB_RTC) + // case RTCDataChannelEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // #if ENABLE(WEB_RTC) + // case RTCErrorEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // #if ENABLE(WEB_RTC) + // case RTCPeerConnectionIceErrorEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // #if ENABLE(WEB_RTC) + // case RTCPeerConnectionIceEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // #if ENABLE(WEB_RTC) + // case RTCRtpSFrameTransformErrorEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // #if ENABLE(WEB_RTC) + // case RTCTrackEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // #if ENABLE(WEB_RTC) + // case RTCTransformEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // case SVGZoomEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // case SecurityPolicyViolationEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // case SpeechRecognitionErrorEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // case SpeechRecognitionEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #if ENABLE(SPEECH_SYNTHESIS) + // case SpeechSynthesisErrorEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // #if ENABLE(SPEECH_SYNTHESIS) + // case SpeechSynthesisEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // case StorageEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // case SubmitEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // case TextEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #if ENABLE(TOUCH_EVENTS) + // case TouchEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // #if ENABLE(VIDEO) + // case TrackEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // case TransitionEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // case UIEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #if ENABLE(WEBGL) + // case WebGLContextEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // #if ENABLE(LEGACY_ENCRYPTED_MEDIA) + // case WebKitMediaKeyMessageEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // #if ENABLE(LEGACY_ENCRYPTED_MEDIA) + // case WebKitMediaKeyNeededEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // #if ENABLE(WIRELESS_PLAYBACK_TARGET) + // case WebKitPlaybackTargetAvailabilityEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // case WheelEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // case XMLHttpRequestProgressEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #if ENABLE(WEBXR) + // case XRInputSourceEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // #if ENABLE(WEBXR) + // case XRInputSourcesChangeEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // #if ENABLE(WEBXR) + // case XRReferenceSpaceEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // #if ENABLE(WEBXR) + // case XRSessionEventInterfaceType: + // return createWrapper(globalObject, WTFMove(impl)); + // #endif + // } + default: { + break; } + } + + return createWrapper(globalObject, WTFMove(impl)); } } // namespace WebCore diff --git a/src/bun.js/bindings/webcore/EventNames.h b/src/bun.js/bindings/webcore/EventNames.h index ebd451814db24..8a62079d34467 100644 --- a/src/bun.js/bindings/webcore/EventNames.h +++ b/src/bun.js/bindings/webcore/EventNames.h @@ -37,302 +37,6 @@ namespace WebCore { macro(message) \ macro(messageerror) -// macro(DOMActivate) \ - // macro(DOMCharacterDataModified) \ - // macro(DOMContentLoaded) \ - // macro(DOMNodeInserted) \ - // macro(DOMNodeInsertedIntoDocument) \ - // macro(DOMNodeRemoved) \ - // macro(DOMNodeRemovedFromDocument) \ - // macro(DOMSubtreeModified) \ - // macro(abort) \ - // macro(activate) \ - // macro(active) \ - // macro(addsourcebuffer) \ - // macro(addstream) \ - // macro(addtrack) \ - // macro(afterprint) \ - // macro(animationcancel) \ - // macro(animationend) \ - // macro(animationiteration) \ - // macro(animationstart) \ - // macro(audioend) \ - // macro(audioprocess) \ - // macro(audiostart) \ - // macro(autocomplete) \ - // macro(autocompleteerror) \ - // macro(beforecopy) \ - // macro(beforecut) \ - // macro(beforeinput) \ - // macro(beforeload) \ - // macro(beforepaste) \ - // macro(beforeprint) \ - // macro(beforeunload) \ - // macro(beginEvent) \ - // macro(blocked) \ - // macro(blur) \ - // macro(boundary) \ - // macro(bufferedamountlow) \ - // macro(cached) \ - // macro(cancel) \ - // macro(canplay) \ - // macro(canplaythrough) \ - // macro(change) \ - // macro(chargingchange) \ - // macro(chargingtimechange) \ - // macro(checking) \ - // macro(click) \ - // macro(close) \ - // macro(closing) \ - // macro(complete) \ - // macro(compositionend) \ - // macro(compositionstart) \ - // macro(compositionupdate) \ - // macro(connect) \ - // macro(connectionstatechange) \ - // macro(connecting) \ - // macro(contextmenu) \ - // macro(controllerchange) \ - // macro(coordinatorstatechange) \ - // macro(copy) \ - // macro(cuechange) \ - // macro(cut) \ - // macro(dataavailable) \ - // macro(datachannel) \ - // macro(dblclick) \ - // macro(devicechange) \ - // macro(devicemotion) \ - // macro(deviceorientation) \ - // macro(dischargingtimechange) \ - // macro(disconnect) \ - // macro(downloading) \ - // macro(drag) \ - // macro(dragend) \ - // macro(dragenter) \ - // macro(dragleave) \ - // macro(dragover) \ - // macro(dragstart) \ - // macro(drop) \ - // macro(durationchange) \ - // macro(emptied) \ - // macro(encrypted) \ - // macro(end) \ - // macro(endEvent) \ - // macro(ended) \ - // macro(enter) \ - // macro(enterpictureinpicture) \ - // macro(error) \ - // macro(exit) \ - // macro(fetch) \ - // macro(finish) \ - // macro(focus) \ - // macro(focusin) \ - // macro(focusout) \ - // macro(formdata) \ - // macro(gamepadconnected) \ - // macro(gamepaddisconnected) \ - // macro(gatheringstatechange) \ - // macro(gesturechange) \ - // macro(gestureend) \ - // macro(gesturescrollend) \ - // macro(gesturescrollstart) \ - // macro(gesturescrollupdate) \ - // macro(gesturestart) \ - // macro(gesturetap) \ - // macro(gesturetapdown) \ - // macro(gotpointercapture) \ - // macro(hashchange) \ - // macro(icecandidate) \ - // macro(icecandidateerror) \ - // macro(iceconnectionstatechange) \ - // macro(icegatheringstatechange) \ - // macro(inactive) \ - // macro(input) \ - // macro(inputsourceschange) \ - // macro(install) \ - // macro(invalid) \ - // macro(keydown) \ - // macro(keypress) \ - // macro(keystatuseschange) \ - // macro(keyup) \ - // macro(languagechange) \ - // macro(leavepictureinpicture) \ - // macro(levelchange) \ - // macro(load) \ - // macro(loadeddata) \ - // macro(loadedmetadata) \ - // macro(loadend) \ - // macro(loading) \ - // macro(loadingdone) \ - // macro(loadingerror) \ - // macro(loadstart) \ - // macro(lostpointercapture) \ - // macro(mark) \ - // macro(merchantvalidation) \ - // macro(message) \ - // macro(messageerror) \ - // macro(mousedown) \ - // macro(mouseenter) \ - // macro(mouseleave) \ - // macro(mousemove) \ - // macro(mouseout) \ - // macro(mouseover) \ - // macro(mouseup) \ - // macro(mousewheel) \ - // macro(mute) \ - // macro(negotiationneeded) \ - // macro(nexttrack) \ - // macro(nomatch) \ - // macro(notificationclick) \ - // macro(notificationclose) \ - // macro(noupdate) \ - // macro(obsolete) \ - // macro(offline) \ - // macro(online) \ - // macro(orientationchange) \ - // macro(overflowchanged) \ - // macro(pagehide) \ - // macro(pageshow) \ - // macro(paste) \ - // macro(pause) \ - // macro(payerdetailchange) \ - // macro(paymentauthorized) \ - // macro(paymentmethodchange) \ - // macro(paymentmethodselected) \ - // macro(play) \ - // macro(playing) \ - // macro(pointerlockchange) \ - // macro(pointerlockerror) \ - // macro(pointercancel) \ - // macro(pointerdown) \ - // macro(pointerenter) \ - // macro(pointerleave) \ - // macro(pointermove) \ - // macro(pointerout) \ - // macro(pointerover) \ - // macro(pointerup) \ - // macro(popstate) \ - // macro(previoustrack) \ - // macro(processorerror) \ - // macro(progress) \ - // macro(push) \ - // macro(pushsubscriptionchange) \ - // macro(ratechange) \ - // macro(readystatechange) \ - // macro(rejectionhandled) \ - // macro(remove) \ - // macro(removesourcebuffer) \ - // macro(removestream) \ - // macro(removetrack) \ - // macro(reset) \ - // macro(resize) \ - // macro(resourcetimingbufferfull) \ - // macro(result) \ - // macro(resume) \ - // macro(rtctransform) \ - // macro(scroll) \ - // macro(search) \ - // macro(securitypolicyviolation) \ - // macro(seeked) \ - // macro(seeking) \ - // macro(select) \ - // macro(selectend) \ - // macro(selectionchange) \ - // macro(selectstart) \ - // macro(shippingaddresschange) \ - // macro(shippingcontactselected) \ - // macro(shippingmethodselected) \ - // macro(shippingoptionchange) \ - // macro(show) \ - // macro(signalingstatechange) \ - // macro(slotchange) \ - // macro(soundend) \ - // macro(soundstart) \ - // macro(sourceclose) \ - // macro(sourceended) \ - // macro(sourceopen) \ - // macro(speechend) \ - // macro(speechstart) \ - // macro(squeeze) \ - // macro(squeezestart) \ - // macro(squeezeend) \ - // macro(stalled) \ - // macro(start) \ - // macro(started) \ - // macro(statechange) \ - // macro(stop) \ - // macro(storage) \ - // macro(submit) \ - // macro(success) \ - // macro(suspend) \ - // macro(textInput) \ - // macro(timeout) \ - // macro(timeupdate) \ - // macro(toggle) \ - // macro(tonechange) \ - // macro(touchcancel) \ - // macro(touchend) \ - // macro(touchforcechange) \ - // macro(touchmove) \ - // macro(touchstart) \ - // macro(track) \ - // macro(transitioncancel) \ - // macro(transitionend) \ - // macro(transitionrun) \ - // macro(transitionstart) \ - // macro(uncapturederror) \ - // macro(unhandledrejection) \ - // macro(unload) \ - // macro(unmute) \ - // macro(update) \ - // macro(updateend) \ - // macro(updatefound) \ - // macro(updateready) \ - // macro(updatestart) \ - // macro(upgradeneeded) \ - // macro(validatemerchant) \ - // macro(versionchange) \ - // macro(visibilitychange) \ - // macro(voiceschanged) \ - // macro(volumechange) \ - // macro(waiting) \ - // macro(waitingforkey) \ - // macro(webglcontextchanged) \ - // macro(webglcontextcreationerror) \ - // macro(webglcontextlost) \ - // macro(webglcontextrestored) \ - // macro(webkitAnimationEnd) \ - // macro(webkitAnimationIteration) \ - // macro(webkitAnimationStart) \ - // macro(webkitBeforeTextInserted) \ - // macro(webkitTransitionEnd) \ - // macro(webkitbeginfullscreen) \ - // macro(webkitcurrentplaybacktargetiswirelesschanged) \ - // macro(webkitendfullscreen) \ - // macro(webkitfullscreenchange) \ - // macro(webkitfullscreenerror) \ - // macro(webkitkeyadded) \ - // macro(webkitkeyerror) \ - // macro(webkitkeymessage) \ - // macro(webkitmouseforcechanged) \ - // macro(webkitmouseforcedown) \ - // macro(webkitmouseforcewillbegin) \ - // macro(webkitmouseforceup) \ - // macro(webkitneedkey) \ - // macro(webkitnetworkinfochange) \ - // macro(webkitplaybacktargetavailabilitychanged) \ - // macro(webkitpresentationmodechanged) \ - // macro(webkitremovesourcebuffer) \ - // macro(webkitsourceclose) \ - // macro(webkitsourceended) \ - // macro(webkitsourceopen) \ - macro(wheel) \ - macro(write) \ - macro(writeend) \ - macro(writestart) \ - macro(zoom) \ -// end of DOM_EVENT_NAMES_FOR_EACH - struct EventNames { WTF_MAKE_NONCOPYABLE(EventNames); WTF_MAKE_FAST_ALLOCATED; diff --git a/src/bun.js/bindings/webcore/EventPath.cpp b/src/bun.js/bindings/webcore/EventPath.cpp index 30dbb5de99781..237923fbee7f2 100644 --- a/src/bun.js/bindings/webcore/EventPath.cpp +++ b/src/bun.js/bindings/webcore/EventPath.cpp @@ -18,13 +18,13 @@ // * Boston, MA 02110-1301, USA. // */ -// #include "config.h" -// #include "EventPath.h" +#include "config.h" +#include "EventPath.h" // // #include "DOMWindow.h" -// #include "Event.h" -// #include "EventContext.h" -// #include "EventNames.h" +#include "Event.h" +#include "EventContext.h" +#include "EventNames.h" // // #include "FullscreenManager.h" // // #include "HTMLSlotElement.h" // // #include "MouseEvent.h" @@ -32,8 +32,9 @@ // // #include "PseudoElement.h" // // #include "ShadowRoot.h" // // #include "TouchEvent.h" +#include -// namespace WebCore { +namespace WebCore { // static inline bool shouldEventCrossShadowBoundary(Event& event, ShadowRoot& shadowRoot, EventTarget& target) // { @@ -80,8 +81,9 @@ // bool m_hasDifferentTreeRoot { false }; // }; -// EventPath::EventPath(Node& originalTarget, Event& event) -// { +EventPath::EventPath(Node& originalTarget, Event& event) +{ +} // buildPath(originalTarget, event); // if (auto* relatedTarget = event.relatedTarget(); is(relatedTarget) && !m_path.isEmpty()) @@ -277,14 +279,13 @@ // return path; // } -// EventPath::EventPath(const Vector& targets) -// { -// m_path = targets.map([&](auto* target) { -// ASSERT(target); -// ASSERT(!is(target)); -// return EventContext { EventContext::Type::Normal, nullptr, target, *targets.begin(), 0 }; -// }); -// } +EventPath::EventPath(const WTF::Vector& targets) +{ + m_path = targets.map([&](auto* target) { + ASSERT(target); + return EventContext { EventContext::Type::Normal, nullptr, target, *targets.begin(), 0 }; + }); +} // static Node* moveOutOfAllShadowRoots(Node& startingNode) // { @@ -420,4 +421,4 @@ // } // #endif // ASSERT_ENABLED -// } +} diff --git a/src/bun.js/bindings/webcore/EventTargetFactory.cpp b/src/bun.js/bindings/webcore/EventTargetFactory.cpp index 809cceda92257..09e35a5a181d8 100644 --- a/src/bun.js/bindings/webcore/EventTargetFactory.cpp +++ b/src/bun.js/bindings/webcore/EventTargetFactory.cpp @@ -267,13 +267,16 @@ JSC::JSValue toJS(JSC::JSGlobalObject* state, JSDOMGlobalObject* globalObject, E // #endif case WorkerEventTargetInterfaceType: return toJS(state, globalObject, static_cast(impl)); - // case WorkletGlobalScopeEventTargetInterfaceType: - // return toJS(state, globalObject, static_cast(impl)); - // case XMLHttpRequestEventTargetInterfaceType: - // return toJS(state, globalObject, static_cast(impl)); - // case XMLHttpRequestUploadEventTargetInterfaceType: - // return toJS(state, globalObject, static_cast(impl)); - // } + // case WorkletGlobalScopeEventTargetInterfaceType: + // return toJS(state, globalObject, static_cast(impl)); + // case XMLHttpRequestEventTargetInterfaceType: + // return toJS(state, globalObject, static_cast(impl)); + // case XMLHttpRequestUploadEventTargetInterfaceType: + // return toJS(state, globalObject, static_cast(impl)); + // } + default: { + break; + } } return wrap(state, globalObject, impl); } diff --git a/src/bun.js/bindings/webcore/ExceptionDetails.h b/src/bun.js/bindings/webcore/ExceptionDetails.h index d25c2e462cb4d..d3e3372881a27 100644 --- a/src/bun.js/bindings/webcore/ExceptionDetails.h +++ b/src/bun.js/bindings/webcore/ExceptionDetails.h @@ -25,7 +25,7 @@ #pragma once -#include "wtf/text/WTFString.h" +#include namespace WebCore { diff --git a/src/bun.js/bindings/webcore/JSAbortController.cpp b/src/bun.js/bindings/webcore/JSAbortController.cpp index 421a47e3c7471..eac7e745ded38 100644 --- a/src/bun.js/bindings/webcore/JSAbortController.cpp +++ b/src/bun.js/bindings/webcore/JSAbortController.cpp @@ -39,12 +39,12 @@ #include "JSDOMWrapperCache.h" #include "ScriptExecutionContext.h" #include "WebCoreJSClientData.h" -#include "JavaScriptCore/FunctionPrototype.h" -#include "JavaScriptCore/HeapAnalyzer.h" +#include +#include -#include "JavaScriptCore/JSDestructibleObjectHeapCellType.h" -#include "JavaScriptCore/SlotVisitorMacros.h" -#include "JavaScriptCore/SubspaceInlines.h" +#include +#include +#include #include #include #include @@ -97,7 +97,7 @@ STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSAbortControllerPrototype, JSAbortControlle using JSAbortControllerDOMConstructor = JSDOMConstructor; -template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSAbortControllerDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSAbortControllerDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) { VM& vm = lexicalGlobalObject->vm(); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -189,7 +189,7 @@ void JSAbortController::destroy(JSC::JSCell* cell) thisObject->JSAbortController::~JSAbortController(); } -JSC_DEFINE_CUSTOM_GETTER(jsAbortControllerConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsAbortControllerConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -207,7 +207,7 @@ static inline JSValue jsAbortController_signalGetter(JSGlobalObject& lexicalGlob RELEASE_AND_RETURN(throwScope, (toJS>(lexicalGlobalObject, *thisObject.globalObject(), throwScope, impl.signal()))); } -JSC_DEFINE_CUSTOM_GETTER(jsAbortController_signal, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsAbortController_signal, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } diff --git a/src/bun.js/bindings/webcore/JSAbortSignal.cpp b/src/bun.js/bindings/webcore/JSAbortSignal.cpp index 4b482e30054d2..aa33d8871e3bb 100644 --- a/src/bun.js/bindings/webcore/JSAbortSignal.cpp +++ b/src/bun.js/bindings/webcore/JSAbortSignal.cpp @@ -182,7 +182,7 @@ JSValue JSAbortSignal::getConstructor(VM& vm, const JSGlobalObject* globalObject return getDOMConstructor(vm, *jsCast(globalObject)); } -JSC_DEFINE_CUSTOM_GETTER(jsAbortSignalConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsAbortSignalConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -200,7 +200,7 @@ static inline JSValue jsAbortSignal_abortedGetter(JSGlobalObject& lexicalGlobalO RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.aborted()))); } -JSC_DEFINE_CUSTOM_GETTER(jsAbortSignal_aborted, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsAbortSignal_aborted, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -213,7 +213,7 @@ static inline JSValue jsAbortSignal_reasonGetter(JSGlobalObject& lexicalGlobalOb RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.reason()))); } -JSC_DEFINE_CUSTOM_GETTER(jsAbortSignal_reason, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsAbortSignal_reason, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -224,7 +224,7 @@ static inline JSValue jsAbortSignal_onabortGetter(JSGlobalObject& lexicalGlobalO return eventHandlerAttribute(thisObject.wrapped(), eventNames().abortEvent, worldForDOMObject(thisObject)); } -JSC_DEFINE_CUSTOM_GETTER(jsAbortSignal_onabort, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsAbortSignal_onabort, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -239,7 +239,7 @@ static inline bool setJSAbortSignal_onabortSetter(JSGlobalObject& lexicalGlobalO return true; } -JSC_DEFINE_CUSTOM_SETTER(setJSAbortSignal_onabort, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_SETTER(setJSAbortSignal_onabort, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, PropertyName attributeName)) { return IDLAttribute::set(*lexicalGlobalObject, thisValue, encodedValue, attributeName); } diff --git a/src/bun.js/bindings/webcore/JSAbortSignalCustom.cpp b/src/bun.js/bindings/webcore/JSAbortSignalCustom.cpp index 88a94c7c01129..4b99b96e528cc 100644 --- a/src/bun.js/bindings/webcore/JSAbortSignalCustom.cpp +++ b/src/bun.js/bindings/webcore/JSAbortSignalCustom.cpp @@ -25,7 +25,7 @@ #include "config.h" #include "JSDOMWrapper.h" -#include "wtf/NeverDestroyed.h" +#include #include "JSAbortSignal.h" namespace WebCore { diff --git a/src/bun.js/bindings/webcore/JSBroadcastChannel.cpp b/src/bun.js/bindings/webcore/JSBroadcastChannel.cpp index 694044ccaf8a8..6f6b1ae36d0fb 100644 --- a/src/bun.js/bindings/webcore/JSBroadcastChannel.cpp +++ b/src/bun.js/bindings/webcore/JSBroadcastChannel.cpp @@ -102,7 +102,7 @@ STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSBroadcastChannelPrototype, JSBroadcastChan using JSBroadcastChannelDOMConstructor = JSDOMConstructor; -template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSBroadcastChannelDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSBroadcastChannelDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) { VM& vm = lexicalGlobalObject->vm(); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -193,7 +193,7 @@ JSValue JSBroadcastChannel::getConstructor(VM& vm, const JSGlobalObject* globalO return getDOMConstructor(vm, *jsCast(globalObject)); } -JSC_DEFINE_CUSTOM_GETTER(jsBroadcastChannelConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsBroadcastChannelConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -211,7 +211,7 @@ static inline JSValue jsBroadcastChannel_nameGetter(JSGlobalObject& lexicalGloba RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.name()))); } -JSC_DEFINE_CUSTOM_GETTER(jsBroadcastChannel_name, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsBroadcastChannel_name, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -222,7 +222,7 @@ static inline JSValue jsBroadcastChannel_onmessageGetter(JSGlobalObject& lexical return eventHandlerAttribute(thisObject.wrapped(), eventNames().messageEvent, worldForDOMObject(thisObject)); } -JSC_DEFINE_CUSTOM_GETTER(jsBroadcastChannel_onmessage, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsBroadcastChannel_onmessage, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -238,7 +238,7 @@ static inline bool setJSBroadcastChannel_onmessageSetter(JSGlobalObject& lexical return true; } -JSC_DEFINE_CUSTOM_SETTER(setJSBroadcastChannel_onmessage, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_SETTER(setJSBroadcastChannel_onmessage, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, PropertyName attributeName)) { return IDLAttribute::set(*lexicalGlobalObject, thisValue, encodedValue, attributeName); } @@ -249,7 +249,7 @@ static inline JSValue jsBroadcastChannel_onmessageerrorGetter(JSGlobalObject& le return eventHandlerAttribute(thisObject.wrapped(), eventNames().messageerrorEvent, worldForDOMObject(thisObject)); } -JSC_DEFINE_CUSTOM_GETTER(jsBroadcastChannel_onmessageerror, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsBroadcastChannel_onmessageerror, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -265,7 +265,7 @@ static inline bool setJSBroadcastChannel_onmessageerrorSetter(JSGlobalObject& le return true; } -JSC_DEFINE_CUSTOM_SETTER(setJSBroadcastChannel_onmessageerror, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_SETTER(setJSBroadcastChannel_onmessageerror, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, PropertyName attributeName)) { return IDLAttribute::set(*lexicalGlobalObject, thisValue, encodedValue, attributeName); } diff --git a/src/bun.js/bindings/webcore/JSByteLengthQueuingStrategy.cpp b/src/bun.js/bindings/webcore/JSByteLengthQueuingStrategy.cpp index 2b8ff4c7b16d9..4dc2e94d341ce 100644 --- a/src/bun.js/bindings/webcore/JSByteLengthQueuingStrategy.cpp +++ b/src/bun.js/bindings/webcore/JSByteLengthQueuingStrategy.cpp @@ -155,7 +155,7 @@ void JSByteLengthQueuingStrategy::destroy(JSC::JSCell* cell) thisObject->JSByteLengthQueuingStrategy::~JSByteLengthQueuingStrategy(); } -JSC_DEFINE_CUSTOM_GETTER(jsByteLengthQueuingStrategyConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsByteLengthQueuingStrategyConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); diff --git a/src/bun.js/bindings/webcore/JSCloseEvent.cpp b/src/bun.js/bindings/webcore/JSCloseEvent.cpp index ad7b6ed57c94a..a302dcdfb35aa 100644 --- a/src/bun.js/bindings/webcore/JSCloseEvent.cpp +++ b/src/bun.js/bindings/webcore/JSCloseEvent.cpp @@ -175,7 +175,7 @@ STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSCloseEventPrototype, JSCloseEventPrototype using JSCloseEventDOMConstructor = JSDOMConstructor; -template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSCloseEventDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSCloseEventDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) { VM& vm = lexicalGlobalObject->vm(); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -266,7 +266,7 @@ JSValue JSCloseEvent::getConstructor(VM& vm, const JSGlobalObject* globalObject) return getDOMConstructor(vm, *jsCast(globalObject)); } -JSC_DEFINE_CUSTOM_GETTER(jsCloseEventConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsCloseEventConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -284,7 +284,7 @@ static inline JSValue jsCloseEvent_wasCleanGetter(JSGlobalObject& lexicalGlobalO RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.wasClean()))); } -JSC_DEFINE_CUSTOM_GETTER(jsCloseEvent_wasClean, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsCloseEvent_wasClean, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -297,7 +297,7 @@ static inline JSValue jsCloseEvent_codeGetter(JSGlobalObject& lexicalGlobalObjec RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.code()))); } -JSC_DEFINE_CUSTOM_GETTER(jsCloseEvent_code, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsCloseEvent_code, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -310,7 +310,7 @@ static inline JSValue jsCloseEvent_reasonGetter(JSGlobalObject& lexicalGlobalObj RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.reason()))); } -JSC_DEFINE_CUSTOM_GETTER(jsCloseEvent_reason, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsCloseEvent_reason, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } diff --git a/src/bun.js/bindings/webcore/JSCountQueuingStrategy.cpp b/src/bun.js/bindings/webcore/JSCountQueuingStrategy.cpp index a193f805ca225..0a05fe808361e 100644 --- a/src/bun.js/bindings/webcore/JSCountQueuingStrategy.cpp +++ b/src/bun.js/bindings/webcore/JSCountQueuingStrategy.cpp @@ -155,7 +155,7 @@ void JSCountQueuingStrategy::destroy(JSC::JSCell* cell) thisObject->JSCountQueuingStrategy::~JSCountQueuingStrategy(); } -JSC_DEFINE_CUSTOM_GETTER(jsCountQueuingStrategyConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsCountQueuingStrategyConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); diff --git a/src/bun.js/bindings/webcore/JSCustomEvent.cpp b/src/bun.js/bindings/webcore/JSCustomEvent.cpp index aeaae71cd16d2..2d5e3b9da3d43 100644 --- a/src/bun.js/bindings/webcore/JSCustomEvent.cpp +++ b/src/bun.js/bindings/webcore/JSCustomEvent.cpp @@ -156,7 +156,7 @@ STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSCustomEventPrototype, JSCustomEventPrototy using JSCustomEventDOMConstructor = JSDOMConstructor; -template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSCustomEventDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSCustomEventDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) { VM& vm = lexicalGlobalObject->vm(); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -246,7 +246,7 @@ JSValue JSCustomEvent::getConstructor(VM& vm, const JSGlobalObject* globalObject return getDOMConstructor(vm, *jsCast(globalObject)); } -JSC_DEFINE_CUSTOM_GETTER(jsCustomEventConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsCustomEventConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -262,7 +262,7 @@ static inline JSValue jsCustomEvent_detailGetter(JSGlobalObject& lexicalGlobalOb return thisObject.detail(lexicalGlobalObject); } -JSC_DEFINE_CUSTOM_GETTER(jsCustomEvent_detail, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsCustomEvent_detail, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } diff --git a/src/bun.js/bindings/webcore/JSDOMBindingInternalsBuiltins.cpp b/src/bun.js/bindings/webcore/JSDOMBindingInternalsBuiltins.cpp index 84f96c5b91f86..f7df311886cfd 100644 --- a/src/bun.js/bindings/webcore/JSDOMBindingInternalsBuiltins.cpp +++ b/src/bun.js/bindings/webcore/JSDOMBindingInternalsBuiltins.cpp @@ -31,13 +31,13 @@ // #include "config.h" // #include "WebCoreJSClientData.h" -// #include "JavaScriptCore/HeapInlines.h" -// #include "JavaScriptCore/IdentifierInlines.h" -// #include "JavaScriptCore/Intrinsic.h" -// #include "JavaScriptCore/JSCJSValueInlines.h" -// #include "JavaScriptCore/JSCellInlines.h" -// #include "JavaScriptCore/StructureInlines.h" -// #include "JavaScriptCore/VM.h" +// #include +// #include +// #include +// #include +// #include +// #include +// #include // namespace WebCore { diff --git a/src/bun.js/bindings/webcore/JSDOMBindingInternalsBuiltins.h b/src/bun.js/bindings/webcore/JSDOMBindingInternalsBuiltins.h index 40b698c3a2cf7..f0041be4dfdf3 100644 --- a/src/bun.js/bindings/webcore/JSDOMBindingInternalsBuiltins.h +++ b/src/bun.js/bindings/webcore/JSDOMBindingInternalsBuiltins.h @@ -30,10 +30,10 @@ // #pragma once -// #include "JavaScriptCore/BuiltinUtils.h" -// #include "JavaScriptCore/Identifier.h" -// #include "JavaScriptCore/JSFunction.h" -// #include "JavaScriptCore/UnlinkedFunctionExecutable.h" +// #include +// #include +// #include +// #include // namespace JSC { // class FunctionExecutable; diff --git a/src/bun.js/bindings/webcore/JSDOMConstructorBase.h b/src/bun.js/bindings/webcore/JSDOMConstructorBase.h index 941637ef90859..117ea9d39cb32 100644 --- a/src/bun.js/bindings/webcore/JSDOMConstructorBase.h +++ b/src/bun.js/bindings/webcore/JSDOMConstructorBase.h @@ -20,7 +20,7 @@ #pragma once #include "JSDOMGlobalObject.h" -#include "JavaScriptCore/InternalFunction.h" +#include #include "ZigGlobalObject.h" diff --git a/src/bun.js/bindings/webcore/JSDOMConvertDate.cpp b/src/bun.js/bindings/webcore/JSDOMConvertDate.cpp index c624bd25bff3e..f479c6d4accc4 100644 --- a/src/bun.js/bindings/webcore/JSDOMConvertDate.cpp +++ b/src/bun.js/bindings/webcore/JSDOMConvertDate.cpp @@ -22,10 +22,10 @@ #include "config.h" #include "JSDOMConvertDate.h" -#include "JavaScriptCore/DateInstance.h" -#include "JavaScriptCore/HeapInlines.h" -#include "JavaScriptCore/JSCJSValueInlines.h" -#include "JavaScriptCore/JSGlobalObject.h" +#include +#include +#include +#include namespace WebCore { using namespace JSC; diff --git a/src/bun.js/bindings/webcore/JSDOMConvertDate.h b/src/bun.js/bindings/webcore/JSDOMConvertDate.h index de0a9f770a53b..d12361fd6ff1e 100644 --- a/src/bun.js/bindings/webcore/JSDOMConvertDate.h +++ b/src/bun.js/bindings/webcore/JSDOMConvertDate.h @@ -27,8 +27,8 @@ #include "IDLTypes.h" #include "JSDOMConvertBase.h" -#include "JavaScriptCore/JSGlobalObject.h" -#include "wtf/WallTime.h" +#include +#include namespace WebCore { diff --git a/src/bun.js/bindings/webcore/JSDOMConvertInterface.h b/src/bun.js/bindings/webcore/JSDOMConvertInterface.h index 34927646788e7..3cc5addbca91c 100644 --- a/src/bun.js/bindings/webcore/JSDOMConvertInterface.h +++ b/src/bun.js/bindings/webcore/JSDOMConvertInterface.h @@ -29,7 +29,7 @@ #include "IDLTypes.h" #include "JSDOMConvertBase.h" -#include "JavaScriptCore/Error.h" +#include namespace WebCore { diff --git a/src/bun.js/bindings/webcore/JSDOMConvertJSON.h b/src/bun.js/bindings/webcore/JSDOMConvertJSON.h index 9a289ef6c4084..6a4716dee7a57 100644 --- a/src/bun.js/bindings/webcore/JSDOMConvertJSON.h +++ b/src/bun.js/bindings/webcore/JSDOMConvertJSON.h @@ -27,7 +27,7 @@ #include "IDLTypes.h" #include "JSDOMConvertBase.h" -#include "JavaScriptCore/JSONObject.h" +#include namespace WebCore { diff --git a/src/bun.js/bindings/webcore/JSDOMConvertNumbers.cpp b/src/bun.js/bindings/webcore/JSDOMConvertNumbers.cpp index 438d327237117..c417a37efd259 100644 --- a/src/bun.js/bindings/webcore/JSDOMConvertNumbers.cpp +++ b/src/bun.js/bindings/webcore/JSDOMConvertNumbers.cpp @@ -23,11 +23,11 @@ #include "JSDOMConvertNumbers.h" #include "JSDOMExceptionHandling.h" -#include "JavaScriptCore/HeapInlines.h" -#include "JavaScriptCore/JSCJSValueInlines.h" -#include "wtf/MathExtras.h" -#include "wtf/text/StringConcatenateNumbers.h" -#include "wtf/text/WTFString.h" +#include +#include +#include +#include +#include namespace WebCore { using namespace JSC; diff --git a/src/bun.js/bindings/webcore/JSDOMConvertObject.h b/src/bun.js/bindings/webcore/JSDOMConvertObject.h index 24dacac9e46fa..2acdad0d6c416 100644 --- a/src/bun.js/bindings/webcore/JSDOMConvertObject.h +++ b/src/bun.js/bindings/webcore/JSDOMConvertObject.h @@ -27,7 +27,7 @@ #include "IDLTypes.h" #include "JSDOMConvertBase.h" -#include "JavaScriptCore/StrongInlines.h" +#include namespace WebCore { diff --git a/src/bun.js/bindings/webcore/JSDOMConvertRecord.h b/src/bun.js/bindings/webcore/JSDOMConvertRecord.h index 0f4c84eff8f3c..76a30b0c4a30a 100644 --- a/src/bun.js/bindings/webcore/JSDOMConvertRecord.h +++ b/src/bun.js/bindings/webcore/JSDOMConvertRecord.h @@ -28,7 +28,7 @@ #include "IDLTypes.h" #include "JSDOMConvertStrings.h" #include "JSDOMGlobalObject.h" -#include "JavaScriptCore/ObjectConstructor.h" +#include namespace WebCore { diff --git a/src/bun.js/bindings/webcore/JSDOMConvertSequences.h b/src/bun.js/bindings/webcore/JSDOMConvertSequences.h index a08336f642271..c2412e5d7adf8 100644 --- a/src/bun.js/bindings/webcore/JSDOMConvertSequences.h +++ b/src/bun.js/bindings/webcore/JSDOMConvertSequences.h @@ -29,10 +29,10 @@ #include "JSDOMConvertBase.h" #include "JSDOMConvertNumbers.h" #include "JSDOMGlobalObject.h" -#include "JavaScriptCore/IteratorOperations.h" -#include "JavaScriptCore/JSArray.h" -#include "JavaScriptCore/JSGlobalObjectInlines.h" -#include "JavaScriptCore/ObjectConstructor.h" +#include +#include +#include +#include namespace WebCore { diff --git a/src/bun.js/bindings/webcore/JSDOMConvertVariadic.h b/src/bun.js/bindings/webcore/JSDOMConvertVariadic.h index dd16b1d66e6f2..3dce23bec66d6 100644 --- a/src/bun.js/bindings/webcore/JSDOMConvertVariadic.h +++ b/src/bun.js/bindings/webcore/JSDOMConvertVariadic.h @@ -27,7 +27,7 @@ #include "IDLTypes.h" #include "JSDOMConvertBase.h" -#include "wtf/FixedVector.h" +#include namespace WebCore { diff --git a/src/bun.js/bindings/webcore/JSDOMException.cpp b/src/bun.js/bindings/webcore/JSDOMException.cpp index 482439d145963..014402adc73a7 100644 --- a/src/bun.js/bindings/webcore/JSDOMException.cpp +++ b/src/bun.js/bindings/webcore/JSDOMException.cpp @@ -36,15 +36,15 @@ #include "JSDOMWrapperCache.h" #include "ScriptExecutionContext.h" #include "WebCoreJSClientData.h" -#include "JavaScriptCore/FunctionPrototype.h" -#include "JavaScriptCore/HeapAnalyzer.h" +#include +#include -#include "JavaScriptCore/JSDestructibleObjectHeapCellType.h" -#include "JavaScriptCore/SlotVisitorMacros.h" -#include "JavaScriptCore/SubspaceInlines.h" -#include "wtf/GetPtr.h" -#include "wtf/PointerPreparations.h" -#include "wtf/URL.h" +#include +#include +#include +#include +#include +#include namespace WebCore { using namespace JSC; @@ -120,7 +120,7 @@ static const HashTableValue JSDOMExceptionConstructorTableValues[] = { { "DATA_CLONE_ERR"_s, JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { HashTableValue::ConstantType, 25 } }, }; -template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSDOMExceptionDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSDOMExceptionDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) { VM& vm = lexicalGlobalObject->vm(); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -242,7 +242,7 @@ void JSDOMException::destroy(JSC::JSCell* cell) thisObject->JSDOMException::~JSDOMException(); } -JSC_DEFINE_CUSTOM_GETTER(jsDOMExceptionConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsDOMExceptionConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -260,7 +260,7 @@ static inline JSValue jsDOMException_codeGetter(JSGlobalObject& lexicalGlobalObj RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.legacyCode()))); } -JSC_DEFINE_CUSTOM_GETTER(jsDOMException_code, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsDOMException_code, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -273,7 +273,7 @@ static inline JSValue jsDOMException_nameGetter(JSGlobalObject& lexicalGlobalObj RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.name()))); } -JSC_DEFINE_CUSTOM_GETTER(jsDOMException_name, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsDOMException_name, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -286,7 +286,7 @@ static inline JSValue jsDOMException_messageGetter(JSGlobalObject& lexicalGlobal RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.message()))); } -JSC_DEFINE_CUSTOM_GETTER(jsDOMException_message, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsDOMException_message, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } diff --git a/src/bun.js/bindings/webcore/JSDOMException.h b/src/bun.js/bindings/webcore/JSDOMException.h index 7c20a57453d3e..7375f0daa21e3 100644 --- a/src/bun.js/bindings/webcore/JSDOMException.h +++ b/src/bun.js/bindings/webcore/JSDOMException.h @@ -24,8 +24,8 @@ #include "DOMException.h" #include "JSDOMWrapper.h" -#include "JavaScriptCore/ErrorPrototype.h" -#include "wtf/NeverDestroyed.h" +#include +#include namespace WebCore { diff --git a/src/bun.js/bindings/webcore/JSDOMFormData.cpp b/src/bun.js/bindings/webcore/JSDOMFormData.cpp index fdb71341c24cc..e47564e755c21 100644 --- a/src/bun.js/bindings/webcore/JSDOMFormData.cpp +++ b/src/bun.js/bindings/webcore/JSDOMFormData.cpp @@ -108,7 +108,7 @@ static JSC_DECLARE_HOST_FUNCTION(jsDOMFormDataPrototypeFunction_toJSON); static JSC_DECLARE_CUSTOM_GETTER(jsDOMFormDataConstructor); -JSC_DEFINE_CUSTOM_GETTER(jsDOMFormDataPrototype_getLength, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsDOMFormDataPrototype_getLength, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto* thisObject = jsDynamicCast(JSValue::decode(thisValue)); @@ -154,7 +154,7 @@ STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSDOMFormDataPrototype, JSDOMFormDataPrototy using JSDOMFormDataDOMConstructor = JSDOMConstructor; -template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSDOMFormDataDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSDOMFormDataDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) { VM& vm = lexicalGlobalObject->vm(); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -184,7 +184,7 @@ template<> JSValue JSDOMFormDataDOMConstructor::prototypeForStructure(JSC::VM& v return globalObject.functionPrototype(); } -extern "C" EncodedJSValue FormData__jsFunctionFromMultipartData(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callframe); +extern "C" JSC::EncodedJSValue FormData__jsFunctionFromMultipartData(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callframe); template<> void JSDOMFormDataDOMConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) { @@ -260,7 +260,7 @@ void JSDOMFormData::destroy(JSC::JSCell* cell) thisObject->JSDOMFormData::~JSDOMFormData(); } -JSC_DEFINE_CUSTOM_GETTER(jsDOMFormDataConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsDOMFormDataConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -567,7 +567,7 @@ const JSC::ClassInfo DOMFormDataIterator::s_info = { "FormData Iterator"_s, &Bas template<> const JSC::ClassInfo DOMFormDataIteratorPrototype::s_info = { "FormData Iterator"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(DOMFormDataIteratorPrototype) }; -static inline EncodedJSValue jsDOMFormDataPrototypeFunction_entriesCaller(JSGlobalObject*, CallFrame*, JSDOMFormData* thisObject) +static inline JSC::EncodedJSValue jsDOMFormDataPrototypeFunction_entriesCaller(JSGlobalObject*, CallFrame*, JSDOMFormData* thisObject) { return JSValue::encode(iteratorCreate(*thisObject, IterationKind::Entries)); } @@ -577,7 +577,7 @@ JSC_DEFINE_HOST_FUNCTION(jsDOMFormDataPrototypeFunction_entries, (JSC::JSGlobalO return IDLOperation::call(*lexicalGlobalObject, *callFrame, "entries"); } -static inline EncodedJSValue jsDOMFormDataPrototypeFunction_keysCaller(JSGlobalObject*, CallFrame*, JSDOMFormData* thisObject) +static inline JSC::EncodedJSValue jsDOMFormDataPrototypeFunction_keysCaller(JSGlobalObject*, CallFrame*, JSDOMFormData* thisObject) { return JSValue::encode(iteratorCreate(*thisObject, IterationKind::Keys)); } @@ -587,7 +587,7 @@ JSC_DEFINE_HOST_FUNCTION(jsDOMFormDataPrototypeFunction_keys, (JSC::JSGlobalObje return IDLOperation::call(*lexicalGlobalObject, *callFrame, "keys"); } -static inline EncodedJSValue jsDOMFormDataPrototypeFunction_valuesCaller(JSGlobalObject*, CallFrame*, JSDOMFormData* thisObject) +static inline JSC::EncodedJSValue jsDOMFormDataPrototypeFunction_valuesCaller(JSGlobalObject*, CallFrame*, JSDOMFormData* thisObject) { return JSValue::encode(iteratorCreate(*thisObject, IterationKind::Values)); } @@ -597,7 +597,7 @@ JSC_DEFINE_HOST_FUNCTION(jsDOMFormDataPrototypeFunction_values, (JSC::JSGlobalOb return IDLOperation::call(*lexicalGlobalObject, *callFrame, "values"); } -static inline EncodedJSValue jsDOMFormDataPrototypeFunction_forEachCaller(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame, JSDOMFormData* thisObject) +static inline JSC::EncodedJSValue jsDOMFormDataPrototypeFunction_forEachCaller(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame, JSDOMFormData* thisObject) { return JSValue::encode(iteratorForEach(*lexicalGlobalObject, *callFrame, *thisObject)); } diff --git a/src/bun.js/bindings/webcore/JSDOMURL.cpp b/src/bun.js/bindings/webcore/JSDOMURL.cpp index 3f99fc2b77fce..88d051dc6f449 100644 --- a/src/bun.js/bindings/webcore/JSDOMURL.cpp +++ b/src/bun.js/bindings/webcore/JSDOMURL.cpp @@ -41,15 +41,15 @@ #include "JSURLSearchParams.h" #include "ScriptExecutionContext.h" #include "WebCoreJSClientData.h" -#include "JavaScriptCore/FunctionPrototype.h" -#include "JavaScriptCore/HeapAnalyzer.h" +#include +#include -#include "JavaScriptCore/JSDestructibleObjectHeapCellType.h" -#include "JavaScriptCore/SlotVisitorMacros.h" -#include "JavaScriptCore/SubspaceInlines.h" -#include "wtf/GetPtr.h" -#include "wtf/PointerPreparations.h" -#include "wtf/URL.h" +#include +#include +#include +#include +#include +#include #if ENABLE(MEDIA_SOURCE) #include "DOMURLMediaSource.h" @@ -135,7 +135,7 @@ static const HashTableValue JSDOMURLConstructorTableValues[] = { { "canParse"_s, static_cast(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsDOMURLConstructorFunction_canParse, 2 } }, }; -static inline EncodedJSValue constructJSDOMURL1(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +static inline JSC::EncodedJSValue constructJSDOMURL1(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) { VM& vm = lexicalGlobalObject->vm(); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -159,7 +159,7 @@ static inline EncodedJSValue constructJSDOMURL1(JSGlobalObject* lexicalGlobalObj return JSValue::encode(jsValue); } -static inline EncodedJSValue constructJSDOMURL2(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +static inline JSC::EncodedJSValue constructJSDOMURL2(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) { VM& vm = lexicalGlobalObject->vm(); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -183,7 +183,7 @@ static inline EncodedJSValue constructJSDOMURL2(JSGlobalObject* lexicalGlobalObj return JSValue::encode(jsValue); } -template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSDOMURLDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSDOMURLDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) { VM& vm = lexicalGlobalObject->vm(); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -287,7 +287,7 @@ void JSDOMURL::destroy(JSC::JSCell* cell) thisObject->JSDOMURL::~JSDOMURL(); } -JSC_DEFINE_CUSTOM_GETTER(jsDOMURLConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsDOMURLConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -305,7 +305,7 @@ static inline JSValue jsDOMURL_hrefGetter(JSGlobalObject& lexicalGlobalObject, J RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.href()))); } -JSC_DEFINE_CUSTOM_GETTER(jsDOMURL_href, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsDOMURL_href, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -323,7 +323,7 @@ static inline bool setJSDOMURL_hrefSetter(JSGlobalObject& lexicalGlobalObject, J return true; } -JSC_DEFINE_CUSTOM_SETTER(setJSDOMURL_href, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_SETTER(setJSDOMURL_href, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, PropertyName attributeName)) { return IDLAttribute::set(*lexicalGlobalObject, thisValue, encodedValue, attributeName); } @@ -336,7 +336,7 @@ static inline JSValue jsDOMURL_originGetter(JSGlobalObject& lexicalGlobalObject, RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.origin()))); } -JSC_DEFINE_CUSTOM_GETTER(jsDOMURL_origin, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsDOMURL_origin, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -349,7 +349,7 @@ static inline JSValue jsDOMURL_protocolGetter(JSGlobalObject& lexicalGlobalObjec RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.protocol()))); } -JSC_DEFINE_CUSTOM_GETTER(jsDOMURL_protocol, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsDOMURL_protocol, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -367,7 +367,7 @@ static inline bool setJSDOMURL_protocolSetter(JSGlobalObject& lexicalGlobalObjec return true; } -JSC_DEFINE_CUSTOM_SETTER(setJSDOMURL_protocol, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_SETTER(setJSDOMURL_protocol, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, PropertyName attributeName)) { return IDLAttribute::set(*lexicalGlobalObject, thisValue, encodedValue, attributeName); } @@ -380,7 +380,7 @@ static inline JSValue jsDOMURL_usernameGetter(JSGlobalObject& lexicalGlobalObjec RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.username()))); } -JSC_DEFINE_CUSTOM_GETTER(jsDOMURL_username, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsDOMURL_username, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -398,7 +398,7 @@ static inline bool setJSDOMURL_usernameSetter(JSGlobalObject& lexicalGlobalObjec return true; } -JSC_DEFINE_CUSTOM_SETTER(setJSDOMURL_username, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_SETTER(setJSDOMURL_username, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, PropertyName attributeName)) { return IDLAttribute::set(*lexicalGlobalObject, thisValue, encodedValue, attributeName); } @@ -411,7 +411,7 @@ static inline JSValue jsDOMURL_passwordGetter(JSGlobalObject& lexicalGlobalObjec RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.password()))); } -JSC_DEFINE_CUSTOM_GETTER(jsDOMURL_password, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsDOMURL_password, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -429,7 +429,7 @@ static inline bool setJSDOMURL_passwordSetter(JSGlobalObject& lexicalGlobalObjec return true; } -JSC_DEFINE_CUSTOM_SETTER(setJSDOMURL_password, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_SETTER(setJSDOMURL_password, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, PropertyName attributeName)) { return IDLAttribute::set(*lexicalGlobalObject, thisValue, encodedValue, attributeName); } @@ -442,7 +442,7 @@ static inline JSValue jsDOMURL_hostGetter(JSGlobalObject& lexicalGlobalObject, J RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.host()))); } -JSC_DEFINE_CUSTOM_GETTER(jsDOMURL_host, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsDOMURL_host, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -460,7 +460,7 @@ static inline bool setJSDOMURL_hostSetter(JSGlobalObject& lexicalGlobalObject, J return true; } -JSC_DEFINE_CUSTOM_SETTER(setJSDOMURL_host, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_SETTER(setJSDOMURL_host, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, PropertyName attributeName)) { return IDLAttribute::set(*lexicalGlobalObject, thisValue, encodedValue, attributeName); } @@ -473,7 +473,7 @@ static inline JSValue jsDOMURL_hostnameGetter(JSGlobalObject& lexicalGlobalObjec RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.hostname()))); } -JSC_DEFINE_CUSTOM_GETTER(jsDOMURL_hostname, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsDOMURL_hostname, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -491,7 +491,7 @@ static inline bool setJSDOMURL_hostnameSetter(JSGlobalObject& lexicalGlobalObjec return true; } -JSC_DEFINE_CUSTOM_SETTER(setJSDOMURL_hostname, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_SETTER(setJSDOMURL_hostname, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, PropertyName attributeName)) { return IDLAttribute::set(*lexicalGlobalObject, thisValue, encodedValue, attributeName); } @@ -504,7 +504,7 @@ static inline JSValue jsDOMURL_portGetter(JSGlobalObject& lexicalGlobalObject, J RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.port()))); } -JSC_DEFINE_CUSTOM_GETTER(jsDOMURL_port, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsDOMURL_port, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -522,7 +522,7 @@ static inline bool setJSDOMURL_portSetter(JSGlobalObject& lexicalGlobalObject, J return true; } -JSC_DEFINE_CUSTOM_SETTER(setJSDOMURL_port, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_SETTER(setJSDOMURL_port, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, PropertyName attributeName)) { return IDLAttribute::set(*lexicalGlobalObject, thisValue, encodedValue, attributeName); } @@ -535,7 +535,7 @@ static inline JSValue jsDOMURL_pathnameGetter(JSGlobalObject& lexicalGlobalObjec RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.pathname()))); } -JSC_DEFINE_CUSTOM_GETTER(jsDOMURL_pathname, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsDOMURL_pathname, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -553,7 +553,7 @@ static inline bool setJSDOMURL_pathnameSetter(JSGlobalObject& lexicalGlobalObjec return true; } -JSC_DEFINE_CUSTOM_SETTER(setJSDOMURL_pathname, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_SETTER(setJSDOMURL_pathname, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, PropertyName attributeName)) { return IDLAttribute::set(*lexicalGlobalObject, thisValue, encodedValue, attributeName); } @@ -566,7 +566,7 @@ static inline JSValue jsDOMURL_hashGetter(JSGlobalObject& lexicalGlobalObject, J RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.hash()))); } -JSC_DEFINE_CUSTOM_GETTER(jsDOMURL_hash, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsDOMURL_hash, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -584,7 +584,7 @@ static inline bool setJSDOMURL_hashSetter(JSGlobalObject& lexicalGlobalObject, J return true; } -JSC_DEFINE_CUSTOM_SETTER(setJSDOMURL_hash, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_SETTER(setJSDOMURL_hash, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, PropertyName attributeName)) { return IDLAttribute::set(*lexicalGlobalObject, thisValue, encodedValue, attributeName); } @@ -597,7 +597,7 @@ static inline JSValue jsDOMURL_searchGetter(JSGlobalObject& lexicalGlobalObject, RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.search()))); } -JSC_DEFINE_CUSTOM_GETTER(jsDOMURL_search, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsDOMURL_search, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -615,7 +615,7 @@ static inline bool setJSDOMURL_searchSetter(JSGlobalObject& lexicalGlobalObject, return true; } -JSC_DEFINE_CUSTOM_SETTER(setJSDOMURL_search, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_SETTER(setJSDOMURL_search, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, PropertyName attributeName)) { return IDLAttribute::set(*lexicalGlobalObject, thisValue, encodedValue, attributeName); } @@ -633,7 +633,7 @@ static inline JSValue jsDOMURL_searchParamsGetter(JSGlobalObject& lexicalGlobalO return result; } -JSC_DEFINE_CUSTOM_GETTER(jsDOMURL_searchParams, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsDOMURL_searchParams, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } diff --git a/src/bun.js/bindings/webcore/JSDOMURL.h b/src/bun.js/bindings/webcore/JSDOMURL.h index 32d7219128c87..9331b631c4780 100644 --- a/src/bun.js/bindings/webcore/JSDOMURL.h +++ b/src/bun.js/bindings/webcore/JSDOMURL.h @@ -22,7 +22,7 @@ #include "DOMURL.h" #include "JSDOMWrapper.h" -#include "wtf/NeverDestroyed.h" +#include namespace WebCore { diff --git a/src/bun.js/bindings/webcore/JSErrorEvent.cpp b/src/bun.js/bindings/webcore/JSErrorEvent.cpp index d17a0aef2eca7..6dbf1ce8efe63 100644 --- a/src/bun.js/bindings/webcore/JSErrorEvent.cpp +++ b/src/bun.js/bindings/webcore/JSErrorEvent.cpp @@ -204,7 +204,7 @@ STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSErrorEventPrototype, JSErrorEventPrototype using JSErrorEventDOMConstructor = JSDOMConstructor; -template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSErrorEventDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSErrorEventDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) { VM& vm = lexicalGlobalObject->vm(); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -297,7 +297,7 @@ JSValue JSErrorEvent::getConstructor(VM& vm, const JSGlobalObject* globalObject) return getDOMConstructor(vm, *jsCast(globalObject)); } -JSC_DEFINE_CUSTOM_GETTER(jsErrorEventConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsErrorEventConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -315,7 +315,7 @@ static inline JSValue jsErrorEvent_messageGetter(JSGlobalObject& lexicalGlobalOb RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.message()))); } -JSC_DEFINE_CUSTOM_GETTER(jsErrorEvent_message, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsErrorEvent_message, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -328,7 +328,7 @@ static inline JSValue jsErrorEvent_filenameGetter(JSGlobalObject& lexicalGlobalO RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.filename()))); } -JSC_DEFINE_CUSTOM_GETTER(jsErrorEvent_filename, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsErrorEvent_filename, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -341,7 +341,7 @@ static inline JSValue jsErrorEvent_linenoGetter(JSGlobalObject& lexicalGlobalObj RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.lineno()))); } -JSC_DEFINE_CUSTOM_GETTER(jsErrorEvent_lineno, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsErrorEvent_lineno, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -354,7 +354,7 @@ static inline JSValue jsErrorEvent_colnoGetter(JSGlobalObject& lexicalGlobalObje RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.colno()))); } -JSC_DEFINE_CUSTOM_GETTER(jsErrorEvent_colno, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsErrorEvent_colno, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -367,7 +367,7 @@ static inline JSValue jsErrorEvent_errorGetter(JSGlobalObject& lexicalGlobalObje RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.error(*jsCast(&lexicalGlobalObject))))); } -JSC_DEFINE_CUSTOM_GETTER(jsErrorEvent_error, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsErrorEvent_error, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } diff --git a/src/bun.js/bindings/webcore/JSEvent.cpp b/src/bun.js/bindings/webcore/JSEvent.cpp index 4f57b5abf463a..6352617000305 100644 --- a/src/bun.js/bindings/webcore/JSEvent.cpp +++ b/src/bun.js/bindings/webcore/JSEvent.cpp @@ -146,7 +146,7 @@ static_assert(Event::CAPTURING_PHASE == 1, "CAPTURING_PHASE in Event does not ma static_assert(Event::AT_TARGET == 2, "AT_TARGET in Event does not match value from IDL"); static_assert(Event::BUBBLING_PHASE == 3, "BUBBLING_PHASE in Event does not match value from IDL"); -template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSEventDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSEventDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) { VM& vm = lexicalGlobalObject->vm(); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -274,7 +274,7 @@ void JSEvent::destroy(JSC::JSCell* cell) thisObject->JSEvent::~JSEvent(); } -JSC_DEFINE_CUSTOM_GETTER(jsEventConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsEventConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -292,7 +292,7 @@ static inline JSValue jsEvent_typeGetter(JSGlobalObject& lexicalGlobalObject, JS RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.type()))); } -JSC_DEFINE_CUSTOM_GETTER(jsEvent_type, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsEvent_type, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -305,7 +305,7 @@ static inline JSValue jsEvent_targetGetter(JSGlobalObject& lexicalGlobalObject, RELEASE_AND_RETURN(throwScope, (toJS>>(lexicalGlobalObject, *thisObject.globalObject(), throwScope, impl.target()))); } -JSC_DEFINE_CUSTOM_GETTER(jsEvent_target, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsEvent_target, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -318,7 +318,7 @@ static inline JSValue jsEvent_currentTargetGetter(JSGlobalObject& lexicalGlobalO RELEASE_AND_RETURN(throwScope, (toJS>>(lexicalGlobalObject, *thisObject.globalObject(), throwScope, impl.currentTarget()))); } -JSC_DEFINE_CUSTOM_GETTER(jsEvent_currentTarget, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsEvent_currentTarget, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -331,7 +331,7 @@ static inline JSValue jsEvent_eventPhaseGetter(JSGlobalObject& lexicalGlobalObje RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.eventPhase()))); } -JSC_DEFINE_CUSTOM_GETTER(jsEvent_eventPhase, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsEvent_eventPhase, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -344,7 +344,7 @@ static inline JSValue jsEvent_cancelBubbleGetter(JSGlobalObject& lexicalGlobalOb RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.cancelBubble()))); } -JSC_DEFINE_CUSTOM_GETTER(jsEvent_cancelBubble, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsEvent_cancelBubble, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -362,7 +362,7 @@ static inline bool setJSEvent_cancelBubbleSetter(JSGlobalObject& lexicalGlobalOb return true; } -JSC_DEFINE_CUSTOM_SETTER(setJSEvent_cancelBubble, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_SETTER(setJSEvent_cancelBubble, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, PropertyName attributeName)) { return IDLAttribute::set(*lexicalGlobalObject, thisValue, encodedValue, attributeName); } @@ -375,7 +375,7 @@ static inline JSValue jsEvent_bubblesGetter(JSGlobalObject& lexicalGlobalObject, RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.bubbles()))); } -JSC_DEFINE_CUSTOM_GETTER(jsEvent_bubbles, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsEvent_bubbles, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -388,7 +388,7 @@ static inline JSValue jsEvent_cancelableGetter(JSGlobalObject& lexicalGlobalObje RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.cancelable()))); } -JSC_DEFINE_CUSTOM_GETTER(jsEvent_cancelable, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsEvent_cancelable, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -401,7 +401,7 @@ static inline JSValue jsEvent_defaultPreventedGetter(JSGlobalObject& lexicalGlob RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.defaultPrevented()))); } -JSC_DEFINE_CUSTOM_GETTER(jsEvent_defaultPrevented, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsEvent_defaultPrevented, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -414,7 +414,7 @@ static inline JSValue jsEvent_composedGetter(JSGlobalObject& lexicalGlobalObject RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.composed()))); } -JSC_DEFINE_CUSTOM_GETTER(jsEvent_composed, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsEvent_composed, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -427,7 +427,7 @@ static inline JSValue jsEvent_isTrustedGetter(JSGlobalObject& lexicalGlobalObjec RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.isTrusted()))); } -JSC_DEFINE_CUSTOM_GETTER(jsEvent_isTrusted, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsEvent_isTrusted, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -443,7 +443,7 @@ static inline JSValue jsEvent_timeStampGetter(JSGlobalObject& lexicalGlobalObjec RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.timeStampForBindings(*context)))); } -JSC_DEFINE_CUSTOM_GETTER(jsEvent_timeStamp, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsEvent_timeStamp, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -456,7 +456,7 @@ static inline JSValue jsEvent_srcElementGetter(JSGlobalObject& lexicalGlobalObje RELEASE_AND_RETURN(throwScope, (toJS>(lexicalGlobalObject, *thisObject.globalObject(), throwScope, impl.target()))); } -JSC_DEFINE_CUSTOM_GETTER(jsEvent_srcElement, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsEvent_srcElement, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -469,7 +469,7 @@ static inline JSValue jsEvent_returnValueGetter(JSGlobalObject& lexicalGlobalObj RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.legacyReturnValue()))); } -JSC_DEFINE_CUSTOM_GETTER(jsEvent_returnValue, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsEvent_returnValue, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -487,7 +487,7 @@ static inline bool setJSEvent_returnValueSetter(JSGlobalObject& lexicalGlobalObj return true; } -JSC_DEFINE_CUSTOM_SETTER(setJSEvent_returnValue, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_SETTER(setJSEvent_returnValue, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, PropertyName attributeName)) { return IDLAttribute::set(*lexicalGlobalObject, thisValue, encodedValue, attributeName); } diff --git a/src/bun.js/bindings/webcore/JSEventEmitter.cpp b/src/bun.js/bindings/webcore/JSEventEmitter.cpp index e81af9549d1b2..e10c1fd65f69f 100644 --- a/src/bun.js/bindings/webcore/JSEventEmitter.cpp +++ b/src/bun.js/bindings/webcore/JSEventEmitter.cpp @@ -96,7 +96,7 @@ STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSEventEmitterPrototype, JSEventEmitterProto using JSEventEmitterDOMConstructor = JSDOMConstructor; -template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSEventEmitterDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSEventEmitterDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) { VM& vm = lexicalGlobalObject->vm(); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -210,7 +210,7 @@ void JSEventEmitter::destroy(JSC::JSCell* cell) thisObject->JSEventEmitter::~JSEventEmitter(); } -JSC_DEFINE_CUSTOM_GETTER(jsEventEmitterConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsEventEmitterConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); diff --git a/src/bun.js/bindings/webcore/JSEventTarget.cpp b/src/bun.js/bindings/webcore/JSEventTarget.cpp index 9f97ac80714a9..f3a233615f55a 100644 --- a/src/bun.js/bindings/webcore/JSEventTarget.cpp +++ b/src/bun.js/bindings/webcore/JSEventTarget.cpp @@ -100,7 +100,7 @@ STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSEventTargetPrototype, JSEventTargetPrototy using JSEventTargetDOMConstructor = JSDOMConstructor; -template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSEventTargetDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSEventTargetDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) { VM& vm = lexicalGlobalObject->vm(); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -193,7 +193,7 @@ void JSEventTarget::destroy(JSC::JSCell* cell) thisObject->JSEventTarget::~JSEventTarget(); } -JSC_DEFINE_CUSTOM_GETTER(jsEventTargetConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsEventTargetConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); diff --git a/src/bun.js/bindings/webcore/JSFetchHeaders.cpp b/src/bun.js/bindings/webcore/JSFetchHeaders.cpp index 421a042e50b66..41bb1f475d69a 100644 --- a/src/bun.js/bindings/webcore/JSFetchHeaders.cpp +++ b/src/bun.js/bindings/webcore/JSFetchHeaders.cpp @@ -115,7 +115,7 @@ STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSFetchHeadersPrototype, JSFetchHeadersProto using JSFetchHeadersDOMConstructor = JSDOMConstructor; -template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSFetchHeadersDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSFetchHeadersDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) { VM& vm = lexicalGlobalObject->vm(); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -353,7 +353,7 @@ void JSFetchHeaders::destroy(JSC::JSCell* cell) thisObject->JSFetchHeaders::~JSFetchHeaders(); } -JSC_DEFINE_CUSTOM_GETTER(jsFetchHeadersConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsFetchHeadersConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -535,7 +535,7 @@ const JSC::ClassInfo FetchHeadersIterator::s_info = { "Headers Iterator"_s, &Bas template<> const JSC::ClassInfo FetchHeadersIteratorPrototype::s_info = { "Headers Iterator"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(FetchHeadersIteratorPrototype) }; -static inline EncodedJSValue jsFetchHeadersPrototypeFunction_entriesCaller(JSGlobalObject*, CallFrame*, JSFetchHeaders* thisObject) +static inline JSC::EncodedJSValue jsFetchHeadersPrototypeFunction_entriesCaller(JSGlobalObject*, CallFrame*, JSFetchHeaders* thisObject) { return JSValue::encode(iteratorCreate(*thisObject, IterationKind::Entries)); } @@ -545,7 +545,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFetchHeadersPrototypeFunction_entries, (JSC::JSGlobal return IDLOperation::call(*lexicalGlobalObject, *callFrame, "entries"); } -static inline EncodedJSValue jsFetchHeadersPrototypeFunction_keysCaller(JSGlobalObject*, CallFrame*, JSFetchHeaders* thisObject) +static inline JSC::EncodedJSValue jsFetchHeadersPrototypeFunction_keysCaller(JSGlobalObject*, CallFrame*, JSFetchHeaders* thisObject) { return JSValue::encode(iteratorCreate(*thisObject, IterationKind::Keys)); } @@ -555,7 +555,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFetchHeadersPrototypeFunction_keys, (JSC::JSGlobalObj return IDLOperation::call(*lexicalGlobalObject, *callFrame, "keys"); } -static inline EncodedJSValue jsFetchHeadersPrototypeFunction_valuesCaller(JSGlobalObject*, CallFrame*, JSFetchHeaders* thisObject) +static inline JSC::EncodedJSValue jsFetchHeadersPrototypeFunction_valuesCaller(JSGlobalObject*, CallFrame*, JSFetchHeaders* thisObject) { return JSValue::encode(iteratorCreate(*thisObject, IterationKind::Values)); } @@ -565,7 +565,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFetchHeadersPrototypeFunction_values, (JSC::JSGlobalO return IDLOperation::call(*lexicalGlobalObject, *callFrame, "values"); } -static inline EncodedJSValue jsFetchHeadersPrototypeFunction_forEachCaller(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame, JSFetchHeaders* thisObject) +static inline JSC::EncodedJSValue jsFetchHeadersPrototypeFunction_forEachCaller(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame, JSFetchHeaders* thisObject) { return JSValue::encode(iteratorForEach(*lexicalGlobalObject, *callFrame, *thisObject)); } diff --git a/src/bun.js/bindings/webcore/JSMessageChannel.cpp b/src/bun.js/bindings/webcore/JSMessageChannel.cpp index 2082bd9a8d35e..8b98dff183ced 100644 --- a/src/bun.js/bindings/webcore/JSMessageChannel.cpp +++ b/src/bun.js/bindings/webcore/JSMessageChannel.cpp @@ -91,7 +91,7 @@ STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSMessageChannelPrototype, JSMessageChannelP using JSMessageChannelDOMConstructor = JSDOMConstructor; -template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSMessageChannelDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSMessageChannelDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) { VM& vm = lexicalGlobalObject->vm(); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -179,7 +179,7 @@ void JSMessageChannel::destroy(JSC::JSCell* cell) thisObject->JSMessageChannel::~JSMessageChannel(); } -JSC_DEFINE_CUSTOM_GETTER(jsMessageChannelConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsMessageChannelConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -197,7 +197,7 @@ static inline JSValue jsMessageChannel_port1Getter(JSGlobalObject& lexicalGlobal RELEASE_AND_RETURN(throwScope, (toJS>(lexicalGlobalObject, *thisObject.globalObject(), throwScope, impl.port1()))); } -JSC_DEFINE_CUSTOM_GETTER(jsMessageChannel_port1, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsMessageChannel_port1, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -210,7 +210,7 @@ static inline JSValue jsMessageChannel_port2Getter(JSGlobalObject& lexicalGlobal RELEASE_AND_RETURN(throwScope, (toJS>(lexicalGlobalObject, *thisObject.globalObject(), throwScope, impl.port2()))); } -JSC_DEFINE_CUSTOM_GETTER(jsMessageChannel_port2, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsMessageChannel_port2, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } diff --git a/src/bun.js/bindings/webcore/JSMessageEvent.cpp b/src/bun.js/bindings/webcore/JSMessageEvent.cpp index 0a7ca6a5f37c8..42da7ef412c27 100644 --- a/src/bun.js/bindings/webcore/JSMessageEvent.cpp +++ b/src/bun.js/bindings/webcore/JSMessageEvent.cpp @@ -20,7 +20,7 @@ #include "config.h" #include "JSMessageEvent.h" -#include "JavaScriptCore/ObjectConstructor.h" +#include #include "ActiveDOMObject.h" #include "ExtendedDOMClientIsoSubspaces.h" #include "ExtendedDOMIsoSubspaces.h" @@ -217,7 +217,7 @@ STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSMessageEventPrototype, JSMessageEventProto using JSMessageEventDOMConstructor = JSDOMConstructor; -template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSMessageEventDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSMessageEventDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) { VM& vm = lexicalGlobalObject->vm(); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -313,7 +313,7 @@ JSValue JSMessageEvent::getConstructor(VM& vm, const JSGlobalObject* globalObjec return getDOMConstructor(vm, *jsCast(globalObject)); } -JSC_DEFINE_CUSTOM_GETTER(jsMessageEventConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsMessageEventConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -331,7 +331,7 @@ static inline JSValue jsMessageEvent_originGetter(JSGlobalObject& lexicalGlobalO RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.origin()))); } -JSC_DEFINE_CUSTOM_GETTER(jsMessageEvent_origin, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsMessageEvent_origin, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -344,7 +344,7 @@ static inline JSValue jsMessageEvent_lastEventIdGetter(JSGlobalObject& lexicalGl RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.lastEventId()))); } -JSC_DEFINE_CUSTOM_GETTER(jsMessageEvent_lastEventId, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsMessageEvent_lastEventId, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -358,7 +358,7 @@ static inline JSValue jsMessageEvent_sourceGetter(JSGlobalObject& lexicalGlobalO // RELEASE_AND_RETURN(throwScope, (toJS, IDLInterface, IDLInterface>>>(lexicalGlobalObject, *thisObject.globalObject(), throwScope, impl.source()))); } -JSC_DEFINE_CUSTOM_GETTER(jsMessageEvent_source, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsMessageEvent_source, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -369,7 +369,7 @@ static inline JSValue jsMessageEvent_dataGetter(JSGlobalObject& lexicalGlobalObj return thisObject.data(lexicalGlobalObject); } -JSC_DEFINE_CUSTOM_GETTER(jsMessageEvent_data, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsMessageEvent_data, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -380,7 +380,7 @@ static inline JSValue jsMessageEvent_portsGetter(JSGlobalObject& lexicalGlobalOb return thisObject.ports(lexicalGlobalObject); } -JSC_DEFINE_CUSTOM_GETTER(jsMessageEvent_ports, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsMessageEvent_ports, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } diff --git a/src/bun.js/bindings/webcore/JSMessagePort.cpp b/src/bun.js/bindings/webcore/JSMessagePort.cpp index b70167e555dc6..a0d97cc9720e0 100644 --- a/src/bun.js/bindings/webcore/JSMessagePort.cpp +++ b/src/bun.js/bindings/webcore/JSMessagePort.cpp @@ -173,7 +173,7 @@ JSValue JSMessagePort::getConstructor(VM& vm, const JSGlobalObject* globalObject return getDOMConstructor(vm, *jsCast(globalObject)); } -JSC_DEFINE_CUSTOM_GETTER(jsMessagePortConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsMessagePortConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -189,7 +189,7 @@ static inline JSValue jsMessagePort_onmessageGetter(JSGlobalObject& lexicalGloba return eventHandlerAttribute(thisObject.wrapped(), eventNames().messageEvent, worldForDOMObject(thisObject)); } -JSC_DEFINE_CUSTOM_GETTER(jsMessagePort_onmessage, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsMessagePort_onmessage, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -207,7 +207,7 @@ static inline bool setJSMessagePort_onmessageSetter(JSGlobalObject& lexicalGloba return true; } -JSC_DEFINE_CUSTOM_SETTER(setJSMessagePort_onmessage, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_SETTER(setJSMessagePort_onmessage, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, PropertyName attributeName)) { return IDLAttribute::set(*lexicalGlobalObject, thisValue, encodedValue, attributeName); } @@ -218,7 +218,7 @@ static inline JSValue jsMessagePort_onmessageerrorGetter(JSGlobalObject& lexical return eventHandlerAttribute(thisObject.wrapped(), eventNames().messageerrorEvent, worldForDOMObject(thisObject)); } -JSC_DEFINE_CUSTOM_GETTER(jsMessagePort_onmessageerror, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsMessagePort_onmessageerror, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -236,7 +236,7 @@ static inline bool setJSMessagePort_onmessageerrorSetter(JSGlobalObject& lexical return true; } -JSC_DEFINE_CUSTOM_SETTER(setJSMessagePort_onmessageerror, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_SETTER(setJSMessagePort_onmessageerror, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, PropertyName attributeName)) { return IDLAttribute::set(*lexicalGlobalObject, thisValue, encodedValue, attributeName); } diff --git a/src/bun.js/bindings/webcore/JSReadableByteStreamController.cpp b/src/bun.js/bindings/webcore/JSReadableByteStreamController.cpp index 54b1a9034e775..cf3d514423ef8 100644 --- a/src/bun.js/bindings/webcore/JSReadableByteStreamController.cpp +++ b/src/bun.js/bindings/webcore/JSReadableByteStreamController.cpp @@ -158,7 +158,7 @@ void JSReadableByteStreamController::destroy(JSC::JSCell* cell) thisObject->JSReadableByteStreamController::~JSReadableByteStreamController(); } -JSC_DEFINE_CUSTOM_GETTER(jsReadableByteStreamControllerConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsReadableByteStreamControllerConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); diff --git a/src/bun.js/bindings/webcore/JSReadableStream.cpp b/src/bun.js/bindings/webcore/JSReadableStream.cpp index 0a0ef3b2324ce..775aa4193c825 100644 --- a/src/bun.js/bindings/webcore/JSReadableStream.cpp +++ b/src/bun.js/bindings/webcore/JSReadableStream.cpp @@ -164,7 +164,7 @@ void JSReadableStream::destroy(JSC::JSCell* cell) thisObject->JSReadableStream::~JSReadableStream(); } -JSC_DEFINE_CUSTOM_GETTER(jsReadableStreamConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsReadableStreamConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); diff --git a/src/bun.js/bindings/webcore/JSReadableStreamBYOBReader.cpp b/src/bun.js/bindings/webcore/JSReadableStreamBYOBReader.cpp index 4d64bf23aae8c..fa8b37d163abf 100644 --- a/src/bun.js/bindings/webcore/JSReadableStreamBYOBReader.cpp +++ b/src/bun.js/bindings/webcore/JSReadableStreamBYOBReader.cpp @@ -157,7 +157,7 @@ void JSReadableStreamBYOBReader::destroy(JSC::JSCell* cell) thisObject->JSReadableStreamBYOBReader::~JSReadableStreamBYOBReader(); } -JSC_DEFINE_CUSTOM_GETTER(jsReadableStreamBYOBReaderConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsReadableStreamBYOBReaderConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); diff --git a/src/bun.js/bindings/webcore/JSReadableStreamBYOBRequest.cpp b/src/bun.js/bindings/webcore/JSReadableStreamBYOBRequest.cpp index b3520e8f88c68..0e50d440cfda6 100644 --- a/src/bun.js/bindings/webcore/JSReadableStreamBYOBRequest.cpp +++ b/src/bun.js/bindings/webcore/JSReadableStreamBYOBRequest.cpp @@ -156,7 +156,7 @@ void JSReadableStreamBYOBRequest::destroy(JSC::JSCell* cell) thisObject->JSReadableStreamBYOBRequest::~JSReadableStreamBYOBRequest(); } -JSC_DEFINE_CUSTOM_GETTER(jsReadableStreamBYOBRequestConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsReadableStreamBYOBRequestConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); diff --git a/src/bun.js/bindings/webcore/JSReadableStreamDefaultController.cpp b/src/bun.js/bindings/webcore/JSReadableStreamDefaultController.cpp index b150840419238..1faff7a64f4d3 100644 --- a/src/bun.js/bindings/webcore/JSReadableStreamDefaultController.cpp +++ b/src/bun.js/bindings/webcore/JSReadableStreamDefaultController.cpp @@ -160,7 +160,7 @@ void JSReadableStreamDefaultController::destroy(JSC::JSCell* cell) thisObject->JSReadableStreamDefaultController::~JSReadableStreamDefaultController(); } -JSC_DEFINE_CUSTOM_GETTER(jsReadableStreamDefaultControllerConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsReadableStreamDefaultControllerConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); diff --git a/src/bun.js/bindings/webcore/JSReadableStreamDefaultReader.cpp b/src/bun.js/bindings/webcore/JSReadableStreamDefaultReader.cpp index 68b587a925cdf..3b72d7b004aca 100644 --- a/src/bun.js/bindings/webcore/JSReadableStreamDefaultReader.cpp +++ b/src/bun.js/bindings/webcore/JSReadableStreamDefaultReader.cpp @@ -158,7 +158,7 @@ void JSReadableStreamDefaultReader::destroy(JSC::JSCell* cell) thisObject->JSReadableStreamDefaultReader::~JSReadableStreamDefaultReader(); } -JSC_DEFINE_CUSTOM_GETTER(jsReadableStreamDefaultReaderConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsReadableStreamDefaultReaderConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); diff --git a/src/bun.js/bindings/webcore/JSReadableStreamSource.cpp b/src/bun.js/bindings/webcore/JSReadableStreamSource.cpp index 15c77fe3de809..fe9ca3ae1e4cc 100644 --- a/src/bun.js/bindings/webcore/JSReadableStreamSource.cpp +++ b/src/bun.js/bindings/webcore/JSReadableStreamSource.cpp @@ -150,7 +150,7 @@ static inline JSValue jsReadableStreamSource_controllerGetter(JSGlobalObject& le return thisObject.controller(lexicalGlobalObject); } -JSC_DEFINE_CUSTOM_GETTER(jsReadableStreamSource_controller, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsReadableStreamSource_controller, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } diff --git a/src/bun.js/bindings/webcore/JSTextEncoder.cpp b/src/bun.js/bindings/webcore/JSTextEncoder.cpp index 3029028feca87..533ffe84af705 100644 --- a/src/bun.js/bindings/webcore/JSTextEncoder.cpp +++ b/src/bun.js/bindings/webcore/JSTextEncoder.cpp @@ -22,19 +22,19 @@ #include "JSTextEncoder.h" -#include "JavaScriptCore/JavaScript.h" -#include "JavaScriptCore/APICast.h" - -#include "JavaScriptCore/FunctionPrototype.h" -#include "JavaScriptCore/HeapAnalyzer.h" -#include "JavaScriptCore/JSDestructibleObjectHeapCellType.h" -#include "JavaScriptCore/ObjectConstructor.h" -#include "JavaScriptCore/SlotVisitorMacros.h" -#include "JavaScriptCore/SubspaceInlines.h" -#include "wtf/GetPtr.h" -#include "wtf/PointerPreparations.h" -#include "wtf/URL.h" -// #include "JavaScriptCore/JSTypedArrays.h" +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +// #include #include "GCDefferalContext.h" #include "ActiveDOMObject.h" @@ -178,7 +178,7 @@ STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTextEncoderPrototype, JSTextEncoderPrototy using JSTextEncoderDOMConstructor = JSDOMConstructor; -template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSTextEncoderDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSTextEncoderDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) { VM& vm = lexicalGlobalObject->vm(); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -254,7 +254,7 @@ JSC_DEFINE_JIT_OPERATION(jsTextEncoderEncodeWithoutTypeCheck, JSC::EncodedJSValu IGNORE_WARNINGS_END JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); auto throwScope = DECLARE_THROW_SCOPE(vm); - EncodedJSValue res; + JSC::EncodedJSValue res; String str; if (input->is8Bit()) { if (input->isRope()) { @@ -348,7 +348,7 @@ void JSTextEncoder::destroy(JSC::JSCell* cell) thisObject->JSTextEncoder::~JSTextEncoder(); } -JSC_DEFINE_CUSTOM_GETTER(jsTextEncoderConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsTextEncoderConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -366,7 +366,7 @@ static inline JSValue jsTextEncoder_encodingGetter(JSGlobalObject& lexicalGlobal RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.encoding()))); } -JSC_DEFINE_CUSTOM_GETTER(jsTextEncoder_encoding, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsTextEncoder_encoding, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -379,7 +379,7 @@ static inline JSC::EncodedJSValue jsTextEncoderPrototypeFunction_encodeBody(JSC: UNUSED_PARAM(callFrame); EnsureStillAliveScope argument0 = callFrame->argument(0); JSC::JSString* input = argument0.value().toStringOrNull(lexicalGlobalObject); - EncodedJSValue res; + JSC::EncodedJSValue res; String str; if (input->is8Bit()) { if (input->isRope()) { diff --git a/src/bun.js/bindings/webcore/JSTransformStream.cpp b/src/bun.js/bindings/webcore/JSTransformStream.cpp index 029886bbaf4e2..25cdd8a1033ad 100644 --- a/src/bun.js/bindings/webcore/JSTransformStream.cpp +++ b/src/bun.js/bindings/webcore/JSTransformStream.cpp @@ -152,7 +152,7 @@ void JSTransformStream::destroy(JSC::JSCell* cell) thisObject->JSTransformStream::~JSTransformStream(); } -JSC_DEFINE_CUSTOM_GETTER(jsTransformStreamConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsTransformStreamConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); diff --git a/src/bun.js/bindings/webcore/JSTransformStreamDefaultController.cpp b/src/bun.js/bindings/webcore/JSTransformStreamDefaultController.cpp index c4367f635ad55..495d9202dcd9f 100644 --- a/src/bun.js/bindings/webcore/JSTransformStreamDefaultController.cpp +++ b/src/bun.js/bindings/webcore/JSTransformStreamDefaultController.cpp @@ -157,7 +157,7 @@ void JSTransformStreamDefaultController::destroy(JSC::JSCell* cell) thisObject->JSTransformStreamDefaultController::~JSTransformStreamDefaultController(); } -JSC_DEFINE_CUSTOM_GETTER(jsTransformStreamDefaultControllerConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsTransformStreamDefaultControllerConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); diff --git a/src/bun.js/bindings/webcore/JSURLSearchParams.cpp b/src/bun.js/bindings/webcore/JSURLSearchParams.cpp index 4c0f0e91216eb..a1884e82514f4 100644 --- a/src/bun.js/bindings/webcore/JSURLSearchParams.cpp +++ b/src/bun.js/bindings/webcore/JSURLSearchParams.cpp @@ -41,20 +41,20 @@ #include "JSDOMIterator.h" #include "JSDOMOperation.h" #include "JSDOMWrapperCache.h" -#include "JavaScriptCore/BuiltinNames.h" -#include "JavaScriptCore/FunctionPrototype.h" -#include "JavaScriptCore/HeapAnalyzer.h" -#include "JavaScriptCore/JSArray.h" - -#include "JavaScriptCore/JSDestructibleObjectHeapCellType.h" -#include "JavaScriptCore/SlotVisitorMacros.h" -#include "JavaScriptCore/SubspaceInlines.h" +#include +#include +#include +#include + +#include +#include +#include #include "ScriptExecutionContext.h" #include "WebCoreJSClientData.h" -#include "wtf/GetPtr.h" -#include "wtf/PointerPreparations.h" -#include "wtf/URL.h" -#include "wtf/Vector.h" +#include +#include +#include +#include #include #include "GCDefferalContext.h" @@ -115,7 +115,7 @@ STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSURLSearchParamsPrototype, JSURLSearchParam using JSURLSearchParamsDOMConstructor = JSDOMConstructor; -template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSURLSearchParamsDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSURLSearchParamsDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) { VM& vm = lexicalGlobalObject->vm(); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -154,7 +154,7 @@ template<> void JSURLSearchParamsDOMConstructor::initializeProperties(VM& vm, JS putDirect(vm, vm.propertyNames->prototype, JSURLSearchParams::prototype(vm, globalObject), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::DontDelete); } -JSC_DEFINE_CUSTOM_GETTER(jsURLSearchParamsPrototype_getLength, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsURLSearchParamsPrototype_getLength, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -231,7 +231,7 @@ void JSURLSearchParams::destroy(JSC::JSCell* cell) thisObject->JSURLSearchParams::~JSURLSearchParams(); } -JSC_DEFINE_CUSTOM_GETTER(jsURLSearchParamsConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsURLSearchParamsConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -397,7 +397,7 @@ JSC_DEFINE_HOST_FUNCTION(jsURLSearchParamsPrototypeFunction_toString, (JSGlobalO return IDLOperation::call(*lexicalGlobalObject, *callFrame, "toString"); } -JSC::JSValue WebCore::getInternalProperties(JSC::VM& vm, JSC::JSGlobalObject* lexicalGlobalObject, JSURLSearchParams* castedThis) +JSC::JSValue getInternalProperties(JSC::VM& vm, JSC::JSGlobalObject* lexicalGlobalObject, JSURLSearchParams* castedThis) { auto& impl = castedThis->wrapped(); auto iter = impl.createIterator(); @@ -517,7 +517,7 @@ const JSC::ClassInfo URLSearchParamsIterator::s_info = { "URLSearchParams Iterat template<> const JSC::ClassInfo URLSearchParamsIteratorPrototype::s_info = { "URLSearchParams Iterator"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(URLSearchParamsIteratorPrototype) }; -static inline EncodedJSValue jsURLSearchParamsPrototypeFunction_entriesCaller(JSGlobalObject*, CallFrame*, JSURLSearchParams* thisObject) +static inline JSC::EncodedJSValue jsURLSearchParamsPrototypeFunction_entriesCaller(JSGlobalObject*, CallFrame*, JSURLSearchParams* thisObject) { return JSValue::encode(iteratorCreate(*thisObject, IterationKind::Entries)); } @@ -527,7 +527,7 @@ JSC_DEFINE_HOST_FUNCTION(jsURLSearchParamsPrototypeFunction_entries, (JSC::JSGlo return IDLOperation::call(*lexicalGlobalObject, *callFrame, "entries"); } -static inline EncodedJSValue jsURLSearchParamsPrototypeFunction_keysCaller(JSGlobalObject*, CallFrame*, JSURLSearchParams* thisObject) +static inline JSC::EncodedJSValue jsURLSearchParamsPrototypeFunction_keysCaller(JSGlobalObject*, CallFrame*, JSURLSearchParams* thisObject) { return JSValue::encode(iteratorCreate(*thisObject, IterationKind::Keys)); } @@ -537,7 +537,7 @@ JSC_DEFINE_HOST_FUNCTION(jsURLSearchParamsPrototypeFunction_keys, (JSC::JSGlobal return IDLOperation::call(*lexicalGlobalObject, *callFrame, "keys"); } -static inline EncodedJSValue jsURLSearchParamsPrototypeFunction_valuesCaller(JSGlobalObject*, CallFrame*, JSURLSearchParams* thisObject) +static inline JSC::EncodedJSValue jsURLSearchParamsPrototypeFunction_valuesCaller(JSGlobalObject*, CallFrame*, JSURLSearchParams* thisObject) { return JSValue::encode(iteratorCreate(*thisObject, IterationKind::Values)); } @@ -547,7 +547,7 @@ JSC_DEFINE_HOST_FUNCTION(jsURLSearchParamsPrototypeFunction_values, (JSC::JSGlob return IDLOperation::call(*lexicalGlobalObject, *callFrame, "values"); } -static inline EncodedJSValue jsURLSearchParamsPrototypeFunction_forEachCaller(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame, JSURLSearchParams* thisObject) +static inline JSC::EncodedJSValue jsURLSearchParamsPrototypeFunction_forEachCaller(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame, JSURLSearchParams* thisObject) { return JSValue::encode(iteratorForEach(*lexicalGlobalObject, *callFrame, *thisObject)); } diff --git a/src/bun.js/bindings/webcore/JSURLSearchParams.h b/src/bun.js/bindings/webcore/JSURLSearchParams.h index 7ff247ed77388..d0794d345f3f7 100644 --- a/src/bun.js/bindings/webcore/JSURLSearchParams.h +++ b/src/bun.js/bindings/webcore/JSURLSearchParams.h @@ -22,7 +22,7 @@ #include "JSDOMWrapper.h" #include "URLSearchParams.h" -#include "wtf/NeverDestroyed.h" +#include namespace WebCore { diff --git a/src/bun.js/bindings/webcore/JSValueInWrappedObject.h b/src/bun.js/bindings/webcore/JSValueInWrappedObject.h index d11796912580e..041bba307d5c5 100644 --- a/src/bun.js/bindings/webcore/JSValueInWrappedObject.h +++ b/src/bun.js/bindings/webcore/JSValueInWrappedObject.h @@ -26,9 +26,9 @@ #include "DOMWrapperWorld.h" #include "JSDOMWrapper.h" -#include "JavaScriptCore/JSCJSValue.h" -#include "JavaScriptCore/SlotVisitor.h" -#include "JavaScriptCore/Weak.h" +#include +#include +#include #include namespace WebCore { diff --git a/src/bun.js/bindings/webcore/JSWebSocket.cpp b/src/bun.js/bindings/webcore/JSWebSocket.cpp index 7b099544b35c8..6a0d3dbf5df7d 100644 --- a/src/bun.js/bindings/webcore/JSWebSocket.cpp +++ b/src/bun.js/bindings/webcore/JSWebSocket.cpp @@ -143,7 +143,7 @@ static_assert(WebSocket::OPEN == 1, "OPEN in WebSocket does not match value from static_assert(WebSocket::CLOSING == 2, "CLOSING in WebSocket does not match value from IDL"); static_assert(WebSocket::CLOSED == 3, "CLOSED in WebSocket does not match value from IDL"); -static inline EncodedJSValue constructJSWebSocket1(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +static inline JSC::EncodedJSValue constructJSWebSocket1(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) { VM& vm = lexicalGlobalObject->vm(); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -170,7 +170,7 @@ static inline EncodedJSValue constructJSWebSocket1(JSGlobalObject* lexicalGlobal return JSValue::encode(jsValue); } -static inline EncodedJSValue constructJSWebSocket2(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +static inline JSC::EncodedJSValue constructJSWebSocket2(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) { VM& vm = lexicalGlobalObject->vm(); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -197,7 +197,7 @@ static inline EncodedJSValue constructJSWebSocket2(JSGlobalObject* lexicalGlobal return JSValue::encode(jsValue); } -static inline EncodedJSValue constructJSWebSocket3(JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, JSValue urlValue, JSValue optionsObjectValue) +static inline JSC::EncodedJSValue constructJSWebSocket3(JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, JSValue urlValue, JSValue optionsObjectValue) { VM& vm = lexicalGlobalObject->vm(); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -245,7 +245,7 @@ static inline EncodedJSValue constructJSWebSocket3(JSGlobalObject* lexicalGlobal return JSValue::encode(jsValue); } -template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSWebSocketDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSWebSocketDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) { VM& vm = lexicalGlobalObject->vm(); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -357,7 +357,7 @@ JSValue JSWebSocket::getConstructor(VM& vm, const JSGlobalObject* globalObject) return getDOMConstructor(vm, *jsCast(globalObject)); } -JSC_DEFINE_CUSTOM_GETTER(jsWebSocketConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsWebSocketConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -375,7 +375,7 @@ static inline JSValue jsWebSocket_URLGetter(JSGlobalObject& lexicalGlobalObject, RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.url()))); } -JSC_DEFINE_CUSTOM_GETTER(jsWebSocket_URL, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsWebSocket_URL, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -388,7 +388,7 @@ static inline JSValue jsWebSocket_urlGetter(JSGlobalObject& lexicalGlobalObject, RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.url()))); } -JSC_DEFINE_CUSTOM_GETTER(jsWebSocket_url, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsWebSocket_url, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -401,7 +401,7 @@ static inline JSValue jsWebSocket_readyStateGetter(JSGlobalObject& lexicalGlobal RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.readyState()))); } -JSC_DEFINE_CUSTOM_GETTER(jsWebSocket_readyState, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsWebSocket_readyState, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -414,7 +414,7 @@ static inline JSValue jsWebSocket_bufferedAmountGetter(JSGlobalObject& lexicalGl RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.bufferedAmount()))); } -JSC_DEFINE_CUSTOM_GETTER(jsWebSocket_bufferedAmount, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsWebSocket_bufferedAmount, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -425,7 +425,7 @@ static inline JSValue jsWebSocket_onopenGetter(JSGlobalObject& lexicalGlobalObje return eventHandlerAttribute(thisObject.wrapped(), eventNames().openEvent, worldForDOMObject(thisObject)); } -JSC_DEFINE_CUSTOM_GETTER(jsWebSocket_onopen, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsWebSocket_onopen, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -440,7 +440,7 @@ static inline bool setJSWebSocket_onopenSetter(JSGlobalObject& lexicalGlobalObje return true; } -JSC_DEFINE_CUSTOM_SETTER(setJSWebSocket_onopen, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_SETTER(setJSWebSocket_onopen, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, PropertyName attributeName)) { return IDLAttribute::set(*lexicalGlobalObject, thisValue, encodedValue, attributeName); } @@ -451,7 +451,7 @@ static inline JSValue jsWebSocket_onmessageGetter(JSGlobalObject& lexicalGlobalO return eventHandlerAttribute(thisObject.wrapped(), eventNames().messageEvent, worldForDOMObject(thisObject)); } -JSC_DEFINE_CUSTOM_GETTER(jsWebSocket_onmessage, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsWebSocket_onmessage, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -466,7 +466,7 @@ static inline bool setJSWebSocket_onmessageSetter(JSGlobalObject& lexicalGlobalO return true; } -JSC_DEFINE_CUSTOM_SETTER(setJSWebSocket_onmessage, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_SETTER(setJSWebSocket_onmessage, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, PropertyName attributeName)) { return IDLAttribute::set(*lexicalGlobalObject, thisValue, encodedValue, attributeName); } @@ -477,7 +477,7 @@ static inline JSValue jsWebSocket_onerrorGetter(JSGlobalObject& lexicalGlobalObj return eventHandlerAttribute(thisObject.wrapped(), eventNames().errorEvent, worldForDOMObject(thisObject)); } -JSC_DEFINE_CUSTOM_GETTER(jsWebSocket_onerror, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsWebSocket_onerror, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -492,7 +492,7 @@ static inline bool setJSWebSocket_onerrorSetter(JSGlobalObject& lexicalGlobalObj return true; } -JSC_DEFINE_CUSTOM_SETTER(setJSWebSocket_onerror, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_SETTER(setJSWebSocket_onerror, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, PropertyName attributeName)) { return IDLAttribute::set(*lexicalGlobalObject, thisValue, encodedValue, attributeName); } @@ -503,7 +503,7 @@ static inline JSValue jsWebSocket_oncloseGetter(JSGlobalObject& lexicalGlobalObj return eventHandlerAttribute(thisObject.wrapped(), eventNames().closeEvent, worldForDOMObject(thisObject)); } -JSC_DEFINE_CUSTOM_GETTER(jsWebSocket_onclose, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsWebSocket_onclose, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -518,7 +518,7 @@ static inline bool setJSWebSocket_oncloseSetter(JSGlobalObject& lexicalGlobalObj return true; } -JSC_DEFINE_CUSTOM_SETTER(setJSWebSocket_onclose, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_SETTER(setJSWebSocket_onclose, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, PropertyName attributeName)) { return IDLAttribute::set(*lexicalGlobalObject, thisValue, encodedValue, attributeName); } @@ -531,7 +531,7 @@ static inline JSValue jsWebSocket_protocolGetter(JSGlobalObject& lexicalGlobalOb RELEASE_AND_RETURN(throwScope, (toJS>(lexicalGlobalObject, throwScope, impl.protocol()))); } -JSC_DEFINE_CUSTOM_GETTER(jsWebSocket_protocol, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsWebSocket_protocol, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -544,7 +544,7 @@ static inline JSValue jsWebSocket_extensionsGetter(JSGlobalObject& lexicalGlobal RELEASE_AND_RETURN(throwScope, (toJS>(lexicalGlobalObject, throwScope, impl.extensions()))); } -JSC_DEFINE_CUSTOM_GETTER(jsWebSocket_extensions, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsWebSocket_extensions, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -557,7 +557,7 @@ static inline JSValue jsWebSocket_binaryTypeGetter(JSGlobalObject& lexicalGlobal RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.binaryType()))); } -JSC_DEFINE_CUSTOM_GETTER(jsWebSocket_binaryType, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsWebSocket_binaryType, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -575,7 +575,7 @@ static inline bool setJSWebSocket_binaryTypeSetter(JSGlobalObject& lexicalGlobal return true; } -JSC_DEFINE_CUSTOM_SETTER(setJSWebSocket_binaryType, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_SETTER(setJSWebSocket_binaryType, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, PropertyName attributeName)) { return IDLAttribute::set(*lexicalGlobalObject, thisValue, encodedValue, attributeName); } diff --git a/src/bun.js/bindings/webcore/JSWorker.cpp b/src/bun.js/bindings/webcore/JSWorker.cpp index 2727bf411ab0a..ed479c378ef49 100644 --- a/src/bun.js/bindings/webcore/JSWorker.cpp +++ b/src/bun.js/bindings/webcore/JSWorker.cpp @@ -111,7 +111,7 @@ STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSWorkerPrototype, JSWorkerPrototype::Base); using JSWorkerDOMConstructor = JSDOMConstructor; -template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSWorkerDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSWorkerDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) { VM& vm = lexicalGlobalObject->vm(); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -189,7 +189,7 @@ template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSWorkerDOMConstructor::const transferredPorts = disentangleResult.releaseReturnValue(); } - options.bun.data = WTFMove(serialized.releaseReturnValue()); + options.bun.data = serialized.releaseReturnValue(); options.bun.dataMessagePorts = WTFMove(transferredPorts); } @@ -266,7 +266,7 @@ template<> void JSWorkerDOMConstructor::initializeProperties(VM& vm, JSDOMGlobal putDirect(vm, vm.propertyNames->prototype, JSWorker::prototype(vm, globalObject), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::DontDelete); } -JSC_DEFINE_CUSTOM_GETTER(jsWorker_threadIdGetter, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsWorker_threadIdGetter, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { auto* castedThis = jsDynamicCast(JSValue::decode(thisValue)); if (UNLIKELY(!castedThis)) @@ -328,7 +328,7 @@ JSValue JSWorker::getConstructor(VM& vm, const JSGlobalObject* globalObject) return getDOMConstructor(vm, *jsCast(globalObject)); } -JSC_DEFINE_CUSTOM_GETTER(jsWorkerConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsWorkerConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -344,7 +344,7 @@ static inline JSValue jsWorker_onmessageGetter(JSGlobalObject& lexicalGlobalObje return eventHandlerAttribute(thisObject.wrapped(), eventNames().messageEvent, worldForDOMObject(thisObject)); } -JSC_DEFINE_CUSTOM_GETTER(jsWorker_onmessage, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsWorker_onmessage, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -360,7 +360,7 @@ static inline bool setJSWorker_onmessageSetter(JSGlobalObject& lexicalGlobalObje return true; } -JSC_DEFINE_CUSTOM_SETTER(setJSWorker_onmessage, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_SETTER(setJSWorker_onmessage, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, PropertyName attributeName)) { return IDLAttribute::set(*lexicalGlobalObject, thisValue, encodedValue, attributeName); } @@ -371,7 +371,7 @@ static inline JSValue jsWorker_onmessageerrorGetter(JSGlobalObject& lexicalGloba return eventHandlerAttribute(thisObject.wrapped(), eventNames().messageerrorEvent, worldForDOMObject(thisObject)); } -JSC_DEFINE_CUSTOM_GETTER(jsWorker_onmessageerror, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsWorker_onmessageerror, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -387,7 +387,7 @@ static inline bool setJSWorker_onmessageerrorSetter(JSGlobalObject& lexicalGloba return true; } -JSC_DEFINE_CUSTOM_SETTER(setJSWorker_onmessageerror, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_SETTER(setJSWorker_onmessageerror, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, PropertyName attributeName)) { return IDLAttribute::set(*lexicalGlobalObject, thisValue, encodedValue, attributeName); } @@ -398,7 +398,7 @@ static inline JSValue jsWorker_onerrorGetter(JSGlobalObject& lexicalGlobalObject return eventHandlerAttribute(thisObject.wrapped(), eventNames().errorEvent, worldForDOMObject(thisObject)); } -JSC_DEFINE_CUSTOM_GETTER(jsWorker_onerror, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsWorker_onerror, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -414,7 +414,7 @@ static inline bool setJSWorker_onerrorSetter(JSGlobalObject& lexicalGlobalObject return true; } -JSC_DEFINE_CUSTOM_SETTER(setJSWorker_onerror, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_SETTER(setJSWorker_onerror, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, PropertyName attributeName)) { return IDLAttribute::set(*lexicalGlobalObject, thisValue, encodedValue, attributeName); } diff --git a/src/bun.js/bindings/webcore/JSWritableStream.cpp b/src/bun.js/bindings/webcore/JSWritableStream.cpp index 9cf7be8634fdb..5292e7c1a9b3a 100644 --- a/src/bun.js/bindings/webcore/JSWritableStream.cpp +++ b/src/bun.js/bindings/webcore/JSWritableStream.cpp @@ -95,7 +95,7 @@ STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSWritableStreamPrototype, JSWritableStreamP using JSWritableStreamDOMConstructor = JSDOMConstructor; -template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSWritableStreamDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSWritableStreamDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) { VM& vm = lexicalGlobalObject->vm(); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -192,7 +192,7 @@ void JSWritableStream::destroy(JSC::JSCell* cell) thisObject->JSWritableStream::~JSWritableStream(); } -JSC_DEFINE_CUSTOM_GETTER(jsWritableStreamConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsWritableStreamConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -210,7 +210,7 @@ static inline JSValue jsWritableStream_lockedGetter(JSGlobalObject& lexicalGloba RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.locked()))); } -JSC_DEFINE_CUSTOM_GETTER(jsWritableStream_locked, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsWritableStream_locked, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } diff --git a/src/bun.js/bindings/webcore/JSWritableStreamDefaultController.cpp b/src/bun.js/bindings/webcore/JSWritableStreamDefaultController.cpp index a1463908aa0b4..af641d0b66e1d 100644 --- a/src/bun.js/bindings/webcore/JSWritableStreamDefaultController.cpp +++ b/src/bun.js/bindings/webcore/JSWritableStreamDefaultController.cpp @@ -153,7 +153,7 @@ void JSWritableStreamDefaultController::destroy(JSC::JSCell* cell) thisObject->JSWritableStreamDefaultController::~JSWritableStreamDefaultController(); } -JSC_DEFINE_CUSTOM_GETTER(jsWritableStreamDefaultControllerConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsWritableStreamDefaultControllerConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); diff --git a/src/bun.js/bindings/webcore/JSWritableStreamDefaultWriter.cpp b/src/bun.js/bindings/webcore/JSWritableStreamDefaultWriter.cpp index fd72ddfb4d3c7..cc79c03d5e5b6 100644 --- a/src/bun.js/bindings/webcore/JSWritableStreamDefaultWriter.cpp +++ b/src/bun.js/bindings/webcore/JSWritableStreamDefaultWriter.cpp @@ -160,7 +160,7 @@ void JSWritableStreamDefaultWriter::destroy(JSC::JSCell* cell) thisObject->JSWritableStreamDefaultWriter::~JSWritableStreamDefaultWriter(); } -JSC_DEFINE_CUSTOM_GETTER(jsWritableStreamDefaultWriterConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsWritableStreamDefaultWriterConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); diff --git a/src/bun.js/bindings/webcore/ScriptWrappable.cpp b/src/bun.js/bindings/webcore/ScriptWrappable.cpp index c55b2ac920cb7..4982dc70a60cb 100644 --- a/src/bun.js/bindings/webcore/ScriptWrappable.cpp +++ b/src/bun.js/bindings/webcore/ScriptWrappable.cpp @@ -29,7 +29,7 @@ #include "config.h" #include "ScriptWrappable.h" -// #include "wtf/IsoMallocInlines.h" +// #include namespace WebCore { diff --git a/src/bun.js/bindings/webcore/ScriptWrappable.h b/src/bun.js/bindings/webcore/ScriptWrappable.h index 20aafa6a11e77..265282045b777 100644 --- a/src/bun.js/bindings/webcore/ScriptWrappable.h +++ b/src/bun.js/bindings/webcore/ScriptWrappable.h @@ -35,7 +35,7 @@ #include "JSDOMWrapper.h" -// #include "wtf/IsoMalloc.h" +// #include namespace WebCore { diff --git a/src/bun.js/bindings/webcore/ScriptWrappableInlines.h b/src/bun.js/bindings/webcore/ScriptWrappableInlines.h index 80b8087bf5ac1..fdd706b48731a 100644 --- a/src/bun.js/bindings/webcore/ScriptWrappableInlines.h +++ b/src/bun.js/bindings/webcore/ScriptWrappableInlines.h @@ -32,8 +32,8 @@ #pragma once #include "JSDOMWrapper.h" -#include "JavaScriptCore/Weak.h" -#include "JavaScriptCore/WeakInlines.h" +#include +#include namespace WebCore { diff --git a/src/bun.js/bindings/webcore/StructuredClone.cpp b/src/bun.js/bindings/webcore/StructuredClone.cpp index aabc9009cf651..ec4119bb3d36c 100644 --- a/src/bun.js/bindings/webcore/StructuredClone.cpp +++ b/src/bun.js/bindings/webcore/StructuredClone.cpp @@ -39,7 +39,7 @@ enum class CloneMode { Partial, }; -static EncodedJSValue cloneArrayBufferImpl(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame, CloneMode mode) +static JSC::EncodedJSValue cloneArrayBufferImpl(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame, CloneMode mode) { VM& vm = lexicalGlobalObject->vm(); diff --git a/src/bun.js/bindings/webcore/WebCoreTypedArrayController.cpp b/src/bun.js/bindings/webcore/WebCoreTypedArrayController.cpp index 5c8f4fbead92c..655677fb725d2 100644 --- a/src/bun.js/bindings/webcore/WebCoreTypedArrayController.cpp +++ b/src/bun.js/bindings/webcore/WebCoreTypedArrayController.cpp @@ -31,9 +31,9 @@ #include "JSDOMGlobalObject.h" -#include "JavaScriptCore/ArrayBuffer.h" +#include -#include "JavaScriptCore/JSArrayBuffer.h" +#include extern "C" Zig::GlobalObject* Bun__getDefaultGlobal(); static inline WebCore::JSDOMGlobalObject* getDefaultGlobal(JSC::JSGlobalObject* lexicalGlobalObject) diff --git a/src/bun.js/bindings/webcore/WebCoreTypedArrayController.h b/src/bun.js/bindings/webcore/WebCoreTypedArrayController.h index c689e019de785..8b41f671e5ca3 100644 --- a/src/bun.js/bindings/webcore/WebCoreTypedArrayController.h +++ b/src/bun.js/bindings/webcore/WebCoreTypedArrayController.h @@ -25,8 +25,8 @@ #pragma once -#include "JavaScriptCore/JSGlobalObject.h" -#include "JavaScriptCore/TypedArrayController.h" +#include +#include namespace WebCore { diff --git a/src/bun.js/bindings/webcore/WebSocket.cpp b/src/bun.js/bindings/webcore/WebSocket.cpp index 4f7f933c50a4b..e7594aed5e414 100644 --- a/src/bun.js/bindings/webcore/WebSocket.cpp +++ b/src/bun.js/bindings/webcore/WebSocket.cpp @@ -880,13 +880,14 @@ String WebSocket::extensions() const String WebSocket::binaryType() const { switch (m_binaryType) { - // case BinaryType::Blob: - // return "blob"_s; - case BinaryType::ArrayBuffer: - return "arraybuffer"_s; case BinaryType::NodeBuffer: return "nodebuffer"_s; + case BinaryType::ArrayBuffer: + return "arraybuffer"_s; + case BinaryType::Blob: + return "blob"_s; } + ASSERT_NOT_REACHED(); return String(); } @@ -1059,7 +1060,7 @@ void WebSocket::didReceiveBinaryData(const AtomString& eventName, VectorincPendingActivityCount(); - context->postTask([this, name = WTFMove(eventName), buffer = WTFMove(arrayBuffer), protectedThis = Ref { *this }](ScriptExecutionContext& context) { + context->postTask([this, name = eventName, buffer = WTFMove(arrayBuffer), protectedThis = Ref { *this }](ScriptExecutionContext& context) { ASSERT(scriptExecutionContext()); protectedThis->dispatchEvent(MessageEvent::create(name, buffer, m_url.string())); protectedThis->decPendingActivityCount(); @@ -1091,13 +1092,13 @@ void WebSocket::didReceiveBinaryData(const AtomString& eventName, VectorincPendingActivityCount(); - context->postTask([this, name = WTFMove(eventName), buffer = WTFMove(arrayBuffer), protectedThis = Ref { *this }](ScriptExecutionContext& context) { + context->postTask([this, name = eventName, buffer = WTFMove(arrayBuffer), protectedThis = Ref { *this }](ScriptExecutionContext& context) { ASSERT(scriptExecutionContext()); size_t length = buffer->byteLength(); JSUint8Array* uint8array = JSUint8Array::create( scriptExecutionContext()->jsGlobalObject(), reinterpret_cast(scriptExecutionContext()->jsGlobalObject())->JSBufferSubclassStructure(), - WTFMove(buffer.copyRef()), + buffer.copyRef(), 0, length); JSC::EnsureStillAliveScope ensureStillAlive(uint8array); @@ -1111,6 +1112,9 @@ void WebSocket::didReceiveBinaryData(const AtomString& eventName, Vector #include "SerializedScriptValue.h" #include "ScriptExecutionContext.h" -#include "JavaScriptCore/JSMap.h" -#include "JavaScriptCore/JSModuleLoader.h" -#include "JavaScriptCore/DeferredWorkTimer.h" +#include +#include +#include #include "MessageEvent.h" #include #include "BunWorkerGlobalScope.h" @@ -411,7 +411,7 @@ extern "C" void WebWorker__dispatchOnline(Worker* worker, Zig::GlobalObject* glo worker->dispatchOnline(globalObject); } -extern "C" void WebWorker__dispatchError(Zig::GlobalObject* globalObject, Worker* worker, BunString message, EncodedJSValue errorValue) +extern "C" void WebWorker__dispatchError(Zig::GlobalObject* globalObject, Worker* worker, BunString message, JSC::EncodedJSValue errorValue) { JSValue error = JSC::JSValue::decode(errorValue); ErrorEvent::Init init; diff --git a/src/bun.js/bindings/webcore/weak_handle.cpp b/src/bun.js/bindings/webcore/weak_handle.cpp index e210a5ba18660..bffe21c03307d 100644 --- a/src/bun.js/bindings/webcore/weak_handle.cpp +++ b/src/bun.js/bindings/webcore/weak_handle.cpp @@ -1,6 +1,6 @@ #include "weak_handle.h" -#include "JavaScriptCore/WeakHandleOwner.h" +#include namespace JSC { class SlotVisitor; @@ -10,12 +10,12 @@ template class Handle; // { // } -// bool WeakHandleOwner::isReachableFromOpaqueRoots(Handle, void*, AbstractSlotVisitor&, const char**) +// bool WeakHandleOwner::isReachableFromOpaqueRoots(Handle, void*, AbstractSlotVisitor&, const char**) // { // return false; // } -// void WeakHandleOwner::finalize(Handle, void*) +// void WeakHandleOwner::finalize(Handle, void*) // { // } } \ No newline at end of file diff --git a/src/bun.js/bindings/webcrypto/Bun_base64URLEncodeToString.h b/src/bun.js/bindings/webcrypto/Bun_base64URLEncodeToString.h new file mode 100644 index 0000000000000..f2ade5d77a07f --- /dev/null +++ b/src/bun.js/bindings/webcrypto/Bun_base64URLEncodeToString.h @@ -0,0 +1,15 @@ +#include "root.h" +#include "headers-handwritten.h" +#include "helpers.h" + +namespace Bun { +WTF::String toWTFString(const BunString& bunString); +} + +extern "C" void Zig__Bun_base64URLEncodeToString(const uint8_t* input_ptr, uint64_t len, BunString* ret); + +inline String Bun_base64URLEncodeToString(std::span input) { + BunString result; + Zig__Bun_base64URLEncodeToString(input.data(), input.size(), &result); + return Bun::toWTFString(result); +} diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyAES.cpp b/src/bun.js/bindings/webcrypto/CryptoKeyAES.cpp index ce23ce5dd0d85..a6c2532d9a5ff 100644 --- a/src/bun.js/bindings/webcrypto/CryptoKeyAES.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoKeyAES.cpp @@ -35,6 +35,7 @@ #include "JsonWebKey.h" #include #include +#include "Bun_base64URLEncodeToString.h" namespace WebCore { diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyECOpenSSL.cpp b/src/bun.js/bindings/webcrypto/CryptoKeyECOpenSSL.cpp index c2b363b32c1cd..b6766623cc845 100644 --- a/src/bun.js/bindings/webcrypto/CryptoKeyECOpenSSL.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoKeyECOpenSSL.cpp @@ -32,6 +32,7 @@ #include "JsonWebKey.h" #include "OpenSSLUtilities.h" #include +#include "Bun_base64URLEncodeToString.h" namespace WebCore { @@ -169,7 +170,7 @@ RefPtr CryptoKeyEC::platformImportJWKPublic(CryptoAlgorithmIdentifi auto group = EC_KEY_get0_group(key.get()); auto point = ECPointPtr(EC_POINT_new(group)); - // Currently we only support elliptic curves over GF(p). + // Currently we only support elliptic curves over GF(p). if (EC_POINT_set_affine_coordinates_GFp(group, point.get(), convertToBigNumber(x).get(), convertToBigNumber(y).get(), nullptr) <= 0) return nullptr; @@ -195,7 +196,7 @@ RefPtr CryptoKeyEC::platformImportJWKPrivate(CryptoAlgorithmIdentif auto group = EC_KEY_get0_group(key.get()); auto point = ECPointPtr(EC_POINT_new(group)); - // Currently we only support elliptic curves over GF(p). + // Currently we only support elliptic curves over GF(p). if (EC_POINT_set_affine_coordinates_GFp(group, point.get(), convertToBigNumber(x).get(), convertToBigNumber(y).get(), nullptr) <= 0) return nullptr; @@ -288,7 +289,7 @@ RefPtr CryptoKeyEC::platformImportSpki(CryptoAlgorithmIdentifier id value = sk_ASN1_TYPE_value(algorithm.get(), 0); if (value->type != V_ASN1_OBJECT) return nullptr; - + if (!supportedAlgorithmIdentifier(identifier, value->value.object)) return nullptr; @@ -298,7 +299,7 @@ RefPtr CryptoKeyEC::platformImportSpki(CryptoAlgorithmIdentifier id // -- specifiedCurve SpecifiedECDomain // } // - // Only "namedCurve" is supported. + // Only "namedCurve" is supported. value = sk_ASN1_TYPE_value(algorithm.get(), 1); if (value->type != V_ASN1_OBJECT) return nullptr; @@ -306,7 +307,7 @@ RefPtr CryptoKeyEC::platformImportSpki(CryptoAlgorithmIdentifier id int curveNID = OBJ_obj2nid(value->value.object); if (curveNID != curveIdentifier(curve)) return nullptr; - + // subjectPublicKey must be a BIT STRING. value = sk_ASN1_TYPE_value(subjectPublicKeyInfo.get(), 1); if (value->type != V_ASN1_BIT_STRING) @@ -380,17 +381,17 @@ Vector CryptoKeyEC::platformExportRaw() const { EC_KEY* key = EVP_PKEY_get0_EC_KEY(platformKey()); if (!key) - return { }; - + return {}; + const EC_POINT* point = EC_KEY_get0_public_key(key); const EC_GROUP* group = EC_KEY_get0_group(key); size_t keyDataSize = EC_POINT_point2oct(group, point, POINT_CONVERSION_UNCOMPRESSED, nullptr, 0, nullptr); if (!keyDataSize) - return { }; + return {}; Vector keyData(keyDataSize); if (EC_POINT_point2oct(group, point, POINT_CONVERSION_UNCOMPRESSED, keyData.data(), keyData.size(), nullptr) != keyDataSize) - return { }; + return {}; return keyData; } @@ -425,16 +426,16 @@ bool CryptoKeyEC::platformAddFieldElements(JsonWebKey& jwk) const Vector CryptoKeyEC::platformExportSpki() const { if (type() != CryptoKeyType::Public) - return { }; + return {}; int len = i2d_PUBKEY(platformKey(), nullptr); if (len < 0) - return { }; + return {}; Vector keyData(len); auto ptr = keyData.data(); if (i2d_PUBKEY(platformKey(), &ptr) < 0) - return { }; + return {}; return keyData; } @@ -442,20 +443,20 @@ Vector CryptoKeyEC::platformExportSpki() const Vector CryptoKeyEC::platformExportPkcs8() const { if (type() != CryptoKeyType::Private) - return { }; + return {}; auto p8inf = PKCS8PrivKeyInfoPtr(EVP_PKEY2PKCS8(platformKey())); if (!p8inf) - return { }; + return {}; int len = i2d_PKCS8_PRIV_KEY_INFO(p8inf.get(), nullptr); if (len < 0) - return { }; + return {}; Vector keyData(len); auto ptr = keyData.data(); if (i2d_PKCS8_PRIV_KEY_INFO(p8inf.get(), &ptr) < 0) - return { }; + return {}; return keyData; } diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyHMAC.cpp b/src/bun.js/bindings/webcrypto/CryptoKeyHMAC.cpp index 9428998cb9984..5ac4446d7ec73 100644 --- a/src/bun.js/bindings/webcrypto/CryptoKeyHMAC.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoKeyHMAC.cpp @@ -35,6 +35,7 @@ #include "JsonWebKey.h" #include #include +#include "Bun_base64URLEncodeToString.h" namespace WebCore { @@ -70,8 +71,8 @@ CryptoKeyHMAC::CryptoKeyHMAC(Vector&& key, CryptoAlgorithmIdentifier ha CryptoKeyHMAC::~CryptoKeyHMAC() = default; - -RefPtr CryptoKeyHMAC::generateFromBytes(void* data, size_t byteLength, CryptoAlgorithmIdentifier hash, bool extractable, CryptoKeyUsageBitmap usages) { +RefPtr CryptoKeyHMAC::generateFromBytes(void* data, size_t byteLength, CryptoAlgorithmIdentifier hash, bool extractable, CryptoKeyUsageBitmap usages) +{ Vector vec_data((uint8_t*)data, byteLength); return adoptRef(new CryptoKeyHMAC(vec_data, hash, extractable, usages)); @@ -126,10 +127,9 @@ RefPtr CryptoKeyHMAC::importJwk(size_t lengthBits, CryptoAlgorith return CryptoKeyHMAC::importRaw(lengthBits, hash, WTFMove(*octetSequence), extractable, usages); } - JsonWebKey CryptoKeyHMAC::exportJwk() const -{ - +{ + JsonWebKey result; result.kty = "oct"_s; result.k = Bun::base64URLEncodeToString(m_key); diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyOKPOpenSSL.cpp b/src/bun.js/bindings/webcrypto/CryptoKeyOKPOpenSSL.cpp index 82e352d0abb44..796ebb772b54e 100644 --- a/src/bun.js/bindings/webcrypto/CryptoKeyOKPOpenSSL.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoKeyOKPOpenSSL.cpp @@ -33,6 +33,7 @@ #include #include #include "CommonCryptoDERUtilities.h" +#include "Bun_base64URLEncodeToString.h" namespace WebCore { @@ -338,10 +339,13 @@ String CryptoKeyOKP::generateJwkX() const ASSERT(type() == CryptoKeyType::Private); if (namedCurve() == NamedCurve::Ed25519) - return Bun::base64URLEncodeToString(WTFMove(ed25519PublicFromPrivate(const_cast(m_data)))); + // TODO(@paperdave 2023-10-19): i removed WTFMove from ed25519PublicFromPrivate() as per MSVC compiler error. + // We need to evaluate if that is the proper fix here. + return Bun::base64URLEncodeToString(ed25519PublicFromPrivate(const_cast(m_data))); ASSERT(namedCurve() == NamedCurve::X25519); - return Bun::base64URLEncodeToString(WTFMove(x25519PublicFromPrivate(const_cast(m_data)))); + // TODO(@paperdave 2023-10-19): see above + return Bun::base64URLEncodeToString(x25519PublicFromPrivate(const_cast(m_data))); } CryptoKeyOKP::KeyMaterial CryptoKeyOKP::platformExportRaw() const @@ -349,9 +353,9 @@ CryptoKeyOKP::KeyMaterial CryptoKeyOKP::platformExportRaw() const if (namedCurve() == NamedCurve::Ed25519 && type() == CryptoKeyType::Private) { ASSERT(m_exportKey); const auto& exportKey = *m_exportKey; - return WTFMove(Vector(exportKey.data(), exportKey.size())); + return Vector(exportKey.data(), exportKey.size()); } - return WTFMove(KeyMaterial(m_data.data(), m_data.size())); + return KeyMaterial(m_data.data(), m_data.size()); } } // namespace WebCore diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyRSA.cpp b/src/bun.js/bindings/webcrypto/CryptoKeyRSA.cpp index 859767107a323..b15910af3d518 100644 --- a/src/bun.js/bindings/webcrypto/CryptoKeyRSA.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoKeyRSA.cpp @@ -30,6 +30,7 @@ #include "JsonWebKey.h" #include "../wtf-bindings.h" #include +#include "Bun_base64URLEncodeToString.h" #if ENABLE(WEB_CRYPTO) @@ -74,7 +75,7 @@ RefPtr CryptoKeyRSA::importJwk(CryptoAlgorithmIdentifier algorithm if (keyData.p.isNull() || keyData.q.isNull() || keyData.dp.isNull() || keyData.dq.isNull() || keyData.qi.isNull()) return nullptr; - + auto firstPrimeFactor = base64URLDecode(keyData.p); if (!firstPrimeFactor) return nullptr; @@ -94,14 +95,14 @@ RefPtr CryptoKeyRSA::importJwk(CryptoAlgorithmIdentifier algorithm CryptoKeyRSAComponents::PrimeInfo firstPrimeInfo; firstPrimeInfo.primeFactor = WTFMove(*firstPrimeFactor); firstPrimeInfo.factorCRTExponent = WTFMove(*firstFactorCRTExponent); - + CryptoKeyRSAComponents::PrimeInfo secondPrimeInfo; secondPrimeInfo.primeFactor = WTFMove(*secondPrimeFactor); secondPrimeInfo.factorCRTExponent = WTFMove(*secondFactorCRTExponent); secondPrimeInfo.factorCRTCoefficient = WTFMove(*secondFactorCRTCoefficient); if (!keyData.oth) { - auto privateKeyComponents = CryptoKeyRSAComponents::createPrivateWithAdditionalData(WTFMove(*modulus), WTFMove(*exponent), WTFMove(*privateExponent), WTFMove(firstPrimeInfo), WTFMove(secondPrimeInfo), { }); + auto privateKeyComponents = CryptoKeyRSAComponents::createPrivateWithAdditionalData(WTFMove(*modulus), WTFMove(*exponent), WTFMove(*privateExponent), WTFMove(firstPrimeInfo), WTFMove(secondPrimeInfo), {}); // Notice: CryptoAlgorithmIdentifier::SHA_1 is just a placeholder. It should not have any effect if hash is std::nullopt. return CryptoKeyRSA::create(algorithm, hash.value_or(CryptoAlgorithmIdentifier::SHA_1), !!hash, *privateKeyComponents, extractable, usages); } diff --git a/src/bun.js/bindings/webcrypto/JSCryptoKey.cpp b/src/bun.js/bindings/webcrypto/JSCryptoKey.cpp index 5b38d78c9b127..1218efaa4ceab 100644 --- a/src/bun.js/bindings/webcrypto/JSCryptoKey.cpp +++ b/src/bun.js/bindings/webcrypto/JSCryptoKey.cpp @@ -219,7 +219,7 @@ void JSCryptoKey::destroy(JSC::JSCell* cell) thisObject->JSCryptoKey::~JSCryptoKey(); } -JSC_DEFINE_CUSTOM_GETTER(jsCryptoKeyConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsCryptoKeyConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -237,7 +237,7 @@ static inline JSValue jsCryptoKey_typeGetter(JSGlobalObject& lexicalGlobalObject RELEASE_AND_RETURN(throwScope, (toJS>(lexicalGlobalObject, throwScope, impl.type()))); } -JSC_DEFINE_CUSTOM_GETTER(jsCryptoKey_type, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsCryptoKey_type, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -250,7 +250,7 @@ static inline JSValue jsCryptoKey_extractableGetter(JSGlobalObject& lexicalGloba RELEASE_AND_RETURN(throwScope, (toJS(lexicalGlobalObject, throwScope, impl.extractable()))); } -JSC_DEFINE_CUSTOM_GETTER(jsCryptoKey_extractable, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsCryptoKey_extractable, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -268,7 +268,7 @@ static inline JSValue jsCryptoKey_algorithmGetter(JSGlobalObject& lexicalGlobalO return result; } -JSC_DEFINE_CUSTOM_GETTER(jsCryptoKey_algorithm, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsCryptoKey_algorithm, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } @@ -286,7 +286,7 @@ static inline JSValue jsCryptoKey_usagesGetter(JSGlobalObject& lexicalGlobalObje return result; } -JSC_DEFINE_CUSTOM_GETTER(jsCryptoKey_usages, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsCryptoKey_usages, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } diff --git a/src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp b/src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp index 04ac271c96947..790c3577f441e 100644 --- a/src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp +++ b/src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp @@ -244,7 +244,7 @@ void JSSubtleCrypto::destroy(JSC::JSCell* cell) thisObject->JSSubtleCrypto::~JSSubtleCrypto(); } -JSC_DEFINE_CUSTOM_GETTER(jsSubtleCryptoConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsSubtleCryptoConstructor, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -515,7 +515,9 @@ static inline JSC::EncodedJSValue jsSubtleCryptoPrototypeFunction_exportKeyBody( EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); auto key = convert>(*lexicalGlobalObject, argument1.value(), [](JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope) { throwArgumentTypeError(lexicalGlobalObject, scope, 1, "key", "SubtleCrypto", "exportKey", "CryptoKey"); }); RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { return impl.exportKey(WTFMove(format), *key, WTFMove(promise)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { + return impl.exportKey(WTFMove(format), *key, WTFMove(promise)); + }))); } JSC_DEFINE_HOST_FUNCTION(jsSubtleCryptoPrototypeFunction_exportKey, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) diff --git a/src/bun.js/bindings/windows/musl-memmem.c b/src/bun.js/bindings/windows/musl-memmem.c new file mode 100644 index 0000000000000..115b99c91e003 --- /dev/null +++ b/src/bun.js/bindings/windows/musl-memmem.c @@ -0,0 +1,367 @@ +// musl as a whole is licensed under the following standard MIT license: +// +// ---------------------------------------------------------------------- +// Copyright © 2005-2020 Rich Felker, et al. +// +// 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. +// ---------------------------------------------------------------------- +// +// Authors/contributors include: +// +// A. Wilcox +// Ada Worcester +// Alex Dowad +// Alex Suykov +// Alexander Monakov +// Andre McCurdy +// Andrew Kelley +// Anthony G. Basile +// Aric Belsito +// Arvid Picciani +// Bartosz Brachaczek +// Benjamin Peterson +// Bobby Bingham +// Boris Brezillon +// Brent Cook +// Chris Spiegel +// Clément Vasseur +// Daniel Micay +// Daniel Sabogal +// Daurnimator +// David Carlier +// David Edelsohn +// Denys Vlasenko +// Dmitry Ivanov +// Dmitry V. Levin +// Drew DeVault +// Emil Renner Berthing +// Fangrui Song +// Felix Fietkau +// Felix Janda +// Gianluca Anzolin +// Hauke Mehrtens +// He X +// Hiltjo Posthuma +// Isaac Dunham +// Jaydeep Patil +// Jens Gustedt +// Jeremy Huntwork +// Jo-Philipp Wich +// Joakim Sindholt +// John Spencer +// Julien Ramseier +// Justin Cormack +// Kaarle Ritvanen +// Khem Raj +// Kylie McClain +// Leah Neukirchen +// Luca Barbato +// Luka Perkov +// M Farkas-Dyck (Strake) +// Mahesh Bodapati +// Markus Wichmann +// Masanori Ogino +// Michael Clark +// Michael Forney +// Mikhail Kremnyov +// Natanael Copa +// Nicholas J. Kain +// orc +// Pascal Cuoq +// Patrick Oppenlander +// Petr Hosek +// Petr Skocik +// Pierre Carrier +// Reini Urban +// Rich Felker +// Richard Pennington +// Ryan Fairfax +// Samuel Holland +// Segev Finer +// Shiz +// sin +// Solar Designer +// Stefan Kristiansson +// Stefan O'Rear +// Szabolcs Nagy +// Timo Teräs +// Trutz Behn +// Valentin Ochs +// Will Dietz +// William Haddon +// William Pitcock +// +// Portions of this software are derived from third-party works licensed +// under terms compatible with the above MIT license: +// +// The TRE regular expression implementation (src/regex/reg* and +// src/regex/tre*) is Copyright © 2001-2008 Ville Laurikari and licensed +// under a 2-clause BSD license (license text in the source files). The +// included version has been heavily modified by Rich Felker in 2012, in +// the interests of size, simplicity, and namespace cleanliness. +// +// Much of the math library code (src/math/* and src/complex/*) is +// Copyright © 1993,2004 Sun Microsystems or +// Copyright © 2003-2011 David Schultz or +// Copyright © 2003-2009 Steven G. Kargl or +// Copyright © 2003-2009 Bruce D. Evans or +// Copyright © 2008 Stephen L. Moshier or +// Copyright © 2017-2018 Arm Limited +// and labelled as such in comments in the individual source files. All +// have been licensed under extremely permissive terms. +// +// The ARM memcpy code (src/string/arm/memcpy.S) is Copyright © 2008 +// The Android Open Source Project and is licensed under a two-clause BSD +// license. It was taken from Bionic libc, used on Android. +// +// The AArch64 memcpy and memset code (src/string/aarch64/*) are +// Copyright © 1999-2019, Arm Limited. +// +// The implementation of DES for crypt (src/crypt/crypt_des.c) is +// Copyright © 1994 David Burren. It is licensed under a BSD license. +// +// The implementation of blowfish crypt (src/crypt/crypt_blowfish.c) was +// originally written by Solar Designer and placed into the public +// domain. The code also comes with a fallback permissive license for use +// in jurisdictions that may not recognize the public domain. +// +// The smoothsort implementation (src/stdlib/qsort.c) is Copyright © 2011 +// Valentin Ochs and is licensed under an MIT-style license. +// +// The x86_64 port was written by Nicholas J. Kain and is licensed under +// the standard MIT terms. +// +// The mips and microblaze ports were originally written by Richard +// Pennington for use in the ellcc project. The original code was adapted +// by Rich Felker for build system and code conventions during upstream +// integration. It is licensed under the standard MIT terms. +// +// The mips64 port was contributed by Imagination Technologies and is +// licensed under the standard MIT terms. +// +// The powerpc port was also originally written by Richard Pennington, +// and later supplemented and integrated by John Spencer. It is licensed +// under the standard MIT terms. +// +// All other files which have no copyright comments are original works +// produced specifically for use as part of this library, written either +// by Rich Felker, the main author of the library, or by one or more +// contibutors listed above. Details on authorship of individual files +// can be found in the git version control history of the project. The +// omission of copyright and license comments in each file is in the +// interest of source tree size. +// +// In addition, permission is hereby granted for all public header files +// (include/* and arch/*/bits/*) and crt files intended to be linked into +// applications (crt/*, ldso/dlstart.c, and arch/*/crt_arch.h) to omit +// the copyright notice and permission notice otherwise required by the +// license, and to use these files without any requirement of +// attribution. These files include substantial contributions from: +// +// Bobby Bingham +// John Spencer +// Nicholas J. Kain +// Rich Felker +// Richard Pennington +// Stefan Kristiansson +// Szabolcs Nagy +// +// all of whom have explicitly granted such permission. +// +// This file previously contained text expressing a belief that most of +// the files covered by the above exception were sufficiently trivial not +// to be subject to copyright, resulting in confusion over whether it +// negated the permissions granted in the license. In the spirit of +// permissive licensing, and of not having licensing issues being an +// obstacle to adoption, that text has been removed. +#ifdef WIN32 +#include +#include + +static char* twobyte_memmem(const unsigned char* h, size_t k, const unsigned char* n) +{ + uint16_t nw = n[0] << 8 | n[1], hw = h[0] << 8 | h[1]; + for (h += 2, k -= 2; k; k--, hw = hw << 8 | *h++) + if (hw == nw) + return (char*)h - 2; + return hw == nw ? (char*)h - 2 : 0; +} + +static char* threebyte_memmem(const unsigned char* h, size_t k, const unsigned char* n) +{ + uint32_t nw = (uint32_t)n[0] << 24 | n[1] << 16 | n[2] << 8; + uint32_t hw = (uint32_t)h[0] << 24 | h[1] << 16 | h[2] << 8; + for (h += 3, k -= 3; k; k--, hw = (hw | *h++) << 8) + if (hw == nw) + return (char*)h - 3; + return hw == nw ? (char*)h - 3 : 0; +} + +static char* fourbyte_memmem(const unsigned char* h, size_t k, const unsigned char* n) +{ + uint32_t nw = (uint32_t)n[0] << 24 | n[1] << 16 | n[2] << 8 | n[3]; + uint32_t hw = (uint32_t)h[0] << 24 | h[1] << 16 | h[2] << 8 | h[3]; + for (h += 4, k -= 4; k; k--, hw = hw << 8 | *h++) + if (hw == nw) + return (char*)h - 4; + return hw == nw ? (char*)h - 4 : 0; +} + +#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#define MIN(a, b) ((a) < (b) ? (a) : (b)) + +#define BITOP(a, b, op) \ + ((a)[(size_t)(b) / (8 * sizeof *(a))] op(size_t) 1 << ((size_t)(b) % (8 * sizeof *(a)))) + +static char* twoway_memmem(const unsigned char* h, const unsigned char* z, const unsigned char* n, size_t l) +{ + size_t i, ip, jp, k, p, ms, p0, mem, mem0; + size_t byteset[32 / sizeof(size_t)] = { 0 }; + size_t shift[256]; + + /* Computing length of needle and fill shift table */ + for (i = 0; i < l; i++) + BITOP(byteset, n[i], |=), shift[n[i]] = i + 1; + + /* Compute maximal suffix */ + ip = -1; + jp = 0; + k = p = 1; + while (jp + k < l) { + if (n[ip + k] == n[jp + k]) { + if (k == p) { + jp += p; + k = 1; + } else + k++; + } else if (n[ip + k] > n[jp + k]) { + jp += k; + k = 1; + p = jp - ip; + } else { + ip = jp++; + k = p = 1; + } + } + ms = ip; + p0 = p; + + /* And with the opposite comparison */ + ip = -1; + jp = 0; + k = p = 1; + while (jp + k < l) { + if (n[ip + k] == n[jp + k]) { + if (k == p) { + jp += p; + k = 1; + } else + k++; + } else if (n[ip + k] < n[jp + k]) { + jp += k; + k = 1; + p = jp - ip; + } else { + ip = jp++; + k = p = 1; + } + } + if (ip + 1 > ms + 1) + ms = ip; + else + p = p0; + + /* Periodic needle? */ + if (memcmp(n, n + p, ms + 1)) { + mem0 = 0; + p = MAX(ms, l - ms - 1) + 1; + } else + mem0 = l - p; + mem = 0; + + /* Search loop */ + for (;;) { + /* If remainder of haystack is shorter than needle, done */ + if (z - h < l) + return 0; + + /* Check last byte first; advance by shift on mismatch */ + if (BITOP(byteset, h[l - 1], &)) { + k = l - shift[h[l - 1]]; + if (k) { + if (k < mem) + k = mem; + h += k; + mem = 0; + continue; + } + } else { + h += l; + mem = 0; + continue; + } + + /* Compare right half */ + for (k = MAX(ms + 1, mem); k < l && n[k] == h[k]; k++) + ; + if (k < l) { + h += k - ms; + mem = 0; + continue; + } + /* Compare left half */ + for (k = ms + 1; k > mem && n[k - 1] == h[k - 1]; k--) + ; + if (k <= mem) + return (char*)h; + h += p; + mem = mem0; + } +} + +extern void* memmem(const void* h0, size_t k, const void* n0, size_t l) +{ + const unsigned char *h = h0, *n = n0; + + /* Return immediately on empty needle */ + if (!l) + return (void*)h; + + /* Return immediately when needle is longer than haystack */ + if (k < l) + return 0; + + /* Use faster algorithms for short needles */ + h = memchr(h0, *n, k); + if (!h || l == 1) + return (void*)h; + k -= h - (const unsigned char*)h0; + if (k < l) + return 0; + if (l == 2) + return twobyte_memmem(h, k, n); + if (l == 3) + return threebyte_memmem(h, k, n); + if (l == 4) + return fourbyte_memmem(h, k, n); + + return twoway_memmem(h, h + k, n, l); +} +#endif \ No newline at end of file diff --git a/src/bun.js/bindings/windows/musl-memmem.h b/src/bun.js/bindings/windows/musl-memmem.h new file mode 100644 index 0000000000000..c036e9e934c05 --- /dev/null +++ b/src/bun.js/bindings/windows/musl-memmem.h @@ -0,0 +1 @@ +extern "C" void *memmem(const void *h0, size_t k, const void *n0, size_t l); \ No newline at end of file diff --git a/src/bun.js/bindings/workaround-missing-symbols.cpp b/src/bun.js/bindings/workaround-missing-symbols.cpp index 81a944a56736b..68ea6d9f3881a 100644 --- a/src/bun.js/bindings/workaround-missing-symbols.cpp +++ b/src/bun.js/bindings/workaround-missing-symbols.cpp @@ -1,6 +1,98 @@ + +#if defined(WIN32) + + +#include +#include +#include +#include +#include +#include +#include +#include + +#undef _environ +#undef environ + +// Some libraries need these symbols. Windows makes it +extern "C" char** environ = nullptr; +extern "C" char** _environ = nullptr; + +extern "C" int strncasecmp(const char* s1, const char* s2, size_t n) +{ + return _strnicmp(s1, s2, n); +} + +extern "C" int fstat64( + _In_ int _FileHandle, + _Out_ struct _stat64* _Stat) +{ + + return _fstat64(_FileHandle, _Stat); +} + +extern "C" int stat64( + _In_z_ char const* _FileName, + _Out_ struct _stat64* _Stat) +{ + return _stat64(_FileName, _Stat); +} + +extern "C" int kill(int pid, int sig) +{ + return uv_kill(pid, sig); +} + +extern "C" int readlink(const char* path, char* buf, size_t bufsize) +{ + uv_fs_t req; + req.result = 0; + + int len = uv_fs_readlink(uv_default_loop(), &req, path, nullptr); + if (req.result < 0) { + uv_fs_req_cleanup(&req); + return req.result; + } + + if (bufsize > req.result) + bufsize = req.result; + + size_t outlen = std::min(static_cast(len), bufsize); + memcpy(buf, req.ptr, outlen); + uv_fs_req_cleanup(&req); + + return outlen; +} + +extern "C" int link(const char* oldpath, const char* newpath) +{ + uv_fs_t req; + int status_code = uv_fs_link(uv_default_loop(), &req, oldpath, newpath, nullptr); + uv_fs_req_cleanup(&req); + return status_code; +} + +extern "C" char* mkdtemp(char* template_name) +{ + uv_fs_t req; + int status_code = uv_fs_mkdtemp(uv_default_loop(), &req, template_name, nullptr); + + if (status_code < 0) + return nullptr; + size_t outlen = std::min(strlen(req.path), strlen(template_name)); + memcpy(template_name, req.path, outlen); + template_name[outlen] = '\0'; + uv_fs_req_cleanup(&req); + return template_name; +} + +#endif + +#if !defined(WIN32) #ifndef UNLIKELY #define UNLIKELY(x) __builtin_expect(!!(x), 0) #endif +#endif // if linux #if defined(__linux__) diff --git a/src/bun.js/bindings/wtf-bindings.cpp b/src/bun.js/bindings/wtf-bindings.cpp index 2ec3d7ee8d7b5..55e71867905d3 100644 --- a/src/bun.js/bindings/wtf-bindings.cpp +++ b/src/bun.js/bindings/wtf-bindings.cpp @@ -1,20 +1,18 @@ +#include "root.h" #include "wtf-bindings.h" -#include "wtf/StackTrace.h" -#include "wtf/dtoa.h" -#include -#include +#include +#include +#include -extern "C" double WTF__parseDouble(const LChar* string, size_t length, size_t* position) -{ - return WTF::parseDouble(string, length, *position); -} +#if OS(WINDOWS) +#include +#endif -extern "C" void WTF__copyLCharsFromUCharSource(LChar* destination, const UChar* source, size_t length) -{ - WTF::StringImpl::copyCharacters(destination, source, length); -} +#if !OS(WINDOWS) +#include +#include static int orig_termios_fd = -1; static struct termios orig_termios; static _Atomic int orig_termios_spinlock; @@ -94,9 +92,11 @@ static void uv__tty_make_raw(struct termios* tio) #endif /* #ifdef __sun */ } -extern "C" int -Bun__ttySetMode(int fd, int mode) +#endif + +extern "C" int Bun__ttySetMode(int fd, int mode) { +#if !OS(WINDOWS) struct termios tmp; int expected; int rc; @@ -160,6 +160,20 @@ Bun__ttySetMode(int fd, int mode) current_tty_mode = mode; return rc; +#else + return 0; + +#endif +} + +extern "C" double WTF__parseDouble(const LChar* string, size_t length, size_t* position) +{ + return WTF::parseDouble(string, length, *position); +} + +extern "C" void WTF__copyLCharsFromUCharSource(LChar* destination, const UChar* source, size_t length) +{ + WTF::StringImpl::copyCharacters(destination, source, length); } extern "C" void Bun__crashReportWrite(void* ctx, const char* message, size_t length); diff --git a/src/bun.js/bindings/wtf-bindings.h b/src/bun.js/bindings/wtf-bindings.h index 3df543934ad14..0a1546472194b 100644 --- a/src/bun.js/bindings/wtf-bindings.h +++ b/src/bun.js/bindings/wtf-bindings.h @@ -1,7 +1,7 @@ #pragma once #include "root.h" -#include "wtf/text/ASCIIFastPath.h" +#include extern "C" void WTF__copyLCharsFromUCharSource(LChar* destination, const UChar* source, size_t length); diff --git a/src/bun.js/event_loop.zig b/src/bun.js/event_loop.zig index f73447fe58721..f6a32bd406c6d 100644 --- a/src/bun.js/event_loop.zig +++ b/src/bun.js/event_loop.zig @@ -3,7 +3,6 @@ const JSC = @import("root").bun.JSC; const JSGlobalObject = JSC.JSGlobalObject; const VirtualMachine = JSC.VirtualMachine; const Lock = @import("../lock.zig").Lock; -const Microtask = JSC.Microtask; const bun = @import("root").bun; const Environment = bun.Environment; const Fetch = JSC.WebCore.Fetch; @@ -23,6 +22,7 @@ pub const WorkPool = @import("../work_pool.zig").WorkPool; pub const WorkPoolTask = @import("../work_pool.zig").Task; const NetworkThread = @import("root").bun.HTTP.NetworkThread; const uws = @import("root").bun.uws; +const Async = bun.Async; pub fn ConcurrentPromiseTask(comptime Context: type) type { return struct { @@ -36,7 +36,7 @@ pub fn ConcurrentPromiseTask(comptime Context: type) type { concurrent_task: JSC.ConcurrentTask = .{}, // This is a poll because we want it to enter the uSockets loop - ref: JSC.PollRef = .{}, + ref: Async.KeepAlive = .{}, pub fn createOnJSThread(allocator: std.mem.Allocator, globalThis: *JSGlobalObject, value: *Context) !*This { var this = try allocator.create(This); @@ -100,7 +100,7 @@ pub fn WorkTask(comptime Context: type, comptime async_io: bool) type { async_task_tracker: JSC.AsyncTaskTracker, // This is a poll because we want it to enter the uSockets loop - ref: JSC.PollRef = .{}, + ref: Async.KeepAlive = .{}, pub fn createOnJSThread(allocator: std.mem.Allocator, globalThis: *JSGlobalObject, value: *Context) !*This { var this = try allocator.create(This); @@ -297,7 +297,6 @@ pub const JSCScheduler = struct { }; const ThreadSafeFunction = JSC.napi.ThreadSafeFunction; -const MicrotaskForDefaultGlobalObject = JSC.MicrotaskForDefaultGlobalObject; const HotReloadTask = JSC.HotReloader.HotReloadTask; const FSWatchTask = JSC.Node.FSWatcher.FSWatchTask; const PollPendingModulesTask = JSC.ModuleLoader.AsyncModule.Queue; @@ -348,8 +347,6 @@ const WaitPidResultTask = JSC.Subprocess.WaiterThread.WaitPidResultTask; // Task.get(ReadFileTask) -> ?ReadFileTask pub const Task = TaggedPointerUnion(.{ FetchTasklet, - Microtask, - MicrotaskForDefaultGlobalObject, AsyncTransformTask, ReadFileTask, CopyFilePromiseTask, @@ -465,7 +462,7 @@ pub const GarbageCollectionController = struct { disabled: bool = false, pub fn init(this: *GarbageCollectionController, vm: *VirtualMachine) void { - var actual = vm.event_loop_handle.?; + var actual = uws.Loop.get(); this.gc_timer = uws.Timer.createFallthrough(actual, this); this.gc_repeating_timer = uws.Timer.createFallthrough(actual, this); @@ -607,6 +604,7 @@ comptime { } pub const DeferredRepeatingTask = *const (fn (*anyopaque) bool); +const Waker = AsyncIO.Waker; pub const EventLoop = struct { tasks: if (JSC.is_bindgen) void else Queue = undefined, @@ -625,20 +623,21 @@ pub const EventLoop = struct { concurrent_tasks: ConcurrentTask.Queue = ConcurrentTask.Queue{}, global: *JSGlobalObject = undefined, virtual_machine: *JSC.VirtualMachine = undefined, - waker: ?AsyncIO.Waker = null, + waker: ?Waker = null, start_server_on_next_tick: bool = false, defer_count: std.atomic.Atomic(usize) = std.atomic.Atomic(usize).init(0), forever_timer: ?*uws.Timer = null, deferred_microtask_map: std.AutoArrayHashMapUnmanaged(?*anyopaque, DeferredRepeatingTask) = .{}, - + uws_loop: if (Environment.isWindows) *uws.Loop else void = undefined, pub const Queue = std.fifo.LinearFifo(Task, .Dynamic); const log = bun.Output.scoped(.EventLoop, false); pub fn tickWhilePaused(this: *EventLoop, done: *bool) void { while (!done.*) { - this.virtual_machine.event_loop_handle.?.tick(this.virtual_machine.jsc); + this.virtual_machine.event_loop_handle.?.tick(); } } + extern fn JSC__JSGlobalObject__drainMicrotasks(*JSC.JSGlobalObject) void; fn drainMicrotasksWithGlobal(this: *EventLoop, globalObject: *JSC.JSGlobalObject) void { JSC.markBinding(@src()); @@ -650,12 +649,6 @@ pub const EventLoop = struct { this.drainMicrotasksWithGlobal(this.global); } - pub fn ensureAliveForOneTick(this: *EventLoop) void { - if (this.noop_task.scheduled) return; - this.enqueueTask(Task.init(&this.noop_task)); - this.noop_task.scheduled = true; - } - pub fn registerDeferredTask(this: *EventLoop, ctx: ?*anyopaque, task: DeferredRepeatingTask) bool { const existing = this.deferred_microtask_map.getOrPutValue(this.virtual_machine.allocator, ctx, task) catch unreachable; return existing.found_existing; @@ -691,14 +684,6 @@ pub const EventLoop = struct { while (@field(this, queue_name).readItem()) |task| { defer counter += 1; switch (task.tag()) { - .Microtask => { - var micro: *Microtask = task.as(Microtask); - micro.run(global); - }, - .MicrotaskForDefaultGlobalObject => { - var micro: *MicrotaskForDefaultGlobalObject = task.as(MicrotaskForDefaultGlobalObject); - micro.run(global); - }, .FetchTasklet => { var fetch_task: *Fetch.FetchTasklet = task.get(Fetch.FetchTasklet).?; fetch_task.onProgressUpdate(); @@ -998,58 +983,73 @@ pub const EventLoop = struct { return this.tasks.count - start_count; } + inline fn usocketsLoop(this: *const EventLoop) *uws.Loop { + if (comptime Environment.isWindows) { + return this.uws_loop; + } + + return this.virtual_machine.event_loop_handle.?; + } + pub fn autoTick(this: *EventLoop) void { var ctx = this.virtual_machine; - var loop = ctx.event_loop_handle.?; + var loop = this.usocketsLoop(); this.flushImmediateQueue(); this.tickImmediateTasks(); - // Some tasks need to keep the event loop alive for one more tick. - // We want to keep the event loop alive long enough to process those ticks and any microtasks - // - // BUT. We don't actually have an idle event in that case. - // That means the process will be waiting forever on nothing. - // So we need to drain the counter immediately before entering uSockets loop - const pending_unref = ctx.pending_unref_counter; - if (pending_unref > 0) { - ctx.pending_unref_counter = 0; - loop.unrefCount(pending_unref); + if (comptime Environment.isPosix) { + // Some tasks need to keep the event loop alive for one more tick. + // We want to keep the event loop alive long enough to process those ticks and any microtasks + // + // BUT. We don't actually have an idle event in that case. + // That means the process will be waiting forever on nothing. + // So we need to drain the counter immediately before entering uSockets loop + const pending_unref = ctx.pending_unref_counter; + if (pending_unref > 0) { + ctx.pending_unref_counter = 0; + loop.unrefCount(pending_unref); + } } - if (loop.num_polls > 0 or loop.active > 0) { + if (loop.isActive()) { this.processGCTimer(); - loop.tick(ctx.jsc); - + loop.tick(); + this.flushImmediateQueue(); ctx.onAfterEventLoop(); - // this.afterUSocketsTick(); + } else { + this.flushImmediateQueue(); } } pub fn autoTickWithTimeout(this: *EventLoop, timeoutMs: i64) void { var ctx = this.virtual_machine; - var loop = ctx.event_loop_handle.?; + var loop = this.usocketsLoop(); this.flushImmediateQueue(); this.tickImmediateTasks(); - // Some tasks need to keep the event loop alive for one more tick. - // We want to keep the event loop alive long enough to process those ticks and any microtasks - // - // BUT. We don't actually have an idle event in that case. - // That means the process will be waiting forever on nothing. - // So we need to drain the counter immediately before entering uSockets loop - const pending_unref = ctx.pending_unref_counter; - if (pending_unref > 0) { - ctx.pending_unref_counter = 0; - loop.unrefCount(pending_unref); + if (comptime Environment.isPosix) { + // Some tasks need to keep the event loop alive for one more tick. + // We want to keep the event loop alive long enough to process those ticks and any microtasks + // + // BUT. We don't actually have an idle event in that case. + // That means the process will be waiting forever on nothing. + // So we need to drain the counter immediately before entering uSockets loop + const pending_unref = ctx.pending_unref_counter; + if (pending_unref > 0) { + ctx.pending_unref_counter = 0; + loop.unrefCount(pending_unref); + } } - if (loop.num_polls > 0 or loop.active > 0) { + if (loop.isActive()) { this.processGCTimer(); - loop.tickWithTimeout(timeoutMs, ctx.jsc); + loop.tickWithTimeout(timeoutMs); + this.flushImmediateQueue(); ctx.onAfterEventLoop(); - // this.afterUSocketsTick(); + } else { + this.flushImmediateQueue(); } } @@ -1069,27 +1069,30 @@ pub const EventLoop = struct { pub fn tickPossiblyForever(this: *EventLoop) void { var ctx = this.virtual_machine; - var loop = ctx.event_loop_handle.?; + var loop = this.usocketsLoop(); - this.flushImmediateQueue(); - this.tickImmediateTasks(); - - const pending_unref = ctx.pending_unref_counter; - if (pending_unref > 0) { - ctx.pending_unref_counter = 0; - loop.unrefCount(pending_unref); + if (comptime Environment.isPosix) { + const pending_unref = ctx.pending_unref_counter; + if (pending_unref > 0) { + ctx.pending_unref_counter = 0; + loop.unrefCount(pending_unref); + } } - if (loop.num_polls == 0 or loop.active == 0) { - if (this.forever_timer == null) { - var t = uws.Timer.create(loop, this); - t.set(this, &noopForeverTimer, 1000 * 60 * 4, 1000 * 60 * 4); - this.forever_timer = t; + if (!loop.isActive()) { + if (comptime Environment.isWindows) { + bun.todo(@src(), {}); + } else { + if (this.forever_timer == null) { + var t = uws.Timer.create(loop, this); + t.set(this, &noopForeverTimer, 1000 * 60 * 4, 1000 * 60 * 4); + this.forever_timer = t; + } } } this.processGCTimer(); - loop.tick(ctx.jsc); + loop.tick(); ctx.onAfterEventLoop(); this.tickConcurrent(); @@ -1101,25 +1104,27 @@ pub const EventLoop = struct { } pub fn autoTickActive(this: *EventLoop) void { - var loop = this.virtual_machine.event_loop_handle.?; + var loop = this.usocketsLoop(); this.flushImmediateQueue(); this.tickImmediateTasks(); var ctx = this.virtual_machine; - - const pending_unref = ctx.pending_unref_counter; - if (pending_unref > 0) { - ctx.pending_unref_counter = 0; - loop.unrefCount(pending_unref); + if (comptime Environment.isPosix) { + const pending_unref = ctx.pending_unref_counter; + if (pending_unref > 0) { + ctx.pending_unref_counter = 0; + loop.unrefCount(pending_unref); + } } - if (loop.active > 0) { + if (loop.isActive()) { this.processGCTimer(); - loop.tick(ctx.jsc); + loop.tick(); this.flushImmediateQueue(); ctx.onAfterEventLoop(); - // this.afterUSocketsTick(); + } else { + this.flushImmediateQueue(); } } @@ -1134,8 +1139,8 @@ pub const EventLoop = struct { this.tickConcurrent(); this.processGCTimer(); - var global = ctx.global; - var global_vm = ctx.jsc; + const global = ctx.global; + const global_vm = ctx.jsc; while (true) { while (this.tickWithCount() > 0) : (this.global.handleRejectedPromises()) { @@ -1209,6 +1214,11 @@ pub const EventLoop = struct { } pub fn enqueueTaskWithTimeout(this: *EventLoop, task: Task, timeout: i32) void { + if (comptime Environment.isWindows) { + bun.todo(@src(), {}); + return; + } + // TODO: make this more efficient! var loop = this.virtual_machine.event_loop_handle orelse @panic("EventLoop.enqueueTaskWithTimeout: uSockets event loop is not initialized"); var timer = uws.Timer.createFallthrough(loop, task.ptr()); @@ -1225,8 +1235,14 @@ pub const EventLoop = struct { pub fn ensureWaker(this: *EventLoop) void { JSC.markBinding(@src()); if (this.virtual_machine.event_loop_handle == null) { - var actual = uws.Loop.get().?; - this.virtual_machine.event_loop_handle = actual; + // Ensure the uWS loop is created first on windows + if (comptime Environment.isWindows) { + this.uws_loop = bun.uws.Loop.get(); + this.virtual_machine.event_loop_handle = bun.Async.Loop.get(); + } else { + this.virtual_machine.event_loop_handle = bun.Async.Loop.get(); + } + this.virtual_machine.gc_controller.init(this.virtual_machine); // _ = actual.addPostHandler(*JSC.EventLoop, this, JSC.EventLoop.afterUSocketsTick); // _ = actual.addPreHandler(*JSC.VM, this.virtual_machine.jsc, JSC.VM.drainMicrotasks); @@ -1239,6 +1255,11 @@ pub const EventLoop = struct { } pub fn wakeup(this: *EventLoop) void { + if (comptime Environment.isWindows) { + this.uws_loop.wakeup(); + return; + } + if (this.virtual_machine.event_loop_handle) |loop| { loop.wakeup(); } @@ -1267,7 +1288,7 @@ pub const MiniEventLoop = struct { return .{ .tasks = Queue.init(allocator), .allocator = allocator, - .loop = uws.Loop.get().?, + .loop = uws.Loop.get(), }; } @@ -1307,9 +1328,9 @@ pub const MiniEventLoop = struct { ) void { while (!isDone(context)) { if (this.tickConcurrentWithCount() == 0 and this.tasks.count == 0) { - this.loop.num_polls += 1; - this.loop.tick(null); - this.loop.num_polls -= 1; + this.loop.inc(); + this.loop.tick(); + this.loop.dec(); } while (this.tasks.readItem()) |task| { diff --git a/src/bun.js/headergen/sizegen.cpp b/src/bun.js/headergen/sizegen.cpp index 49b64e0e9b08b..83754cbb2e470 100644 --- a/src/bun.js/headergen/sizegen.cpp +++ b/src/bun.js/headergen/sizegen.cpp @@ -13,8 +13,8 @@ using namespace std; #include "headers-cpp.h" -#include "JavaScriptCore/CallFrame.h" -#include "JavaScriptCore/JSArrayBufferViewInlines.h" +#include +#include int main() { time_t rawtime; diff --git a/src/bun.js/javascript.zig b/src/bun.js/javascript.zig index 4ee87b21bb9f2..5bf37152b8654 100644 --- a/src/bun.js/javascript.zig +++ b/src/bun.js/javascript.zig @@ -58,7 +58,7 @@ const MarkedArrayBuffer = @import("./base.zig").MarkedArrayBuffer; const getAllocator = @import("./base.zig").getAllocator; const JSValue = @import("root").bun.JSC.JSValue; const NewClass = @import("./base.zig").NewClass; -const Microtask = @import("root").bun.JSC.Microtask; + const JSGlobalObject = @import("root").bun.JSC.JSGlobalObject; const ExceptionValueRef = @import("root").bun.JSC.ExceptionValueRef; const JSPrivateDataPtr = @import("root").bun.JSC.JSPrivateDataPtr; @@ -96,6 +96,7 @@ pub const Buffer = MarkedArrayBuffer; const Lock = @import("../lock.zig").Lock; const BuildMessage = JSC.BuildMessage; const ResolveMessage = JSC.ResolveMessage; +const Async = bun.Async; pub const OpaqueCallback = *const fn (current: ?*anyopaque) callconv(.C) void; pub fn OpaqueWrap(comptime Context: type, comptime Function: fn (this: *Context) void) OpaqueCallback { @@ -463,6 +464,8 @@ pub const ImportWatcher = union(enum) { } }; +const PlatformEventLoop = if (Environment.isPosix) uws.Loop else bun.Async.Loop; + /// TODO: rename this to ScriptExecutionContext /// This is the shared global state for a single JS instance execution /// Today, Bun is one VM per thread, so the name "VirtualMachine" sort of makes sense @@ -484,7 +487,7 @@ pub const VirtualMachine = struct { origin: URL = URL{}, node_fs: ?*Node.NodeFS = null, timer: Bun.Timer = Bun.Timer{}, - event_loop_handle: ?*uws.Loop = null, + event_loop_handle: ?*PlatformEventLoop = null, pending_unref_counter: i32 = 0, preload: []const string = &[_][]const u8{}, unhandled_pending_rejection_to_capture: ?*JSC.JSValue = null, @@ -591,6 +594,14 @@ pub const VirtualMachine = struct { pub const OnException = fn (*ZigException) void; + pub fn uwsLoop(this: *const VirtualMachine) *uws.Loop { + if (comptime Environment.isPosix) { + return this.event_loop_handle.?; + } + + return uws.Loop.get(); + } + pub fn isMainThread(this: *const VirtualMachine) bool { return this.worker == null; } @@ -629,9 +640,13 @@ pub const VirtualMachine = struct { } pub fn isEventLoopAlive(vm: *const VirtualMachine) bool { - return vm.active_tasks + - @as(usize, vm.event_loop_handle.?.active) + - vm.event_loop.tasks.count + vm.event_loop.immediate_tasks.count + vm.event_loop.next_immediate_tasks.count > 0; + return vm.event_loop_handle.?.isActive() or (vm.active_tasks + + vm.event_loop.tasks.count + + vm.event_loop.immediate_tasks.count + vm.event_loop.next_immediate_tasks.count > 0); + } + + pub fn wakeup(this: *VirtualMachine) void { + this.eventLoop().wakeup(); } const SourceMapHandlerGetter = struct { @@ -892,7 +907,7 @@ pub const VirtualMachine = struct { unix: []const u8 = "", script_execution_context_id: u32 = 0, next_debugger_id: u64 = 1, - poll_ref: JSC.PollRef = .{}, + poll_ref: Async.KeepAlive = .{}, wait_for_connection: bool = false, set_breakpoint_on_first_line: bool = false, @@ -1688,20 +1703,6 @@ pub const VirtualMachine = struct { ret.path = result_path.text; } - pub fn queueMicrotaskToEventLoop( - globalObject: *JSGlobalObject, - microtask: *Microtask, - ) void { - if (comptime Environment.allow_assert) - std.debug.assert(VirtualMachine.isLoaded()); - - var vm_ = globalObject.bunVM(); - if (vm_.global == globalObject) { - vm_.enqueueTask(Task.init(@as(*JSC.MicrotaskForDefaultGlobalObject, @ptrCast(microtask)))); - } else { - vm_.enqueueTask(Task.init(microtask)); - } - } pub fn resolveForAPI( res: *ErrorableString, @@ -2086,7 +2087,7 @@ pub const VirtualMachine = struct { try this.entry_point.generate( this.allocator, this.bun_watcher != .none, - Fs.PathName.init(entry_path), + entry_path, main_file_name, ); this.eventLoop().ensureWaker(); @@ -2893,6 +2894,10 @@ pub const VirtualMachine = struct { }; pub fn initIPCInstance(this: *VirtualMachine, fd: i32) void { + if (Environment.isWindows) { + Output.prettyWarnln("IPC is not supported on Windows", .{}); + return; + } this.event_loop.ensureWaker(); const context = uws.us_create_socket_context(0, this.event_loop_handle.?, @sizeOf(usize), .{}).?; IPC.Socket.configure(context, true, *IPCInstance, IPCInstance.Handlers); diff --git a/src/bun.js/module_loader.zig b/src/bun.js/module_loader.zig index 9a46d403ba411..209f86ca117d3 100644 --- a/src/bun.js/module_loader.zig +++ b/src/bun.js/module_loader.zig @@ -56,7 +56,7 @@ const MarkedArrayBuffer = @import("./base.zig").MarkedArrayBuffer; const getAllocator = @import("./base.zig").getAllocator; const JSValue = @import("root").bun.JSC.JSValue; const NewClass = @import("./base.zig").NewClass; -const Microtask = @import("root").bun.JSC.Microtask; + const JSGlobalObject = @import("root").bun.JSC.JSGlobalObject; const ExceptionValueRef = @import("root").bun.JSC.ExceptionValueRef; const JSPrivateDataPtr = @import("root").bun.JSC.JSPrivateDataPtr; @@ -85,7 +85,7 @@ const PackageManager = @import("../install/install.zig").PackageManager; const Install = @import("../install/install.zig"); const VirtualMachine = JSC.VirtualMachine; const Dependency = @import("../install/dependency.zig"); - +const Async = bun.Async; const String = bun.String; // Setting BUN_OVERRIDE_MODULE_PATH to the path to the bun repo will make it so modules are loaded @@ -159,6 +159,7 @@ const BunDebugHolder = struct { /// This can technically fail if concurrent access across processes happens, or permission issues. /// Errors here should always be ignored. fn dumpSource(specifier: string, printer: anytype) void { + if (comptime Environment.isWindows) return; if (BunDebugHolder.dir == null) { BunDebugHolder.dir = std.fs.cwd().makeOpenPathIterable("/tmp/bun-debug-src/", .{}) catch return; BunDebugHolder.lock = bun.Lock.init(); @@ -235,7 +236,7 @@ pub const RuntimeTranspilerStore = struct { vm: *JSC.VirtualMachine, globalThis: *JSC.JSGlobalObject, fetcher: Fetcher, - poll_ref: JSC.PollRef = .{}, + poll_ref: Async.KeepAlive = .{}, generation_number: u32 = 0, log: logger.Log, parse_error: ?anyerror = null, @@ -590,7 +591,7 @@ pub const ModuleLoader = struct { arena: bun.ArenaAllocator, // This is the specific state for making it async - poll_ref: JSC.PollRef = .{}, + poll_ref: Async.KeepAlive = .{}, any_task: JSC.AnyTask = undefined, pub const Id = u32; @@ -1424,12 +1425,12 @@ pub const ModuleLoader = struct { // var should_close_input_file_fd = fd == null; - var input_file_fd: StoredFileDescriptorType = 0; + var input_file_fd: StoredFileDescriptorType = bun.invalid_fd; var parse_options = Bundler.ParseOptions{ .allocator = allocator, .path = path, .loader = loader, - .dirname_fd = 0, + .dirname_fd = bun.invalid_fd, .file_descriptor = fd, .file_fd_ptr = &input_file_fd, .file_hash = hash, @@ -1443,9 +1444,9 @@ pub const ModuleLoader = struct { .set_breakpoint_on_first_line = is_main and jsc_vm.debugger != null and jsc_vm.debugger.?.set_breakpoint_on_first_line and setBreakPointOnFirstLine(), }; defer { - if (should_close_input_file_fd and input_file_fd != 0) { + if (should_close_input_file_fd and input_file_fd != bun.invalid_fd) { _ = bun.sys.close(input_file_fd); - input_file_fd = 0; + input_file_fd = bun.invalid_fd; } } diff --git a/src/bun.js/modules/BunJSCModule.h b/src/bun.js/modules/BunJSCModule.h index 74e745badedbd..01c47c63f821d 100644 --- a/src/bun.js/modules/BunJSCModule.h +++ b/src/bun.js/modules/BunJSCModule.h @@ -1,43 +1,43 @@ #include "_NativeModule.h" #include "ExceptionOr.h" -#include "JavaScriptCore/APICast.h" -#include "JavaScriptCore/AggregateError.h" -#include "JavaScriptCore/BytecodeIndex.h" -#include "JavaScriptCore/CallFrameInlines.h" -#include "JavaScriptCore/ClassInfo.h" -#include "JavaScriptCore/CodeBlock.h" -#include "JavaScriptCore/Completion.h" -#include "JavaScriptCore/DeferTermination.h" -#include "JavaScriptCore/Error.h" -#include "JavaScriptCore/ErrorInstance.h" -#include "JavaScriptCore/HeapSnapshotBuilder.h" -#include "JavaScriptCore/JIT.h" -#include "JavaScriptCore/JSBasePrivate.h" -#include "JavaScriptCore/JSCInlines.h" -#include "JavaScriptCore/JSONObject.h" -#include "JavaScriptCore/JavaScript.h" -#include "JavaScriptCore/ObjectConstructor.h" -#include "JavaScriptCore/SamplingProfiler.h" -#include "JavaScriptCore/TestRunnerUtils.h" -#include "JavaScriptCore/VMTrapsInlines.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "MessagePort.h" #include "SerializedScriptValue.h" -#include "wtf/FileSystem.h" -#include "wtf/MemoryFootprint.h" -#include "wtf/text/WTFString.h" +#include +#include +#include -#include "Process.h" +#include "BunProcess.h" #include #if ENABLE(REMOTE_INSPECTOR) -#include "JavaScriptCore/RemoteInspectorServer.h" +#include #endif #include "JSDOMConvertBase.h" #include "ZigSourceProvider.h" #include "mimalloc.h" -#include "JavaScriptCore/ControlFlowProfiler.h" +#include using namespace JSC; using namespace WTF; @@ -653,7 +653,7 @@ JSC_DEFINE_HOST_FUNCTION(functionDeserialize, (JSGlobalObject * globalObject, RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" EncodedJSValue ByteRangeMapping__findExecutedLines( +extern "C" JSC::EncodedJSValue ByteRangeMapping__findExecutedLines( JSC::JSGlobalObject *, BunString sourceURL, BasicBlockRange *ranges, size_t len, size_t functionOffset, bool ignoreSourceMap); diff --git a/src/bun.js/modules/NodeModuleModule.h b/src/bun.js/modules/NodeModuleModule.h index 804d1dd9d9f03..cf399ab1cbc24 100644 --- a/src/bun.js/modules/NodeModuleModule.h +++ b/src/bun.js/modules/NodeModuleModule.h @@ -2,8 +2,8 @@ #include "CommonJSModuleRecord.h" #include "ImportMetaObject.h" -#include "JavaScriptCore/JSBoundFunction.h" -#include "JavaScriptCore/ObjectConstructor.h" +#include +#include #include "_NativeModule.h" #include "isBuiltinModule.h" @@ -188,7 +188,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionNodeModuleCreateRequire, scope, JSValue::encode(Bun::JSCommonJSModule::createBoundRequireFunction( vm, globalObject, val))); } -extern "C" EncodedJSValue Resolver__nodeModulePathsForJS(JSGlobalObject *, +extern "C" JSC::EncodedJSValue Resolver__nodeModulePathsForJS(JSGlobalObject *, CallFrame *); JSC_DEFINE_HOST_FUNCTION(jsFunctionFindSourceMap, diff --git a/src/bun.js/modules/NodeProcessModule.h b/src/bun.js/modules/NodeProcessModule.h index 6c3db073112cc..e24fe07a25e12 100644 --- a/src/bun.js/modules/NodeProcessModule.h +++ b/src/bun.js/modules/NodeProcessModule.h @@ -1,6 +1,6 @@ #include "../bindings/ZigGlobalObject.h" -#include "JavaScriptCore/CustomGetterSetter.h" -#include "JavaScriptCore/JSGlobalObject.h" +#include +#include #include "_NativeModule.h" namespace Zig { @@ -16,7 +16,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionProcessModuleCommonJS, JSC_DEFINE_CUSTOM_GETTER(jsFunctionProcessModuleCommonJSGetter, (JSGlobalObject * globalObject, - EncodedJSValue thisValue, + JSC::EncodedJSValue thisValue, PropertyName propertyName)) { VM &vm = globalObject->vm(); @@ -27,7 +27,7 @@ JSC_DEFINE_CUSTOM_GETTER(jsFunctionProcessModuleCommonJSGetter, JSC_DEFINE_CUSTOM_SETTER(jsFunctionProcessModuleCommonJSSetter, (JSGlobalObject * globalObject, - EncodedJSValue thisValue, EncodedJSValue encodedValue, + JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, PropertyName propertyName)) { VM &vm = globalObject->vm(); diff --git a/src/bun.js/modules/NodeStringDecoderModule.h b/src/bun.js/modules/NodeStringDecoderModule.h index 3f5258cc1d851..253ba0f7e20e7 100644 --- a/src/bun.js/modules/NodeStringDecoderModule.h +++ b/src/bun.js/modules/NodeStringDecoderModule.h @@ -1,6 +1,6 @@ #include "../bindings/JSStringDecoder.h" #include "../bindings/ZigGlobalObject.h" -#include "JavaScriptCore/JSGlobalObject.h" +#include namespace Zig { diff --git a/src/bun.js/modules/NodeTTYModule.h b/src/bun.js/modules/NodeTTYModule.h index 18a8f59a9a32d..913332980eb71 100644 --- a/src/bun.js/modules/NodeTTYModule.h +++ b/src/bun.js/modules/NodeTTYModule.h @@ -1,6 +1,10 @@ #include "JSBuffer.h" #include "_NativeModule.h" +#if OS(WINDOWS) +#include +#endif + namespace Zig { using namespace WebCore; @@ -15,7 +19,20 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionTty_isatty, (JSGlobalObject * globalObject, int fd = callFrame->argument(0).toInt32(globalObject); RETURN_IF_EXCEPTION(scope, encodedJSValue()); - return JSValue::encode(jsBoolean(isatty(fd))); + #if !OS(WINDOWS) + bool isTTY = isatty(fd); + #else + bool isTTY = false; + switch (uv_guess_handle(fd)) { + case UV_TTY: + isTTY = true; + break; + default: + break; + } + #endif + + return JSValue::encode(jsBoolean(isTTY)); } JSC_DEFINE_HOST_FUNCTION(jsFunctionNotImplementedYet, diff --git a/src/bun.js/modules/NodeUtilTypesModule.h b/src/bun.js/modules/NodeUtilTypesModule.h index e0b9906031560..35fe51c6ae525 100644 --- a/src/bun.js/modules/NodeUtilTypesModule.h +++ b/src/bun.js/modules/NodeUtilTypesModule.h @@ -2,15 +2,15 @@ #include "webcrypto/JSCryptoKey.h" #include "napi_external.h" -#include "JavaScriptCore/CallFrame.h" -#include "JavaScriptCore/CallFrameInlines.h" -#include "JavaScriptCore/AggregateError.h" -#include "JavaScriptCore/JSArrayBuffer.h" +#include +#include +#include +#include #include "webcrypto/JSJsonWebKey.h" -#include "JavaScriptCore/ObjectConstructor.h" -#include "JavaScriptCore/GeneratorFunctionPrototype.h" -#include "JavaScriptCore/AsyncFunctionPrototype.h" -#include "JavaScriptCore/ErrorPrototype.h" +#include +#include +#include +#include using namespace JSC; diff --git a/src/bun.js/modules/ObjectModule.h b/src/bun.js/modules/ObjectModule.h index 296e8000ae033..5b9aba2cd74b1 100644 --- a/src/bun.js/modules/ObjectModule.h +++ b/src/bun.js/modules/ObjectModule.h @@ -1,7 +1,7 @@ #pragma once #include "../bindings/ZigGlobalObject.h" -#include "JavaScriptCore/JSGlobalObject.h" +#include namespace Zig { JSC::SyntheticSourceProvider::SyntheticSourceGenerator diff --git a/src/bun.js/modules/_NativeModule.h b/src/bun.js/modules/_NativeModule.h index 6d3d761769cae..cd855a7a968c1 100644 --- a/src/bun.js/modules/_NativeModule.h +++ b/src/bun.js/modules/_NativeModule.h @@ -1,8 +1,8 @@ // clang-format off #pragma once #include "JSBuffer.h" -#include "JavaScriptCore/JSGlobalObject.h" -#include "JavaScriptCore/ObjectConstructor.h" +#include +#include #include "ZigGlobalObject.h" // These modules are implemented in native code as a function which writes ESM diff --git a/src/bun.js/node/fs_events.zig b/src/bun.js/node/fs_events.zig index ce158a037ac59..25988c2475257 100644 --- a/src/bun.js/node/fs_events.zig +++ b/src/bun.js/node/fs_events.zig @@ -187,7 +187,7 @@ var fsevents_cf: ?CoreFoundation = null; var fsevents_cs: ?CoreServices = null; fn InitLibrary() void { - const fsevents_cf_handle = std.c.dlopen("/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation", RTLD_LAZY | RTLD_LOCAL); + const fsevents_cf_handle = bun.C.dlopen("/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation", RTLD_LAZY | RTLD_LOCAL); if (fsevents_cf_handle == null) @panic("Cannot Load CoreFoundation"); fsevents_cf = CoreFoundation{ @@ -206,7 +206,7 @@ fn InitLibrary() void { .RunLoopDefaultMode = dlsym(fsevents_cf_handle, *CFStringRef, "kCFRunLoopDefaultMode") orelse @panic("Cannot Load CoreFoundation"), }; - const fsevents_cs_handle = std.c.dlopen("/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices", RTLD_LAZY | RTLD_LOCAL); + const fsevents_cs_handle = bun.C.dlopen("/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices", RTLD_LAZY | RTLD_LOCAL); if (fsevents_cs_handle == null) @panic("Cannot Load CoreServices"); fsevents_cs = CoreServices{ diff --git a/src/bun.js/node/node.classes.ts b/src/bun.js/node/node.classes.ts index 46c25ad064223..4ed5b9b2e9e96 100644 --- a/src/bun.js/node/node.classes.ts +++ b/src/bun.js/node/node.classes.ts @@ -1,4 +1,4 @@ -import { define } from "../scripts/class-definitions"; +import { define } from "../../codegen/class-definitions"; export default [ define({ diff --git a/src/bun.js/node/node_fs.zig b/src/bun.js/node/node_fs.zig index 173f750a504b8..f4c0b589a621f 100644 --- a/src/bun.js/node/node_fs.zig +++ b/src/bun.js/node/node_fs.zig @@ -4,6 +4,7 @@ const std = @import("std"); const bun = @import("root").bun; const strings = bun.strings; +const windows = bun.windows; const string = bun.string; const AsyncIO = @import("root").bun.AsyncIO; const JSC = @import("root").bun.JSC; @@ -39,7 +40,6 @@ const ReadPosition = i64; const Stats = JSC.Node.Stats; const Dirent = JSC.Node.Dirent; - pub const FlavoredIO = struct { io: *AsyncIO, }; @@ -109,7 +109,7 @@ pub const Async = struct { globalObject: *JSC.JSGlobalObject, task: JSC.WorkPoolTask = .{ .callback = &workPoolCallback }, result: JSC.Maybe(ReturnType), - ref: JSC.PollRef = .{}, + ref: bun.Async.KeepAlive = .{}, tracker: JSC.AsyncTaskTracker, pub const Task = @This(); @@ -209,7 +209,7 @@ pub const AsyncCpTask = struct { globalObject: *JSC.JSGlobalObject, task: JSC.WorkPoolTask = .{ .callback = &workPoolCallback }, result: JSC.Maybe(Return.Cp), - ref: JSC.PollRef = .{}, + ref: bun.Async.KeepAlive = .{}, arena: bun.ArenaAllocator, tracker: JSC.AsyncTaskTracker, has_result: std.atomic.Atomic(bool), @@ -224,6 +224,11 @@ pub const AsyncCpTask = struct { vm: *JSC.VirtualMachine, arena: bun.ArenaAllocator, ) JSC.JSValue { + if (comptime Environment.isWindows) { + globalObject.throwTODO("fs.promises.cp is not implemented on Windows yet"); + return .zero; + } + var task = bun.default_allocator.create(AsyncCpTask) catch @panic("out of memory"); task.* = AsyncCpTask{ .promise = JSC.JSPromise.Strong.init(globalObject), @@ -352,7 +357,7 @@ pub const AsyncCpSingleFileTask = struct { brk: { switch (result) { .err => |err| { - if (err.errno == @intFromEnum(os.E.EXIST) and !args.flags.errorOnExist) { + if (err.errno == @intFromEnum(E.EXIST) and !args.flags.errorOnExist) { break :brk; } this.cp_task.finishConcurrently(result); @@ -3420,13 +3425,14 @@ pub const NodeFS = struct { _ = flavor; const ret = Maybe(Return.CopyFile); - var src_buf: [bun.MAX_PATH_BYTES]u8 = undefined; - var dest_buf: [bun.MAX_PATH_BYTES]u8 = undefined; - var src = args.src.sliceZ(&src_buf); - var dest = args.dest.sliceZ(&dest_buf); - // TODO: do we need to fchown? if (comptime Environment.isMac) { + var src_buf: [bun.MAX_PATH_BYTES]u8 = undefined; + var dest_buf: [bun.MAX_PATH_BYTES]u8 = undefined; + + var src = args.src.sliceZ(&src_buf); + var dest = args.dest.sliceZ(&dest_buf); + if (args.mode.isForceClone()) { // https://www.manpagez.com/man/2/clonefile/ return ret.errnoSysP(C.clonefile(src, dest, 0), .clonefile, src) orelse ret.success; @@ -3493,6 +3499,11 @@ pub const NodeFS = struct { } if (comptime Environment.isLinux) { + var src_buf: [bun.MAX_PATH_BYTES]u8 = undefined; + var dest_buf: [bun.MAX_PATH_BYTES]u8 = undefined; + var src = args.src.sliceZ(&src_buf); + var dest = args.dest.sliceZ(&dest_buf); + // https://manpages.debian.org/testing/manpages-dev/ioctl_ficlone.2.en.html if (args.mode.isForceClone()) { return Maybe(Return.CopyFile).todo; @@ -3576,6 +3587,26 @@ pub const NodeFS = struct { return ret.success; } + + if (comptime Environment.isWindows) { + if (args.mode.isForceClone()) { + return Maybe(Return.CopyFile).todo; + } + + var src_buf: bun.MAX_WPATH = undefined; + var dest_buf: bun.MAX_WPATH = undefined; + var src = strings.toWPathNormalizeAutoExtend(&src_buf, args.src.slice()); + var dest = strings.toWPathNormalizeAutoExtend(&dest_buf, args.dest.slice()); + if (windows.CopyFileW(src.ptr, dest.ptr, if (args.mode.shouldntOverwrite()) 1 else 0) == windows.FALSE) { + if (ret.errnoSysP(0, .copyfile, args.src.slice())) |rest| { + return rest; + } + } + + return ret.success; + } + + return Maybe(Return.CopyFile).todo; } pub fn exists(this: *NodeFS, args: Arguments.Exists, comptime flavor: Flavor) Maybe(Return.Exists) { @@ -4960,8 +4991,16 @@ pub const NodeFS = struct { /// This function is `cpSync`, but only if you pass `{ recursive: ..., force: ..., errorOnExist: ..., mode: ... }' /// The other options like `filter` use a JS fallback, see `src/js/internal/fs/cp.ts` pub fn cp(this: *NodeFS, args: Arguments.Cp, comptime flavor: Flavor) Maybe(Return.Cp) { + if (comptime Environment.isWindows) { + return Maybe(Return.Cp).todo; + } + comptime std.debug.assert(flavor == .sync); + if (comptime Environment.isWindows) { + return Maybe(Return.Cp).todo; + } + var src_buf: [bun.MAX_PATH_BYTES]u8 = undefined; var dest_buf: [bun.MAX_PATH_BYTES]u8 = undefined; var src = args.src.sliceZ(&src_buf); @@ -4996,7 +5035,7 @@ pub const NodeFS = struct { @enumFromInt((if (args.errorOnExist or !args.force) Constants.COPYFILE_EXCL else @as(u8, 0))), stat_, ); - if (r == .err and r.err.errno == @intFromEnum(os.E.EXIST) and !args.errorOnExist) { + if (r == .err and r.err.errno == @intFromEnum(E.EXIST) and !args.errorOnExist) { return Maybe(Return.Cp).success; } return r; @@ -5006,7 +5045,7 @@ pub const NodeFS = struct { @memcpy(this.sync_error_buf[0..src.len], src); return .{ .err = .{ - .errno = @intFromEnum(std.os.E.ISDIR), + .errno = @intFromEnum(E.ISDIR), .syscall = .copyfile, .path = this.sync_error_buf[0..src.len], }, @@ -5095,7 +5134,7 @@ pub const NodeFS = struct { ); switch (r) { .err => { - if (r.err.errno == @intFromEnum(os.E.EXIST) and !args.errorOnExist) { + if (r.err.errno == @intFromEnum(E.EXIST) and !args.errorOnExist) { continue; } return r; @@ -5351,6 +5390,11 @@ pub const NodeFS = struct { /// Directory scanning + clonefile will block this thread, then each individual file copy (what the sync version /// calls "_copySingleFileSync") will be dispatched as a separate task. pub fn cpAsync(this: *NodeFS, task: *AsyncCpTask) void { + if (comptime Environment.isWindows) { + task.finishConcurrently(Maybe(Return.Cp).todo); + return; + } + const args = task.args; var src_buf: [bun.MAX_PATH_BYTES]u8 = undefined; var dest_buf: [bun.MAX_PATH_BYTES]u8 = undefined; @@ -5374,7 +5418,7 @@ pub const NodeFS = struct { @enumFromInt((if (args.flags.errorOnExist or !args.flags.force) Constants.COPYFILE_EXCL else @as(u8, 0))), stat_, ); - if (r == .err and r.err.errno == @intFromEnum(os.E.EXIST) and !args.flags.errorOnExist) { + if (r == .err and r.err.errno == @intFromEnum(E.EXIST) and !args.flags.errorOnExist) { task.finishConcurrently(Maybe(Return.Cp).success); return; } @@ -5385,7 +5429,7 @@ pub const NodeFS = struct { if (!args.flags.recursive) { @memcpy(this.sync_error_buf[0..src.len], src); task.finishConcurrently(.{ .err = .{ - .errno = @intFromEnum(std.os.E.ISDIR), + .errno = @intFromEnum(E.ISDIR), .syscall = .copyfile, .path = this.sync_error_buf[0..src.len], } }); diff --git a/src/bun.js/node/node_fs_stat_watcher.zig b/src/bun.js/node/node_fs_stat_watcher.zig index 158a08ff73809..2da4a15978357 100644 --- a/src/bun.js/node/node_fs_stat_watcher.zig +++ b/src/bun.js/node/node_fs_stat_watcher.zig @@ -156,7 +156,7 @@ pub const StatWatcher = struct { globalThis: *JSC.JSGlobalObject, js_this: JSC.JSValue, - poll_ref: JSC.PollRef = .{}, + poll_ref: bun.Async.KeepAlive = .{}, last_stat: bun.Stat, last_jsvalue: JSC.Strong, @@ -197,6 +197,12 @@ pub const StatWatcher = struct { global_this: JSC.C.JSContextRef, pub fn fromJS(ctx: JSC.C.JSContextRef, arguments: *ArgumentsSlice, exception: JSC.C.ExceptionRef) ?Arguments { + if (comptime Environment.isWindows) { + bun.todo(@src(), void{}); + ctx.throwTODO("Windows support not implemented yet! Sorry!!"); + return null; + } + const vm = ctx.vm(); const path = PathLike.fromJSWithAllocator(ctx, arguments, bun.default_allocator, exception) orelse { if (exception.* == null) { diff --git a/src/bun.js/node/node_fs_watcher.zig b/src/bun.js/node/node_fs_watcher.zig index ccb1a987feead..44f6e37d1ae95 100644 --- a/src/bun.js/node/node_fs_watcher.zig +++ b/src/bun.js/node/node_fs_watcher.zig @@ -16,6 +16,7 @@ const Output = bun.Output; const string = bun.string; const StoredFileDescriptorType = bun.StoredFileDescriptorType; const Environment = bun.Environment; +const Async = bun.Async; pub const FSWatcher = struct { ctx: *VirtualMachine, @@ -26,7 +27,7 @@ pub const FSWatcher = struct { signal: ?*JSC.AbortSignal, persistent: bool, path_watcher: ?*PathWatcher.PathWatcher, - poll_ref: JSC.PollRef = .{}, + poll_ref: Async.KeepAlive = .{}, globalThis: *JSC.JSGlobalObject, js_this: JSC.JSValue, encoding: JSC.Node.Encoding, diff --git a/src/bun.js/node/syscall.zig b/src/bun.js/node/syscall.zig index edb7b35783510..18dc4a0ef0332 100644 --- a/src/bun.js/node/syscall.zig +++ b/src/bun.js/node/syscall.zig @@ -928,9 +928,11 @@ pub fn getFdPath(fd_: bun.FileDescriptor, out_buffer: *[MAX_PATH_BYTES]u8) Maybe const wide_slice = std.os.windows.GetFinalPathNameByHandle(fd, .{}, wide_buf[0..]) catch { return Maybe([]u8){ .err = .{ .errno = @intFromEnum(bun.C.SystemErrno.EBADF) } }; }; - // Trust that Windows gives us valid UTF-16LE. - return .{ .result = @constCast(bun.strings.fromWPath(out_buffer, wide_slice)) }; + var slash_buf: [MAX_PATH_BYTES * 2]u8 = undefined; + var slash_str = bun.strings.fromWPath(&slash_buf, wide_slice); + + return .{ .result = bun.path.normalizeStringBuf(slash_str, out_buffer, false, .loose) }; }, .macos, .ios, .watchos, .tvos => { // On macOS, we can use F.GETPATH fcntl command to query the OS for diff --git a/src/bun.js/node/types.zig b/src/bun.js/node/types.zig index 96d1a00eff451..f0609f45edb65 100644 --- a/src/bun.js/node/types.zig +++ b/src/bun.js/node/types.zig @@ -83,10 +83,11 @@ pub fn Maybe(comptime ResultType: type) type { pub const todo: @This() = @This(){ .err = Syscall.Error.todo }; - pub fn throw(this: @This()) !void { - if (this == .err) { - return bun.AsyncIO.asError(this.err.errno); - } + pub fn unwrap(this: @This()) !ReturnType { + return switch (this) { + .err => |err| bun.AsyncIO.asError(err.errno), + .result => |result| result, + }; } pub fn toJS(this: @This(), globalThis: *JSC.JSGlobalObject) JSC.JSValue { @@ -2553,7 +2554,7 @@ pub const Process = struct { // When we update the cwd from JS, we have to update the bundler's version as well // However, this might be called many times in a row, so we use a pre-allocated buffer // that way we don't have to worry about garbage collector - JSC.VirtualMachine.get().bundler.fs.top_level_dir = std.os.getcwd(&JSC.VirtualMachine.get().bundler.fs.top_level_dir_buf) catch { + JSC.VirtualMachine.get().bundler.fs.top_level_dir = bun.getcwd(&JSC.VirtualMachine.get().bundler.fs.top_level_dir_buf) catch { _ = Syscall.chdir(@as([:0]const u8, @ptrCast(JSC.VirtualMachine.get().bundler.fs.top_level_dir))); return JSC.toInvalidArguments("Invalid path", .{}, globalObject.ref()); }; diff --git a/src/bun.js/rare_data.zig b/src/bun.js/rare_data.zig index c9d742d966050..f97e94d8db369 100644 --- a/src/bun.js/rare_data.zig +++ b/src/bun.js/rare_data.zig @@ -10,6 +10,7 @@ const BoringSSL = @import("root").bun.BoringSSL; const bun = @import("root").bun; const WebSocketClientMask = @import("../http/websocket_http_client.zig").Mask; const UUID = @import("./uuid.zig"); +const Async = bun.Async; const StatWatcherScheduler = @import("./node/node_fs_stat_watcher.zig").StatWatcherScheduler; const IPC = @import("./ipc.zig"); const uws = @import("root").bun.uws; @@ -29,7 +30,7 @@ hot_map: ?HotMap = null, tail_cleanup_hook: ?*CleanupHook = null, cleanup_hook: ?*CleanupHook = null, -file_polls_: ?*JSC.FilePoll.Store = null, +file_polls_: ?*Async.FilePoll.Store = null, global_dns_data: ?*JSC.DNS.GlobalData = null, @@ -135,10 +136,10 @@ pub const HotMap = struct { } }; -pub fn filePolls(this: *RareData, vm: *JSC.VirtualMachine) *JSC.FilePoll.Store { +pub fn filePolls(this: *RareData, vm: *JSC.VirtualMachine) *Async.FilePoll.Store { return this.file_polls_ orelse { - this.file_polls_ = vm.allocator.create(JSC.FilePoll.Store) catch unreachable; - this.file_polls_.?.* = JSC.FilePoll.Store.init(vm.allocator); + this.file_polls_ = vm.allocator.create(Async.FilePoll.Store) catch unreachable; + this.file_polls_.?.* = Async.FilePoll.Store.init(vm.allocator); return this.file_polls_.?; }; } diff --git a/src/bun.js/resolve_message.classes.ts b/src/bun.js/resolve_message.classes.ts index 3e3c6d083cedc..5bdd08eac399a 100644 --- a/src/bun.js/resolve_message.classes.ts +++ b/src/bun.js/resolve_message.classes.ts @@ -1,4 +1,4 @@ -import { define } from "./scripts/class-definitions"; +import { define } from "../codegen/class-definitions"; export default [ define({ diff --git a/src/bun.js/test/jest.classes.ts b/src/bun.js/test/jest.classes.ts index f10d9fb372848..8e9a21e923d2f 100644 --- a/src/bun.js/test/jest.classes.ts +++ b/src/bun.js/test/jest.classes.ts @@ -1,4 +1,4 @@ -import { define } from "../scripts/class-definitions"; +import { define } from "../../codegen/class-definitions"; export default [ define({ diff --git a/src/bun.js/test/jest.zig b/src/bun.js/test/jest.zig index d7ddea6be547e..0019f0f6eb6b1 100644 --- a/src/bun.js/test/jest.zig +++ b/src/bun.js/test/jest.zig @@ -127,7 +127,7 @@ pub const TestRunner = struct { if (milliseconds > 0) { if (this.test_timeout_timer == null) { - this.test_timeout_timer = bun.uws.Timer.createFallthrough(bun.uws.Loop.get().?, this); + this.test_timeout_timer = bun.uws.Timer.createFallthrough(bun.uws.Loop.get(), this); } if (this.last_test_timeout_timer_duration != milliseconds) { @@ -146,7 +146,7 @@ pub const TestRunner = struct { this.pending_test = null; // disable idling - JSC.VirtualMachine.get().event_loop_handle.?.wakeup(); + JSC.VirtualMachine.get().wakeup(); } pub fn drain(this: *TestRunner) void { diff --git a/src/bun.js/web_worker.zig b/src/bun.js/web_worker.zig index b4de8aad247f5..230f30da23d26 100644 --- a/src/bun.js/web_worker.zig +++ b/src/bun.js/web_worker.zig @@ -4,6 +4,7 @@ const Output = bun.Output; const log = Output.scoped(.Worker, true); const std = @import("std"); const JSValue = JSC.JSValue; +const Async = bun.Async; /// Shared implementation of Web and Node `Worker` pub const WebWorker = struct { @@ -28,7 +29,7 @@ pub const WebWorker = struct { /// if false, then the parent poll will always be unref, otherwise the worker's event loop will keep the poll alive. user_keep_alive: bool = false, worker_event_loop_running: bool = true, - parent_poll_ref: JSC.PollRef = .{}, + parent_poll_ref: Async.KeepAlive = .{}, pub const Status = enum { start, diff --git a/src/bun.js/webcore/encoding.classes.ts b/src/bun.js/webcore/encoding.classes.ts index 7114f210edfc3..7fd70406f4dd8 100644 --- a/src/bun.js/webcore/encoding.classes.ts +++ b/src/bun.js/webcore/encoding.classes.ts @@ -1,4 +1,4 @@ -import { define } from "../scripts/class-definitions"; +import { define } from "../../codegen/class-definitions"; export default [ define({ diff --git a/src/bun.js/webcore/encoding.zig b/src/bun.js/webcore/encoding.zig index 18e70b26143dc..2f973792ed3db 100644 --- a/src/bun.js/webcore/encoding.zig +++ b/src/bun.js/webcore/encoding.zig @@ -880,6 +880,7 @@ pub const Encoder = struct { else => toString(input, len, globalObject, .utf8), }; } + pub fn toString(input_ptr: [*]const u8, len: usize, global: *JSGlobalObject, comptime encoding: JSC.Node.Encoding) JSValue { if (len == 0) return ZigString.Empty.toValue(global); @@ -1254,4 +1255,10 @@ comptime { } } -test "Vec" {} +export fn Zig__Bun_base64URLEncodeToString(input_ptr: [*]const u8, len: usize, ret: *bun.String) void { + const input = input_ptr[0..len]; + var out = bun.String.createUninitialized(.latin1, bun.base64.urlSafeEncodeLen(input)) orelse @panic("Out of memory"); + defer out.deref(); + _ = bun.base64.encodeURLSafe(@constCast(out.latin1()), input); + ret.* = out; +} diff --git a/src/bun.js/webcore/response.classes.ts b/src/bun.js/webcore/response.classes.ts index 6f3c05aa45b81..6ce2f17f8a88a 100644 --- a/src/bun.js/webcore/response.classes.ts +++ b/src/bun.js/webcore/response.classes.ts @@ -1,4 +1,4 @@ -import { define } from "../scripts/class-definitions"; +import { define } from "../../codegen/class-definitions"; export default [ define({ diff --git a/src/bun.js/webcore/response.zig b/src/bun.js/webcore/response.zig index f7ada28627a42..8df2cdb2957eb 100644 --- a/src/bun.js/webcore/response.zig +++ b/src/bun.js/webcore/response.zig @@ -53,6 +53,7 @@ const BodyMixin = JSC.WebCore.BodyMixin; const Body = JSC.WebCore.Body; const Request = JSC.WebCore.Request; const Blob = JSC.WebCore.Blob; +const Async = bun.Async; const BoringSSL = bun.BoringSSL; const X509 = @import("../api/bun/x509.zig"); @@ -782,7 +783,7 @@ pub const Fetch = struct { request_headers: Headers = Headers{ .allocator = undefined }, promise: JSC.JSPromise.Strong, concurrent_task: JSC.ConcurrentTask = .{}, - poll_ref: JSC.PollRef = .{}, + poll_ref: Async.KeepAlive = .{}, memory_reporter: *JSC.MemoryReportingAllocator, /// For Http Client requests /// when Content-Length is provided this represents the whole size of the request diff --git a/src/bun.js/webcore/streams.classes.ts b/src/bun.js/webcore/streams.classes.ts deleted file mode 100644 index 0b070b857896b..0000000000000 --- a/src/bun.js/webcore/streams.classes.ts +++ /dev/null @@ -1,5 +0,0 @@ -// import { define } from "../scripts/class-definitions"; - -// export default [ -// define({}) -// ] diff --git a/src/bun.js/webcore/streams.zig b/src/bun.js/webcore/streams.zig index 6c51daf94a16d..24ae5757ab784 100644 --- a/src/bun.js/webcore/streams.zig +++ b/src/bun.js/webcore/streams.zig @@ -21,7 +21,7 @@ const default_allocator = @import("root").bun.default_allocator; const FeatureFlags = @import("root").bun.FeatureFlags; const ArrayBuffer = @import("../base.zig").ArrayBuffer; const Properties = @import("../base.zig").Properties; - +const Async = bun.Async; const castObj = @import("../base.zig").castObj; const getAllocator = @import("../base.zig").getAllocator; @@ -1245,7 +1245,7 @@ pub const FileSink = struct { has_adjusted_pipe_size_on_linux: bool = false, max_write_size: usize = std.math.maxInt(usize), reachable_from_js: bool = true, - poll_ref: ?*JSC.FilePoll = null, + poll_ref: ?*Async.FilePoll = null, pub usingnamespace NewReadyWatcher(@This(), .writable, ready); const log = Output.scoped(.FileSink, false); @@ -3790,7 +3790,7 @@ pub const AutoSizer = struct { pub const FIFO = struct { buf: []u8 = &[_]u8{}, view: JSC.Strong = .{}, - poll_ref: ?*JSC.FilePoll = null, + poll_ref: ?*Async.FilePoll = null, fd: bun.FileDescriptor = bun.invalid_fd, to_read: ?u32 = null, close_on_empty_read: bool = false, @@ -4065,6 +4065,12 @@ pub const FIFO = struct { /// provided via kqueue(), only on macOS kqueue_read_amt: ?u32, ) ReadResult { + if (comptime Environment.isWindows) { + return ReadResult{ + .err = Syscall.Error.todo, + }; + } + const available_to_read = this.getAvailableToRead( if (kqueue_read_amt != null) @as(i64, @intCast(kqueue_read_amt.?)) @@ -4155,7 +4161,7 @@ pub const File = struct { buf: []u8 = &[_]u8{}, view: JSC.Strong = .{}, - poll_ref: JSC.PollRef = .{}, + poll_ref: Async.KeepAlive = .{}, fd: bun.FileDescriptor = bun.invalid_fd, concurrent: Concurrent = .{}, loop: *JSC.EventLoop, @@ -4858,7 +4864,7 @@ pub const FileReader = struct { pub fn NewReadyWatcher( comptime Context: type, - comptime flag_: JSC.FilePoll.Flags, + comptime flag_: Async.FilePoll.Flags, comptime onReady: anytype, ) type { return struct { @@ -4893,6 +4899,11 @@ pub fn NewReadyWatcher( } pub fn unwatch(this: *Context, fd_: anytype) void { + if (comptime Environment.isWindows) { + bun.todo(@src(), {}); + return; + } + const fd = @as(c_int, @intCast(fd_)); std.debug.assert(@as(c_int, @intCast(this.poll_ref.?.fd)) == fd); std.debug.assert( @@ -4900,9 +4911,9 @@ pub fn NewReadyWatcher( ); } - pub fn pollRef(this: *Context) *JSC.FilePoll { + pub fn pollRef(this: *Context) *Async.FilePoll { return this.poll_ref orelse brk: { - this.poll_ref = JSC.FilePoll.init( + this.poll_ref = Async.FilePoll.init( JSC.VirtualMachine.get(), this.fd, .{}, @@ -4922,9 +4933,12 @@ pub fn NewReadyWatcher( } pub fn watch(this: *Context, fd_: anytype) void { + if (comptime Environment.isWindows) { + return; + } const fd = @as(bun.FileDescriptor, @intCast(fd_)); - var poll_ref: *JSC.FilePoll = this.poll_ref orelse brk: { - this.poll_ref = JSC.FilePoll.init( + var poll_ref: *Async.FilePoll = this.poll_ref orelse brk: { + this.poll_ref = Async.FilePoll.init( JSC.VirtualMachine.get(), fd, .{}, diff --git a/src/bun.zig b/src/bun.zig index a93b3c5ae7b0e..4da5a99844e8b 100644 --- a/src/bun.zig +++ b/src/bun.zig @@ -716,7 +716,7 @@ pub fn rangeOfSliceInBuffer(slice: []const u8, buffer: []const u8) ?[2]u32 { pub const invalid_fd = if (Environment.isWindows) // on windows, max usize is the process handle, a very valid fd - std.math.maxInt(i32) + 1 + std.math.maxInt(usize) else std.math.maxInt(FileDescriptor); @@ -740,9 +740,61 @@ pub const DateTime = @import("./deps/zig-datetime/src/datetime.zig"); pub var start_time: i128 = 0; +pub fn openFileZ(pathZ: [:0]const u8, open_flags: std.fs.File.OpenFlags) !std.fs.File { + var flags: Mode = 0; + switch (open_flags.mode) { + .read_only => flags |= std.os.O.RDONLY, + .write_only => flags |= std.os.O.WRONLY, + .read_write => flags |= std.os.O.RDWR, + } + + const res = try sys.open(pathZ, flags, 0).unwrap(); + return std.fs.File{ .handle = fdcast(res) }; +} + +pub fn openFile(path_: []const u8, open_flags: std.fs.File.OpenFlags) !std.fs.File { + if (comptime Environment.isWindows) { + var flags: Mode = 0; + switch (open_flags.mode) { + .read_only => flags |= std.os.O.RDONLY, + .write_only => flags |= std.os.O.WRONLY, + .read_write => flags |= std.os.O.RDWR, + } + + return std.fs.File{ .handle = fdcast(try sys.openA(path_, flags, 0).unwrap()) }; + } + + return try openFileZ(&try std.os.toPosixPath(path_), open_flags); +} + pub fn openDir(dir: std.fs.Dir, path_: [:0]const u8) !std.fs.IterableDir { - const fd = try std.os.openatZ(dir.fd, path_, std.os.O.DIRECTORY | std.os.O.CLOEXEC | 0, 0); - return std.fs.IterableDir{ .dir = .{ .fd = fd } }; + if (comptime Environment.isWindows) { + const res = try sys.openDirAtWindowsA(toFD(dir.fd), path_, true, false).unwrap(); + return std.fs.IterableDir{ .dir = .{ .fd = fdcast(res) } }; + } else { + const fd = try sys.openat(dir.fd, path_, std.os.O.DIRECTORY | std.os.O.CLOEXEC | std.os.O.RDONLY, 0).unwrap(); + return std.fs.IterableDir{ .dir = .{ .fd = fd } }; + } +} + +pub fn openDirA(dir: std.fs.Dir, path_: []const u8) !std.fs.IterableDir { + if (comptime Environment.isWindows) { + const res = try sys.openDirAtWindowsA(toFD(dir.fd), path_, true, false).unwrap(); + return std.fs.IterableDir{ .dir = .{ .fd = fdcast(res) } }; + } else { + const fd = try sys.openatA(dir.fd, path_, std.os.O.DIRECTORY | std.os.O.CLOEXEC | std.os.O.RDONLY, 0).unwrap(); + return std.fs.IterableDir{ .dir = .{ .fd = fd } }; + } +} + +pub fn openDirAbsolute(path_: []const u8) !std.fs.Dir { + if (comptime Environment.isWindows) { + const res = try sys.openDirAtWindowsA(invalid_fd, path_, true, false).unwrap(); + return std.fs.Dir{ .fd = fdcast(res) }; + } else { + const fd = try sys.openA(path_, std.os.O.DIRECTORY | std.os.O.CLOEXEC | std.os.O.RDONLY, 0).unwrap(); + return std.fs.Dir{ .fd = fd }; + } } pub const MimallocArena = @import("./mimalloc_arena.zig").Arena; @@ -753,6 +805,20 @@ pub fn getenvZ(path_: [:0]const u8) ?[]const u8 { return null; } + if (comptime Environment.isWindows) { + // Windows UCRT will fill this in for us + for (std.os.environ) |lineZ| { + const line = sliceTo(lineZ, 0); + const key_end = strings.indexOfCharUsize(line, '=') orelse line.len; + const key = line[0..key_end]; + if (strings.eqlLong(key, path_, true)) { + return line[@min(key_end + 1, line.len)..]; + } + } + + return null; + } + const ptr = std.c.getenv(path_.ptr) orelse return null; return sliceTo(ptr, 0); } @@ -1054,12 +1120,33 @@ fn getFdPathViaCWD(fd: std.os.fd_t, buf: *[@This().MAX_PATH_BYTES]u8) ![]u8 { return std.os.getcwd(buf); } +pub fn getcwd(buf_: []u8) ![]u8 { + if (comptime !Environment.isWindows) { + return std.os.getcwd(buf_); + } + + var temp: [MAX_PATH_BYTES]u8 = undefined; + var temp_slice = try std.os.getcwd(&temp); + return path.normalizeBuf(temp_slice, buf_, .loose); +} + +pub fn getcwdAlloc(allocator: std.mem.Allocator) ![]u8 { + var temp: [MAX_PATH_BYTES]u8 = undefined; + var temp_slice = try getcwd(&temp); + return allocator.dupe(u8, temp_slice); +} + /// Get the absolute path to a file descriptor. /// On Linux, when `/proc/self/fd` is not available, this function will attempt to use `fchdir` and `getcwd` to get the path instead. pub fn getFdPath(fd_: anytype, buf: *[@This().MAX_PATH_BYTES]u8) ![]u8 { const fd = fdcast(toFD(fd_)); + if (comptime Environment.isWindows) { + var temp: [MAX_PATH_BYTES]u8 = undefined; + var temp_slice = try std.os.getFdPath(fd, &temp); + return path.normalizeBuf(temp_slice, buf, .loose); + } if (comptime !Environment.isLinux) { - return std.os.getFdPath(fd, buf); + return try std.os.getFdPath(fd, buf); } if (needs_proc_self_workaround) { @@ -1678,6 +1765,10 @@ const WindowsStat = extern struct { mtim: std.c.timespec, ctim: std.c.timespec, + pub fn birthtime(_: *const WindowsStat) std.c.timespec { + return std.c.timespec{ .tv_nsec = 0, .tv_sec = 0 }; + } + pub fn mtime(this: *const WindowsStat) std.c.timespec { return this.mtim; } @@ -1718,15 +1809,13 @@ pub const win32 = struct { pub var STDOUT_FD: FileDescriptor = undefined; pub var STDERR_FD: FileDescriptor = undefined; pub var STDIN_FD: FileDescriptor = undefined; - var argv_: [][*:0]u8 = undefined; - var args_buf: [255][*:0]u8 = undefined; pub inline fn argv() [][*:0]u8 { - return argv_; + return std.os.argv; } pub inline fn setArgv(new_ptr: [][*:0]u8) void { - argv_ = new_ptr; + std.os.argv = new_ptr; } pub fn stdio(i: anytype) FileDescriptor { @@ -1737,47 +1826,6 @@ pub const win32 = struct { else => @panic("Invalid stdio fd"), }; } - - pub fn populateArgv() void { - const kernel32 = windows; - - var wargv_all = kernel32.GetCommandLineW(); - var num_args: c_int = 0; - var start = kernel32.CommandLineToArgvW(wargv_all, &num_args); - defer _ = kernel32.LocalFree(@ptrCast(start)); - var wargv = start[0..@as(usize, @intCast(num_args))]; - var argv_list = std.ArrayList([*:0]u8).init(default_allocator); - argv_list.items = &args_buf; - argv_list.capacity = args_buf.len; - - if (wargv.len > args_buf.len) { - var ptrs = default_allocator.alloc(?[*]u8, wargv.len + 1) catch unreachable; - ptrs[ptrs.len - 1] = null; - argv_list.items = @ptrCast(ptrs[0 .. ptrs.len - 1]); - argv_list.capacity = argv_list.items.len + 1; - } - - const probably_overestimated_length = strings.elementLengthUTF16IntoUTF8([]const u16, sliceTo(wargv_all, 0)) + argv_list.items.len; - var buf = default_allocator.alloc(u8, probably_overestimated_length) catch unreachable; - var builder = StringBuilder{ - .cap = probably_overestimated_length, - .ptr = buf.ptr, - .len = 0, - }; - - for (wargv) |warg_| { - var warg = sliceTo(warg_, 0); - argv_list.appendAssumeCapacity( - (builder.append16(warg) orelse brk: { - var list = strings.convertUTF16ToUTF8(std.ArrayList(u8).init(default_allocator), []const u16, warg) catch unreachable; - list.append(0) catch unreachable; - break :brk list.items.ptr[0..list.items.len :0]; - }).ptr, - ); - } - - argv_ = argv_list.items.ptr[0..argv_list.items.len]; - } }; pub usingnamespace if (@import("builtin").target.os.tag != .windows) posix else win32; @@ -1910,6 +1958,9 @@ pub inline fn serializableInto(comptime T: type, init: anytype) T { /// Like std.fs.Dir.makePath except instead of infinite looping on dangling /// symlink, it deletes the symlink and tries again. pub fn makePath(dir: std.fs.Dir, sub_path: []const u8) !void { + if (comptime Environment.isWindows) { + @panic("TODO: Windows makePath"); + } var it = try std.fs.path.componentIterator(sub_path); var component = it.last() orelse return; while (true) { @@ -1920,9 +1971,8 @@ pub fn makePath(dir: std.fs.Dir, sub_path: []const u8) !void { path_buf2[component.path.len] = 0; var path_to_use = path_buf2[0..component.path.len :0]; - const result = sys.lstat(path_to_use); - try result.throw(); - const is_dir = std.os.S.ISDIR(result.result.mode); + const result = try sys.lstat(path_to_use).unwrap(); + const is_dir = std.os.S.ISDIR(result.mode); // dangling symlink if (!is_dir) { dir.deleteTree(component.path) catch {}; @@ -1938,3 +1988,5 @@ pub fn makePath(dir: std.fs.Dir, sub_path: []const u8) !void { component = it.next() orelse return; } } + +pub const Async = @import("async"); diff --git a/src/bundler/bundle_v2.zig b/src/bundler/bundle_v2.zig index e5b73814c5bf0..8e145aa34465e 100644 --- a/src/bundler/bundle_v2.zig +++ b/src/bundler/bundle_v2.zig @@ -94,7 +94,7 @@ const Router = @import("../router.zig"); const isPackagePath = _resolver.isPackagePath; const Lock = @import("../lock.zig").Lock; const NodeFallbackModules = @import("../node_fallbacks.zig"); -const CacheEntry = @import("../cache.zig").FsCacheEntry; +const CacheEntry = @import("../cache.zig").Fs.Entry; const Analytics = @import("../analytics/analytics_thread.zig"); const URL = @import("../url.zig").URL; const Report = @import("../report.zig"); @@ -126,6 +126,7 @@ const Scope = js_ast.Scope; const JSC = bun.JSC; const debugTreeShake = Output.scoped(.TreeShake, true); const BitSet = bun.bit_set.DynamicBitSetUnmanaged; +const Async = bun.Async; fn tracer(comptime src: std.builtin.SourceLocation, comptime name: [*:0]const u8) bun.tracy.Ctx { return bun.tracy.traceNamed(src, "Bundler." ++ name); @@ -1136,7 +1137,7 @@ pub const BundleV2 = struct { .jsc_event_loop = event_loop, .promise = JSC.JSPromise.Strong.init(globalThis), .globalThis = globalThis, - .poll_ref = JSC.PollRef.init(), + .poll_ref = Async.KeepAlive.init(), .env = globalThis.bunVM().bundler.env, .plugins = plugins, .log = Logger.Log.init(bun.default_allocator), @@ -1163,7 +1164,7 @@ pub const BundleV2 = struct { thread.detach(); } else { BundleThread.instance.queue.push(completion); - BundleThread.instance.waker.wake() catch {}; + BundleThread.instance.waker.wake(); } completion.poll_ref.ref(globalThis.bunVM()); @@ -1181,7 +1182,7 @@ pub const BundleV2 = struct { task: bun.JSC.AnyTask, globalThis: *JSC.JSGlobalObject, promise: JSC.JSPromise.Strong, - poll_ref: JSC.PollRef = JSC.PollRef.init(), + poll_ref: Async.KeepAlive = Async.KeepAlive.init(), env: *bun.DotEnv.Loader, log: Logger.Log, @@ -1566,7 +1567,7 @@ pub const BundleV2 = struct { if (any) { bun.Mimalloc.mi_collect(false); } - _ = instance.waker.wait() catch 0; + _ = instance.waker.wait(); } } @@ -2557,7 +2558,7 @@ pub const ParseTask = struct { const will_close_file_descriptor = task.contents_or_fd == .fd and entry.fd > 2 and this.ctx.bun_watcher == null; if (will_close_file_descriptor) { - _ = bun.sys.close(entry.fd); + _ = entry.closeFD(); } if (!will_close_file_descriptor and entry.fd > 2) task.contents_or_fd = .{ diff --git a/src/bundler/entry_points.zig b/src/bundler/entry_points.zig index 9101cef081ba5..43972307da1be 100644 --- a/src/bundler/entry_points.zig +++ b/src/bundler/entry_points.zig @@ -183,29 +183,16 @@ pub const ServerEntryPoint = struct { entry: *ServerEntryPoint, allocator: std.mem.Allocator, is_hot_reload_enabled: bool, - original_path: Fs.PathName, + path_to_use: string, name: string, ) !void { - - // This is *extremely* naive. - // The basic idea here is this: - // -- - // import * as EntryPoint from 'entry-point'; - // import boot from 'framework'; - // boot(EntryPoint); - // -- - // We go through the steps of printing the code -- only to then parse/transpile it because - // we want it to go through the linker and the rest of the transpilation process - - const dir_to_use: string = original_path.dirWithTrailingSlash(); - const code = brk: { if (is_hot_reload_enabled) { break :brk try std.fmt.allocPrint( allocator, \\// @bun \\var hmrSymbol = Symbol.for("BunServerHMR"); - \\import * as start from "{}{}"; + \\import * as start from '{}'; \\var entryNamespace = start; \\if (typeof entryNamespace?.then === 'function') {{ \\ entryNamespace = entryNamespace.then((entryNamespace) => {{ @@ -231,15 +218,14 @@ pub const ServerEntryPoint = struct { \\ , .{ - QuoteEscapeFormat{ .data = dir_to_use }, - QuoteEscapeFormat{ .data = original_path.filename }, + QuoteEscapeFormat{ .data = path_to_use }, }, ); } break :brk try std.fmt.allocPrint( allocator, \\// @bun - \\import * as start from "{}{}"; + \\import * as start from "{}"; \\var entryNamespace = start; \\if (typeof entryNamespace?.then === 'function') {{ \\ entryNamespace = entryNamespace.then((entryNamespace) => {{ @@ -253,8 +239,7 @@ pub const ServerEntryPoint = struct { \\ , .{ - QuoteEscapeFormat{ .data = dir_to_use }, - QuoteEscapeFormat{ .data = original_path.filename }, + QuoteEscapeFormat{ .data = path_to_use }, }, ); }; diff --git a/src/c.zig b/src/c.zig index 639b18f256b40..b3da68a0cc07d 100644 --- a/src/c.zig +++ b/src/c.zig @@ -388,6 +388,16 @@ const LazyStatus = enum { failed, }; +fn _dlsym(handle: ?*anyopaque, name: [:0]const u8) ?*anyopaque { + if (comptime Environment.isWindows) { + return bun.windows.GetProcAddressA(handle, name); + } else if (comptime Environment.isMac or Environment.isLinux) { + return std.c.dlsym(handle, name.ptr); + } + + return bun.todo(@src(), null); +} + pub fn dlsymWithHandle(comptime Type: type, comptime name: [:0]const u8, comptime handle_getter: fn () ?*anyopaque) ?Type { if (comptime @typeInfo(Type) != .Pointer) { @compileError("dlsym must be a pointer type (e.g. ?const *fn()). Received " ++ @typeName(Type) ++ "."); @@ -399,7 +409,7 @@ pub fn dlsymWithHandle(comptime Type: type, comptime name: [:0]const u8, comptim }; if (Wrapper.loaded == .pending) { - const result = std.c.dlsym(@call(.always_inline, handle_getter, .{}), name); + const result = _dlsym(@call(.always_inline, handle_getter, .{}), name); if (result) |ptr| { Wrapper.function = bun.cast(Type, ptr); @@ -442,3 +452,11 @@ pub extern fn memmove(dest: [*]u8, src: [*]const u8, n: usize) void; // https://man7.org/linux/man-pages/man3/fmod.3.html pub extern fn fmod(f64, f64) f64; + +pub fn dlopen(filename: [:0]const u8, flags: i32) ?*anyopaque { + if (comptime Environment.isWindows) { + return bun.windows.LoadLibraryA(filename); + } + + return std.c.dlopen(filename, flags); +} diff --git a/src/cache.zig b/src/cache.zig index 56d91618dc65b..81b98838bf32e 100644 --- a/src/cache.zig +++ b/src/cache.zig @@ -26,18 +26,6 @@ const import_record = @import("./import_record.zig"); const ImportRecord = import_record.ImportRecord; -pub const FsCacheEntry = struct { - contents: string, - fd: StoredFileDescriptorType = 0, - - pub fn deinit(entry: *FsCacheEntry, allocator: std.mem.Allocator) void { - if (entry.contents.len > 0) { - allocator.free(entry.contents); - entry.contents = ""; - } - } -}; - pub const Set = struct { js: JavaScript, fs: Fs, @@ -56,7 +44,27 @@ pub const Set = struct { }; const debug = Output.scoped(.fs, false); pub const Fs = struct { - const Entry = FsCacheEntry; + pub const Entry = struct { + contents: string, + fd: StoredFileDescriptorType = bun.invalid_fd, + + pub fn deinit(entry: *Entry, allocator: std.mem.Allocator) void { + if (entry.contents.len > 0) { + allocator.free(entry.contents); + entry.contents = ""; + } + } + + pub fn closeFD(entry: *Entry) ?bun.sys.Error { + if (entry.fd != bun.invalid_fd) { + defer { + entry.fd = bun.invalid_fd; + } + return bun.sys.close(entry.fd); + } + return null; + } + }; shared_buffer: MutableString, macro_shared_buffer: MutableString, @@ -207,7 +215,7 @@ pub const Fs = struct { return Entry{ .contents = file.contents, - .fd = if (FeatureFlags.store_file_descriptors and !will_close) file_handle.handle else 0, + .fd = if (FeatureFlags.store_file_descriptors and !will_close) file_handle.handle else bun.invalid_fd, }; } }; diff --git a/src/cli.zig b/src/cli.zig index 24e142eb9e23e..18289732b89f5 100644 --- a/src/cli.zig +++ b/src/cli.zig @@ -145,7 +145,7 @@ pub const Arguments = struct { var paths = [_]string{ cwd, filename }; const outpath = try std.fs.path.resolve(allocator, &paths); defer allocator.free(outpath); - var file = try std.fs.openFileAbsolute(outpath, std.fs.File.OpenFlags{ .mode = .read_only }); + var file = try bun.openFileZ(&try std.os.toPosixPath(outpath), std.fs.File.OpenFlags{ .mode = .read_only }); defer file.close(); const size = try file.getEndPos(); return try file.readToEndAlloc(allocator, size); @@ -267,16 +267,18 @@ pub const Arguments = struct { } pub fn loadConfigPath(allocator: std.mem.Allocator, auto_loaded: bool, config_path: [:0]const u8, ctx: *Command.Context, comptime cmd: Command.Tag) !void { - var config_file = std.fs.File{ - .handle = std.os.openZ(config_path, std.os.O.RDONLY, 0) catch |err| { + var config_file = switch (bun.sys.openA(config_path, std.os.O.RDONLY, 0)) { + .result => |fd| std.fs.File{ .handle = bun.fdcast(fd) }, + .err => |err| { if (auto_loaded) return; - Output.prettyErrorln("error: {s} opening config \"{s}\"", .{ - @errorName(err), + Output.prettyErrorln("{}\nwhile opening config \"{s}\"", .{ + err, config_path, }); Global.exit(1); }, }; + defer config_file.close(); var contents = config_file.readToEndAlloc(allocator, std.math.maxInt(usize)) catch |err| { if (auto_loaded) return; @@ -302,7 +304,7 @@ pub const Arguments = struct { } fn getHomeConfigPath(buf: *[bun.MAX_PATH_BYTES]u8) ?[:0]const u8 { - if (bun.getenvZ("XDG_CONFIG_HOME") orelse bun.getenvZ("HOME")) |data_dir| { + if (bun.getenvZ("XDG_CONFIG_HOME") orelse bun.getenvZ(bun.DotEnv.home_env)) |data_dir| { var paths = [_]string{".bunfig.toml"}; return resolve_path.joinAbsStringBufZ(data_dir, buf, &paths, .auto); } @@ -348,9 +350,11 @@ pub const Arguments = struct { } else { if (ctx.args.absolute_working_dir == null) { var secondbuf: [bun.MAX_PATH_BYTES]u8 = undefined; - var cwd = std.os.getcwd(&secondbuf) catch return; + var cwd = bun.getcwd(&secondbuf) catch return; + ctx.args.absolute_working_dir = try allocator.dupe(u8, cwd); } + var parts = [_]string{ ctx.args.absolute_working_dir.?, config_path_ }; config_path_ = resolve_path.joinAbsStringBuf( ctx.args.absolute_working_dir.?, @@ -412,7 +416,7 @@ pub const Arguments = struct { break :brk try allocator.dupe(u8, out); }; } else { - cwd = try std.process.getCwdAlloc(allocator); + cwd = try bun.getcwdAlloc(allocator); } if (cmd == .TestCommand) { @@ -1255,29 +1259,33 @@ pub const Command = struct { // _ = BunxCommand; } - if (try bun.StandaloneModuleGraph.fromExecutable(bun.default_allocator)) |graph| { - var ctx = Command.Context{ - .args = std.mem.zeroes(Api.TransformOptions), - .log = log, - .start_time = start_time, - .allocator = bun.default_allocator, - }; + // there's a bug with openSelfExe() on Windows + if (comptime !bun.Environment.isWindows) { + // bun build --compile entry point + if (try bun.StandaloneModuleGraph.fromExecutable(bun.default_allocator)) |graph| { + var ctx = Command.Context{ + .args = std.mem.zeroes(Api.TransformOptions), + .log = log, + .start_time = start_time, + .allocator = bun.default_allocator, + }; - ctx.args.target = Api.Target.bun; - var argv = try bun.default_allocator.alloc(string, bun.argv().len -| 1); - if (bun.argv().len > 1) { - for (argv, bun.argv()[1..]) |*dest, src| { - dest.* = bun.span(src); + ctx.args.target = Api.Target.bun; + var argv = try bun.default_allocator.alloc(string, bun.argv().len -| 1); + if (bun.argv().len > 1) { + for (argv, bun.argv()[1..]) |*dest, src| { + dest.* = bun.span(src); + } } - } - ctx.passthrough = argv; + ctx.passthrough = argv; - try @import("./bun_js.zig").Run.bootStandalone( - ctx, - graph.entryPoint().name, - graph, - ); - return; + try @import("./bun_js.zig").Run.bootStandalone( + ctx, + graph.entryPoint().name, + graph, + ); + return; + } } const tag = which(); @@ -1703,27 +1711,20 @@ pub const Command = struct { const script_name_to_search = ctx.args.entry_points[0]; var file_path = script_name_to_search; - const file_: std.fs.File.OpenError!std.fs.File = brk: { - if (script_name_to_search[0] == std.fs.path.sep) { - break :brk std.fs.openFileAbsolute(script_name_to_search, .{ .mode = .read_only }); + const file_: anyerror!std.fs.File = brk: { + if (std.fs.path.isAbsoluteWindows(script_name_to_search)) { + break :brk bun.openFile(script_name_to_search, .{ .mode = .read_only }); } else if (!strings.hasPrefix(script_name_to_search, "..") and script_name_to_search[0] != '~') { const file_pathZ = brk2: { - if (!strings.hasPrefix(file_path, "./")) { - script_name_buf[0..2].* = "./".*; - @memcpy(script_name_buf[2..][0..file_path.len], file_path); - script_name_buf[file_path.len + 2] = 0; - break :brk2 script_name_buf[0 .. file_path.len + 2 :0]; - } else { - @memcpy(script_name_buf[0..file_path.len], file_path); - script_name_buf[file_path.len] = 0; - break :brk2 script_name_buf[0..file_path.len :0]; - } + @memcpy(script_name_buf[0..file_path.len], file_path); + script_name_buf[file_path.len] = 0; + break :brk2 script_name_buf[0..file_path.len :0]; }; - break :brk std.fs.cwd().openFileZ(file_pathZ, .{ .mode = .read_only }); + break :brk bun.openFileZ(file_pathZ, .{ .mode = .read_only }); } else { var path_buf: [bun.MAX_PATH_BYTES]u8 = undefined; - const cwd = std.os.getcwd(&path_buf) catch return false; + const cwd = bun.getcwd(&path_buf) catch return false; path_buf[cwd.len] = std.fs.path.sep; var parts = [_]string{script_name_to_search}; file_path = resolve_path.joinAbsStringBuf( @@ -1735,7 +1736,7 @@ pub const Command = struct { if (file_path.len == 0) return false; script_name_buf[file_path.len] = 0; var file_pathZ = script_name_buf[0..file_path.len :0]; - break :brk std.fs.openFileAbsoluteZ(file_pathZ, .{ .mode = .read_only }); + break :brk bun.openFileZ(file_pathZ, .{ .mode = .read_only }); } }; diff --git a/src/cli/create_command.zig b/src/cli/create_command.zig index f95d8efff166e..cac4d296dedf1 100644 --- a/src/cli/create_command.zig +++ b/src/cli/create_command.zig @@ -602,7 +602,12 @@ pub const CreateCommand = struct { { var parent_dir = try std.fs.openDirAbsolute(destination, .{}); defer parent_dir.close(); - std.os.linkat(parent_dir.fd, "gitignore", parent_dir.fd, ".gitignore", 0) catch {}; + if (comptime Environment.isWindows) { + try parent_dir.copyFile("gitignore", parent_dir, ".gitignore", .{}); + } else { + std.os.linkat(parent_dir.fd, "gitignore", parent_dir.fd, ".gitignore", 0) catch {}; + } + std.os.unlinkat( parent_dir.fd, "gitignore", @@ -1755,7 +1760,7 @@ pub const Example = struct { folders[1] = std.fs.cwd().openIterableDir(outdir_path, .{}) catch .{ .dir = .{ .fd = bun.fdcast(bun.invalid_fd) } }; } - if (env_loader.map.get("HOME")) |home_dir| { + if (env_loader.map.get(bun.DotEnv.home_env)) |home_dir| { var parts = [_]string{ home_dir, BUN_CREATE_DIR }; var outdir_path = filesystem.absBuf(&parts, &home_dir_buf); folders[2] = std.fs.cwd().openIterableDir(outdir_path, .{}) catch .{ .dir = .{ .fd = bun.fdcast(bun.invalid_fd) } }; @@ -2194,7 +2199,7 @@ pub const CreateListExamplesCommand = struct { Output.prettyln("# You can also paste a GitHub repository:\n\n bun create ahfarmer/calculator calc\n\n", .{}); - if (env_loader.map.get("HOME")) |homedir| { + if (env_loader.map.get(bun.DotEnv.home_env)) |homedir| { Output.prettyln( "This command is completely optional. To add a new local template, create a folder in {s}/.bun-create/. To publish a new template, git clone https://github.com/oven-sh/bun, add a new folder to the \"examples\" folder, and submit a PR.", .{homedir}, diff --git a/src/cli/init_command.zig b/src/cli/init_command.zig index ed9a0047738d1..bc0aad069c3c7 100644 --- a/src/cli/init_command.zig +++ b/src/cli/init_command.zig @@ -23,19 +23,7 @@ const logger = @import("root").bun.logger; const JSPrinter = bun.js_printer; fn exists(path: anytype) bool { - if (@TypeOf(path) == [:0]const u8 or @TypeOf(path) == [:0]u8) { - if (std.os.accessZ(path, 0)) { - return true; - } else |_| { - return false; - } - } else { - if (std.os.access(path, 0)) { - return true; - } else |_| { - return false; - } - } + return bun.sys.exists(path); } pub const InitCommand = struct { fn prompt( @@ -210,7 +198,7 @@ pub const InitCommand = struct { ).data.e_object; } - const auto_yes = brk: { + const auto_yes = Output.stdout_descriptor_type != .terminal or brk: { for (argv) |arg_| { const arg = bun.span(arg_); if (strings.eqlComptime(arg, "-y") or strings.eqlComptime(arg, "--yes")) { @@ -395,7 +383,7 @@ pub const InitCommand = struct { defer file.close(); file.writer().print(README, .{ .name = fields.name, - .bunVersion = Global.version.fmt(""), + .bunVersion = Environment.version_string, .entryPoint = fields.entry_point, }) catch break :brk; Output.prettyln(" + {s}", .{filename}); @@ -425,9 +413,9 @@ pub const InitCommand = struct { }, alloc, ); - process.stderr_behavior = .Pipe; - process.stdin_behavior = .Pipe; - process.stdout_behavior = .Pipe; + process.stderr_behavior = .Ignore; + process.stdin_behavior = .Ignore; + process.stdout_behavior = .Ignore; _ = try process.spawnAndWait(); } } diff --git a/src/cli/install_command.zig b/src/cli/install_command.zig index 6c441b859d076..1c32d775db6eb 100644 --- a/src/cli/install_command.zig +++ b/src/cli/install_command.zig @@ -1,8 +1,14 @@ const Command = @import("../cli.zig").Command; +const bun = @import("root").bun; const PackageManager = @import("../install/install.zig").PackageManager; pub const InstallCommand = struct { pub fn exec(ctx: Command.Context) !void { + if (bun.FeatureFlags.disable_on_windows_due_to_bugs and !bun.Environment.allow_assert) { + bun.Output.prettyErrorln("install is not supported on Windows yet, sorry!!", .{}); + bun.Global.exit(1); + } + try PackageManager.install(ctx); } }; diff --git a/src/cli/install_completions_command.zig b/src/cli/install_completions_command.zig index 1d67a7b39aa60..9eb253b90af10 100644 --- a/src/cli/install_completions_command.zig +++ b/src/cli/install_completions_command.zig @@ -72,7 +72,7 @@ pub const InstallCompletionsCommand = struct { // if that fails, try $HOME/.bun/bin outer: { - if (bun.getenvZ("HOME")) |home_dir| { + if (bun.getenvZ(bun.DotEnv.home_env)) |home_dir| { target = std.fmt.bufPrint(&target_buf, "{s}/.bun/bin/" ++ bunx_name, .{home_dir}) catch unreachable; std.os.symlink(exe, target) catch break :outer; return; @@ -81,7 +81,7 @@ pub const InstallCompletionsCommand = struct { // if that fails, try $HOME/.local/bin outer: { - if (bun.getenvZ("HOME")) |home_dir| { + if (bun.getenvZ(bun.DotEnv.home_env)) |home_dir| { target = std.fmt.bufPrint(&target_buf, "{s}/.local/bin/" ++ bunx_name, .{home_dir}) catch unreachable; std.os.symlink(exe, target) catch break :outer; return; @@ -106,7 +106,7 @@ pub const InstallCompletionsCommand = struct { shell = ShellCompletions.Shell.fromEnv(@TypeOf(shell_name), shell_name); } - var cwd = std.os.getcwd(&cwd_buf) catch { + var cwd = bun.getcwd(&cwd_buf) catch { // don't fail on this if we don't actually need to if (fail_exit_code == 1) { if (!stdout.isTty()) { @@ -189,7 +189,7 @@ pub const InstallCompletionsCommand = struct { } } - if (bun.getenvZ("HOME")) |home_dir| { + if (bun.getenvZ(bun.DotEnv.home_env)) |home_dir| { outer: { var paths = [_]string{ home_dir, "./.config/fish/completions" }; completions_dir = resolve_path.joinAbsString(cwd, &paths, .auto); @@ -247,7 +247,7 @@ pub const InstallCompletionsCommand = struct { } } - if (bun.getenvZ("HOME")) |home_dir| { + if (bun.getenvZ(bun.DotEnv.home_env)) |home_dir| { { outer: { var paths = [_]string{ home_dir, "./.oh-my-zsh/completions" }; @@ -299,7 +299,7 @@ pub const InstallCompletionsCommand = struct { } } - if (bun.getenvZ("HOME")) |home_dir| { + if (bun.getenvZ(bun.DotEnv.home_env)) |home_dir| { { outer: { var paths = [_]string{ home_dir, "./.oh-my-bash/custom/completions" }; @@ -409,7 +409,7 @@ pub const InstallCompletionsCommand = struct { } second: { - if (bun.getenvZ("HOME")) |zdot_dir| { + if (bun.getenvZ(bun.DotEnv.home_env)) |zdot_dir| { bun.copy(u8, &zshrc_filepath, zdot_dir); bun.copy(u8, zshrc_filepath[zdot_dir.len..], "/.zshrc"); zshrc_filepath[zdot_dir.len + "/.zshrc".len] = 0; @@ -419,7 +419,7 @@ pub const InstallCompletionsCommand = struct { } third: { - if (bun.getenvZ("HOME")) |zdot_dir| { + if (bun.getenvZ(bun.DotEnv.home_env)) |zdot_dir| { bun.copy(u8, &zshrc_filepath, zdot_dir); bun.copy(u8, zshrc_filepath[zdot_dir.len..], "/.zshenv"); zshrc_filepath[zdot_dir.len + "/.zshenv".len] = 0; diff --git a/src/cli/package_manager_command.zig b/src/cli/package_manager_command.zig index d9b2b82e7d2db..91f33f1273deb 100644 --- a/src/cli/package_manager_command.zig +++ b/src/cli/package_manager_command.zig @@ -208,7 +208,7 @@ pub const PackageManagerCommand = struct { try printNodeModulesFolderStructure(&first_directory, null, 0, &directories, lockfile, more_packages); } else { var cwd_buf: [bun.MAX_PATH_BYTES]u8 = undefined; - const path = std.os.getcwd(&cwd_buf) catch { + const path = bun.getcwd(&cwd_buf) catch { Output.prettyErrorln("error: Could not get current working directory", .{}); Global.exit(1); }; @@ -353,7 +353,7 @@ fn printNodeModulesFolderStructure( } } else { var cwd_buf: [bun.MAX_PATH_BYTES]u8 = undefined; - const path = std.os.getcwd(&cwd_buf) catch { + const path = bun.getcwd(&cwd_buf) catch { Output.prettyErrorln("error: Could not get current working directory", .{}); Global.exit(1); }; diff --git a/src/cli/run_command.zig b/src/cli/run_command.zig index 19046e29271e3..391e5c02ad69b 100644 --- a/src/cli/run_command.zig +++ b/src/cli/run_command.zig @@ -925,24 +925,25 @@ pub const RunCommand = struct { } var file_path = script_name_to_search; - - const file_: std.fs.File.OpenError!std.fs.File = brk: { - if (script_name_to_search[0] == std.fs.path.sep) { - break :brk std.fs.openFileAbsolute(script_name_to_search, .{ .mode = .read_only }); + var must_normalize = false; + const file_: anyerror!std.fs.File = brk: { + if (std.fs.path.isAbsolute(script_name_to_search)) { + must_normalize = Environment.isWindows; + break :brk bun.openFile(script_name_to_search, .{ .mode = .read_only }); } else { - const cwd = std.os.getcwd(&path_buf) catch break :possibly_open_with_bun_js; - path_buf[cwd.len] = std.fs.path.sep; + const cwd = bun.getcwd(&path_buf) catch break :possibly_open_with_bun_js; + path_buf[cwd.len] = std.fs.path.sep_posix; var parts = [_]string{script_name_to_search}; file_path = resolve_path.joinAbsStringBuf( path_buf[0 .. cwd.len + 1], &path_buf2, &parts, - .auto, + .loose, ); if (file_path.len == 0) break :possibly_open_with_bun_js; path_buf2[file_path.len] = 0; var file_pathZ = path_buf2[0..file_path.len :0]; - break :brk std.fs.openFileAbsoluteZ(file_pathZ, .{ .mode = .read_only }); + break :brk bun.openFileZ(file_pathZ, .{ .mode = .read_only }); } }; @@ -984,7 +985,13 @@ pub const RunCommand = struct { } Global.configureAllocator(.{ .long_running = true }); - Run.boot(ctx, ctx.allocator.dupe(u8, file_path) catch unreachable) catch |err| { + var out_path = ctx.allocator.dupe(u8, file_path) catch unreachable; + if (must_normalize) { + if (comptime Environment.isWindows) { + std.mem.replaceScalar(u8, out_path, std.fs.path.sep_windows, std.fs.path.sep_posix); + } + } + Run.boot(ctx, out_path) catch |err| { if (Output.enable_ansi_colors) { ctx.log.printForLogLevelWithEnableAnsiColors(Output.errorWriter(), true) catch {}; } else { diff --git a/src/cli/upgrade_command.zig b/src/cli/upgrade_command.zig index d865d990d5de4..0103c7d4c162b 100644 --- a/src/cli/upgrade_command.zig +++ b/src/cli/upgrade_command.zig @@ -78,7 +78,13 @@ pub const Version = struct { return this.tag["bun-v".len..]; } - pub const platform_label = if (Environment.isMac) "darwin" else "linux"; + pub const platform_label = switch (Environment.os) { + .mac => "darwin", + .linux => "linux", + .windows => "windows", + else => @compileError("Unsupported OS for Bun Upgrade"), + }; + pub const arch_label = if (Environment.isAarch64) "aarch64" else "x64"; pub const triplet = platform_label ++ "-" ++ arch_label; const suffix = if (Environment.baseline) "-baseline" else ""; @@ -138,7 +144,7 @@ pub const UpgradeCheckerThread = struct { if (!version.isCurrent()) { if (version.name()) |name| { - Output.prettyErrorln("\nbun v{s} is out. Run bun upgrade to upgrade.\n", .{name}); + Output.prettyErrorln("\nBun v{s} is out. Run bun upgrade to upgrade.\n", .{name}); Output.flush(); } } @@ -378,7 +384,7 @@ pub const UpgradeCommand = struct { progress.end(); refresher.refresh(); if (version.name()) |name| { - Output.prettyErrorln("bun v{s} is out, but not for this platform ({s}) yet.", .{ + Output.prettyErrorln("Bun v{s} is out, but not for this platform ({s}) yet.", .{ name, Version.triplet, }); } @@ -395,7 +401,14 @@ pub const UpgradeCommand = struct { @setCold(true); _exec(ctx) catch |err| { - Output.prettyErrorln("bun upgrade failed with error: {s}\n\nPlease upgrade manually:\n curl -fsSL https://bun.sh/install | bash\n\n", .{@errorName(err)}); + Output.prettyErrorln( + \\Bun upgrade failed with error: {s} + \\ + \\Please upgrade manually: + \\ curl -fsSL https://bun.sh/install | bash + \\ + \\ + , .{@errorName(err)}); Global.exit(1); }; } @@ -435,25 +448,31 @@ pub const UpgradeCommand = struct { progress.end(); refresher.refresh(); - if (version.name() != null and version.isCurrent()) { - Output.prettyErrorln( - "Congrats! You're already on the latest version of bun (which is v{s})", - .{ - version.name().?, - }, - ); - Global.exit(0); + if (!Environment.is_canary) { + if (version.name() != null and version.isCurrent()) { + Output.prettyErrorln( + "Congrats! You're already on the latest version of Bun (which is v{s})", + .{ + version.name().?, + }, + ); + Global.exit(0); + } } if (version.name() == null) { Output.prettyErrorln( - "error: bun versions are currently unavailable (the latest version name didn't match the expeccted format)", + "error: Bun versions are currently unavailable (the latest version name didn't match the expeccted format)", .{}, ); Global.exit(1); } - Output.prettyErrorln("bun v{s} is out! You're on {s}\n", .{ version.name().?, Global.package_json_version }); + if (!Environment.is_canary) { + Output.prettyErrorln("Bun v{s} is out! You're on {s}\n", .{ version.name().?, Global.package_json_version }); + } else { + Output.prettyErrorln("Downgrading from Bun {s}-canary to Bun v{s}\n", .{ Global.package_json_version, version.name().? }); + } Output.flush(); } else { version = Version{ @@ -524,7 +543,7 @@ pub const UpgradeCommand = struct { refresher.refresh(); if (bytes.len == 0) { - Output.prettyErrorln("error: Failed to download the latest version of bun. Received empty content", .{}); + Output.prettyErrorln("error: Failed to download the latest version of Bun. Received empty content", .{}); Global.exit(1); } @@ -568,39 +587,79 @@ pub const UpgradeCommand = struct { save_dir.deleteFileZ(tmpname) catch {}; } - const unzip_exe = which(&unzip_path_buf, env_loader.map.get("PATH") orelse "", filesystem.top_level_dir, "unzip") orelse { - save_dir.deleteFileZ(tmpname) catch {}; - Output.prettyErrorln("error: Failed to locate \"unzip\" in PATH. bun upgrade needs \"unzip\" to work.", .{}); - Global.exit(1); - }; - - // We could just embed libz2 - // however, we want to be sure that xattrs are preserved - // xattrs are used for codesigning - // it'd be easy to mess that up - var unzip_argv = [_]string{ - bun.asByteSlice(unzip_exe), - "-q", - "-o", - tmpname, - }; - - var unzip_process = std.ChildProcess.init(&unzip_argv, ctx.allocator); - unzip_process.cwd = tmpdir_path; - unzip_process.stdin_behavior = .Inherit; - unzip_process.stdout_behavior = .Inherit; - unzip_process.stderr_behavior = .Inherit; + if (comptime Environment.isPosix) { + const unzip_exe = which(&unzip_path_buf, env_loader.map.get("PATH") orelse "", filesystem.top_level_dir, "unzip") orelse { + save_dir.deleteFileZ(tmpname) catch {}; + Output.prettyErrorln("error: Failed to locate \"unzip\" in PATH. bun upgrade needs \"unzip\" to work.", .{}); + Global.exit(1); + }; + + // We could just embed libz2 + // however, we want to be sure that xattrs are preserved + // xattrs are used for codesigning + // it'd be easy to mess that up + var unzip_argv = [_]string{ + bun.asByteSlice(unzip_exe), + "-q", + "-o", + tmpname, + }; + + var unzip_process = std.ChildProcess.init(&unzip_argv, ctx.allocator); + unzip_process.cwd = tmpdir_path; + unzip_process.stdin_behavior = .Inherit; + unzip_process.stdout_behavior = .Inherit; + unzip_process.stderr_behavior = .Inherit; + + const unzip_result = unzip_process.spawnAndWait() catch |err| { + save_dir.deleteFileZ(tmpname) catch {}; + Output.prettyErrorln("error: Failed to spawn unzip due to {s}.", .{@errorName(err)}); + Global.exit(1); + }; - const unzip_result = unzip_process.spawnAndWait() catch |err| { - save_dir.deleteFileZ(tmpname) catch {}; - Output.prettyErrorln("error: Failed to spawn unzip due to {s}.", .{@errorName(err)}); - Global.exit(1); - }; + if (unzip_result.Exited != 0) { + Output.prettyErrorln("Unzip failed (exit code: {d})", .{unzip_result.Exited}); + save_dir.deleteFileZ(tmpname) catch {}; + Global.exit(1); + } + } else if (Environment.isWindows) { + // Run a powershell script to unzip the file + var unzip_script = try std.fmt.allocPrint( + ctx.allocator, + "Expand-Archive -Path {s} -DestinationPath {s} -Force", + .{ + tmpname, + tmpdir_path, + }, + ); + + var unzip_argv = [_]string{ + "powershell.exe", + "-NoProfile", + "-ExecutionPolicy", + "Bypass", + "-Command", + unzip_script, + }; + + var unzip_process = std.ChildProcess.init(&unzip_argv, ctx.allocator); + + unzip_process.cwd = tmpdir_path; + unzip_process.stdin_behavior = .Inherit; + unzip_process.stdout_behavior = .Inherit; + unzip_process.stderr_behavior = .Inherit; + + const unzip_result = unzip_process.spawnAndWait() catch |err| { + save_dir.deleteFileZ(tmpname) catch {}; + Output.prettyErrorln("error: Failed to spawn unzip due to {s}.", .{@errorName(err)}); + Global.exit(1); + }; - if (unzip_result.Exited != 0) { - Output.prettyErrorln("Unzip failed (exit code: {d})", .{unzip_result.Exited}); - save_dir.deleteFileZ(tmpname) catch {}; - Global.exit(1); + if (unzip_result.Exited != 0) { + Output.prettyErrorln("Unzip failed (exit code: {d})", .{unzip_result.Exited}); + save_dir.deleteFileZ(tmpname) catch {}; + Global.exit(1); + } } } { @@ -609,20 +668,20 @@ pub const UpgradeCommand = struct { "--version", }; - const result = std.ChildProcess.exec(.{ + const result = std.ChildProcess.run(.{ .allocator = ctx.allocator, .argv = &verify_argv, .cwd = tmpdir_path, .max_output_bytes = 512, }) catch |err| { save_dir_.deleteTree(version_name) catch {}; - Output.prettyErrorln("error Failed to verify bun {s})", .{@errorName(err)}); + Output.prettyErrorln("error Failed to verify Bun {s})", .{@errorName(err)}); Global.exit(1); }; if (result.term.Exited != 0) { save_dir_.deleteTree(version_name) catch {}; - Output.prettyErrorln("error failed to verify bun (exit code: {d})", .{result.term.Exited}); + Output.prettyErrorln("error failed to verify Bun (exit code: {d})", .{result.term.Exited}); Global.exit(1); } @@ -638,7 +697,7 @@ pub const UpgradeCommand = struct { save_dir_.deleteTree(version_name) catch {}; Output.prettyErrorln( - "error: The downloaded version of bun ({s}) doesn't match the expected version ({s}). Cancelled upgrade", + "error: The downloaded version of Bun ({s}) doesn't match the expected version ({s}). Cancelled upgrade", .{ version_string[0..@min(version_string.len, 512)], version_name, @@ -660,7 +719,7 @@ pub const UpgradeCommand = struct { var target_dirname = current_executable_buf[0..target_dir_.len :0]; var target_dir_it = std.fs.openIterableDirAbsoluteZ(target_dirname, .{}) catch |err| { save_dir_.deleteTree(version_name) catch {}; - Output.prettyErrorln("error: Failed to open bun's install directory {s}", .{@errorName(err)}); + Output.prettyErrorln("error: Failed to open Bun's install directory {s}", .{@errorName(err)}); Global.exit(1); }; var target_dir = target_dir_it.dir; @@ -670,13 +729,13 @@ pub const UpgradeCommand = struct { // Check if the versions are the same const target_stat = target_dir.statFile(target_filename) catch |err| { save_dir_.deleteTree(version_name) catch {}; - Output.prettyErrorln("error: Failed to stat target bun {s}", .{@errorName(err)}); + Output.prettyErrorln("error: Failed to stat target Bun {s}", .{@errorName(err)}); Global.exit(1); }; const dest_stat = save_dir.statFile(exe) catch |err| { save_dir_.deleteTree(version_name) catch {}; - Output.prettyErrorln("error: Failed to stat source bun {s}", .{@errorName(err)}); + Output.prettyErrorln("error: Failed to stat source Bun {s}", .{@errorName(err)}); Global.exit(1); }; @@ -685,20 +744,24 @@ pub const UpgradeCommand = struct { const target_hash = bun.hash(target_dir.readFile(target_filename, input_buf) catch |err| { save_dir_.deleteTree(version_name) catch {}; - Output.prettyErrorln("error: Failed to read target bun {s}", .{@errorName(err)}); + Output.prettyErrorln("error: Failed to read target Bun {s}", .{@errorName(err)}); Global.exit(1); }); const source_hash = bun.hash(save_dir.readFile(exe, input_buf) catch |err| { save_dir_.deleteTree(version_name) catch {}; - Output.prettyErrorln("error: Failed to read source bun {s}", .{@errorName(err)}); + Output.prettyErrorln("error: Failed to read source Bun {s}", .{@errorName(err)}); Global.exit(1); }); if (target_hash == source_hash) { save_dir_.deleteTree(version_name) catch {}; Output.prettyErrorln( - "Congrats! You're already on the latest canary build of bun", + \\Congrats! You're already on the latest canary build of Bun + \\ + \\To downgrade to the latest stable release, run bun upgrade --stable + \\ + , .{}, ); Global.exit(0); @@ -707,11 +770,20 @@ pub const UpgradeCommand = struct { } if (env_loader.map.get("BUN_DRY_RUN") == null) { - C.moveFileZ(save_dir.fd, exe, target_dir.fd, target_filename) catch |err| { - save_dir_.deleteTree(version_name) catch {}; - Output.prettyErrorln("error: Failed to move new version of bun due to {s}. You could try the install script instead:\n curl -fsSL https://bun.sh/install | bash", .{@errorName(err)}); - Global.exit(1); - }; + if (comptime Environment.isWindows) { + // On Windows, we cannot replace the running executable directly. + // we rename the old executable to a temporary name, and then move the new executable to the old name. + // This is because Windows locks the executable while it's running. + + // var tmpname = try std.fmt.allocPrint(ctx.allocator, "{s}.old.exe", .{target_filename}); + + } else { + C.moveFileZ(save_dir.fd, exe, target_dir.fd, target_filename) catch |err| { + save_dir_.deleteTree(version_name) catch {}; + Output.prettyErrorln("error: Failed to move new version of Bun due to {s}. You could try the install script instead:\n curl -fsSL https://bun.sh/install | bash", .{@errorName(err)}); + Global.exit(1); + }; + } } // Ensure completions are up to date. @@ -723,7 +795,7 @@ pub const UpgradeCommand = struct { env_loader.map.put("IS_BUN_AUTO_UPDATE", "true") catch unreachable; var buf_map = try env_loader.map.cloneToEnvMap(ctx.allocator); - _ = std.ChildProcess.exec(.{ + _ = std.ChildProcess.run(.{ .allocator = ctx.allocator, .argv = &completions_argv, .cwd = target_dirname, @@ -738,7 +810,7 @@ pub const UpgradeCommand = struct { Output.prettyErrorln( \\ Upgraded. \\ - \\Welcome to bun's latest canary build! + \\Welcome to Bun's latest canary build! \\ \\Report any bugs: \\ @@ -757,7 +829,7 @@ pub const UpgradeCommand = struct { Output.prettyErrorln( \\ Upgraded. \\ - \\Welcome to bun v{s}! + \\Welcome to Bun v{s}! \\ \\Report any bugs: \\ diff --git a/src/js/_codegen/builtin-parser.ts b/src/codegen/builtin-parser.ts similarity index 100% rename from src/js/_codegen/builtin-parser.ts rename to src/codegen/builtin-parser.ts diff --git a/src/js/_codegen/build-functions.ts b/src/codegen/bundle-functions.ts similarity index 91% rename from src/js/_codegen/build-functions.ts rename to src/codegen/bundle-functions.ts index 275cd2e1a0ba8..7b33d0dbb1661 100644 --- a/src/js/_codegen/build-functions.ts +++ b/src/codegen/bundle-functions.ts @@ -2,17 +2,31 @@ import { existsSync, mkdirSync, readdirSync, rmSync } from "fs"; import path from "path"; import { sliceSourceCode } from "./builtin-parser"; import { applyGlobalReplacements, define } from "./replacements"; -import { cap, fmtCPPString, low } from "./helpers"; +import { cap, fmtCPPString, low, writeIfNotChanged } from "./helpers"; +import { createInternalModuleRegistry } from "./internal-module-registry-scanner"; +import { createAssertClientJS, createLogClientJS } from "./client-js"; console.log("Bundling Bun builtin functions..."); -const MINIFY = process.argv.includes("--minify") || process.argv.includes("-m"); -const PARALLEL = process.argv.includes("--parallel") || process.argv.includes("-p"); -const KEEP_TMP = process.argv.includes("--keep-tmp") || process.argv.includes("-k") || true; +const PARALLEL = false; +const KEEP_TMP = true; -const SRC_DIR = path.join(import.meta.dir, "../builtins"); -const OUT_DIR = path.join(SRC_DIR, "../out"); -const TMP_DIR = path.join(SRC_DIR, "../out/tmp/builtins"); +const debug = process.argv[2] === "--debug=ON"; +const CMAKE_BUILD_ROOT = process.argv[3]; + +if (!CMAKE_BUILD_ROOT) { + console.error("Usage: bun bundle-functions.ts "); + process.exit(1); +} + +const SRC_DIR = path.join(import.meta.dir, "../js/builtins"); +const CODEGEN_DIR = path.join(CMAKE_BUILD_ROOT, "./codegen"); +const TMP_DIR = path.join(CMAKE_BUILD_ROOT, "./tmp_functions"); + +const { + // + requireTransformer, +} = createInternalModuleRegistry(path.join(import.meta.dir, "../js")); if (existsSync(TMP_DIR)) rmSync(TMP_DIR, { recursive: true }); mkdirSync(TMP_DIR, { recursive: true }); @@ -122,7 +136,7 @@ async function processFileSplit(filename: string): Promise<{ functions: BundledB } const { result, rest } = sliceSourceCode(contents.slice(declaration[0].length - 1), true, x => - globalThis.requireTransformer(x, SRC_DIR + "/" + basename), + requireTransformer(x, SRC_DIR + "/" + basename), ); functions.push({ @@ -179,11 +193,20 @@ $$capture_start$$(${fn.async ? "async " : ""}${ throw new Error("expected one output"); } const output = await build.outputs[0].text(); + let usesDebug = output.includes("$debug_log"); + let usesAssert = output.includes("$assert"); const captured = output.match(/\$\$capture_start\$\$([\s\S]+)\.\$\$capture_end\$\$/)![1]; const finalReplacement = - (fn.directives.sloppy ? captured : captured.replace(/function\s*\(.*?\)\s*{/, '$&"use strict";')) + (fn.directives.sloppy + ? captured + : captured.replace( + /function\s*\(.*?\)\s*{/, + '$&"use strict";' + + (usesDebug ? createLogClientJS("BUILTINS", fn.name) : "") + + (usesAssert ? createAssertClientJS(fn.name) : ""), + ) + ) .replace(/^\((async )?function\(/, "($1function (") - // .replace(/__intrinsic__lazy\(/g, "globalThis[globalThis.Symbol.for('Bun.lazy')](") .replace(/__intrinsic__/g, "@") + "\n"; bundledFunctions.push({ @@ -240,8 +263,7 @@ if (PARALLEL) { } // C++ codegen -let bundledCPP = `// Generated by \`bun src/js/builtins/codegen\` -// Do not edit by hand. +let bundledCPP = `// Generated by ${import.meta.path} namespace Zig { class GlobalObject; } #include "root.h" #include "config.h" @@ -257,15 +279,16 @@ for (const { basename, functions } of files) { bundledCPP += `/* ${basename}.ts */\n`; const lowerBasename = low(basename); for (const fn of functions) { + const [code, count] = fmtCPPString(fn.source, true); const name = `${lowerBasename}${cap(fn.name)}Code`; bundledCPP += `// ${fn.name} const JSC::ConstructAbility s_${name}ConstructAbility = JSC::ConstructAbility::${fn.constructAbility}; const JSC::ConstructorKind s_${name}ConstructorKind = JSC::ConstructorKind::${fn.constructKind}; const JSC::ImplementationVisibility s_${name}ImplementationVisibility = JSC::ImplementationVisibility::${fn.visibility}; const int s_${name}Length = ${fn.source.length}; -static const JSC::Intrinsic s_${name}Intrinsic = JSC::NoIntrinsic; -const char* const s_${name} = ${fmtCPPString(fn.source)}; - +const JSC::Intrinsic s_${name}Intrinsic = JSC::NoIntrinsic; +const char s_${name}Bytes[${count}] = ${code}; +const char* s_${name} = s_${name}Bytes; `; } bundledCPP += `#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \\ @@ -351,7 +374,7 @@ bundledCPP += ` `; // C++ Header codegen -let bundledHeader = `// Generated by \`bun src/js/builtins/codegen\` +let bundledHeader = `// Generated by ${import.meta.path} // Do not edit by hand. #pragma once namespace Zig { class GlobalObject; } @@ -378,7 +401,7 @@ for (const { basename, functions, internal } of files) { const name = `${lowerBasename}${cap(fn.name)}Code`; bundledHeader += `// ${fn.name} #define WEBCORE_BUILTIN_${basename.toUpperCase()}_${fn.name.toUpperCase()} 1 -extern const char* const s_${name}; +extern const char* s_${name}; extern const int s_${name}Length; extern const JSC::ConstructAbility s_${name}ConstructAbility; extern const JSC::ConstructorKind s_${name}ConstructorKind; @@ -574,8 +597,8 @@ bundledHeader += ` } // namespace WebCore `; -await Bun.write(path.join(OUT_DIR, "WebCoreJSBuiltins.h"), bundledHeader); -await Bun.write(path.join(OUT_DIR, "WebCoreJSBuiltins.cpp"), bundledCPP); +writeIfNotChanged(path.join(CODEGEN_DIR, "WebCoreJSBuiltins.h"), bundledHeader); +writeIfNotChanged(path.join(CODEGEN_DIR, "WebCoreJSBuiltins.cpp"), bundledCPP); // Generate TS types let dts = `// Generated by \`bun src/js/builtins/codegen\` @@ -588,14 +611,14 @@ for (const { basename, functions, internal } of files) { dts += `\n// ${basename}.ts\n`; for (const fn of functions) { dts += `declare const \$${fn.name}: RemoveThis;\n`; } } } -await Bun.write(path.join(OUT_DIR, "WebCoreJSBuiltins.d.ts"), dts); +writeIfNotChanged(path.join(CODEGEN_DIR, "WebCoreJSBuiltins.d.ts"), dts); const totalJSSize = files.reduce( (acc, { functions }) => acc + functions.reduce((acc, fn) => acc + fn.source.length, 0), diff --git a/src/codegen/bundle-modules-fast.ts b/src/codegen/bundle-modules-fast.ts new file mode 100644 index 0000000000000..f699370cff262 --- /dev/null +++ b/src/codegen/bundle-modules-fast.ts @@ -0,0 +1,77 @@ +// This script is run when you change anything in src/js/* +import path from "path"; +import { cap, writeIfNotChanged } from "./helpers"; +import { createInternalModuleRegistry } from "./internal-module-registry-scanner"; + +const BASE = path.join(import.meta.dir, "../js"); +const CMAKE_BUILD_ROOT = process.argv[2]; + +if (!CMAKE_BUILD_ROOT) { + console.error("Usage: bun bundle-modules-fast.ts "); + process.exit(1); +} + +const CODEGEN_DIR = path.join(CMAKE_BUILD_ROOT, "codegen"); + +let start = performance.now(); +function mark(log: string) { + const now = performance.now(); + console.log(`${log} (${(now - start).toFixed(0)}ms)`); + start = now; +} + +const { + // + moduleList, + nativeModuleIds, +} = createInternalModuleRegistry(BASE); + +function idToEnumName(id: string) { + return id + .replace(/\.[mc]?[tj]s$/, "") + .replace(/[^a-zA-Z0-9]+/g, " ") + .split(" ") + .map(x => (["jsc", "ffi", "vm", "tls", "os", "ws", "fs", "dns"].includes(x) ? x.toUpperCase() : cap(x))) + .join(""); +} + +function idToPublicSpecifierOrEnumName(id: string) { + id = id.replace(/\.[mc]?[tj]s$/, ""); + if (id.startsWith("node/")) { + return "node:" + id.slice(5).replaceAll(".", "/"); + } else if (id.startsWith("bun/")) { + return "bun:" + id.slice(4).replaceAll(".", "/"); + } else if (id.startsWith("internal/")) { + return "internal:" + id.slice(9).replaceAll(".", "/"); + } else if (id.startsWith("thirdparty/")) { + return id.slice(11).replaceAll(".", "/"); + } + return idToEnumName(id); +} + +// This is a generated enum for zig code (exports.zig) +writeIfNotChanged( + path.join(CODEGEN_DIR, "ResolvedSourceTag.zig"), + `// zig fmt: off +pub const ResolvedSourceTag = enum(u32) { + // Predefined + javascript = 0, + package_json_type_module = 1, + wasm = 2, + object = 3, + file = 4, + esm = 5, + json_for_object_loader = 6, + + // Built in modules are loaded through InternalModuleRegistry by numerical ID. + // In this enum are represented as \`(1 << 9) & id\` +${moduleList.map((id, n) => ` @"${idToPublicSpecifierOrEnumName(id)}" = ${(1 << 9) | n},`).join("\n")} + // Native modules run through a different system using ESM registry. +${Object.entries(nativeModuleIds) + .map(([id, n]) => ` @"${id}" = ${(1 << 10) | n},`) + .join("\n")} +}; +`, +); + +mark("Generate Code"); diff --git a/src/codegen/bundle-modules.ts b/src/codegen/bundle-modules.ts new file mode 100644 index 0000000000000..dd6368a096702 --- /dev/null +++ b/src/codegen/bundle-modules.ts @@ -0,0 +1,427 @@ +// This script is run when you change anything in src/js/* +import fs from "fs"; +import { writeFile, rm, mkdir } from "fs/promises"; +import path from "path"; +import { sliceSourceCode } from "./builtin-parser"; +import { cap, declareASCIILiteral, readdirRecursive, resolveSyncOrNull, writeIfNotChanged } from "./helpers"; +import { createAssertClientJS, createLogClientJS } from "./client-js"; +import { builtinModules } from "node:module"; +import { define } from "./replacements"; +import { createInternalModuleRegistry } from "./internal-module-registry-scanner"; + +const BASE = path.join(import.meta.dir, "../js"); +const debug = process.argv[2] === "--debug=ON"; +const CMAKE_BUILD_ROOT = process.argv[3]; + +if (!CMAKE_BUILD_ROOT) { + console.error("Usage: bun bundle-modules.ts "); + process.exit(1); +} + +const TMP_DIR = path.join(CMAKE_BUILD_ROOT, "tmp_modules"); +const CODEGEN_DIR = path.join(CMAKE_BUILD_ROOT, "codegen"); +const JS_DIR = path.join(CMAKE_BUILD_ROOT, "js"); + +const t = new Bun.Transpiler({ loader: "tsx" }); + +let start = performance.now(); +function mark(log: string) { + const now = performance.now(); + console.log(`${log} (${(now - start).toFixed(0)}ms)`); + start = now; +} + +const { + // + moduleList, + nativeModuleIds, + nativeModuleEnumToId, + nativeModuleEnums, + requireTransformer, +} = createInternalModuleRegistry(BASE); + +// these logs surround a very weird issue where writing files and then bundling sometimes doesn't +// work, so i have lot of debug logs that blow up the console because not sure what is going on. +// that is also the reason for using `retry` when theoretically writing a file the first time +// should actually write the file. +const verbose = Bun.env.VERBOSE ? console.log : () => {}; +async function retry(n, fn) { + var err; + while (n > 0) { + try { + await fn(); + return; + } catch (e) { + err = e; + n--; + await Bun.sleep(5); + } + } + throw err; +} + +// Preprocess builtins +const bundledEntryPoints: string[] = []; +for (let i = 0; i < moduleList.length; i++) { + try { + let input = fs.readFileSync(path.join(BASE, moduleList[i]), "utf8"); + + const scannedImports = t.scanImports(input); + for (const imp of scannedImports) { + if (imp.kind === "import-statement") { + var isBuiltin = true; + try { + if (!builtinModules.includes(imp.path)) { + requireTransformer(imp.path, moduleList[i]); + } + } catch { + isBuiltin = false; + } + if (isBuiltin) { + throw new Error(`Cannot use ESM import on builtin modules. Use require("${imp.path}") instead.`); + } + } + } + + let importStatements: string[] = []; + + const processed = sliceSourceCode( + "{" + + input + .replace( + /\bimport(\s*type)?\s*(\{[^}]*\}|(\*\s*as)?\s[a-zA-Z0-9_$]+)\s*from\s*['"][^'"]+['"]/g, + stmt => (importStatements.push(stmt), ""), + ) + .replace(/export\s*{\s*}\s*;/g, ""), + true, + x => requireTransformer(x, moduleList[i]), + ); + let fileToTranspile = `// @ts-nocheck +// GENERATED TEMP FILE - DO NOT EDIT +// Sourced from src/js/${moduleList[i]} +${importStatements.join("\n")} + +${processed.result.slice(1).trim()} +$$EXPORT$$(__intrinsic__exports).$$EXPORT_END$$; +`; + + // Attempt to optimize "$exports = ..." to a variableless return + // otherwise, declare $exports so it works. + let exportOptimization = false; + fileToTranspile = fileToTranspile.replace( + /__intrinsic__exports\s*=\s*(.*|.*\{[^\}]*}|.*\([^\)]*\))\n+\s*\$\$EXPORT\$\$\(__intrinsic__exports\).\$\$EXPORT_END\$\$;/, + (_, a) => { + exportOptimization = true; + return "$$EXPORT$$(" + a.replace(/;$/, "") + ").$$EXPORT_END$$;"; + }, + ); + if (!exportOptimization) { + fileToTranspile = `var $;` + fileToTranspile.replaceAll("__intrinsic__exports", "$"); + } + const outputPath = path.join(TMP_DIR, moduleList[i].slice(0, -3) + ".ts"); + + await mkdir(path.dirname(outputPath), { recursive: true }); + if (!fs.existsSync(path.dirname(outputPath))) { + verbose("directory did not exist after mkdir twice:", path.dirname(outputPath)); + } + // await Bun.sleep(10); + + try { + await writeFile(outputPath, fileToTranspile); + if (!fs.existsSync(outputPath)) { + verbose("file did not exist after write:", outputPath); + throw new Error("file did not exist after write: " + outputPath); + } + verbose("wrote to", outputPath, "successfully"); + } catch { + await retry(3, async () => { + await mkdir(path.dirname(outputPath), { recursive: true }); + await writeFile(outputPath, fileToTranspile); + if (!fs.existsSync(outputPath)) { + verbose("file did not exist after write:", outputPath); + throw new Error("file did not exist after write: " + outputPath); + } + verbose("wrote to", outputPath, "successfully later"); + }); + } + bundledEntryPoints.push(outputPath); + } catch (error) { + console.error(error); + console.error(`While processing: ${moduleList[i]}`); + process.exit(1); + } +} + +mark("Preprocess modules"); + +await Bun.sleep(10); + +// directory caching stuff breaks this sometimes. CLI rules +const config_cli = [ + process.execPath, + "build", + ...bundledEntryPoints, + ...(debug ? [] : ["--minify-syntax"]), + "--root", + TMP_DIR, + "--target", + "bun", + ...builtinModules.map(x => ["--external", x]).flat(), + ...Object.keys(define) + .map(x => [`--define`, `${x}=${define[x]}`]) + .flat(), + "--define", + `IS_BUN_DEVELOPMENT=${String(!!debug)}`, + "--define", + `__intrinsic__debug=${debug ? "$debug_log_enabled" : "false"}`, + "--outdir", + path.join(TMP_DIR, "modules_out"), +]; +verbose("running: ", config_cli); +const out = Bun.spawnSync({ + cmd: config_cli, + cwd: process.cwd(), + env: process.env, + stdio: ["pipe", "pipe", "pipe"], +}); +if (out.exitCode !== 0) { + console.error(out.stderr.toString()); + process.exit(out.exitCode); +} + +// const config = ({ debug }: { debug?: boolean }) => +// ({ +// entrypoints: bundledEntryPoints, +// // Whitespace and identifiers are not minified to give better error messages when an error happens in our builtins +// minify: { syntax: !debug, whitespace: false }, +// root: TMP_DIR, +// target: "bun", +// external: builtinModules, +// define: { +// ...define, +// IS_BUN_DEVELOPMENT: String(!!debug), +// __intrinsic__debug: debug ? "$debug_log_enabled" : "false", +// }, +// } satisfies BuildConfig); + +mark("Bundle modules"); + +const outputs = new Map(); + +for (const entrypoint of bundledEntryPoints) { + const file_path = entrypoint.slice(TMP_DIR.length + 1).replace(/\.ts$/, ".js"); + const file = Bun.file(path.join(TMP_DIR, "modules_out", file_path)); + const output = await file.text(); + let captured = `(function (){${output.replace("// @bun\n", "").trim()}})`; + let usesDebug = output.includes("$debug_log"); + let usesAssert = output.includes("$assert"); + captured = + captured + .replace( + `var __require = (id) => { + return import.meta.require(id); +};`, + "", + ) + .replace(/var\s*__require\s*=\s*\(?id\)?\s*=>\s*{\s*return\s*import.meta.require\(id\)\s*};?/, "") + .replace(/var __require=\(?id\)?=>import.meta.require\(id\);?/, "") + .replace(/\$\$EXPORT\$\$\((.*)\).\$\$EXPORT_END\$\$;/, "return $1") + .replace(/]\s*,\s*__(debug|assert)_end__\)/g, ")") + .replace(/]\s*,\s*__debug_end__\)/g, ")") + // .replace(/__intrinsic__lazy\(/g, "globalThis[globalThis.Symbol.for('Bun.lazy')](") + .replace(/import.meta.require\((.*?)\)/g, (expr, specifier) => { + throw new Error(`Builtin Bundler: do not use import.meta.require() (in ${file_path}))`); + }) + .replace(/__intrinsic__/g, "@") + "\n"; + captured = captured.replace( + /function\s*\(.*?\)\s*{/, + '$&"use strict";' + + (usesDebug + ? createLogClientJS( + file_path.replace(".js", ""), + idToPublicSpecifierOrEnumName(file_path).replace(/^node:|^bun:/, ""), + ) + : "") + + (usesAssert ? createAssertClientJS(idToPublicSpecifierOrEnumName(file_path).replace(/^node:|^bun:/, "")) : ""), + ); + const outputPath = path.join(JS_DIR, file_path); + fs.mkdirSync(path.dirname(outputPath), { recursive: true }); + fs.writeFileSync(outputPath, captured); + outputs.set(file_path.replace(".js", ""), captured); +} + +mark("Postprocesss modules"); + +function idToEnumName(id: string) { + return id + .replace(/\.[mc]?[tj]s$/, "") + .replace(/[^a-zA-Z0-9]+/g, " ") + .split(" ") + .map(x => (["jsc", "ffi", "vm", "tls", "os", "ws", "fs", "dns"].includes(x) ? x.toUpperCase() : cap(x))) + .join(""); +} + +function idToPublicSpecifierOrEnumName(id: string) { + id = id.replace(/\.[mc]?[tj]s$/, ""); + if (id.startsWith("node/")) { + return "node:" + id.slice(5).replaceAll(".", "/"); + } else if (id.startsWith("bun/")) { + return "bun:" + id.slice(4).replaceAll(".", "/"); + } else if (id.startsWith("internal/")) { + return "internal:" + id.slice(9).replaceAll(".", "/"); + } else if (id.startsWith("thirdparty/")) { + return id.slice(11).replaceAll(".", "/"); + } + return idToEnumName(id); +} + +// This is a file with a single macro that is used in defining InternalModuleRegistry.h +writeIfNotChanged( + path.join(CODEGEN_DIR, "InternalModuleRegistry+numberOfModules.h"), + `#define BUN_INTERNAL_MODULE_COUNT ${moduleList.length}\n`, +); + +// This code slice is used in InternalModuleRegistry.h for inlining the enum. I dont think we +// actually use this enum but it's probably a good thing to include. +writeIfNotChanged( + path.join(CODEGEN_DIR, "InternalModuleRegistry+enum.h"), + `${ + moduleList + .map((id, n) => { + return `${idToEnumName(id)} = ${n},`; + }) + .join("\n") + "\n" + } +`, +); + +// This code slice is used in InternalModuleRegistry.cpp. It defines the loading function for modules. +writeIfNotChanged( + path.join(CODEGEN_DIR, "InternalModuleRegistry+createInternalModuleById.h"), + `// clang-format off +JSValue InternalModuleRegistry::createInternalModuleById(JSGlobalObject* globalObject, VM& vm, Field id) +{ + switch (id) { + // JS internal modules + ${moduleList + .map((id, n) => { + return `case Field::${idToEnumName(id)}: { + INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "${idToPublicSpecifierOrEnumName(id)}"_s, ${JSON.stringify( + id.replace(/\.[mc]?[tj]s$/, ".js"), + )}_s, InternalModuleRegistryConstants::${idToEnumName(id)}Code, "builtin://${id + .replace(/\.[mc]?[tj]s$/, "") + .replace(/[^a-zA-Z0-9]+/g, "/")}"_s); + }`; + }) + .join("\n ")} + default: { + __builtin_unreachable(); + } + } +} +`, +); + +// This header is used by InternalModuleRegistry.cpp, and should only be included in that file. +// It inlines all the strings for the module IDs. +// +// We cannot use ASCIILiteral's `_s` operator for the module source code because for long +// strings it fails a constexpr assert. Instead, we do that assert in JS before we format the string +if (!debug) { + writeIfNotChanged( + path.join(CODEGEN_DIR, "InternalModuleRegistryConstants.h"), + `// clang-format off +#pragma once + +namespace Bun { +namespace InternalModuleRegistryConstants { + ${moduleList.map((id, n) => declareASCIILiteral(`${idToEnumName(id)}Code`, outputs.get(id.slice(0, -3)))).join("\n")} +} +}`, + ); +} else { + // In debug builds, we write empty strings to prevent recompilation. These are loaded from disk instead. + writeIfNotChanged( + path.join(CODEGEN_DIR, "InternalModuleRegistryConstants.h"), + `// clang-format off +#pragma once + +namespace Bun { +namespace InternalModuleRegistryConstants { + ${moduleList.map((id, n) => `${declareASCIILiteral(`${idToEnumName(id)}Code`, "")}`).join("\n")} +} +}`, + ); +} + +// This is a generated enum for zig code (exports.zig) +writeIfNotChanged( + path.join(CODEGEN_DIR, "ResolvedSourceTag.zig"), + `// zig fmt: off +pub const ResolvedSourceTag = enum(u32) { + // Predefined + javascript = 0, + package_json_type_module = 1, + wasm = 2, + object = 3, + file = 4, + esm = 5, + json_for_object_loader = 6, + + // Built in modules are loaded through InternalModuleRegistry by numerical ID. + // In this enum are represented as \`(1 << 9) & id\` +${moduleList.map((id, n) => ` @"${idToPublicSpecifierOrEnumName(id)}" = ${(1 << 9) | n},`).join("\n")} + // Native modules run through a different system using ESM registry. +${Object.entries(nativeModuleIds) + .map(([id, n]) => ` @"${id}" = ${(1 << 10) | n},`) + .join("\n")} +}; +`, +); + +// This is a generated enum for c++ code (headers-handwritten.h) +writeIfNotChanged( + path.join(CODEGEN_DIR, "SyntheticModuleType.h"), + `enum SyntheticModuleType : uint32_t { + JavaScript = 0, + PackageJSONTypeModule = 1, + Wasm = 2, + ObjectModule = 3, + File = 4, + ESM = 5, + JSONForObjectLoader = 6, + + // Built in modules are loaded through InternalModuleRegistry by numerical ID. + // In this enum are represented as \`(1 << 9) & id\` + InternalModuleRegistryFlag = 1 << 9, +${moduleList.map((id, n) => ` ${idToEnumName(id)} = ${(1 << 9) | n},`).join("\n")} + + // Native modules run through the same system, but with different underlying initializers. + // They also have bit 10 set to differentiate them from JS builtins. + NativeModuleFlag = (1 << 10) | (1 << 9), +${Object.entries(nativeModuleEnumToId) + .map(([id, n]) => ` ${id} = ${(1 << 10) | n},`) + .join("\n")} +}; + +`, +); + +// This is used in ModuleLoader.cpp to link to all the headers for native modules. +writeIfNotChanged( + path.join(CODEGEN_DIR, "NativeModuleImpl.h"), + Object.values(nativeModuleEnums) + .map(value => `#include "../../bun.js/modules/${value}Module.h"`) + .join("\n") + "\n", +); + +// This is used for debug builds for the base path for dynamic loading +// fs.writeFileSync( +// path.join(OUT_DIR, "DebugPath.h"), +// `// Using __FILE__ does not give an absolute file path +// // This is a workaround for that. +// #define BUN_DYNAMIC_JS_LOAD_PATH "${path.join(OUT_DIR, "")}" +// `, +// ); + +mark("Generate Code"); diff --git a/src/bun.js/scripts/class-definitions.ts b/src/codegen/class-definitions.ts similarity index 100% rename from src/bun.js/scripts/class-definitions.ts rename to src/codegen/class-definitions.ts diff --git a/src/js/_codegen/client-js.ts b/src/codegen/client-js.ts similarity index 100% rename from src/js/_codegen/client-js.ts rename to src/codegen/client-js.ts diff --git a/src/codegen/create-hash-table.ts b/src/codegen/create-hash-table.ts new file mode 100644 index 0000000000000..0d9b08d4130d0 --- /dev/null +++ b/src/codegen/create-hash-table.ts @@ -0,0 +1,23 @@ +import { spawn } from "bun"; +import path from "path"; +import { writeIfNotChanged } from "./helpers"; + +const input = process.argv[2]; +const output = process.argv[3]; + +const create_hash_table = path.join(import.meta.dir, "./create_hash_table"); + +const { stdout, exited } = spawn({ + cmd: [create_hash_table, input], + stdout: "pipe", + stderr: "inherit", +}); +await exited; +let str = await new Response(stdout).text(); +str = str.replaceAll(/^\/\/.*$/gm, ""); +str = str.replaceAll(/^#include.*$/gm, ""); +str = str.replaceAll(`namespace JSC {`, ""); +str = str.replaceAll(`} // namespace JSC`, ""); +str = "// File generated via `static-hash-table.ts`\n" + str.trim() + "\n"; + +writeIfNotChanged(output, str); diff --git a/src/bun.js/scripts/create_hash_table b/src/codegen/create_hash_table similarity index 100% rename from src/bun.js/scripts/create_hash_table rename to src/codegen/create_hash_table diff --git a/src/codegen/download-webkit.ts b/src/codegen/download-webkit.ts new file mode 100644 index 0000000000000..9e73089374aa0 --- /dev/null +++ b/src/codegen/download-webkit.ts @@ -0,0 +1,56 @@ +import fs from "fs"; +import path from "path"; + +let OUTDIR: string | null = null; +let TAG: string | null = null; +let PKG: string | null = null; + +for (const arg of process.argv.slice(2)) { + if (arg.startsWith("--outdir=")) OUTDIR = arg.slice("--outdir=".length); + if (arg.startsWith("--tag=")) TAG = arg.slice("--tag=".length); + if (arg.startsWith("--package=")) PKG = arg.slice("--package=".length); +} + +if (!OUTDIR) { + console.error(`Missing --outdir`); + process.exit(); +} +if (!TAG) { + console.error(`Missing --tag`); + process.exit(); +} +if (!PKG) { + console.error(`Missing --package`); + process.exit(); +} + +fs.mkdirSync(OUTDIR, { recursive: true }); + +const url = `https://github.com/oven-sh/WebKit/releases/download/autobuild-${TAG}/${PKG}.tar.gz`; +const tar_dir = path.join(import.meta.dir, "../../.webkit-cache"); +const tar = path.join(tar_dir, `./${PKG}-${TAG}.tar.gz`); + +fs.mkdirSync(tar_dir, { recursive: true }); + +try { + if (fs.existsSync(OUTDIR + "/package.json")) { + const read = JSON.parse(fs.readFileSync(OUTDIR + "/package.json", "utf-8")); + if (read.version === "0.0.1-" + TAG && read.name === PKG) { + process.exit(); + } + } +} catch {} + +fs.rmSync(OUTDIR, { force: true, recursive: true }); + +if (!fs.existsSync(tar)) { + console.log(`-- Downloading WebKit`); + const res = await fetch(url); + if (!res.ok) { + console.error(`Failed to download ${url}: ${res.status} ${res.statusText}`); + process.exit(); + } + await Bun.write(tar, res); +} + +Bun.spawnSync(["tar", "-xzf", tar], { cwd: path.dirname(OUTDIR) }); diff --git a/src/bun.js/scripts/generate-classes.ts b/src/codegen/generate-classes.ts similarity index 89% rename from src/bun.js/scripts/generate-classes.ts rename to src/codegen/generate-classes.ts index ae28f4fe558bc..10567dc130a5a 100644 --- a/src/bun.js/scripts/generate-classes.ts +++ b/src/codegen/generate-classes.ts @@ -1,8 +1,10 @@ // @ts-nocheck -import { unlinkSync } from "fs"; -import { readdirSync } from "fs"; import { resolve } from "path"; import type { Field, ClassDefinition } from "./class-definitions"; +import { writeIfNotChanged } from "./helpers"; + +const files = process.argv.slice(2); +const outBase = files.pop(); const CommonIdentifiers = { "name": true, @@ -16,11 +18,11 @@ function toIdentifier(propertyName) { } const directoriesToSearch = [ - resolve(`${import.meta.dir}/../`), - resolve(`${import.meta.dir}/../api`), - resolve(`${import.meta.dir}/../test`), - resolve(`${import.meta.dir}/../webcore`), - resolve(`${import.meta.dir}/../node`), + resolve(`${import.meta.dir}/../bun.js/`), + resolve(`${import.meta.dir}/../bun.js/api`), + resolve(`${import.meta.dir}/../bun.js/test`), + resolve(`${import.meta.dir}/../bun.js/webcore`), + resolve(`${import.meta.dir}/../bun.js/node`), ]; function symbolName(typeName, name) { @@ -284,28 +286,11 @@ export function generateHashTable(nameToUse, symbolName, typeName, obj, props = rows.push(propRow(symbolName, typeName, name, props[name], wrapped, defaultPropertyAttributes)); } - // static const HashTableValue JSWebSocketPrototypeTableValues[] = { - // { "constructor"_s, static_cast(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { HashTableValue::GetterSetterType, jsWebSocketConstructor, 0 } }, - // { "URL"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, jsWebSocket_URL, 0 } }, - // { "url"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, jsWebSocket_url, 0 } }, - // { "readyState"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, jsWebSocket_readyState, 0 } }, - // { "bufferedAmount"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, jsWebSocket_bufferedAmount, 0 } }, - // { "onopen"_s, static_cast(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, jsWebSocket_onopen, setJSWebSocket_onopen } }, }, - // { "onmessage"_s, static_cast(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, jsWebSocket_onmessage, setJSWebSocket_onmessage } }, }, - // { "onerror"_s, static_cast(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, jsWebSocket_onerror, setJSWebSocket_onerror } }, }, - // { "onclose"_s, static_cast(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, jsWebSocket_onclose, setJSWebSocket_onclose } }, }, - // { "protocol"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, jsWebSocket_protocol, 0 } }, - // { "extensions"_s, static_cast(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, jsWebSocket_extensions, 0 } }, - // { "binaryType"_s, static_cast(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, jsWebSocket_binaryType, setJSWebSocket_binaryType } }, }, - // { "send"_s, static_cast(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsWebSocketPrototypeFunction_send (intptr_t)(1) } }, - // { "close"_s, static_cast(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsWebSocketPrototypeFunction_close (intptr_t)(0) } }, - // { "CONNECTING"_s, JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { HashTableValue::ConstantType, 0 } }, - // { "OPEN"_s, JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { HashTableValue::ConstantType, 1 } }, - // { "CLOSING"_s, JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { HashTableValue::ConstantType, 2 } }, - // { "CLOSED"_s, JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { HashTableValue::ConstantType, 3 } }, - // }; + if (rows.length === 0) { + return ""; + } return ` - static const HashTableValue ${nameToUse}TableValues[] = {${rows.length > 0 ? "\n" + rows.join(" ,\n") + "\n" : ""}}; + static const HashTableValue ${nameToUse}TableValues[${rows.length}] = {${"\n" + rows.join(" ,\n") + "\n"}}; `; } @@ -1701,47 +1686,30 @@ const ZIG_GENERATED_CLASSES_HEADER = ` /// - pub usingnamespace JSC.Codegen.JSMyClassName; /// 5. make clean-bindings && make bindings -j10 /// -const JSC = @import("root").bun.JSC; -const Classes = @import("./generated_classes_list.zig").Classes; -const Environment = @import("../../env.zig"); +const bun = @import("root").bun; +const JSC = bun.JSC; +const Classes = JSC.GeneratedClassesList; +const Environment = bun.Environment; const std = @import("std"); pub const StaticGetterType = fn(*JSC.JSGlobalObject, JSC.JSValue, JSC.JSValue) callconv(.C) JSC.JSValue; pub const StaticSetterType = fn(*JSC.JSGlobalObject, JSC.JSValue, JSC.JSValue, JSC.JSValue) callconv(.C) bool; pub const StaticCallbackType = fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - `; -function findClasses() { - var classes = []; - for (let directory of directoriesToSearch) { - readdirSync(directory).forEach(file => { - if (file.endsWith(".classes.ts")) { - const result = require(`${directory}/${file}`); - if (!(result?.default?.length ?? 0)) return; - console.log("Generated", result.default.length, "classes from", file); - for (let { name } of result.default) { - console.log(` - ${name}`); - } - - classes.push(...result.default); - } - }); +const classes = []; +for (const file of files) { + const result = require(file); + if (!(result?.default?.length ?? 0)) continue; + console.log("Found", result.default.length, "classes from", file); + for (let { name } of result.default) { + console.log(` - ${name}`); } - classes.sort((a, b) => (a.name < b.name ? -1 : 1)); - return classes; -} -const classes = findClasses(); - -function writeAndUnlink(path, content) { - try { - unlinkSync(path); - } catch (e) {} - return Bun.write(path, content); + classes.push(...result.default); } +classes.sort((a, b) => (a.name < b.name ? -1 : 1)); const GENERATED_CLASSES_FOOTER = ` @@ -1815,13 +1783,10 @@ function writeCppSerializers() { } `; - for (let klass of classes) { - } - return output; } -await writeAndUnlink(`${import.meta.dir}/../bindings/generated_classes.zig`, [ +await writeIfNotChanged(`${outBase}/ZigGeneratedClasses.zig`, [ ZIG_GENERATED_CLASSES_HEADER, ...classes.map(a => generateZig(a.name, a).trim()).join("\n"), @@ -1830,51 +1795,51 @@ await writeAndUnlink(`${import.meta.dir}/../bindings/generated_classes.zig`, [ comptime { ${classes.map(a => `_ = ${className(a.name)};`).join("\n ")} } - + `, ]); -const allHeaders = classes.map(a => generateHeader(a.name, a)); -await writeAndUnlink(`${import.meta.dir}/../bindings/ZigGeneratedClasses.h`, [ - GENERATED_CLASSES_HEADER[0], - ...[...new Set(extraIncludes.map(a => `#include "${a}";` + "\n"))], - GENERATED_CLASSES_HEADER[1], - ...allHeaders, - GENERATED_CLASSES_FOOTER, -]); -await writeAndUnlink(`${import.meta.dir}/../bindings/ZigGeneratedClasses.cpp`, [ - GENERATED_CLASSES_IMPL_HEADER, - ...classes.map(a => generateImpl(a.name, a)), - writeCppSerializers(classes), - GENERATED_CLASSES_IMPL_FOOTER, -]); -await writeAndUnlink( - `${import.meta.dir}/../bindings/ZigGeneratedClasses+lazyStructureHeader.h`, - classes.map(a => generateLazyClassStructureHeader(a.name, a)).join("\n"), -); - -await writeAndUnlink( - `${import.meta.dir}/../bindings/ZigGeneratedClasses+DOMClientIsoSubspaces.h`, - classes.map(a => - [ - `std::unique_ptr ${clientSubspaceFor(a.name)};`, - !a.noConstructor ? `std::unique_ptr ${clientSubspaceFor(a.name)}Constructor;` : "", - ].join("\n"), - ), -); - -await writeAndUnlink( - `${import.meta.dir}/../bindings/ZigGeneratedClasses+DOMIsoSubspaces.h`, - classes.map(a => - [ - `std::unique_ptr ${subspaceFor(a.name)};`, - !a.noConstructor ? `std::unique_ptr ${subspaceFor(a.name)}Constructor;` : ``, - ].join("\n"), - ), -); - -await writeAndUnlink( - `${import.meta.dir}/../bindings/ZigGeneratedClasses+lazyStructureImpl.h`, - initLazyClasses(classes.map(a => generateLazyClassStructureImpl(a.name, a))) + "\n" + visitLazyClasses(classes), -); - -export {}; +if (!process.env.ONLY_ZIG) { + const allHeaders = classes.map(a => generateHeader(a.name, a)); + await writeIfNotChanged(`${outBase}/ZigGeneratedClasses.h`, [ + GENERATED_CLASSES_HEADER[0], + ...[...new Set(extraIncludes.map(a => `#include "${a}";` + "\n"))], + GENERATED_CLASSES_HEADER[1], + ...allHeaders, + GENERATED_CLASSES_FOOTER, + ]); + await writeIfNotChanged(`${outBase}/ZigGeneratedClasses.cpp`, [ + GENERATED_CLASSES_IMPL_HEADER, + ...classes.map(a => generateImpl(a.name, a)), + writeCppSerializers(classes), + GENERATED_CLASSES_IMPL_FOOTER, + ]); + await writeIfNotChanged( + `${outBase}/ZigGeneratedClasses+lazyStructureHeader.h`, + classes.map(a => generateLazyClassStructureHeader(a.name, a)).join("\n"), + ); + + await writeIfNotChanged( + `${outBase}/ZigGeneratedClasses+DOMClientIsoSubspaces.h`, + classes.map(a => + [ + `std::unique_ptr ${clientSubspaceFor(a.name)};`, + !a.noConstructor ? `std::unique_ptr ${clientSubspaceFor(a.name)}Constructor;` : "", + ].join("\n"), + ), + ); + + await writeIfNotChanged( + `${outBase}/ZigGeneratedClasses+DOMIsoSubspaces.h`, + classes.map(a => + [ + `std::unique_ptr ${subspaceFor(a.name)};`, + !a.noConstructor ? `std::unique_ptr ${subspaceFor(a.name)}Constructor;` : ``, + ].join("\n"), + ), + ); + + await writeIfNotChanged( + `${outBase}/ZigGeneratedClasses+lazyStructureImpl.h`, + initLazyClasses(classes.map(a => generateLazyClassStructureImpl(a.name, a))) + "\n" + visitLazyClasses(classes), + ); +} diff --git a/src/bun.js/scripts/generate-jssink.js b/src/codegen/generate-jssink.ts similarity index 97% rename from src/bun.js/scripts/generate-jssink.js rename to src/codegen/generate-jssink.ts index 758b1863b0858..31a475e0bd9f5 100644 --- a/src/bun.js/scripts/generate-jssink.js +++ b/src/codegen/generate-jssink.ts @@ -1,7 +1,6 @@ -import { resolve } from "path"; +import { resolve, join } from "path"; const classes = ["ArrayBufferSink", "FileSink", "HTTPResponseSink", "HTTPSResponseSink"]; -const SINK_COUNT = 5; function names(name) { return { @@ -15,6 +14,7 @@ function names(name) { writableStreamName: `JSWritableStreamSource${name}`, }; } + function header() { function classTemplate(name) { const { constructor, className, controller, writableStreamName } = names(name); @@ -182,7 +182,7 @@ JSC_DECLARE_CUSTOM_GETTER(function${name}__getter); #include "root.h" #include "JSDOMWrapper.h" -#include "wtf/NeverDestroyed.h" +#include #include "Sink.h" @@ -241,31 +241,31 @@ async function implementation() { #include "JSDOMWrapperCache.h" #include "ScriptExecutionContext.h" #include "WebCoreJSClientData.h" -#include "JavaScriptCore/FunctionPrototype.h" -#include "JavaScriptCore/HeapAnalyzer.h" +#include +#include -#include "JavaScriptCore/JSDestructibleObjectHeapCellType.h" -#include "JavaScriptCore/SlotVisitorMacros.h" -#include "JavaScriptCore/SubspaceInlines.h" -#include "wtf/GetPtr.h" -#include "wtf/PointerPreparations.h" -#include "wtf/URL.h" -#include "JavaScriptCore/BuiltinNames.h" +#include +#include +#include +#include +#include +#include +#include #include "JSBufferEncodingType.h" -#include "JavaScriptCore/JSBase.h" +#include #if ENABLE(MEDIA_SOURCE) #include "BufferMediaSource.h" #include "JSMediaSource.h" #endif -// #include "JavaScriptCore/JSTypedArrayViewPrototype.h" -#include "JavaScriptCore/JSArrayBufferViewInlines.h" +// #include +#include #include "JSReadableStream.h" #include "BunClientData.h" -#include "JavaScriptCore/Weak.h" -#include "JavaScriptCore/WeakInlines.h" +#include +#include @@ -480,7 +480,7 @@ JSC_DEFINE_HOST_FUNCTION(${name}__doClose, (JSC::JSGlobalObject * lexicalGlobalO } templ += ` -#include "JSSinkLookupTable.h" +#include "JSSink.lut.h" `; for (let name of classes) { @@ -951,5 +951,14 @@ extern "C" void ${name}__onClose(JSC__JSValue controllerValue, JSC__JSValue reas return templ; } -await Bun.write(resolve(import.meta.dir + "/../bindings/JSSink.h"), header()); -await Bun.write(resolve(import.meta.dir + "/../bindings/JSSink.cpp"), await implementation()); +const outDir = resolve(process.argv[2]); + +await Bun.write(resolve(outDir + "/JSSink.h"), header()); +await Bun.write(resolve(outDir + "/JSSink.cpp"), await implementation()); + +Bun.spawnSync([ + process.execPath, + join(import.meta.dir, "create-hash-table.ts"), + resolve(outDir + "/JSSink.cpp"), + join(outDir, "JSSink.lut.h"), +]); diff --git a/src/codegen/generate-unified-source-bundles.rb b/src/codegen/generate-unified-source-bundles.rb new file mode 100644 index 0000000000000..505654acef846 --- /dev/null +++ b/src/codegen/generate-unified-source-bundles.rb @@ -0,0 +1,392 @@ +# Copyright (C) 2017 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +# THE POSSIBILITY OF SUCH DAMAGE. + +require 'digest' +require 'fileutils' +require 'pathname' +require 'getoptlong' + +SCRIPT_NAME = File.basename($0) +COMMENT_REGEXP = /\/\// + +def usage(message) + if message + puts "Error: #{message}" + puts + end + + puts "usage: #{SCRIPT_NAME} [options] ..." + puts " may be separate arguments or one semicolon separated string" + puts "--help (-h) Print this message" + puts "--verbose (-v) Adds extra logging to stderr." + puts + puts "Required arguments:" + puts "--source-tree-path (-s) Path to the root of the source directory." + puts "--derived-sources-path (-d) Path to the directory where the unified source files should be placed." + puts + puts "Optional arguments:" + puts "--print-bundled-sources Print bundled sources rather than generating sources" + puts "--print-all-sources Print all sources rather than generating sources" + puts "--generate-xcfilelists Generate .xcfilelist files" + puts "--input-xcfilelist-path Path of the generated input .xcfilelist file" + puts "--output-xcfilelist-path Path of the generated output .xcfilelist file" + puts + puts "Generation options:" + puts "--max-cpp-bundle-count Use global sequential numbers for cpp bundle filenames and set the limit on the number" + puts "--max-c-bundle-count Use global sequential numbers for c bundle filenames and set the limit on the number" + puts "--max-obj-c-bundle-count Use global sequential numbers for Obj-C bundle filenames and set the limit on the number" + puts "--max-bundle-size The number of files to merge into a single bundle" + puts "--dense-bundle-filter Densely bundle files matching the given path glob" + exit 1 +end + +MAX_DENSE_BUNDLE_SIZE = 64 +$derivedSourcesPath = nil +$unifiedSourceOutputPath = nil +$sourceTreePath = nil +$verbose = false +$mode = :GenerateBundles +$inputXCFilelistPath = nil +$outputXCFilelistPath = nil +$maxCppBundleCount = nil +$maxCBundleCount = nil +$maxObjCBundleCount = nil +$maxBundleSize = 8 +$denseBundleFilters = [] +$bundleFilenamePrefix = '' + +def log(text) + $stderr.puts text if $verbose +end + +GetoptLong.new(['--help', '-h', GetoptLong::NO_ARGUMENT], + ['--verbose', '-v', GetoptLong::NO_ARGUMENT], + ['--derived-sources-path', '-d', GetoptLong::REQUIRED_ARGUMENT], + ['--source-tree-path', '-s', GetoptLong::REQUIRED_ARGUMENT], + ['--print-bundled-sources', GetoptLong::NO_ARGUMENT], + ['--print-all-sources', GetoptLong::NO_ARGUMENT], + ['--generate-xcfilelists', GetoptLong::NO_ARGUMENT], + ['--input-xcfilelist-path', GetoptLong::REQUIRED_ARGUMENT], + ['--output-xcfilelist-path', GetoptLong::REQUIRED_ARGUMENT], + ['--max-cpp-bundle-count', GetoptLong::REQUIRED_ARGUMENT], + ['--max-c-bundle-count', GetoptLong::REQUIRED_ARGUMENT], + ['--max-obj-c-bundle-count', GetoptLong::REQUIRED_ARGUMENT], + ['--max-bundle-size', GetoptLong::REQUIRED_ARGUMENT], + ['--dense-bundle-filter', GetoptLong::REQUIRED_ARGUMENT], + ['--bundle-filename-prefix', GetoptLong::REQUIRED_ARGUMENT]).each { + | opt, arg | + case opt + when '--help' + usage(nil) + when '--verbose' + $verbose = true + when '--derived-sources-path' + $derivedSourcesPath = Pathname.new(arg) + when '--source-tree-path' + $sourceTreePath = Pathname.new(arg) + usage("Source tree #{arg} does not exist.") if !$sourceTreePath.exist? + when '--print-bundled-sources' + $mode = :PrintBundledSources + when '--print-all-sources' + $mode = :PrintAllSources + when '--generate-xcfilelists' + $mode = :GenerateXCFilelists + when '--input-xcfilelist-path' + $inputXCFilelistPath = arg + when '--output-xcfilelist-path' + $outputXCFilelistPath = arg + when '--max-cpp-bundle-count' + $maxCppBundleCount = arg.to_i + when '--max-c-bundle-count' + $maxCBundleCount = arg.to_i + when '--max-obj-c-bundle-count' + $maxObjCBundleCount = arg.to_i + when '--max-bundle-size' + $maxBundleSize = arg.to_i + when '--dense-bundle-filter' + $denseBundleFilters.push(arg) + when '--bundle-filename-prefix' + $bundleFilenamePrefix = arg + end +} + +$unifiedSourceOutputPath = $derivedSourcesPath + Pathname.new("unified-sources") +FileUtils.mkpath($unifiedSourceOutputPath) if !$unifiedSourceOutputPath.exist? && $mode != :GenerateXCFilelists + +usage("--derived-sources-path must be specified.") if !$unifiedSourceOutputPath +usage("--source-tree-path must be specified.") if !$sourceTreePath +log("Putting unified sources in #{$unifiedSourceOutputPath}") + +usage("At least one source list file must be specified.") if ARGV.length == 0 +# Even though CMake will only pass us a single semicolon separated arguemnts, we separate all the arguments for simplicity. +sourceListFiles = ARGV.to_a.map { | sourceFileList | sourceFileList.split(";") }.flatten +log("Source files: #{sourceListFiles}") +$generatedSources = [] +$inputSources = [] +$outputSources = [] + +class SourceFile + attr_reader :unifiable, :fileIndex, :path + def initialize(file, fileIndex) + @unifiable = true + @fileIndex = fileIndex + + attributeStart = file =~ /@/ + if attributeStart + # We want to make sure we skip the first @ so split works correctly + attributesText = file[(attributeStart + 1)..file.length] + attributesText.split(/\s*@/).each { + | attribute | + case attribute.strip + when "no-unify" + @unifiable = false + else + raise "unknown attribute: #{attribute}" + end + } + file = file[0..(attributeStart-1)] + end + + @path = Pathname.new(file.strip) + end + + def <=>(other) + return @path.dirname <=> other.path.dirname if @path.dirname != other.path.dirname + return @path.basename <=> other.path.basename if @fileIndex == other.fileIndex + @fileIndex <=> other.fileIndex + end + + def derived? + return @derived if @derived != nil + @derived = !($sourceTreePath + self.path).exist? + end + + def to_s + if $mode == :GenerateXCFilelists + if derived? + ($derivedSourcesPath + @path).to_s + else + '$(SRCROOT)/' + @path.to_s + end + elsif $mode == :GenerateBundles || !derived? + @path.to_s + else + ($derivedSourcesPath + @path).to_s + end + end +end + +class BundleManager + attr_reader :bundleCount, :extension, :fileCount, :currentBundleText, :maxCount, :extraFiles + + def initialize(extension, max) + @extension = extension + @fileCount = 0 + @bundleCount = 0 + @currentBundleText = "" + @maxCount = max + @extraFiles = [] + @currentDirectory = nil + @lastBundlingPrefix = nil + end + + def writeFile(file, text) + bundleFile = $unifiedSourceOutputPath + file + if $mode == :GenerateXCFilelists + $outputSources << bundleFile + return + end + if (!bundleFile.exist? || IO::read(bundleFile) != @currentBundleText) + log("Writing bundle #{bundleFile} with: \n#{@currentBundleText}") + IO::write(bundleFile, @currentBundleText) + end + end + + def bundleFileName() + id = + if @maxCount + @bundleCount.to_s + else + # The dash makes the filenames more clear when using a hash. + hash = Digest::SHA1.hexdigest(@currentDirectory.to_s)[0..7] + "-#{hash}-#{@bundleCount}" + end + @extension == "cpp" ? "#{$bundleFilenamePrefix}UnifiedSource#{id}.#{extension}" : "#{$bundleFilenamePrefix}UnifiedSource#{id}-#{extension}.#{extension}" + end + + def flush + @bundleCount += 1 + bundleFile = bundleFileName + $generatedSources << $unifiedSourceOutputPath + bundleFile + @extraFiles << bundleFile if @maxCount and @bundleCount > @maxCount + + writeFile(bundleFile, @currentBundleText) + @currentBundleText = "" + @fileCount = 0 + end + + def flushToMax + raise if !@maxCount + while @bundleCount < @maxCount + flush + end + end + + def addFile(sourceFile) + path = sourceFile.path + raise "wrong extension: #{path.extname} expected #{@extension}" unless path.extname == ".#{@extension}" + bundlePrefix, bundleSize = BundlePrefixAndSizeForPath(path) + if (@lastBundlingPrefix != bundlePrefix) + unless @fileCount.zero? + log("Flushing because new top level directory; old: #{@currentDirectory}, new: #{path.dirname}") + flush + end + @lastBundlingPrefix = bundlePrefix + @currentDirectory = path.dirname + @bundleCount = 0 unless @maxCount + end + if @fileCount >= bundleSize + log("Flushing because new bundle is full (#{@fileCount} sources)") + flush + end + @currentBundleText += "#include \"#{sourceFile}\"\n" + @fileCount += 1 + end +end + +def BundlePrefixAndSizeForPath(path) + topLevelDirectory = TopLevelDirectoryForPath(path.dirname) + $denseBundleFilters.each { |filter| + if path.fnmatch(filter) + return filter, MAX_DENSE_BUNDLE_SIZE + end + } + return topLevelDirectory, $maxBundleSize +end + +def TopLevelDirectoryForPath(path) + if !path + return nil + end + while path.dirname != path.dirname.dirname + path = path.dirname + end + return path +end + +def ProcessFileForUnifiedSourceGeneration(sourceFile) + path = sourceFile.path + $inputSources << sourceFile.to_s + + bundle = $bundleManagers[path.extname] + if !bundle + log("No bundle for #{path.extname} files, building #{path} standalone") + $generatedSources << sourceFile + elsif !sourceFile.unifiable + log("Not allowed to unify #{path}, building standalone") + $generatedSources << sourceFile + else + bundle.addFile(sourceFile) + end +end + +$bundleManagers = { + ".cpp" => BundleManager.new("cpp", $maxCppBundleCount), + ".c" => BundleManager.new("c", $maxCBundleCount), + ".mm" => BundleManager.new("mm", $maxObjCBundleCount) +} + +seen = {} +sourceFiles = [] + +sourceListFiles.each_with_index { + | path, sourceFileIndex | + log("Reading #{path}") + result = [] + File.read(path).lines.each { + | line | + commentStart = line =~ COMMENT_REGEXP + log("Before: #{line}") + if commentStart != nil + line = line.slice(0, commentStart) + log("After: #{line}") + end + line.strip! + + next if line.empty? + + if seen[line] + next if $mode == :GenerateXCFilelists + raise "duplicate line: #{line} in #{path}" + end + seen[line] = true + result << SourceFile.new(line, sourceFileIndex) + } + + log("Found #{result.length} source files in #{path}") + sourceFiles += result +} + +log("Found sources: #{sourceFiles.sort}") + +sourceFiles.sort.each { + | sourceFile | + case $mode + when :GenerateBundles, :GenerateXCFilelists + ProcessFileForUnifiedSourceGeneration(sourceFile) + when :PrintAllSources + $generatedSources << sourceFile + when :PrintBundledSources + $generatedSources << sourceFile if $bundleManagers[sourceFile.path.extname] && sourceFile.unifiable + end +} + +if $mode != :PrintAllSources + $bundleManagers.each_value { + | manager | + manager.flush unless manager.fileCount.zero? + + maxCount = manager.maxCount + next if !maxCount # It is nil in CMake since maxCount limitation does not exist. + + manager.flushToMax + + unless manager.extraFiles.empty? + extension = manager.extension + bundleCount = manager.bundleCount + filesToAdd = manager.extraFiles.join(", ") + raise "number of bundles for #{extension} sources, #{bundleCount}, exceeded limit, #{maxCount}. Please add #{filesToAdd} to Xcode then update UnifiedSource#{extension.capitalize}FileCount" + end + } +end + +if $mode == :GenerateXCFilelists + IO::write($inputXCFilelistPath, $inputSources.sort.join("\n") + "\n") if $inputXCFilelistPath + IO::write($outputXCFilelistPath, $outputSources.sort.join("\n") + "\n") if $outputXCFilelistPath +end + +# We use stdout to report our unified source list to CMake. +# Add trailing semicolon and avoid a trailing newline for CMake's sake. + +log($generatedSources.join(";") + ";") +print($generatedSources.join(";") + ";") diff --git a/src/codegen/helpers.ts b/src/codegen/helpers.ts new file mode 100644 index 0000000000000..e1683376e1360 --- /dev/null +++ b/src/codegen/helpers.ts @@ -0,0 +1,82 @@ +import fs from "fs"; +import path from "path"; +import { isAscii } from "buffer"; + +// MSVC has a max of 16k characters per string literal +// Combining string literals didn't support constexpr apparently +// so we have to do this the gigantic array way +export function fmtCPPString(str: string, nullTerminated: boolean = true) { + const normalized = str + "\n"; + + var remain = normalized; + + const chars = + "{" + + remain + .split("") + .map(a => a.charCodeAt(0)) + .join(",") + + (nullTerminated ? ",0" : "") + + "}"; + return [chars, normalized.length + (nullTerminated ? 1 : 0)]; +} + +export function declareASCIILiteral(name: string, value: string) { + const [chars, count] = fmtCPPString(value); + return `static constexpr const char ${name}Bytes[${count}] = ${chars}; +static constexpr ASCIILiteral ${name} = ASCIILiteral::fromLiteralUnsafe(${name}Bytes);`; +} + +export function cap(str: string) { + return str[0].toUpperCase() + str.slice(1); +} + +export function low(str: string) { + if (str.startsWith("JS")) { + return "js" + str.slice(2); + } + + return str[0].toLowerCase() + str.slice(1); +} + +export function readdirRecursive(root: string): string[] { + const files = fs.readdirSync(root, { withFileTypes: true }); + return files.flatMap(file => { + const fullPath = path.join(root, file.name); + return file.isDirectory() ? readdirRecursive(fullPath) : fullPath; + }); +} + +export function resolveSyncOrNull(specifier: string, from: string) { + try { + return Bun.resolveSync(specifier, from); + } catch { + return null; + } +} + +export function checkAscii(str: string) { + if (!isAscii(Buffer.from(str))) { + throw new Error(`non-ascii character in string "${str}". this will not be a valid ASCIILiteral`); + } + + return str; +} + +export function writeIfNotChanged(file: string, contents: string) { + if (Array.isArray(contents)) contents = contents.join(""); + + if (fs.existsSync(file)) { + const oldContents = fs.readFileSync(file, "utf8"); + if (oldContents === contents) { + return; + } + } + + try { + fs.writeFileSync(file, contents); + } catch (error) { + fs.mkdirSync(path.dirname(file), { recursive: true }); + fs.writeFileSync(file, contents); + } +} diff --git a/src/codegen/internal-module-registry-scanner.ts b/src/codegen/internal-module-registry-scanner.ts new file mode 100644 index 0000000000000..7bc2f9bdddb19 --- /dev/null +++ b/src/codegen/internal-module-registry-scanner.ts @@ -0,0 +1,92 @@ +import fs from "fs"; +import path from "path"; +import { readdirRecursive, resolveSyncOrNull } from "./helpers"; + +export function createInternalModuleRegistry(basedir: string) { + const moduleList = ["bun", "node", "thirdparty", "internal"] + .flatMap(dir => readdirRecursive(path.join(basedir, dir))) + .filter(file => file.endsWith(".js") || (file.endsWith(".ts") && !file.endsWith(".d.ts"))) + .map(file => file.slice(basedir.length + 1)) + .sort(); + + // Create the Internal Module Registry + const internalRegistry = new Map(); + for (let i = 0; i < moduleList.length; i++) { + const prefix = moduleList[i].startsWith("node/") + ? "node:" + : moduleList[i].startsWith("bun:") + ? "bun:" + : moduleList[i].startsWith("internal/") + ? "internal/" + : undefined; + if (prefix) { + const id = prefix + moduleList[i].slice(prefix.length).replaceAll(".", "/").slice(0, -3); + internalRegistry.set(id, i); + } + } + + // Native Module registry + const nativeModuleH = fs.readFileSync(path.join(basedir, "../bun.js/modules/_NativeModule.h"), "utf8"); + const nativeModuleDefine = nativeModuleH.match(/BUN_FOREACH_NATIVE_MODULE\(macro\)\s*\\\n((.*\\\n)*\n)/); + if (!nativeModuleDefine) { + throw new Error( + "Could not find BUN_FOREACH_NATIVE_MODULE in _NativeModule.h. Knowing native module IDs is a part of the codegen process.", + ); + } + let nextNativeModuleId = 0; + const nativeModuleIds: Record = {}; + const nativeModuleEnums: Record = {}; + const nativeModuleEnumToId: Record = {}; + for (const [_, idString, enumValue] of nativeModuleDefine[0].matchAll(/macro\((.*?),(.*?)\)/g)) { + const processedIdString = JSON.parse(idString.trim().replace(/_s$/, "")); + const processedEnumValue = enumValue.trim(); + const processedNumericId = nextNativeModuleId++; + nativeModuleIds[processedIdString] = processedNumericId; + nativeModuleEnums[processedIdString] = processedEnumValue; + nativeModuleEnumToId[processedEnumValue] = processedNumericId; + } + + function codegenRequireId(id: string) { + return `(__intrinsic__getInternalField(__intrinsic__internalModuleRegistry, ${id}) || __intrinsic__createInternalModuleById(${id}))`; + } + + function codegenRequireNativeModule(id: string) { + return `(__intrinsic__requireNativeModule(${id.replace(/node:/, "")}))`; + } + + const requireTransformer = (specifier: string, from: string) => { + // this one is deprecated + if (specifier === "$shared") specifier = "./internal/shared.ts"; + + const directMatch = internalRegistry.get(specifier); + if (directMatch) return codegenRequireId(`${directMatch}/*${specifier}*/`); + + if (specifier in nativeModuleIds) { + return codegenRequireNativeModule(JSON.stringify(specifier)); + } + + const relativeMatch = + resolveSyncOrNull(specifier, path.join(basedir, path.dirname(from))) ?? resolveSyncOrNull(specifier, basedir); + + if (relativeMatch) { + const found = moduleList.indexOf(path.relative(basedir, relativeMatch)); + if (found === -1) { + throw new Error( + `Builtin Bundler: "${specifier}" cannot be imported here because it doesn't get a module ID. Only files in "src/js" besides "src/js/builtins" can be used here. Note that the 'node:' or 'bun:' prefix is required here. `, + ); + } + return codegenRequireId(`${found}/*${path.relative(basedir, relativeMatch)}*/`); + } + + throw new Error(`Builtin Bundler: Could not resolve "${specifier}" in ${from}.`); + }; + + return { + requireTransformer, + nativeModuleIds, + nativeModuleEnums, + nativeModuleEnumToId, + internalRegistry, + moduleList, + } as const; +} diff --git a/src/js/_codegen/replacements.ts b/src/codegen/replacements.ts similarity index 93% rename from src/js/_codegen/replacements.ts rename to src/codegen/replacements.ts index 45f2426b5928c..3520076466b64 100644 --- a/src/js/_codegen/replacements.ts +++ b/src/codegen/replacements.ts @@ -1,4 +1,4 @@ -import { LoaderKeys } from "../../api/schema"; +import { LoaderKeys } from "../api/schema"; import { sliceSourceCode } from "./builtin-parser"; // This is a list of extra syntax replacements to do. Kind of like macros @@ -81,9 +81,10 @@ export const warnOnIdentifiersNotPresentAtRuntime = [ ]; // These are passed to --define to the bundler +const debug = process.argv[2] === "--debug=ON"; export const define: Record = { - "process.env.NODE_ENV": "production", - "IS_BUN_DEVELOPMENT": "false", + "process.env.NODE_ENV": JSON.stringify(debug ? "development" : "production"), + "IS_BUN_DEVELOPMENT": String(debug), $streamClosed: "1", $streamClosing: "2", @@ -91,6 +92,9 @@ export const define: Record = { $streamReadable: "4", $streamWaiting: "5", $streamWritable: "6", + + "process.platform": JSON.stringify(Bun.env.PROCESS_PLATFORM ?? process.platform), + "process.arch": JSON.stringify(Bun.env.PROCESS_ARCH ?? process.arch), }; // ------------------------------ // diff --git a/src/deps/libuv.zig b/src/deps/libuv.zig new file mode 100644 index 0000000000000..bb784bda2419e --- /dev/null +++ b/src/deps/libuv.zig @@ -0,0 +1,2188 @@ +const bun = @import("root").bun; +const WORD = c_ushort; +const LARGE_INTEGER = i64; +const std = @import("std"); +const windows = bun.windows; +const HANDLE = windows.HANDLE; +const DWORD = windows.DWORD; +const OVERLAPPED = std.os.windows.OVERLAPPED; +const ULONG_PTR = std.os.windows.ULONG_PTR; +const HMODULE = HANDLE; +const ULONG = windows.ULONG; +const WCHAR = windows.WCHAR; +const SOCKET = *anyopaque; +const LPFN_ACCEPTEX = *const anyopaque; +const WIN32_FIND_DATAW = *const anyopaque; +const LPFN_CONNECTEX = *const anyopaque; +const O = std.os.O; +const FILE = std.c.FILE; +const CRITICAL_SECTION = *anyopaque; +const INPUT_RECORD = *const anyopaque; +const sockaddr = std.os.sockaddr; +const sockaddr_in = std.os.sockaddr_in; +const sockaddr_in6 = std.os.sockaddr_in6; +const sockaddr_storage = std.os.sockaddr_storage; +const sockaddr_un = std.os.sockaddr_un; +const BOOL = windows.BOOL; +pub const CHAR = u8; +pub const SHORT = c_short; +pub const LONG = c_long; +pub const struct_linger = extern struct { + l_onoff: c_ushort, + l_linger: c_ushort, +}; +pub const struct_sockaddr = extern struct { + sa_family: c_ushort, + sa_data: [14]u8, +}; +const struct_unnamed_350 = extern struct { + s_b1: [*]u8, + s_b2: [*]u8, + s_b3: [*]u8, + s_b4: [*]u8, +}; +const struct_unnamed_351 = extern struct { + s_w1: [8]u16, + s_w2: [8]u16, +}; +const union_unnamed_349 = extern union { + S_un_b: struct_unnamed_350, + S_un_w: struct_unnamed_351, + S_addr: c_ulong, +}; +pub const struct_in_addr = extern struct { + S_un: union_unnamed_349, +}; +pub const struct_sockaddr_in = extern struct { + sin_family: c_short, + sin_port: c_ushort, + sin_addr: struct_in_addr, + sin_zero: [8]u8, +}; +pub const SOCKADDR = struct_sockaddr; +pub const PSOCKADDR = [*c]struct_sockaddr; +pub const LPSOCKADDR = [*c]struct_sockaddr; +pub const SOCKADDR_IN = struct_sockaddr_in; +pub const PSOCKADDR_IN = [*c]struct_sockaddr_in; +pub const LPSOCKADDR_IN = [*c]struct_sockaddr_in; + +pub const struct__COORD = extern struct { + X: SHORT, + Y: SHORT, +}; +pub const COORD = struct__COORD; + +pub inline fn UV__ERR(x: anytype) @TypeOf(-x) { + return -x; +} +pub const UV__EOF = -@as(c_int, 4095); +pub const UV__UNKNOWN = -@as(c_int, 4094); +pub const UV__EAI_ADDRFAMILY = -@as(c_int, 3000); +pub const UV__EAI_AGAIN = -@as(c_int, 3001); +pub const UV__EAI_BADFLAGS = -@as(c_int, 3002); +pub const UV__EAI_CANCELED = -@as(c_int, 3003); +pub const UV__EAI_FAIL = -@as(c_int, 3004); +pub const UV__EAI_FAMILY = -@as(c_int, 3005); +pub const UV__EAI_MEMORY = -@as(c_int, 3006); +pub const UV__EAI_NODATA = -@as(c_int, 3007); +pub const UV__EAI_NONAME = -@as(c_int, 3008); +pub const UV__EAI_OVERFLOW = -@as(c_int, 3009); +pub const UV__EAI_SERVICE = -@as(c_int, 3010); +pub const UV__EAI_SOCKTYPE = -@as(c_int, 3011); +pub const UV__EAI_BADHINTS = -@as(c_int, 3013); +pub const UV__EAI_PROTOCOL = -@as(c_int, 3014); +pub const UV__E2BIG = -@as(c_int, 4093); +pub const UV__EACCES = -@as(c_int, 4092); +pub const UV__EADDRINUSE = -@as(c_int, 4091); +pub const UV__EADDRNOTAVAIL = -@as(c_int, 4090); +pub const UV__EAFNOSUPPORT = -@as(c_int, 4089); +pub const UV__EAGAIN = -@as(c_int, 4088); +pub const UV__EALREADY = -@as(c_int, 4084); +pub const UV__EBADF = -@as(c_int, 4083); +pub const UV__EBUSY = -@as(c_int, 4082); +pub const UV__ECANCELED = -@as(c_int, 4081); +pub const UV__ECHARSET = -@as(c_int, 4080); +pub const UV__ECONNABORTED = -@as(c_int, 4079); +pub const UV__ECONNREFUSED = -@as(c_int, 4078); +pub const UV__ECONNRESET = -@as(c_int, 4077); +pub const UV__EDESTADDRREQ = -@as(c_int, 4076); +pub const UV__EEXIST = -@as(c_int, 4075); +pub const UV__EFAULT = -@as(c_int, 4074); +pub const UV__EHOSTUNREACH = -@as(c_int, 4073); +pub const UV__EINTR = -@as(c_int, 4072); +pub const UV__EINVAL = -@as(c_int, 4071); +pub const UV__EIO = -@as(c_int, 4070); +pub const UV__EISCONN = -@as(c_int, 4069); +pub const UV__EISDIR = -@as(c_int, 4068); +pub const UV__ELOOP = -@as(c_int, 4067); +pub const UV__EMFILE = -@as(c_int, 4066); +pub const UV__EMSGSIZE = -@as(c_int, 4065); +pub const UV__ENAMETOOLONG = -@as(c_int, 4064); +pub const UV__ENETDOWN = -@as(c_int, 4063); +pub const UV__ENETUNREACH = -@as(c_int, 4062); +pub const UV__ENFILE = -@as(c_int, 4061); +pub const UV__ENOBUFS = -@as(c_int, 4060); +pub const UV__ENODEV = -@as(c_int, 4059); +pub const UV__ENOENT = -@as(c_int, 4058); +pub const UV__ENOMEM = -@as(c_int, 4057); +pub const UV__ENONET = -@as(c_int, 4056); +pub const UV__ENOSPC = -@as(c_int, 4055); +pub const UV__ENOSYS = -@as(c_int, 4054); +pub const UV__ENOTCONN = -@as(c_int, 4053); +pub const UV__ENOTDIR = -@as(c_int, 4052); +pub const UV__ENOTEMPTY = -@as(c_int, 4051); +pub const UV__ENOTSOCK = -@as(c_int, 4050); +pub const UV__ENOTSUP = -@as(c_int, 4049); +pub const UV__EPERM = -@as(c_int, 4048); +pub const UV__EPIPE = -@as(c_int, 4047); +pub const UV__EPROTO = -@as(c_int, 4046); +pub const UV__EPROTONOSUPPORT = -@as(c_int, 4045); +pub const UV__EPROTOTYPE = -@as(c_int, 4044); +pub const UV__EROFS = -@as(c_int, 4043); +pub const UV__ESHUTDOWN = -@as(c_int, 4042); +pub const UV__ESPIPE = -@as(c_int, 4041); +pub const UV__ESRCH = -@as(c_int, 4040); +pub const UV__ETIMEDOUT = -@as(c_int, 4039); +pub const UV__ETXTBSY = -@as(c_int, 4038); +pub const UV__EXDEV = -@as(c_int, 4037); +pub const UV__EFBIG = -@as(c_int, 4036); +pub const UV__ENOPROTOOPT = -@as(c_int, 4035); +pub const UV__ERANGE = -@as(c_int, 4034); +pub const UV__ENXIO = -@as(c_int, 4033); +pub const UV__EMLINK = -@as(c_int, 4032); +pub const UV__EHOSTDOWN = -@as(c_int, 4031); +pub const UV__EREMOTEIO = -@as(c_int, 4030); +pub const UV__ENOTTY = -@as(c_int, 4029); +pub const UV__EFTYPE = -@as(c_int, 4028); +pub const UV__EILSEQ = -@as(c_int, 4027); +pub const UV__EOVERFLOW = -@as(c_int, 4026); +pub const UV__ESOCKTNOSUPPORT = -@as(c_int, 4025); +pub const UV__ENODATA = -@as(c_int, 4024); +pub const UV__EUNATCH = -@as(c_int, 4023); +pub const UV_VERSION_H = ""; +pub const UV_VERSION_MAJOR = @as(c_int, 1); +pub const UV_VERSION_MINOR = @as(c_int, 46); +pub const UV_VERSION_PATCH = @as(c_int, 1); +pub const UV_VERSION_IS_RELEASE = @as(c_int, 0); +pub const UV_VERSION_SUFFIX = "dev"; +pub const UV_VERSION_HEX = ((UV_VERSION_MAJOR << @as(c_int, 16)) | (UV_VERSION_MINOR << @as(c_int, 8))) | UV_VERSION_PATCH; + +pub const UV_THREADPOOL_H_ = ""; +pub const MAX_PIPENAME_LEN = @as(c_int, 256); +pub const S_IFLNK = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0xA000, .hexadecimal); +pub const SIGHUP = @as(c_int, 1); +pub const SIGQUIT = @as(c_int, 3); +pub const SIGKILL = @as(c_int, 9); +pub const SIGWINCH = @as(c_int, 28); +pub const UV_MSAFD_PROVIDER_COUNT = @as(c_int, 4); +pub const HAVE_DIRENT_TYPES = ""; +pub const UV__DT_DIR = UV_DIRENT_DIR; +pub const UV__DT_FILE = UV_DIRENT_FILE; +pub const UV__DT_LINK = UV_DIRENT_LINK; +pub const UV__DT_FIFO = UV_DIRENT_FIFO; +pub const UV__DT_SOCKET = UV_DIRENT_SOCKET; +pub const UV__DT_CHAR = UV_DIRENT_CHAR; +pub const UV__DT_BLOCK = UV_DIRENT_BLOCK; +pub const UV_FS_O_APPEND = O.APPEND; +pub const UV_FS_O_CREAT = O.CREAT; +pub const UV_FS_O_EXCL = O.EXCL; +pub const UV_FS_O_FILEMAP = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x20000000, .hexadecimal); +pub const UV_FS_O_RANDOM = O.RANDOM; +pub const UV_FS_O_RDONLY = O.RDONLY; +pub const UV_FS_O_RDWR = O.RDWR; +pub const UV_FS_O_SEQUENTIAL = O.SEQUENTIAL; +pub const UV_FS_O_SHORT_LIVED = O.SHORT_LIVED; +pub const UV_FS_O_TEMPORARY = O.TEMPORARY; +pub const UV_FS_O_TRUNC = O.TRUNC; +pub const UV_FS_O_WRONLY = O.WRONLY; +pub const UV_FS_O_DIRECT = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x02000000, .hexadecimal); +pub const UV_FS_O_DIRECTORY = @as(c_int, 0); +pub const UV_FS_O_DSYNC = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x04000000, .hexadecimal); +pub const UV_FS_O_EXLOCK = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x10000000, .hexadecimal); +pub const UV_FS_O_NOATIME = @as(c_int, 0); +pub const UV_FS_O_NOCTTY = @as(c_int, 0); +pub const UV_FS_O_NOFOLLOW = @as(c_int, 0); +pub const UV_FS_O_NONBLOCK = @as(c_int, 0); +pub const UV_FS_O_SYMLINK = @as(c_int, 0); +pub const UV_FS_O_SYNC = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x08000000, .hexadecimal); +pub const UV_PRIORITY_LOW = @as(c_int, 19); +pub const UV_PRIORITY_BELOW_NORMAL = @as(c_int, 10); +pub const UV_PRIORITY_NORMAL = @as(c_int, 0); +pub const UV_PRIORITY_ABOVE_NORMAL = -@as(c_int, 7); +pub const UV_PRIORITY_HIGH = -@as(c_int, 14); +pub const UV_PRIORITY_HIGHEST = -@as(c_int, 20); +pub const UV_MAXHOSTNAMESIZE = @as(c_int, 256); +pub const UV_FS_COPYFILE_EXCL = @as(c_int, 0x0001); +pub const UV_FS_COPYFILE_FICLONE = @as(c_int, 0x0002); +pub const UV_FS_COPYFILE_FICLONE_FORCE = @as(c_int, 0x0004); +pub const UV_FS_SYMLINK_DIR = @as(c_int, 0x0001); +pub const UV_FS_SYMLINK_JUNCTION = @as(c_int, 0x0002); +pub const UV_IF_NAMESIZE = @as(c_int, 16) + @as(c_int, 1); +pub const uv__queue = struct_uv__queue; + +pub const uv_req_s = struct_uv_req_s; +pub const uv_handle_s = Handle; +pub const uv_prepare_s = struct_uv_prepare_s; +pub const uv_check_s = struct_uv_check_s; +pub const uv_idle_s = struct_uv_idle_s; +pub const uv_async_s = struct_uv_async_s; +pub const uv_loop_s = Loop; +pub const uv__work = struct_uv__work; +pub const uv_once_s = struct_uv_once_s; +pub const uv__dirent_s = struct_uv__dirent_s; +pub const uv_dirent_s = struct_uv_dirent_s; +pub const uv_dir_s = struct_uv_dir_s; +pub const uv_read_s = struct_uv_read_s; +pub const uv_shutdown_s = struct_uv_shutdown_s; +pub const uv_stream_s = struct_uv_stream_s; +pub const uv_tcp_accept_s = struct_uv_tcp_accept_s; +pub const uv_tcp_s = struct_uv_tcp_s; +pub const uv_udp_s = struct_uv_udp_s; +pub const uv_pipe_accept_s = struct_uv_pipe_accept_s; +pub const uv_timer_s = struct_uv_timer_s; +pub const uv_write_s = struct_uv_write_s; +pub const uv_pipe_s = struct_uv_pipe_s; +pub const uv_tty_s = struct_uv_tty_s; +pub const uv_poll_s = struct_uv_poll_s; +pub const uv_process_exit_s = struct_uv_process_exit_s; +pub const uv_process_s = struct_uv_process_s; +pub const uv_fs_event_req_s = struct_uv_fs_event_req_s; +pub const uv_fs_event_s = struct_uv_fs_event_s; +pub const uv_fs_poll_s = struct_uv_fs_poll_s; +pub const uv_signal_s = struct_uv_signal_s; +pub const uv_getaddrinfo_s = struct_uv_getaddrinfo_s; +pub const uv_getnameinfo_s = struct_uv_getnameinfo_s; +pub const uv_connect_s = struct_uv_connect_s; +pub const uv_udp_send_s = struct_uv_udp_send_s; +pub const uv_fs_s = struct_uv_fs_s; +pub const uv_work_s = struct_uv_work_s; +pub const uv_random_s = struct_uv_random_s; +pub const uv_env_item_s = struct_uv_env_item_s; +pub const uv_cpu_times_s = struct_uv_cpu_times_s; +pub const uv_cpu_info_s = struct_uv_cpu_info_s; +pub const uv_interface_address_s = struct_uv_interface_address_s; +pub const uv_passwd_s = struct_uv_passwd_s; +pub const uv_group_s = struct_uv_group_s; +pub const uv_utsname_s = struct_uv_utsname_s; +pub const uv_statfs_s = struct_uv_statfs_s; +pub const uv_metrics_s = struct_uv_metrics_s; +pub const uv_tcp_flags = enum_uv_tcp_flags; +pub const uv_udp_flags = enum_uv_udp_flags; +pub const uv_poll_event = enum_uv_poll_event; +pub const uv_stdio_container_s = struct_uv_stdio_container_s; +pub const uv_process_options_s = struct_uv_process_options_s; +pub const uv_process_flags = enum_uv_process_flags; +pub const uv_fs_event = enum_uv_fs_event; +pub const uv_fs_event_flags = enum_uv_fs_event_flags; +pub const uv_thread_options_s = struct_uv_thread_options_s; +pub const uv_any_handle = union_uv_any_handle; +pub const uv_any_req = union_uv_any_req; +pub const struct_uv__queue = extern struct { + next: [*c]struct_uv__queue, + prev: [*c]struct_uv__queue, +}; + +const union_unnamed_370 = extern union { + unused: ?*anyopaque, + count: c_uint, +}; +const struct_unnamed_372 = extern struct { + overlapped: OVERLAPPED, + queued_bytes: usize, +}; +const struct_unnamed_373 = extern struct { + result: ULONG_PTR, + pipeHandle: HANDLE, + duplex_flags: DWORD, + name: [*]WCHAR, +}; +const union_unnamed_371 = extern union { + io: struct_unnamed_372, + connect: struct_unnamed_373, +}; +pub const struct_uv_req_s = extern struct { + data: ?*anyopaque, + type: uv_req_type, + reserved: [6]?*anyopaque, + u: union_unnamed_371, + next_req: [*c]struct_uv_req_s, +}; +pub const uv_req_t = struct_uv_req_s; +pub const uv_loop_t = Loop; +pub const uv_close_cb = ?*const fn (*anyopaque) callconv(.C) void; +const union_unnamed_374 = extern union { + fd: c_int, + reserved: [4]?*anyopaque, +}; +pub const Handle = extern struct { + data: ?*anyopaque, + loop: *uv_loop_t, + type: uv_handle_type, + close_cb: uv_close_cb, + handle_queue: struct_uv__queue, + u: union_unnamed_374, + endgame_next: ?*uv_handle_t = null, + flags: c_uint, + + pub const Type = enum(c_uint) { + unknown = 0, + @"async" = 1, + check = 2, + fs_event = 3, + fs_poll = 4, + handle = 5, + idle = 6, + named_pipe = 7, + poll = 8, + prepare = 9, + process = 10, + stream = 11, + tcp = 12, + timer = 13, + tty = 14, + udp = 15, + signal = 16, + file = 17, + }; +}; + +fn HandleMixin(comptime Type: type) type { + return struct { + pub fn getData(this: *const Type, comptime DataType: type) ?*DataType { + return @ptrCast(uv_handle_get_data(@ptrCast(this))); + } + pub fn getLoop(this: *const Type) *Loop { + return uv_handle_get_loop(@ptrCast(this)); + } + pub fn setData(handle: *Type, ptr: ?*anyopaque) void { + uv_handle_set_data(@ptrCast(handle), ptr); + } + pub fn close(this: *Type, cb: uv_close_cb) void { + uv_close(@ptrCast(this), @ptrCast(cb)); + } + + pub fn hasRef(this: *const Type) bool { + return uv_has_ref(@ptrCast(this)) != 0; + } + + pub fn ref(this: *Type) void { + uv_ref(@ptrCast(this)); + } + + pub fn unref(this: *Type) void { + uv_unref(@ptrCast(this)); + } + + pub fn isClosing(this: *const Type) bool { + return uv_is_closing(@ptrCast(this)) != 0; + } + + pub fn isActive(this: *const Type) bool { + return uv_is_active(@ptrCast(this)) != 0; + } + }; +} + +// https://docs.libuv.org/en/v1.x/request.html +fn ReqMixin(comptime Type: type) type { + return struct { + pub fn getData(this: *const Type, comptime DataType: type) ?*DataType { + return @ptrCast(uv_req_get_data(@ptrCast(this))); + } + pub fn loop(this: *const Type) *Loop { + return uv_handle_get_loop(@ptrCast(this)); + } + pub fn setData(handle: *Type, ptr: ?*anyopaque) void { + uv_req_set_data(@ptrCast(handle), ptr); + } + pub fn cancel(this: *Type) void { + uv_cancel(@ptrCast(this)); + } + }; +} +pub const uv_handle_t = Handle; +const union_unnamed_375 = extern union { + fd: c_int, + reserved: [4]?*anyopaque, +}; +pub const uv_prepare_cb = ?*const fn (*uv_prepare_t) callconv(.C) void; +pub const struct_uv_prepare_s = extern struct { + data: ?*anyopaque, + loop: *uv_loop_t, + type: uv_handle_type, + close_cb: uv_close_cb, + handle_queue: struct_uv__queue, + u: union_unnamed_375, + endgame_next: [*c]uv_handle_t, + flags: c_uint, + prepare_prev: *uv_prepare_t, + prepare_next: *uv_prepare_t, + prepare_cb: uv_prepare_cb, +}; +pub const uv_prepare_t = struct_uv_prepare_s; +const union_unnamed_376 = extern union { + fd: c_int, + reserved: [4]?*anyopaque, +}; +pub const uv_check_cb = ?*const fn (*uv_check_t) callconv(.C) void; +pub const struct_uv_check_s = extern struct { + data: ?*anyopaque, + loop: *uv_loop_t, + type: uv_handle_type, + close_cb: uv_close_cb, + handle_queue: struct_uv__queue, + u: union_unnamed_376, + endgame_next: [*c]uv_handle_t, + flags: c_uint, + check_prev: *uv_check_t, + check_next: *uv_check_t, + check_cb: uv_check_cb, +}; +pub const uv_check_t = struct_uv_check_s; +const union_unnamed_377 = extern union { + fd: c_int, + reserved: [4]?*anyopaque, +}; +pub const uv_idle_cb = ?*const fn ([*c]uv_idle_t) callconv(.C) void; +pub const struct_uv_idle_s = extern struct { + data: ?*anyopaque, + loop: *uv_loop_t, + type: uv_handle_type, + close_cb: uv_close_cb, + handle_queue: struct_uv__queue, + u: union_unnamed_377, + endgame_next: [*c]uv_handle_t, + flags: c_uint, + idle_prev: [*c]uv_idle_t, + idle_next: [*c]uv_idle_t, + idle_cb: uv_idle_cb, +}; +pub const uv_idle_t = struct_uv_idle_s; +pub const uv_mutex_t = CRITICAL_SECTION; +const union_unnamed_378 = extern union { + fd: c_int, + reserved: [4]?*anyopaque, +}; +pub const uv_async_cb = ?*const fn ([*c]uv_async_t) callconv(.C) void; +pub const struct_uv_async_s = extern struct { + data: ?*anyopaque, + loop: *uv_loop_t, + type: uv_handle_type, + close_cb: uv_close_cb, + handle_queue: struct_uv__queue, + u: union_unnamed_378, + endgame_next: [*c]uv_handle_t, + flags: c_uint, + async_req: struct_uv_req_s, + async_cb: uv_async_cb, + async_sent: u8, + + pub usingnamespace HandleMixin(@This()); + + pub fn init(this: *@This(), loop: *Loop, callback: uv_async_cb) void { + @memset(std.mem.asBytes(this), 0); + + if (uv_async_init(loop, @ptrCast(this), callback) != 0) { + @panic("internal error: uv_async_init failed"); + } + } + + pub fn send(this: *@This()) void { + _ = uv_async_send(this); + } +}; +pub const uv_async_t = struct_uv_async_s; +pub const Loop = extern struct { + data: ?*anyopaque = null, + active_handles: c_uint, + handle_queue: struct_uv__queue, + active_reqs: union_unnamed_370, + internal_fields: ?*anyopaque, + stop_flag: c_uint, + iocp: HANDLE, + time: u64, + pending_reqs_tail: ?[*]uv_req_t = null, + endgame_handles: ?[*]uv_handle_t = null, + timer_heap: ?*anyopaque = null, + prepare_handles: *uv_prepare_t, + check_handles: *uv_check_t, + idle_handles: [*c]uv_idle_t, + next_prepare_handle: *uv_prepare_t, + next_check_handle: *uv_check_t, + next_idle_handle: *uv_idle_t, + poll_peer_sockets: [4]SOCKET, + active_tcp_streams: c_uint, + active_udp_streams: c_uint, + timer_counter: u64, + wq: struct_uv__queue, + wq_mutex: uv_mutex_t, + wq_async: uv_async_t, + + pub fn inc(this: *Loop) void { + this.active_handles += 1; + } + + pub fn dec(this: *Loop) void { + this.active_handles -= 1; + } + + pub fn init() *Loop { + var this = get(); + uv_replace_allocator( + this, + @ptrCast(&bun.Mimalloc.mi_malloc), + @ptrCast(&bun.Mimalloc.mi_realloc), + @ptrCast(&bun.Mimalloc.mi_calloc), + @ptrCast(&bun.Mimalloc.mi_free), + ); + } + + pub fn isActive(this: *const Loop) bool { + return uv_loop_alive(this) != 0; + } + + pub fn get() *Loop { + return uv_default_loop(); + } + + pub fn tick(this: *Loop) void { + _ = uv_run(this, RunMode.default); + } + + pub fn run(this: *Loop) void { + _ = uv_run(this, RunMode.default); + } + + pub fn tickWithTimeout(this: *Loop, _: i64) void { + _ = uv_run(this, RunMode.nowait); + } + + pub fn wakeup(this: *Loop) void { + this.wq_async.send(); + } + + pub fn refConcurrently(this: *Loop) void { + _ = @atomicRmw(c_uint, &this.active_handles, std.builtin.AtomicRmwOp.Add, 1, .Monotonic); + } + + pub fn unrefConcurrently(this: *Loop) void { + _ = @atomicRmw(c_uint, &this.active_handles, std.builtin.AtomicRmwOp.Sub, 1, .Monotonic); + } + + pub fn unrefCount(this: *Loop, count: i32) void { + this.active_handles -= @intCast(count); + } +}; +pub const struct_uv__work = extern struct { + work: ?*const fn ([*c]struct_uv__work) callconv(.C) void, + done: ?*const fn ([*c]struct_uv__work, c_int) callconv(.C) void, + loop: [*c]Loop, + wq: struct_uv__queue, +}; +pub const LPFN_WSARECV = ?*const anyopaque; +pub const LPFN_WSARECVFROM = ?*const anyopaque; +pub const struct__AFD_POLL_HANDLE_INFO = extern struct { + Handle: HANDLE, + Events: ULONG, + Status: windows.NTSTATUS, +}; +pub const AFD_POLL_HANDLE_INFO = struct__AFD_POLL_HANDLE_INFO; +pub const PAFD_POLL_HANDLE_INFO = [*c]struct__AFD_POLL_HANDLE_INFO; +pub const struct__AFD_POLL_INFO = extern struct { + Timeout: LARGE_INTEGER, + NumberOfHandles: ULONG, + Exclusive: ULONG, + Handles: [1]AFD_POLL_HANDLE_INFO, +}; +pub const AFD_POLL_INFO = struct__AFD_POLL_INFO; +pub const PAFD_POLL_INFO = [*c]struct__AFD_POLL_INFO; +pub const struct_uv_buf_t = extern struct { + len: ULONG, + base: [*]u8, + + pub fn slice(this: *const @This()) []u8 { + return this.base[0..this.len]; + } +}; +pub const uv_buf_t = struct_uv_buf_t; +pub const uv_file = c_int; +pub const uv_os_sock_t = SOCKET; +pub const uv_os_fd_t = HANDLE; +pub const uv_pid_t = c_int; +pub const uv_thread_t = HANDLE; +pub const uv_sem_t = HANDLE; +// const struct_unnamed_379 = extern struct { +// waiters_count: c_uint, +// waiters_count_lock: CRITICAL_SECTION, +// signal_event: HANDLE, +// broadcast_event: HANDLE, +// }; +// pub const uv_cond_t = extern union { +// cond_var: CONDITION_VARIABLE, +// unused_: struct_unnamed_379, +// }; +// pub const uv_rwlock_t = extern struct { +// read_write_lock_: SRWLOCK, +// padding_: [72]u8, +// }; +// pub const uv_barrier_t = extern struct { +// threshold: c_uint, +// in: c_uint, +// mutex: uv_mutex_t, +// cond: CONDITION_VARIABLE, +// out: c_uint, +// }; +pub const uv_key_t = extern struct { + tls_index: DWORD, +}; +pub const struct_uv_once_s = extern struct { + ran: u8, + event: HANDLE, +}; +pub const uv_once_t = struct_uv_once_s; +pub const uv_uid_t = u8; +pub const uv_gid_t = u8; +pub const struct_uv__dirent_s = extern struct { + d_type: c_int, + d_name: [1]u8, +}; +pub const uv__dirent_t = struct_uv__dirent_s; +pub const uv_lib_t = extern struct { + handle: HMODULE, + errmsg: [*]u8, +}; +pub const UV_E2BIG: c_int = -4093; +pub const UV_EACCES: c_int = -4092; +pub const UV_EADDRINUSE: c_int = -4091; +pub const UV_EADDRNOTAVAIL: c_int = -4090; +pub const UV_EAFNOSUPPORT: c_int = -4089; +pub const UV_EAGAIN: c_int = -4088; +pub const UV_EAI_ADDRFAMILY: c_int = -3000; +pub const UV_EAI_AGAIN: c_int = -3001; +pub const UV_EAI_BADFLAGS: c_int = -3002; +pub const UV_EAI_BADHINTS: c_int = -3013; +pub const UV_EAI_CANCELED: c_int = -3003; +pub const UV_EAI_FAIL: c_int = -3004; +pub const UV_EAI_FAMILY: c_int = -3005; +pub const UV_EAI_MEMORY: c_int = -3006; +pub const UV_EAI_NODATA: c_int = -3007; +pub const UV_EAI_NONAME: c_int = -3008; +pub const UV_EAI_OVERFLOW: c_int = -3009; +pub const UV_EAI_PROTOCOL: c_int = -3014; +pub const UV_EAI_SERVICE: c_int = -3010; +pub const UV_EAI_SOCKTYPE: c_int = -3011; +pub const UV_EALREADY: c_int = -4084; +pub const UV_EBADF: c_int = -4083; +pub const UV_EBUSY: c_int = -4082; +pub const UV_ECANCELED: c_int = -4081; +pub const UV_ECHARSET: c_int = -4080; +pub const UV_ECONNABORTED: c_int = -4079; +pub const UV_ECONNREFUSED: c_int = -4078; +pub const UV_ECONNRESET: c_int = -4077; +pub const UV_EDESTADDRREQ: c_int = -4076; +pub const UV_EEXIST: c_int = -4075; +pub const UV_EFAULT: c_int = -4074; +pub const UV_EFBIG: c_int = -4036; +pub const UV_EHOSTUNREACH: c_int = -4073; +pub const UV_EINTR: c_int = -4072; +pub const UV_EINVAL: c_int = -4071; +pub const UV_EIO: c_int = -4070; +pub const UV_EISCONN: c_int = -4069; +pub const UV_EISDIR: c_int = -4068; +pub const UV_ELOOP: c_int = -4067; +pub const UV_EMFILE: c_int = -4066; +pub const UV_EMSGSIZE: c_int = -4065; +pub const UV_ENAMETOOLONG: c_int = -4064; +pub const UV_ENETDOWN: c_int = -4063; +pub const UV_ENETUNREACH: c_int = -4062; +pub const UV_ENFILE: c_int = -4061; +pub const UV_ENOBUFS: c_int = -4060; +pub const UV_ENODEV: c_int = -4059; +pub const UV_ENOENT: c_int = -4058; +pub const UV_ENOMEM: c_int = -4057; +pub const UV_ENONET: c_int = -4056; +pub const UV_ENOPROTOOPT: c_int = -4035; +pub const UV_ENOSPC: c_int = -4055; +pub const UV_ENOSYS: c_int = -4054; +pub const UV_ENOTCONN: c_int = -4053; +pub const UV_ENOTDIR: c_int = -4052; +pub const UV_ENOTEMPTY: c_int = -4051; +pub const UV_ENOTSOCK: c_int = -4050; +pub const UV_ENOTSUP: c_int = -4049; +pub const UV_EOVERFLOW: c_int = -4026; +pub const UV_EPERM: c_int = -4048; +pub const UV_EPIPE: c_int = -4047; +pub const UV_EPROTO: c_int = -4046; +pub const UV_EPROTONOSUPPORT: c_int = -4045; +pub const UV_EPROTOTYPE: c_int = -4044; +pub const UV_ERANGE: c_int = -4034; +pub const UV_EROFS: c_int = -4043; +pub const UV_ESHUTDOWN: c_int = -4042; +pub const UV_ESPIPE: c_int = -4041; +pub const UV_ESRCH: c_int = -4040; +pub const UV_ETIMEDOUT: c_int = -4039; +pub const UV_ETXTBSY: c_int = -4038; +pub const UV_EXDEV: c_int = -4037; +pub const UV_UNKNOWN: c_int = -4094; +pub const UV_EOF: c_int = -4095; +pub const UV_ENXIO: c_int = -4033; +pub const UV_EMLINK: c_int = -4032; +pub const UV_EHOSTDOWN: c_int = -4031; +pub const UV_EREMOTEIO: c_int = -4030; +pub const UV_ENOTTY: c_int = -4029; +pub const UV_EFTYPE: c_int = -4028; +pub const UV_EILSEQ: c_int = -4027; +pub const UV_ESOCKTNOSUPPORT: c_int = -4025; +pub const UV_ENODATA: c_int = -4024; +pub const UV_EUNATCH: c_int = -4023; +pub const UV_ERRNO_MAX: c_int = -4096; +pub const uv_errno_t = c_int; +pub const UV_UNKNOWN_HANDLE: c_int = 0; +pub const UV_ASYNC: c_int = 1; +pub const UV_CHECK: c_int = 2; +pub const UV_FS_EVENT: c_int = 3; +pub const UV_FS_POLL: c_int = 4; +pub const UV_HANDLE: c_int = 5; +pub const UV_IDLE: c_int = 6; +pub const UV_NAMED_PIPE: c_int = 7; +pub const UV_POLL: c_int = 8; +pub const UV_PREPARE: c_int = 9; +pub const UV_PROCESS: c_int = 10; +pub const UV_STREAM: c_int = 11; +pub const UV_TCP: c_int = 12; +pub const UV_TIMER: c_int = 13; +pub const UV_TTY: c_int = 14; +pub const UV_UDP: c_int = 15; +pub const UV_SIGNAL: c_int = 16; +pub const UV_FILE: c_int = 17; +pub const UV_HANDLE_TYPE_MAX: c_int = 18; +pub const uv_handle_type = Handle.Type; +pub const UV_UNKNOWN_REQ: c_int = 0; +pub const UV_REQ: c_int = 1; +pub const UV_CONNECT: c_int = 2; +pub const UV_WRITE: c_int = 3; +pub const UV_SHUTDOWN: c_int = 4; +pub const UV_UDP_SEND: c_int = 5; +pub const UV_FS: c_int = 6; +pub const UV_WORK: c_int = 7; +pub const UV_GETADDRINFO: c_int = 8; +pub const UV_GETNAMEINFO: c_int = 9; +pub const UV_RANDOM: c_int = 10; +pub const UV_ACCEPT: c_int = 11; +pub const UV_FS_EVENT_REQ: c_int = 12; +pub const UV_POLL_REQ: c_int = 13; +pub const UV_PROCESS_EXIT: c_int = 14; +pub const UV_READ: c_int = 15; +pub const UV_UDP_RECV: c_int = 16; +pub const UV_WAKEUP: c_int = 17; +pub const UV_SIGNAL_REQ: c_int = 18; +pub const UV_REQ_TYPE_MAX: c_int = 19; +pub const uv_req_type = c_uint; +pub const struct_uv_dirent_s = extern struct { + name: [*]const u8, + type: uv_dirent_type_t, +}; +pub const uv_dirent_t = struct_uv_dirent_s; +pub const struct_uv_dir_s = extern struct { + dirents: [*c]uv_dirent_t, + nentries: usize, + reserved: [4]?*anyopaque, + dir_handle: HANDLE, + find_data: WIN32_FIND_DATAW, + need_find_call: BOOL, +}; +pub const uv_dir_t = struct_uv_dir_s; +const union_unnamed_380 = extern union { + fd: c_int, + reserved: [4]?*anyopaque, +}; +pub const uv_alloc_cb = ?*const fn (*uv_handle_t, usize, [*]uv_buf_t) callconv(.C) void; +pub const uv_stream_t = struct_uv_stream_s; +pub const uv_read_cb = ?*const fn (*uv_stream_t, isize, [*]const uv_buf_t) callconv(.C) void; +const struct_unnamed_382 = extern struct { + overlapped: OVERLAPPED, + queued_bytes: usize, +}; +const struct_unnamed_383 = extern struct { + result: ULONG_PTR, + pipeHandle: HANDLE, + duplex_flags: DWORD, + name: [*]WCHAR, +}; +const union_unnamed_381 = extern union { + io: struct_unnamed_382, + connect: struct_unnamed_383, +}; +pub const struct_uv_read_s = extern struct { + data: ?*anyopaque, + type: uv_req_type, + reserved: [6]?*anyopaque, + u: union_unnamed_381, + next_req: [*c]struct_uv_req_s, + event_handle: HANDLE, + wait_handle: HANDLE, +}; +pub const uv_read_t = struct_uv_read_s; +const struct_unnamed_387 = extern struct { + overlapped: OVERLAPPED, + queued_bytes: usize, +}; +const struct_unnamed_388 = extern struct { + result: ULONG_PTR, + pipeHandle: HANDLE, + duplex_flags: DWORD, + name: [*]WCHAR, +}; +const union_unnamed_386 = extern union { + io: struct_unnamed_387, + connect: struct_unnamed_388, +}; +pub const uv_shutdown_cb = ?*const fn ([*c]uv_shutdown_t, c_int) callconv(.C) void; +pub const struct_uv_shutdown_s = extern struct { + data: ?*anyopaque, + type: uv_req_type, + reserved: [6]?*anyopaque, + u: union_unnamed_386, + next_req: [*c]struct_uv_req_s, + handle: *uv_stream_t, + cb: uv_shutdown_cb, +}; +pub const uv_shutdown_t = struct_uv_shutdown_s; +const struct_unnamed_385 = extern struct { + write_reqs_pending: c_uint, + shutdown_req: [*c]uv_shutdown_t, +}; +pub const uv_connection_cb = ?*const fn ([*c]uv_stream_t, c_int) callconv(.C) void; +const struct_unnamed_389 = extern struct { + connection_cb: uv_connection_cb, +}; +const union_unnamed_384 = extern union { + conn: struct_unnamed_385, + serv: struct_unnamed_389, +}; +pub const struct_uv_stream_s = extern struct { + data: ?*anyopaque, + loop: *uv_loop_t, + type: uv_handle_type, + close_cb: uv_close_cb, + handle_queue: struct_uv__queue, + u: union_unnamed_380, + endgame_next: [*c]uv_handle_t, + flags: c_uint, + write_queue_size: usize, + alloc_cb: uv_alloc_cb, + read_cb: uv_read_cb, + reqs_pending: c_uint, + activecnt: c_int, + read_req: uv_read_t, + stream: union_unnamed_384, +}; +const union_unnamed_390 = extern union { + fd: c_int, + reserved: [4]?*anyopaque, +}; +const struct_unnamed_392 = extern struct { + write_reqs_pending: c_uint, + shutdown_req: [*c]uv_shutdown_t, +}; +const struct_unnamed_393 = extern struct { + connection_cb: uv_connection_cb, +}; +const union_unnamed_391 = extern union { + conn: struct_unnamed_392, + serv: struct_unnamed_393, +}; +const struct_unnamed_397 = extern struct { + overlapped: OVERLAPPED, + queued_bytes: usize, +}; +const struct_unnamed_398 = extern struct { + result: ULONG_PTR, + pipeHandle: HANDLE, + duplex_flags: DWORD, + name: [*]WCHAR, +}; +const union_unnamed_396 = extern union { + io: struct_unnamed_397, + connect: struct_unnamed_398, +}; +pub const struct_uv_tcp_accept_s = extern struct { + data: ?*anyopaque, + type: uv_req_type, + reserved: [6]?*anyopaque, + u: union_unnamed_396, + next_req: [*c]struct_uv_req_s, + accept_socket: SOCKET, + accept_buffer: [288]u8, + event_handle: HANDLE, + wait_handle: HANDLE, + next_pending: [*c]struct_uv_tcp_accept_s, +}; +pub const uv_tcp_accept_t = struct_uv_tcp_accept_s; +const struct_unnamed_395 = extern struct { + accept_reqs: [*c]uv_tcp_accept_t, + processed_accepts: c_uint, + pending_accepts: [*c]uv_tcp_accept_t, + func_acceptex: LPFN_ACCEPTEX, +}; +const struct_unnamed_399 = extern struct { + read_buffer: uv_buf_t, + func_connectex: LPFN_CONNECTEX, +}; +const union_unnamed_394 = extern union { + serv: struct_unnamed_395, + conn: struct_unnamed_399, +}; +pub const struct_uv_tcp_s = extern struct { + data: ?*anyopaque, + loop: *uv_loop_t, + type: uv_handle_type, + close_cb: uv_close_cb, + handle_queue: struct_uv__queue, + u: union_unnamed_390, + endgame_next: [*c]uv_handle_t, + flags: c_uint, + write_queue_size: usize, + alloc_cb: uv_alloc_cb, + read_cb: uv_read_cb, + reqs_pending: c_uint, + activecnt: c_int, + read_req: uv_read_t, + stream: union_unnamed_391, + socket: SOCKET, + delayed_error: c_int, + tcp: union_unnamed_394, +}; +pub const uv_tcp_t = struct_uv_tcp_s; +const union_unnamed_400 = extern union { + fd: c_int, + reserved: [4]?*anyopaque, +}; +pub const uv_udp_t = struct_uv_udp_s; +pub const uv_udp_recv_cb = ?*const fn ([*c]uv_udp_t, isize, [*]const uv_buf_t, [*c]const sockaddr, c_uint) callconv(.C) void; +pub const struct_uv_udp_s = extern struct { + data: ?*anyopaque, + loop: *uv_loop_t, + type: uv_handle_type, + close_cb: uv_close_cb, + handle_queue: struct_uv__queue, + u: union_unnamed_400, + endgame_next: [*c]uv_handle_t, + flags: c_uint, + send_queue_size: usize, + send_queue_count: usize, + socket: SOCKET, + reqs_pending: c_uint, + activecnt: c_int, + recv_req: uv_req_t, + recv_buffer: uv_buf_t, + recv_from: sockaddr_storage, + recv_from_len: c_int, + recv_cb: uv_udp_recv_cb, + alloc_cb: uv_alloc_cb, + func_wsarecv: LPFN_WSARECV, + func_wsarecvfrom: LPFN_WSARECVFROM, +}; +const union_unnamed_401 = extern union { + fd: c_int, + reserved: [4]?*anyopaque, +}; +const struct_unnamed_403 = extern struct { + write_reqs_pending: c_uint, + shutdown_req: [*c]uv_shutdown_t, +}; +const struct_unnamed_404 = extern struct { + connection_cb: uv_connection_cb, +}; +const union_unnamed_402 = extern union { + conn: struct_unnamed_403, + serv: struct_unnamed_404, +}; +const struct_unnamed_408 = extern struct { + overlapped: OVERLAPPED, + queued_bytes: usize, +}; +const struct_unnamed_409 = extern struct { + result: ULONG_PTR, + pipeHandle: HANDLE, + duplex_flags: DWORD, + name: [*]WCHAR, +}; +const union_unnamed_407 = extern union { + io: struct_unnamed_408, + connect: struct_unnamed_409, +}; +pub const struct_uv_pipe_accept_s = extern struct { + data: ?*anyopaque, + type: uv_req_type, + reserved: [6]?*anyopaque, + u: union_unnamed_407, + next_req: [*c]struct_uv_req_s, + pipeHandle: HANDLE, + next_pending: [*c]struct_uv_pipe_accept_s, +}; +pub const uv_pipe_accept_t = struct_uv_pipe_accept_s; +const struct_unnamed_406 = extern struct { + pending_instances: c_int, + accept_reqs: [*c]uv_pipe_accept_t, + pending_accepts: [*c]uv_pipe_accept_t, +}; +const union_unnamed_411 = extern union { + fd: c_int, + reserved: [4]?*anyopaque, +}; +pub const uv_timer_cb = ?*const fn ([*c]uv_timer_t) callconv(.C) void; +pub const struct_uv_timer_s = extern struct { + data: ?*anyopaque, + loop: *uv_loop_t, + type: uv_handle_type, + close_cb: uv_close_cb, + handle_queue: struct_uv__queue, + u: union_unnamed_411, + endgame_next: [*c]uv_handle_t, + flags: c_uint, + heap_node: [3]?*anyopaque, + unused: c_int, + timeout: u64, + repeat: u64, + start_id: u64, + timer_cb: uv_timer_cb, +}; +pub const uv_timer_t = struct_uv_timer_s; +const struct_unnamed_413 = extern struct { + overlapped: OVERLAPPED, + queued_bytes: usize, +}; +const struct_unnamed_414 = extern struct { + result: ULONG_PTR, + pipeHandle: HANDLE, + duplex_flags: DWORD, + name: [*]WCHAR, +}; +const union_unnamed_412 = extern union { + io: struct_unnamed_413, + connect: struct_unnamed_414, +}; +pub const uv_write_cb = ?*const fn ([*c]uv_write_t, c_int) callconv(.C) void; +pub const struct_uv_write_s = extern struct { + data: ?*anyopaque, + type: uv_req_type, + reserved: [6]?*anyopaque, + u: union_unnamed_412, + next_req: [*c]struct_uv_req_s, + cb: uv_write_cb, + send_handle: *uv_stream_t, + handle: *uv_stream_t, + coalesced: c_int, + write_buffer: uv_buf_t, + event_handle: HANDLE, + wait_handle: HANDLE, +}; +pub const uv_write_t = struct_uv_write_s; +const union_unnamed_415 = extern union { + payload_remaining: u32, + dummy: u64, +}; +const struct_unnamed_410 = extern struct { + eof_timer: [*c]uv_timer_t, + dummy: uv_write_t, + ipc_remote_pid: DWORD, + ipc_data_frame: union_unnamed_415, + ipc_xfer_queue: struct_uv__queue, + ipc_xfer_queue_length: c_int, + non_overlapped_writes_tail: [*c]uv_write_t, + readfile_thread_lock: CRITICAL_SECTION, + readfile_thread_handle: HANDLE, +}; +const union_unnamed_405 = extern union { + serv: struct_unnamed_406, + conn: struct_unnamed_410, +}; +pub const struct_uv_pipe_s = extern struct { + data: ?*anyopaque, + loop: *uv_loop_t, + type: uv_handle_type, + close_cb: uv_close_cb, + handle_queue: struct_uv__queue, + u: union_unnamed_401, + endgame_next: [*c]uv_handle_t, + flags: c_uint, + write_queue_size: usize, + alloc_cb: uv_alloc_cb, + read_cb: uv_read_cb, + reqs_pending: c_uint, + activecnt: c_int, + read_req: uv_read_t, + stream: union_unnamed_402, + ipc: c_int, + handle: HANDLE, + name: [*]WCHAR, + pipe: union_unnamed_405, +}; +pub const uv_pipe_t = struct_uv_pipe_s; +const union_unnamed_416 = extern union { + fd: c_int, + reserved: [4]?*anyopaque, +}; +const struct_unnamed_418 = extern struct { + write_reqs_pending: c_uint, + shutdown_req: [*c]uv_shutdown_t, +}; +const struct_unnamed_419 = extern struct { + connection_cb: uv_connection_cb, +}; +const union_unnamed_417 = extern union { + conn: struct_unnamed_418, + serv: struct_unnamed_419, +}; +const struct_unnamed_421 = extern struct { + unused_: HANDLE, + read_line_buffer: uv_buf_t, + read_raw_wait: HANDLE, + last_key: [8]u8, + last_key_offset: u8, + last_key_len: u8, + last_utf16_high_surrogate: WCHAR, + last_input_record: INPUT_RECORD, +}; +const struct_unnamed_422 = extern struct { + utf8_codepoint: c_uint, + utf8_bytes_left: u8, + previous_eol: u8, + ansi_parser_state: c_ushort, + ansi_csi_argc: u8, + ansi_csi_argv: [4]c_ushort, + saved_position: COORD, + saved_attributes: WORD, +}; +const union_unnamed_420 = extern union { + rd: struct_unnamed_421, + wr: struct_unnamed_422, +}; +pub const struct_uv_tty_s = extern struct { + data: ?*anyopaque, + loop: *uv_loop_t, + type: uv_handle_type, + close_cb: uv_close_cb, + handle_queue: struct_uv__queue, + u: union_unnamed_416, + endgame_next: [*c]uv_handle_t, + flags: c_uint, + write_queue_size: usize, + alloc_cb: uv_alloc_cb, + read_cb: uv_read_cb, + reqs_pending: c_uint, + activecnt: c_int, + read_req: uv_read_t, + stream: union_unnamed_417, + handle: HANDLE, + tty: union_unnamed_420, +}; +pub const uv_tty_t = struct_uv_tty_s; +const union_unnamed_423 = extern union { + fd: c_int, + reserved: [4]?*anyopaque, +}; +pub const uv_poll_t = struct_uv_poll_s; +pub const uv_poll_cb = ?*const fn ([*c]uv_poll_t, c_int, c_int) callconv(.C) void; +pub const struct_uv_poll_s = extern struct { + data: ?*anyopaque, + loop: *uv_loop_t, + type: uv_handle_type, + close_cb: uv_close_cb, + handle_queue: struct_uv__queue, + u: union_unnamed_423, + endgame_next: [*c]uv_handle_t, + flags: c_uint, + poll_cb: uv_poll_cb, + socket: SOCKET, + peer_socket: SOCKET, + afd_poll_info_1: AFD_POLL_INFO, + afd_poll_info_2: AFD_POLL_INFO, + poll_req_1: uv_req_t, + poll_req_2: uv_req_t, + submitted_events_1: u8, + submitted_events_2: u8, + mask_events_1: u8, + mask_events_2: u8, + events: u8, + + pub usingnamespace HandleMixin(@This()); +}; +pub const Poll = struct_uv_poll_s; +const union_unnamed_424 = extern union { + fd: c_int, + reserved: [4]?*anyopaque, +}; +pub const uv_process_t = struct_uv_process_s; +pub const uv_exit_cb = ?*const fn ([*c]uv_process_t, i64, c_int) callconv(.C) void; +const struct_unnamed_426 = extern struct { + overlapped: OVERLAPPED, + queued_bytes: usize, +}; +const struct_unnamed_427 = extern struct { + result: ULONG_PTR, + pipeHandle: HANDLE, + duplex_flags: DWORD, + name: [*]WCHAR, +}; +const union_unnamed_425 = extern union { + io: struct_unnamed_426, + connect: struct_unnamed_427, +}; +pub const struct_uv_process_exit_s = extern struct { + data: ?*anyopaque, + type: uv_req_type, + reserved: [6]?*anyopaque, + u: union_unnamed_425, + next_req: [*c]struct_uv_req_s, +}; +pub const struct_uv_process_s = extern struct { + data: ?*anyopaque, + loop: *uv_loop_t, + type: uv_handle_type, + close_cb: uv_close_cb, + handle_queue: struct_uv__queue, + u: union_unnamed_424, + endgame_next: [*c]uv_handle_t, + flags: c_uint, + exit_cb: uv_exit_cb, + pid: c_int, + exit_req: struct_uv_process_exit_s, + unused: ?*anyopaque, + exit_signal: c_int, + wait_handle: HANDLE, + process_handle: HANDLE, + exit_cb_pending: u8, +}; +const union_unnamed_428 = extern union { + fd: c_int, + reserved: [4]?*anyopaque, +}; +const struct_unnamed_430 = extern struct { + overlapped: OVERLAPPED, + queued_bytes: usize, +}; +const struct_unnamed_431 = extern struct { + result: ULONG_PTR, + pipeHandle: HANDLE, + duplex_flags: DWORD, + name: [*]WCHAR, +}; +const union_unnamed_429 = extern union { + io: struct_unnamed_430, + connect: struct_unnamed_431, +}; +pub const struct_uv_fs_event_req_s = extern struct { + data: ?*anyopaque, + type: uv_req_type, + reserved: [6]?*anyopaque, + u: union_unnamed_429, + next_req: [*c]struct_uv_req_s, +}; +pub const uv_fs_event_t = struct_uv_fs_event_s; +pub const uv_fs_event_cb = ?*const fn ([*c]uv_fs_event_t, [*]const u8, c_int, c_int) callconv(.C) void; +pub const struct_uv_fs_event_s = extern struct { + data: ?*anyopaque, + loop: *uv_loop_t, + type: uv_handle_type, + close_cb: uv_close_cb, + handle_queue: struct_uv__queue, + u: union_unnamed_428, + endgame_next: [*c]uv_handle_t, + flags: c_uint, + path: [*]u8, + req: struct_uv_fs_event_req_s, + dir_handle: HANDLE, + req_pending: c_int, + cb: uv_fs_event_cb, + filew: [*]WCHAR, + short_filew: [*]WCHAR, + dirw: [*]WCHAR, + buffer: [*]u8, +}; +const union_unnamed_432 = extern union { + fd: c_int, + reserved: [4]?*anyopaque, +}; +pub const struct_uv_fs_poll_s = extern struct { + data: ?*anyopaque, + loop: *uv_loop_t, + type: uv_handle_type, + close_cb: uv_close_cb, + handle_queue: struct_uv__queue, + u: union_unnamed_432, + endgame_next: [*c]uv_handle_t, + flags: c_uint, + poll_ctx: ?*anyopaque, +}; +pub const uv_fs_poll_t = struct_uv_fs_poll_s; +const union_unnamed_433 = extern union { + fd: c_int, + reserved: [4]?*anyopaque, +}; +pub const uv_signal_t = struct_uv_signal_s; +pub const uv_signal_cb = ?*const fn ([*c]uv_signal_t, c_int) callconv(.C) void; +const struct_unnamed_434 = extern struct { + rbe_left: [*c]struct_uv_signal_s, + rbe_right: [*c]struct_uv_signal_s, + rbe_parent: [*c]struct_uv_signal_s, + rbe_color: c_int, +}; +pub const struct_uv_signal_s = extern struct { + data: ?*anyopaque, + loop: *uv_loop_t, + type: uv_handle_type, + close_cb: uv_close_cb, + handle_queue: struct_uv__queue, + u: union_unnamed_433, + endgame_next: [*c]uv_handle_t, + flags: c_uint, + signal_cb: uv_signal_cb, + signum: c_int, + tree_entry: struct_unnamed_434, + signal_req: struct_uv_req_s, + pending_signum: c_ulong, +}; +const struct_unnamed_436 = extern struct { + overlapped: OVERLAPPED, + queued_bytes: usize, +}; +const struct_unnamed_437 = extern struct { + result: ULONG_PTR, + pipeHandle: HANDLE, + duplex_flags: DWORD, + name: [*]WCHAR, +}; +const union_unnamed_435 = extern union { + io: struct_unnamed_436, + connect: struct_unnamed_437, +}; +pub const uv_getaddrinfo_t = struct_uv_getaddrinfo_s; +pub const uv_getaddrinfo_cb = ?*const fn ([*c]uv_getaddrinfo_t, c_int, ?*anyopaque) callconv(.C) void; +pub const struct_uv_getaddrinfo_s = extern struct { + data: ?*anyopaque, + type: uv_req_type, + reserved: [6]?*anyopaque, + u: union_unnamed_435, + next_req: [*c]struct_uv_req_s, + loop: *uv_loop_t, + work_req: struct_uv__work, + getaddrinfo_cb: uv_getaddrinfo_cb, + alloc: ?*anyopaque, + node: [*]WCHAR, + service: [*]WCHAR, + addrinfow: ?*anyopaque, + addrinfo: ?*anyopaque, + retcode: c_int, +}; +const struct_unnamed_439 = extern struct { + overlapped: OVERLAPPED, + queued_bytes: usize, +}; +const struct_unnamed_440 = extern struct { + result: ULONG_PTR, + pipeHandle: HANDLE, + duplex_flags: DWORD, + name: [*]WCHAR, +}; +const union_unnamed_438 = extern union { + io: struct_unnamed_439, + connect: struct_unnamed_440, +}; +pub const uv_getnameinfo_t = struct_uv_getnameinfo_s; +pub const uv_getnameinfo_cb = ?*const fn ([*c]uv_getnameinfo_t, c_int, [*]const u8, [*]const u8) callconv(.C) void; +pub const struct_uv_getnameinfo_s = extern struct { + data: ?*anyopaque, + type: uv_req_type, + reserved: [6]?*anyopaque, + u: union_unnamed_438, + next_req: [*c]struct_uv_req_s, + loop: *uv_loop_t, + work_req: struct_uv__work, + getnameinfo_cb: uv_getnameinfo_cb, + storage: sockaddr_storage, + flags: c_int, + host: [1025]u8, + service: [32]u8, + retcode: c_int, +}; +const struct_unnamed_442 = extern struct { + overlapped: OVERLAPPED, + queued_bytes: usize, +}; +const struct_unnamed_443 = extern struct { + result: ULONG_PTR, + pipeHandle: HANDLE, + duplex_flags: DWORD, + name: [*]WCHAR, +}; +const union_unnamed_441 = extern union { + io: struct_unnamed_442, + connect: struct_unnamed_443, +}; +pub const uv_connect_t = struct_uv_connect_s; +pub const uv_connect_cb = ?*const fn ([*c]uv_connect_t, c_int) callconv(.C) void; +pub const struct_uv_connect_s = extern struct { + data: ?*anyopaque, + type: uv_req_type, + reserved: [6]?*anyopaque, + u: union_unnamed_441, + next_req: [*c]struct_uv_req_s, + cb: uv_connect_cb, + handle: *uv_stream_t, +}; +const struct_unnamed_445 = extern struct { + overlapped: OVERLAPPED, + queued_bytes: usize, +}; +const struct_unnamed_446 = extern struct { + result: ULONG_PTR, + pipeHandle: HANDLE, + duplex_flags: DWORD, + name: [*]WCHAR, +}; +const union_unnamed_444 = extern union { + io: struct_unnamed_445, + connect: struct_unnamed_446, +}; +pub const uv_udp_send_t = struct_uv_udp_send_s; +pub const uv_udp_send_cb = ?*const fn ([*c]uv_udp_send_t, c_int) callconv(.C) void; +pub const struct_uv_udp_send_s = extern struct { + data: ?*anyopaque, + type: uv_req_type, + reserved: [6]?*anyopaque, + u: union_unnamed_444, + next_req: [*c]struct_uv_req_s, + handle: *uv_udp_t, + cb: uv_udp_send_cb, +}; +const struct_unnamed_448 = extern struct { + overlapped: OVERLAPPED, + queued_bytes: usize, +}; +const struct_unnamed_449 = extern struct { + result: ULONG_PTR, + pipeHandle: HANDLE, + duplex_flags: DWORD, + name: [*]WCHAR, +}; +const union_unnamed_447 = extern union { + io: struct_unnamed_448, + connect: struct_unnamed_449, +}; +pub const uv_fs_t = struct_uv_fs_s; +pub const uv_fs_cb = ?*const fn ([*c]uv_fs_t) callconv(.C) void; +const union_unnamed_450 = extern union { + pathw: [*]WCHAR, + fd: c_int, +}; +const struct_unnamed_452 = extern struct { + mode: c_int, + new_pathw: [*]WCHAR, + file_flags: c_int, + fd_out: c_int, + nbufs: c_uint, + bufs: [*c]uv_buf_t, + offset: i64, + bufsml: [4]uv_buf_t, +}; +const struct_unnamed_453 = extern struct { + atime: f64, + mtime: f64, +}; +const union_unnamed_451 = extern union { + info: struct_unnamed_452, + time: struct_unnamed_453, +}; +pub const struct_uv_fs_s = extern struct { + data: ?*anyopaque, + type: uv_req_type, + reserved: [6]?*anyopaque, + u: union_unnamed_447, + next_req: [*c]struct_uv_req_s, + fs_type: uv_fs_type, + loop: *uv_loop_t, + cb: uv_fs_cb, + result: isize, + ptr: ?*anyopaque, + path: [*]const u8, + statbuf: uv_stat_t, + work_req: struct_uv__work, + flags: c_int, + sys_errno_: DWORD, + file: union_unnamed_450, + fs: union_unnamed_451, +}; +const struct_unnamed_455 = extern struct { + overlapped: OVERLAPPED, + queued_bytes: usize, +}; +const struct_unnamed_456 = extern struct { + result: ULONG_PTR, + pipeHandle: HANDLE, + duplex_flags: DWORD, + name: [*]WCHAR, +}; +const union_unnamed_454 = extern union { + io: struct_unnamed_455, + connect: struct_unnamed_456, +}; +pub const uv_work_t = struct_uv_work_s; +pub const uv_work_cb = ?*const fn ([*c]uv_work_t) callconv(.C) void; +pub const uv_after_work_cb = ?*const fn ([*c]uv_work_t, c_int) callconv(.C) void; +pub const struct_uv_work_s = extern struct { + data: ?*anyopaque, + type: uv_req_type, + reserved: [6]?*anyopaque, + u: union_unnamed_454, + next_req: [*c]struct_uv_req_s, + loop: *uv_loop_t, + work_cb: uv_work_cb, + after_work_cb: uv_after_work_cb, + work_req: struct_uv__work, + + pub usingnamespace ReqMixin(@This()); +}; +const struct_unnamed_458 = extern struct { + overlapped: OVERLAPPED, + queued_bytes: usize, +}; +const struct_unnamed_459 = extern struct { + result: ULONG_PTR, + pipeHandle: HANDLE, + duplex_flags: DWORD, + name: [*]WCHAR, +}; +const union_unnamed_457 = extern union { + io: struct_unnamed_458, + connect: struct_unnamed_459, +}; +pub const uv_random_t = struct_uv_random_s; +pub const uv_random_cb = ?*const fn ([*c]uv_random_t, c_int, ?*anyopaque, usize) callconv(.C) void; +pub const struct_uv_random_s = extern struct { + data: ?*anyopaque, + type: uv_req_type, + reserved: [6]?*anyopaque, + u: union_unnamed_457, + next_req: [*c]struct_uv_req_s, + loop: *uv_loop_t, + status: c_int, + buf: ?*anyopaque, + buflen: usize, + cb: uv_random_cb, + work_req: struct_uv__work, + + pub usingnamespace ReqMixin(@This()); +}; +pub const struct_uv_env_item_s = extern struct { + name: [*]u8, + value: [*]u8, +}; +pub const uv_env_item_t = struct_uv_env_item_s; +pub const struct_uv_cpu_times_s = extern struct { + user: u64, + nice: u64, + sys: u64, + idle: u64, + irq: u64, +}; +pub const struct_uv_cpu_info_s = extern struct { + model: [*]u8, + speed: c_int, + cpu_times: struct_uv_cpu_times_s, +}; +pub const uv_cpu_info_t = struct_uv_cpu_info_s; +const union_unnamed_460 = extern union { + address4: sockaddr_in, + address6: sockaddr_in6, +}; +const union_unnamed_461 = extern union { + netmask4: sockaddr_in, + netmask6: sockaddr_in6, +}; +pub const struct_uv_interface_address_s = extern struct { + name: [*]u8, + phys_addr: [6]u8, + is_internal: c_int, + address: union_unnamed_460, + netmask: union_unnamed_461, +}; +pub const uv_interface_address_t = struct_uv_interface_address_s; +pub const struct_uv_passwd_s = extern struct { + username: [*]u8, + uid: c_ulong, + gid: c_ulong, + shell: [*]u8, + homedir: [*]u8, +}; +pub const uv_passwd_t = struct_uv_passwd_s; +pub const struct_uv_group_s = extern struct { + groupname: [*]u8, + gid: c_ulong, + members: [*c][*]u8, +}; +pub const uv_group_t = struct_uv_group_s; +pub const struct_uv_utsname_s = extern struct { + sysname: [256]u8, + release: [256]u8, + version: [256]u8, + machine: [256]u8, +}; +pub const uv_utsname_t = struct_uv_utsname_s; +pub const struct_uv_statfs_s = extern struct { + f_type: u64, + f_bsize: u64, + f_blocks: u64, + f_bfree: u64, + f_bavail: u64, + f_files: u64, + f_ffree: u64, + f_spare: [4]u64, +}; +pub const uv_statfs_t = struct_uv_statfs_s; +pub const struct_uv_metrics_s = extern struct { + loop_count: u64, + events: u64, + events_waiting: u64, + reserved: [13][*c]u64, +}; +pub const uv_metrics_t = struct_uv_metrics_s; +pub const UV_LOOP_BLOCK_SIGNAL: c_int = 0; +pub const UV_METRICS_IDLE_TIME: c_int = 1; +pub const uv_loop_option = c_uint; +pub const UV_RUN_DEFAULT: c_int = 0; +pub const UV_RUN_ONCE: c_int = 1; +pub const UV_RUN_NOWAIT: c_int = 2; +pub const uv_run_mode = c_uint; +pub const RunMode = enum(c_uint) { + default = 0, + once = 1, + nowait = 2, +}; +pub extern fn uv_version() c_uint; +pub extern fn uv_version_string() [*:0]const u8; +pub const uv_malloc_func = ?*const fn (usize) callconv(.C) ?*anyopaque; +pub const uv_realloc_func = ?*const fn (?*anyopaque, usize) callconv(.C) ?*anyopaque; +pub const uv_calloc_func = ?*const fn (usize, usize) callconv(.C) ?*anyopaque; +pub const uv_free_func = ?*const fn (?*anyopaque) callconv(.C) void; +pub extern fn uv_library_shutdown() void; +pub extern fn uv_replace_allocator(malloc_func: uv_malloc_func, realloc_func: uv_realloc_func, calloc_func: uv_calloc_func, free_func: uv_free_func) c_int; +pub extern fn uv_default_loop() *uv_loop_t; +pub extern fn uv_loop_init(loop: *uv_loop_t) c_int; +pub extern fn uv_loop_close(loop: *uv_loop_t) c_int; +pub extern fn uv_loop_new() *uv_loop_t; +pub extern fn uv_loop_delete(*uv_loop_t) void; +pub extern fn uv_loop_size() usize; +pub extern fn uv_loop_alive(loop: *const uv_loop_t) c_int; +pub extern fn uv_loop_configure(loop: *uv_loop_t, option: uv_loop_option, ...) c_int; +pub extern fn uv_loop_fork(loop: *uv_loop_t) c_int; +pub extern fn uv_run(*uv_loop_t, mode: RunMode) c_int; +pub extern fn uv_stop(*uv_loop_t) void; +pub extern fn uv_ref([*c]uv_handle_t) void; +pub extern fn uv_unref([*c]uv_handle_t) void; +pub extern fn uv_has_ref([*c]const uv_handle_t) c_int; +pub extern fn uv_update_time(*uv_loop_t) void; +pub extern fn uv_now([*c]const uv_loop_t) u64; +pub extern fn uv_backend_fd([*c]const uv_loop_t) c_int; +pub extern fn uv_backend_timeout([*c]const uv_loop_t) c_int; +pub const uv_walk_cb = ?*const fn ([*c]uv_handle_t, ?*anyopaque) callconv(.C) void; +pub const UV_CLOCK_MONOTONIC: c_int = 0; +pub const UV_CLOCK_REALTIME: c_int = 1; +pub const uv_clock_id = c_uint; +pub const uv_timespec_t = extern struct { + tv_sec: c_long, + tv_nsec: c_long, +}; +pub const uv_timespec64_t = extern struct { + tv_sec: i64, + tv_nsec: i32, +}; +pub const uv_timeval_t = extern struct { + tv_sec: c_long, + tv_usec: c_long, +}; +pub const uv_timeval64_t = extern struct { + tv_sec: i64, + tv_usec: i32, +}; +pub const uv_stat_t = extern struct { + st_dev: u64, + st_mode: u64, + st_nlink: u64, + st_uid: u64, + st_gid: u64, + st_rdev: u64, + st_ino: u64, + st_size: u64, + st_blksize: u64, + st_blocks: u64, + st_flags: u64, + st_gen: u64, + st_atim: uv_timespec_t, + st_mtim: uv_timespec_t, + st_ctim: uv_timespec_t, + st_birthtim: uv_timespec_t, +}; +pub const uv_fs_poll_cb = ?*const fn ([*c]uv_fs_poll_t, c_int, [*c]const uv_stat_t, [*c]const uv_stat_t) callconv(.C) void; +pub const UV_LEAVE_GROUP: c_int = 0; +pub const UV_JOIN_GROUP: c_int = 1; +pub const uv_membership = c_uint; +pub extern fn uv_translate_sys_error(sys_errno: c_int) c_int; +pub extern fn uv_strerror(err: c_int) [*]const u8; +pub extern fn uv_strerror_r(err: c_int, buf: [*]u8, buflen: usize) [*]u8; +pub extern fn uv_err_name(err: c_int) [*]const u8; +pub extern fn uv_err_name_r(err: c_int, buf: [*]u8, buflen: usize) [*]u8; +pub extern fn uv_shutdown(req: [*c]uv_shutdown_t, handle: *uv_stream_t, cb: uv_shutdown_cb) c_int; +pub extern fn uv_handle_size(@"type": uv_handle_type) usize; +pub extern fn uv_handle_get_type(handle: *const uv_handle_t) uv_handle_type; +pub extern fn uv_handle_type_name(@"type": uv_handle_type) [*]const u8; +pub extern fn uv_handle_get_data(handle: *const uv_handle_t) ?*anyopaque; +pub extern fn uv_handle_get_loop(handle: *const uv_handle_t) *uv_loop_t; +pub extern fn uv_handle_set_data(handle: *uv_handle_t, data: ?*anyopaque) void; +pub extern fn uv_req_size(@"type": uv_req_type) usize; +pub extern fn uv_req_get_data(req: [*c]const uv_req_t) ?*anyopaque; +pub extern fn uv_req_set_data(req: [*c]uv_req_t, data: ?*anyopaque) void; +pub extern fn uv_req_get_type(req: [*c]const uv_req_t) uv_req_type; +pub extern fn uv_req_type_name(@"type": uv_req_type) [*]const u8; +pub extern fn uv_is_active(handle: *const uv_handle_t) c_int; +pub extern fn uv_walk(loop: *uv_loop_t, walk_cb: uv_walk_cb, arg: ?*anyopaque) void; +pub extern fn uv_print_all_handles(loop: *uv_loop_t, stream: [*c]FILE) void; +pub extern fn uv_print_active_handles(loop: *uv_loop_t, stream: [*c]FILE) void; +pub extern fn uv_close(handle: *uv_handle_t, close_cb: uv_close_cb) void; +pub extern fn uv_send_buffer_size(handle: *uv_handle_t, value: [*c]c_int) c_int; +pub extern fn uv_recv_buffer_size(handle: *uv_handle_t, value: [*c]c_int) c_int; +pub extern fn uv_fileno(handle: *const uv_handle_t, fd: [*c]uv_os_fd_t) c_int; +pub extern fn uv_buf_init(base: [*]u8, len: c_uint) uv_buf_t; +pub extern fn uv_pipe(fds: [*c]uv_file, read_flags: c_int, write_flags: c_int) c_int; +pub extern fn uv_socketpair(@"type": c_int, protocol: c_int, socket_vector: [*c]uv_os_sock_t, flags0: c_int, flags1: c_int) c_int; +pub extern fn uv_stream_get_write_queue_size(stream: [*c]const uv_stream_t) usize; +pub extern fn uv_listen(stream: [*c]uv_stream_t, backlog: c_int, cb: uv_connection_cb) c_int; +pub extern fn uv_accept(server: [*c]uv_stream_t, client: [*c]uv_stream_t) c_int; +pub extern fn uv_read_start([*c]uv_stream_t, alloc_cb: uv_alloc_cb, read_cb: uv_read_cb) c_int; +pub extern fn uv_read_stop([*c]uv_stream_t) c_int; +pub extern fn uv_write(req: [*c]uv_write_t, handle: *uv_stream_t, bufs: [*]const uv_buf_t, nbufs: c_uint, cb: uv_write_cb) c_int; +pub extern fn uv_write2(req: [*c]uv_write_t, handle: *uv_stream_t, bufs: [*]const uv_buf_t, nbufs: c_uint, send_handle: *uv_stream_t, cb: uv_write_cb) c_int; +pub extern fn uv_try_write(handle: *uv_stream_t, bufs: [*]const uv_buf_t, nbufs: c_uint) c_int; +pub extern fn uv_try_write2(handle: *uv_stream_t, bufs: [*]const uv_buf_t, nbufs: c_uint, send_handle: *uv_stream_t) c_int; +pub extern fn uv_is_readable(handle: *const uv_stream_t) c_int; +pub extern fn uv_is_writable(handle: *const uv_stream_t) c_int; +pub extern fn uv_stream_set_blocking(handle: *uv_stream_t, blocking: c_int) c_int; +pub extern fn uv_is_closing(handle: *const uv_handle_t) c_int; +pub extern fn uv_tcp_init(*uv_loop_t, handle: *uv_tcp_t) c_int; +pub extern fn uv_tcp_init_ex(*uv_loop_t, handle: *uv_tcp_t, flags: c_uint) c_int; +pub extern fn uv_tcp_open(handle: *uv_tcp_t, sock: uv_os_sock_t) c_int; +pub extern fn uv_tcp_nodelay(handle: *uv_tcp_t, enable: c_int) c_int; +pub extern fn uv_tcp_keepalive(handle: *uv_tcp_t, enable: c_int, delay: c_uint) c_int; +pub extern fn uv_tcp_simultaneous_accepts(handle: *uv_tcp_t, enable: c_int) c_int; +pub const UV_TCP_IPV6ONLY: c_int = 1; +pub const enum_uv_tcp_flags = c_uint; +pub extern fn uv_tcp_bind(handle: *uv_tcp_t, addr: [*c]const sockaddr, flags: c_uint) c_int; +pub extern fn uv_tcp_getsockname(handle: *const uv_tcp_t, name: [*c]sockaddr, namelen: [*c]c_int) c_int; +pub extern fn uv_tcp_getpeername(handle: *const uv_tcp_t, name: [*c]sockaddr, namelen: [*c]c_int) c_int; +pub extern fn uv_tcp_close_reset(handle: *uv_tcp_t, close_cb: uv_close_cb) c_int; +pub extern fn uv_tcp_connect(req: [*c]uv_connect_t, handle: *uv_tcp_t, addr: [*c]const sockaddr, cb: uv_connect_cb) c_int; +pub const UV_UDP_IPV6ONLY: c_int = 1; +pub const UV_UDP_PARTIAL: c_int = 2; +pub const UV_UDP_REUSEADDR: c_int = 4; +pub const UV_UDP_MMSG_CHUNK: c_int = 8; +pub const UV_UDP_MMSG_FREE: c_int = 16; +pub const UV_UDP_LINUX_RECVERR: c_int = 32; +pub const UV_UDP_RECVMMSG: c_int = 256; +pub const enum_uv_udp_flags = c_uint; +pub extern fn uv_udp_init(*uv_loop_t, handle: *uv_udp_t) c_int; +pub extern fn uv_udp_init_ex(*uv_loop_t, handle: *uv_udp_t, flags: c_uint) c_int; +pub extern fn uv_udp_open(handle: *uv_udp_t, sock: uv_os_sock_t) c_int; +pub extern fn uv_udp_bind(handle: *uv_udp_t, addr: [*c]const sockaddr, flags: c_uint) c_int; +pub extern fn uv_udp_connect(handle: *uv_udp_t, addr: [*c]const sockaddr) c_int; +pub extern fn uv_udp_getpeername(handle: *const uv_udp_t, name: [*c]sockaddr, namelen: [*c]c_int) c_int; +pub extern fn uv_udp_getsockname(handle: *const uv_udp_t, name: [*c]sockaddr, namelen: [*c]c_int) c_int; +pub extern fn uv_udp_set_membership(handle: *uv_udp_t, multicast_addr: [*]const u8, interface_addr: [*]const u8, membership: uv_membership) c_int; +pub extern fn uv_udp_set_source_membership(handle: *uv_udp_t, multicast_addr: [*]const u8, interface_addr: [*]const u8, source_addr: [*]const u8, membership: uv_membership) c_int; +pub extern fn uv_udp_set_multicast_loop(handle: *uv_udp_t, on: c_int) c_int; +pub extern fn uv_udp_set_multicast_ttl(handle: *uv_udp_t, ttl: c_int) c_int; +pub extern fn uv_udp_set_multicast_interface(handle: *uv_udp_t, interface_addr: [*]const u8) c_int; +pub extern fn uv_udp_set_broadcast(handle: *uv_udp_t, on: c_int) c_int; +pub extern fn uv_udp_set_ttl(handle: *uv_udp_t, ttl: c_int) c_int; +pub extern fn uv_udp_send(req: [*c]uv_udp_send_t, handle: *uv_udp_t, bufs: [*]const uv_buf_t, nbufs: c_uint, addr: [*c]const sockaddr, send_cb: uv_udp_send_cb) c_int; +pub extern fn uv_udp_try_send(handle: *uv_udp_t, bufs: [*]const uv_buf_t, nbufs: c_uint, addr: [*c]const sockaddr) c_int; +pub extern fn uv_udp_recv_start(handle: *uv_udp_t, alloc_cb: uv_alloc_cb, recv_cb: uv_udp_recv_cb) c_int; +pub extern fn uv_udp_using_recvmmsg(handle: *const uv_udp_t) c_int; +pub extern fn uv_udp_recv_stop(handle: *uv_udp_t) c_int; +pub extern fn uv_udp_get_send_queue_size(handle: *const uv_udp_t) usize; +pub extern fn uv_udp_get_send_queue_count(handle: *const uv_udp_t) usize; +pub const UV_TTY_MODE_NORMAL: c_int = 0; +pub const UV_TTY_MODE_RAW: c_int = 1; +pub const UV_TTY_MODE_IO: c_int = 2; +pub const uv_tty_mode_t = c_uint; +pub const UV_TTY_SUPPORTED: c_int = 0; +pub const UV_TTY_UNSUPPORTED: c_int = 1; +pub const uv_tty_vtermstate_t = c_uint; +pub extern fn uv_tty_init(*uv_loop_t, [*c]uv_tty_t, fd: uv_file, readable: c_int) c_int; +pub extern fn uv_tty_set_mode([*c]uv_tty_t, mode: uv_tty_mode_t) c_int; +pub extern fn uv_tty_reset_mode() c_int; +pub extern fn uv_tty_get_winsize([*c]uv_tty_t, width: [*c]c_int, height: [*c]c_int) c_int; +pub extern fn uv_tty_set_vterm_state(state: uv_tty_vtermstate_t) void; +pub extern fn uv_tty_get_vterm_state(state: [*c]uv_tty_vtermstate_t) c_int; +pub extern fn uv_guess_handle(file: uv_file) uv_handle_type; +pub const UV_PIPE_NO_TRUNCATE: c_int = 1; +const enum_unnamed_462 = c_uint; +pub extern fn uv_pipe_init(*uv_loop_t, handle: *uv_pipe_t, ipc: c_int) c_int; +pub extern fn uv_pipe_open([*c]uv_pipe_t, file: uv_file) c_int; +pub extern fn uv_pipe_bind(handle: *uv_pipe_t, name: [*]const u8) c_int; +pub extern fn uv_pipe_bind2(handle: *uv_pipe_t, name: [*]const u8, namelen: usize, flags: c_uint) c_int; +pub extern fn uv_pipe_connect(req: [*c]uv_connect_t, handle: *uv_pipe_t, name: [*]const u8, cb: uv_connect_cb) void; +pub extern fn uv_pipe_connect2(req: [*c]uv_connect_t, handle: *uv_pipe_t, name: [*]const u8, namelen: usize, flags: c_uint, cb: uv_connect_cb) c_int; +pub extern fn uv_pipe_getsockname(handle: *const uv_pipe_t, buffer: [*]u8, size: [*c]usize) c_int; +pub extern fn uv_pipe_getpeername(handle: *const uv_pipe_t, buffer: [*]u8, size: [*c]usize) c_int; +pub extern fn uv_pipe_pending_instances(handle: *uv_pipe_t, count: c_int) void; +pub extern fn uv_pipe_pending_count(handle: *uv_pipe_t) c_int; +pub extern fn uv_pipe_pending_type(handle: *uv_pipe_t) uv_handle_type; +pub extern fn uv_pipe_chmod(handle: *uv_pipe_t, flags: c_int) c_int; +pub const UV_READABLE: c_int = 1; +pub const UV_WRITABLE: c_int = 2; +pub const UV_DISCONNECT: c_int = 4; +pub const UV_PRIORITIZED: c_int = 8; +pub const enum_uv_poll_event = c_uint; +pub extern fn uv_poll_init(loop: *uv_loop_t, handle: *uv_poll_t, fd: c_int) c_int; +pub extern fn uv_poll_init_socket(loop: *uv_loop_t, handle: *uv_poll_t, socket: uv_os_sock_t) c_int; +pub extern fn uv_poll_start(handle: *uv_poll_t, events: c_int, cb: uv_poll_cb) c_int; +pub extern fn uv_poll_stop(handle: *uv_poll_t) c_int; +pub extern fn uv_prepare_init(*uv_loop_t, prepare: *uv_prepare_t) c_int; +pub extern fn uv_prepare_start(prepare: *uv_prepare_t, cb: uv_prepare_cb) c_int; +pub extern fn uv_prepare_stop(prepare: *uv_prepare_t) c_int; +pub extern fn uv_check_init(*uv_loop_t, check: *uv_check_t) c_int; +pub extern fn uv_check_start(check: *uv_check_t, cb: uv_check_cb) c_int; +pub extern fn uv_check_stop(check: *uv_check_t) c_int; +pub extern fn uv_idle_init(*uv_loop_t, idle: [*c]uv_idle_t) c_int; +pub extern fn uv_idle_start(idle: [*c]uv_idle_t, cb: uv_idle_cb) c_int; +pub extern fn uv_idle_stop(idle: [*c]uv_idle_t) c_int; +pub extern fn uv_async_init(*uv_loop_t, @"async": *uv_async_t, async_cb: uv_async_cb) c_int; +pub extern fn uv_async_send(@"async": *uv_async_t) c_int; +pub extern fn uv_timer_init(*uv_loop_t, handle: *uv_timer_t) c_int; +pub extern fn uv_timer_start(handle: *uv_timer_t, cb: uv_timer_cb, timeout: u64, repeat: u64) c_int; +pub extern fn uv_timer_stop(handle: *uv_timer_t) c_int; +pub extern fn uv_timer_again(handle: *uv_timer_t) c_int; +pub extern fn uv_timer_set_repeat(handle: *uv_timer_t, repeat: u64) void; +pub extern fn uv_timer_get_repeat(handle: *const uv_timer_t) u64; +pub extern fn uv_timer_get_due_in(handle: *const uv_timer_t) u64; +// pub extern fn uv_getaddrinfo(loop: *uv_loop_t, req: [*c]uv_getaddrinfo_t, getaddrinfo_cb: uv_getaddrinfo_cb, node: [*]const u8, service: [*]const u8, hints: [*c]const struct_addrinfo) c_int; +// pub extern fn uv_freeaddrinfo(ai: [*c]struct_addrinfo) void; +// pub extern fn uv_getnameinfo(loop: *uv_loop_t, req: [*c]uv_getnameinfo_t, getnameinfo_cb: uv_getnameinfo_cb, addr: [*c]const sockaddr, flags: c_int) c_int; +pub const UV_IGNORE: c_int = 0; +pub const UV_CREATE_PIPE: c_int = 1; +pub const UV_INHERIT_FD: c_int = 2; +pub const UV_INHERIT_STREAM: c_int = 4; +pub const UV_READABLE_PIPE: c_int = 16; +pub const UV_WRITABLE_PIPE: c_int = 32; +pub const UV_NONBLOCK_PIPE: c_int = 64; +pub const UV_OVERLAPPED_PIPE: c_int = 64; +pub const uv_stdio_flags = c_uint; +const union_unnamed_463 = extern union { + stream: [*c]uv_stream_t, + fd: c_int, +}; +pub const struct_uv_stdio_container_s = extern struct { + flags: uv_stdio_flags, + data: union_unnamed_463, +}; +pub const uv_stdio_container_t = struct_uv_stdio_container_s; +pub const struct_uv_process_options_s = extern struct { + exit_cb: uv_exit_cb, + file: [*]const u8, + args: [*c][*]u8, + env: [*c][*]u8, + cwd: [*]const u8, + flags: c_uint, + stdio_count: c_int, + stdio: [*c]uv_stdio_container_t, + uid: uv_uid_t, + gid: uv_gid_t, +}; +pub const uv_process_options_t = struct_uv_process_options_s; +pub const UV_PROCESS_SETUID: c_int = 1; +pub const UV_PROCESS_SETGID: c_int = 2; +pub const UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS: c_int = 4; +pub const UV_PROCESS_DETACHED: c_int = 8; +pub const UV_PROCESS_WINDOWS_HIDE: c_int = 16; +pub const UV_PROCESS_WINDOWS_HIDE_CONSOLE: c_int = 32; +pub const UV_PROCESS_WINDOWS_HIDE_GUI: c_int = 64; +pub const enum_uv_process_flags = c_uint; +pub extern fn uv_spawn(loop: *uv_loop_t, handle: *uv_process_t, options: [*c]const uv_process_options_t) c_int; +pub extern fn uv_process_kill([*c]uv_process_t, signum: c_int) c_int; +pub extern fn uv_kill(pid: c_int, signum: c_int) c_int; +pub extern fn uv_process_get_pid([*c]const uv_process_t) uv_pid_t; +pub extern fn uv_queue_work(loop: *uv_loop_t, req: [*c]uv_work_t, work_cb: uv_work_cb, after_work_cb: uv_after_work_cb) c_int; +pub extern fn uv_cancel(req: [*c]uv_req_t) c_int; +pub const UV_DIRENT_UNKNOWN: c_int = 0; +pub const UV_DIRENT_FILE: c_int = 1; +pub const UV_DIRENT_DIR: c_int = 2; +pub const UV_DIRENT_LINK: c_int = 3; +pub const UV_DIRENT_FIFO: c_int = 4; +pub const UV_DIRENT_SOCKET: c_int = 5; +pub const UV_DIRENT_CHAR: c_int = 6; +pub const UV_DIRENT_BLOCK: c_int = 7; +pub const uv_dirent_type_t = c_uint; +pub extern fn uv_setup_args(argc: c_int, argv: [*c][*]u8) [*c][*]u8; +pub extern fn uv_get_process_title(buffer: [*]u8, size: usize) c_int; +pub extern fn uv_set_process_title(title: [*]const u8) c_int; +pub extern fn uv_resident_set_memory(rss: [*c]usize) c_int; +pub extern fn uv_uptime(uptime: [*c]f64) c_int; +pub extern fn uv_get_osfhandle(fd: c_int) uv_os_fd_t; +pub extern fn uv_open_osfhandle(os_fd: uv_os_fd_t) c_int; +pub const uv_rusage_t = extern struct { + ru_utime: uv_timeval_t, + ru_stime: uv_timeval_t, + ru_maxrss: u64, + ru_ixrss: u64, + ru_idrss: u64, + ru_isrss: u64, + ru_minflt: u64, + ru_majflt: u64, + ru_nswap: u64, + ru_inblock: u64, + ru_oublock: u64, + ru_msgsnd: u64, + ru_msgrcv: u64, + ru_nsignals: u64, + ru_nvcsw: u64, + ru_nivcsw: u64, +}; +pub extern fn uv_getrusage(rusage: [*c]uv_rusage_t) c_int; +pub extern fn uv_os_homedir(buffer: [*]u8, size: [*c]usize) c_int; +pub extern fn uv_os_tmpdir(buffer: [*]u8, size: [*c]usize) c_int; +pub extern fn uv_os_get_passwd(pwd: [*c]uv_passwd_t) c_int; +pub extern fn uv_os_free_passwd(pwd: [*c]uv_passwd_t) void; +pub extern fn uv_os_get_passwd2(pwd: [*c]uv_passwd_t, uid: uv_uid_t) c_int; +pub extern fn uv_os_get_group(grp: [*c]uv_group_t, gid: uv_uid_t) c_int; +pub extern fn uv_os_free_group(grp: [*c]uv_group_t) void; +pub extern fn uv_os_getpid() uv_pid_t; +pub extern fn uv_os_getppid() uv_pid_t; +pub extern fn uv_os_getpriority(pid: uv_pid_t, priority: [*c]c_int) c_int; +pub extern fn uv_os_setpriority(pid: uv_pid_t, priority: c_int) c_int; +pub extern fn uv_available_parallelism() c_uint; +pub extern fn uv_cpu_info(cpu_infos: [*c][*c]uv_cpu_info_t, count: [*c]c_int) c_int; +pub extern fn uv_free_cpu_info(cpu_infos: [*c]uv_cpu_info_t, count: c_int) void; +pub extern fn uv_cpumask_size() c_int; +pub extern fn uv_interface_addresses(addresses: [*c]?*uv_interface_address_t, count: [*c]c_int) c_int; +pub extern fn uv_free_interface_addresses(addresses: ?*uv_interface_address_t, count: c_int) void; +pub extern fn uv_os_environ(envitems: [*c][*c]uv_env_item_t, count: [*c]c_int) c_int; +pub extern fn uv_os_free_environ(envitems: [*c]uv_env_item_t, count: c_int) void; +pub extern fn uv_os_getenv(name: [*]const u8, buffer: [*]u8, size: [*c]usize) c_int; +pub extern fn uv_os_setenv(name: [*]const u8, value: [*]const u8) c_int; +pub extern fn uv_os_unsetenv(name: [*]const u8) c_int; +pub extern fn uv_os_gethostname(buffer: [*]u8, size: [*c]usize) c_int; +pub extern fn uv_os_uname(buffer: [*c]uv_utsname_t) c_int; +pub extern fn uv_metrics_info(loop: *uv_loop_t, metrics: [*c]uv_metrics_t) c_int; +pub extern fn uv_metrics_idle_time(loop: *uv_loop_t) u64; +pub const UV_FS_UNKNOWN: c_int = -1; +pub const UV_FS_CUSTOM: c_int = 0; +pub const UV_FS_OPEN: c_int = 1; +pub const UV_FS_CLOSE: c_int = 2; +pub const UV_FS_READ: c_int = 3; +pub const UV_FS_WRITE: c_int = 4; +pub const UV_FS_SENDFILE: c_int = 5; +pub const UV_FS_STAT: c_int = 6; +pub const UV_FS_LSTAT: c_int = 7; +pub const UV_FS_FSTAT: c_int = 8; +pub const UV_FS_FTRUNCATE: c_int = 9; +pub const UV_FS_UTIME: c_int = 10; +pub const UV_FS_FUTIME: c_int = 11; +pub const UV_FS_ACCESS: c_int = 12; +pub const UV_FS_CHMOD: c_int = 13; +pub const UV_FS_FCHMOD: c_int = 14; +pub const UV_FS_FSYNC: c_int = 15; +pub const UV_FS_FDATASYNC: c_int = 16; +pub const UV_FS_UNLINK: c_int = 17; +pub const UV_FS_RMDIR: c_int = 18; +pub const UV_FS_MKDIR: c_int = 19; +pub const UV_FS_MKDTEMP: c_int = 20; +pub const UV_FS_RENAME: c_int = 21; +pub const UV_FS_SCANDIR: c_int = 22; +pub const UV_FS_LINK: c_int = 23; +pub const UV_FS_SYMLINK: c_int = 24; +pub const UV_FS_READLINK: c_int = 25; +pub const UV_FS_CHOWN: c_int = 26; +pub const UV_FS_FCHOWN: c_int = 27; +pub const UV_FS_REALPATH: c_int = 28; +pub const UV_FS_COPYFILE: c_int = 29; +pub const UV_FS_LCHOWN: c_int = 30; +pub const UV_FS_OPENDIR: c_int = 31; +pub const UV_FS_READDIR: c_int = 32; +pub const UV_FS_CLOSEDIR: c_int = 33; +pub const UV_FS_STATFS: c_int = 34; +pub const UV_FS_MKSTEMP: c_int = 35; +pub const UV_FS_LUTIME: c_int = 36; +pub const uv_fs_type = c_int; +pub extern fn uv_fs_get_type([*c]const uv_fs_t) uv_fs_type; +pub extern fn uv_fs_get_result([*c]const uv_fs_t) isize; +pub extern fn uv_fs_get_system_error([*c]const uv_fs_t) c_int; +pub extern fn uv_fs_get_ptr([*c]const uv_fs_t) ?*anyopaque; +pub extern fn uv_fs_get_path([*c]const uv_fs_t) [*]const u8; +pub extern fn uv_fs_get_statbuf([*c]uv_fs_t) [*c]uv_stat_t; +pub extern fn uv_fs_req_cleanup(req: *uv_fs_t) void; +pub extern fn uv_fs_close(loop: *uv_loop_t, req: *uv_fs_t, file: uv_file, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_open(loop: *uv_loop_t, req: *uv_fs_t, path: [*]const u8, flags: c_int, mode: c_int, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_read(loop: *uv_loop_t, req: *uv_fs_t, file: uv_file, bufs: [*]const uv_buf_t, nbufs: c_uint, offset: i64, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_unlink(loop: *uv_loop_t, req: *uv_fs_t, path: [*]const u8, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_write(loop: *uv_loop_t, req: *uv_fs_t, file: uv_file, bufs: [*]const uv_buf_t, nbufs: c_uint, offset: i64, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_copyfile(loop: *uv_loop_t, req: *uv_fs_t, path: [*]const u8, new_path: [*]const u8, flags: c_int, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_mkdir(loop: *uv_loop_t, req: *uv_fs_t, path: [*]const u8, mode: c_int, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_mkdtemp(loop: *uv_loop_t, req: *uv_fs_t, tpl: [*]const u8, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_mkstemp(loop: *uv_loop_t, req: *uv_fs_t, tpl: [*]const u8, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_rmdir(loop: *uv_loop_t, req: *uv_fs_t, path: [*]const u8, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_scandir(loop: *uv_loop_t, req: *uv_fs_t, path: [*]const u8, flags: c_int, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_scandir_next(req: *uv_fs_t, ent: *uv_dirent_t) c_int; +pub extern fn uv_fs_opendir(loop: *uv_loop_t, req: *uv_fs_t, path: [*]const u8, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_readdir(loop: *uv_loop_t, req: *uv_fs_t, dir: [*c]uv_dir_t, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_closedir(loop: *uv_loop_t, req: *uv_fs_t, dir: [*c]uv_dir_t, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_stat(loop: *uv_loop_t, req: *uv_fs_t, path: [*]const u8, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_fstat(loop: *uv_loop_t, req: *uv_fs_t, file: uv_file, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_rename(loop: *uv_loop_t, req: *uv_fs_t, path: [*]const u8, new_path: [*]const u8, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_fsync(loop: *uv_loop_t, req: *uv_fs_t, file: uv_file, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_fdatasync(loop: *uv_loop_t, req: *uv_fs_t, file: uv_file, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_ftruncate(loop: *uv_loop_t, req: *uv_fs_t, file: uv_file, offset: i64, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_sendfile(loop: *uv_loop_t, req: *uv_fs_t, out_fd: uv_file, in_fd: uv_file, in_offset: i64, length: usize, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_access(loop: *uv_loop_t, req: *uv_fs_t, path: [*]const u8, mode: c_int, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_chmod(loop: *uv_loop_t, req: *uv_fs_t, path: [*]const u8, mode: c_int, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_utime(loop: *uv_loop_t, req: *uv_fs_t, path: [*]const u8, atime: f64, mtime: f64, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_futime(loop: *uv_loop_t, req: *uv_fs_t, file: uv_file, atime: f64, mtime: f64, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_lutime(loop: *uv_loop_t, req: *uv_fs_t, path: [*]const u8, atime: f64, mtime: f64, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_lstat(loop: *uv_loop_t, req: *uv_fs_t, path: [*]const u8, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_link(loop: *uv_loop_t, req: *uv_fs_t, path: [*]const u8, new_path: [*]const u8, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_symlink(loop: *uv_loop_t, req: *uv_fs_t, path: [*]const u8, new_path: [*]const u8, flags: c_int, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_readlink(loop: *uv_loop_t, req: *uv_fs_t, path: [*]const u8, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_realpath(loop: *uv_loop_t, req: *uv_fs_t, path: [*]const u8, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_fchmod(loop: *uv_loop_t, req: *uv_fs_t, file: uv_file, mode: c_int, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_chown(loop: *uv_loop_t, req: *uv_fs_t, path: [*]const u8, uid: uv_uid_t, gid: uv_gid_t, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_fchown(loop: *uv_loop_t, req: *uv_fs_t, file: uv_file, uid: uv_uid_t, gid: uv_gid_t, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_lchown(loop: *uv_loop_t, req: *uv_fs_t, path: [*]const u8, uid: uv_uid_t, gid: uv_gid_t, cb: uv_fs_cb) c_int; +pub extern fn uv_fs_statfs(loop: *uv_loop_t, req: *uv_fs_t, path: [*]const u8, cb: uv_fs_cb) c_int; +pub const UV_RENAME: c_int = 1; +pub const UV_CHANGE: c_int = 2; +pub const enum_uv_fs_event = c_uint; +pub extern fn uv_fs_poll_init(loop: *uv_loop_t, handle: *uv_fs_poll_t) c_int; +pub extern fn uv_fs_poll_start(handle: *uv_fs_poll_t, poll_cb: uv_fs_poll_cb, path: [*]const u8, interval: c_uint) c_int; +pub extern fn uv_fs_poll_stop(handle: *uv_fs_poll_t) c_int; +pub extern fn uv_fs_poll_getpath(handle: *uv_fs_poll_t, buffer: [*]u8, size: [*c]usize) c_int; +pub extern fn uv_signal_init(loop: *uv_loop_t, handle: *uv_signal_t) c_int; +pub extern fn uv_signal_start(handle: *uv_signal_t, signal_cb: uv_signal_cb, signum: c_int) c_int; +pub extern fn uv_signal_start_oneshot(handle: *uv_signal_t, signal_cb: uv_signal_cb, signum: c_int) c_int; +pub extern fn uv_signal_stop(handle: *uv_signal_t) c_int; +pub extern fn uv_loadavg(avg: [*c]f64) void; +pub const UV_FS_EVENT_WATCH_ENTRY: c_int = 1; +pub const UV_FS_EVENT_STAT: c_int = 2; +pub const UV_FS_EVENT_RECURSIVE: c_int = 4; +pub const enum_uv_fs_event_flags = c_uint; +pub extern fn uv_fs_event_init(loop: *uv_loop_t, handle: *uv_fs_event_t) c_int; +pub extern fn uv_fs_event_start(handle: *uv_fs_event_t, cb: uv_fs_event_cb, path: [*]const u8, flags: c_uint) c_int; +pub extern fn uv_fs_event_stop(handle: *uv_fs_event_t) c_int; +pub extern fn uv_fs_event_getpath(handle: *uv_fs_event_t, buffer: [*]u8, size: [*c]usize) c_int; +pub extern fn uv_ip4_addr(ip: [*]const u8, port: c_int, addr: [*c]sockaddr_in) c_int; +pub extern fn uv_ip6_addr(ip: [*]const u8, port: c_int, addr: ?*sockaddr_in6) c_int; +pub extern fn uv_ip4_name(src: [*c]const sockaddr_in, dst: [*]u8, size: usize) c_int; +pub extern fn uv_ip6_name(src: ?*const sockaddr_in6, dst: [*]u8, size: usize) c_int; +pub extern fn uv_ip_name(src: [*c]const sockaddr, dst: [*]u8, size: usize) c_int; +pub extern fn uv_inet_ntop(af: c_int, src: ?*const anyopaque, dst: [*]u8, size: usize) c_int; +pub extern fn uv_inet_pton(af: c_int, src: [*]const u8, dst: ?*anyopaque) c_int; +pub extern fn uv_random(loop: *uv_loop_t, req: [*c]uv_random_t, buf: ?*anyopaque, buflen: usize, flags: c_uint, cb: uv_random_cb) c_int; +pub extern fn uv_if_indextoname(ifindex: c_uint, buffer: [*]u8, size: [*c]usize) c_int; +pub extern fn uv_if_indextoiid(ifindex: c_uint, buffer: [*]u8, size: [*c]usize) c_int; +pub extern fn uv_exepath(buffer: [*]u8, size: [*c]usize) c_int; +pub extern fn uv_cwd(buffer: [*]u8, size: [*c]usize) c_int; +pub extern fn uv_chdir(dir: [*]const u8) c_int; +pub extern fn uv_get_free_memory() u64; +pub extern fn uv_get_total_memory() u64; +pub extern fn uv_get_constrained_memory() u64; +pub extern fn uv_get_available_memory() u64; +pub extern fn uv_clock_gettime(clock_id: uv_clock_id, ts: [*c]uv_timespec64_t) c_int; +pub extern fn uv_hrtime() u64; +pub extern fn uv_sleep(msec: c_uint) void; +pub extern fn uv_disable_stdio_inheritance() void; +pub extern fn uv_dlopen(filename: [*]const u8, lib: [*c]uv_lib_t) c_int; +pub extern fn uv_dlclose(lib: [*c]uv_lib_t) void; +pub extern fn uv_dlsym(lib: [*c]uv_lib_t, name: [*]const u8, ptr: [*c]?*anyopaque) c_int; +pub extern fn uv_dlerror(lib: [*c]const uv_lib_t) [*]const u8; +// pub extern fn uv_mutex_init(handle: *uv_mutex_t) c_int; +// pub extern fn uv_mutex_init_recursive(handle: *uv_mutex_t) c_int; +// pub extern fn uv_mutex_destroy(handle: *uv_mutex_t) void; +// pub extern fn uv_mutex_lock(handle: *uv_mutex_t) void; +// pub extern fn uv_mutex_trylock(handle: *uv_mutex_t) c_int; +// pub extern fn uv_mutex_unlock(handle: *uv_mutex_t) void; +// pub extern fn uv_rwlock_init(rwlock: [*c]uv_rwlock_t) c_int; +// pub extern fn uv_rwlock_destroy(rwlock: [*c]uv_rwlock_t) void; +// pub extern fn uv_rwlock_rdlock(rwlock: [*c]uv_rwlock_t) void; +// pub extern fn uv_rwlock_tryrdlock(rwlock: [*c]uv_rwlock_t) c_int; +// pub extern fn uv_rwlock_rdunlock(rwlock: [*c]uv_rwlock_t) void; +// pub extern fn uv_rwlock_wrlock(rwlock: [*c]uv_rwlock_t) void; +// pub extern fn uv_rwlock_trywrlock(rwlock: [*c]uv_rwlock_t) c_int; +// pub extern fn uv_rwlock_wrunlock(rwlock: [*c]uv_rwlock_t) void; +// pub extern fn uv_sem_init(sem: [*c]uv_sem_t, value: c_uint) c_int; +// pub extern fn uv_sem_destroy(sem: [*c]uv_sem_t) void; +// pub extern fn uv_sem_post(sem: [*c]uv_sem_t) void; +// pub extern fn uv_sem_wait(sem: [*c]uv_sem_t) void; +// pub extern fn uv_sem_trywait(sem: [*c]uv_sem_t) c_int; +// pub extern fn uv_cond_init(cond: [*c]uv_cond_t) c_int; +// pub extern fn uv_cond_destroy(cond: [*c]uv_cond_t) void; +// pub extern fn uv_cond_signal(cond: [*c]uv_cond_t) void; +// pub extern fn uv_cond_broadcast(cond: [*c]uv_cond_t) void; +// pub extern fn uv_barrier_init(barrier: [*c]uv_barrier_t, count: c_uint) c_int; +// pub extern fn uv_barrier_destroy(barrier: [*c]uv_barrier_t) void; +// pub extern fn uv_barrier_wait(barrier: [*c]uv_barrier_t) c_int; +// pub extern fn uv_cond_wait(cond: [*c]uv_cond_t, mutex: [*c]uv_mutex_t) void; +// pub extern fn uv_cond_timedwait(cond: [*c]uv_cond_t, mutex: [*c]uv_mutex_t, timeout: u64) c_int; +pub extern fn uv_once(guard: [*c]uv_once_t, callback: ?*const fn () callconv(.C) void) void; +pub extern fn uv_key_create(key: [*c]uv_key_t) c_int; +pub extern fn uv_key_delete(key: [*c]uv_key_t) void; +pub extern fn uv_key_get(key: [*c]uv_key_t) ?*anyopaque; +pub extern fn uv_key_set(key: [*c]uv_key_t, value: ?*anyopaque) void; +pub extern fn uv_gettimeofday(tv: [*c]uv_timeval64_t) c_int; +pub const uv_thread_cb = ?*const fn (?*anyopaque) callconv(.C) void; +pub extern fn uv_thread_create(tid: [*c]uv_thread_t, entry: uv_thread_cb, arg: ?*anyopaque) c_int; +pub const UV_THREAD_NO_FLAGS: c_int = 0; +pub const UV_THREAD_HAS_STACK_SIZE: c_int = 1; +pub const uv_thread_create_flags = c_uint; +pub const struct_uv_thread_options_s = extern struct { + flags: c_uint, + stack_size: usize, +}; +pub const uv_thread_options_t = struct_uv_thread_options_s; +pub extern fn uv_thread_create_ex(tid: [*c]uv_thread_t, params: [*c]const uv_thread_options_t, entry: uv_thread_cb, arg: ?*anyopaque) c_int; +pub extern fn uv_thread_setaffinity(tid: [*c]uv_thread_t, cpumask: [*]u8, oldmask: [*]u8, mask_size: usize) c_int; +pub extern fn uv_thread_getaffinity(tid: [*c]uv_thread_t, cpumask: [*]u8, mask_size: usize) c_int; +pub extern fn uv_thread_getcpu() c_int; +pub extern fn uv_thread_self() uv_thread_t; +pub extern fn uv_thread_join(tid: [*c]uv_thread_t) c_int; +pub extern fn uv_thread_equal(t1: [*c]const uv_thread_t, t2: [*c]const uv_thread_t) c_int; +pub const union_uv_any_handle = extern union { + @"async": uv_async_t, + check: uv_check_t, + fs_event: uv_fs_event_t, + fs_poll: uv_fs_poll_t, + handle: uv_handle_t, + idle: uv_idle_t, + pipe: uv_pipe_t, + poll: uv_poll_t, + prepare: uv_prepare_t, + process: uv_process_t, + stream: uv_stream_t, + tcp: uv_tcp_t, + timer: uv_timer_t, + tty: uv_tty_t, + udp: uv_udp_t, + signal: uv_signal_t, +}; +pub const union_uv_any_req = extern union { + req: uv_req_t, + connect: uv_connect_t, + write: uv_write_t, + shutdown: uv_shutdown_t, + udp_send: uv_udp_send_t, + fs: uv_fs_t, + work: uv_work_t, + getaddrinfo: uv_getaddrinfo_t, + getnameinfo: uv_getnameinfo_t, + random: uv_random_t, +}; +pub extern fn uv_loop_get_data([*c]const uv_loop_t) ?*anyopaque; +pub extern fn uv_loop_set_data(*uv_loop_t, data: ?*anyopaque) void; diff --git a/src/deps/uws.zig b/src/deps/uws.zig index 8ca0f260b70e0..4aa0b15e10ef1 100644 --- a/src/deps/uws.zig +++ b/src/deps/uws.zig @@ -21,6 +21,28 @@ fn NativeSocketHandleType(comptime ssl: bool) type { return anyopaque; } } +pub const InternalLoopData = extern struct { + pub const us_internal_async = opaque {}; + + sweep_timer: ?*Timer, + wakeup_async: ?*us_internal_async, + last_write_failed: i32, + head: ?*SocketContext, + iterator: ?*SocketContext, + recv_buf: [*]u8, + ssl_data: ?*anyopaque, + pre_cb: ?*fn (?*Loop) callconv(.C) void, + post_cb: ?*fn (?*Loop) callconv(.C) void, + closed_head: ?*Socket, + low_prio_head: ?*Socket, + low_prio_budget: i32, + iteration_nr: c_longlong, + + pub fn recvSlice(this: *InternalLoopData) []u8 { + return this.recv_buf[0..LIBUS_RECV_BUFFER_LENGTH]; + } +}; + pub fn NewSocketHandler(comptime is_ssl: bool) type { return struct { const ssl_int: i32 = @intFromBool(is_ssl); @@ -797,12 +819,10 @@ pub const SocketContext = opaque { pub fn deinit(this: *SocketContext, ssl: bool) void { this.close(ssl); //always deinit in next iteration - if (Loop.get()) |loop| { - if (ssl) { - loop.nextTick(*SocketContext, this, SocketContext._deinit_ssl); - } else { - loop.nextTick(*SocketContext, this, SocketContext._deinit); - } + if (ssl) { + Loop.get().nextTick(*SocketContext, this, SocketContext._deinit_ssl); + } else { + Loop.get().nextTick(*SocketContext, this, SocketContext._deinit); } } @@ -825,7 +845,7 @@ pub const SocketContext = opaque { return @as(*align(alignment) ContextType, @ptrCast(@alignCast(ptr))); } }; -pub const Loop = extern struct { +pub const PosixLoop = extern struct { internal_loop_data: InternalLoopData align(16), /// Number of non-fallthrough polls in the loop @@ -856,57 +876,47 @@ pub const Loop = extern struct { const log = bun.Output.scoped(.Loop, false); - pub const InternalLoopData = extern struct { - pub const us_internal_async = opaque {}; - - sweep_timer: ?*Timer, - wakeup_async: ?*us_internal_async, - last_write_failed: i32, - head: ?*SocketContext, - iterator: ?*SocketContext, - recv_buf: [*]u8, - ssl_data: ?*anyopaque, - pre_cb: ?*fn (?*Loop) callconv(.C) void, - post_cb: ?*fn (?*Loop) callconv(.C) void, - closed_head: ?*Socket, - low_prio_head: ?*Socket, - low_prio_budget: i32, - iteration_nr: c_longlong, - - pub fn recvSlice(this: *InternalLoopData) []u8 { - return this.recv_buf[0..LIBUS_RECV_BUFFER_LENGTH]; - } - }; + pub fn inc(this: *PosixLoop) void { + this.num_polls += 1; + } - pub fn ref(this: *Loop) void { + pub fn dec(this: *PosixLoop) void { + this.num_polls -= 1; + } + + pub fn ref(this: *PosixLoop) void { log("ref", .{}); this.num_polls += 1; this.active += 1; } - pub fn refConcurrently(this: *Loop) void { + pub fn refConcurrently(this: *PosixLoop) void { _ = @atomicRmw(@TypeOf(this.num_polls), &this.num_polls, .Add, 1, .Monotonic); _ = @atomicRmw(@TypeOf(this.active), &this.active, .Add, 1, .Monotonic); log("refConcurrently ({d}, {d})", .{ this.num_polls, this.active }); } - pub fn unrefConcurrently(this: *Loop) void { + pub fn unrefConcurrently(this: *PosixLoop) void { _ = @atomicRmw(@TypeOf(this.num_polls), &this.num_polls, .Sub, 1, .Monotonic); _ = @atomicRmw(@TypeOf(this.active), &this.active, .Sub, 1, .Monotonic); log("unrefConcurrently ({d}, {d})", .{ this.num_polls, this.active }); } - pub fn unref(this: *Loop) void { + pub fn unref(this: *PosixLoop) void { log("unref", .{}); this.num_polls -= 1; this.active -|= 1; } - pub fn unrefCount(this: *Loop, count: i32) void { + pub fn isActive(this: *const Loop) bool { + return this.active > 0; + } + + pub fn unrefCount(this: *PosixLoop, count: i32) void { log("unref x {d}", .{count}); this.num_polls -|= count; this.active -|= @as(u32, @intCast(count)); } - pub fn get() ?*Loop { + pub fn get() *Loop { return uws_get_loop(); } @@ -920,19 +930,23 @@ pub const Loop = extern struct { ).?; } - pub fn wakeup(this: *Loop) void { + pub fn wakeup(this: *PosixLoop) void { return us_wakeup_loop(this); } - pub fn tick(this: *Loop, ctx: ?*anyopaque) void { - us_loop_run_bun_tick(this, 0, ctx); + pub const wake = wakeup; + + pub fn tick(this: *PosixLoop) void { + us_loop_run_bun_tick(this, 0); } - pub fn tickWithTimeout(this: *Loop, timeoutMs: i64, ctx: ?*anyopaque) void { - us_loop_run_bun_tick(this, timeoutMs, ctx); + pub fn tickWithTimeout(this: *PosixLoop, timeoutMs: i64) void { + us_loop_run_bun_tick(this, timeoutMs); } - pub fn nextTick(this: *Loop, comptime UserType: type, user_data: UserType, comptime deferCallback: fn (ctx: UserType) void) void { + extern fn us_loop_run_bun_tick(loop: ?*Loop, timouetMs: i64) void; + + pub fn nextTick(this: *PosixLoop, comptime UserType: type, user_data: UserType, comptime deferCallback: fn (ctx: UserType) void) void { const Handler = struct { pub fn callback(data: *anyopaque) callconv(.C) void { deferCallback(@as(UserType, @ptrCast(@alignCast(data)))); @@ -956,7 +970,7 @@ pub const Loop = extern struct { }; } - pub fn addPostHandler(this: *Loop, comptime UserType: type, ctx: UserType, comptime callback: fn (UserType) void) NewHandler(UserType, callback) { + pub fn addPostHandler(this: *PosixLoop, comptime UserType: type, ctx: UserType, comptime callback: fn (UserType) void) NewHandler(UserType, callback) { const Handler = NewHandler(UserType, callback); uws_loop_addPostHandler(this, ctx, Handler.callback); @@ -965,7 +979,7 @@ pub const Loop = extern struct { }; } - pub fn addPreHandler(this: *Loop, comptime UserType: type, ctx: UserType, comptime callback: fn (UserType) void) NewHandler(UserType, callback) { + pub fn addPreHandler(this: *PosixLoop, comptime UserType: type, ctx: UserType, comptime callback: fn (UserType) void) NewHandler(UserType, callback) { const Handler = NewHandler(UserType, callback); uws_loop_addPreHandler(this, ctx, Handler.callback); @@ -974,33 +988,12 @@ pub const Loop = extern struct { }; } - pub fn run(this: *Loop) void { + pub fn run(this: *PosixLoop) void { us_loop_run(this); } - - extern fn uws_loop_defer(loop: *Loop, ctx: *anyopaque, cb: *const (fn (ctx: *anyopaque) callconv(.C) void)) void; - - extern fn uws_get_loop() ?*Loop; - extern fn us_create_loop( - hint: ?*anyopaque, - wakeup_cb: ?*const fn (*Loop) callconv(.C) void, - pre_cb: ?*const fn (*Loop) callconv(.C) void, - post_cb: ?*const fn (*Loop) callconv(.C) void, - ext_size: c_uint, - ) ?*Loop; - extern fn us_loop_free(loop: ?*Loop) void; - extern fn us_loop_ext(loop: ?*Loop) ?*anyopaque; - extern fn us_loop_run(loop: ?*Loop) void; - extern fn us_loop_run_bun_tick(loop: ?*Loop, timouetMs: i64, ?*anyopaque) void; - extern fn us_wakeup_loop(loop: ?*Loop) void; - extern fn us_loop_integrate(loop: ?*Loop) void; - extern fn us_loop_iteration_number(loop: ?*Loop) c_longlong; - extern fn uws_loop_addPostHandler(loop: *Loop, ctx: *anyopaque, cb: *const (fn (ctx: *anyopaque, loop: *Loop) callconv(.C) void)) void; - extern fn uws_loop_removePostHandler(loop: *Loop, ctx: *anyopaque, cb: *const (fn (ctx: *anyopaque, loop: *Loop) callconv(.C) void)) void; - extern fn uws_loop_addPreHandler(loop: *Loop, ctx: *anyopaque, cb: *const (fn (ctx: *anyopaque, loop: *Loop) callconv(.C) void)) void; - extern fn uws_loop_removePreHandler(loop: *Loop, ctx: *anyopaque, cb: *const (fn (ctx: *anyopaque, loop: *Loop) callconv(.C) void)) void; }; const uintmax_t = c_ulong; +extern fn uws_loop_defer(loop: *Loop, ctx: *anyopaque, cb: *const (fn (ctx: *anyopaque) callconv(.C) void)) void; extern fn us_create_timer(loop: ?*Loop, fallthrough: i32, ext_size: c_uint) *Timer; extern fn us_timer_ext(timer: ?*Timer) *?*anyopaque; @@ -2396,6 +2389,105 @@ extern fn uws_app_listen_domain_with_options( ?*anyopaque, ) void; +pub const UVLoop = extern struct { + const uv = bun.windows.libuv; + + internal_loop_data: InternalLoopData align(16), + + uv_loop: *uv.Loop, + is_default: c_int, + pre: *uv.uv_prepare_t, + check: *uv.uv_check_t, + + pub fn isActive(this: *const UVLoop) bool { + return this.uv_loop.isActive(); + } + pub fn get() *UVLoop { + return @ptrCast(uws_get_loop()); + } + + pub fn wakeup(this: *UVLoop) void { + us_wakeup_loop(this); + } + + pub const wake = wakeup; + + pub fn tickWithTimeout(this: *UVLoop, _: i64) void { + us_loop_run(this); + } + + pub fn create(comptime Handler: anytype) *UVLoop { + return us_create_loop( + null, + Handler.wakeup, + if (@hasDecl(Handler, "pre")) Handler.pre else null, + if (@hasDecl(Handler, "post")) Handler.post else null, + 0, + ).?; + } + + pub fn run(this: *UVLoop) void { + us_loop_run(this); + } + pub const tick = run; + + pub fn wait(this: *UVLoop) void { + us_loop_run(this); + } + + pub fn inc(this: *UVLoop) void { + this.uv_loop.inc(); + } + + pub fn dec(this: *UVLoop) void { + this.uv_loop.dec(); + } + + pub fn nextTick(this: *Loop, comptime UserType: type, user_data: UserType, comptime deferCallback: fn (ctx: UserType) void) void { + const Handler = struct { + pub fn callback(data: *anyopaque) callconv(.C) void { + deferCallback(@as(UserType, @ptrCast(@alignCast(data)))); + } + }; + uws_loop_defer(this, user_data, Handler.callback); + } + + fn NewHandler(comptime UserType: type, comptime callback_fn: fn (UserType) void) type { + return struct { + loop: *Loop, + pub fn removePost(handler: @This()) void { + return uws_loop_removePostHandler(handler.loop, callback); + } + pub fn removePre(handler: @This()) void { + return uws_loop_removePostHandler(handler.loop, callback); + } + pub fn callback(data: *anyopaque, _: *Loop) callconv(.C) void { + callback_fn(@as(UserType, @ptrCast(@alignCast(data)))); + } + }; + } +}; + +pub const Loop = if (bun.Environment.isWindows) UVLoop else PosixLoop; + +extern fn uws_get_loop() *Loop; +extern fn us_create_loop( + hint: ?*anyopaque, + wakeup_cb: ?*const fn (*Loop) callconv(.C) void, + pre_cb: ?*const fn (*Loop) callconv(.C) void, + post_cb: ?*const fn (*Loop) callconv(.C) void, + ext_size: c_uint, +) ?*Loop; +extern fn us_loop_free(loop: ?*Loop) void; +extern fn us_loop_ext(loop: ?*Loop) ?*anyopaque; +extern fn us_loop_run(loop: ?*Loop) void; +extern fn us_wakeup_loop(loop: ?*Loop) void; +extern fn us_loop_integrate(loop: ?*Loop) void; +extern fn us_loop_iteration_number(loop: ?*Loop) c_longlong; +extern fn uws_loop_addPostHandler(loop: *Loop, ctx: *anyopaque, cb: *const (fn (ctx: *anyopaque, loop: *Loop) callconv(.C) void)) void; +extern fn uws_loop_removePostHandler(loop: *Loop, ctx: *anyopaque, cb: *const (fn (ctx: *anyopaque, loop: *Loop) callconv(.C) void)) void; +extern fn uws_loop_addPreHandler(loop: *Loop, ctx: *anyopaque, cb: *const (fn (ctx: *anyopaque, loop: *Loop) callconv(.C) void)) void; +extern fn uws_loop_removePreHandler(loop: *Loop, ctx: *anyopaque, cb: *const (fn (ctx: *anyopaque, loop: *Loop) callconv(.C) void)) void; extern fn us_socket_pair( ctx: *SocketContext, ext_size: c_int, diff --git a/src/deps/zlib.posix.zig b/src/deps/zlib.posix.zig new file mode 100644 index 0000000000000..b38cf143796c9 --- /dev/null +++ b/src/deps/zlib.posix.zig @@ -0,0 +1,89 @@ +const uInt = c_uint; +const uLong = c_ulong; +pub const struct_internal_state = extern struct { + dummy: c_int, +}; + +// https://zlib.net/manual.html#Stream +const Byte = u8; +const Bytef = Byte; +const charf = u8; +const intf = c_int; +const uIntf = uInt; +const uLongf = uLong; +const voidpc = ?*const anyopaque; +const voidpf = ?*anyopaque; +const voidp = ?*anyopaque; +const z_crc_t = c_uint; + +// typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); +// typedef void (*free_func) OF((voidpf opaque, voidpf address)); + +pub const z_alloc_fn = ?*const fn (*anyopaque, uInt, uInt) callconv(.C) voidpf; +pub const z_free_fn = ?*const fn (*anyopaque, *anyopaque) callconv(.C) void; + +pub const zStream_struct = extern struct { + /// next input byte + next_in: [*c]const u8, + /// number of bytes available at next_in + avail_in: uInt, + /// total number of input bytes read so far + total_in: uLong, + + /// next output byte will go here + next_out: [*c]u8, + /// remaining free space at next_out + avail_out: uInt, + /// total number of bytes output so far + total_out: uLong, + + /// last error message, NULL if no error + err_msg: [*c]const u8, + /// not visible by applications + internal_state: ?*struct_internal_state, + + /// used to allocate the internal state + alloc_func: z_alloc_fn, + /// used to free the internal state + free_func: z_free_fn, + /// private data object passed to zalloc and zfree + user_data: *anyopaque, + + /// best guess about the data type: binary or text for deflate, or the decoding state for inflate + data_type: DataType, + + ///Adler-32 or CRC-32 value of the uncompressed data + adler: uLong, + /// reserved for future use + reserved: uLong, +}; + +pub const z_stream = zStream_struct; +pub const z_streamp = *z_stream; + +pub const DataType = @import("./zlib.shared.zig").DataType; +pub const FlushValue = @import("./zlib.shared.zig").FlushValue; +pub const ReturnCode = @import("./zlib.shared.zig").ReturnCode; +pub extern fn zlibVersion() [*c]const u8; + +pub extern fn deflateInit_(strm: z_streamp, level: c_int, version: [*c]const u8, stream_size: c_int) ReturnCode; +pub extern fn inflateInit_(strm: z_streamp, version: [*c]const u8, stream_size: c_int) ReturnCode; +pub extern fn deflateInit2_(strm: z_streamp, level: c_int, method: c_int, windowBits: c_int, memLevel: c_int, strategy: c_int, version: [*c]const u8, stream_size: c_int) ReturnCode; +pub extern fn inflateInit2_(strm: z_streamp, windowBits: c_int, version: [*c]const u8, stream_size: c_int) ReturnCode; +pub extern fn inflateBackInit_(strm: z_streamp, windowBits: c_int, window: [*c]u8, version: [*c]const u8, stream_size: c_int) ReturnCode; + +pub inline fn deflateInit(strm: anytype, level: anytype) ReturnCode { + return deflateInit_(strm, level, zlibVersion(), @import("std").zig.c_translation.cast(c_int, @import("std").zig.c_translation.sizeof(z_stream))); +} +pub inline fn inflateInit(strm: anytype) ReturnCode { + return inflateInit_(strm, zlibVersion(), @import("std").zig.c_translation.cast(c_int, @import("std").zig.c_translation.sizeof(z_stream))); +} +pub inline fn deflateInit2(strm: anytype, level: anytype, method: anytype, windowBits: anytype, memLevel: anytype, strategy: anytype) ReturnCode { + return deflateInit2_(strm, level, method, windowBits, memLevel, strategy, zlibVersion(), @import("std").zig.c_translation.cast(c_int, @import("std").zig.c_translation.sizeof(z_stream))); +} +pub inline fn inflateInit2(strm: anytype, windowBits: anytype) ReturnCode { + return inflateInit2_(strm, windowBits, zlibVersion(), @import("std").zig.c_translation.cast(c_int, @import("std").zig.c_translation.sizeof(z_stream))); +} +pub inline fn inflateBackInit(strm: anytype, windowBits: anytype, window: anytype) ReturnCode { + return inflateBackInit_(strm, windowBits, window, zlibVersion(), @import("std").zig.c_translation.cast(c_int, @import("std").zig.c_translation.sizeof(z_stream))); +} diff --git a/src/deps/zlib.shared.zig b/src/deps/zlib.shared.zig new file mode 100644 index 0000000000000..a198cc0ebe333 --- /dev/null +++ b/src/deps/zlib.shared.zig @@ -0,0 +1,52 @@ +// #define Z_BINARY 0 +// #define Z_TEXT 1 +// #define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ +// #define Z_UNKNOWN 2 +pub const DataType = enum(c_int) { + Binary = 0, + Text = 1, + Unknown = 2, +}; + +// #define Z_OK 0 +// #define Z_STREAM_END 1 +// #define Z_NEED_DICT 2 +// #define Z_ERRNO (-1) +// #define Z_STREAM_ERROR (-2) +// #define Z_DATA_ERROR (-3) +// #define Z_MEM_ERROR (-4) +// #define Z_BUF_ERROR (-5) +// #define Z_VERSION_ERROR (-6) +pub const ReturnCode = enum(c_int) { + Ok = 0, + StreamEnd = 1, + NeedDict = 2, + ErrNo = -1, + StreamError = -2, + DataError = -3, + MemError = -4, + BufError = -5, + VersionError = -6, +}; + +// #define Z_NO_FLUSH 0 +// #define Z_PARTIAL_FLUSH 1 +// #define Z_SYNC_FLUSH 2 +// #define Z_FULL_FLUSH 3 +// #define Z_FINISH 4 +// #define Z_BLOCK 5 +// #define Z_TREES 6 +pub const FlushValue = enum(c_int) { + NoFlush = 0, + PartialFlush = 1, + /// Z_SYNC_FLUSH requests that inflate() flush as much output as possible to the output buffer + SyncFlush = 2, + FullFlush = 3, + Finish = 4, + + /// Z_BLOCK requests that inflate() stop if and when it gets to the next / deflate block boundary When decoding the zlib or gzip format, this will / cause inflate() to return immediately after the header and before the / first block. When doing a raw inflate, inflate() will go ahead and / process the first block, and will return when it gets to the end of that / block, or when it runs out of data. / The Z_BLOCK option assists in appending to or combining deflate streams. / To assist in this, on return inflate() always sets strm->data_type to the / number of unused bits in the last byte taken from strm->next_in, plus 64 / if inflate() is currently decoding the last block in the deflate stream, / plus 128 if inflate() returned immediately after decoding an end-of-block / code or decoding the complete header up to just before the first byte of / the deflate stream. The end-of-block will not be indicated until all of / the uncompressed data from that block has been written to strm->next_out. / The number of unused bits may in general be greater than seven, except / when bit 7 of data_type is set, in which case the number of unused bits / will be less than eight. data_type is set as noted here every time / inflate() returns for all flush options, and so can be used to determine / the amount of currently consumed input in bits. + Block = 5, + + /// The Z_TREES option behaves as Z_BLOCK does, but it also returns when the end of each deflate block header is reached, before any actual data in that block is decoded. This allows the caller to determine the length of the deflate block header for later use in random access within a deflate block. 256 is added to the value of strm->data_type when inflate() returns immediately after reaching the end of the deflate block header. + Trees = 6, +}; diff --git a/src/deps/zlib.win32.zig b/src/deps/zlib.win32.zig new file mode 100644 index 0000000000000..3d6aba35cb502 --- /dev/null +++ b/src/deps/zlib.win32.zig @@ -0,0 +1,210 @@ +// zig translate-c -I${VCPKG_ROOT}/installed/x64-windows/include/ ${VCPKG_ROOT}/current/installed/x64-windows/include/zlib.h -target x86_64-windows-msvc -lc > src/deps/zlib.win32.zig +pub const rsize_t = usize; +pub const _ino_t = c_ushort; +pub const ino_t = _ino_t; +pub const _dev_t = c_uint; +pub const dev_t = _dev_t; +pub const _off_t = c_long; +pub const off_t = _off_t; +const voidpf = *anyopaque; +const Bytef = [*]u8; +const Byte = u8; +const uInt = c_uint; +const uLong = c_ulong; +const z_size_t = usize; +const intf = ReturnCode; +const uIntf = uInt; +const uLongf = uLong; +const voidpc = ?*const anyopaque; +const voidp = ?*anyopaque; +pub const alloc_func = ?*const fn (voidpf, uInt, uInt) callconv(.C) voidpf; +pub const free_func = ?*const fn (voidpf, voidpf) callconv(.C) void; +pub const z_alloc_func = alloc_func; +pub const z_free_func = free_func; +pub const struct_internal_state = opaque {}; +pub const struct_z_stream_s = extern struct { + next_in: ?[*]const u8, + avail_in: uInt, + total_in: uLong, + next_out: ?[*]u8, + avail_out: uInt, + total_out: uLong, + err_msg: ?[*:0]const u8, + internal_state: ?*struct_internal_state, + alloc_func: alloc_func, + free_func: free_func, + user_data: voidpf, + data_type: DataType, + adler: uLong, + reserved: uLong, +}; +pub const z_stream = struct_z_stream_s; +pub const z_streamp = ?*z_stream; +pub const struct_gz_header_s = extern struct { + text: c_int, + time: uLong, + xflags: c_int, + os: c_int, + extra: [*c]Bytef, + extra_len: uInt, + extra_max: uInt, + name: [*c]Bytef, + name_max: uInt, + comment: [*c]Bytef, + comm_max: uInt, + hcrc: c_int, + done: c_int, +}; +pub const gz_header = struct_gz_header_s; +pub const gz_headerp = [*c]gz_header; +pub extern fn zlibVersion() [*c]const u8; +pub extern fn deflate(strm: z_streamp, flush: FlushValue) ReturnCode; +pub extern fn deflateEnd(strm: z_streamp) ReturnCode; +pub extern fn inflate(strm: z_streamp, flush: FlushValue) ReturnCode; +pub extern fn inflateEnd(strm: z_streamp) ReturnCode; +pub extern fn deflateSetDictionary(strm: z_streamp, dictionary: [*c]const Bytef, dictLength: uInt) ReturnCode; +pub extern fn deflateGetDictionary(strm: z_streamp, dictionary: [*c]Bytef, dictLength: [*c]uInt) ReturnCode; +pub extern fn deflateCopy(dest: z_streamp, source: z_streamp) ReturnCode; +pub extern fn deflateReset(strm: z_streamp) ReturnCode; +pub extern fn deflateParams(strm: z_streamp, level: c_int, strategy: c_int) ReturnCode; +pub extern fn deflateTune(strm: z_streamp, good_length: c_int, max_lazy: c_int, nice_length: c_int, max_chain: c_int) ReturnCode; +pub extern fn deflateBound(strm: z_streamp, sourceLen: uLong) uLong; +pub extern fn deflatePending(strm: z_streamp, pending: [*c]c_uint, bits: [*c]c_int) ReturnCode; +pub extern fn deflatePrime(strm: z_streamp, bits: c_int, value: c_int) ReturnCode; +pub extern fn deflateSetHeader(strm: z_streamp, head: gz_headerp) ReturnCode; +pub extern fn inflateSetDictionary(strm: z_streamp, dictionary: [*c]const Bytef, dictLength: uInt) ReturnCode; +pub extern fn inflateGetDictionary(strm: z_streamp, dictionary: [*c]Bytef, dictLength: [*c]uInt) ReturnCode; +pub extern fn inflateSync(strm: z_streamp) ReturnCode; +pub extern fn inflateCopy(dest: z_streamp, source: z_streamp) ReturnCode; +pub extern fn inflateReset(strm: z_streamp) ReturnCode; +pub extern fn inflateReset2(strm: z_streamp, windowBits: c_int) ReturnCode; +pub extern fn inflatePrime(strm: z_streamp, bits: c_int, value: c_int) ReturnCode; +pub extern fn inflateMark(strm: z_streamp) c_long; +pub extern fn inflateGetHeader(strm: z_streamp, head: gz_headerp) ReturnCode; +pub const in_func = ?*const fn (?*anyopaque, [*c][*c]u8) callconv(.C) c_uint; +pub const out_func = ?*const fn (?*anyopaque, [*c]u8, c_uint) callconv(.C) ReturnCode; +pub extern fn inflateBack(strm: z_streamp, in: in_func, in_desc: ?*anyopaque, out: out_func, out_desc: ?*anyopaque) ReturnCode; +pub extern fn inflateBackEnd(strm: z_streamp) ReturnCode; +pub extern fn zlibCompileFlags() uLong; +pub extern fn compress(dest: [*c]Bytef, destLen: [*c]uLongf, source: [*c]const Bytef, sourceLen: uLong) ReturnCode; +pub extern fn compress2(dest: [*c]Bytef, destLen: [*c]uLongf, source: [*c]const Bytef, sourceLen: uLong, level: c_int) ReturnCode; +pub extern fn compressBound(sourceLen: uLong) uLong; +pub extern fn uncompress(dest: [*c]Bytef, destLen: [*c]uLongf, source: [*c]const Bytef, sourceLen: uLong) ReturnCode; +pub extern fn uncompress2(dest: [*c]Bytef, destLen: [*c]uLongf, source: [*c]const Bytef, sourceLen: [*c]uLong) ReturnCode; +pub const struct_gzFile_s = extern struct { + have: c_uint, + next: [*c]u8, + pos: c_longlong, +}; +pub const gzFile = [*c]struct_gzFile_s; +pub extern fn gzdopen(fd: c_int, mode: [*c]const u8) gzFile; +pub extern fn gzbuffer(file: gzFile, size: c_uint) ReturnCode; +pub extern fn gzsetparams(file: gzFile, level: c_int, strategy: c_int) ReturnCode; +pub extern fn gzread(file: gzFile, buf: voidp, len: c_uint) ReturnCode; +pub extern fn gzfread(buf: voidp, size: z_size_t, nitems: z_size_t, file: gzFile) z_size_t; +pub extern fn gzwrite(file: gzFile, buf: voidpc, len: c_uint) ReturnCode; +pub extern fn gzfwrite(buf: voidpc, size: z_size_t, nitems: z_size_t, file: gzFile) z_size_t; +pub extern fn gzprintf(file: gzFile, format: [*c]const u8, ...) ReturnCode; +pub extern fn gzputs(file: gzFile, s: [*c]const u8) ReturnCode; +pub extern fn gzgets(file: gzFile, buf: [*c]u8, len: c_int) [*c]u8; +pub extern fn gzputc(file: gzFile, c: c_int) ReturnCode; +pub extern fn gzgetc(file: gzFile) ReturnCode; +pub extern fn gzungetc(c: c_int, file: gzFile) ReturnCode; +pub extern fn gzflush(file: gzFile, flush: FlushValue) ReturnCode; +pub extern fn gzrewind(file: gzFile) ReturnCode; +pub extern fn gzeof(file: gzFile) ReturnCode; +pub extern fn gzdirect(file: gzFile) ReturnCode; +pub extern fn gzclose(file: gzFile) ReturnCode; +pub extern fn gzclose_r(file: gzFile) ReturnCode; +pub extern fn gzclose_w(file: gzFile) ReturnCode; +pub extern fn gzerror(file: gzFile, errnum: [*c]c_int) [*c]const u8; +pub extern fn gzclearerr(file: gzFile) void; +pub extern fn adler32(adler: uLong, buf: [*c]const Bytef, len: uInt) uLong; +pub extern fn adler32_z(adler: uLong, buf: [*c]const Bytef, len: z_size_t) uLong; +pub extern fn crc32(crc: uLong, buf: [*c]const Bytef, len: uInt) uLong; +pub extern fn crc32_z(crc: uLong, buf: [*c]const Bytef, len: z_size_t) uLong; +pub extern fn crc32_combine_op(crc1: uLong, crc2: uLong, op: uLong) uLong; +pub extern fn deflateInit_(strm: z_streamp, level: c_int, version: [*c]const u8, stream_size: c_int) ReturnCode; +pub extern fn inflateInit_(strm: z_streamp, version: [*c]const u8, stream_size: c_int) ReturnCode; +pub extern fn deflateInit2_(strm: z_streamp, level: c_int, method: c_int, windowBits: c_int, memLevel: c_int, strategy: c_int, version: [*c]const u8, stream_size: c_int) ReturnCode; +pub extern fn inflateInit2_(strm: z_streamp, windowBits: c_int, version: [*c]const u8, stream_size: c_int) ReturnCode; +pub extern fn inflateBackInit_(strm: z_streamp, windowBits: c_int, window: [*c]u8, version: [*c]const u8, stream_size: c_int) ReturnCode; +pub extern fn gzgetc_(file: gzFile) ReturnCode; +pub extern fn gzopen([*c]const u8, [*c]const u8) gzFile; +pub extern fn gzseek(gzFile, c_long, c_int) c_long; +pub extern fn gztell(gzFile) c_long; +pub extern fn gzoffset(gzFile) c_long; +pub extern fn adler32_combine(uLong, uLong, c_long) uLong; +pub extern fn crc32_combine(uLong, uLong, c_long) uLong; +pub extern fn crc32_combine_gen(c_long) uLong; +pub extern fn zError(c_int) [*c]const u8; +pub extern fn inflateSyncPoint(z_streamp) ReturnCode; +// pub extern fn get_crc_table() [*c]const z_crc_t; +pub extern fn inflateUndermine(z_streamp, c_int) ReturnCode; +pub extern fn inflateValidate(z_streamp, c_int) ReturnCode; +pub extern fn inflateCodesUsed(z_streamp) c_ulong; +pub extern fn inflateResetKeep(z_streamp) ReturnCode; +pub extern fn deflateResetKeep(z_streamp) ReturnCode; + +pub const z_off_t = c_long; +pub const ZLIB_VERSION = "1.2.13"; +pub const ZLIB_VERNUM = @as(c_int, 0x12d0); +pub const ZLIB_VER_MAJOR = @as(c_int, 1); +pub const ZLIB_VER_MINOR = @as(c_int, 2); +pub const ZLIB_VER_REVISION = @as(c_int, 13); +pub const ZLIB_VER_SUBREVISION = @as(c_int, 0); +pub const Z_NO_FLUSH = @as(c_int, 0); +pub const Z_PARTIAL_FLUSH = @as(c_int, 1); +pub const Z_SYNC_FLUSH = @as(c_int, 2); +pub const Z_FULL_FLUSH = @as(c_int, 3); +pub const Z_FINISH = @as(c_int, 4); +pub const Z_BLOCK = @as(c_int, 5); +pub const Z_TREES = @as(c_int, 6); +pub const Z_OK = @as(c_int, 0); +pub const Z_STREAM_END = @as(c_int, 1); +pub const Z_NEED_DICT = @as(c_int, 2); +pub const Z_ERRNO = -@as(c_int, 1); +pub const Z_STREAM_ERROR = -@as(c_int, 2); +pub const Z_DATA_ERROR = -@as(c_int, 3); +pub const Z_MEM_ERROR = -@as(c_int, 4); +pub const Z_BUF_ERROR = -@as(c_int, 5); +pub const Z_VERSION_ERROR = -@as(c_int, 6); +pub const Z_NO_COMPRESSION = @as(c_int, 0); +pub const Z_BEST_SPEED = @as(c_int, 1); +pub const Z_BEST_COMPRESSION = @as(c_int, 9); +pub const Z_DEFAULT_COMPRESSION = -@as(c_int, 1); +pub const Z_FILTERED = @as(c_int, 1); +pub const Z_HUFFMAN_ONLY = @as(c_int, 2); +pub const Z_RLE = @as(c_int, 3); +pub const Z_FIXED = @as(c_int, 4); +pub const Z_DEFAULT_STRATEGY = @as(c_int, 0); +pub const Z_BINARY = @as(c_int, 0); +pub const Z_TEXT = @as(c_int, 1); +pub const Z_ASCII = Z_TEXT; +pub const Z_UNKNOWN = @as(c_int, 2); +pub const Z_DEFLATED = @as(c_int, 8); +pub const Z_NULL = @as(c_int, 0); +pub inline fn deflateInit(strm: anytype, level: anytype) ReturnCode { + return deflateInit_(strm, level, zlibVersion(), @import("std").zig.c_translation.cast(c_int, @import("std").zig.c_translation.sizeof(z_stream))); +} +pub inline fn inflateInit(strm: anytype) ReturnCode { + return inflateInit_(strm, zlibVersion(), @import("std").zig.c_translation.cast(c_int, @import("std").zig.c_translation.sizeof(z_stream))); +} +pub inline fn deflateInit2(strm: anytype, level: anytype, method: anytype, windowBits: anytype, memLevel: anytype, strategy: anytype) ReturnCode { + return deflateInit2_(strm, level, method, windowBits, memLevel, strategy, zlibVersion(), @import("std").zig.c_translation.cast(c_int, @import("std").zig.c_translation.sizeof(z_stream))); +} +pub inline fn inflateInit2(strm: anytype, windowBits: anytype) ReturnCode { + return inflateInit2_(strm, windowBits, zlibVersion(), @import("std").zig.c_translation.cast(c_int, @import("std").zig.c_translation.sizeof(z_stream))); +} +pub inline fn inflateBackInit(strm: anytype, windowBits: anytype, window: anytype) ReturnCode { + return inflateBackInit_(strm, windowBits, window, zlibVersion(), @import("std").zig.c_translation.cast(c_int, @import("std").zig.c_translation.sizeof(z_stream))); +} +pub const internal_state = struct_internal_state; +pub const z_stream_s = struct_z_stream_s; +pub const zStream_struct = struct_z_stream_s; +pub const gz_header_s = struct_gz_header_s; +pub const gzFile_s = struct_gzFile_s; + +pub const DataType = @import("./zlib.shared.zig").DataType; +pub const FlushValue = @import("./zlib.shared.zig").FlushValue; +pub const ReturnCode = @import("./zlib.shared.zig").ReturnCode; diff --git a/src/env.zig b/src/env.zig index 65b49b18ae76f..beb2385706de8 100644 --- a/src/env.zig +++ b/src/env.zig @@ -41,17 +41,30 @@ pub const is_canary = BuildOptions.is_canary; pub const dump_source = isDebug and !isTest; pub const base_path = BuildOptions.base_path ++ "/"; +pub const version: std.SemanticVersion = BuildOptions.version; +pub const version_string = std.fmt.comptimePrint("{d}.{d}.{d}", .{ version.major, version.minor, version.patch }); + pub inline fn onlyMac() void { if (comptime !isMac) { unreachable; } } + pub const OperatingSystem = enum { mac, linux, windows, // wAsM is nOt aN oPeRaTiNg SyStEm wasm, + + pub fn displayString(self: OperatingSystem) []const u8 { + return switch (self) { + .mac => "macOS", + .linux => "Linux", + .windows => "Windows", + .wasm => "WASM", + }; + } }; pub const os: OperatingSystem = if (isMac) diff --git a/src/env_loader.zig b/src/env_loader.zig index f0bb911487788..28ffe9ed211ff 100644 --- a/src/env_loader.zig +++ b/src/env_loader.zig @@ -371,7 +371,7 @@ pub const Loader = struct { } this.did_load_process = true; - if (this.map.get("HOME")) |home_folder| { + if (this.map.get(bun.DotEnv.home_env)) |home_folder| { Analytics.username_only_for_determining_project_id_and_never_sent = home_folder; } else if (this.map.get("USER")) |home_folder| { Analytics.username_only_for_determining_project_id_and_never_sent = home_folder; @@ -1171,3 +1171,5 @@ test "DotEnv Loader - copyForDefine" { try expectString(env_defines.get("process.env.HOSTNAME").?.value.e_string.data, "example.com"); try expect(env_defines.get("process.env.THIS_SHOULDNT_BE_IN_DEFINES_MAP") == null); } + +pub const home_env = if (Environment.isWindows) "USERPROFILE" else "HOME"; diff --git a/src/feature_flags.zig b/src/feature_flags.zig index 0f7e35988ca62..a2503eafb5864 100644 --- a/src/feature_flags.zig +++ b/src/feature_flags.zig @@ -176,3 +176,5 @@ pub const export_star_redirect = false; pub const streaming_file_uploads_for_http_client = true; pub const concurrent_transpiler = true; + +pub const disable_on_windows_due_to_bugs = env.isWindows; diff --git a/src/fs.zig b/src/fs.zig index 9c0114f494e56..01a2451a95e9d 100644 --- a/src/fs.zig +++ b/src/fs.zig @@ -110,14 +110,14 @@ pub const FileSystem = struct { comptime force: bool, ) !*FileSystem { const allocator = bun.fs_allocator; - var _top_level_dir = top_level_dir orelse (if (Environment.isBrowser) "/project/" else try std.process.getCwdAlloc(allocator)); + var _top_level_dir = top_level_dir orelse (if (Environment.isBrowser) "/project/" else try bun.getcwdAlloc(allocator)); // Ensure there's a trailing separator in the top level directory // This makes path resolution more reliable - if (!std.fs.path.isSep(_top_level_dir[_top_level_dir.len - 1])) { + if (!bun.path.isSepAny(_top_level_dir[_top_level_dir.len - 1])) { const tld = try allocator.alloc(u8, _top_level_dir.len + 1); bun.copy(u8, tld, _top_level_dir); - tld[tld.len - 1] = std.fs.path.sep; + tld[tld.len - 1] = '/'; // if (!isBrowser) { // allocator.free(_top_level_dir); // } @@ -375,6 +375,8 @@ pub const FileSystem = struct { pub const Cache = struct { symlink: PathString = PathString.empty, + /// Too much code expects this to be 0 + /// don't make it bun.invalid_fd fd: StoredFileDescriptorType = 0, kind: Kind = .file, }; @@ -428,7 +430,7 @@ pub const FileSystem = struct { return @call(.always_inline, path_handler.joinStringBuf, .{ &join_buf, parts, - .auto, + .loose, }); } @@ -436,7 +438,7 @@ pub const FileSystem = struct { return @call(.always_inline, path_handler.joinStringBuf, .{ buf, parts, - .auto, + .loose, }); } @@ -465,7 +467,7 @@ pub const FileSystem = struct { const joined = path_handler.joinAbsString( f.top_level_dir, parts, - .auto, + .loose, ); return try allocator.dupe(u8, joined); } @@ -474,7 +476,7 @@ pub const FileSystem = struct { const joined = path_handler.joinAbsString( f.top_level_dir, parts, - .auto, + .loose, ); return try allocator.dupeZ(u8, joined); } @@ -483,12 +485,12 @@ pub const FileSystem = struct { return path_handler.joinAbsString( f.top_level_dir, parts, - .auto, + .loose, ); } pub fn absBuf(f: *@This(), parts: anytype, buf: []u8) string { - return path_handler.joinAbsStringBuf(f.top_level_dir, buf, parts, .auto); + return path_handler.joinAbsStringBuf(f.top_level_dir, buf, parts, .loose); } pub fn joinAlloc(f: *@This(), allocator: std.mem.Allocator, parts: anytype) !string { @@ -530,11 +532,34 @@ pub const FileSystem = struct { else => "/tmp", }; + fn platformTempDir() []const u8 { + if (comptime Environment.isWindows) { + // https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppathw#remarks + return bun.getenvZ("TMP") orelse bun.getenvZ("TEMP") orelse brk: { + if (bun.getenvZ("USERPROFILE")) |profile| { + var buf: [bun.MAX_PATH_BYTES]u8 = undefined; + var parts = [_]string{"AppData/Local/Temp"}; + var out = bun.path.joinAbsStringBuf(profile, &buf, &parts, .loose); + break :brk bun.default_allocator.dupe(u8, out) catch unreachable; + } + + return "C:/Windows/Temp"; + }; + } + + return PLATFORM_TMP_DIR; + } + + pub const Tmpfile = switch (Environment.os) { + .windows => TmpfileWindows, + else => TmpfilePosix, + }; + pub var tmpdir_path: []const u8 = undefined; pub var tmpdir_path_set = false; pub fn tmpdirPath(_: *const @This()) []const u8 { if (!tmpdir_path_set) { - tmpdir_path = bun.getenvZ("BUN_TMPDIR") orelse bun.getenvZ("TMPDIR") orelse PLATFORM_TMP_DIR; + tmpdir_path = bun.getenvZ("BUN_TMPDIR") orelse bun.getenvZ("TMPDIR") orelse platformTempDir(); tmpdir_path_set = true; } @@ -543,20 +568,18 @@ pub const FileSystem = struct { pub fn openTmpDir(_: *const RealFS) !std.fs.Dir { if (!tmpdir_path_set) { - tmpdir_path = bun.getenvZ("BUN_TMPDIR") orelse bun.getenvZ("TMPDIR") orelse PLATFORM_TMP_DIR; + tmpdir_path = bun.getenvZ("BUN_TMPDIR") orelse bun.getenvZ("TMPDIR") orelse platformTempDir(); tmpdir_path_set = true; } - return (try std.fs.cwd().openIterableDir(tmpdir_path, .{ - .access_sub_paths = true, - })).dir; + return try bun.openDirAbsolute(tmpdir_path); } pub fn entriesAt(this: *RealFS, index: allocators.IndexType, generation: bun.Generation) ?*EntriesOption { var existing = this.entries.atIndex(index) orelse return null; if (existing.* == .entries) { if (existing.entries.generation < generation) { - var handle = std.fs.Dir.openIterableDir(std.fs.cwd(), existing.entries.dir, .{}) catch |err| { + var handle = bun.openDirA(std.fs.cwd(), existing.entries.dir) catch |err| { existing.entries.data.clearAndFree(bun.fs_allocator); return this.readDirectoryError(existing.entries.dir, err) catch unreachable; @@ -601,44 +624,45 @@ pub const FileSystem = struct { return file; } - pub const Tmpfile = struct { + pub const TmpfilePosix = struct { fd: bun.FileDescriptor = bun.invalid_fd, dir_fd: bun.FileDescriptor = bun.invalid_fd, - pub inline fn dir(this: *Tmpfile) std.fs.Dir { + pub inline fn dir(this: *TmpfilePosix) std.fs.Dir { return std.fs.Dir{ .fd = bun.fdcast(this.dir_fd), }; } - pub inline fn file(this: *Tmpfile) std.fs.File { + pub inline fn file(this: *TmpfilePosix) std.fs.File { return std.fs.File{ .handle = bun.fdcast(this.fd), }; } - pub fn close(this: *Tmpfile) void { + pub fn close(this: *TmpfilePosix) void { if (this.fd != bun.invalid_fd) _ = bun.sys.close(this.fd); } - pub fn create(this: *Tmpfile, rfs: *RealFS, name: [*:0]const u8) !void { + pub fn create(this: *TmpfilePosix, rfs: *RealFS, name: [:0]const u8) !void { var tmpdir_ = try rfs.openTmpDir(); const flags = std.os.O.CREAT | std.os.O.RDWR | std.os.O.CLOEXEC; this.dir_fd = bun.toFD(tmpdir_.fd); - this.fd = bun.toFD(try std.os.openatZ(tmpdir_.fd, name, flags, if (comptime Environment.isPosix) std.os.S.IRWXU else 0)); + const result = try bun.sys.openat(tmpdir_.fd, name, flags, std.os.S.IRWXU).unwrap(); + this.fd = bun.toFD(result); } - pub fn promote(this: *Tmpfile, from_name: [*:0]const u8, destination_fd: std.os.fd_t, name: [*:0]const u8) !void { + pub fn promoteToCWD(this: *TmpfilePosix, from_name: [*:0]const u8, name: [*:0]const u8) !void { std.debug.assert(this.fd != bun.invalid_fd); std.debug.assert(this.dir_fd != bun.invalid_fd); - try C.moveFileZWithHandle(bun.fdcast(this.fd), bun.fdcast(this.dir_fd), from_name, destination_fd, name); + try C.moveFileZWithHandle(bun.fdcast(this.fd), bun.fdcast(this.dir_fd), from_name, std.fs.cwd().fd, name); this.close(); } - pub fn closeAndDelete(this: *Tmpfile, name: [*:0]const u8) void { + pub fn closeAndDelete(this: *TmpfilePosix, name: [*:0]const u8) void { this.close(); if (comptime !Environment.isLinux) { @@ -649,6 +673,61 @@ pub const FileSystem = struct { } }; + pub const TmpfileWindows = struct { + fd: bun.FileDescriptor = bun.invalid_fd, + existing_path: []const u8 = "", + + pub inline fn dir(_: *TmpfileWindows) std.fs.Dir { + return Fs.FileSystem.instance.tmpdir(); + } + + pub inline fn file(this: *TmpfileWindows) std.fs.File { + return std.fs.File{ + .handle = bun.fdcast(this.fd), + }; + } + + pub fn close(this: *TmpfileWindows) void { + if (this.fd != bun.invalid_fd) _ = bun.sys.close(this.fd); + } + + pub fn create(this: *TmpfileWindows, rfs: *RealFS, name: [:0]const u8) !void { + var tmpdir_ = try rfs.openTmpDir(); + + const flags = std.os.O.CREAT | std.os.O.WRONLY | std.os.O.CLOEXEC; + + var result = try bun.sys.openat(bun.toFD(tmpdir_.fd), name, flags, 0).unwrap(); + this.fd = bun.toFD(result); + var buf: [bun.MAX_PATH_BYTES]u8 = undefined; + const existing_path = try bun.getFdPath(this.fd, &buf); + this.existing_path = try bun.default_allocator.dupe(u8, existing_path); + } + + pub fn promoteToCWD(this: *TmpfileWindows, from_name: [*:0]const u8, name: [:0]const u8) !void { + _ = from_name; + var existing_buf: bun.MAX_WPATH = undefined; + var new_buf: bun.MAX_WPATH = undefined; + this.close(); + const existing = bun.strings.toExtendedPathNormalized(&new_buf, this.existing_path); + const new = if (std.fs.path.isAbsoluteWindows(name)) + bun.strings.toExtendedPathNormalized(&existing_buf, name) + else + bun.strings.toWPathNormalized(&existing_buf, name); + if (comptime Environment.allow_assert) { + debug("moveFileExW({s}, {s})", .{ strings.fmtUTF16(existing), strings.fmtUTF16(new) }); + } + + if (bun.windows.kernel32.MoveFileExW(existing.ptr, new.ptr, bun.windows.MOVEFILE_COPY_ALLOWED | bun.windows.MOVEFILE_REPLACE_EXISTING | bun.windows.MOVEFILE_WRITE_THROUGH) == bun.windows.FALSE) { + try bun.windows.Win32Error.get().unwrap(); + } + } + + pub fn closeAndDelete(this: *TmpfileWindows, name: [*:0]const u8) void { + _ = name; + this.close(); + } + }; + inline fn _fetchCacheFile(fs: *RealFS, basename: string) !std.fs.File { var parts = [_]string{ "node_modules", ".cache", basename }; var path = fs.parent_fs.join(&parts); @@ -832,10 +911,17 @@ pub const FileSystem = struct { pub const Map = allocators.BSSMap(EntriesOption, Preallocate.Counts.dir_entry, false, 256, true); }; - pub fn openDir(_: *RealFS, unsafe_dir_string: string) std.fs.File.OpenError!std.fs.Dir { - const dir = try std.os.open(unsafe_dir_string, std.os.O.DIRECTORY, 0); + pub fn openDir(_: *RealFS, unsafe_dir_string: string) !std.fs.Dir { + const dirfd = if (Environment.isWindows) + bun.sys.openDirAtWindowsA(bun.invalid_fd, unsafe_dir_string, true, true) + else + bun.sys.openA( + unsafe_dir_string, + std.os.O.DIRECTORY, + 0, + ); return std.fs.Dir{ - .fd = dir, + .fd = bun.fdcast(try dirfd.unwrap()), }; } @@ -1392,7 +1478,7 @@ pub const PathName = struct { return if (this.dir.len == 0) "./" else this.dir.ptr[0 .. this.dir.len + @as( usize, @intCast(@intFromBool( - this.dir[this.dir.len - 1] != std.fs.path.sep_posix and (@intFromPtr(this.dir.ptr) + this.dir.len + 1) == @intFromPtr(this.base.ptr), + !bun.path.isSepAny(this.dir[this.dir.len - 1]) and (@intFromPtr(this.dir.ptr) + this.dir.len + 1) == @intFromPtr(this.base.ptr), )), )]; } @@ -1403,8 +1489,15 @@ pub const PathName = struct { var ext: []const u8 = undefined; var dir = path; var is_absolute = true; + const has_disk_designator = path.len > 2 and path[1] == ':' and switch (path[0]) { + 'a'...'z', 'A'...'Z' => true, + else => false, + } and bun.path.isSepAny(path[2]); + if (has_disk_designator) { + path = path[2..]; + } - var _i = strings.lastIndexOfChar(path, '/'); + var _i = bun.path.lastIndexOfSep(path); while (_i) |i| { // Stop if we found a non-trailing slash if (i + 1 != path.len and path.len > i + 1) { @@ -1417,7 +1510,7 @@ pub const PathName = struct { // Ignore trailing slashes path = path[0..i]; - _i = strings.lastIndexOfChar(path, '/'); + _i = bun.path.lastIndexOfSep(path); } // Strip off the extension @@ -1432,10 +1525,14 @@ pub const PathName = struct { dir = &([_]u8{}); } - if (base.len > 1 and base[base.len - 1] == '/') { + if (base.len > 1 and bun.path.isSepAny(base[base.len - 1])) { base = base[0 .. base.len - 1]; } + if (!is_absolute and has_disk_designator) { + dir = _path[0 .. dir.len + 2]; + } + return PathName{ .dir = dir, .base = base, diff --git a/src/http/websocket_http_client.zig b/src/http/websocket_http_client.zig index 9516934f19ed3..1f821812ec22d 100644 --- a/src/http/websocket_http_client.zig +++ b/src/http/websocket_http_client.zig @@ -23,6 +23,8 @@ const WebsocketDataFrame = @import("./websocket.zig").WebsocketDataFrame; const Opcode = @import("./websocket.zig").Opcode; const ZigURL = @import("../url.zig").URL; +const Async = bun.Async; + const log = Output.scoped(.WebSocketClient, false); const NonUTF8Headers = struct { @@ -190,7 +192,7 @@ pub fn NewHTTPUpgradeClient(comptime ssl: bool) type { body: std.ArrayListUnmanaged(u8) = .{}, websocket_protocol: u64 = 0, hostname: [:0]const u8 = "", - poll_ref: JSC.PollRef = .{}, + poll_ref: Async.KeepAlive = .{}, pub const name = if (ssl) "WebSocketHTTPSClient" else "WebSocketHTTPClient"; @@ -200,7 +202,7 @@ pub fn NewHTTPUpgradeClient(comptime ssl: bool) type { pub fn register(global: *JSC.JSGlobalObject, loop_: *anyopaque, ctx_: *anyopaque) callconv(.C) void { var vm = global.bunVM(); - var loop = @as(*uws.Loop, @ptrCast(@alignCast(loop_))); + var loop: *bun.Async.Loop = @alignCast(@ptrCast(loop_)); var ctx: *uws.SocketContext = @as(*uws.SocketContext, @ptrCast(ctx_)); if (vm.event_loop_handle) |other| { @@ -872,7 +874,7 @@ pub fn NewWebSocketClient(comptime ssl: bool) type { send_buffer: bun.LinearFifo(u8, .Dynamic), globalThis: *JSC.JSGlobalObject, - poll_ref: JSC.PollRef = JSC.PollRef.init(), + poll_ref: Async.KeepAlive = Async.KeepAlive.init(), initial_data_handler: ?*InitialDataHandler = null, @@ -889,12 +891,12 @@ pub fn NewWebSocketClient(comptime ssl: bool) type { var ctx: *uws.SocketContext = @as(*uws.SocketContext, @ptrCast(ctx_)); - if (vm.event_loop_handle) |other| { - std.debug.assert(other == loop); + if (comptime Environment.isPosix) { + if (vm.event_loop_handle) |other| { + std.debug.assert(other == loop); + } } - vm.event_loop_handle = loop; - Socket.configure( ctx, false, diff --git a/src/http_client_async.zig b/src/http_client_async.zig index fac496620337c..aa224d5399260 100644 --- a/src/http_client_async.zig +++ b/src/http_client_async.zig @@ -724,7 +724,7 @@ pub const HTTPThread = struct { Output.Source.configureNamedThread("HTTP Client"); default_arena = Arena.init() catch unreachable; default_allocator = default_arena.allocator(); - var loop = uws.Loop.create(struct { + var loop = bun.uws.Loop.create(struct { pub fn wakeup(_: *uws.Loop) callconv(.C) void { http_thread.drainEvents(); } @@ -790,7 +790,8 @@ pub const HTTPThread = struct { } fn processEvents_(this: *@This()) void { - this.loop.num_polls = @max(2, this.loop.num_polls); + if (comptime Environment.isPosix) + this.loop.num_polls = @max(2, this.loop.num_polls); while (true) { this.drainEvents(); @@ -1425,10 +1426,10 @@ pub const InternalState = struct { body_out_str.list.expandToCapacity(); } reader.list = body_out_str.list; - reader.zlib.next_out = &body_out_str.list.items[initial]; + reader.zlib.next_out = @ptrCast(&body_out_str.list.items[initial]); reader.zlib.avail_out = @as(u32, @truncate(body_out_str.list.capacity - initial)); // we reset the total out so we can track how much we decompressed this time - reader.zlib.total_out = initial; + reader.zlib.total_out = @truncate(initial); } else { reader = try Zlib.ZlibReaderArrayList.initWithOptionsAndListAllocator( buffer, diff --git a/src/install/install.zig b/src/install/install.zig index fd0aaf16bb1ca..dbe03f7c6501e 100644 --- a/src/install/install.zig +++ b/src/install/install.zig @@ -888,9 +888,15 @@ const PackageInstall = struct { .symlink = true, }); + pub const windows = BackendSupport.initDefault(false, .{ + .hardlink = true, + .copyfile = true, + }); + pub inline fn isSupported(this: Method) bool { if (comptime Environment.isMac) return macOS.get(this); if (comptime Environment.isLinux) return linux.get(this); + if (comptime Environment.isWindows) return windows.get(this); return false; } @@ -1030,7 +1036,7 @@ const PackageInstall = struct { step: Step, pub inline fn isPackageMissingFromCache(this: @This()) bool { - return this.err == error.FileNotFound and this.step == .opening_cache_dir; + return (this.err == error.FileNotFound or this.err == error.ENOENT) and this.step == .opening_cache_dir; } }, pending: void, @@ -1225,8 +1231,6 @@ const PackageInstall = struct { if (comptime Environment.isPosix) { const stat = infile.stat() catch continue; _ = C.fchmod(outfile.handle, stat.mode); - } else { - bun.todo(@src(), {}); } bun.copyFile(infile.handle, outfile.handle) catch |err| { @@ -1275,10 +1279,37 @@ const PackageInstall = struct { }; defer walker_.deinit(); + var buf: if (Environment.isWindows) [2048]u16 else [0]u16 = undefined; + var buf2: if (Environment.isWindows) [2048]u16 else [0]u16 = undefined; + var to_copy_buf: []u16 = undefined; + var to_copy_buf2: []u16 = undefined; + if (comptime Environment.isWindows) { + buf[0] = '\\'; + buf[1] = '\\'; + buf[2] = '?'; + buf[3] = '\\'; + + strings.copyU8IntoU16(buf[3..], this.destination_dir_subpath); + buf[3 + this.destination_dir_subpath.len] = 0; + + buf2[0] = '\\'; + buf2[1] = '\\'; + buf2[2] = '?'; + buf2[3] = '\\'; + strings.copyU8IntoU16(buf2[3..], this.cache_dir_subpath); + + to_copy_buf = buf[0 .. 4 + this.destination_dir_subpath.len :0]; + to_copy_buf2 = buf2[0 .. 4 + this.cache_dir_subpath.len :0]; + } + const FileCopier = struct { pub fn copy( destination_dir_: std.fs.IterableDir, walker: *Walker, + to_copy_into1: if (Environment.isWindows) []u16 else void, + head1: if (Environment.isWindows) []u16 else void, + to_copy_into2: if (Environment.isWindows) []u16 else void, + head2: if (Environment.isWindows) []u16 else void, ) !u32 { var real_file_count: u32 = 0; while (try walker.next()) |entry| { @@ -1287,14 +1318,47 @@ const PackageInstall = struct { std.os.mkdirat(destination_dir_.dir.fd, entry.path, 0o755) catch {}; }, .file => { - std.os.linkat(entry.dir.dir.fd, entry.basename, destination_dir_.dir.fd, entry.path, 0) catch |err| { - if (err != error.PathAlreadyExists) { - return err; + if (comptime Environment.isWindows) { + if (entry.path.len > to_copy_into1.len or entry.path.len > to_copy_into2.len) { + return error.NameTooLong; } - std.os.unlinkat(destination_dir_.dir.fd, entry.path, 0) catch {}; - try std.os.linkat(entry.dir.dir.fd, entry.basename, destination_dir_.dir.fd, entry.path, 0); - }; + // TODO: this copy shouldn't be necessary in the first place. + strings.copyU8IntoU16( + to_copy_into1, + entry.path, + ); + head1[entry.path.len + (head1.len - to_copy_into1.len)] = 0; + var dest: [:0]u16 = head1[0 .. entry.path.len + head1.len - to_copy_into1.len :0]; + + strings.copyU8IntoU16( + to_copy_into2, + entry.path, + ); + head2[entry.path.len + (head1.len - to_copy_into2.len)] = 0; + var src: [:0]u16 = head2[0 .. entry.path.len + head2.len - to_copy_into2.len :0]; + + // Windows limits hardlinks to 1023 per file + if (bun.windows.CreateHardLinkW(dest, src, null) == 0) { + if (bun.windows.CopyFileW(src, dest, 0) == 0) { + if (bun.windows.Win32Error.get().toSystemErrno()) |_| { + // TODO: make this better + return error.FailedToCopyFile; + } + + return error.FailedToCopyFile; + } + } + } else { + std.os.linkat(entry.dir.dir.fd, entry.basename, destination_dir_.dir.fd, entry.path, 0) catch |err| { + if (err != error.PathAlreadyExists) { + return err; + } + + std.os.unlinkat(destination_dir_.dir.fd, entry.path, 0) catch {}; + try std.os.linkat(entry.dir.dir.fd, entry.basename, destination_dir_.dir.fd, entry.path, 0); + }; + } real_file_count += 1; }, @@ -1315,11 +1379,24 @@ const PackageInstall = struct { this.file_count = FileCopier.copy( subdir, &walker_, - ) catch |err| switch (err) { - error.NotSameFileSystem => return err, - else => return Result{ + if (Environment.isWindows) to_copy_buf else void{}, + if (Environment.isWindows) &buf else void{}, + if (Environment.isWindows) to_copy_buf2 else void{}, + if (Environment.isWindows) &buf2 else void{}, + ) catch |err| { + if (comptime Environment.isWindows) { + if (err == error.FailedToCopyFile) { + return Result{ + .fail = .{ .err = err, .step = .copying_files }, + }; + } + } else if (err == error.NotSameFileSystem or err == error.ENXIO) { + return err; + } + + return Result{ .fail = .{ .err = err, .step = .copying_files }, - }, + }; }; return Result{ @@ -1575,10 +1652,10 @@ const PackageInstall = struct { return result; } else |err| { switch (err) { - error.NotSameFileSystem => { - supported_method = .copyfile; - supported_method_to_use = .copyfile; - }, + // error.ENXIO => { + // supported_method = .copyfile; + // supported_method_to_use = .copyfile; + // }, error.FileNotFound => return Result{ .fail = .{ .err = error.FileNotFound, .step = .opening_cache_dir }, }, @@ -1636,8 +1713,11 @@ const TaskCallbackContext = union(Tag) { const TaskCallbackList = std.ArrayListUnmanaged(TaskCallbackContext); const TaskDependencyQueue = std.HashMapUnmanaged(u64, TaskCallbackList, IdentityContext(u64), 80); -const TaskChannel = sync.Channel(Task, .{ .Static = 4096 }); -const NetworkChannel = sync.Channel(*NetworkTask, .{ .Static = 8192 }); + +// Windows seems to stack overflow in debug builds due to the size of these allocations. +const TaskChannel = sync.Channel(Task, .{ .Static = 4096 / (if (Environment.isWindows) 16 else 1) }); +const NetworkChannel = sync.Channel(*NetworkTask, .{ .Static = 8192 / (if (Environment.isWindows) 16 else 1) }); + const ThreadPool = bun.ThreadPool; const PackageManifestMap = std.HashMapUnmanaged(PackageNameHash, Npm.PackageManifest, IdentityContext(PackageNameHash), 80); const RepositoryMap = std.HashMapUnmanaged(u64, bun.FileDescriptor, IdentityContext(u64), 80); @@ -1649,7 +1729,7 @@ pub const CacheLevel = struct { use_last_modified: bool, }; const AsyncIO = bun.AsyncIO; -const Waker = AsyncIO.Waker; +const Waker = if (Environment.isPosix) bun.AsyncIO.Waker else *bun.uws.UVLoop; // We can't know all the packages we need until we've downloaded all the packages // The easy way would be: @@ -1783,13 +1863,13 @@ pub const PackageManager = struct { } _ = this.wait_count.fetchAdd(1, .Monotonic); - this.waiter.wake() catch {}; + this.waiter.wake(); } pub fn sleep(this: *PackageManager) void { if (this.wait_count.swap(0, .Monotonic) > 0) return; Output.flush(); - _ = this.waiter.wait() catch 0; + this.waiter.wait(); } const DependencyToEnqueue = union(enum) { @@ -2987,7 +3067,7 @@ pub const PackageManager = struct { ); } - try tmpfile.promote(tmpname, std.fs.cwd().fd, "yarn.lock"); + try tmpfile.promoteToCWD(tmpname, "yarn.lock"); } pub fn isRootDependency(this: *const PackageManager, id: DependencyID) bool { @@ -3073,7 +3153,14 @@ pub const PackageManager = struct { } } - break :version dependency.version; + // explicit copy here due to `dependency.version` becoming undefined + // when `getOrPutResolvedPackageWithFindResult` is called and resizes the list. + break :version Dependency.Version{ + .literal = dependency.version.literal, + .tag = dependency.version.tag, + .value = dependency.version.value, + }; + // break :version dependency.version; }; var loaded_manifest: ?Npm.PackageManifest = null; @@ -3997,7 +4084,7 @@ pub const PackageManager = struct { return CacheDir{ .path = Fs.FileSystem.instance.abs(&parts), .is_node_modules = false }; } - if (env.map.get("HOME")) |dir| { + if (env.map.get(bun.DotEnv.home_env)) |dir| { var parts = [_]string{ dir, ".bun/", "install/", "cache/" }; return CacheDir{ .path = Fs.FileSystem.instance.abs(&parts), .is_node_modules = false }; } @@ -4781,7 +4868,7 @@ pub const PackageManager = struct { return try std.fs.cwd().makeOpenPathIterable(path, .{}); } - if (bun.getenvZ("XDG_CACHE_HOME") orelse bun.getenvZ("HOME")) |home_dir| { + if (bun.getenvZ("XDG_CACHE_HOME") orelse bun.getenvZ(bun.DotEnv.home_env)) |home_dir| { var buf: [bun.MAX_PATH_BYTES]u8 = undefined; var parts = [_]string{ ".bun", @@ -5579,7 +5666,7 @@ pub const PackageManager = struct { break :brk child_json; }; - try bun.sys.chdir(fs.top_level_dir).throw(); + try bun.sys.chdir(fs.top_level_dir).unwrap(); try BunArguments.loadConfig(ctx.allocator, cli.config, ctx, .InstallCommand); bun.copy(u8, &cwd_buf, fs.top_level_dir); cwd_buf[fs.top_level_dir.len] = '/'; @@ -5645,7 +5732,7 @@ pub const PackageManager = struct { .resolve_tasks = TaskChannel.init(), .lockfile = undefined, .root_package_json_file = package_json_file, - .waiter = try Waker.init(ctx.allocator), + .waiter = if (Environment.isPosix) try Waker.init(ctx.allocator) else bun.uws.Loop.get(), .workspaces = workspaces, // .progress }; @@ -5724,7 +5811,7 @@ pub const PackageManager = struct { .resolve_tasks = TaskChannel.init(), .lockfile = undefined, .root_package_json_file = undefined, - .waiter = try Waker.init(allocator), + .waiter = if (Environment.isPosix) try Waker.init(allocator) else bun.uws.Loop.get(), .workspaces = std.StringArrayHashMap(?Semver.Version).init(allocator), }; manager.lockfile = try allocator.create(Lockfile); @@ -6320,7 +6407,7 @@ pub const PackageManager = struct { var buf2: [bun.MAX_PATH_BYTES]u8 = undefined; var final_path: [:0]u8 = undefined; if (cwd_.len > 0 and cwd_[0] == '.') { - var cwd = try std.os.getcwd(&buf); + var cwd = try bun.getcwd(&buf); var parts = [_]string{cwd_}; var path_ = Path.joinAbsStringBuf(cwd, &buf2, &parts, .auto); buf2[path_.len] = 0; @@ -6330,7 +6417,7 @@ pub const PackageManager = struct { buf[cwd_.len] = 0; final_path = buf[0..cwd_.len :0]; } - try bun.sys.chdir(final_path).throw(); + try bun.sys.chdir(final_path).unwrap(); } const specified_backend: ?PackageInstall.Method = brk: { @@ -7238,7 +7325,7 @@ pub const PackageManager = struct { const path_str = Path.joinAbsString( bun.getFdPath(bun.toFD(this.node_modules_folder.dir.fd), &path_buf) catch unreachable, &[_]string{destination_dir_subpath}, - .posix, + .auto, ); scripts.enqueueFromPackageJSON( @@ -7564,9 +7651,11 @@ pub const PackageManager = struct { const cwd = std.fs.cwd(); var node_modules_folder = cwd.openIterableDir("node_modules", .{}) catch brk: { skip_verify_installed_version_number = true; - (if (comptime Environment.isWindows) std.os.mkdiratW(cwd.fd, bun.strings.w("node_modules"), 0) else cwd.makeDirZ("node_modules")) catch |err| { - Output.prettyErrorln("error: {s} creating node_modules folder", .{@errorName(err)}); - Global.crash(); + bun.sys.mkdir("node_modules", 0o755).unwrap() catch |err| { + if (err != error.EEXIST) { + Output.prettyErrorln("error: {s} creating node_modules folder", .{@errorName(err)}); + Global.crash(); + } }; break :brk cwd.openIterableDir("node_modules", .{}) catch |err| { Output.prettyErrorln("error: {s} opening node_modules folder", .{@errorName(err)}); diff --git a/src/install/lockfile.zig b/src/install/lockfile.zig index a4a23a5408428..fbc3e09d44d4f 100644 --- a/src/install/lockfile.zig +++ b/src/install/lockfile.zig @@ -995,7 +995,7 @@ pub const Printer = struct { var lockfile_path: stringZ = ""; if (!std.fs.path.isAbsolute(path)) { - var cwd = try std.os.getcwd(&lockfile_path_buf1); + var cwd = try bun.getcwd(&lockfile_path_buf1); var parts = [_]string{path}; var lockfile_path__ = Path.joinAbsStringBuf(cwd, &lockfile_path_buf2, &parts, .auto); lockfile_path_buf2[lockfile_path__.len] = 0; @@ -1295,7 +1295,7 @@ pub const Printer = struct { // internal for debugging, print the lockfile as custom json // limited to debug because we don't want people to rely on this format. if (Environment.isDebug) { - if (std.os.getenv("JSON")) |_| { + if (std.process.hasEnvVarConstant("JSON")) { try std.json.stringify( this.lockfile, .{ @@ -1583,7 +1583,7 @@ pub fn saveToDisk(this: *Lockfile, filename: stringZ) void { var tmpfile = FileSystem.RealFS.Tmpfile{}; var secret: [32]u8 = undefined; std.mem.writeIntNative(u64, secret[0..8], @as(u64, @intCast(std.time.milliTimestamp()))); - var base64_bytes: [64]u8 = undefined; + var base64_bytes: [16]u8 = undefined; std.crypto.random.bytes(&base64_bytes); const tmpname__ = std.fmt.bufPrint(tmpname_buf[8..], "{s}", .{std.fmt.fmtSliceHexLower(&base64_bytes)}) catch unreachable; @@ -1614,7 +1614,7 @@ pub fn saveToDisk(this: *Lockfile, filename: stringZ) void { ); } - tmpfile.promote(tmpname, std.fs.cwd().fd, filename) catch |err| { + tmpfile.promoteToCWD(tmpname, filename) catch |err| { tmpfile.dir().deleteFileZ(tmpname) catch {}; Output.prettyErrorln("error: failed to save lockfile: {s}", .{@errorName(err)}); Global.crash(); @@ -2334,9 +2334,13 @@ pub const Package = extern struct { subpath: [:0]const u8, cwd: string, ) !void { - var pkg_dir = try bun.openDir(node_modules, subpath); - defer pkg_dir.close(); - const json_file = try pkg_dir.dir.openFileZ("package.json", .{ .mode = .read_only }); + var json_file_fd = try bun.sys.openat( + bun.toFD(node_modules.fd), + bun.path.joinZ([_]string{ subpath, "package.json" }, .auto), + std.os.O.RDONLY, + 0, + ).unwrap(); + const json_file = std.fs.File{ .handle = bun.fdcast(json_file_fd) }; defer json_file.close(); const json_stat_size = try json_file.getEndPos(); const json_buf = try lockfile.allocator.alloc(u8, json_stat_size + 64); @@ -2910,10 +2914,14 @@ pub const Package = extern struct { if (switch (version.tag) { .workspace => if (to_lockfile.workspace_paths.getPtr(from_dep.name_hash)) |path_ptr| brk: { const path = to_lockfile.str(path_ptr); - var file = std.fs.cwd().openFile(Path.join( + var local_buf: [bun.MAX_PATH_BYTES]u8 = undefined; + var package_json_path = Path.joinZBuf( + &local_buf, &[_]string{ path, "package.json" }, .auto, - ), .{ .mode = .read_only }) catch break :brk false; + ); + var file = try bun.openFileZ(package_json_path, .{ .mode = .read_only }); + defer file.close(); const bytes = try file.readToEndAlloc(allocator, std.math.maxInt(usize)); defer allocator.free(bytes); @@ -3137,20 +3145,21 @@ pub const Package = extern struct { } } else { const workspace = dependency_version.value.workspace.slice(buf); - const path = string_builder.append( - String, - if (strings.eqlComptime(workspace, "*")) "*" else Path.relative( + const path = string_builder.append(String, if (strings.eqlComptime(workspace, "*")) "*" else brk: { + var buf2: [bun.MAX_PATH_BYTES]u8 = undefined; + break :brk Path.relative( FileSystem.instance.top_level_dir, - Path.joinAbsString( + Path.joinAbsStringBuf( FileSystem.instance.top_level_dir, + &buf2, &[_]string{ source.path.name.dir, workspace, }, .posix, ), - ), - ); + ); + }); if (comptime Environment.allow_assert) { std.debug.assert(path.len() > 0); std.debug.assert(!std.fs.path.isAbsolute(path.slice(buf))); @@ -3328,7 +3337,13 @@ pub const Package = extern struct { const paths = [_]string{ path, "package.json" }; break :brk bun.path.joinStringBuf(path_buf, &paths, .auto); }; - var workspace_file = try dir.openFile(path_to_use, .{ .mode = .read_only }); + + // TODO: windows + var workspace_file = dir.openFile(path_to_use, .{ .mode = .read_only }) catch |err| { + debug("processWorkspaceName({s}) = {} ", .{ path_to_use, err }); + return err; + }; + defer workspace_file.close(); const workspace_bytes = try workspace_file.readToEndAlloc(workspace_allocator, std.math.maxInt(usize)); @@ -3346,6 +3361,7 @@ pub const Package = extern struct { .name = name_to_copy[0..workspace_json.found_name.len], .path = path_to_use, }; + debug("processWorkspaceName({s}) = {s}", .{ path_to_use, entry.name }); if (workspace_json.has_found_version) { const version = SlicedString.init(workspace_json.found_version, workspace_json.found_version); const result = Semver.Version.parse(version); @@ -3453,7 +3469,7 @@ pub const Package = extern struct { item.loc, allocator, "{s} reading package.json for workspace package \"{s}\" from \"{s}\"", - .{ @errorName(err), input_path, std.os.getcwd(allocator.alloc(u8, bun.MAX_PATH_BYTES) catch unreachable) catch unreachable }, + .{ @errorName(err), input_path, bun.getcwd(allocator.alloc(u8, bun.MAX_PATH_BYTES) catch unreachable) catch unreachable }, ) catch {}; }, } @@ -3500,7 +3516,7 @@ pub const Package = extern struct { 0, true, ) catch |err| switch (err) { - error.FileNotFound => { + error.ENOENT => { log.addWarningFmt( source, loc, @@ -3510,7 +3526,7 @@ pub const Package = extern struct { ) catch {}; continue; }, - error.NotDir => { + error.ENOTDIR => { log.addWarningFmt( source, loc, @@ -3542,16 +3558,15 @@ pub const Package = extern struct { ); if (entry.cache.fd == 0) { - entry.cache.fd = bun.toFD(std.os.openatZ( - std.fs.cwd().fd, + entry.cache.fd = bun.toFD(bun.sys.open( entry_path, - std.os.O.DIRECTORY | std.os.O.CLOEXEC | std.os.O.NOCTTY, + std.os.O.DIRECTORY | std.os.O.CLOEXEC | std.os.O.NOCTTY | std.os.O.RDONLY, 0, - ) catch continue); + ).unwrap() catch continue); } const dir_fd = entry.cache.fd; - std.debug.assert(dir_fd != 0); // kind() should've opened + std.debug.assert(dir_fd != bun.invalid_fd); // kind() should've opened defer fallback.fixed_buffer_allocator.reset(); const workspace_entry = processWorkspaceName( diff --git a/src/install/repository.zig b/src/install/repository.zig index 17afec0790c88..38dfd3e8b36aa 100644 --- a/src/install/repository.zig +++ b/src/install/repository.zig @@ -113,7 +113,7 @@ pub const Repository = extern struct { fn exec(allocator: std.mem.Allocator, env: *DotEnv.Loader, cwd_dir: std.fs.Dir, argv: []const string) !string { const buf_map = try env.map.cloneToEnvMap(allocator); - const result = try std.ChildProcess.exec(.{ + const result = try std.ChildProcess.run(.{ .allocator = allocator, .argv = argv, .cwd_dir = cwd_dir, diff --git a/src/io/io_darwin.zig b/src/io/io_darwin.zig index cb2d15afbe120..df03237d16a5b 100644 --- a/src/io/io_darwin.zig +++ b/src/io/io_darwin.zig @@ -512,7 +512,7 @@ pub const Waker = struct { const zeroed = std.mem.zeroes([16]Kevent64); - pub fn wake(this: *Waker) !void { + pub fn wake(this: *Waker) void { bun.JSC.markBinding(@src()); if (io_darwin_schedule_wakeup(this.machport)) { @@ -522,11 +522,11 @@ pub const Waker = struct { this.has_pending_wake = true; } - pub fn wait(this: Waker) !usize { + pub fn wait(this: Waker) void { bun.JSC.markBinding(@src()); var events = zeroed; - const count = std.os.system.kevent64( + _ = std.os.system.kevent64( this.kq, &events, 0, @@ -535,12 +535,6 @@ pub const Waker = struct { 0, null, ); - - if (count < 0) { - return asError(std.c.getErrno(count)); - } - - return @as(usize, @intCast(count)); } extern fn io_darwin_create_machport( diff --git a/src/io/io_linux.zig b/src/io/io_linux.zig index 8f054490b7699..1cbf222d44907 100644 --- a/src/io/io_linux.zig +++ b/src/io/io_linux.zig @@ -997,13 +997,12 @@ pub const Waker = struct { }; } - pub fn wait(this: Waker) !u64 { + pub fn wait(this: Waker) void { var bytes: usize = 0; _ = std.os.read(this.fd, @as(*[8]u8, @ptrCast(&bytes))) catch 0; - return @as(u64, @intCast(bytes)); } - pub fn wake(this: *const Waker) !void { + pub fn wake(this: *const Waker) void { var bytes: usize = 1; _ = std.os.write( this.fd, diff --git a/src/io/io_windows.zig b/src/io/io_windows.zig index 47f813c35b1de..cf795c28008a6 100644 --- a/src/io/io_windows.zig +++ b/src/io/io_windows.zig @@ -115,14 +115,14 @@ pub const Waker = struct { }; } - pub fn wait(this: Waker) !u64 { + pub fn wait(this: Waker) u64 { var overlapped = [_]os.windows.OVERLAPPED_ENTRY{std.mem.zeroes(os.windows.OVERLAPPED_ENTRY)} ** 1; var removed: u32 = 0; _ = kernel32.GetQueuedCompletionStatusEx(this.iocp, &overlapped, 1, &removed, 0, 1); return 0; } - pub fn wake(this: Waker) !void { + pub fn wake(this: Waker) void { var overlapped: os.windows.OVERLAPPED = std.mem.zeroes(os.windows.OVERLAPPED); _ = kernel32.PostQueuedCompletionStatus(this.iocp, 1, completion_key, &overlapped); } @@ -430,11 +430,8 @@ pub fn open( .flags = flags, }, struct { - fn do_operation(ctx: Completion.Context, op: anytype) OpenError!bun.FileDescriptor { - _ = ctx; - const result = bun.sys.openat(bun.invalid_fd, op.path, op.flags, 0); - try result.throw(); - return result.result; + fn do_operation(_: Completion.Context, op: anytype) OpenError!bun.FileDescriptor { + return try bun.sys.openat(bun.invalid_fd, op.path, op.flags, 0).unwrap(); } }, ); diff --git a/src/js/_codegen/build-modules.ts b/src/js/_codegen/build-modules.ts deleted file mode 100644 index 3591d812e81e2..0000000000000 --- a/src/js/_codegen/build-modules.ts +++ /dev/null @@ -1,460 +0,0 @@ -import fs from "fs"; -import path from "path"; -import { sliceSourceCode } from "./builtin-parser"; -import { cap, checkAscii, fmtCPPString, readdirRecursive, resolveSyncOrNull } from "./helpers"; -import { createAssertClientJS, createLogClientJS } from "./client-js"; -import { builtinModules } from "node:module"; -import { BuildConfig } from "bun"; -import { define } from "./replacements"; - -const t = new Bun.Transpiler({ loader: "tsx" }); - -let start = performance.now(); -function mark(log: string) { - const now = performance.now(); - console.log(`${log} (${(now - start).toFixed(0)}ms)`); - start = now; -} - -const BASE = path.join(import.meta.dir, "../"); -const TMP = path.join(BASE, "out/tmp"); - -const moduleList = ["bun", "node", "thirdparty", "internal"] - .flatMap(dir => readdirRecursive(path.join(BASE, dir))) - .filter(file => file.endsWith(".js") || (file.endsWith(".ts") && !file.endsWith(".d.ts"))) - .map(file => file.slice(BASE.length)) - .sort(); - -const internalRegistry = new Map(); - -// Build Registry -for (let i = 0; i < moduleList.length; i++) { - const prefix = moduleList[i].startsWith("node/") - ? "node:" - : moduleList[i].startsWith("bun:") - ? "bun/" - : moduleList[i].startsWith("internal/") - ? "internal/" - : undefined; - if (prefix) { - const id = prefix + moduleList[i].slice(prefix.length).replaceAll(".", "/").slice(0, -3); - internalRegistry.set(id, i); - } -} - -// Native Module registry -const nativeModuleH = fs.readFileSync(path.join(BASE, "../bun.js/modules/_NativeModule.h"), "utf8"); -const nativeModuleDefine = nativeModuleH.match(/BUN_FOREACH_NATIVE_MODULE\(macro\)\s*\\\n((.*\\\n)*\n)/); -if (!nativeModuleDefine) { - throw new Error( - "Could not find BUN_FOREACH_NATIVE_MODULE in _NativeModule.h. Knowing native module IDs is a part of the codegen process.", - ); -} -let nextNativeModuleId = 0; -const nativeModuleIds: Record = {}; -const nativeModuleEnums: Record = {}; -const nativeModuleEnumToId: Record = {}; -for (const [_, idString, enumValue] of nativeModuleDefine[0].matchAll(/macro\((.*?),(.*?)\)/g)) { - const processedIdString = JSON.parse(idString.trim().replace(/_s$/, "")); - const processedEnumValue = enumValue.trim(); - const processedNumericId = nextNativeModuleId++; - nativeModuleIds[processedIdString] = processedNumericId; - nativeModuleEnums[processedIdString] = processedEnumValue; - nativeModuleEnumToId[processedEnumValue] = processedNumericId; -} - -mark("Scan internal registry"); - -function codegenRequireId(id: string) { - return `(__intrinsic__getInternalField(__intrinsic__internalModuleRegistry, ${id}) || __intrinsic__createInternalModuleById(${id}))`; -} - -function codegenRequireNativeModule(id: string) { - return `(__intrinsic__requireNativeModule(${id.replace(/node:/, "")}))`; -} - -globalThis.requireTransformer = (specifier: string, from: string) => { - // this one is deprecated - if (specifier === "$shared") specifier = "./internal/shared.ts"; - - const directMatch = internalRegistry.get(specifier); - if (directMatch) return codegenRequireId(`${directMatch}/*${specifier}*/`); - - if (specifier in nativeModuleIds) { - return codegenRequireNativeModule(JSON.stringify(specifier)); - } - - const relativeMatch = - resolveSyncOrNull(specifier, path.join(BASE, path.dirname(from))) ?? resolveSyncOrNull(specifier, BASE); - - if (relativeMatch) { - const found = moduleList.indexOf(path.relative(BASE, relativeMatch)); - if (found === -1) { - throw new Error( - `Builtin Bundler: "${specifier}" cannot be imported here because it doesn't get a module ID. Only files in "src/js" besides "src/js/builtins" can be used here. Note that the 'node:' or 'bun:' prefix is required here. `, - ); - } - return codegenRequireId(`${found}/*${path.relative(BASE, relativeMatch)}*/`); - } - - throw new Error(`Builtin Bundler: Could not resolve "${specifier}" in ${from}.`); -}; - -// Preprocess builtins -const bundledEntryPoints: string[] = []; -for (let i = 0; i < moduleList.length; i++) { - try { - let input = fs.readFileSync(path.join(BASE, moduleList[i]), "utf8"); - - const scannedImports = t.scanImports(input); - for (const imp of scannedImports) { - if (imp.kind === "import-statement") { - var isBuiltin = true; - try { - if (!builtinModules.includes(imp.path)) { - globalThis.requireTransformer(imp.path, moduleList[i]); - } - } catch { - isBuiltin = false; - } - if (isBuiltin) { - throw new Error(`Cannot use ESM import on builtin modules. Use require("${imp.path}") instead.`); - } - } - } - - let importStatements: string[] = []; - - const processed = sliceSourceCode( - "{" + - input - .replace( - /\bimport(\s*type)?\s*(\{[^}]*\}|(\*\s*as)?\s[a-zA-Z0-9_$]+)\s*from\s*['"][^'"]+['"]/g, - stmt => (importStatements.push(stmt), ""), - ) - .replace(/export\s*{\s*}\s*;/g, ""), - true, - x => globalThis.requireTransformer(x, moduleList[i]), - ); - let fileToTranspile = `// @ts-nocheck -// GENERATED TEMP FILE - DO NOT EDIT -// Sourced from src/js/${moduleList[i]} -${importStatements.join("\n")} - -${processed.result.slice(1).trim()} -$$EXPORT$$(__intrinsic__exports).$$EXPORT_END$$; -`; - - // Attempt to optimize "$exports = ..." to a variableless return - // otherwise, declare $exports so it works. - let exportOptimization = false; - fileToTranspile = fileToTranspile.replace( - /__intrinsic__exports\s*=\s*(.*|.*\{[^\}]*}|.*\([^\)]*\))\n+\s*\$\$EXPORT\$\$\(__intrinsic__exports\).\$\$EXPORT_END\$\$;/, - (_, a) => { - exportOptimization = true; - return "$$EXPORT$$(" + a.replace(/;$/, "") + ").$$EXPORT_END$$;"; - }, - ); - if (!exportOptimization) { - fileToTranspile = `var $;` + fileToTranspile.replaceAll("__intrinsic__exports", "$"); - } - const outputPath = path.join(TMP, moduleList[i].slice(0, -3) + ".ts"); - fs.mkdirSync(path.dirname(outputPath), { recursive: true }); - fs.writeFileSync(outputPath, fileToTranspile); - bundledEntryPoints.push(outputPath); - } catch (error) { - console.error(error); - console.error(`While processing: ${moduleList[i]}`); - process.exit(1); - } -} - -mark("Preprocess modules"); - -const config = ({ platform, debug }: { platform: string; debug?: boolean }) => - ({ - entrypoints: bundledEntryPoints, - // Whitespace and identifiers are not minified to give better error messages when an error happens in our builtins - minify: { syntax: !debug, whitespace: false }, - root: TMP, - target: "bun", - external: builtinModules, - define: { - ...define, - IS_BUN_DEVELOPMENT: String(!!debug), - __intrinsic__debug: debug ? "$debug_log_enabled" : "false", - "process.platform": JSON.stringify(platform), - }, - } satisfies BuildConfig); -const bundled_dev = await Bun.build(config({ platform: process.platform, debug: true })); -const bundled_linux = await Bun.build(config({ platform: "linux" })); -const bundled_darwin = await Bun.build(config({ platform: "darwin" })); -const bundled_win32 = await Bun.build(config({ platform: "win32" })); -for (const bundled of [bundled_dev, bundled_linux, bundled_darwin, bundled_win32]) { - if (!bundled.success) { - console.error(bundled.logs); - process.exit(1); - } -} - -mark("Bundle modules"); - -const bundledOutputs = { - host: new Map(), - linux: new Map(), - darwin: new Map(), - win32: new Map(), -}; - -for (const [name, bundle, outputs] of [ - ["modules_dev", bundled_dev, bundledOutputs.host], - ["modules_linux", bundled_linux, bundledOutputs.linux], - ["modules_darwin", bundled_darwin, bundledOutputs.darwin], - ["modules_win32", bundled_win32, bundledOutputs.win32], -] as const) { - for (const file of bundle.outputs) { - const output = await file.text(); - let captured = `(function (){${output.replace("// @bun\n", "").trim()}})`; - let usesDebug = output.includes("$debug_log"); - let usesAssert = output.includes("$assert"); - captured = - captured - .replace( - `var __require = (id) => { - return import.meta.require(id); -};`, - "", - ) - .replace(/var\s*__require\s*=\s*\(?id\)?\s*=>\s*{\s*return\s*import.meta.require\(id\)\s*};?/, "") - .replace(/var __require=\(?id\)?=>import.meta.require\(id\);?/, "") - .replace(/\$\$EXPORT\$\$\((.*)\).\$\$EXPORT_END\$\$;/, "return $1") - .replace(/]\s*,\s*__(debug|assert)_end__\)/g, ")") - .replace(/]\s*,\s*__debug_end__\)/g, ")") - // .replace(/__intrinsic__lazy\(/g, "globalThis[globalThis.Symbol.for('Bun.lazy')](") - .replace(/import.meta.require\((.*?)\)/g, (expr, specifier) => { - try { - const str = JSON.parse(specifier); - return globalThis.requireTransformer(str, file.path); - } catch { - throw new Error( - `Builtin Bundler: import.meta.require() must be called with a string literal. Found ${specifier}. (in ${file.path}))`, - ); - } - }) - .replace(/__intrinsic__/g, "@") + "\n"; - captured = captured.replace( - /function\s*\(.*?\)\s*{/, - '$&"use strict";' + - (usesDebug - ? createLogClientJS( - file.path.replace(".js", ""), - idToPublicSpecifierOrEnumName(file.path).replace(/^node:|^bun:/, ""), - ) - : "") + - (usesAssert ? createAssertClientJS(idToPublicSpecifierOrEnumName(file.path).replace(/^node:|^bun:/, "")) : ""), - ); - const outputPath = path.join(BASE, "out", name, file.path); - if (name === "modules_dev") { - fs.mkdirSync(path.dirname(outputPath), { recursive: true }); - fs.writeFileSync(outputPath, captured); - } - outputs.set(file.path.replace(".js", ""), captured); - } -} - -mark("Postprocesss modules"); - -function idToEnumName(id: string) { - return id - .replace(/\.[mc]?[tj]s$/, "") - .replace(/[^a-zA-Z0-9]+/g, " ") - .split(" ") - .map(x => (["jsc", "ffi", "vm", "tls", "os", "ws", "fs", "dns"].includes(x) ? x.toUpperCase() : cap(x))) - .join(""); -} - -function idToPublicSpecifierOrEnumName(id: string) { - id = id.replace(/\.[mc]?[tj]s$/, ""); - if (id.startsWith("node/")) { - return "node:" + id.slice(5).replaceAll(".", "/"); - } else if (id.startsWith("bun/")) { - return "bun:" + id.slice(4).replaceAll(".", "/"); - } else if (id.startsWith("internal/")) { - return "internal:" + id.slice(9).replaceAll(".", "/"); - } else if (id.startsWith("thirdparty/")) { - return id.slice(11).replaceAll(".", "/"); - } - return idToEnumName(id); -} - -// This is a file with a single macro that is used in defining InternalModuleRegistry.h -fs.writeFileSync( - path.join(BASE, "out/InternalModuleRegistry+numberOfModules.h"), - `#define BUN_INTERNAL_MODULE_COUNT ${moduleList.length}\n`, -); - -// This code slice is used in InternalModuleRegistry.h for inlining the enum. I dont think we -// actually use this enum but it's probably a good thing to include. -fs.writeFileSync( - path.join(BASE, "out/InternalModuleRegistry+enum.h"), - `${ - moduleList - .map((id, n) => { - return `${idToEnumName(id)} = ${n},`; - }) - .join("\n") + "\n" - } -`, -); - -// This code slice is used in InternalModuleRegistry.cpp. It defines the loading function for modules. -fs.writeFileSync( - path.join(BASE, "out/InternalModuleRegistry+createInternalModuleById.h"), - `// clang-format off -JSValue InternalModuleRegistry::createInternalModuleById(JSGlobalObject* globalObject, VM& vm, Field id) -{ - switch (id) { - // JS internal modules - ${moduleList - .map((id, n) => { - return `case Field::${idToEnumName(id)}: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "${idToPublicSpecifierOrEnumName(id)}"_s, ${JSON.stringify( - id.replace(/\.[mc]?[tj]s$/, ".js"), - )}_s, InternalModuleRegistryConstants::${idToEnumName(id)}Code, "builtin://${id - .replace(/\.[mc]?[tj]s$/, "") - .replace(/[^a-zA-Z0-9]+/g, "/")}"_s); - }`; - }) - .join("\n ")} - } -} -`, -); - -// This header is used by InternalModuleRegistry.cpp, and should only be included in that file. -// It inlines all the strings for the module IDs. -// -// We cannot use ASCIILiteral's `_s` operator for the module source code because for long -// strings it fails a constexpr assert. Instead, we do that assert in JS before we format the string -fs.writeFileSync( - path.join(BASE, "out/InternalModuleRegistryConstants.h"), - `// clang-format off -#pragma once - -namespace Bun { -namespace InternalModuleRegistryConstants { - -#if __APPLE__ - ${moduleList - .map( - (id, n) => - `// -static constexpr ASCIILiteral ${idToEnumName(id)}Code = ASCIILiteral::fromLiteralUnsafe(${fmtCPPString( - checkAscii(bundledOutputs.darwin.get(id.slice(0, -3))), - )}); -// -`, - ) - .join("\n")} - #elif _WIN32 - ${moduleList - .map( - (id, n) => - `// -static constexpr ASCIILiteral ${idToEnumName(id)}Code = ASCIILiteral::fromLiteralUnsafe(${fmtCPPString( - checkAscii(bundledOutputs.win32.get(id.slice(0, -3))), - )}); -// -`, - ) - .join("\n")} - #else - // Not 100% accurate, but basically inlining linux on non-windows non-mac platforms. - ${moduleList - .map( - (id, n) => - `// -static constexpr ASCIILiteral ${idToEnumName(id)}Code = ASCIILiteral::fromLiteralUnsafe(${fmtCPPString( - checkAscii(bundledOutputs.linux.get(id.slice(0, -3))), - )}); -// -`, - ) - .join("\n")} -#endif - -} -}`, -); - -// This is a generated enum for zig code (exports.zig) -fs.writeFileSync( - path.join(BASE, "out/ResolvedSourceTag.zig"), - `// zig fmt: off -pub const ResolvedSourceTag = enum(u32) { - // Predefined - javascript = 0, - package_json_type_module = 1, - wasm = 2, - object = 3, - file = 4, - esm = 5, - json_for_object_loader = 6, - - // Built in modules are loaded through InternalModuleRegistry by numerical ID. - // In this enum are represented as \`(1 << 9) & id\` -${moduleList.map((id, n) => ` @"${idToPublicSpecifierOrEnumName(id)}" = ${(1 << 9) | n},`).join("\n")} - // Native modules run through a different system using ESM registry. -${Object.entries(nativeModuleIds) - .map(([id, n]) => ` @"${id}" = ${(1 << 10) | n},`) - .join("\n")} -}; -`, -); - -// This is a generated enum for c++ code (headers-handwritten.h) -fs.writeFileSync( - path.join(BASE, "out/SyntheticModuleType.h"), - `enum SyntheticModuleType : uint32_t { - JavaScript = 0, - PackageJSONTypeModule = 1, - Wasm = 2, - ObjectModule = 3, - File = 4, - ESM = 5, - JSONForObjectLoader = 6, - - // Built in modules are loaded through InternalModuleRegistry by numerical ID. - // In this enum are represented as \`(1 << 9) & id\` - InternalModuleRegistryFlag = 1 << 9, -${moduleList.map((id, n) => ` ${idToEnumName(id)} = ${(1 << 9) | n},`).join("\n")} - - // Native modules run through the same system, but with different underlying initializers. - // They also have bit 10 set to differentiate them from JS builtins. - NativeModuleFlag = (1 << 10) | (1 << 9), -${Object.entries(nativeModuleEnumToId) - .map(([id, n]) => ` ${id} = ${(1 << 10) | n},`) - .join("\n")} -}; - -`, -); - -// This is used in ModuleLoader.cpp to link to all the headers for native modules. -fs.writeFileSync( - path.join(BASE, "out/NativeModuleImpl.h"), - Object.values(nativeModuleEnums) - .map(value => `#include "../../bun.js/modules/${value}Module.h"`) - .join("\n") + "\n", -); - -// This is used for debug builds for the base path for dynamic loading -fs.writeFileSync( - path.join(BASE, "out/DebugPath.h"), - `// Using __FILE__ does not give an absolute file path -// This is a workaround for that. -#define BUN_DYNAMIC_JS_LOAD_PATH "${path.join(BASE, "out/")}" -`, -); - -mark("Generate Code"); diff --git a/src/js/_codegen/helpers.ts b/src/js/_codegen/helpers.ts deleted file mode 100644 index 74680b956cbd9..0000000000000 --- a/src/js/_codegen/helpers.ts +++ /dev/null @@ -1,53 +0,0 @@ -import fs from "fs"; -import path from "path"; -import { isAscii } from "buffer"; - -export function fmtCPPString(str: string) { - return ( - '"' + - str - .replace(/\\/g, "\\\\") - .replace(/"/g, '\\"') - .replace(/\n/g, "\\n") - .replace(/\r/g, "\\r") - .replace(/\t/g, "\\t") - .replace(/\?/g, "\\?") + // https://stackoverflow.com/questions/1234582 - '"' - ); -} - -export function cap(str: string) { - return str[0].toUpperCase() + str.slice(1); -} - -export function low(str: string) { - if (str.startsWith("JS")) { - return "js" + str.slice(2); - } - - return str[0].toLowerCase() + str.slice(1); -} - -export function readdirRecursive(root: string): string[] { - const files = fs.readdirSync(root, { withFileTypes: true }); - return files.flatMap(file => { - const fullPath = path.join(root, file.name); - return file.isDirectory() ? readdirRecursive(fullPath) : fullPath; - }); -} - -export function resolveSyncOrNull(specifier: string, from: string) { - try { - return Bun.resolveSync(specifier, from); - } catch { - return null; - } -} - -export function checkAscii(str: string) { - if (!isAscii(Buffer.from(str))) { - throw new Error(`non-ascii character in string "${str}". this will not be a valid ASCIILiteral`); - } - - return str; -} diff --git a/src/js/_codegen/index.ts b/src/js/_codegen/index.ts deleted file mode 100644 index 4e048b144693e..0000000000000 --- a/src/js/_codegen/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -import "./build-modules"; -import "./build-functions"; diff --git a/src/js/_codegen/static-hash-tables.ts b/src/js/_codegen/static-hash-tables.ts deleted file mode 100644 index 858974aa10b6f..0000000000000 --- a/src/js/_codegen/static-hash-tables.ts +++ /dev/null @@ -1,43 +0,0 @@ -// TODO: move this file somewhere else. it doesnt make sense in src/js/ -// it generates C++ code not related to javascript at all -import { spawn } from "bun"; -import path from "../node/path"; - -const STATIC_HASH_TABLES = [ - // - "src/bun.js/bindings/BunObject.cpp", - "src/bun.js/bindings/ZigGlobalObject.lut.txt", - "src/bun.js/bindings/JSBuffer.cpp", - "src/bun.js/bindings/Process.cpp", - "src/bun.js/bindings/ProcessBindingConstants.cpp", - "src/bun.js/bindings/ProcessBindingNatives.cpp", -]; - -console.time("Creating static hash tables..."); -const create_hash_table = path.join(import.meta.dir, "../../../src/bun.js/scripts/create_hash_table"); -if (!create_hash_table) { - console.warn("Could not find create_hash_table executable. Run `bun i` or clone webkit to build static hash tables"); - process.exit(1); -} - -await Promise.all( - STATIC_HASH_TABLES.map(async cpp => { - cpp = path.join(import.meta.dir, "../../../", cpp); - const { stdout, exited } = spawn({ - cmd: [create_hash_table, cpp], - stdout: "pipe", - stderr: "inherit", - }); - await exited; - let str = await new Response(stdout).text(); - str = str.replaceAll(/^\/\/.*$/gm, ""); - str = str.replaceAll(/^#include.*$/gm, ""); - str = str.replaceAll(`namespace JSC {`, ""); - str = str.replaceAll(`} // namespace JSC`, ""); - str = "// File generated via `make static-hash-table` / `make cpp`\n" + str.trim() + "\n"; - await Bun.write(cpp.replace(/\.cpp$/, ".lut.h").replace(/(\.lut)?\.txt$/, ".lut.h"), str); - console.log("Wrote", path.relative(process.cwd(), cpp.replace(/\.cpp$/, ".lut.h"))); - }), -); - -console.timeEnd("Creating static hash tables..."); diff --git a/src/js/builtins/BunBuiltinNames.h b/src/js/builtins/BunBuiltinNames.h index f3266d5c28562..3128c3d6c5b35 100644 --- a/src/js/builtins/BunBuiltinNames.h +++ b/src/js/builtins/BunBuiltinNames.h @@ -9,9 +9,12 @@ #endif #endif -#include "JavaScriptCore/BuiltinUtils.h" #include "root.h" +#include +#include +#include + namespace WebCore { using namespace JSC; diff --git a/src/js/out/InternalModuleRegistry+create.h b/src/js/out/InternalModuleRegistry+create.h deleted file mode 100644 index 7804dd395144a..0000000000000 --- a/src/js/out/InternalModuleRegistry+create.h +++ /dev/null @@ -1,193 +0,0 @@ -registry->m_internalModule[0].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "bun:ffi"_s, "/Users/dave/code/bun/src/js/out/modules/bun/ffi.js"_s, InternalModuleRegistryConstants::BunFFICode); -}); -registry->m_internalModule[1].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "bun:sqlite"_s, "/Users/dave/code/bun/src/js/out/modules/bun/sqlite.js"_s, InternalModuleRegistryConstants::BunSqliteCode); -}); -registry->m_internalModule[2].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "internal:shared"_s, "/Users/dave/code/bun/src/js/out/modules/internal/shared.js"_s, InternalModuleRegistryConstants::InternalSharedCode); -}); -registry->m_internalModule[3].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:assert"_s, "/Users/dave/code/bun/src/js/out/modules/node/assert.js"_s, InternalModuleRegistryConstants::NodeAssertCode); -}); -registry->m_internalModule[4].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:assert/strict"_s, "/Users/dave/code/bun/src/js/out/modules/node/assert.strict.js"_s, InternalModuleRegistryConstants::NodeAssertStrictCode); -}); -registry->m_internalModule[5].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:async_hooks"_s, "/Users/dave/code/bun/src/js/out/modules/node/async_hooks.js"_s, InternalModuleRegistryConstants::NodeAsyncHooksCode); -}); -registry->m_internalModule[6].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:child_process"_s, "/Users/dave/code/bun/src/js/out/modules/node/child_process.js"_s, InternalModuleRegistryConstants::NodeChildProcessCode); -}); -registry->m_internalModule[7].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:cluster"_s, "/Users/dave/code/bun/src/js/out/modules/node/cluster.js"_s, InternalModuleRegistryConstants::NodeClusterCode); -}); -registry->m_internalModule[8].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:crypto"_s, "/Users/dave/code/bun/src/js/out/modules/node/crypto.js"_s, InternalModuleRegistryConstants::NodeCryptoCode); -}); -registry->m_internalModule[9].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:dgram"_s, "/Users/dave/code/bun/src/js/out/modules/node/dgram.js"_s, InternalModuleRegistryConstants::NodeDgramCode); -}); -registry->m_internalModule[10].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:diagnostics_channel"_s, "/Users/dave/code/bun/src/js/out/modules/node/diagnostics_channel.js"_s, InternalModuleRegistryConstants::NodeDiagnosticsChannelCode); -}); -registry->m_internalModule[11].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:dns"_s, "/Users/dave/code/bun/src/js/out/modules/node/dns.js"_s, InternalModuleRegistryConstants::NodeDNSCode); -}); -registry->m_internalModule[12].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:dns/promises"_s, "/Users/dave/code/bun/src/js/out/modules/node/dns.promises.js"_s, InternalModuleRegistryConstants::NodeDNSPromisesCode); -}); -registry->m_internalModule[13].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:events"_s, "/Users/dave/code/bun/src/js/out/modules/node/events.js"_s, InternalModuleRegistryConstants::NodeEventsCode); -}); -registry->m_internalModule[14].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:fs"_s, "/Users/dave/code/bun/src/js/out/modules/node/fs.js"_s, InternalModuleRegistryConstants::NodeFSCode); -}); -registry->m_internalModule[15].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:fs/promises"_s, "/Users/dave/code/bun/src/js/out/modules/node/fs.promises.js"_s, InternalModuleRegistryConstants::NodeFSPromisesCode); -}); -registry->m_internalModule[16].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:http"_s, "/Users/dave/code/bun/src/js/out/modules/node/http.js"_s, InternalModuleRegistryConstants::NodeHttpCode); -}); -registry->m_internalModule[17].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:http2"_s, "/Users/dave/code/bun/src/js/out/modules/node/http2.js"_s, InternalModuleRegistryConstants::NodeHttp2Code); -}); -registry->m_internalModule[18].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:https"_s, "/Users/dave/code/bun/src/js/out/modules/node/https.js"_s, InternalModuleRegistryConstants::NodeHttpsCode); -}); -registry->m_internalModule[19].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:inspector"_s, "/Users/dave/code/bun/src/js/out/modules/node/inspector.js"_s, InternalModuleRegistryConstants::NodeInspectorCode); -}); -registry->m_internalModule[20].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:net"_s, "/Users/dave/code/bun/src/js/out/modules/node/net.js"_s, InternalModuleRegistryConstants::NodeNetCode); -}); -registry->m_internalModule[21].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:os"_s, "/Users/dave/code/bun/src/js/out/modules/node/os.js"_s, InternalModuleRegistryConstants::NodeOSCode); -}); -registry->m_internalModule[22].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:path/posix"_s, "/Users/dave/code/bun/src/js/out/modules/node/path.posix.js"_s, InternalModuleRegistryConstants::NodePathPosixCode); -}); -registry->m_internalModule[23].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:path"_s, "/Users/dave/code/bun/src/js/out/modules/node/path.js"_s, InternalModuleRegistryConstants::NodePathCode); -}); -registry->m_internalModule[24].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:path/win32"_s, "/Users/dave/code/bun/src/js/out/modules/node/path.win32.js"_s, InternalModuleRegistryConstants::NodePathWin32Code); -}); -registry->m_internalModule[25].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:perf_hooks"_s, "/Users/dave/code/bun/src/js/out/modules/node/perf_hooks.js"_s, InternalModuleRegistryConstants::NodePerfHooksCode); -}); -registry->m_internalModule[26].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:readline"_s, "/Users/dave/code/bun/src/js/out/modules/node/readline.js"_s, InternalModuleRegistryConstants::NodeReadlineCode); -}); -registry->m_internalModule[27].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:readline/promises"_s, "/Users/dave/code/bun/src/js/out/modules/node/readline.promises.js"_s, InternalModuleRegistryConstants::NodeReadlinePromisesCode); -}); -registry->m_internalModule[28].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:repl"_s, "/Users/dave/code/bun/src/js/out/modules/node/repl.js"_s, InternalModuleRegistryConstants::NodeReplCode); -}); -registry->m_internalModule[29].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:stream/consumers"_s, "/Users/dave/code/bun/src/js/out/modules/node/stream.consumers.js"_s, InternalModuleRegistryConstants::NodeStreamConsumersCode); -}); -registry->m_internalModule[30].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:stream"_s, "/Users/dave/code/bun/src/js/out/modules/node/stream.js"_s, InternalModuleRegistryConstants::NodeStreamCode); -}); -registry->m_internalModule[31].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:stream/promises"_s, "/Users/dave/code/bun/src/js/out/modules/node/stream.promises.js"_s, InternalModuleRegistryConstants::NodeStreamPromisesCode); -}); -registry->m_internalModule[32].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:stream/web"_s, "/Users/dave/code/bun/src/js/out/modules/node/stream.web.js"_s, InternalModuleRegistryConstants::NodeStreamWebCode); -}); -registry->m_internalModule[33].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:timers"_s, "/Users/dave/code/bun/src/js/out/modules/node/timers.js"_s, InternalModuleRegistryConstants::NodeTimersCode); -}); -registry->m_internalModule[34].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:timers/promises"_s, "/Users/dave/code/bun/src/js/out/modules/node/timers.promises.js"_s, InternalModuleRegistryConstants::NodeTimersPromisesCode); -}); -registry->m_internalModule[35].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:tls"_s, "/Users/dave/code/bun/src/js/out/modules/node/tls.js"_s, InternalModuleRegistryConstants::NodeTLSCode); -}); -registry->m_internalModule[36].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:trace_events"_s, "/Users/dave/code/bun/src/js/out/modules/node/trace_events.js"_s, InternalModuleRegistryConstants::NodeTraceEventsCode); -}); -registry->m_internalModule[37].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:url"_s, "/Users/dave/code/bun/src/js/out/modules/node/url.js"_s, InternalModuleRegistryConstants::NodeUrlCode); -}); -registry->m_internalModule[38].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:util"_s, "/Users/dave/code/bun/src/js/out/modules/node/util.js"_s, InternalModuleRegistryConstants::NodeUtilCode); -}); -registry->m_internalModule[39].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:v8"_s, "/Users/dave/code/bun/src/js/out/modules/node/v8.js"_s, InternalModuleRegistryConstants::NodeV8Code); -}); -registry->m_internalModule[40].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:vm"_s, "/Users/dave/code/bun/src/js/out/modules/node/vm.js"_s, InternalModuleRegistryConstants::NodeVMCode); -}); -registry->m_internalModule[41].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:wasi"_s, "/Users/dave/code/bun/src/js/out/modules/node/wasi.js"_s, InternalModuleRegistryConstants::NodeWasiCode); -}); -registry->m_internalModule[42].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "node:zlib"_s, "/Users/dave/code/bun/src/js/out/modules/node/zlib.js"_s, InternalModuleRegistryConstants::NodeZlibCode); -}); -registry->m_internalModule[43].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "depd"_s, "/Users/dave/code/bun/src/js/out/modules/thirdparty/depd.js"_s, InternalModuleRegistryConstants::ThirdpartyDepdCode); -}); -registry->m_internalModule[44].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "detect-libc"_s, "/Users/dave/code/bun/src/js/out/modules/thirdparty/detect-libc.js"_s, InternalModuleRegistryConstants::ThirdpartyDetectLibcCode); -}); -registry->m_internalModule[45].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "detect-libc/linux"_s, "/Users/dave/code/bun/src/js/out/modules/thirdparty/detect-libc.linux.js"_s, InternalModuleRegistryConstants::ThirdpartyDetectLibcLinuxCode); -}); -registry->m_internalModule[46].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "undici"_s, "/Users/dave/code/bun/src/js/out/modules/thirdparty/undici.js"_s, InternalModuleRegistryConstants::ThirdpartyUndiciCode); -}); -registry->m_internalModule[47].initLater([](const JSC::LazyProperty::Initializer& init) { - INTERNAL_MODULE_REGISTRY_GENERATE(init, "ws"_s, "/Users/dave/code/bun/src/js/out/modules/thirdparty/ws.js"_s, InternalModuleRegistryConstants::ThirdpartyWSCode); -}); - -registry->m_internalFields[0].set(vm, this, jsUndefined()) -registry->m_internalFields[1].set(vm, this, jsUndefined()) -registry->m_internalFields[2].set(vm, this, jsUndefined()) -registry->m_internalFields[3].set(vm, this, jsUndefined()) -registry->m_internalFields[4].set(vm, this, jsUndefined()) -registry->m_internalFields[5].set(vm, this, jsUndefined()) -registry->m_internalFields[6].set(vm, this, jsUndefined()) -registry->m_internalFields[7].set(vm, this, jsUndefined()) -registry->m_internalFields[8].set(vm, this, jsUndefined()) -registry->m_internalFields[9].set(vm, this, jsUndefined()) -registry->m_internalFields[10].set(vm, this, jsUndefined()) -registry->m_internalFields[11].set(vm, this, jsUndefined()) -registry->m_internalFields[12].set(vm, this, jsUndefined()) -registry->m_internalFields[13].set(vm, this, jsUndefined()) -registry->m_internalFields[14].set(vm, this, jsUndefined()) -registry->m_internalFields[15].set(vm, this, jsUndefined()) -registry->m_internalFields[16].set(vm, this, jsUndefined()) -registry->m_internalFields[17].set(vm, this, jsUndefined()) -registry->m_internalFields[18].set(vm, this, jsUndefined()) -registry->m_internalFields[19].set(vm, this, jsUndefined()) -registry->m_internalFields[20].set(vm, this, jsUndefined()) -registry->m_internalFields[21].set(vm, this, jsUndefined()) -registry->m_internalFields[22].set(vm, this, jsUndefined()) -registry->m_internalFields[23].set(vm, this, jsUndefined()) -registry->m_internalFields[24].set(vm, this, jsUndefined()) -registry->m_internalFields[25].set(vm, this, jsUndefined()) -registry->m_internalFields[26].set(vm, this, jsUndefined()) -registry->m_internalFields[27].set(vm, this, jsUndefined()) -registry->m_internalFields[28].set(vm, this, jsUndefined()) -registry->m_internalFields[29].set(vm, this, jsUndefined()) -registry->m_internalFields[30].set(vm, this, jsUndefined()) -registry->m_internalFields[31].set(vm, this, jsUndefined()) -registry->m_internalFields[32].set(vm, this, jsUndefined()) -registry->m_internalFields[33].set(vm, this, jsUndefined()) -registry->m_internalFields[34].set(vm, this, jsUndefined()) -registry->m_internalFields[35].set(vm, this, jsUndefined()) -registry->m_internalFields[36].set(vm, this, jsUndefined()) -registry->m_internalFields[37].set(vm, this, jsUndefined()) -registry->m_internalFields[38].set(vm, this, jsUndefined()) -registry->m_internalFields[39].set(vm, this, jsUndefined()) -registry->m_internalFields[40].set(vm, this, jsUndefined()) -registry->m_internalFields[41].set(vm, this, jsUndefined()) -registry->m_internalFields[42].set(vm, this, jsUndefined()) -registry->m_internalFields[43].set(vm, this, jsUndefined()) -registry->m_internalFields[44].set(vm, this, jsUndefined()) -registry->m_internalFields[45].set(vm, this, jsUndefined()) -registry->m_internalFields[46].set(vm, this, jsUndefined()) -registry->m_internalFields[47].set(vm, this, jsUndefined()) diff --git a/src/js/out/InternalModuleRegistry+createInternalModuleById.h b/src/js/out/InternalModuleRegistry+createInternalModuleById.h deleted file mode 100644 index 9521f43a73841..0000000000000 --- a/src/js/out/InternalModuleRegistry+createInternalModuleById.h +++ /dev/null @@ -1,193 +0,0 @@ -// clang-format off -JSValue InternalModuleRegistry::createInternalModuleById(JSGlobalObject* globalObject, VM& vm, Field id) -{ - switch (id) { - // JS internal modules - case Field::BunFFI: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "bun:ffi"_s, "bun/ffi.js"_s, InternalModuleRegistryConstants::BunFFICode, "builtin://bun/ffi"_s); - } - case Field::BunSqlite: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "bun:sqlite"_s, "bun/sqlite.js"_s, InternalModuleRegistryConstants::BunSqliteCode, "builtin://bun/sqlite"_s); - } - case Field::InternalDebugger: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "internal:debugger"_s, "internal/debugger.js"_s, InternalModuleRegistryConstants::InternalDebuggerCode, "builtin://internal/debugger"_s); - } - case Field::InternalFSCpSync: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "internal:fs/cp-sync"_s, "internal/fs/cp-sync.js"_s, InternalModuleRegistryConstants::InternalFSCpSyncCode, "builtin://internal/fs/cp/sync"_s); - } - case Field::InternalFSCp: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "internal:fs/cp"_s, "internal/fs/cp.js"_s, InternalModuleRegistryConstants::InternalFSCpCode, "builtin://internal/fs/cp"_s); - } - case Field::InternalPrimordials: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "internal:primordials"_s, "internal/primordials.js"_s, InternalModuleRegistryConstants::InternalPrimordialsCode, "builtin://internal/primordials"_s); - } - case Field::InternalShared: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "internal:shared"_s, "internal/shared.js"_s, InternalModuleRegistryConstants::InternalSharedCode, "builtin://internal/shared"_s); - } - case Field::InternalUtilInspect: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "internal:util/inspect"_s, "internal/util/inspect.js"_s, InternalModuleRegistryConstants::InternalUtilInspectCode, "builtin://internal/util/inspect"_s); - } - case Field::NodeAssert: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:assert"_s, "node/assert.js"_s, InternalModuleRegistryConstants::NodeAssertCode, "builtin://node/assert"_s); - } - case Field::NodeAssertStrict: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:assert/strict"_s, "node/assert.strict.js"_s, InternalModuleRegistryConstants::NodeAssertStrictCode, "builtin://node/assert/strict"_s); - } - case Field::NodeAsyncHooks: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:async_hooks"_s, "node/async_hooks.js"_s, InternalModuleRegistryConstants::NodeAsyncHooksCode, "builtin://node/async/hooks"_s); - } - case Field::NodeChildProcess: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:child_process"_s, "node/child_process.js"_s, InternalModuleRegistryConstants::NodeChildProcessCode, "builtin://node/child/process"_s); - } - case Field::NodeCluster: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:cluster"_s, "node/cluster.js"_s, InternalModuleRegistryConstants::NodeClusterCode, "builtin://node/cluster"_s); - } - case Field::NodeConsole: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:console"_s, "node/console.js"_s, InternalModuleRegistryConstants::NodeConsoleCode, "builtin://node/console"_s); - } - case Field::NodeCrypto: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:crypto"_s, "node/crypto.js"_s, InternalModuleRegistryConstants::NodeCryptoCode, "builtin://node/crypto"_s); - } - case Field::NodeDgram: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:dgram"_s, "node/dgram.js"_s, InternalModuleRegistryConstants::NodeDgramCode, "builtin://node/dgram"_s); - } - case Field::NodeDiagnosticsChannel: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:diagnostics_channel"_s, "node/diagnostics_channel.js"_s, InternalModuleRegistryConstants::NodeDiagnosticsChannelCode, "builtin://node/diagnostics/channel"_s); - } - case Field::NodeDNS: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:dns"_s, "node/dns.js"_s, InternalModuleRegistryConstants::NodeDNSCode, "builtin://node/dns"_s); - } - case Field::NodeDNSPromises: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:dns/promises"_s, "node/dns.promises.js"_s, InternalModuleRegistryConstants::NodeDNSPromisesCode, "builtin://node/dns/promises"_s); - } - case Field::NodeDomain: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:domain"_s, "node/domain.js"_s, InternalModuleRegistryConstants::NodeDomainCode, "builtin://node/domain"_s); - } - case Field::NodeEvents: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:events"_s, "node/events.js"_s, InternalModuleRegistryConstants::NodeEventsCode, "builtin://node/events"_s); - } - case Field::NodeFS: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:fs"_s, "node/fs.js"_s, InternalModuleRegistryConstants::NodeFSCode, "builtin://node/fs"_s); - } - case Field::NodeFSPromises: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:fs/promises"_s, "node/fs.promises.js"_s, InternalModuleRegistryConstants::NodeFSPromisesCode, "builtin://node/fs/promises"_s); - } - case Field::NodeHttp: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:http"_s, "node/http.js"_s, InternalModuleRegistryConstants::NodeHttpCode, "builtin://node/http"_s); - } - case Field::NodeHttp2: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:http2"_s, "node/http2.js"_s, InternalModuleRegistryConstants::NodeHttp2Code, "builtin://node/http2"_s); - } - case Field::NodeHttps: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:https"_s, "node/https.js"_s, InternalModuleRegistryConstants::NodeHttpsCode, "builtin://node/https"_s); - } - case Field::NodeInspector: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:inspector"_s, "node/inspector.js"_s, InternalModuleRegistryConstants::NodeInspectorCode, "builtin://node/inspector"_s); - } - case Field::NodeNet: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:net"_s, "node/net.js"_s, InternalModuleRegistryConstants::NodeNetCode, "builtin://node/net"_s); - } - case Field::NodeOS: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:os"_s, "node/os.js"_s, InternalModuleRegistryConstants::NodeOSCode, "builtin://node/os"_s); - } - case Field::NodePathPosix: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:path/posix"_s, "node/path.posix.js"_s, InternalModuleRegistryConstants::NodePathPosixCode, "builtin://node/path/posix"_s); - } - case Field::NodePath: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:path"_s, "node/path.js"_s, InternalModuleRegistryConstants::NodePathCode, "builtin://node/path"_s); - } - case Field::NodePathWin32: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:path/win32"_s, "node/path.win32.js"_s, InternalModuleRegistryConstants::NodePathWin32Code, "builtin://node/path/win32"_s); - } - case Field::NodePerfHooks: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:perf_hooks"_s, "node/perf_hooks.js"_s, InternalModuleRegistryConstants::NodePerfHooksCode, "builtin://node/perf/hooks"_s); - } - case Field::NodePunycode: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:punycode"_s, "node/punycode.js"_s, InternalModuleRegistryConstants::NodePunycodeCode, "builtin://node/punycode"_s); - } - case Field::NodeQuerystring: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:querystring"_s, "node/querystring.js"_s, InternalModuleRegistryConstants::NodeQuerystringCode, "builtin://node/querystring"_s); - } - case Field::NodeReadline: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:readline"_s, "node/readline.js"_s, InternalModuleRegistryConstants::NodeReadlineCode, "builtin://node/readline"_s); - } - case Field::NodeReadlinePromises: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:readline/promises"_s, "node/readline.promises.js"_s, InternalModuleRegistryConstants::NodeReadlinePromisesCode, "builtin://node/readline/promises"_s); - } - case Field::NodeRepl: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:repl"_s, "node/repl.js"_s, InternalModuleRegistryConstants::NodeReplCode, "builtin://node/repl"_s); - } - case Field::NodeStreamConsumers: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:stream/consumers"_s, "node/stream.consumers.js"_s, InternalModuleRegistryConstants::NodeStreamConsumersCode, "builtin://node/stream/consumers"_s); - } - case Field::NodeStream: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:stream"_s, "node/stream.js"_s, InternalModuleRegistryConstants::NodeStreamCode, "builtin://node/stream"_s); - } - case Field::NodeStreamPromises: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:stream/promises"_s, "node/stream.promises.js"_s, InternalModuleRegistryConstants::NodeStreamPromisesCode, "builtin://node/stream/promises"_s); - } - case Field::NodeStreamWeb: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:stream/web"_s, "node/stream.web.js"_s, InternalModuleRegistryConstants::NodeStreamWebCode, "builtin://node/stream/web"_s); - } - case Field::NodeTimers: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:timers"_s, "node/timers.js"_s, InternalModuleRegistryConstants::NodeTimersCode, "builtin://node/timers"_s); - } - case Field::NodeTimersPromises: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:timers/promises"_s, "node/timers.promises.js"_s, InternalModuleRegistryConstants::NodeTimersPromisesCode, "builtin://node/timers/promises"_s); - } - case Field::NodeTLS: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:tls"_s, "node/tls.js"_s, InternalModuleRegistryConstants::NodeTLSCode, "builtin://node/tls"_s); - } - case Field::NodeTraceEvents: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:trace_events"_s, "node/trace_events.js"_s, InternalModuleRegistryConstants::NodeTraceEventsCode, "builtin://node/trace/events"_s); - } - case Field::NodeTty: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:tty"_s, "node/tty.js"_s, InternalModuleRegistryConstants::NodeTtyCode, "builtin://node/tty"_s); - } - case Field::NodeUrl: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:url"_s, "node/url.js"_s, InternalModuleRegistryConstants::NodeUrlCode, "builtin://node/url"_s); - } - case Field::NodeUtil: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:util"_s, "node/util.js"_s, InternalModuleRegistryConstants::NodeUtilCode, "builtin://node/util"_s); - } - case Field::NodeV8: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:v8"_s, "node/v8.js"_s, InternalModuleRegistryConstants::NodeV8Code, "builtin://node/v8"_s); - } - case Field::NodeVM: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:vm"_s, "node/vm.js"_s, InternalModuleRegistryConstants::NodeVMCode, "builtin://node/vm"_s); - } - case Field::NodeWasi: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:wasi"_s, "node/wasi.js"_s, InternalModuleRegistryConstants::NodeWasiCode, "builtin://node/wasi"_s); - } - case Field::NodeWorkerThreads: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:worker_threads"_s, "node/worker_threads.js"_s, InternalModuleRegistryConstants::NodeWorkerThreadsCode, "builtin://node/worker/threads"_s); - } - case Field::NodeZlib: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node:zlib"_s, "node/zlib.js"_s, InternalModuleRegistryConstants::NodeZlibCode, "builtin://node/zlib"_s); - } - case Field::ThirdpartyDepd: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "depd"_s, "thirdparty/depd.js"_s, InternalModuleRegistryConstants::ThirdpartyDepdCode, "builtin://thirdparty/depd"_s); - } - case Field::ThirdpartyDetectLibc: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "detect-libc"_s, "thirdparty/detect-libc.js"_s, InternalModuleRegistryConstants::ThirdpartyDetectLibcCode, "builtin://thirdparty/detect/libc"_s); - } - case Field::ThirdpartyDetectLibcLinux: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "detect-libc/linux"_s, "thirdparty/detect-libc.linux.js"_s, InternalModuleRegistryConstants::ThirdpartyDetectLibcLinuxCode, "builtin://thirdparty/detect/libc/linux"_s); - } - case Field::ThirdpartyIsomorphicFetch: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "isomorphic-fetch"_s, "thirdparty/isomorphic-fetch.js"_s, InternalModuleRegistryConstants::ThirdpartyIsomorphicFetchCode, "builtin://thirdparty/isomorphic/fetch"_s); - } - case Field::ThirdpartyNodeFetch: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "node-fetch"_s, "thirdparty/node-fetch.js"_s, InternalModuleRegistryConstants::ThirdpartyNodeFetchCode, "builtin://thirdparty/node/fetch"_s); - } - case Field::ThirdpartyUndici: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "undici"_s, "thirdparty/undici.js"_s, InternalModuleRegistryConstants::ThirdpartyUndiciCode, "builtin://thirdparty/undici"_s); - } - case Field::ThirdpartyVercelFetch: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "vercel_fetch"_s, "thirdparty/vercel_fetch.js"_s, InternalModuleRegistryConstants::ThirdpartyVercelFetchCode, "builtin://thirdparty/vercel/fetch"_s); - } - case Field::ThirdpartyWS: { - INTERNAL_MODULE_REGISTRY_GENERATE(globalObject, vm, "ws"_s, "thirdparty/ws.js"_s, InternalModuleRegistryConstants::ThirdpartyWSCode, "builtin://thirdparty/ws"_s); - } - } -} diff --git a/src/js/out/InternalModuleRegistry+enum.h b/src/js/out/InternalModuleRegistry+enum.h deleted file mode 100644 index e065ad481c154..0000000000000 --- a/src/js/out/InternalModuleRegistry+enum.h +++ /dev/null @@ -1,63 +0,0 @@ -BunFFI = 0, -BunSqlite = 1, -InternalDebugger = 2, -InternalFSCpSync = 3, -InternalFSCp = 4, -InternalPrimordials = 5, -InternalShared = 6, -InternalUtilInspect = 7, -NodeAssert = 8, -NodeAssertStrict = 9, -NodeAsyncHooks = 10, -NodeChildProcess = 11, -NodeCluster = 12, -NodeConsole = 13, -NodeCrypto = 14, -NodeDgram = 15, -NodeDiagnosticsChannel = 16, -NodeDNS = 17, -NodeDNSPromises = 18, -NodeDomain = 19, -NodeEvents = 20, -NodeFS = 21, -NodeFSPromises = 22, -NodeHttp = 23, -NodeHttp2 = 24, -NodeHttps = 25, -NodeInspector = 26, -NodeNet = 27, -NodeOS = 28, -NodePathPosix = 29, -NodePath = 30, -NodePathWin32 = 31, -NodePerfHooks = 32, -NodePunycode = 33, -NodeQuerystring = 34, -NodeReadline = 35, -NodeReadlinePromises = 36, -NodeRepl = 37, -NodeStreamConsumers = 38, -NodeStream = 39, -NodeStreamPromises = 40, -NodeStreamWeb = 41, -NodeTimers = 42, -NodeTimersPromises = 43, -NodeTLS = 44, -NodeTraceEvents = 45, -NodeTty = 46, -NodeUrl = 47, -NodeUtil = 48, -NodeV8 = 49, -NodeVM = 50, -NodeWasi = 51, -NodeWorkerThreads = 52, -NodeZlib = 53, -ThirdpartyDepd = 54, -ThirdpartyDetectLibc = 55, -ThirdpartyDetectLibcLinux = 56, -ThirdpartyIsomorphicFetch = 57, -ThirdpartyNodeFetch = 58, -ThirdpartyUndici = 59, -ThirdpartyVercelFetch = 60, -ThirdpartyWS = 61, - diff --git a/src/js/out/InternalModuleRegistry+numberOfModules.h b/src/js/out/InternalModuleRegistry+numberOfModules.h deleted file mode 100644 index af572e96591dd..0000000000000 --- a/src/js/out/InternalModuleRegistry+numberOfModules.h +++ /dev/null @@ -1 +0,0 @@ -#define BUN_INTERNAL_MODULE_COUNT 62 diff --git a/src/js/out/InternalModuleRegistry+visitImpl.h b/src/js/out/InternalModuleRegistry+visitImpl.h deleted file mode 100644 index 0c4a8f7659246..0000000000000 --- a/src/js/out/InternalModuleRegistry+visitImpl.h +++ /dev/null @@ -1,48 +0,0 @@ -m_internalModule[0].visit(visitor); -m_internalModule[1].visit(visitor); -m_internalModule[2].visit(visitor); -m_internalModule[3].visit(visitor); -m_internalModule[4].visit(visitor); -m_internalModule[5].visit(visitor); -m_internalModule[6].visit(visitor); -m_internalModule[7].visit(visitor); -m_internalModule[8].visit(visitor); -m_internalModule[9].visit(visitor); -m_internalModule[10].visit(visitor); -m_internalModule[11].visit(visitor); -m_internalModule[12].visit(visitor); -m_internalModule[13].visit(visitor); -m_internalModule[14].visit(visitor); -m_internalModule[15].visit(visitor); -m_internalModule[16].visit(visitor); -m_internalModule[17].visit(visitor); -m_internalModule[18].visit(visitor); -m_internalModule[19].visit(visitor); -m_internalModule[20].visit(visitor); -m_internalModule[21].visit(visitor); -m_internalModule[22].visit(visitor); -m_internalModule[23].visit(visitor); -m_internalModule[24].visit(visitor); -m_internalModule[25].visit(visitor); -m_internalModule[26].visit(visitor); -m_internalModule[27].visit(visitor); -m_internalModule[28].visit(visitor); -m_internalModule[29].visit(visitor); -m_internalModule[30].visit(visitor); -m_internalModule[31].visit(visitor); -m_internalModule[32].visit(visitor); -m_internalModule[33].visit(visitor); -m_internalModule[34].visit(visitor); -m_internalModule[35].visit(visitor); -m_internalModule[36].visit(visitor); -m_internalModule[37].visit(visitor); -m_internalModule[38].visit(visitor); -m_internalModule[39].visit(visitor); -m_internalModule[40].visit(visitor); -m_internalModule[41].visit(visitor); -m_internalModule[42].visit(visitor); -m_internalModule[43].visit(visitor); -m_internalModule[44].visit(visitor); -m_internalModule[45].visit(visitor); -m_internalModule[46].visit(visitor); -m_internalModule[47].visit(visitor); diff --git a/src/js/out/InternalModuleRegistryConstants.h b/src/js/out/InternalModuleRegistryConstants.h deleted file mode 100644 index a39dcf6298b5c..0000000000000 --- a/src/js/out/InternalModuleRegistryConstants.h +++ /dev/null @@ -1,758 +0,0 @@ -// clang-format off -#pragma once - -namespace Bun { -namespace InternalModuleRegistryConstants { - -#if __APPLE__ - // -static constexpr ASCIILiteral BunFFICode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/bun/ffi.ts\nvar FFIBuilder = function(params, returnType, functionToCall, name) {\n const hasReturnType = typeof FFIType[returnType] === \"number\" && FFIType[returnType] !== FFIType.void;\n var paramNames = new @Array(params.length), args = new @Array(params.length);\n for (let i = 0;i < params.length; i++) {\n paramNames[i] = `p${i}`;\n const wrapper = ffiWrappers[FFIType[params[i]]];\n if (wrapper)\n args[i] = `(val=>${wrapper})(p${i})`;\n else\n @throwTypeError(`Unsupported type ${params[i]}. Must be one of: ${Object.keys(FFIType).sort().join(\", \")}`);\n }\n var code = `functionToCall(${args.join(\", \")})`;\n if (hasReturnType)\n if (FFIType[returnType] === FFIType.cstring)\n code = `return new __GlobalBunCString(${code})`;\n else\n code = `return ${code}`;\n var func = new Function(\"functionToCall\", ...paramNames, code);\n Object.defineProperty(func, \"name\", {\n value: name\n });\n var wrap;\n switch (paramNames.length) {\n case 0:\n wrap = () => func(functionToCall);\n break;\n case 1:\n wrap = (arg1) => func(functionToCall, arg1);\n break;\n case 2:\n wrap = (arg1, arg2) => func(functionToCall, arg1, arg2);\n break;\n case 3:\n wrap = (arg1, arg2, arg3) => func(functionToCall, arg1, arg2, arg3);\n break;\n case 4:\n wrap = (arg1, arg2, arg3, arg4) => func(functionToCall, arg1, arg2, arg3, arg4);\n break;\n case 5:\n wrap = (arg1, arg2, arg3, arg4, arg5) => func(functionToCall, arg1, arg2, arg3, arg4, arg5);\n break;\n case 6:\n wrap = (arg1, arg2, arg3, arg4, arg5, arg6) => func(functionToCall, arg1, arg2, arg3, arg4, arg5, arg6);\n break;\n case 7:\n wrap = (arg1, arg2, arg3, arg4, arg5, arg6, arg7) => func(functionToCall, arg1, arg2, arg3, arg4, arg5, arg6, arg7);\n break;\n case 8:\n wrap = (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) => func(functionToCall, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);\n break;\n case 9:\n wrap = (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) => func(functionToCall, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);\n break;\n default: {\n wrap = (...args2) => func(functionToCall, ...args2);\n break;\n }\n }\n return wrap.native = functionToCall, wrap.ptr = functionToCall.ptr, wrap;\n}, dlopen = function(path, options) {\n const result = nativeDLOpen(path, options);\n if (result instanceof Error)\n throw result;\n for (let key in result.symbols) {\n var symbol = result.symbols[key];\n if (options[key]\?.args\?.length || FFIType[options[key]\?.returns] === FFIType.cstring)\n result.symbols[key] = FFIBuilder(options[key].args \?\? [], options[key].returns \?\? FFIType.void, symbol, path.includes(\"/\") \? `${key} (${path.split(\"/\").pop()})` : `${key} (${path})`);\n else\n result.symbols[key].native = result.symbols[key];\n }\n return result.close = result.close.bind(result), result;\n}, linkSymbols = function(options) {\n const result = nativeLinkSymbols(options);\n for (let key in result.symbols) {\n var symbol = result.symbols[key];\n if (options[key]\?.args\?.length || FFIType[options[key]\?.returns] === FFIType.cstring)\n result.symbols[key] = FFIBuilder(options[key].args \?\? [], options[key].returns \?\? FFIType.void, symbol, key);\n else\n result.symbols[key].native = result.symbols[key];\n }\n return result;\n}, onCloseCFunction = function(close) {\n close();\n}, CFunction = function(options) {\n const identifier = `CFunction${cFunctionI++}`;\n var result = linkSymbols({\n [identifier]: options\n }), hasClosed = !1, close = result.close.bind(result);\n return result.symbols[identifier].close = () => {\n if (hasClosed || !close)\n return;\n hasClosed = !0, close(), close = @undefined;\n }, cFunctionRegistry ||= new FinalizationRegistry(onCloseCFunction), cFunctionRegistry.register(result.symbols[identifier], result.symbols[identifier].close), result.symbols[identifier];\n}, $, FFIType = {\n \"0\": 0,\n \"1\": 1,\n \"2\": 2,\n \"3\": 3,\n \"4\": 4,\n \"5\": 5,\n \"6\": 6,\n \"7\": 7,\n \"8\": 8,\n \"9\": 9,\n \"10\": 10,\n \"11\": 11,\n \"12\": 12,\n \"13\": 13,\n \"14\": 14,\n \"15\": 15,\n \"16\": 16,\n \"17\": 17,\n bool: 11,\n c_int: 5,\n c_uint: 6,\n char: 0,\n \"char*\": 12,\n double: 9,\n f32: 10,\n f64: 9,\n float: 10,\n i16: 3,\n i32: 5,\n i64: 7,\n i8: 1,\n int: 5,\n int16_t: 3,\n int32_t: 5,\n int64_t: 7,\n int8_t: 1,\n isize: 7,\n u16: 4,\n u32: 6,\n u64: 8,\n u8: 2,\n uint16_t: 4,\n uint32_t: 6,\n uint64_t: 8,\n uint8_t: 2,\n usize: 8,\n \"void*\": 12,\n ptr: 12,\n pointer: 12,\n void: 13,\n cstring: 14,\n i64_fast: 15,\n u64_fast: 16,\n function: 17,\n callback: 17,\n fn: 17\n};\nvar ffi = globalThis.Bun.FFI, ptr = (arg1, arg2) => typeof arg2 === \"undefined\" \? ffi.ptr(arg1) : ffi.ptr(arg1, arg2), toBuffer = ffi.toBuffer, toArrayBuffer = ffi.toArrayBuffer, viewSource = ffi.viewSource, BunCString = ffi.CString, nativeLinkSymbols = ffi.linkSymbols, nativeDLOpen = ffi.dlopen, nativeCallback = ffi.callback, closeCallback = ffi.closeCallback;\ndelete ffi.callback;\ndelete ffi.closeCallback;\n\nclass JSCallback {\n constructor(cb, options) {\n const { ctx, ptr: ptr2 } = nativeCallback(options, cb);\n this.#ctx = ctx, this.ptr = ptr2, this.#threadsafe = !!options\?.threadsafe;\n }\n ptr;\n #ctx;\n #threadsafe;\n get threadsafe() {\n return this.#threadsafe;\n }\n [Symbol.toPrimitive]() {\n const { ptr: ptr2 } = this;\n return typeof ptr2 === \"number\" \? ptr2 : 0;\n }\n close() {\n const ctx = this.#ctx;\n if (this.ptr = null, this.#ctx = null, ctx)\n closeCallback(ctx);\n }\n}\n\nclass CString extends @String {\n constructor(ptr2, byteOffset, byteLength) {\n super(ptr2 \? typeof byteLength === \"number\" && Number.isSafeInteger(byteLength) \? BunCString(ptr2, byteOffset || 0, byteLength) : BunCString(ptr2) : \"\");\n if (this.ptr = typeof ptr2 === \"number\" \? ptr2 : 0, typeof byteOffset !== \"undefined\")\n this.byteOffset = byteOffset;\n if (typeof byteLength !== \"undefined\")\n this.byteLength = byteLength;\n }\n ptr;\n byteOffset;\n byteLength;\n #cachedArrayBuffer;\n get arrayBuffer() {\n if (this.#cachedArrayBuffer)\n return this.#cachedArrayBuffer;\n if (!this.ptr)\n return this.#cachedArrayBuffer = new @ArrayBuffer(0);\n return this.#cachedArrayBuffer = toArrayBuffer(this.ptr, this.byteOffset, this.byteLength);\n }\n}\nObject.defineProperty(globalThis, \"__GlobalBunCString\", {\n value: CString,\n enumerable: !1,\n configurable: !1\n});\nvar ffiWrappers = new @Array(18), char = \"val|0\";\nffiWrappers.fill(char);\nffiWrappers[FFIType.uint8_t] = \"val<0\?0:val>=255\?255:val|0\";\nffiWrappers[FFIType.int16_t] = \"val<=-32768\?-32768:val>=32768\?32768:val|0\";\nffiWrappers[FFIType.uint16_t] = \"val<=0\?0:val>=65536\?65536:val|0\";\nffiWrappers[FFIType.int32_t] = \"val|0\";\nffiWrappers[FFIType.uint32_t] = \"val<=0\?0:val>=0xffffffff\?0xffffffff:+val||0\";\nffiWrappers[FFIType.i64_fast] = `{\n if (typeof val === \"bigint\") {\n if (val <= BigInt(Number.MAX_SAFE_INTEGER) && val >= BigInt(-Number.MAX_SAFE_INTEGER)) {\n return Number(val).valueOf() || 0;\n }\n\n return val;\n }\n\n return !val \? 0 : +val || 0;\n}`;\nffiWrappers[FFIType.i64_fast] = `{\n if (typeof val === \"bigint\") {\n if (val <= BigInt(Number.MAX_SAFE_INTEGER) && val >= BigInt(-Number.MAX_SAFE_INTEGER)) {\n return Number(val).valueOf() || 0;\n }\n\n return val;\n }\n\n return !val \? 0 : +val || 0;\n}`;\nffiWrappers[FFIType.u64_fast] = `{\n if (typeof val === \"bigint\") {\n if (val <= BigInt(Number.MAX_SAFE_INTEGER) && val >= 0) {\n return Number(val).valueOf() || 0;\n }\n\n return val;\n }\n\n return !val \? 0 : +val || 0;\n}`;\nffiWrappers[FFIType.int64_t] = `{\n if (typeof val === \"bigint\") {\n return val;\n }\n\n if (typeof val === \"number\") {\n return BigInt(val || 0);\n }\n\n return BigInt(+val || 0);\n}`;\nffiWrappers[FFIType.uint64_t] = `{\n if (typeof val === \"bigint\") {\n return val;\n }\n\n if (typeof val === \"number\") {\n return val <= 0 \? BigInt(0) : BigInt(val || 0);\n }\n\n return BigInt(+val || 0);\n}`;\nffiWrappers[FFIType.u64_fast] = `{\n if (typeof val === \"bigint\") {\n if (val <= BigInt(Number.MAX_SAFE_INTEGER) && val >= BigInt(0)) return Number(val);\n return val;\n }\n\n return typeof val === \"number\" \? (val <= 0 \? 0 : +val || 0) : +val || 0;\n}`;\nffiWrappers[FFIType.uint16_t] = `{\n const ret = (typeof val === \"bigint\" \? Number(val) : val) | 0;\n return ret <= 0 \? 0 : ret > 0xffff \? 0xffff : ret;\n}`;\nffiWrappers[FFIType.double] = `{\n if (typeof val === \"bigint\") {\n if (val.valueOf() < BigInt(Number.MAX_VALUE)) {\n return Math.abs(Number(val).valueOf()) + 0.00000000000001 - 0.00000000000001;\n }\n }\n\n if (!val) {\n return 0 + 0.00000000000001 - 0.00000000000001;\n }\n\n return val + 0.00000000000001 - 0.00000000000001;\n}`;\nffiWrappers[FFIType.float] = ffiWrappers[10] = `{\n return Math.fround(val);\n}`;\nffiWrappers[FFIType.bool] = `{\n return !!val;\n}`;\nObject.defineProperty(globalThis, \"__GlobalBunFFIPtrFunctionForWrapper\", {\n value: ptr,\n enumerable: !1,\n configurable: !0\n});\nffiWrappers[FFIType.cstring] = ffiWrappers[FFIType.pointer] = `{\n if (typeof val === \"number\") return val;\n if (!val) {\n return null;\n }\n\n if (ArrayBuffer.isView(val) || val instanceof ArrayBuffer) {\n return __GlobalBunFFIPtrFunctionForWrapper(val);\n }\n\n if (typeof val === \"string\") {\n throw new TypeError(\"To convert a string to a pointer, encode it as a buffer\");\n }\n\n throw new TypeError(\\`Unable to convert \\${ val } to a pointer\\`);\n}`;\nffiWrappers[FFIType.function] = `{\n if (typeof val === \"number\") {\n return val;\n }\n\n if (typeof val === \"bigint\") {\n return Number(val);\n }\n\n var ptr = val && val.ptr;\n\n if (!ptr) {\n throw new TypeError(\"Expected function to be a JSCallback or a number\");\n }\n\n return ptr;\n}`;\nvar native = {\n dlopen: nativeDLOpen,\n callback: () => {\n throw new Error(\"Deprecated. Use new JSCallback(options, fn) instead\");\n }\n}, cFunctionI = 0, cFunctionRegistry, read = ffi.read;\n$ = {\n CFunction,\n CString,\n FFIType,\n JSCallback,\n dlopen,\n linkSymbols,\n native,\n ptr,\n read,\n suffix: \"dylib\",\n toArrayBuffer,\n toBuffer,\n viewSource\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral BunSqliteCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/bun/sqlite.ts\nvar $, defineProperties = Object.defineProperties, toStringTag = Symbol.toStringTag, isArray = @Array.isArray, isTypedArray = @ArrayBuffer.isView, constants = {\n SQLITE_OPEN_READONLY: 1,\n SQLITE_OPEN_READWRITE: 2,\n SQLITE_OPEN_CREATE: 4,\n SQLITE_OPEN_DELETEONCLOSE: 8,\n SQLITE_OPEN_EXCLUSIVE: 16,\n SQLITE_OPEN_AUTOPROXY: 32,\n SQLITE_OPEN_URI: 64,\n SQLITE_OPEN_MEMORY: 128,\n SQLITE_OPEN_MAIN_DB: 256,\n SQLITE_OPEN_TEMP_DB: 512,\n SQLITE_OPEN_TRANSIENT_DB: 1024,\n SQLITE_OPEN_MAIN_JOURNAL: 2048,\n SQLITE_OPEN_TEMP_JOURNAL: 4096,\n SQLITE_OPEN_SUBJOURNAL: 8192,\n SQLITE_OPEN_SUPER_JOURNAL: 16384,\n SQLITE_OPEN_NOMUTEX: 32768,\n SQLITE_OPEN_FULLMUTEX: 65536,\n SQLITE_OPEN_SHAREDCACHE: 131072,\n SQLITE_OPEN_PRIVATECACHE: 262144,\n SQLITE_OPEN_WAL: 524288,\n SQLITE_OPEN_NOFOLLOW: 16777216,\n SQLITE_OPEN_EXRESCODE: 33554432,\n SQLITE_PREPARE_PERSISTENT: 1,\n SQLITE_PREPARE_NORMALIZE: 2,\n SQLITE_PREPARE_NO_VTAB: 4\n}, SQL, controllers;\n\nclass Statement {\n constructor(raw) {\n switch (this.#raw = raw, raw.paramsCount) {\n case 0: {\n this.get = this.#getNoArgs, this.all = this.#allNoArgs, this.values = this.#valuesNoArgs, this.run = this.#runNoArgs;\n break;\n }\n default: {\n this.get = this.#get, this.all = this.#all, this.values = this.#values, this.run = this.#run;\n break;\n }\n }\n }\n #raw;\n get;\n all;\n values;\n run;\n isFinalized = !1;\n toJSON() {\n return {\n sql: this.native.toString(),\n isFinalized: this.isFinalized,\n paramsCount: this.paramsCount,\n columnNames: this.columnNames\n };\n }\n get [toStringTag]() {\n return `\"${this.native.toString()}\"`;\n }\n toString() {\n return this.native.toString();\n }\n get native() {\n return this.#raw;\n }\n #getNoArgs() {\n return this.#raw.get();\n }\n #allNoArgs() {\n return this.#raw.all();\n }\n #valuesNoArgs() {\n return this.#raw.values();\n }\n #runNoArgs() {\n this.#raw.run();\n }\n #get(...args) {\n if (args.length === 0)\n return this.#getNoArgs();\n var arg0 = args[0];\n return !isArray(arg0) && (!arg0 || typeof arg0 !== \"object\" || isTypedArray(arg0)) \? this.#raw.get(args) : this.#raw.get(...args);\n }\n #all(...args) {\n if (args.length === 0)\n return this.#allNoArgs();\n var arg0 = args[0];\n return !isArray(arg0) && (!arg0 || typeof arg0 !== \"object\" || isTypedArray(arg0)) \? this.#raw.all(args) : this.#raw.all(...args);\n }\n #values(...args) {\n if (args.length === 0)\n return this.#valuesNoArgs();\n var arg0 = args[0];\n return !isArray(arg0) && (!arg0 || typeof arg0 !== \"object\" || isTypedArray(arg0)) \? this.#raw.values(args) : this.#raw.values(...args);\n }\n #run(...args) {\n if (args.length === 0)\n return this.#runNoArgs();\n var arg0 = args[0];\n !isArray(arg0) && (!arg0 || typeof arg0 !== \"object\" || isTypedArray(arg0)) \? this.#raw.run(args) : this.#raw.run(...args);\n }\n get columnNames() {\n return this.#raw.columns;\n }\n get paramsCount() {\n return this.#raw.paramsCount;\n }\n finalize(...args) {\n return this.isFinalized = !0, this.#raw.finalize(...args);\n }\n}\nvar cachedCount = Symbol.for(\"Bun.Database.cache.count\");\n\nclass Database {\n constructor(filenameGiven, options) {\n if (typeof filenameGiven === \"undefined\")\n ;\n else if (typeof filenameGiven !== \"string\") {\n if (isTypedArray(filenameGiven)) {\n this.#handle = Database.#deserialize(filenameGiven, typeof options === \"object\" && options \? !!options.readonly : ((options | 0) & constants.SQLITE_OPEN_READONLY) != 0), this.filename = \":memory:\";\n return;\n }\n @throwTypeError(`Expected 'filename' to be a string, got '${typeof filenameGiven}'`);\n }\n var filename = typeof filenameGiven === \"string\" \? filenameGiven.trim() : \":memory:\", flags = constants.SQLITE_OPEN_READWRITE | constants.SQLITE_OPEN_CREATE;\n if (typeof options === \"object\" && options) {\n if (flags = 0, options.readonly)\n flags = constants.SQLITE_OPEN_READONLY;\n if (\"readOnly\" in options)\n @throwTypeError('Misspelled option \"readOnly\" should be \"readonly\"');\n if (options.create)\n flags = constants.SQLITE_OPEN_READWRITE | constants.SQLITE_OPEN_CREATE;\n if (options.readwrite)\n flags |= constants.SQLITE_OPEN_READWRITE;\n } else if (typeof options === \"number\")\n flags = options;\n const anonymous = filename === \"\" || filename === \":memory:\";\n if (anonymous && (flags & constants.SQLITE_OPEN_READONLY) !== 0)\n throw new Error(\"Cannot open an anonymous database in read-only mode.\");\n if (!SQL)\n SQL = @lazy(\"sqlite\");\n this.#handle = SQL.open(anonymous \? \":memory:\" : filename, flags), this.filename = filename;\n }\n #handle;\n #cachedQueriesKeys = [];\n #cachedQueriesLengths = [];\n #cachedQueriesValues = [];\n filename;\n get handle() {\n return this.#handle;\n }\n get inTransaction() {\n return SQL.isInTransaction(this.#handle);\n }\n static open(filename, options) {\n return new Database(filename, options);\n }\n loadExtension(name, entryPoint) {\n return SQL.loadExtension(this.#handle, name, entryPoint);\n }\n serialize(optionalName) {\n return SQL.serialize(this.#handle, optionalName || \"main\");\n }\n static #deserialize(serialized, isReadOnly = !1) {\n if (!SQL)\n SQL = @lazy(\"sqlite\");\n return SQL.deserialize(serialized, isReadOnly);\n }\n static deserialize(serialized, isReadOnly = !1) {\n return new Database(serialized, isReadOnly \? constants.SQLITE_OPEN_READONLY : 0);\n }\n static setCustomSQLite(path) {\n if (!SQL)\n SQL = @lazy(\"sqlite\");\n return SQL.setCustomSQLite(path);\n }\n close() {\n return this.clearQueryCache(), SQL.close(this.#handle);\n }\n clearQueryCache() {\n for (let item of this.#cachedQueriesValues)\n item.finalize();\n this.#cachedQueriesKeys.length = 0, this.#cachedQueriesValues.length = 0, this.#cachedQueriesLengths.length = 0;\n }\n run(query, ...params) {\n if (params.length === 0) {\n SQL.run(this.#handle, query);\n return;\n }\n var arg0 = params[0];\n return !isArray(arg0) && (!arg0 || typeof arg0 !== \"object\" || isTypedArray(arg0)) \? SQL.run(this.#handle, query, params) : SQL.run(this.#handle, query, ...params);\n }\n prepare(query, params, flags) {\n return new Statement(SQL.prepare(this.#handle, query, params, flags || 0));\n }\n static MAX_QUERY_CACHE_SIZE = 20;\n get [cachedCount]() {\n return this.#cachedQueriesKeys.length;\n }\n query(query) {\n if (typeof query !== \"string\")\n @throwTypeError(`Expected 'query' to be a string, got '${typeof query}'`);\n if (query.length === 0)\n throw new Error(\"SQL query cannot be empty.\");\n const willCache = this.#cachedQueriesKeys.length < Database.MAX_QUERY_CACHE_SIZE;\n var index = this.#cachedQueriesLengths.indexOf(query.length);\n while (index !== -1) {\n if (this.#cachedQueriesKeys[index] !== query) {\n index = this.#cachedQueriesLengths.indexOf(query.length, index + 1);\n continue;\n }\n var stmt = this.#cachedQueriesValues[index];\n if (stmt.isFinalized)\n return this.#cachedQueriesValues[index] = this.prepare(query, @undefined, willCache \? constants.SQLITE_PREPARE_PERSISTENT : 0);\n return stmt;\n }\n var stmt = this.prepare(query, @undefined, willCache \? constants.SQLITE_PREPARE_PERSISTENT : 0);\n if (willCache)\n this.#cachedQueriesKeys.push(query), this.#cachedQueriesLengths.push(query.length), this.#cachedQueriesValues.push(stmt);\n return stmt;\n }\n transaction(fn, self) {\n if (typeof fn !== \"function\")\n @throwTypeError(\"Expected first argument to be a function\");\n const db = this, controller = getController(db, self), properties = {\n default: { value: wrapTransaction(fn, db, controller.default) },\n deferred: { value: wrapTransaction(fn, db, controller.deferred) },\n immediate: {\n value: wrapTransaction(fn, db, controller.immediate)\n },\n exclusive: {\n value: wrapTransaction(fn, db, controller.exclusive)\n },\n database: { value: this, enumerable: !0 }\n };\n return defineProperties(properties.default.value, properties), defineProperties(properties.deferred.value, properties), defineProperties(properties.immediate.value, properties), defineProperties(properties.exclusive.value, properties), properties.default.value;\n }\n}\nDatabase.prototype.exec = Database.prototype.run;\nvar getController = (db, self) => {\n let controller = (controllers ||= new WeakMap).get(db);\n if (!controller) {\n const shared = {\n commit: db.prepare(\"COMMIT\", @undefined, 0),\n rollback: db.prepare(\"ROLLBACK\", @undefined, 0),\n savepoint: db.prepare(\"SAVEPOINT `\\t_bs3.\\t`\", @undefined, 0),\n release: db.prepare(\"RELEASE `\\t_bs3.\\t`\", @undefined, 0),\n rollbackTo: db.prepare(\"ROLLBACK TO `\\t_bs3.\\t`\", @undefined, 0)\n };\n controllers.set(db, controller = {\n default: Object.assign({ begin: db.prepare(\"BEGIN\", @undefined, 0) }, shared),\n deferred: Object.assign({ begin: db.prepare(\"BEGIN DEFERRED\", @undefined, 0) }, shared),\n immediate: Object.assign({ begin: db.prepare(\"BEGIN IMMEDIATE\", @undefined, 0) }, shared),\n exclusive: Object.assign({ begin: db.prepare(\"BEGIN EXCLUSIVE\", @undefined, 0) }, shared)\n });\n }\n return controller;\n}, wrapTransaction = (fn, db, { begin, commit, rollback, savepoint, release, rollbackTo }) => function transaction(...args) {\n let before, after, undo;\n if (db.inTransaction)\n before = savepoint, after = release, undo = rollbackTo;\n else\n before = begin, after = commit, undo = rollback;\n try {\n before.run();\n const result = fn.@apply(this, args);\n return after.run(), result;\n } catch (ex) {\n if (db.inTransaction) {\n if (undo.run(), undo !== rollback)\n after.run();\n }\n throw ex;\n }\n};\n$ = {\n __esModule: !0,\n Database,\n Statement,\n constants,\n default: Database\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral InternalDebuggerCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/internal/debugger.ts\nvar versionInfo = function() {\n return {\n \"Protocol-Version\": \"1.3\",\n Browser: \"Bun\",\n \"User-Agent\": navigator.userAgent,\n \"WebKit-Version\": process.versions.webkit,\n \"Bun-Version\": Bun.version,\n \"Bun-Revision\": Bun.revision\n };\n}, webSocketWriter = function(ws) {\n return {\n write: (message) => !!ws.sendText(message),\n close: () => ws.close()\n };\n}, socketWriter = function(socket) {\n return {\n write: (message) => !!socket.write(message),\n close: () => socket.end()\n };\n}, bufferedWriter = function(writer) {\n let draining = !1, pendingMessages = [];\n return {\n write: (message) => {\n if (draining || !writer.write(message))\n pendingMessages.push(message);\n return !0;\n },\n drain: () => {\n draining = !0;\n try {\n for (let i = 0;i < pendingMessages.length; i++)\n if (!writer.write(pendingMessages[i])) {\n pendingMessages = pendingMessages.slice(i);\n return;\n }\n } finally {\n draining = !1;\n }\n },\n close: () => {\n writer.close(), pendingMessages.length = 0;\n }\n };\n}, parseUrl = function(url) {\n try {\n if (!url)\n return new URL(randomId(), `ws://${defaultHostname}:${defaultPort}/`);\n else if (url.startsWith(\"/\"))\n return new URL(url, `ws://${defaultHostname}:${defaultPort}/`);\n else if (/^[a-z+]+:\\/\\//i.test(url))\n return new URL(url);\n else if (/^\\d+$/.test(url))\n return new URL(randomId(), `ws://${defaultHostname}:${url}/`);\n else if (!url.includes(\"/\") && url.includes(\":\"))\n return new URL(randomId(), `ws://${url}/`);\n else if (!url.includes(\":\")) {\n const [hostname, pathname] = url.split(\"/\", 2);\n return new URL(`ws://${hostname}:${defaultPort}/${pathname}`);\n } else\n return new URL(randomId(), `ws://${url}`);\n } catch {\n @throwTypeError(`Invalid hostname or URL: '${url}'`);\n }\n}, randomId = function() {\n return Math.random().toString(36).slice(2);\n}, dim = function(string) {\n if (enableANSIColors)\n return `\\x1B[2m${string}\\x1B[22m`;\n return string;\n}, link = function(url) {\n if (enableANSIColors)\n return `\\x1B[1m\\x1B]8;;${url}\\x1B\\\\${url}\\x1B]8;;\\x1B\\\\\\x1B[22m`;\n return url;\n}, reset = function() {\n if (enableANSIColors)\n return \"\\x1B[49m\";\n return \"\";\n}, notify = function(unix) {\n Bun.connect({\n unix,\n socket: {\n open: (socket) => {\n socket.end(\"1\");\n },\n data: () => {\n }\n }\n }).finally(() => {\n });\n}, exit = function(...args) {\n console.error(...args), process.exit(1);\n}, $;\n$ = function(executionContextId, url, createBackend, send, close) {\n let debug;\n try {\n debug = new Debugger(executionContextId, url, createBackend, send, close);\n } catch (error) {\n exit(\"Failed to start inspector:\\n\", error);\n }\n const { protocol, href, host, pathname } = debug.url;\n if (!protocol.includes(\"unix\")) {\n if (console.log(dim(\"--------------------- Bun Inspector ---------------------\"), reset()), console.log(`Listening:\\n ${dim(href)}`), protocol.includes(\"ws\"))\n console.log(`Inspect in browser:\\n ${link(`https://debug.bun.sh/#${host}${pathname}`)}`);\n console.log(dim(\"--------------------- Bun Inspector ---------------------\"), reset());\n }\n const unix = process.env.BUN_INSPECT_NOTIFY;\n if (unix) {\n const { protocol: protocol2, pathname: pathname2 } = parseUrl(unix);\n if (protocol2 === \"unix:\")\n notify(pathname2);\n }\n};\n\nclass Debugger {\n #url;\n #createBackend;\n constructor(executionContextId, url, createBackend, send, close) {\n this.#url = parseUrl(url), this.#createBackend = (refEventLoop, receive) => {\n const backend = createBackend(executionContextId, refEventLoop, receive);\n return {\n write: (message) => {\n return send.@call(backend, message), !0;\n },\n close: () => close.@call(backend)\n };\n }, this.#listen();\n }\n get url() {\n return this.#url;\n }\n #listen() {\n const { protocol, hostname, port, pathname } = this.#url;\n if (protocol === \"ws:\" || protocol === \"ws+tcp:\") {\n const server = Bun.serve({\n hostname,\n port,\n fetch: this.#fetch.bind(this),\n websocket: this.#websocket\n });\n this.#url.hostname = server.hostname, this.#url.port = `${server.port}`;\n return;\n }\n if (protocol === \"ws+unix:\") {\n Bun.serve({\n unix: pathname,\n fetch: this.#fetch.bind(this),\n websocket: this.#websocket\n });\n return;\n }\n @throwTypeError(`Unsupported protocol: '${protocol}' (expected 'ws:', 'ws+unix:', or 'unix:')`);\n }\n get #websocket() {\n return {\n idleTimeout: 0,\n closeOnBackpressureLimit: !1,\n open: (ws) => this.#open(ws, webSocketWriter(ws)),\n message: (ws, message) => {\n if (typeof message === \"string\")\n this.#message(ws, message);\n else\n this.#error(ws, new Error(`Unexpected binary message: ${message.toString()}`));\n },\n drain: (ws) => this.#drain(ws),\n close: (ws) => this.#close(ws)\n };\n }\n #fetch(request, server) {\n const { method, url, headers } = request, { pathname } = new URL(url);\n if (method !== \"GET\")\n return new Response(null, {\n status: 405\n });\n switch (pathname) {\n case \"/json/version\":\n return Response.json(versionInfo());\n case \"/json\":\n case \"/json/list\":\n }\n if (!this.#url.protocol.includes(\"unix\") && this.#url.pathname !== pathname)\n return new Response(null, {\n status: 404\n });\n const data = {\n refEventLoop: headers.get(\"Ref-Event-Loop\") === \"0\"\n };\n if (!server.upgrade(request, { data }))\n return new Response(null, {\n status: 426,\n headers: {\n Upgrade: \"websocket\"\n }\n });\n }\n get #socket() {\n return {\n open: (socket) => this.#open(socket, socketWriter(socket)),\n data: (socket, message) => this.#message(socket, message.toString()),\n drain: (socket) => this.#drain(socket),\n close: (socket) => this.#close(socket),\n error: (socket, error) => this.#error(socket, error),\n connectError: (_, error) => exit(\"Failed to start inspector:\\n\", error)\n };\n }\n #open(connection, writer) {\n const { data } = connection, { refEventLoop } = data, client = bufferedWriter(writer), backend = this.#createBackend(refEventLoop, (...messages) => {\n for (let message of messages)\n client.write(message);\n });\n data.client = client, data.backend = backend;\n }\n #message(connection, message) {\n const { data } = connection, { backend } = data;\n backend\?.write(message);\n }\n #drain(connection) {\n const { data } = connection, { client } = data;\n client\?.drain\?.();\n }\n #close(connection) {\n const { data } = connection, { backend } = data;\n backend\?.close();\n }\n #error(connection, error) {\n const { data } = connection, { backend } = data;\n console.error(error), backend\?.close();\n }\n}\nvar defaultHostname = \"localhost\", defaultPort = 6499, { enableANSIColors } = Bun;\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral InternalFSCpSyncCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/internal/fs/cp-sync.ts\nvar areIdentical = function(srcStat, destStat) {\n return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;\n}, isSrcSubdir = function(src, dest) {\n const srcArr = normalizePathToArray(src), destArr = normalizePathToArray(dest);\n return ArrayPrototypeEvery.@call(srcArr, (cur, i) => destArr[i] === cur);\n}, cpSyncFn = function(src, dest, opts) {\n const { srcStat, destStat, skipped } = checkPathsSync(src, dest, opts);\n if (skipped)\n return;\n return checkParentPathsSync(src, srcStat, dest), checkParentDir(destStat, src, dest, opts);\n}, checkPathsSync = function(src, dest, opts) {\n if (opts.filter) {\n const shouldCopy = opts.filter(src, dest);\n if (isPromise(shouldCopy))\n throw new Error(\"Expected a boolean from the filter function, but got a promise. Use `fs.promises.cp` instead.\");\n if (!shouldCopy)\n return { __proto__: null, skipped: !0 };\n }\n const { srcStat, destStat } = getStatsSync(src, dest, opts);\n if (destStat) {\n if (areIdentical(srcStat, destStat))\n throw new Error(\"src and dest cannot be the same\");\n if (srcStat.isDirectory() && !destStat.isDirectory())\n throw new Error(`cannot overwrite directory ${src} with non-directory ${dest}`);\n if (!srcStat.isDirectory() && destStat.isDirectory())\n throw new Error(`cannot overwrite non-directory ${src} with directory ${dest}`);\n }\n if (srcStat.isDirectory() && isSrcSubdir(src, dest))\n throw new Error(`cannot copy ${src} to a subdirectory of self ${dest}`);\n return { __proto__: null, srcStat, destStat, skipped: !1 };\n}, getStatsSync = function(src, dest, opts) {\n let destStat;\n const statFunc = opts.dereference \? (file) => statSync(file, { bigint: !0 }) : (file) => lstatSync(file, { bigint: !0 }), srcStat = statFunc(src);\n try {\n destStat = statFunc(dest);\n } catch (err) {\n if (err.code === \"ENOENT\")\n return { srcStat, destStat: null };\n throw err;\n }\n return { srcStat, destStat };\n}, checkParentPathsSync = function(src, srcStat, dest) {\n const srcParent = resolve(dirname(src)), destParent = resolve(dirname(dest));\n if (destParent === srcParent || destParent === parse(destParent).root)\n return;\n let destStat;\n try {\n destStat = statSync(destParent, { bigint: !0 });\n } catch (err) {\n if (err.code === \"ENOENT\")\n return;\n throw err;\n }\n if (areIdentical(srcStat, destStat))\n throw new Error(`cannot copy ${src} to a subdirectory of self ${dest}`);\n return checkParentPathsSync(src, srcStat, destParent);\n}, checkParentDir = function(destStat, src, dest, opts) {\n const destParent = dirname(dest);\n if (!existsSync(destParent))\n mkdirSync(destParent, { recursive: !0 });\n return getStats(destStat, src, dest, opts);\n}, getStats = function(destStat, src, dest, opts) {\n const srcStat = (opts.dereference \? statSync : lstatSync)(src);\n if (srcStat.isDirectory() && opts.recursive)\n return onDir(srcStat, destStat, src, dest, opts);\n else if (srcStat.isDirectory())\n throw new Error(`${src} is a directory (not copied)`);\n else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice())\n return onFile(srcStat, destStat, src, dest, opts);\n else if (srcStat.isSymbolicLink())\n return onLink(destStat, src, dest, opts);\n else if (srcStat.isSocket())\n throw new Error(`cannot copy a socket file: ${dest}`);\n else if (srcStat.isFIFO())\n throw new Error(`cannot copy a FIFO pipe: ${dest}`);\n throw new Error(`cannot copy an unknown file type: ${dest}`);\n}, onFile = function(srcStat, destStat, src, dest, opts) {\n if (!destStat)\n return copyFile(srcStat, src, dest, opts);\n return mayCopyFile(srcStat, src, dest, opts);\n}, mayCopyFile = function(srcStat, src, dest, opts) {\n if (opts.force)\n return unlinkSync(dest), copyFile(srcStat, src, dest, opts);\n else if (opts.errorOnExist)\n throw new Error(`${dest} already exists`);\n}, copyFile = function(srcStat, src, dest, opts) {\n if (copyFileSync(src, dest, opts.mode), opts.preserveTimestamps)\n handleTimestamps(srcStat.mode, src, dest);\n return setDestMode(dest, srcStat.mode);\n}, handleTimestamps = function(srcMode, src, dest) {\n if (fileIsNotWritable(srcMode))\n makeFileWritable(dest, srcMode);\n return setDestTimestamps(src, dest);\n}, fileIsNotWritable = function(srcMode) {\n return (srcMode & 128) === 0;\n}, makeFileWritable = function(dest, srcMode) {\n return setDestMode(dest, srcMode | 128);\n}, setDestMode = function(dest, srcMode) {\n return chmodSync(dest, srcMode);\n}, setDestTimestamps = function(src, dest) {\n const updatedSrcStat = statSync(src);\n return utimesSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime);\n}, onDir = function(srcStat, destStat, src, dest, opts) {\n if (!destStat)\n return mkDirAndCopy(srcStat.mode, src, dest, opts);\n return copyDir(src, dest, opts);\n}, mkDirAndCopy = function(srcMode, src, dest, opts) {\n return mkdirSync(dest), copyDir(src, dest, opts), setDestMode(dest, srcMode);\n}, copyDir = function(src, dest, opts) {\n for (let dirent of readdirSync(src, { withFileTypes: !0 })) {\n const { name } = dirent, srcItem = join(src, name), destItem = join(dest, name), { destStat, skipped } = checkPathsSync(srcItem, destItem, opts);\n if (!skipped)\n getStats(destStat, srcItem, destItem, opts);\n }\n}, onLink = function(destStat, src, dest, opts) {\n let resolvedSrc = readlinkSync(src);\n if (!opts.verbatimSymlinks && !isAbsolute(resolvedSrc))\n resolvedSrc = resolve(dirname(src), resolvedSrc);\n if (!destStat)\n return symlinkSync(resolvedSrc, dest);\n let resolvedDest;\n try {\n resolvedDest = readlinkSync(dest);\n } catch (err) {\n if (err.code === \"EINVAL\" || err.code === \"UNKNOWN\")\n return symlinkSync(resolvedSrc, dest);\n throw err;\n }\n if (!isAbsolute(resolvedDest))\n resolvedDest = resolve(dirname(dest), resolvedDest);\n if (isSrcSubdir(resolvedSrc, resolvedDest))\n throw new Error(`cannot copy ${resolvedSrc} to a subdirectory of self ${resolvedDest}`);\n if (statSync(dest).isDirectory() && isSrcSubdir(resolvedDest, resolvedSrc))\n throw new Error(`cannot overwrite ${resolvedDest} with ${resolvedSrc}`);\n return copyLink(resolvedSrc, dest);\n}, copyLink = function(resolvedSrc, dest) {\n return unlinkSync(dest), symlinkSync(resolvedSrc, dest);\n}, ArrayPrototypeEvery = @Array.prototype.every, ArrayPrototypeFilter = @Array.prototype.filter, StringPrototypeSplit = @String.prototype.split, normalizePathToArray = (path) => ArrayPrototypeFilter.@call(StringPrototypeSplit.@call(resolve(path), sep), Boolean), {\n chmodSync,\n copyFileSync,\n existsSync,\n lstatSync,\n mkdirSync,\n readdirSync,\n readlinkSync,\n statSync,\n symlinkSync,\n unlinkSync,\n utimesSync\n} = @getInternalField(@internalModuleRegistry, 21) || @createInternalModuleById(21), { dirname, isAbsolute, join, parse, resolve, sep } = @getInternalField(@internalModuleRegistry, 30) || @createInternalModuleById(30), { isPromise } = @requireNativeModule(\"util/types\");\nreturn cpSyncFn})\n"); -// - -// -static constexpr ASCIILiteral InternalFSCpCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/internal/fs/cp.ts\nasync function cpFn(src, dest, opts) {\n const stats = await checkPaths(src, dest, opts), { srcStat, destStat, skipped } = stats;\n if (skipped)\n return;\n return await checkParentPaths(src, srcStat, dest), checkParentDir(destStat, src, dest, opts);\n}\nasync function checkPaths(src, dest, opts) {\n if (opts.filter && !await opts.filter(src, dest))\n return { __proto__: null, skipped: !0 };\n const { 0: srcStat, 1: destStat } = await getStats(src, dest, opts);\n if (destStat) {\n if (areIdentical(srcStat, destStat))\n throw new Error(\"Source and destination must not be the same.\");\n if (srcStat.isDirectory() && !destStat.isDirectory())\n throw new Error(`cannot overwrite directory ${src} with non-directory ${dest}`);\n if (!srcStat.isDirectory() && destStat.isDirectory())\n throw new Error(`cannot overwrite non-directory ${src} with directory ${dest}`);\n }\n if (srcStat.isDirectory() && isSrcSubdir(src, dest))\n throw new Error(`cannot copy ${src} to a subdirectory of self ${dest}`);\n return { __proto__: null, srcStat, destStat, skipped: !1 };\n}\nvar areIdentical = function(srcStat, destStat) {\n return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;\n}, getStats = function(src, dest, opts) {\n const statFunc = opts.dereference \? (file) => stat(file, { bigint: !0 }) : (file) => lstat(file, { bigint: !0 });\n return SafePromiseAll([\n statFunc(src),\n PromisePrototypeThen.@call(statFunc(dest), @undefined, (err) => {\n if (err.code === \"ENOENT\")\n return null;\n throw err;\n })\n ]);\n};\nasync function checkParentDir(destStat, src, dest, opts) {\n const destParent = dirname(dest);\n if (await pathExists(destParent))\n return getStatsForCopy(destStat, src, dest, opts);\n return await mkdir(destParent, { recursive: !0 }), getStatsForCopy(destStat, src, dest, opts);\n}\nvar pathExists = function(dest) {\n return PromisePrototypeThen(stat(dest), () => !0, (err) => err.code === \"ENOENT\" \? !1 : PromiseReject(err));\n};\nasync function checkParentPaths(src, srcStat, dest) {\n const srcParent = resolve(dirname(src)), destParent = resolve(dirname(dest));\n if (destParent === srcParent || destParent === parse(destParent).root)\n return;\n let destStat;\n try {\n destStat = await stat(destParent, { bigint: !0 });\n } catch (err) {\n if (err.code === \"ENOENT\")\n return;\n throw err;\n }\n if (areIdentical(srcStat, destStat))\n throw new Error(`cannot copy ${src} to a subdirectory of self ${dest}`);\n return checkParentPaths(src, srcStat, destParent);\n}\nvar isSrcSubdir = function(src, dest) {\n const srcArr = normalizePathToArray(src), destArr = normalizePathToArray(dest);\n return ArrayPrototypeEvery.@call(srcArr, (cur, i) => destArr[i] === cur);\n};\nasync function getStatsForCopy(destStat, src, dest, opts) {\n const srcStat = await (opts.dereference \? stat : lstat)(src);\n if (srcStat.isDirectory() && opts.recursive)\n return onDir(srcStat, destStat, src, dest, opts);\n else if (srcStat.isDirectory())\n throw new Error(`${src} is a directory (not copied)`);\n else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice())\n return onFile(srcStat, destStat, src, dest, opts);\n else if (srcStat.isSymbolicLink())\n return onLink(destStat, src, dest, opts);\n else if (srcStat.isSocket())\n throw new Error(`cannot copy a socket file: ${dest}`);\n else if (srcStat.isFIFO())\n throw new Error(`cannot copy a FIFO pipe: ${dest}`);\n throw new Error(`cannot copy an unknown file type: ${dest}`);\n}\nvar onFile = function(srcStat, destStat, src, dest, opts) {\n if (!destStat)\n return _copyFile(srcStat, src, dest, opts);\n return mayCopyFile(srcStat, src, dest, opts);\n};\nasync function mayCopyFile(srcStat, src, dest, opts) {\n if (opts.force)\n return await unlink(dest), _copyFile(srcStat, src, dest, opts);\n else if (opts.errorOnExist)\n throw new Error(`${dest} already exists`);\n}\nasync function _copyFile(srcStat, src, dest, opts) {\n if (await copyFile(src, dest, opts.mode), opts.preserveTimestamps)\n return handleTimestampsAndMode(srcStat.mode, src, dest);\n return setDestMode(dest, srcStat.mode);\n}\nasync function handleTimestampsAndMode(srcMode, src, dest) {\n if (fileIsNotWritable(srcMode))\n return await makeFileWritable(dest, srcMode), setDestTimestampsAndMode(srcMode, src, dest);\n return setDestTimestampsAndMode(srcMode, src, dest);\n}\nvar fileIsNotWritable = function(srcMode) {\n return (srcMode & 128) === 0;\n}, makeFileWritable = function(dest, srcMode) {\n return setDestMode(dest, srcMode | 128);\n};\nasync function setDestTimestampsAndMode(srcMode, src, dest) {\n return await setDestTimestamps(src, dest), setDestMode(dest, srcMode);\n}\nvar setDestMode = function(dest, srcMode) {\n return chmod(dest, srcMode);\n};\nasync function setDestTimestamps(src, dest) {\n const updatedSrcStat = await stat(src);\n return utimes(dest, updatedSrcStat.atime, updatedSrcStat.mtime);\n}\nvar onDir = function(srcStat, destStat, src, dest, opts) {\n if (!destStat)\n return mkDirAndCopy(srcStat.mode, src, dest, opts);\n return copyDir(src, dest, opts);\n};\nasync function mkDirAndCopy(srcMode, src, dest, opts) {\n return await mkdir(dest), await copyDir(src, dest, opts), setDestMode(dest, srcMode);\n}\nasync function copyDir(src, dest, opts) {\n const dir = await opendir(src);\n for await (let { name } of dir) {\n const srcItem = join(src, name), destItem = join(dest, name), { destStat, skipped } = await checkPaths(srcItem, destItem, opts);\n if (!skipped)\n await getStatsForCopy(destStat, srcItem, destItem, opts);\n }\n}\nasync function onLink(destStat, src, dest, opts) {\n let resolvedSrc = await readlink(src);\n if (!opts.verbatimSymlinks && !isAbsolute(resolvedSrc))\n resolvedSrc = resolve(dirname(src), resolvedSrc);\n if (!destStat)\n return symlink(resolvedSrc, dest);\n let resolvedDest;\n try {\n resolvedDest = await readlink(dest);\n } catch (err) {\n if (err.code === \"EINVAL\" || err.code === \"UNKNOWN\")\n return symlink(resolvedSrc, dest);\n throw err;\n }\n if (!isAbsolute(resolvedDest))\n resolvedDest = resolve(dirname(dest), resolvedDest);\n if (isSrcSubdir(resolvedSrc, resolvedDest))\n throw new Error(`cannot copy ${resolvedSrc} to a subdirectory of self ${resolvedDest}`);\n if ((await stat(src)).isDirectory() && isSrcSubdir(resolvedDest, resolvedSrc))\n throw new Error(`cannot overwrite ${resolvedDest} with ${resolvedSrc}`);\n return copyLink(resolvedSrc, dest);\n}\nasync function copyLink(resolvedSrc, dest) {\n return await unlink(dest), symlink(resolvedSrc, dest);\n}\nvar { chmod, copyFile, lstat, mkdir, opendir, readlink, stat, symlink, unlink, utimes } = @getInternalField(@internalModuleRegistry, 22) || @createInternalModuleById(22), { dirname, isAbsolute, join, parse, resolve, sep } = @getInternalField(@internalModuleRegistry, 30) || @createInternalModuleById(30), SafePromiseAll = @Promise.all, PromisePrototypeThen = @Promise.prototype.then, PromiseReject = @Promise.reject, ArrayPrototypeFilter = @Array.prototype.filter, StringPrototypeSplit = @String.prototype.split, ArrayPrototypeEvery = @Array.prototype.every, normalizePathToArray = (path) => ArrayPrototypeFilter.@call(StringPrototypeSplit(resolve(path), sep), Boolean);\nreturn cpFn})\n"); -// - -// -static constexpr ASCIILiteral InternalPrimordialsCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/internal/primordials.ts\nvar getGetter = function(cls, getter) {\n return FunctionPrototypeCall.bind(cls.prototype.__lookupGetter__(getter));\n}, uncurryThis = function(func) {\n return FunctionPrototypeCall.bind(func);\n}, ErrorCaptureStackTrace = function(targetObject) {\n const stack = new Error().stack;\n targetObject.stack = stack.replace(/.*\\n.*/, \"$1\");\n}, $, createSafeIterator = (factory, next) => {\n\n class SafeIterator {\n constructor(iterable) {\n this._iterator = factory(iterable);\n }\n next() {\n return next(this._iterator);\n }\n [Symbol.iterator]() {\n return this;\n }\n }\n return Object.setPrototypeOf(SafeIterator.prototype, null), Object.freeze(SafeIterator.prototype), Object.freeze(SafeIterator), SafeIterator;\n}, FunctionPrototypeCall = @getByIdDirect(Function.prototype, \"call\"), copyProps = (src, dest) => {\n ArrayPrototypeForEach(Reflect.ownKeys(src), (key) => {\n if (!Reflect.getOwnPropertyDescriptor(dest, key))\n Reflect.defineProperty(dest, key, Reflect.getOwnPropertyDescriptor(src, key));\n });\n}, makeSafe = (unsafe, safe) => {\n if (Symbol.iterator in unsafe.prototype) {\n const dummy = new unsafe;\n let next;\n ArrayPrototypeForEach(Reflect.ownKeys(unsafe.prototype), (key) => {\n if (!Reflect.getOwnPropertyDescriptor(safe.prototype, key)) {\n const desc = Reflect.getOwnPropertyDescriptor(unsafe.prototype, key);\n if (typeof desc.value === \"function\" && desc.value.length === 0 && (Symbol.iterator in (desc.value.@call(dummy) || {}))) {\n const createIterator = uncurryThis(desc.value);\n next \?\?= uncurryThis(createIterator(dummy).next);\n const SafeIterator = createSafeIterator(createIterator, next);\n desc.value = function() {\n return new SafeIterator(this);\n };\n }\n Reflect.defineProperty(safe.prototype, key, desc);\n }\n });\n } else\n copyProps(unsafe.prototype, safe.prototype);\n return copyProps(unsafe, safe), Object.setPrototypeOf(safe.prototype, null), Object.freeze(safe.prototype), Object.freeze(safe), safe;\n}, StringIterator = uncurryThis(@String.prototype[Symbol.iterator]), StringIteratorPrototype = Reflect.getPrototypeOf(StringIterator(\"\")), ArrayPrototypeForEach = uncurryThis(@Array.prototype.forEach), arrayProtoPush = @Array.prototype.push;\n$ = {\n makeSafe,\n Array: @Array,\n ArrayFrom: @Array.from,\n ArrayIsArray: @Array.isArray,\n ArrayPrototypeFlat: uncurryThis(@Array.prototype.flat),\n ArrayPrototypeFilter: uncurryThis(@Array.prototype.filter),\n ArrayPrototypeForEach,\n ArrayPrototypeIncludes: uncurryThis(@Array.prototype.includes),\n ArrayPrototypeIndexOf: uncurryThis(@Array.prototype.indexOf),\n ArrayPrototypeJoin: uncurryThis(@Array.prototype.join),\n ArrayPrototypeMap: uncurryThis(@Array.prototype.map),\n ArrayPrototypePop: uncurryThis(@Array.prototype.pop),\n ArrayPrototypePush: uncurryThis(arrayProtoPush),\n ArrayPrototypePushApply: (a, b) => arrayProtoPush.@apply(a, b),\n ArrayPrototypeSlice: uncurryThis(@Array.prototype.slice),\n ArrayPrototypeSort: uncurryThis(@Array.prototype.sort),\n ArrayPrototypeSplice: uncurryThis(@Array.prototype.splice),\n ArrayPrototypeUnshift: uncurryThis(@Array.prototype.unshift),\n BigIntPrototypeValueOf: uncurryThis(BigInt.prototype.valueOf),\n BooleanPrototypeValueOf: uncurryThis(Boolean.prototype.valueOf),\n DatePrototypeGetTime: uncurryThis(Date.prototype.getTime),\n DatePrototypeToISOString: uncurryThis(Date.prototype.toISOString),\n DatePrototypeToString: uncurryThis(Date.prototype.toString),\n ErrorCaptureStackTrace,\n ErrorPrototypeToString: uncurryThis(Error.prototype.toString),\n FunctionPrototypeToString: uncurryThis(Function.prototype.toString),\n JSONStringify: JSON.stringify,\n MapPrototypeGetSize: getGetter(Map, \"size\"),\n MapPrototypeEntries: uncurryThis(Map.prototype.entries),\n MapPrototypeValues: uncurryThis(Map.prototype.values),\n MapPrototypeKeys: uncurryThis(Map.prototype.keys),\n MathFloor: Math.floor,\n MathMax: Math.max,\n MathMin: Math.min,\n MathRound: Math.round,\n MathSqrt: Math.sqrt,\n MathTrunc: Math.trunc,\n Number,\n NumberIsFinite: Number.isFinite,\n NumberIsNaN: Number.isNaN,\n NumberParseFloat: Number.parseFloat,\n NumberParseInt: Number.parseInt,\n NumberPrototypeToString: uncurryThis(Number.prototype.toString),\n NumberPrototypeValueOf: uncurryThis(Number.prototype.valueOf),\n Object,\n ObjectAssign: Object.assign,\n ObjectCreate: Object.create,\n ObjectDefineProperty: Object.defineProperty,\n ObjectEntries: Object.entries,\n ObjectGetOwnPropertyDescriptor: Object.getOwnPropertyDescriptor,\n ObjectGetOwnPropertyDescriptors: Object.getOwnPropertyDescriptors,\n ObjectGetOwnPropertyNames: Object.getOwnPropertyNames,\n ObjectGetOwnPropertySymbols: Object.getOwnPropertySymbols,\n ObjectGetPrototypeOf: Object.getPrototypeOf,\n ObjectIs: Object.is,\n ObjectKeys: Object.keys,\n ObjectPrototypeHasOwnProperty: uncurryThis(Object.prototype.hasOwnProperty),\n ObjectPrototypePropertyIsEnumerable: uncurryThis(Object.prototype.propertyIsEnumerable),\n ObjectPrototypeToString: uncurryThis(Object.prototype.toString),\n ObjectSeal: Object.seal,\n ObjectSetPrototypeOf: Object.setPrototypeOf,\n ReflectApply: @getByIdDirect(Reflect, \"apply\"),\n ReflectOwnKeys: Reflect.ownKeys,\n RegExp: @RegExp,\n RegExpPrototypeExec: uncurryThis(@RegExp.prototype.exec),\n RegExpPrototypeSymbolReplace: uncurryThis(@RegExp.prototype[Symbol.replace]),\n RegExpPrototypeSymbolSplit: uncurryThis(@RegExp.prototype[Symbol.split]),\n RegExpPrototypeTest: uncurryThis(@RegExp.prototype.test),\n RegExpPrototypeToString: uncurryThis(@RegExp.prototype.toString),\n SafeStringIterator: createSafeIterator(StringIterator, uncurryThis(StringIteratorPrototype.next)),\n SafeMap: makeSafe(Map, class SafeMap extends Map {\n constructor(i) {\n super(i);\n }\n }),\n SafeSet: makeSafe(Set, class SafeSet extends Set {\n constructor(i) {\n super(i);\n }\n }),\n SetPrototypeGetSize: getGetter(Set, \"size\"),\n SetPrototypeEntries: uncurryThis(Set.prototype.entries),\n SetPrototypeValues: uncurryThis(Set.prototype.values),\n String: @String,\n StringPrototypeCharCodeAt: uncurryThis(@String.prototype.charCodeAt),\n StringPrototypeCodePointAt: uncurryThis(@String.prototype.codePointAt),\n StringPrototypeEndsWith: uncurryThis(@String.prototype.endsWith),\n StringPrototypeIncludes: uncurryThis(@String.prototype.includes),\n StringPrototypeIndexOf: uncurryThis(@String.prototype.indexOf),\n StringPrototypeLastIndexOf: uncurryThis(@String.prototype.lastIndexOf),\n StringPrototypeMatch: uncurryThis(@String.prototype.match),\n StringPrototypeNormalize: uncurryThis(@String.prototype.normalize),\n StringPrototypePadEnd: uncurryThis(@String.prototype.padEnd),\n StringPrototypePadStart: uncurryThis(@String.prototype.padStart),\n StringPrototypeRepeat: uncurryThis(@String.prototype.repeat),\n StringPrototypeReplace: uncurryThis(@String.prototype.replace),\n StringPrototypeReplaceAll: uncurryThis(@String.prototype.replaceAll),\n StringPrototypeSlice: uncurryThis(@String.prototype.slice),\n StringPrototypeSplit: uncurryThis(@String.prototype.split),\n StringPrototypeStartsWith: uncurryThis(@String.prototype.startsWith),\n StringPrototypeToLowerCase: uncurryThis(@String.prototype.toLowerCase),\n StringPrototypeTrim: uncurryThis(@String.prototype.trim),\n StringPrototypeValueOf: uncurryThis(@String.prototype.valueOf),\n SymbolPrototypeToString: uncurryThis(Symbol.prototype.toString),\n SymbolPrototypeValueOf: uncurryThis(Symbol.prototype.valueOf),\n FunctionPrototypeToString: uncurryThis(Function.prototype.toString),\n FunctionPrototypeBind: uncurryThis(Function.prototype.bind),\n SymbolIterator: Symbol.iterator,\n SymbolFor: Symbol.for,\n SymbolToStringTag: Symbol.toStringTag,\n TypedArrayPrototypeGetLength: getGetter(@Uint8Array, \"length\"),\n TypedArrayPrototypeGetSymbolToStringTag: getGetter(@Uint8Array, Symbol.toStringTag),\n Uint8ClampedArray,\n Uint8Array: @Uint8Array,\n Uint16Array,\n Uint32Array,\n Int8Array,\n Int16Array,\n Int32Array,\n Float32Array,\n Float64Array,\n BigUint64Array,\n BigInt64Array,\n uncurryThis\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral InternalSharedCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/internal/shared.ts\nvar throwNotImplemented = function(feature, issue) {\n throw hideFromStack(throwNotImplemented), new NotImplementedError(feature, issue);\n}, hideFromStack = function(...fns) {\n for (let fn of fns)\n Object.defineProperty(fn, \"name\", {\n value: \"::bunternal::\"\n });\n}, $;\n\nclass NotImplementedError extends Error {\n code;\n constructor(feature, issue) {\n super(feature + \" is not yet implemented in Bun.\" + (issue \? \" Track the status & thumbs up the issue: https://github.com/oven-sh/bun/issues/\" + issue : \"\"));\n this.name = \"NotImplementedError\", this.code = \"ERR_NOT_IMPLEMENTED\", hideFromStack(NotImplementedError);\n }\n}\n$ = {\n NotImplementedError,\n throwNotImplemented,\n hideFromStack\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral InternalUtilInspectCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/internal/util/inspect.ts\nvar vmSafeInstanceof = function(val, ctor) {\n if (val instanceof ctor)\n return !0;\n while (val) {\n if (typeof val !== \"object\")\n return !1;\n if (ctor.name === internalGetConstructorName(val))\n return !0;\n val = ObjectGetPrototypeOf(val);\n }\n return !1;\n}, checkBox = function(ctor) {\n return (val) => {\n if (!vmSafeInstanceof(val, ctor))\n return !1;\n try {\n ctor.prototype.valueOf.@call(val);\n } catch {\n return !1;\n }\n return !0;\n };\n}, assert = function(p, message) {\n if (!p)\n throw new AssertionError(message);\n}, getUserOptions = function(ctx, isCrossContext) {\n const ret = {\n stylize: ctx.stylize,\n showHidden: ctx.showHidden,\n depth: ctx.depth,\n colors: ctx.colors,\n customInspect: ctx.customInspect,\n showProxy: ctx.showProxy,\n maxArrayLength: ctx.maxArrayLength,\n maxStringLength: ctx.maxStringLength,\n breakLength: ctx.breakLength,\n compact: ctx.compact,\n sorted: ctx.sorted,\n getters: ctx.getters,\n numericSeparator: ctx.numericSeparator,\n ...ctx.userOptions\n };\n if (isCrossContext) {\n ObjectSetPrototypeOf(ret, null);\n for (let key of ObjectKeys(ret))\n if ((typeof ret[key] === \"object\" || typeof ret[key] === \"function\") && ret[key] !== null)\n delete ret[key];\n ret.stylize = ObjectSetPrototypeOf((value, flavour) => {\n let stylized;\n try {\n stylized = `${ctx.stylize(value, flavour)}`;\n } catch {\n }\n if (typeof stylized !== \"string\")\n return value;\n return stylized;\n }, null);\n }\n return ret;\n}, inspect = function(value, opts) {\n const ctx = {\n budget: {},\n indentationLvl: 0,\n seen: [],\n currentDepth: 0,\n stylize: stylizeNoColor,\n showHidden: inspectDefaultOptions.showHidden,\n depth: inspectDefaultOptions.depth,\n colors: inspectDefaultOptions.colors,\n customInspect: inspectDefaultOptions.customInspect,\n showProxy: inspectDefaultOptions.showProxy,\n maxArrayLength: inspectDefaultOptions.maxArrayLength,\n maxStringLength: inspectDefaultOptions.maxStringLength,\n breakLength: inspectDefaultOptions.breakLength,\n compact: inspectDefaultOptions.compact,\n sorted: inspectDefaultOptions.sorted,\n getters: inspectDefaultOptions.getters,\n numericSeparator: inspectDefaultOptions.numericSeparator\n };\n if (arguments.length > 1) {\n if (arguments.length > 2) {\n if (arguments[2] !== @undefined)\n ctx.depth = arguments[2];\n if (arguments.length > 3 && arguments[3] !== @undefined)\n ctx.colors = arguments[3];\n }\n if (typeof opts === \"boolean\")\n ctx.showHidden = opts;\n else if (opts) {\n const optKeys = ObjectKeys(opts);\n for (let i = 0;i < optKeys.length; ++i) {\n const key = optKeys[i];\n if (ObjectPrototypeHasOwnProperty(inspectDefaultOptions, key) || key === \"stylize\")\n ctx[key] = opts[key];\n else if (ctx.userOptions === @undefined)\n ctx.userOptions = opts;\n }\n }\n }\n if (ctx.colors)\n ctx.stylize = stylizeWithColor;\n if (ctx.maxArrayLength === null)\n ctx.maxArrayLength = @Infinity;\n if (ctx.maxStringLength === null)\n ctx.maxStringLength = @Infinity;\n return formatValue(ctx, value, 0);\n}, defineColorAlias = function(target, alias) {\n ObjectDefineProperty(inspect.colors, alias, {\n __proto__: null,\n get() {\n return this[target];\n },\n set(value) {\n this[target] = value;\n },\n configurable: !0,\n enumerable: !1\n });\n}, addQuotes = function(str, quotes) {\n if (quotes === -1)\n return `\"${str}\"`;\n if (quotes === -2)\n return `\\`${str}\\``;\n return `'${str}'`;\n}, escapeFn = function(str) {\n const charCode = StringPrototypeCharCodeAt(str);\n return meta.length > charCode \? meta[charCode] : `\\\\u${NumberPrototypeToString(charCode, 16)}`;\n}, strEscape = function(str) {\n let escapeTest = strEscapeSequencesRegExp, escapeReplace = strEscapeSequencesReplacer, singleQuote = 39;\n if (StringPrototypeIncludes(str, \"'\")) {\n if (!StringPrototypeIncludes(str, '\"'))\n singleQuote = -1;\n else if (!StringPrototypeIncludes(str, \"`\") && !StringPrototypeIncludes(str, \"${\"))\n singleQuote = -2;\n if (singleQuote !== 39)\n escapeTest = strEscapeSequencesRegExpSingle, escapeReplace = strEscapeSequencesReplacerSingle;\n }\n if (str.length < 5000 && RegExpPrototypeExec(escapeTest, str) === null)\n return addQuotes(str, singleQuote);\n if (str.length > 100)\n return str = RegExpPrototypeSymbolReplace(escapeReplace, str, escapeFn), addQuotes(str, singleQuote);\n let result = \"\", last = 0;\n for (let i = 0;i < str.length; i++) {\n const point = StringPrototypeCharCodeAt(str, i);\n if (point === singleQuote || point === 92 || point < 32 || point > 126 && point < 160) {\n if (last === i)\n result += meta[point];\n else\n result += `${StringPrototypeSlice(str, last, i)}${meta[point]}`;\n last = i + 1;\n } else if (point >= 55296 && point <= 57343) {\n if (point <= 56319 && i + 1 < str.length) {\n const point2 = StringPrototypeCharCodeAt(str, i + 1);\n if (point2 >= 56320 && point2 <= 57343) {\n i++;\n continue;\n }\n }\n result += `${StringPrototypeSlice(str, last, i)}\\\\u${NumberPrototypeToString(point, 16)}`, last = i + 1;\n }\n }\n if (last !== str.length)\n result += StringPrototypeSlice(str, last);\n return addQuotes(result, singleQuote);\n}, stylizeWithColor = function(str, styleType) {\n const style = inspect.styles[styleType];\n if (style !== @undefined) {\n const color = inspect.colors[style];\n if (color !== @undefined)\n return `\\x1B[${color[0]}m${str}\\x1B[${color[1]}m`;\n }\n return str;\n}, stylizeNoColor = function(str) {\n return str;\n}, getEmptyFormatArray = function() {\n return [];\n}, isInstanceof = function(object, proto) {\n try {\n return object instanceof proto;\n } catch {\n return !1;\n }\n}, getConstructorName = function(obj, ctx, recurseTimes, protoProps) {\n let firstProto;\n const tmp = obj;\n while (obj || isUndetectableObject(obj)) {\n const descriptor = ObjectGetOwnPropertyDescriptor(obj, \"constructor\");\n if (descriptor !== @undefined && typeof descriptor.value === \"function\" && descriptor.value.name !== \"\" && isInstanceof(tmp, descriptor.value)) {\n if (protoProps !== @undefined && (firstProto !== obj || !builtInObjects.has(descriptor.value.name)))\n addPrototypeProperties(ctx, tmp, firstProto || tmp, recurseTimes, protoProps);\n return String(descriptor.value.name);\n }\n if (obj = ObjectGetPrototypeOf(obj), firstProto === @undefined)\n firstProto = obj;\n }\n if (firstProto === null)\n return null;\n const res = internalGetConstructorName(tmp);\n if (recurseTimes > ctx.depth && ctx.depth !== null)\n return `${res} `;\n const protoConstr = getConstructorName(firstProto, ctx, recurseTimes + 1, protoProps);\n if (protoConstr === null)\n return `${res} <${inspect(firstProto, {\n ...ctx,\n customInspect: !1,\n depth: -1\n })}>`;\n return `${res} <${protoConstr}>`;\n}, addPrototypeProperties = function(ctx, main, obj, recurseTimes, output) {\n let depth = 0, keys, keySet;\n do {\n if (depth !== 0 || main === obj) {\n if (obj = ObjectGetPrototypeOf(obj), obj === null)\n return;\n const descriptor = ObjectGetOwnPropertyDescriptor(obj, \"constructor\");\n if (descriptor !== @undefined && typeof descriptor.value === \"function\" && builtInObjects.has(descriptor.value.name))\n return;\n }\n if (depth === 0)\n keySet = new SafeSet;\n else\n ArrayPrototypeForEach(keys, (key) => keySet.add(key));\n keys = ReflectOwnKeys(obj), ArrayPrototypePush(ctx.seen, main);\n for (let key of keys) {\n if (key === \"constructor\" || ObjectPrototypeHasOwnProperty(main, key) || depth !== 0 && keySet.has(key))\n continue;\n const desc = ObjectGetOwnPropertyDescriptor(obj, key);\n if (typeof desc.value === \"function\")\n continue;\n const value = formatProperty(ctx, obj, recurseTimes, key, kObjectType, desc, main);\n if (ctx.colors)\n ArrayPrototypePush(output, `\\x1B[2m${value}\\x1B[22m`);\n else\n ArrayPrototypePush(output, value);\n }\n ArrayPrototypePop(ctx.seen);\n } while (++depth !== 3);\n}, getPrefix = function(constructor, tag, fallback, size = \"\") {\n if (constructor === null) {\n if (tag !== \"\" && fallback !== tag)\n return `[${fallback}${size}: null prototype] [${tag}] `;\n return `[${fallback}${size}: null prototype] `;\n }\n if (tag !== \"\" && constructor !== tag)\n return `${constructor}${size} [${tag}] `;\n return `${constructor}${size} `;\n}, getKeys = function(value, showHidden) {\n let keys;\n const symbols = ObjectGetOwnPropertySymbols(value);\n if (showHidden) {\n if (keys = ObjectGetOwnPropertyNames(value), symbols.length !== 0)\n ArrayPrototypePushApply(keys, symbols);\n } else {\n try {\n keys = ObjectKeys(value);\n } catch (err) {\n assert(isNativeError(err) && err.name === \"ReferenceError\" && isModuleNamespaceObject(value)), keys = ObjectGetOwnPropertyNames(value);\n }\n if (symbols.length !== 0)\n ArrayPrototypePushApply(keys, ArrayPrototypeFilter(symbols, (key) => ObjectPrototypePropertyIsEnumerable(value, key)));\n }\n return keys;\n}, getCtxStyle = function(value, constructor, tag) {\n let fallback = \"\";\n if (constructor === null) {\n if (fallback = internalGetConstructorName(value), fallback === tag)\n fallback = \"Object\";\n }\n return getPrefix(constructor, tag, fallback);\n}, formatProxy = function(ctx, proxy, recurseTimes) {\n if (recurseTimes > ctx.depth && ctx.depth !== null)\n return ctx.stylize(\"Proxy [Array]\", \"special\");\n recurseTimes += 1, ctx.indentationLvl += 2;\n const res = [formatValue(ctx, proxy[0], recurseTimes), formatValue(ctx, proxy[1], recurseTimes)];\n return ctx.indentationLvl -= 2, reduceToSingleString(ctx, res, \"\", [\"Proxy [\", \"]\"], kArrayExtrasType, recurseTimes);\n}, formatValue = function(ctx, value, recurseTimes, typedArray) {\n if (typeof value !== \"object\" && typeof value !== \"function\" && !isUndetectableObject(value))\n return formatPrimitive(ctx.stylize, value, ctx);\n if (value === null)\n return ctx.stylize(\"null\", \"null\");\n const context = value, proxy = getProxyDetails(value, !!ctx.showProxy);\n if (proxy !== @undefined) {\n if (proxy === null || proxy[0] === null)\n return ctx.stylize(\"\", \"special\");\n if (ctx.showProxy)\n return formatProxy(ctx, proxy, recurseTimes);\n value = proxy;\n }\n if (ctx.customInspect) {\n const maybeCustom = value[customInspectSymbol];\n if (typeof maybeCustom === \"function\" && maybeCustom !== inspect && !(value.constructor && value.constructor.prototype === value)) {\n const depth = ctx.depth === null \? null : ctx.depth - recurseTimes, isCrossContext = proxy !== @undefined || !(context instanceof Object), ret = maybeCustom.@call(context, depth, getUserOptions(ctx, isCrossContext), inspect);\n if (ret !== context) {\n if (typeof ret !== \"string\")\n return formatValue(ctx, ret, recurseTimes);\n return StringPrototypeReplaceAll(ret, \"\\n\", `\\n${StringPrototypeRepeat(\" \", ctx.indentationLvl)}`);\n }\n }\n }\n if (ctx.seen.includes(value)) {\n let index = 1;\n if (ctx.circular === @undefined)\n ctx.circular = new SafeMap, ctx.circular.set(value, index);\n else if (index = ctx.circular.get(value), index === @undefined)\n index = ctx.circular.size + 1, ctx.circular.set(value, index);\n return ctx.stylize(`[Circular *${index}]`, \"special\");\n }\n return formatRaw(ctx, value, recurseTimes, typedArray);\n}, formatRaw = function(ctx, value, recurseTimes, typedArray) {\n let keys, protoProps;\n if (ctx.showHidden && (recurseTimes <= ctx.depth || ctx.depth === null))\n protoProps = [];\n const constructor = getConstructorName(value, ctx, recurseTimes, protoProps);\n if (protoProps !== @undefined && protoProps.length === 0)\n protoProps = @undefined;\n let tag = value[SymbolToStringTag];\n if (typeof tag !== \"string\" || tag !== \"\" && (ctx.showHidden \? ObjectPrototypeHasOwnProperty : ObjectPrototypePropertyIsEnumerable)(value, SymbolToStringTag))\n tag = \"\";\n let base = \"\", formatter = getEmptyFormatArray, braces, noIterator = !0, i = 0;\n const filter = ctx.showHidden \? 0 : 2;\n let extrasType = kObjectType;\n if ((SymbolIterator in value) || constructor === null)\n if (noIterator = !1, ArrayIsArray(value)) {\n const prefix = constructor !== \"Array\" || tag !== \"\" \? getPrefix(constructor, tag, \"Array\", `(${value.length})`) : \"\";\n if (keys = getOwnNonIndexProperties(value, filter), braces = [`${prefix}[`, \"]\"], value.length === 0 && keys.length === 0 && protoProps === @undefined)\n return `${braces[0]}]`;\n extrasType = kArrayExtrasType, formatter = formatArray;\n } else if (isSet(value)) {\n const size = SetPrototypeGetSize(value), prefix = getPrefix(constructor, tag, \"Set\", `(${size})`);\n if (keys = getKeys(value, ctx.showHidden), formatter = constructor !== null \? FunctionPrototypeBind(formatSet, null, value) : FunctionPrototypeBind(formatSet, null, SetPrototypeValues(value)), size === 0 && keys.length === 0 && protoProps === @undefined)\n return `${prefix}{}`;\n braces = [`${prefix}{`, \"}\"];\n } else if (isMap(value)) {\n const size = MapPrototypeGetSize(value), prefix = getPrefix(constructor, tag, \"Map\", `(${size})`);\n if (keys = getKeys(value, ctx.showHidden), formatter = constructor !== null \? FunctionPrototypeBind(formatMap, null, value) : FunctionPrototypeBind(formatMap, null, MapPrototypeEntries(value)), size === 0 && keys.length === 0 && protoProps === @undefined)\n return `${prefix}{}`;\n braces = [`${prefix}{`, \"}\"];\n } else if (isTypedArray(value)) {\n keys = getOwnNonIndexProperties(value, filter);\n let bound = value, fallback = \"\";\n if (constructor === null)\n fallback = TypedArrayPrototypeGetSymbolToStringTag(value), bound = new primordials[fallback](value);\n const size = TypedArrayPrototypeGetLength(value);\n if (braces = [`${getPrefix(constructor, tag, fallback, `(${size})`)}[`, \"]\"], value.length === 0 && keys.length === 0 && !ctx.showHidden)\n return `${braces[0]}]`;\n formatter = FunctionPrototypeBind(formatTypedArray, null, bound, size), extrasType = kArrayExtrasType;\n } else if (isMapIterator(value))\n keys = getKeys(value, ctx.showHidden), braces = getIteratorBraces(\"Map\", tag), formatter = FunctionPrototypeBind(formatIterator, null, braces);\n else if (isSetIterator(value))\n keys = getKeys(value, ctx.showHidden), braces = getIteratorBraces(\"Set\", tag), formatter = FunctionPrototypeBind(formatIterator, null, braces);\n else\n noIterator = !0;\n if (noIterator)\n if (keys = getKeys(value, ctx.showHidden), braces = [\"{\", \"}\"], constructor === \"Object\") {\n if (isArgumentsObject(value))\n braces[0] = \"[Arguments] {\";\n else if (tag !== \"\")\n braces[0] = `${getPrefix(constructor, tag, \"Object\")}{`;\n if (keys.length === 0 && protoProps === @undefined)\n return `${braces[0]}}`;\n } else if (typeof value === \"function\") {\n if (base = getFunctionBase(value, constructor, tag), keys.length === 0 && protoProps === @undefined)\n return ctx.stylize(base, \"special\");\n } else if (isRegExp(value)) {\n base = RegExpPrototypeToString(constructor !== null \? value : new RegExp(value));\n const prefix = getPrefix(constructor, tag, \"RegExp\");\n if (prefix !== \"RegExp \")\n base = `${prefix}${base}`;\n if (keys.length === 0 && protoProps === @undefined || recurseTimes > ctx.depth && ctx.depth !== null)\n return ctx.stylize(base, \"regexp\");\n } else if (isDate(value)) {\n base = NumberIsNaN(DatePrototypeGetTime(value)) \? DatePrototypeToString(value) : DatePrototypeToISOString(value);\n const prefix = getPrefix(constructor, tag, \"Date\");\n if (prefix !== \"Date \")\n base = `${prefix}${base}`;\n if (keys.length === 0 && protoProps === @undefined)\n return ctx.stylize(base, \"date\");\n } else if (value instanceof Error) {\n if (base = formatError(value, constructor, tag, ctx, keys), keys.length === 0 && protoProps === @undefined)\n return base;\n } else if (isAnyArrayBuffer(value)) {\n const arrayType = isArrayBuffer(value) \? \"ArrayBuffer\" : \"SharedArrayBuffer\", prefix = getPrefix(constructor, tag, arrayType);\n if (typedArray === @undefined)\n formatter = formatArrayBuffer;\n else if (keys.length === 0 && protoProps === @undefined)\n return prefix + `{ byteLength: ${formatNumber(ctx.stylize, value.byteLength, !1)} }`;\n braces[0] = `${prefix}{`, ArrayPrototypeUnshift(keys, \"byteLength\");\n } else if (isDataView(value))\n braces[0] = `${getPrefix(constructor, tag, \"DataView\")}{`, ArrayPrototypeUnshift(keys, \"byteLength\", \"byteOffset\", \"buffer\");\n else if (isPromise(value))\n braces[0] = `${getPrefix(constructor, tag, \"Promise\")}{`, formatter = formatPromise;\n else if (isWeakSet(value))\n braces[0] = `${getPrefix(constructor, tag, \"WeakSet\")}{`, formatter = ctx.showHidden \? formatWeakSet : formatWeakCollection;\n else if (isWeakMap(value))\n braces[0] = `${getPrefix(constructor, tag, \"WeakMap\")}{`, formatter = ctx.showHidden \? formatWeakMap : formatWeakCollection;\n else if (isModuleNamespaceObject(value))\n braces[0] = `${getPrefix(constructor, tag, \"Module\")}{`, formatter = formatNamespaceObject.bind(null, keys);\n else if (isBoxedPrimitive(value)) {\n if (base = getBoxedBase(value, ctx, keys, constructor, tag), keys.length === 0 && protoProps === @undefined)\n return base;\n } else {\n if (keys.length === 0 && protoProps === @undefined) {\n if (isExternal(value))\n return ctx.stylize(\"[External: 0]\", \"special\");\n return `${getCtxStyle(value, constructor, tag)}{}`;\n }\n braces[0] = `${getCtxStyle(value, constructor, tag)}{`;\n }\n if (recurseTimes > ctx.depth && ctx.depth !== null) {\n let constructorName = StringPrototypeSlice(getCtxStyle(value, constructor, tag), 0, -1);\n if (constructor !== null)\n constructorName = `[${constructorName}]`;\n return ctx.stylize(constructorName, \"special\");\n }\n recurseTimes += 1, ctx.seen.push(value), ctx.currentDepth = recurseTimes;\n let output;\n const indentationLvl = ctx.indentationLvl;\n try {\n if (ctx.currentDepth > 1000)\n @throwRangeError(ERROR_STACK_OVERFLOW_MSG);\n output = formatter(ctx, value, recurseTimes);\n for (i = 0;i < keys.length; i++)\n ArrayPrototypePush(output, formatProperty(ctx, value, recurseTimes, keys[i], extrasType));\n if (protoProps !== @undefined)\n ArrayPrototypePushApply(output, protoProps);\n } catch (err) {\n if (err instanceof RangeError && err.message === ERROR_STACK_OVERFLOW_MSG) {\n const constructorName = StringPrototypeSlice(getCtxStyle(value, constructor, tag), 0, -1);\n return ctx.seen.pop(), ctx.indentationLvl = indentationLvl, ctx.stylize(`[${constructorName}: Inspection interrupted prematurely. Maximum call stack size exceeded.]`, \"special\");\n }\n throw new AssertionError(\"handleMaxCallStackSize assertion failed: \" + String(err), !0);\n }\n if (ctx.circular !== @undefined) {\n const index = ctx.circular.get(value);\n if (index !== @undefined)\n if (ctx.seenRefs \?\?= new Set, !ctx.seenRefs.has(index)) {\n ctx.seenRefs.add(index);\n const reference = ctx.stylize(``, \"special\");\n if (ctx.compact !== !0)\n base = base === \"\" \? reference : `${reference} ${base}`;\n else\n braces[0] = `${reference} ${braces[0]}`;\n } else {\n //! this is a non-standard behavior compared to Node's implementation\n return ctx.stylize(`[Circular *${index}]`, \"special\");\n }\n }\n if (ctx.seen.pop(), ctx.sorted) {\n const comparator = ctx.sorted === !0 \? @undefined : ctx.sorted;\n if (extrasType === kObjectType)\n ArrayPrototypeSort(output, comparator);\n else if (keys.length > 1) {\n const sorted = ArrayPrototypeSort(ArrayPrototypeSlice(output, output.length - keys.length), comparator);\n ArrayPrototypeUnshift(sorted, output, output.length - keys.length, keys.length), ReflectApply(ArrayPrototypeSplice, null, sorted);\n }\n }\n const res = reduceToSingleString(ctx, output, base, braces, extrasType, recurseTimes, value), newLength = (ctx.budget[ctx.indentationLvl] || 0) + res.length;\n if (ctx.budget[ctx.indentationLvl] = newLength, newLength > 134217728)\n ctx.depth = -1;\n return res;\n}, getIteratorBraces = function(type, tag) {\n if (tag !== `${type} Iterator`) {\n if (tag !== \"\")\n tag += \"] [\";\n tag += `${type} Iterator`;\n }\n return [`[${tag}] {`, \"}\"];\n}, getBoxedBase = function(value, ctx, keys, constructor, tag) {\n let fn, type;\n if (isNumberObject(value))\n fn = NumberPrototypeValueOf, type = \"Number\";\n else if (isStringObject(value))\n fn = StringPrototypeValueOf, type = \"String\", keys.splice(0, value.length);\n else if (isBooleanObject(value))\n fn = BooleanPrototypeValueOf, type = \"Boolean\";\n else if (isBigIntObject(value))\n fn = BigIntPrototypeValueOf, type = \"BigInt\";\n else\n fn = SymbolPrototypeValueOf, type = \"Symbol\";\n let base = `[${type}`;\n if (type !== constructor)\n if (constructor === null)\n base += \" (null prototype)\";\n else\n base += ` (${constructor})`;\n if (base += `: ${formatPrimitive(stylizeNoColor, fn(value), ctx)}]`, tag !== \"\" && tag !== constructor)\n base += ` [${tag}]`;\n if (keys.length !== 0 || ctx.stylize === stylizeNoColor)\n return base;\n return ctx.stylize(base, StringPrototypeToLowerCase(type));\n}, getClassBase = function(value, constructor, tag) {\n let base = `class ${ObjectPrototypeHasOwnProperty(value, \"name\") && value.name || \"(anonymous)\"}`;\n if (constructor !== \"Function\" && constructor !== null)\n base += ` [${constructor}]`;\n if (tag !== \"\" && constructor !== tag)\n base += ` [${tag}]`;\n if (constructor !== null) {\n const superName = ObjectGetPrototypeOf(value).name;\n if (superName)\n base += ` extends ${superName}`;\n } else\n base += \" extends [null prototype]\";\n return `[${base}]`;\n}, getFunctionBase = function(value, constructor, tag) {\n const stringified = FunctionPrototypeToString(value);\n if (StringPrototypeStartsWith(stringified, \"class\") && StringPrototypeEndsWith(stringified, \"}\")) {\n const slice = StringPrototypeSlice(stringified, 5, -1), bracketIndex = StringPrototypeIndexOf(slice, \"{\");\n if (bracketIndex !== -1 && (!StringPrototypeIncludes(StringPrototypeSlice(slice, 0, bracketIndex), \"(\") || RegExpPrototypeExec(classRegExp, RegExpPrototypeSymbolReplace(stripCommentsRegExp, slice)) !== null))\n return getClassBase(value, constructor, tag);\n }\n let type = \"Function\";\n if (isGeneratorFunction(value))\n type = `Generator${type}`;\n if (isAsyncFunction(value))\n type = `Async${type}`;\n let base = `[${type}`;\n if (constructor === null)\n base += \" (null prototype)\";\n if (value.name === \"\")\n base += \" (anonymous)\";\n else\n base += `: ${value.name}`;\n if (base += \"]\", constructor !== type && constructor !== null)\n base += ` ${constructor}`;\n if (tag !== \"\" && constructor !== tag)\n base += ` [${tag}]`;\n return base;\n}, identicalSequenceRange = function(a, b) {\n for (let i = 0;i < a.length - 3; i++) {\n const pos = b.indexOf(a[i]);\n if (pos !== -1) {\n const rest = b.length - pos;\n if (rest > 3) {\n let len = 1;\n const maxLen = MathMin(a.length - i, rest);\n while (maxLen > len && a[i + len] === b[pos + len])\n len++;\n if (len > 3)\n return { len, offset: i };\n }\n }\n }\n return { len: 0, offset: 0 };\n}, getStackString = function(error) {\n return error.stack \? String(error.stack) : ErrorPrototypeToString(error);\n}, getStackFrames = function(ctx, err, stack) {\n const frames = StringPrototypeSplit(stack, \"\\n\");\n let cause;\n try {\n ({ cause } = err);\n } catch {\n }\n if (cause != null && cause instanceof Error) {\n const causeStack = getStackString(cause), causeStackStart = StringPrototypeIndexOf(causeStack, \"\\n at\");\n if (causeStackStart !== -1) {\n const causeFrames = StringPrototypeSplit(StringPrototypeSlice(causeStack, causeStackStart + 1), \"\\n\"), { len, offset } = identicalSequenceRange(frames, causeFrames);\n if (len > 0) {\n const skipped = len - 2, msg = ` ... ${skipped} lines matching cause stack trace ...`;\n frames.splice(offset + 1, skipped, ctx.stylize(msg, \"undefined\"));\n }\n }\n }\n return frames;\n}, improveStack = function(stack, constructor, name, tag) {\n let len = name.length;\n if (constructor === null || StringPrototypeEndsWith(name, \"Error\") && StringPrototypeStartsWith(stack, name) && (stack.length === len || stack[len] === \":\" || stack[len] === \"\\n\")) {\n let fallback = \"Error\";\n if (constructor === null) {\n const start = RegExpPrototypeExec(/^([A-Z][a-z_ A-Z0-9[\\]()-]+)(\?::|\\n {4}at)/, stack) || RegExpPrototypeExec(/^([a-z_A-Z0-9-]*Error)$/, stack);\n fallback = start && start[1] || \"\", len = fallback.length, fallback = fallback || \"Error\";\n }\n const prefix = StringPrototypeSlice(getPrefix(constructor, tag, fallback), 0, -1);\n if (name !== prefix)\n if (StringPrototypeIncludes(prefix, name))\n if (len === 0)\n stack = `${prefix}: ${stack}`;\n else\n stack = `${prefix}${StringPrototypeSlice(stack, len)}`;\n else\n stack = `${prefix} [${name}]${StringPrototypeSlice(stack, len)}`;\n }\n return stack;\n}, removeDuplicateErrorKeys = function(ctx, keys, err, stack) {\n if (!ctx.showHidden && keys.length !== 0)\n for (let name of [\"name\", \"message\", \"stack\"]) {\n const index = ArrayPrototypeIndexOf(keys, name);\n if (index !== -1 && StringPrototypeIncludes(stack, err[name]))\n ArrayPrototypeSplice(keys, index, 1);\n }\n}, markNodeModules = function(ctx, line) {\n let tempLine = \"\", nodeModule, pos = 0;\n while ((nodeModule = nodeModulesRegExp.exec(line)) !== null)\n tempLine += StringPrototypeSlice(line, pos, nodeModule.index + 14), tempLine += ctx.stylize(nodeModule[1], \"module\"), pos = nodeModule.index + nodeModule[0].length;\n if (pos !== 0)\n line = tempLine + StringPrototypeSlice(line, pos);\n return line;\n}, markCwd = function(ctx, line, workingDirectory) {\n let cwdStartPos = StringPrototypeIndexOf(line, workingDirectory), tempLine = \"\", cwdLength = workingDirectory.length;\n if (cwdStartPos !== -1) {\n if (StringPrototypeSlice(line, cwdStartPos - 7, cwdStartPos) === \"file://\")\n cwdLength += 7, cwdStartPos -= 7;\n const start = line[cwdStartPos - 1] === \"(\" \? cwdStartPos - 1 : cwdStartPos, end = start !== cwdStartPos && StringPrototypeEndsWith(line, \")\") \? -1 : line.length, workingDirectoryEndPos = cwdStartPos + cwdLength + 1, cwdSlice = StringPrototypeSlice(line, start, workingDirectoryEndPos);\n if (tempLine += StringPrototypeSlice(line, 0, start), tempLine += ctx.stylize(cwdSlice, \"undefined\"), tempLine += StringPrototypeSlice(line, workingDirectoryEndPos, end), end === -1)\n tempLine += ctx.stylize(\")\", \"undefined\");\n } else\n tempLine += line;\n return tempLine;\n}, safeGetCWD = function() {\n let workingDirectory;\n try {\n workingDirectory = process.cwd();\n } catch {\n return;\n }\n return workingDirectory;\n}, formatError = function(err, constructor, tag, ctx, keys) {\n const name = err.name != null \? String(err.name) : \"Error\";\n let stack = getStackString(err);\n //! temp fix for Bun losing the error name from inherited errors + extraneous \": \" with no message\n if (stack = stack.replace(/^Error: /, `${name}${err.message \? \": \" : \"\"}`), removeDuplicateErrorKeys(ctx, keys, err, stack), (\"cause\" in err) && (keys.length === 0 || !ArrayPrototypeIncludes(keys, \"cause\")))\n ArrayPrototypePush(keys, \"cause\");\n if (ArrayIsArray(err.errors) && (keys.length === 0 || !ArrayPrototypeIncludes(keys, \"errors\")))\n ArrayPrototypePush(keys, \"errors\");\n stack = improveStack(stack, constructor, name, tag);\n let pos = err.message && StringPrototypeIndexOf(stack, err.message) || -1;\n if (pos !== -1)\n pos += err.message.length;\n const stackStart = StringPrototypeIndexOf(stack, \"\\n at\", pos);\n if (stackStart === -1)\n stack = `[${stack}]`;\n else {\n let newStack = StringPrototypeSlice(stack, 0, stackStart);\n const stackFramePart = StringPrototypeSlice(stack, stackStart + 1), lines = getStackFrames(ctx, err, stackFramePart);\n if (ctx.colors) {\n const workingDirectory = safeGetCWD();\n let esmWorkingDirectory;\n for (let line of lines) {\n const core = RegExpPrototypeExec(coreModuleRegExp, line);\n if (core !== null && (StringPrototypeStartsWith(core[1], \"internal/\") || ArrayPrototypeIncludes(@requireNativeModule(\"module\").builtinModules, core[1])))\n newStack += `\\n${ctx.stylize(line, \"undefined\")}`;\n else {\n if (newStack += \"\\n\", line = markNodeModules(ctx, line), workingDirectory !== @undefined) {\n let newLine = markCwd(ctx, line, workingDirectory);\n if (newLine === line)\n esmWorkingDirectory \?\?= pathToFileURL(workingDirectory), newLine = markCwd(ctx, line, esmWorkingDirectory);\n line = newLine;\n }\n newStack += line;\n }\n }\n } else\n newStack += `\\n${ArrayPrototypeJoin(lines, \"\\n\")}`;\n stack = newStack;\n }\n if (ctx.indentationLvl !== 0) {\n const indentation = StringPrototypeRepeat(\" \", ctx.indentationLvl);\n stack = StringPrototypeReplaceAll(stack, \"\\n\", `\\n${indentation}`);\n }\n return stack;\n}, groupArrayElements = function(ctx, output, value) {\n let totalLength = 0, maxLength = 0, i = 0, outputLength = output.length;\n if (ctx.maxArrayLength < output.length)\n outputLength--;\n const separatorSpace = 2, dataLen = new Array(outputLength);\n for (;i < outputLength; i++) {\n const len = getStringWidth(output[i], ctx.colors);\n if (dataLen[i] = len, totalLength += len + separatorSpace, maxLength < len)\n maxLength = len;\n }\n const actualMax = maxLength + separatorSpace;\n if (actualMax * 3 + ctx.indentationLvl < ctx.breakLength && (totalLength / actualMax > 5 || maxLength <= 6)) {\n const averageBias = MathSqrt(actualMax - totalLength / output.length), biasedMax = MathMax(actualMax - 3 - averageBias, 1), columns = MathMin(MathRound(MathSqrt(2.5 * biasedMax * outputLength) / biasedMax), MathFloor((ctx.breakLength - ctx.indentationLvl) / actualMax), ctx.compact * 4, 15);\n if (columns <= 1)\n return output;\n const tmp = [], maxLineLength = [];\n for (let i2 = 0;i2 < columns; i2++) {\n let lineMaxLength = 0;\n for (let j = i2;j < output.length; j += columns)\n if (dataLen[j] > lineMaxLength)\n lineMaxLength = dataLen[j];\n lineMaxLength += separatorSpace, maxLineLength[i2] = lineMaxLength;\n }\n let order = StringPrototypePadStart;\n if (value !== @undefined) {\n for (let i2 = 0;i2 < output.length; i2++)\n if (typeof value[i2] !== \"number\" && typeof value[i2] !== \"bigint\") {\n order = StringPrototypePadEnd;\n break;\n }\n }\n for (let i2 = 0;i2 < outputLength; i2 += columns) {\n const max = MathMin(i2 + columns, outputLength);\n let str = \"\", j = i2;\n for (;j < max - 1; j++) {\n const padding = maxLineLength[j - i2] + output[j].length - dataLen[j];\n str += order(`${output[j]}, `, padding, \" \");\n }\n if (order === StringPrototypePadStart) {\n const padding = maxLineLength[j - i2] + output[j].length - dataLen[j] - separatorSpace;\n str += StringPrototypePadStart(output[j], padding, \" \");\n } else\n str += output[j];\n ArrayPrototypePush(tmp, str);\n }\n if (ctx.maxArrayLength < output.length)\n ArrayPrototypePush(tmp, output[outputLength]);\n output = tmp;\n }\n return output;\n}, addNumericSeparator = function(integerString) {\n let result = \"\", i = integerString.length;\n const start = StringPrototypeStartsWith(integerString, \"-\") \? 1 : 0;\n for (;i >= start + 4; i -= 3)\n result = `_${StringPrototypeSlice(integerString, i - 3, i)}${result}`;\n return i === integerString.length \? integerString : `${StringPrototypeSlice(integerString, 0, i)}${result}`;\n}, addNumericSeparatorEnd = function(integerString) {\n let result = \"\", i = 0;\n for (;i < integerString.length - 3; i += 3)\n result += `${StringPrototypeSlice(integerString, i, i + 3)}_`;\n return i === 0 \? integerString : `${result}${StringPrototypeSlice(integerString, i)}`;\n}, formatNumber = function(fn, number, numericSeparator) {\n if (!numericSeparator) {\n if (ObjectIs(number, -0))\n return fn(\"-0\", \"number\");\n return fn(`${number}`, \"number\");\n }\n const integer = MathTrunc(number), string = String(integer);\n if (integer === number) {\n if (!NumberIsFinite(number) || StringPrototypeIncludes(string, \"e\"))\n return fn(string, \"number\");\n return fn(`${addNumericSeparator(string)}`, \"number\");\n }\n if (NumberIsNaN(number))\n return fn(string, \"number\");\n return fn(`${addNumericSeparator(string)}.${addNumericSeparatorEnd(StringPrototypeSlice(String(number), string.length + 1))}`, \"number\");\n}, formatBigInt = function(fn, bigint, numericSeparator) {\n const string = String(bigint);\n if (!numericSeparator)\n return fn(`${string}n`, \"bigint\");\n return fn(`${addNumericSeparator(string)}n`, \"bigint\");\n}, formatPrimitive = function(fn, value, ctx) {\n if (typeof value === \"string\") {\n let trailer = \"\";\n if (value.length > ctx.maxStringLength) {\n const remaining = value.length - ctx.maxStringLength;\n value = StringPrototypeSlice(value, 0, ctx.maxStringLength), trailer = `... ${remaining} more character${remaining > 1 \? \"s\" : \"\"}`;\n }\n if (ctx.compact !== !0 && value.length > kMinLineLength && value.length > ctx.breakLength - ctx.indentationLvl - 4)\n return ArrayPrototypeJoin(ArrayPrototypeMap(extractedSplitNewLines(value), (line) => fn(strEscape(line), \"string\")), ` +\\n${StringPrototypeRepeat(\" \", ctx.indentationLvl + 2)}`) + trailer;\n return fn(strEscape(value), \"string\") + trailer;\n }\n if (typeof value === \"number\")\n return formatNumber(fn, value, ctx.numericSeparator);\n if (typeof value === \"bigint\")\n return formatBigInt(fn, value, ctx.numericSeparator);\n if (typeof value === \"boolean\")\n return fn(`${value}`, \"boolean\");\n if (typeof value === \"undefined\")\n return fn(\"undefined\", \"undefined\");\n return fn(SymbolPrototypeToString(value), \"symbol\");\n}, formatNamespaceObject = function(keys, ctx, value, recurseTimes) {\n const output = new Array(keys.length);\n for (let i = 0;i < keys.length; i++)\n try {\n output[i] = formatProperty(ctx, value, recurseTimes, keys[i], kObjectType);\n } catch (err) {\n assert(isNativeError(err) && err.name === \"ReferenceError\");\n const tmp = { [keys[i]]: \"\" };\n output[i] = formatProperty(ctx, tmp, recurseTimes, keys[i], kObjectType);\n const pos = StringPrototypeLastIndexOf(output[i], \" \");\n output[i] = StringPrototypeSlice(output[i], 0, pos + 1) + ctx.stylize(\"\", \"special\");\n }\n return keys.length = 0, output;\n}, formatSpecialArray = function(ctx, value, recurseTimes, maxLength, output, i) {\n const keys = ObjectKeys(value);\n let index = i;\n for (;i < keys.length && output.length < maxLength; i++) {\n const key = keys[i], tmp = +key;\n if (tmp > 4294967294)\n break;\n if (`${index}` !== key) {\n if (RegExpPrototypeExec(numberRegExp, key) === null)\n break;\n const emptyItems = tmp - index, ending = emptyItems > 1 \? \"s\" : \"\", message = `<${emptyItems} empty item${ending}>`;\n if (ArrayPrototypePush(output, ctx.stylize(message, \"undefined\")), index = tmp, output.length === maxLength)\n break;\n }\n ArrayPrototypePush(output, formatProperty(ctx, value, recurseTimes, key, kArrayType)), index++;\n }\n const remaining = value.length - index;\n if (output.length !== maxLength) {\n if (remaining > 0) {\n const ending = remaining > 1 \? \"s\" : \"\", message = `<${remaining} empty item${ending}>`;\n ArrayPrototypePush(output, ctx.stylize(message, \"undefined\"));\n }\n } else if (remaining > 0)\n ArrayPrototypePush(output, remainingText(remaining));\n return output;\n}, hexSlice = function(buf, start = 0, end) {\n return ArrayPrototypeJoin(ArrayPrototypeMap(buf.slice(start, end), (x) => (\"00\" + x.toString(16)).slice(-2)), \"\");\n}, formatArrayBuffer = function(ctx, value) {\n let buffer;\n try {\n buffer = new Uint8Array(value);\n } catch {\n return [ctx.stylize(\"(detached)\", \"special\")];\n }\n let str = StringPrototypeTrim(RegExpPrototypeSymbolReplace(/(.{2})/g, hexSlice(buffer, 0, MathMin(ctx.maxArrayLength, buffer.length)), \"$1 \"));\n const remaining = buffer.length - ctx.maxArrayLength;\n if (remaining > 0)\n str += ` ... ${remaining} more byte${remaining > 1 \? \"s\" : \"\"}`;\n return [`${ctx.stylize(\"[Uint8Contents]\", \"special\")}: <${str}>`];\n}, formatArray = function(ctx, value, recurseTimes) {\n const valLen = value.length, len = MathMin(MathMax(0, ctx.maxArrayLength), valLen), remaining = valLen - len, output = [];\n for (let i = 0;i < len; i++) {\n if (!ObjectPrototypeHasOwnProperty(value, i))\n return formatSpecialArray(ctx, value, recurseTimes, len, output, i);\n ArrayPrototypePush(output, formatProperty(ctx, value, recurseTimes, i, kArrayType));\n }\n if (remaining > 0)\n ArrayPrototypePush(output, remainingText(remaining));\n return output;\n}, formatTypedArray = function(value, length, ctx, ignored, recurseTimes) {\n const maxLength = MathMin(MathMax(0, ctx.maxArrayLength), length), remaining = value.length - maxLength, output = new Array(maxLength), elementFormatter = value.length > 0 && typeof value[0] === \"number\" \? formatNumber : formatBigInt;\n for (let i = 0;i < maxLength; ++i)\n output[i] = elementFormatter(ctx.stylize, value[i], ctx.numericSeparator);\n if (remaining > 0)\n output[maxLength] = remainingText(remaining);\n if (ctx.showHidden) {\n ctx.indentationLvl += 2;\n for (let key of [\"BYTES_PER_ELEMENT\", \"length\", \"byteLength\", \"byteOffset\", \"buffer\"]) {\n const str = formatValue(ctx, value[key], recurseTimes, !0);\n ArrayPrototypePush(output, `[${key}]: ${str}`);\n }\n ctx.indentationLvl -= 2;\n }\n return output;\n}, formatSet = function(value, ctx, ignored, recurseTimes) {\n const length = value.size, maxLength = MathMin(MathMax(0, ctx.maxArrayLength), length), remaining = length - maxLength, output = [];\n ctx.indentationLvl += 2;\n let i = 0;\n for (let v of value) {\n if (i >= maxLength)\n break;\n ArrayPrototypePush(output, formatValue(ctx, v, recurseTimes)), i++;\n }\n if (remaining > 0)\n ArrayPrototypePush(output, remainingText(remaining));\n return ctx.indentationLvl -= 2, output;\n}, formatMap = function(value, ctx, ignored, recurseTimes) {\n const length = value.size, maxLength = MathMin(MathMax(0, ctx.maxArrayLength), length), remaining = length - maxLength, output = [];\n ctx.indentationLvl += 2;\n let i = 0;\n for (let { 0: k, 1: v } of value) {\n if (i >= maxLength)\n break;\n ArrayPrototypePush(output, `${formatValue(ctx, k, recurseTimes)} => ${formatValue(ctx, v, recurseTimes)}`), i++;\n }\n if (remaining > 0)\n ArrayPrototypePush(output, remainingText(remaining));\n return ctx.indentationLvl -= 2, output;\n}, formatSetIterInner = function(ctx, recurseTimes, entries, state) {\n const maxArrayLength = MathMax(ctx.maxArrayLength, 0), maxLength = MathMin(maxArrayLength, entries.length), output = new Array(maxLength);\n ctx.indentationLvl += 2;\n for (let i = 0;i < maxLength; i++)\n output[i] = formatValue(ctx, entries[i], recurseTimes);\n if (ctx.indentationLvl -= 2, state === kWeak && !ctx.sorted)\n ArrayPrototypeSort(output);\n const remaining = entries.length - maxLength;\n if (remaining > 0)\n ArrayPrototypePush(output, remainingText(remaining));\n return output;\n}, formatMapIterInner = function(ctx, recurseTimes, entries, state) {\n const maxArrayLength = MathMax(ctx.maxArrayLength, 0), len = entries.length / 2, remaining = len - maxArrayLength, maxLength = MathMin(maxArrayLength, len), output = new Array(maxLength);\n let i = 0;\n if (ctx.indentationLvl += 2, state === kWeak) {\n for (;i < maxLength; i++) {\n const pos = i * 2;\n output[i] = `${formatValue(ctx, entries[pos], recurseTimes)} => ${formatValue(ctx, entries[pos + 1], recurseTimes)}`;\n }\n if (!ctx.sorted)\n ArrayPrototypeSort(output);\n } else\n for (;i < maxLength; i++) {\n const pos = i * 2, res = [formatValue(ctx, entries[pos], recurseTimes), formatValue(ctx, entries[pos + 1], recurseTimes)];\n output[i] = reduceToSingleString(ctx, res, \"\", [\"[\", \"]\"], kArrayExtrasType, recurseTimes);\n }\n if (ctx.indentationLvl -= 2, remaining > 0)\n ArrayPrototypePush(output, remainingText(remaining));\n return output;\n}, formatWeakCollection = function(ctx) {\n return [ctx.stylize(\"\", \"special\")];\n}, formatWeakSet = function(ctx, value, recurseTimes) {\n const entries = previewEntries(value);\n return formatSetIterInner(ctx, recurseTimes, entries, kWeak);\n}, formatWeakMap = function(ctx, value, recurseTimes) {\n const entries = previewEntries(value);\n return formatMapIterInner(ctx, recurseTimes, entries, kWeak);\n}, formatIterator = function(braces, ctx, value, recurseTimes) {\n const { 0: entries, 1: isKeyValue } = previewEntries(value, !0);\n if (isKeyValue)\n return braces[0] = RegExpPrototypeSymbolReplace(/ Iterator] {$/, braces[0], \" Entries] {\"), formatMapIterInner(ctx, recurseTimes, entries, kMapEntries);\n return formatSetIterInner(ctx, recurseTimes, entries, kIterator);\n}, formatPromise = function(ctx, value, recurseTimes) {\n let output;\n const { 0: state, 1: result } = getPromiseDetails(value);\n if (state === kPending)\n output = [ctx.stylize(\"\", \"special\")];\n else {\n ctx.indentationLvl += 2;\n const str = formatValue(ctx, result, recurseTimes);\n ctx.indentationLvl -= 2, output = [state === kRejected \? `${ctx.stylize(\"\", \"special\")} ${str}` : str];\n }\n return output;\n}, formatProperty = function(ctx, value, recurseTimes, key, type, desc, original = value) {\n let name, str, extra = \" \";\n if (desc ||= ObjectGetOwnPropertyDescriptor(value, key) || { value: value[key], enumerable: !0 }, desc.value !== @undefined) {\n const diff = ctx.compact !== !0 || type !== kObjectType \? 2 : 3;\n if (ctx.indentationLvl += diff, str = formatValue(ctx, desc.value, recurseTimes), diff === 3 && ctx.breakLength < getStringWidth(str, ctx.colors))\n extra = `\\n${StringPrototypeRepeat(\" \", ctx.indentationLvl)}`;\n ctx.indentationLvl -= diff;\n } else if (desc.get !== @undefined) {\n const label = desc.set !== @undefined \? \"Getter/Setter\" : \"Getter\", s = ctx.stylize;\n if (ctx.getters && (ctx.getters === !0 || ctx.getters === \"get\" && desc.set === @undefined || ctx.getters === \"set\" && desc.set !== @undefined))\n try {\n const tmp = desc.get.@call(original);\n if (ctx.indentationLvl += 2, tmp === null)\n str = `${s(`[${label}:`, \"special\")} ${s(\"null\", \"null\")}${s(\"]\", \"special\")}`;\n else if (typeof tmp === \"object\")\n str = `${s(`[${label}]`, \"special\")} ${formatValue(ctx, tmp, recurseTimes)}`;\n else {\n const primitive = formatPrimitive(s, tmp, ctx);\n str = `${s(`[${label}:`, \"special\")} ${primitive}${s(\"]\", \"special\")}`;\n }\n ctx.indentationLvl -= 2;\n } catch (err) {\n const message = ``;\n str = `${s(`[${label}:`, \"special\")} ${message}${s(\"]\", \"special\")}`;\n }\n else\n str = ctx.stylize(`[${label}]`, \"special\");\n } else if (desc.set !== @undefined)\n str = ctx.stylize(\"[Setter]\", \"special\");\n else\n str = ctx.stylize(\"undefined\", \"undefined\");\n if (type === kArrayType)\n return str;\n if (typeof key === \"symbol\") {\n const tmp = RegExpPrototypeSymbolReplace(strEscapeSequencesReplacer, SymbolPrototypeToString(key), escapeFn);\n name = `[${ctx.stylize(tmp, \"symbol\")}]`;\n } else if (key === \"__proto__\")\n name = \"['__proto__']\";\n else if (desc.enumerable === !1)\n name = `[${RegExpPrototypeSymbolReplace(strEscapeSequencesReplacer, key, escapeFn)}]`;\n else if (RegExpPrototypeExec(keyStrRegExp, key) !== null)\n name = ctx.stylize(key, \"name\");\n else\n name = ctx.stylize(strEscape(key), \"string\");\n return `${name}:${extra}${str}`;\n}, isBelowBreakLength = function(ctx, output, start, base) {\n let totalLength = output.length + start;\n if (totalLength + output.length > ctx.breakLength)\n return !1;\n for (let i = 0;i < output.length; i++) {\n if (ctx.colors)\n totalLength += StringPrototypeReplaceAll(output[i], /\\u001B\\[\\d\\d\?m/g, \"\").length;\n else\n totalLength += output[i].length;\n if (totalLength > ctx.breakLength)\n return !1;\n }\n return base === \"\" || !StringPrototypeIncludes(base, \"\\n\");\n}, reduceToSingleString = function(ctx, output, base, braces, extrasType, recurseTimes, value) {\n if (ctx.compact !== !0) {\n if (typeof ctx.compact === \"number\" && ctx.compact >= 1) {\n const entries = output.length;\n if (extrasType === kArrayExtrasType && entries > 6)\n output = groupArrayElements(ctx, output, value);\n if (ctx.currentDepth - recurseTimes < ctx.compact && entries === output.length) {\n const start = output.length + ctx.indentationLvl + braces[0].length + base.length + 10;\n if (isBelowBreakLength(ctx, output, start, base)) {\n const joinedOutput = ArrayPrototypeJoin(output, \", \");\n if (!StringPrototypeIncludes(joinedOutput, \"\\n\"))\n return `${base \? `${base} ` : \"\"}${braces[0]} ${joinedOutput}` + ` ${braces[1]}`;\n }\n }\n }\n const indentation2 = `\\n${StringPrototypeRepeat(\" \", ctx.indentationLvl)}`;\n return `${base \? `${base} ` : \"\"}${braces[0]}${indentation2} ` + `${ArrayPrototypeJoin(output, `,${indentation2} `)}${indentation2}${braces[1]}`;\n }\n if (isBelowBreakLength(ctx, output, 0, base))\n return `${braces[0]}${base \? ` ${base}` : \"\"} ${ArrayPrototypeJoin(output, \", \")} ` + braces[1];\n const indentation = StringPrototypeRepeat(\" \", ctx.indentationLvl), ln = base === \"\" && braces[0].length === 1 \? \" \" : `${base \? ` ${base}` : \"\"}\\n${indentation} `;\n return `${braces[0]}${ln}${ArrayPrototypeJoin(output, `,\\n${indentation} `)} ${braces[1]}`;\n}, hasBuiltInToString = function(value) {\n const proxyTarget = getProxyDetails(value, !1);\n if (proxyTarget !== @undefined) {\n if (proxyTarget === null)\n return !0;\n value = proxyTarget;\n }\n if (typeof value.toString !== \"function\")\n return !0;\n if (ObjectPrototypeHasOwnProperty(value, \"toString\"))\n return !1;\n let pointer = value;\n do\n pointer = ObjectGetPrototypeOf(pointer);\n while (!ObjectPrototypeHasOwnProperty(pointer, \"toString\"));\n const descriptor = ObjectGetOwnPropertyDescriptor(pointer, \"constructor\");\n return descriptor !== @undefined && typeof descriptor.value === \"function\" && builtInObjects.has(descriptor.value.name);\n}, tryStringify = function(arg) {\n try {\n return JSONStringify(arg);\n } catch (err) {\n if (!CIRCULAR_ERROR_MESSAGE)\n try {\n const a = {};\n a.a = a, JSONStringify(a);\n } catch (circularError) {\n CIRCULAR_ERROR_MESSAGE = firstErrorLine(circularError);\n }\n if (err.name === \"TypeError\" && firstErrorLine(err) === CIRCULAR_ERROR_MESSAGE)\n return \"[Circular]\";\n throw err;\n }\n}, format = function(...args) {\n return formatWithOptionsInternal(@undefined, args);\n}, formatWithOptions = function(inspectOptions, ...args) {\n return validateObject(inspectOptions, \"inspectOptions\", { allowArray: !0 }), formatWithOptionsInternal(inspectOptions, args);\n}, formatNumberNoColor = function(number, options) {\n return formatNumber(stylizeNoColor, number, options\?.numericSeparator \?\? inspectDefaultOptions.numericSeparator);\n}, formatBigIntNoColor = function(bigint, options) {\n return formatBigInt(stylizeNoColor, bigint, options\?.numericSeparator \?\? inspectDefaultOptions.numericSeparator);\n}, formatWithOptionsInternal = function(inspectOptions, args) {\n const first = args[0];\n let a = 0, str = \"\", join = \"\";\n if (typeof first === \"string\") {\n if (args.length === 1)\n return first;\n let tempStr, lastPos = 0;\n for (let i = 0;i < first.length - 1; i++)\n if (StringPrototypeCharCodeAt(first, i) === 37) {\n const nextChar = StringPrototypeCharCodeAt(first, ++i);\n if (a + 1 !== args.length) {\n switch (nextChar) {\n case 115: {\n const tempArg = args[++a];\n if (typeof tempArg === \"number\")\n tempStr = formatNumberNoColor(tempArg, inspectOptions);\n else if (typeof tempArg === \"bigint\")\n tempStr = formatBigIntNoColor(tempArg, inspectOptions);\n else if (typeof tempArg !== \"object\" || tempArg === null || !hasBuiltInToString(tempArg))\n tempStr = String(tempArg);\n else\n tempStr = inspect(tempArg, {\n ...inspectOptions,\n compact: 3,\n colors: !1,\n depth: 0\n });\n break;\n }\n case 106:\n tempStr = tryStringify(args[++a]);\n break;\n case 100: {\n const tempNum = args[++a];\n if (typeof tempNum === \"bigint\")\n tempStr = formatBigIntNoColor(tempNum, inspectOptions);\n else if (typeof tempNum === \"symbol\")\n tempStr = \"NaN\";\n else\n tempStr = formatNumberNoColor(Number(tempNum), inspectOptions);\n break;\n }\n case 79:\n tempStr = inspect(args[++a], inspectOptions);\n break;\n case 111:\n tempStr = inspect(args[++a], {\n ...inspectOptions,\n showHidden: !0,\n showProxy: !0,\n depth: 4\n });\n break;\n case 105: {\n const tempInteger = args[++a];\n if (typeof tempInteger === \"bigint\")\n tempStr = formatBigIntNoColor(tempInteger, inspectOptions);\n else if (typeof tempInteger === \"symbol\")\n tempStr = \"NaN\";\n else\n tempStr = formatNumberNoColor(NumberParseInt(tempInteger), inspectOptions);\n break;\n }\n case 102: {\n const tempFloat = args[++a];\n if (typeof tempFloat === \"symbol\")\n tempStr = \"NaN\";\n else\n tempStr = formatNumberNoColor(NumberParseFloat(tempFloat), inspectOptions);\n break;\n }\n case 99:\n a += 1, tempStr = \"\";\n break;\n case 37:\n str += StringPrototypeSlice(first, lastPos, i), lastPos = i + 1;\n continue;\n default:\n continue;\n }\n if (lastPos !== i - 1)\n str += StringPrototypeSlice(first, lastPos, i - 1);\n str += tempStr, lastPos = i + 1;\n } else if (nextChar === 37)\n str += StringPrototypeSlice(first, lastPos, i), lastPos = i + 1;\n }\n if (lastPos !== 0) {\n if (a++, join = \" \", lastPos < first.length)\n str += StringPrototypeSlice(first, lastPos);\n }\n }\n while (a < args.length) {\n const value = args[a];\n str += join, str += typeof value !== \"string\" \? inspect(value, inspectOptions) : value, join = \" \", a++;\n }\n return str;\n}, isZeroWidthCodePoint = function(code) {\n return code <= 31 || code >= 127 && code <= 159 || code >= 768 && code <= 879 || code >= 8203 && code <= 8207 || code >= 8400 && code <= 8447 || code >= 65024 && code <= 65039 || code >= 65056 && code <= 65071 || code >= 917760 && code <= 917999;\n}, stripVTControlCharacters = function(str) {\n if (typeof str !== \"string\")\n throw new codes.ERR_INVALID_ARG_TYPE(\"str\", \"string\", str);\n return RegExpPrototypeSymbolReplace(ansi, str, \"\");\n}, getOwnNonIndexProperties = function(a, filter = 2) {\n const desc = ObjectGetOwnPropertyDescriptors(a), ret = [];\n for (let [k, v] of ObjectEntries(desc))\n if (!RegExpPrototypeTest(/^(0|[1-9][0-9]*)$/, k) || NumberParseInt(k, 10) >= 4294967295)\n if (filter === 2 && !v.enumerable)\n continue;\n else\n ArrayPrototypePush(ret, k);\n for (let s of ObjectGetOwnPropertySymbols(a)) {\n const v = ObjectGetOwnPropertyDescriptor(a, s);\n if (filter === 2 && !v.enumerable)\n continue;\n ArrayPrototypePush(ret, s);\n }\n return ret;\n}, getPromiseDetails = function(promise) {\n const state = @getPromiseInternalField(promise, @promiseFieldFlags) & @promiseStateMask;\n if (state !== @promiseStatePending)\n return [\n state === @promiseStateRejected \? kRejected : kFulfilled,\n @getPromiseInternalField(promise, @promiseFieldReactionsOrResult)\n ];\n return [kPending, @undefined];\n}, getProxyDetails = function(proxy, withHandler = !0) {\n if (!@isProxyObject(proxy))\n return @undefined;\n const handler = @getProxyInternalField(proxy, @proxyFieldHandler), target = handler === null \? null : @getProxyInternalField(proxy, @proxyFieldTarget);\n if (withHandler)\n return [target, handler];\n else\n return target;\n}, previewEntries = function(val, isIterator = !1) {\n if (isIterator) {\n const iteratedObject = @getInternalField(val, 1), kind = @getInternalField(val, 2), isEntries = kind === 2;\n if (@isMap(iteratedObject))\n if (isEntries)\n return [ArrayPrototypeFlat(ArrayFrom(iteratedObject)), !0];\n else if (kind === 1)\n return [ArrayFrom(MapPrototypeValues(iteratedObject)), !1];\n else\n return [ArrayFrom(MapPrototypeKeys(iteratedObject)), !1];\n else if (@isSet(iteratedObject))\n if (isEntries)\n return [ArrayPrototypeFlat(ArrayFrom(SetPrototypeEntries(iteratedObject))), !0];\n else\n return [ArrayFrom(iteratedObject), !1];\n else\n throw new Error(\"previewEntries(): Invalid iterator received\");\n }\n if (isWeakMap(val))\n return [];\n if (isWeakSet(val))\n return [];\n else\n throw new Error(\"previewEntries(): Invalid object received\");\n}, internalGetConstructorName = function(val) {\n if (!val || typeof val !== \"object\")\n throw new Error(\"Invalid object\");\n if (val.constructor\?.name)\n return val.constructor.name;\n const str = ObjectPrototypeToString(val), m = StringPrototypeMatch(str, /^\\[object ([^\\]]+)\\]/);\n return m \? m[1] : \"Object\";\n}, $, { pathToFileURL } = @getInternalField(@internalModuleRegistry, 47) || @createInternalModuleById(47), primordials = @getInternalField(@internalModuleRegistry, 5) || @createInternalModuleById(5), {\n Array,\n ArrayFrom,\n ArrayIsArray,\n ArrayPrototypeFilter,\n ArrayPrototypeFlat,\n ArrayPrototypeForEach,\n ArrayPrototypeIncludes,\n ArrayPrototypeIndexOf,\n ArrayPrototypeJoin,\n ArrayPrototypeMap,\n ArrayPrototypePop,\n ArrayPrototypePush,\n ArrayPrototypePushApply,\n ArrayPrototypeSlice,\n ArrayPrototypeSplice,\n ArrayPrototypeSort,\n ArrayPrototypeUnshift,\n BigIntPrototypeValueOf,\n BooleanPrototypeValueOf,\n DatePrototypeGetTime,\n DatePrototypeToISOString,\n DatePrototypeToString,\n ErrorCaptureStackTrace,\n ErrorPrototypeToString,\n FunctionPrototypeBind,\n FunctionPrototypeToString,\n JSONStringify,\n MapPrototypeGetSize,\n MapPrototypeEntries,\n MapPrototypeValues,\n MapPrototypeKeys,\n MathFloor,\n MathMax,\n MathMin,\n MathRound,\n MathSqrt,\n MathTrunc,\n Number,\n NumberIsFinite,\n NumberIsNaN,\n NumberParseFloat,\n NumberParseInt,\n NumberPrototypeToString,\n NumberPrototypeValueOf,\n Object,\n ObjectAssign,\n ObjectDefineProperty,\n ObjectEntries,\n ObjectGetOwnPropertyDescriptor,\n ObjectGetOwnPropertyDescriptors,\n ObjectGetOwnPropertyNames,\n ObjectGetOwnPropertySymbols,\n ObjectGetPrototypeOf,\n ObjectIs,\n ObjectKeys,\n ObjectPrototypeHasOwnProperty,\n ObjectPrototypePropertyIsEnumerable,\n ObjectPrototypeToString,\n ObjectSeal,\n ObjectSetPrototypeOf,\n ReflectApply,\n ReflectOwnKeys,\n RegExp,\n RegExpPrototypeExec,\n RegExpPrototypeSymbolReplace,\n RegExpPrototypeSymbolSplit,\n RegExpPrototypeTest,\n RegExpPrototypeToString,\n SafeStringIterator,\n SafeMap,\n SafeSet,\n SetPrototypeEntries,\n SetPrototypeGetSize,\n SetPrototypeValues,\n String,\n StringPrototypeCharCodeAt,\n StringPrototypeCodePointAt,\n StringPrototypeIncludes,\n StringPrototypeIndexOf,\n StringPrototypeLastIndexOf,\n StringPrototypeMatch,\n StringPrototypeNormalize,\n StringPrototypePadEnd,\n StringPrototypePadStart,\n StringPrototypeRepeat,\n StringPrototypeReplaceAll,\n StringPrototypeSlice,\n StringPrototypeSplit,\n StringPrototypeEndsWith,\n StringPrototypeStartsWith,\n StringPrototypeToLowerCase,\n StringPrototypeTrim,\n StringPrototypeValueOf,\n SymbolPrototypeToString,\n SymbolPrototypeValueOf,\n SymbolIterator,\n SymbolToStringTag,\n TypedArrayPrototypeGetLength,\n TypedArrayPrototypeGetSymbolToStringTag,\n Uint8Array\n} = primordials, customInspectSymbol = Symbol.for(\"nodejs.util.inspect.custom\"), kPending = Symbol(\"kPending\"), kFulfilled = Symbol(\"kFulfilled\"), kRejected = Symbol(\"kRejected\");\nvar isAsyncFunction = (v) => typeof v === \"function\" && StringPrototypeStartsWith(FunctionPrototypeToString(v), \"async\"), isGeneratorFunction = (v) => typeof v === \"function\" && StringPrototypeMatch(FunctionPrototypeToString(v), /^(async\\s+)\?function *\\*/), isBigIntObject = checkBox(BigInt), isSymbolObject = checkBox(Symbol), {\n isAnyArrayBuffer,\n isArrayBuffer,\n isArgumentsObject,\n isBoxedPrimitive: _native_isBoxedPrimitive,\n isDataView,\n isExternal,\n isMap,\n isMapIterator,\n isModuleNamespaceObject,\n isNativeError,\n isPromise,\n isSet,\n isSetIterator,\n isWeakMap,\n isWeakSet,\n isRegExp,\n isDate,\n isTypedArray,\n isStringObject,\n isNumberObject,\n isBooleanObject\n} = @requireNativeModule(\"util/types\");\n//! The native versions of the commented out functions are currently buggy, so we use the polyfills above for now.\n//! temp workaround to apply is{BigInt,Symbol}Object fix\nvar isBoxedPrimitive = (val) => isBigIntObject(val) || isSymbolObject(val) || _native_isBoxedPrimitive(val);\n\nclass AssertionError extends Error {\n constructor(message, isForced = !1) {\n super(message);\n this.name = \"AssertionError\", this.code = \"ERR_ASSERTION\", this.operator = \"==\", this.generatedMessage = !isForced, this.actual = isForced && @undefined, this.expected = !isForced || @undefined;\n }\n}\nvar codes = {};\n{\n const kTypes = [\n \"string\",\n \"function\",\n \"number\",\n \"object\",\n \"Function\",\n \"Object\",\n \"boolean\",\n \"bigint\",\n \"symbol\"\n ], classRegExp = /^([A-Z][a-z0-9]*)+$/, messages = new SafeMap;\n messages.set(\"ERR_INVALID_ARG_TYPE\", (name, expected, actual) => {\n if (assert(typeof name === \"string\", \"'name' must be a string\"), !ArrayIsArray(expected))\n expected = [expected];\n let msg = \"The \";\n if (StringPrototypeEndsWith(name, \" argument\"))\n msg += `${name} `;\n else\n msg += `\"${name}\" ${StringPrototypeIncludes(name, \".\") \? \"property\" : \"argument\"} `;\n msg += \"must be \";\n const types = [], instances = [], other = [];\n for (let value of expected)\n if (assert(typeof value === \"string\", \"All expected entries have to be of type string\"), ArrayPrototypeIncludes(kTypes, value))\n ArrayPrototypePush(types, StringPrototypeToLowerCase(value));\n else if (RegExpPrototypeTest(classRegExp, value))\n ArrayPrototypePush(instances, value);\n else\n assert(value !== \"object\", 'The value \"object\" should be written as \"Object\"'), ArrayPrototypePush(other, value);\n if (instances.length > 0) {\n const pos = ArrayPrototypeIndexOf(types, \"object\");\n if (pos !== -1)\n ArrayPrototypeSplice(types, pos, 1), ArrayPrototypePush(instances, \"Object\");\n }\n if (types.length > 0) {\n if (types.length > 2)\n msg += `one of type ${ArrayPrototypeJoin(types, \", \")}, or ${ArrayPrototypePop(types)}`;\n else if (types.length === 2)\n msg += `one of type ${types[0]} or ${types[1]}`;\n else\n msg += `of type ${types[0]}`;\n if (instances.length > 0 || other.length > 0)\n msg += \" or \";\n }\n if (instances.length > 0) {\n if (instances.length > 2)\n msg += `an instance of ${ArrayPrototypeJoin(instances, \", \")}, or ${ArrayPrototypePop(instances)}`;\n else\n msg += `an instance of ${instances[0]}` + (instances.length === 2 \? ` or ${instances[1]}` : \"\");\n if (other.length > 0)\n msg += \" or \";\n }\n if (other.length > 0)\n if (other.length > 2) {\n const last = ArrayPrototypePop(other);\n msg += `one of ${ArrayPrototypeJoin(other, \", \")}, or ${last}`;\n } else if (other.length === 2)\n msg += `one of ${other[0]} or ${other[1]}`;\n else {\n if (StringPrototypeToLowerCase(other[0]) !== other[0])\n msg += \"an \";\n msg += `${other[0]}`;\n }\n if (actual == null)\n msg += `. Received ${actual}`;\n else if (typeof actual === \"function\" && actual.name)\n msg += `. Received function ${actual.name}`;\n else if (typeof actual === \"object\")\n if (actual.constructor && actual.constructor.name)\n msg += `. Received an instance of ${actual.constructor.name}`;\n else\n msg += `. Received ${inspect(actual, { depth: -1 })}`;\n else {\n let inspected = inspect(actual, { colors: !1 });\n if (inspected.length > 25)\n inspected = `${StringPrototypeSlice(inspected, 0, 25)}...`;\n msg += `. Received type ${typeof actual} (${inspected})`;\n }\n return msg;\n }), codes[\"ERR_INVALID_ARG_TYPE\"] = function NodeError(...args) {\n const limit = Error.stackTraceLimit;\n Error.stackTraceLimit = 0;\n const error = @makeTypeError();\n Error.stackTraceLimit = limit;\n const msg = messages.get(\"ERR_INVALID_ARG_TYPE\");\n assert(typeof msg === \"function\"), assert(msg.length <= args.length, `Code: ERR_INVALID_ARG_TYPE; The provided arguments length (${args.length}) does not match the required ones (${msg.length}).`);\n const message = ReflectApply(msg, error, args);\n ObjectDefineProperty(error, \"message\", { value: message, enumerable: !1, writable: !0, configurable: !0 }), ObjectDefineProperty(error, \"toString\", {\n value() {\n return `${this.name} [ERR_INVALID_ARG_TYPE]: ${this.message}`;\n },\n enumerable: !1,\n writable: !0,\n configurable: !0\n });\n let err = error;\n const userStackTraceLimit = Error.stackTraceLimit;\n return Error.stackTraceLimit = @Infinity, ErrorCaptureStackTrace(err), Error.stackTraceLimit = userStackTraceLimit, err.name = `${TypeError.name} [ERR_INVALID_ARG_TYPE]`, err.stack, delete err.name, error.code = \"ERR_INVALID_ARG_TYPE\", error;\n };\n}\nvar validateObject = (value, name, allowArray = !1) => {\n if (value === null || !allowArray && ArrayIsArray(value) || typeof value !== \"object\" && typeof value !== \"function\")\n throw new codes.ERR_INVALID_ARG_TYPE(name, \"Object\", value);\n}, builtInObjects = new SafeSet(ArrayPrototypeFilter(ObjectGetOwnPropertyNames(globalThis), (e) => RegExpPrototypeExec(/^[A-Z][a-zA-Z0-9]+$/, e) !== null)), isUndetectableObject = (v) => typeof v === \"undefined\" && v !== @undefined, ERROR_STACK_OVERFLOW_MSG = \"Maximum call stack size exceeded.\", inspectDefaultOptions = ObjectSeal({\n showHidden: !1,\n depth: 2,\n colors: !1,\n customInspect: !0,\n showProxy: !1,\n maxArrayLength: 100,\n maxStringLength: 1e4,\n breakLength: 80,\n compact: 3,\n sorted: !1,\n getters: !1,\n numericSeparator: !1\n}), inspectReplDefaults = ObjectSeal({\n ...inspectDefaultOptions,\n colors: Bun.enableANSIColors,\n showProxy: !0\n}), kObjectType = 0, kArrayType = 1, kArrayExtrasType = 2, strEscapeSequencesRegExp, strEscapeSequencesReplacer, strEscapeSequencesRegExpSingle, strEscapeSequencesReplacerSingle, extractedSplitNewLines;\ntry {\n strEscapeSequencesRegExp = new RegExp(\"[\\\\x00-\\\\x1f\\\\x27\\\\x5c\\\\x7f-\\\\x9f]|[\\\\ud800-\\\\udbff](\?![\\\\udc00-\\\\udfff])|(\? RegExpPrototypeSymbolSplit(extractedNewLineRe, value);\n} catch {\n strEscapeSequencesRegExp = /[\\x00-\\x1f\\x27\\x5c\\x7f-\\x9f]/, strEscapeSequencesReplacer = /[\\x00-\\x1f\\x27\\x5c\\x7f-\\x9f]/g, strEscapeSequencesRegExpSingle = /[\\x00-\\x1f\\x5c\\x7f-\\x9f]/, strEscapeSequencesReplacerSingle = /[\\x00-\\x1f\\x5c\\x7f-\\x9f]/g, extractedSplitNewLines = (value) => {\n const lines = RegExpPrototypeSymbolSplit(/\\n/, value), last = ArrayPrototypePop(lines), nlLines = ArrayPrototypeMap(lines, (line) => line + \"\\n\");\n if (last !== \"\")\n nlLines.push(last);\n return nlLines;\n };\n}\nvar keyStrRegExp = /^[a-zA-Z_][a-zA-Z_0-9]*$/, numberRegExp = /^(0|[1-9][0-9]*)$/, coreModuleRegExp = /^ {4}at (\?:[^/\\\\(]+ \\(|)node:(.+):\\d+:\\d+\\)\?$/, nodeModulesRegExp = /[/\\\\]node_modules[/\\\\](.+\?)(\?=[/\\\\])/g, classRegExp = /^(\\s+[^(]*\?)\\s*{/, stripCommentsRegExp = /(\\/\\/.*\?\\n)|(\\/\\*(.|\\n)*\?\\*\\/)/g, kMinLineLength = 16, kWeak = 0, kIterator = 1, kMapEntries = 2, meta = [\n \"\\\\x00\",\n \"\\\\x01\",\n \"\\\\x02\",\n \"\\\\x03\",\n \"\\\\x04\",\n \"\\\\x05\",\n \"\\\\x06\",\n \"\\\\x07\",\n \"\\\\b\",\n \"\\\\t\",\n \"\\\\n\",\n \"\\\\x0B\",\n \"\\\\f\",\n \"\\\\r\",\n \"\\\\x0E\",\n \"\\\\x0F\",\n \"\\\\x10\",\n \"\\\\x11\",\n \"\\\\x12\",\n \"\\\\x13\",\n \"\\\\x14\",\n \"\\\\x15\",\n \"\\\\x16\",\n \"\\\\x17\",\n \"\\\\x18\",\n \"\\\\x19\",\n \"\\\\x1A\",\n \"\\\\x1B\",\n \"\\\\x1C\",\n \"\\\\x1D\",\n \"\\\\x1E\",\n \"\\\\x1F\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\\\\'\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\\\\\\\\\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\\\\x7F\",\n \"\\\\x80\",\n \"\\\\x81\",\n \"\\\\x82\",\n \"\\\\x83\",\n \"\\\\x84\",\n \"\\\\x85\",\n \"\\\\x86\",\n \"\\\\x87\",\n \"\\\\x88\",\n \"\\\\x89\",\n \"\\\\x8A\",\n \"\\\\x8B\",\n \"\\\\x8C\",\n \"\\\\x8D\",\n \"\\\\x8E\",\n \"\\\\x8F\",\n \"\\\\x90\",\n \"\\\\x91\",\n \"\\\\x92\",\n \"\\\\x93\",\n \"\\\\x94\",\n \"\\\\x95\",\n \"\\\\x96\",\n \"\\\\x97\",\n \"\\\\x98\",\n \"\\\\x99\",\n \"\\\\x9A\",\n \"\\\\x9B\",\n \"\\\\x9C\",\n \"\\\\x9D\",\n \"\\\\x9E\",\n \"\\\\x9F\"\n], getStringWidth;\ninspect.custom = customInspectSymbol;\nObjectDefineProperty(inspect, \"defaultOptions\", {\n __proto__: null,\n get() {\n return inspectDefaultOptions;\n },\n set(options) {\n return validateObject(options, \"options\"), ObjectAssign(inspectDefaultOptions, options);\n }\n});\nObjectDefineProperty(inspect, \"replDefaults\", {\n __proto__: null,\n get() {\n return inspectReplDefaults;\n },\n set(options) {\n return validateObject(options, \"options\"), ObjectAssign(inspectReplDefaults, options);\n }\n});\nvar defaultFG = 39, defaultBG = 49;\ninspect.colors = {\n __proto__: null,\n reset: [0, 0],\n bold: [1, 22],\n dim: [2, 22],\n italic: [3, 23],\n underline: [4, 24],\n blink: [5, 25],\n inverse: [7, 27],\n hidden: [8, 28],\n strikethrough: [9, 29],\n doubleunderline: [21, 24],\n black: [30, defaultFG],\n red: [31, defaultFG],\n green: [32, defaultFG],\n yellow: [33, defaultFG],\n blue: [34, defaultFG],\n magenta: [35, defaultFG],\n cyan: [36, defaultFG],\n white: [37, defaultFG],\n bgBlack: [40, defaultBG],\n bgRed: [41, defaultBG],\n bgGreen: [42, defaultBG],\n bgYellow: [43, defaultBG],\n bgBlue: [44, defaultBG],\n bgMagenta: [45, defaultBG],\n bgCyan: [46, defaultBG],\n bgWhite: [47, defaultBG],\n framed: [51, 54],\n overlined: [53, 55],\n gray: [90, defaultFG],\n redBright: [91, defaultFG],\n greenBright: [92, defaultFG],\n yellowBright: [93, defaultFG],\n blueBright: [94, defaultFG],\n magentaBright: [95, defaultFG],\n cyanBright: [96, defaultFG],\n whiteBright: [97, defaultFG],\n bgGray: [100, defaultBG],\n bgRedBright: [101, defaultBG],\n bgGreenBright: [102, defaultBG],\n bgYellowBright: [103, defaultBG],\n bgBlueBright: [104, defaultBG],\n bgMagentaBright: [105, defaultBG],\n bgCyanBright: [106, defaultBG],\n bgWhiteBright: [107, defaultBG]\n};\ndefineColorAlias(\"gray\", \"grey\");\ndefineColorAlias(\"gray\", \"blackBright\");\ndefineColorAlias(\"bgGray\", \"bgGrey\");\ndefineColorAlias(\"bgGray\", \"bgBlackBright\");\ndefineColorAlias(\"dim\", \"faint\");\ndefineColorAlias(\"strikethrough\", \"crossedout\");\ndefineColorAlias(\"strikethrough\", \"strikeThrough\");\ndefineColorAlias(\"strikethrough\", \"crossedOut\");\ndefineColorAlias(\"hidden\", \"conceal\");\ndefineColorAlias(\"inverse\", \"swapColors\");\ndefineColorAlias(\"inverse\", \"swapcolors\");\ndefineColorAlias(\"doubleunderline\", \"doubleUnderline\");\ninspect.styles = {\n __proto__: null,\n special: \"cyan\",\n number: \"yellow\",\n bigint: \"yellow\",\n boolean: \"yellow\",\n undefined: \"grey\",\n null: \"bold\",\n string: \"green\",\n symbol: \"green\",\n date: \"magenta\",\n regexp: \"red\",\n module: \"underline\"\n};\nvar remainingText = (remaining) => `... ${remaining} more item${remaining > 1 \? \"s\" : \"\"}`, firstErrorLine = (error) => StringPrototypeSplit(error.message, \"\\n\", 1)[0], CIRCULAR_ERROR_MESSAGE;\n{\n getStringWidth = function getStringWidth(str, removeControlChars = !0) {\n let width = 0;\n if (removeControlChars)\n str = stripVTControlCharacters(str);\n str = StringPrototypeNormalize(str, \"NFC\");\n for (let char of new SafeStringIterator(str)) {\n const code = StringPrototypeCodePointAt(char, 0);\n if (isFullWidthCodePoint(code))\n width += 2;\n else if (!isZeroWidthCodePoint(code))\n width++;\n }\n return width;\n };\n const isFullWidthCodePoint = (code) => {\n return code >= 4352 && (code <= 4447 || code === 9001 || code === 9002 || code >= 11904 && code <= 12871 && code !== 12351 || code >= 12880 && code <= 19903 || code >= 19968 && code <= 42182 || code >= 43360 && code <= 43388 || code >= 44032 && code <= 55203 || code >= 63744 && code <= 64255 || code >= 65040 && code <= 65049 || code >= 65072 && code <= 65131 || code >= 65281 && code <= 65376 || code >= 65504 && code <= 65510 || code >= 110592 && code <= 110593 || code >= 127488 && code <= 127569 || code >= 127744 && code <= 128591 || code >= 131072 && code <= 262141);\n };\n}\nvar ansiPattern = \"[\\\\u001B\\\\u009B][[\\\\]()#;\?]*(\?:(\?:(\?:(\?:;[-a-zA-Z\\\\d\\\\/#&.:=\?%@~_]+)*|[a-zA-Z\\\\d]+(\?:;[-a-zA-Z\\\\d\\\\/#&.:=\?%@~_]*)*)\?\\\\u0007)|(\?:(\?:\\\\d{1,4}(\?:;\\\\d{0,4})*)\?[\\\\dA-PR-TZcf-ntqry=><~]))\", ansi = new RegExp(ansiPattern, \"g\");\n$ = {\n inspect,\n format,\n formatWithOptions,\n stripVTControlCharacters\n};\n//! non-standard properties, should these be kept\? (not currently exposed)\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeAssertCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/assert.ts\nvar CallTracker = function() {\n throw new Error(\"CallTracker is not supported yet\");\n}, util = @getInternalField(@internalModuleRegistry, 48) || @createInternalModuleById(48), isDeepEqual = Bun.deepEquals, __commonJS = (cb, mod) => function() {\n return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n}, require_errors = __commonJS({\n \"assert/build/internal/errors.js\"(exports, module2) {\n function _typeof(obj) {\n return typeof Symbol == \"function\" && typeof Symbol.iterator == \"symbol\" \? _typeof = function(obj2) {\n return typeof obj2;\n } : _typeof = function(obj2) {\n return obj2 && typeof Symbol == \"function\" && obj2.constructor === Symbol && obj2 !== Symbol.prototype \? \"symbol\" : typeof obj2;\n }, _typeof(obj);\n }\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor))\n @throwTypeError(\"Cannot call a class as a function\");\n }\n function _possibleConstructorReturn(self, call) {\n return call && (_typeof(call) === \"object\" || typeof call == \"function\") \? call : _assertThisInitialized(self);\n }\n function _assertThisInitialized(self) {\n if (self === void 0)\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n return self;\n }\n function _getPrototypeOf(o) {\n return _getPrototypeOf = Object.setPrototypeOf \? Object.getPrototypeOf : function(o2) {\n return o2.__proto__ || Object.getPrototypeOf(o2);\n }, _getPrototypeOf(o);\n }\n function _inherits(subClass, superClass) {\n if (typeof superClass != \"function\" && superClass !== null)\n @throwTypeError(\"Super expression must either be null or a function\");\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: { value: subClass, writable: !0, configurable: !0 }\n }), superClass && _setPrototypeOf(subClass, superClass);\n }\n function _setPrototypeOf(o, p) {\n return _setPrototypeOf = Object.setPrototypeOf || function(o2, p2) {\n return o2.__proto__ = p2, o2;\n }, _setPrototypeOf(o, p);\n }\n var codes = {}, assert, util2;\n function createErrorType(code, message, Base) {\n Base || (Base = Error);\n function getMessage(arg1, arg2, arg3) {\n return typeof message == \"string\" \? message : message(arg1, arg2, arg3);\n }\n var NodeError = function(_Base) {\n _inherits(NodeError2, _Base);\n function NodeError2(arg1, arg2, arg3) {\n var _this;\n return _classCallCheck(this, NodeError2), _this = _possibleConstructorReturn(this, _getPrototypeOf(NodeError2).@call(this, getMessage(arg1, arg2, arg3))), _this.code = code, _this;\n }\n return NodeError2;\n }(Base);\n codes[code] = NodeError;\n }\n function oneOf(expected, thing) {\n if (@Array.isArray(expected)) {\n var len = expected.length;\n return expected = expected.map(function(i) {\n return @String(i);\n }), len > 2 \? \"one of \".concat(thing, \" \").concat(expected.slice(0, len - 1).join(\", \"), \", or \") + expected[len - 1] : len === 2 \? \"one of \".concat(thing, \" \").concat(expected[0], \" or \").concat(expected[1]) : \"of \".concat(thing, \" \").concat(expected[0]);\n } else\n return \"of \".concat(thing, \" \").concat(@String(expected));\n }\n function startsWith(str, search, pos) {\n return str.substr(!pos || pos < 0 \? 0 : +pos, search.length) === search;\n }\n function endsWith(str, search, this_len) {\n return (this_len === void 0 || this_len > str.length) && (this_len = str.length), str.substring(this_len - search.length, this_len) === search;\n }\n function includes(str, search, start) {\n return typeof start != \"number\" && (start = 0), start + search.length > str.length \? !1 : str.indexOf(search, start) !== -1;\n }\n createErrorType(\"ERR_AMBIGUOUS_ARGUMENT\", 'The \"%s\" argument is ambiguous. %s', TypeError), createErrorType(\"ERR_INVALID_ARG_TYPE\", function(name, expected, actual) {\n assert === void 0 && (assert = require_assert()), assert(typeof name == \"string\", \"'name' must be a string\");\n var determiner;\n typeof expected == \"string\" && startsWith(expected, \"not \") \? (determiner = \"must not be\", expected = expected.replace(/^not /, \"\")) : determiner = \"must be\";\n var msg;\n if (endsWith(name, \" argument\"))\n msg = \"The \".concat(name, \" \").concat(determiner, \" \").concat(oneOf(expected, \"type\"));\n else {\n var type = includes(name, \".\") \? \"property\" : \"argument\";\n msg = 'The \"'.concat(name, '\" ').concat(type, \" \").concat(determiner, \" \").concat(oneOf(expected, \"type\"));\n }\n return msg += \". Received type \".concat(_typeof(actual)), msg;\n }, TypeError), createErrorType(\"ERR_INVALID_ARG_VALUE\", function(name, value) {\n var reason = arguments.length > 2 && arguments[2] !== void 0 \? arguments[2] : \"is invalid\", inspected = util2.inspect(value);\n return inspected.length > 128 && (inspected = \"\".concat(inspected.slice(0, 128), \"...\")), \"The argument '\".concat(name, \"' \").concat(reason, \". Received \").concat(inspected);\n }, TypeError, RangeError), createErrorType(\"ERR_INVALID_RETURN_VALUE\", function(input, name, value) {\n var type;\n return value && value.constructor && value.constructor.name \? type = \"instance of \".concat(value.constructor.name) : type = \"type \".concat(_typeof(value)), \"Expected \".concat(input, ' to be returned from the \"').concat(name, '\"') + \" function but got \".concat(type, \".\");\n }, TypeError), createErrorType(\"ERR_MISSING_ARGS\", function() {\n for (var _len = arguments.length, args = new @Array(_len), _key = 0;_key < _len; _key++)\n args[_key] = arguments[_key];\n assert === void 0 && (assert = require_assert()), assert(args.length > 0, \"At least one arg needs to be specified\");\n var msg = \"The \", len = args.length;\n switch (args = args.map(function(a) {\n return '\"'.concat(a, '\"');\n }), len) {\n case 1:\n msg += \"\".concat(args[0], \" argument\");\n break;\n case 2:\n msg += \"\".concat(args[0], \" and \").concat(args[1], \" arguments\");\n break;\n default:\n msg += args.slice(0, len - 1).join(\", \"), msg += \", and \".concat(args[len - 1], \" arguments\");\n break;\n }\n return \"\".concat(msg, \" must be specified\");\n }, TypeError), module2.exports.codes = codes;\n }\n}), require_assertion_error = __commonJS({\n \"assert/build/internal/assert/assertion_error.js\"(exports, module2) {\n function _objectSpread(target) {\n for (var i = 1;i < arguments.length; i++) {\n var source = arguments[i] != null \? arguments[i] : {}, ownKeys = Object.keys(source);\n typeof Object.getOwnPropertySymbols == \"function\" && (ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }))), ownKeys.forEach(function(key) {\n _defineProperty(target, key, source[key]);\n });\n }\n return target;\n }\n function _defineProperty(obj, key, value) {\n return (key in obj) \? Object.defineProperty(obj, key, {\n value,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : obj[key] = value, obj;\n }\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor))\n @throwTypeError(\"Cannot call a class as a function\");\n }\n function _defineProperties(target, props) {\n for (var i = 0;i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, (\"value\" in descriptor) && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n function _createClass(Constructor, protoProps, staticProps) {\n return protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), Constructor;\n }\n function _possibleConstructorReturn(self, call) {\n return call && (_typeof(call) === \"object\" || typeof call == \"function\") \? call : _assertThisInitialized(self);\n }\n function _assertThisInitialized(self) {\n if (self === void 0)\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n return self;\n }\n function _inherits(subClass, superClass) {\n if (typeof superClass != \"function\" && superClass !== null)\n @throwTypeError(\"Super expression must either be null or a function\");\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: { value: subClass, writable: !0, configurable: !0 }\n }), superClass && _setPrototypeOf(subClass, superClass);\n }\n function _wrapNativeSuper(Class) {\n var _cache = typeof Map == \"function\" \? new Map : void 0;\n return _wrapNativeSuper = function(Class2) {\n if (Class2 === null || !_isNativeFunction(Class2))\n return Class2;\n if (typeof Class2 != \"function\")\n @throwTypeError(\"Super expression must either be null or a function\");\n if (typeof _cache != \"undefined\") {\n if (_cache.has(Class2))\n return _cache.get(Class2);\n _cache.set(Class2, Wrapper);\n }\n function Wrapper() {\n return _construct(Class2, arguments, _getPrototypeOf(this).constructor);\n }\n return Wrapper.prototype = Object.create(Class2.prototype, {\n constructor: {\n value: Wrapper,\n enumerable: !1,\n writable: !0,\n configurable: !0\n }\n }), _setPrototypeOf(Wrapper, Class2);\n }, _wrapNativeSuper(Class);\n }\n function isNativeReflectConstruct() {\n if (typeof Reflect == \"undefined\" || !Reflect.construct || Reflect.construct.sham)\n return !1;\n if (typeof Proxy == \"function\")\n return !0;\n try {\n return Date.prototype.toString.@call(Reflect.construct(Date, [], function() {\n })), !0;\n } catch {\n return !1;\n }\n }\n function _construct(Parent, args, Class) {\n return isNativeReflectConstruct() \? _construct = Reflect.construct : _construct = function(Parent2, args2, Class2) {\n var a = [null];\n a.push.@apply(a, args2);\n var Constructor = Function.bind.@apply(Parent2, a), instance = new Constructor;\n return Class2 && _setPrototypeOf(instance, Class2.prototype), instance;\n }, _construct.@apply(null, arguments);\n }\n function _isNativeFunction(fn) {\n return Function.toString.@call(fn).indexOf(\"[native code]\") !== -1;\n }\n function _setPrototypeOf(o, p) {\n return _setPrototypeOf = Object.setPrototypeOf || function(o2, p2) {\n return o2.__proto__ = p2, o2;\n }, _setPrototypeOf(o, p);\n }\n function _getPrototypeOf(o) {\n return _getPrototypeOf = Object.setPrototypeOf \? Object.getPrototypeOf : function(o2) {\n return o2.__proto__ || Object.getPrototypeOf(o2);\n }, _getPrototypeOf(o);\n }\n function _typeof(obj) {\n return typeof Symbol == \"function\" && typeof Symbol.iterator == \"symbol\" \? _typeof = function(obj2) {\n return typeof obj2;\n } : _typeof = function(obj2) {\n return obj2 && typeof Symbol == \"function\" && obj2.constructor === Symbol && obj2 !== Symbol.prototype \? \"symbol\" : typeof obj2;\n }, _typeof(obj);\n }\n var inspect = util.inspect, _require2 = require_errors(), ERR_INVALID_ARG_TYPE = _require2.codes.ERR_INVALID_ARG_TYPE;\n function endsWith(str, search, this_len) {\n return (this_len === void 0 || this_len > str.length) && (this_len = str.length), str.substring(this_len - search.length, this_len) === search;\n }\n function repeat(str, count) {\n if (count = Math.floor(count), str.length == 0 || count == 0)\n return \"\";\n var maxCount = str.length * count;\n for (count = Math.floor(Math.log(count) / Math.log(2));count; )\n str += str, count--;\n return str += str.substring(0, maxCount - str.length), str;\n }\n var blue = \"\", green = \"\", red = \"\", white = \"\", kReadableOperator = {\n deepStrictEqual: \"Expected values to be strictly deep-equal:\",\n strictEqual: \"Expected values to be strictly equal:\",\n strictEqualObject: 'Expected \"actual\" to be reference-equal to \"expected\":',\n deepEqual: \"Expected values to be loosely deep-equal:\",\n equal: \"Expected values to be loosely equal:\",\n notDeepStrictEqual: 'Expected \"actual\" not to be strictly deep-equal to:',\n notStrictEqual: 'Expected \"actual\" to be strictly unequal to:',\n notStrictEqualObject: 'Expected \"actual\" not to be reference-equal to \"expected\":',\n notDeepEqual: 'Expected \"actual\" not to be loosely deep-equal to:',\n notEqual: 'Expected \"actual\" to be loosely unequal to:',\n notIdentical: \"Values identical but not reference-equal:\"\n }, kMaxShortLength = 10;\n function copyError(source) {\n var keys = Object.keys(source), target = Object.create(Object.getPrototypeOf(source));\n return keys.forEach(function(key) {\n target[key] = source[key];\n }), Object.defineProperty(target, \"message\", {\n value: source.message\n }), target;\n }\n function inspectValue(val) {\n return inspect(val, {\n compact: !1,\n customInspect: !1,\n depth: 1000,\n maxArrayLength: Infinity,\n showHidden: !1,\n breakLength: Infinity,\n showProxy: !1,\n sorted: !0,\n getters: !0\n });\n }\n function createErrDiff(actual, expected, operator) {\n var other = \"\", res = \"\", lastPos = 0, end = \"\", skipped = !1, actualInspected = inspectValue(actual), actualLines = actualInspected.split(`\n`), expectedLines = inspectValue(expected).split(`\n`), i = 0, indicator = \"\";\n if (operator === \"strictEqual\" && _typeof(actual) === \"object\" && _typeof(expected) === \"object\" && actual !== null && expected !== null && (operator = \"strictEqualObject\"), actualLines.length === 1 && expectedLines.length === 1 && actualLines[0] !== expectedLines[0]) {\n var inputLength = actualLines[0].length + expectedLines[0].length;\n if (inputLength <= kMaxShortLength) {\n if ((_typeof(actual) !== \"object\" || actual === null) && (_typeof(expected) !== \"object\" || expected === null) && (actual !== 0 || expected !== 0))\n return \"\".concat(kReadableOperator[operator], `\n\n`) + \"\".concat(actualLines[0], \" !== \").concat(expectedLines[0], `\n`);\n } else if (operator !== \"strictEqualObject\") {\n var maxLength = process.stderr && process.stderr.isTTY \? process.stderr.columns : 80;\n if (inputLength < maxLength) {\n for (;actualLines[0][i] === expectedLines[0][i]; )\n i++;\n i > 2 && (indicator = `\n `.concat(repeat(\" \", i), \"^\"), i = 0);\n }\n }\n }\n for (var a = actualLines[actualLines.length - 1], b = expectedLines[expectedLines.length - 1];a === b && (i++ < 2 \? end = `\n `.concat(a).concat(end) : other = a, actualLines.pop(), expectedLines.pop(), !(actualLines.length === 0 || expectedLines.length === 0)); )\n a = actualLines[actualLines.length - 1], b = expectedLines[expectedLines.length - 1];\n var maxLines = Math.max(actualLines.length, expectedLines.length);\n if (maxLines === 0) {\n var _actualLines = actualInspected.split(`\n`);\n if (_actualLines.length > 30)\n for (_actualLines[26] = \"\".concat(blue, \"...\").concat(white);_actualLines.length > 27; )\n _actualLines.pop();\n return \"\".concat(kReadableOperator.notIdentical, `\n\n`).concat(_actualLines.join(`\n`), `\n`);\n }\n i > 3 && (end = `\n`.concat(blue, \"...\").concat(white).concat(end), skipped = !0), other !== \"\" && (end = `\n `.concat(other).concat(end), other = \"\");\n var printedLines = 0, msg = kReadableOperator[operator] + `\n`.concat(green, \"+ actual\").concat(white, \" \").concat(red, \"- expected\").concat(white), skippedMsg = \" \".concat(blue, \"...\").concat(white, \" Lines skipped\");\n for (i = 0;i < maxLines; i++) {\n var cur = i - lastPos;\n if (actualLines.length < i + 1)\n cur > 1 && i > 2 && (cur > 4 \? (res += `\n`.concat(blue, \"...\").concat(white), skipped = !0) : cur > 3 && (res += `\n `.concat(expectedLines[i - 2]), printedLines++), res += `\n `.concat(expectedLines[i - 1]), printedLines++), lastPos = i, other += `\n`.concat(red, \"-\").concat(white, \" \").concat(expectedLines[i]), printedLines++;\n else if (expectedLines.length < i + 1)\n cur > 1 && i > 2 && (cur > 4 \? (res += `\n`.concat(blue, \"...\").concat(white), skipped = !0) : cur > 3 && (res += `\n `.concat(actualLines[i - 2]), printedLines++), res += `\n `.concat(actualLines[i - 1]), printedLines++), lastPos = i, res += `\n`.concat(green, \"+\").concat(white, \" \").concat(actualLines[i]), printedLines++;\n else {\n var expectedLine = expectedLines[i], actualLine = actualLines[i], divergingLines = actualLine !== expectedLine && (!endsWith(actualLine, \",\") || actualLine.slice(0, -1) !== expectedLine);\n divergingLines && endsWith(expectedLine, \",\") && expectedLine.slice(0, -1) === actualLine && (divergingLines = !1, actualLine += \",\"), divergingLines \? (cur > 1 && i > 2 && (cur > 4 \? (res += `\n`.concat(blue, \"...\").concat(white), skipped = !0) : cur > 3 && (res += `\n `.concat(actualLines[i - 2]), printedLines++), res += `\n `.concat(actualLines[i - 1]), printedLines++), lastPos = i, res += `\n`.concat(green, \"+\").concat(white, \" \").concat(actualLine), other += `\n`.concat(red, \"-\").concat(white, \" \").concat(expectedLine), printedLines += 2) : (res += other, other = \"\", (cur === 1 || i === 0) && (res += `\n `.concat(actualLine), printedLines++));\n }\n if (printedLines > 20 && i < maxLines - 2)\n return \"\".concat(msg).concat(skippedMsg, `\n`).concat(res, `\n`).concat(blue, \"...\").concat(white).concat(other, `\n`) + \"\".concat(blue, \"...\").concat(white);\n }\n return \"\".concat(msg).concat(skipped \? skippedMsg : \"\", `\n`).concat(res).concat(other).concat(end).concat(indicator);\n }\n var AssertionError = function(_Error) {\n function AssertionError2(options) {\n var _this;\n if (_classCallCheck(this, AssertionError2), _typeof(options) !== \"object\" || options === null)\n throw new ERR_INVALID_ARG_TYPE(\"options\", \"Object\", options);\n var { message, operator, stackStartFn, actual, expected } = options, limit = Error.stackTraceLimit;\n if (Error.stackTraceLimit = 0, message != null)\n _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).@call(this, @String(message)));\n else if (process.stderr && process.stderr.isTTY && (process.stderr && process.stderr.getColorDepth && process.stderr.getColorDepth() !== 1 \? (blue = \"\", green = \"\", white = \"\", red = \"\") : (blue = \"\", green = \"\", white = \"\", red = \"\")), _typeof(actual) === \"object\" && actual !== null && _typeof(expected) === \"object\" && expected !== null && (\"stack\" in actual) && actual instanceof Error && (\"stack\" in expected) && expected instanceof Error && (actual = copyError(actual), expected = copyError(expected)), operator === \"deepStrictEqual\" || operator === \"strictEqual\")\n _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).@call(this, createErrDiff(actual, expected, operator)));\n else if (operator === \"notDeepStrictEqual\" || operator === \"notStrictEqual\") {\n var base = kReadableOperator[operator], res = inspectValue(actual).split(`\n`);\n if (operator === \"notStrictEqual\" && _typeof(actual) === \"object\" && actual !== null && (base = kReadableOperator.notStrictEqualObject), res.length > 30)\n for (res[26] = \"\".concat(blue, \"...\").concat(white);res.length > 27; )\n res.pop();\n res.length === 1 \? _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).@call(this, \"\".concat(base, \" \").concat(res[0]))) : _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).@call(this, \"\".concat(base, `\n\n`).concat(res.join(`\n`), `\n`)));\n } else {\n var _res = inspectValue(actual), other = \"\", knownOperators = kReadableOperator[operator];\n operator === \"notDeepEqual\" || operator === \"notEqual\" \? (_res = \"\".concat(kReadableOperator[operator], `\n\n`).concat(_res), _res.length > 1024 && (_res = \"\".concat(_res.slice(0, 1021), \"...\"))) : (other = \"\".concat(inspectValue(expected)), _res.length > 512 && (_res = \"\".concat(_res.slice(0, 509), \"...\")), other.length > 512 && (other = \"\".concat(other.slice(0, 509), \"...\")), operator === \"deepEqual\" || operator === \"equal\" \? _res = \"\".concat(knownOperators, `\n\n`).concat(_res, `\n\nshould equal\n\n`) : other = \" \".concat(operator, \" \").concat(other)), _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).@call(this, \"\".concat(_res).concat(other)));\n }\n return Error.stackTraceLimit = limit, _this.generatedMessage = !message, Object.defineProperty(_assertThisInitialized(_this), \"name\", {\n value: \"AssertionError [ERR_ASSERTION]\",\n enumerable: !1,\n writable: !0,\n configurable: !0\n }), _this.code = \"ERR_ASSERTION\", _this.actual = actual, _this.expected = expected, _this.operator = operator, Error.captureStackTrace && Error.captureStackTrace(_assertThisInitialized(_this), stackStartFn), _this.stack, _this.name = \"AssertionError\", _possibleConstructorReturn(_this);\n }\n return AssertionError2.prototype = {}, _inherits(AssertionError2, _Error), _createClass(AssertionError2, [\n {\n key: \"toString\",\n value: function() {\n return \"\".concat(this.name, \" [\").concat(this.code, \"]: \").concat(this.message);\n }\n },\n {\n key: inspect.custom,\n value: function(recurseTimes, ctx) {\n return inspect(this, _objectSpread({}, ctx, {\n customInspect: !1,\n depth: 0\n }));\n }\n }\n ]), AssertionError2;\n }(_wrapNativeSuper(Error));\n module2.exports = AssertionError;\n }\n}), require_assert = __commonJS({\n \"assert/build/assert.js\"(exports, module2) {\n function _typeof(obj) {\n return typeof Symbol == \"function\" && typeof Symbol.iterator == \"symbol\" \? _typeof = function(obj2) {\n return typeof obj2;\n } : _typeof = function(obj2) {\n return obj2 && typeof Symbol == \"function\" && obj2.constructor === Symbol && obj2 !== Symbol.prototype \? \"symbol\" : typeof obj2;\n }, _typeof(obj);\n }\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor))\n @throwTypeError(\"Cannot call a class as a function\");\n }\n var _require = require_errors(), _require$codes = _require.codes, ERR_AMBIGUOUS_ARGUMENT = _require$codes.ERR_AMBIGUOUS_ARGUMENT, ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_VALUE = _require$codes.ERR_INVALID_ARG_VALUE, ERR_INVALID_RETURN_VALUE = _require$codes.ERR_INVALID_RETURN_VALUE, ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, AssertionError = require_assertion_error(), _require2 = util, inspect = _require2.inspect, _require$types = util.types, isPromise = _require$types.isPromise, isRegExp = _require$types.isRegExp, objectAssign = Object.assign, objectIs = Object.is, errorCache = new Map, warned = !1, assert = module2.exports = ok, NO_EXCEPTION_SENTINEL = {};\n function innerFail(obj) {\n throw obj.message instanceof Error \? obj.message : new AssertionError(obj);\n }\n function fail(actual, expected, message, operator, stackStartFn) {\n var argsLen = arguments.length, internalMessage;\n if (argsLen === 0)\n internalMessage = \"Failed\";\n else if (argsLen === 1)\n message = actual, actual = void 0;\n else {\n if (warned === !1) {\n warned = !0;\n var warn = process.emitWarning \? process.emitWarning : console.warn.bind(console);\n warn(\"assert.fail() with more than one argument is deprecated. Please use assert.strictEqual() instead or only pass a message.\", \"DeprecationWarning\", \"DEP0094\");\n }\n argsLen === 2 && (operator = \"!=\");\n }\n if (message instanceof Error)\n throw message;\n var errArgs = {\n actual,\n expected,\n operator: operator === void 0 \? \"fail\" : operator,\n stackStartFn: stackStartFn || fail\n };\n message !== void 0 && (errArgs.message = message);\n var err = new AssertionError(errArgs);\n throw internalMessage && (err.message = internalMessage, err.generatedMessage = !0), err;\n }\n assert.fail = fail, assert.AssertionError = AssertionError;\n function innerOk(fn, argLen, value, message) {\n if (!value) {\n var generatedMessage = !1;\n if (argLen === 0)\n generatedMessage = !0, message = \"No value argument passed to `assert.ok()`\";\n else if (message instanceof Error)\n throw message;\n var err = new AssertionError({\n actual: value,\n expected: !0,\n message,\n operator: \"==\",\n stackStartFn: fn\n });\n throw err.generatedMessage = generatedMessage, err;\n }\n }\n function ok() {\n for (var _len = arguments.length, args = new @Array(_len), _key = 0;_key < _len; _key++)\n args[_key] = arguments[_key];\n innerOk.@apply(void 0, [ok, args.length].concat(args));\n }\n assert.ok = ok, assert.equal = function equal(actual, expected, message) {\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n actual != expected && innerFail({\n actual,\n expected,\n message,\n operator: \"==\",\n stackStartFn: equal\n });\n }, assert.notEqual = function notEqual(actual, expected, message) {\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n actual == expected && innerFail({\n actual,\n expected,\n message,\n operator: \"!=\",\n stackStartFn: notEqual\n });\n }, assert.deepEqual = function deepEqual(actual, expected, message) {\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n isDeepEqual(actual, expected, !1) || innerFail({\n actual,\n expected,\n message,\n operator: \"deepEqual\",\n stackStartFn: deepEqual\n });\n }, assert.notDeepEqual = function notDeepEqual(actual, expected, message) {\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n isDeepEqual(actual, expected, !1) && innerFail({\n actual,\n expected,\n message,\n operator: \"notDeepEqual\",\n stackStartFn: notDeepEqual\n });\n }, assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n isDeepEqual(actual, expected, !0) || innerFail({\n actual,\n expected,\n message,\n operator: \"deepStrictEqual\",\n stackStartFn: deepStrictEqual\n });\n }, assert.notDeepStrictEqual = notDeepStrictEqual;\n function notDeepStrictEqual(actual, expected, message) {\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n isDeepEqual(actual, expected, !0) && innerFail({\n actual,\n expected,\n message,\n operator: \"notDeepStrictEqual\",\n stackStartFn: notDeepStrictEqual\n });\n }\n assert.strictEqual = function strictEqual(actual, expected, message) {\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n objectIs(actual, expected) || innerFail({\n actual,\n expected,\n message,\n operator: \"strictEqual\",\n stackStartFn: strictEqual\n });\n }, assert.notStrictEqual = function notStrictEqual(actual, expected, message) {\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n objectIs(actual, expected) && innerFail({\n actual,\n expected,\n message,\n operator: \"notStrictEqual\",\n stackStartFn: notStrictEqual\n });\n }, assert.match = function match(actual, expected, message) {\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n if (!isRegExp(expected))\n throw new ERR_INVALID_ARG_TYPE(\"expected\", \"RegExp\", expected);\n expected.test(actual) || innerFail({\n actual,\n expected,\n message,\n operator: \"match\",\n stackStartFn: match\n });\n };\n var Comparison = function Comparison2(obj, keys, actual) {\n var _this = this;\n _classCallCheck(this, Comparison2), keys.forEach(function(key) {\n (key in obj) && (actual !== void 0 && typeof actual[key] == \"string\" && isRegExp(obj[key]) && obj[key].test(actual[key]) \? _this[key] = actual[key] : _this[key] = obj[key]);\n });\n };\n function compareExceptionKey(actual, expected, key, message, keys, fn) {\n if (!(key in actual) || !isDeepEqual(actual[key], expected[key], !0)) {\n if (!message) {\n var a = new Comparison(actual, keys), b = new Comparison(expected, keys, actual), err = new AssertionError({\n actual: a,\n expected: b,\n operator: \"deepStrictEqual\",\n stackStartFn: fn\n });\n throw err.actual = actual, err.expected = expected, err.operator = fn.name, err;\n }\n innerFail({\n actual,\n expected,\n message,\n operator: fn.name,\n stackStartFn: fn\n });\n }\n }\n function expectedException(actual, expected, msg, fn) {\n if (typeof expected != \"function\") {\n if (isRegExp(expected))\n return expected.test(actual);\n if (arguments.length === 2)\n throw new ERR_INVALID_ARG_TYPE(\"expected\", [\"Function\", \"RegExp\"], expected);\n if (_typeof(actual) !== \"object\" || actual === null) {\n var err = new AssertionError({\n actual,\n expected,\n message: msg,\n operator: \"deepStrictEqual\",\n stackStartFn: fn\n });\n throw err.operator = fn.name, err;\n }\n var keys = Object.keys(expected);\n if (expected instanceof Error)\n keys.push(\"name\", \"message\");\n else if (keys.length === 0)\n throw new ERR_INVALID_ARG_VALUE(\"error\", expected, \"may not be an empty object\");\n return keys.forEach(function(key) {\n return typeof actual[key] == \"string\" && isRegExp(expected[key]) && expected[key].test(actual[key]) || compareExceptionKey(actual, expected, key, msg, keys, fn);\n }), !0;\n }\n return expected.prototype !== void 0 && actual instanceof expected \? !0 : Error.isPrototypeOf(expected) \? !1 : expected.@call({}, actual) === !0;\n }\n function getActual(fn) {\n if (typeof fn != \"function\")\n throw new ERR_INVALID_ARG_TYPE(\"fn\", \"Function\", fn);\n try {\n fn();\n } catch (e) {\n return e;\n }\n return NO_EXCEPTION_SENTINEL;\n }\n function checkIsPromise(obj) {\n return isPromise(obj) || obj !== null && _typeof(obj) === \"object\" && typeof obj.then == \"function\" && typeof obj.catch == \"function\";\n }\n function waitForActual(promiseFn) {\n return @Promise.resolve().then(function() {\n var resultPromise;\n if (typeof promiseFn == \"function\") {\n if (resultPromise = promiseFn(), !checkIsPromise(resultPromise))\n throw new ERR_INVALID_RETURN_VALUE(\"instance of Promise\", \"promiseFn\", resultPromise);\n } else if (checkIsPromise(promiseFn))\n resultPromise = promiseFn;\n else\n throw new ERR_INVALID_ARG_TYPE(\"promiseFn\", [\"Function\", \"Promise\"], promiseFn);\n return @Promise.resolve().then(function() {\n return resultPromise;\n }).then(function() {\n return NO_EXCEPTION_SENTINEL;\n }).catch(function(e) {\n return e;\n });\n });\n }\n function expectsError(stackStartFn, actual, error, message) {\n if (typeof error == \"string\") {\n if (arguments.length === 4)\n throw new ERR_INVALID_ARG_TYPE(\"error\", [\"Object\", \"Error\", \"Function\", \"RegExp\"], error);\n if (_typeof(actual) === \"object\" && actual !== null) {\n if (actual.message === error)\n throw new ERR_AMBIGUOUS_ARGUMENT(\"error/message\", 'The error message \"'.concat(actual.message, '\" is identical to the message.'));\n } else if (actual === error)\n throw new ERR_AMBIGUOUS_ARGUMENT(\"error/message\", 'The error \"'.concat(actual, '\" is identical to the message.'));\n message = error, error = void 0;\n } else if (error != null && _typeof(error) !== \"object\" && typeof error != \"function\")\n throw new ERR_INVALID_ARG_TYPE(\"error\", [\"Object\", \"Error\", \"Function\", \"RegExp\"], error);\n if (actual === NO_EXCEPTION_SENTINEL) {\n var details = \"\";\n error && error.name && (details += \" (\".concat(error.name, \")\")), details += message \? \": \".concat(message) : \".\";\n var fnType = stackStartFn.name === \"rejects\" \? \"rejection\" : \"exception\";\n innerFail({\n actual: void 0,\n expected: error,\n operator: stackStartFn.name,\n message: \"Missing expected \".concat(fnType).concat(details),\n stackStartFn\n });\n }\n if (error && !expectedException(actual, error, message, stackStartFn))\n throw actual;\n }\n function expectsNoError(stackStartFn, actual, error, message) {\n if (actual !== NO_EXCEPTION_SENTINEL) {\n if (typeof error == \"string\" && (message = error, error = void 0), !error || expectedException(actual, error)) {\n var details = message \? \": \".concat(message) : \".\", fnType = stackStartFn.name === \"doesNotReject\" \? \"rejection\" : \"exception\";\n innerFail({\n actual,\n expected: error,\n operator: stackStartFn.name,\n message: \"Got unwanted \".concat(fnType).concat(details, `\n`) + 'Actual message: \"'.concat(actual && actual.message, '\"'),\n stackStartFn\n });\n }\n throw actual;\n }\n }\n assert.throws = function throws(promiseFn) {\n for (var _len2 = arguments.length, args = new @Array(_len2 > 1 \? _len2 - 1 : 0), _key2 = 1;_key2 < _len2; _key2++)\n args[_key2 - 1] = arguments[_key2];\n expectsError.@apply(void 0, [throws, getActual(promiseFn)].concat(args));\n }, assert.rejects = function rejects(promiseFn) {\n for (var _len3 = arguments.length, args = new @Array(_len3 > 1 \? _len3 - 1 : 0), _key3 = 1;_key3 < _len3; _key3++)\n args[_key3 - 1] = arguments[_key3];\n return waitForActual(promiseFn).then(function(result) {\n return expectsError.@apply(void 0, [rejects, result].concat(args));\n });\n }, assert.doesNotThrow = function doesNotThrow(fn) {\n for (var _len4 = arguments.length, args = new @Array(_len4 > 1 \? _len4 - 1 : 0), _key4 = 1;_key4 < _len4; _key4++)\n args[_key4 - 1] = arguments[_key4];\n expectsNoError.@apply(void 0, [doesNotThrow, getActual(fn)].concat(args));\n }, assert.doesNotReject = function doesNotReject(fn) {\n for (var _len5 = arguments.length, args = new @Array(_len5 > 1 \? _len5 - 1 : 0), _key5 = 1;_key5 < _len5; _key5++)\n args[_key5 - 1] = arguments[_key5];\n return waitForActual(fn).then(function(result) {\n return expectsNoError.@apply(void 0, [doesNotReject, result].concat(args));\n });\n }, assert.ifError = function ifError(err) {\n if (err != null) {\n var message = \"ifError got unwanted exception: \";\n _typeof(err) === \"object\" && typeof err.message == \"string\" \? err.message.length === 0 && err.constructor \? message += err.constructor.name : message += err.message : message += inspect(err);\n var newErr = new AssertionError({\n actual: err,\n expected: null,\n operator: \"ifError\",\n message,\n stackStartFn: ifError\n }), origStack = err.stack;\n if (typeof origStack == \"string\") {\n var tmp2 = origStack.split(`\n`);\n tmp2.shift();\n for (var tmp1 = newErr.stack.split(`\n`), i = 0;i < tmp2.length; i++) {\n var pos = tmp1.indexOf(tmp2[i]);\n if (pos !== -1) {\n tmp1 = tmp1.slice(0, pos);\n break;\n }\n }\n newErr.stack = \"\".concat(tmp1.join(`\n`), `\n`).concat(tmp2.join(`\n`));\n }\n throw newErr;\n }\n };\n function strict() {\n for (var _len6 = arguments.length, args = new @Array(_len6), _key6 = 0;_key6 < _len6; _key6++)\n args[_key6] = arguments[_key6];\n innerOk.@apply(void 0, [strict, args.length].concat(args));\n }\n assert.strict = objectAssign(strict, assert, {\n equal: assert.strictEqual,\n deepEqual: assert.deepStrictEqual,\n notEqual: assert.notStrictEqual,\n notDeepEqual: assert.notDeepStrictEqual\n }), assert.strict.strict = assert.strict;\n }\n}), assert_module = require_assert();\nassert_module.CallTracker = CallTracker;\nreturn assert_module})\n"); -// - -// -static constexpr ASCIILiteral NodeAssertStrictCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/assert.strict.ts\nreturn (@getInternalField(@internalModuleRegistry, 8) || @createInternalModuleById(8)).strict})\n"); -// - -// -static constexpr ASCIILiteral NodeAsyncHooksCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/async_hooks.ts\nvar get = function() {\n return @getInternalField(@asyncContext, 0);\n}, set = function(contextValue) {\n return @putInternalField(@asyncContext, 0, contextValue);\n}, createWarning = function(message) {\n let warned = !1;\n var wrapped = function() {\n if (warned)\n return;\n if (new Error().stack.includes(\"zx/build/core.js\"))\n return;\n warned = !0, console.warn(\"[bun] Warning:\", message);\n };\n return wrapped;\n}, createHook = function(callbacks) {\n return {\n enable: createHookNotImpl,\n disable: createHookNotImpl\n };\n}, executionAsyncId = function() {\n return executionAsyncIdNotImpl(), 0;\n}, triggerAsyncId = function() {\n return 0;\n}, executionAsyncResource = function() {\n return executionAsyncResourceWarning(), process.stdin;\n}, $, { cleanupLater, setAsyncHooksEnabled } = @lazy(\"async_hooks\");\n\nclass AsyncLocalStorage {\n #disableCalled = !1;\n constructor() {\n setAsyncHooksEnabled(!0);\n }\n static bind(fn, ...args) {\n return this.snapshot().bind(null, fn, ...args);\n }\n static snapshot() {\n var context = get();\n return (fn, ...args) => {\n var prev = get();\n set(context);\n try {\n return fn(...args);\n } catch (error) {\n throw error;\n } finally {\n set(prev);\n }\n };\n }\n enterWith(store) {\n cleanupLater();\n var context = get();\n if (!context) {\n set([this, store]);\n return;\n }\n var { length } = context;\n for (var i = 0;i < length; i += 2)\n if (context[i] === this) {\n const clone = context.slice();\n clone[i + 1] = store, set(clone);\n return;\n }\n set(context.concat(this, store));\n }\n exit(cb, ...args) {\n return this.run(@undefined, cb, ...args);\n }\n run(store_value, callback, ...args) {\n var context = get(), hasPrevious = !1, previous_value, i = 0, contextWasAlreadyInit = !context;\n if (contextWasAlreadyInit)\n set(context = [this, store_value]);\n else {\n if (context = context.slice(), i = context.indexOf(this), i > -1)\n hasPrevious = !0, previous_value = context[i + 1], context[i + 1] = store_value;\n else\n i = context.length, context.push(this, store_value);\n set(context);\n }\n try {\n return callback(...args);\n } catch (e) {\n throw e;\n } finally {\n if (!this.#disableCalled) {\n var context2 = get();\n if (context2 === context && contextWasAlreadyInit)\n set(@undefined);\n else if (context2 = context2.slice(), hasPrevious)\n context2[i + 1] = previous_value, set(context2);\n else\n context2.splice(i, 2), set(context2.length \? context2 : @undefined);\n }\n }\n }\n disable() {\n if (!this.#disableCalled) {\n var context = get();\n if (context) {\n var { length } = context;\n for (var i = 0;i < length; i += 2)\n if (context[i] === this) {\n context.splice(i, 2), set(context.length \? context : @undefined);\n break;\n }\n }\n this.#disableCalled = !0;\n }\n }\n getStore() {\n var context = get();\n if (!context)\n return;\n var { length } = context;\n for (var i = 0;i < length; i += 2)\n if (context[i] === this)\n return context[i + 1];\n }\n}\n\nclass AsyncResource {\n type;\n #snapshot;\n constructor(type, options) {\n if (typeof type !== \"string\")\n @throwTypeError('The \"type\" argument must be of type string. Received type ' + typeof type);\n setAsyncHooksEnabled(!0), this.type = type, this.#snapshot = get();\n }\n emitBefore() {\n return !0;\n }\n emitAfter() {\n return !0;\n }\n asyncId() {\n return 0;\n }\n triggerAsyncId() {\n return 0;\n }\n emitDestroy() {\n }\n runInAsyncScope(fn, thisArg, ...args) {\n var prev = get();\n set(this.#snapshot);\n try {\n return fn.@apply(thisArg, args);\n } catch (error) {\n throw error;\n } finally {\n set(prev);\n }\n }\n bind(fn, thisArg) {\n return this.runInAsyncScope.bind(this, fn, thisArg \?\? this);\n }\n static bind(fn, type, thisArg) {\n return type = type || fn.name, new AsyncResource(type || \"bound-anonymous-fn\").bind(fn, thisArg);\n }\n}\nvar createHookNotImpl = createWarning(\"async_hooks.createHook is not implemented in Bun. Hooks can still be created but will never be called.\"), executionAsyncIdNotImpl = createWarning(\"async_hooks.executionAsyncId/triggerAsyncId are not implemented in Bun. It will return 0 every time.\"), executionAsyncResourceWarning = createWarning(\"async_hooks.executionAsyncResource is not implemented in Bun. It returns a reference to process.stdin every time.\"), asyncWrapProviders = {\n NONE: 0,\n DIRHANDLE: 1,\n DNSCHANNEL: 2,\n ELDHISTOGRAM: 3,\n FILEHANDLE: 4,\n FILEHANDLECLOSEREQ: 5,\n FIXEDSIZEBLOBCOPY: 6,\n FSEVENTWRAP: 7,\n FSREQCALLBACK: 8,\n FSREQPROMISE: 9,\n GETADDRINFOREQWRAP: 10,\n GETNAMEINFOREQWRAP: 11,\n HEAPSNAPSHOT: 12,\n HTTP2SESSION: 13,\n HTTP2STREAM: 14,\n HTTP2PING: 15,\n HTTP2SETTINGS: 16,\n HTTPINCOMINGMESSAGE: 17,\n HTTPCLIENTREQUEST: 18,\n JSSTREAM: 19,\n JSUDPWRAP: 20,\n MESSAGEPORT: 21,\n PIPECONNECTWRAP: 22,\n PIPESERVERWRAP: 23,\n PIPEWRAP: 24,\n PROCESSWRAP: 25,\n PROMISE: 26,\n QUERYWRAP: 27,\n SHUTDOWNWRAP: 28,\n SIGNALWRAP: 29,\n STATWATCHER: 30,\n STREAMPIPE: 31,\n TCPCONNECTWRAP: 32,\n TCPSERVERWRAP: 33,\n TCPWRAP: 34,\n TTYWRAP: 35,\n UDPSENDWRAP: 36,\n UDPWRAP: 37,\n SIGINTWATCHDOG: 38,\n WORKER: 39,\n WORKERHEAPSNAPSHOT: 40,\n WRITEWRAP: 41,\n ZLIB: 42,\n CHECKPRIMEREQUEST: 43,\n PBKDF2REQUEST: 44,\n KEYPAIRGENREQUEST: 45,\n KEYGENREQUEST: 46,\n KEYEXPORTREQUEST: 47,\n CIPHERREQUEST: 48,\n DERIVEBITSREQUEST: 49,\n HASHREQUEST: 50,\n RANDOMBYTESREQUEST: 51,\n RANDOMPRIMEREQUEST: 52,\n SCRYPTREQUEST: 53,\n SIGNREQUEST: 54,\n TLSWRAP: 55,\n VERIFYREQUEST: 56,\n INSPECTORJSBINDING: 57\n};\n$ = {\n AsyncLocalStorage,\n createHook,\n executionAsyncId,\n triggerAsyncId,\n executionAsyncResource,\n asyncWrapProviders,\n AsyncResource\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeChildProcessCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/child_process.ts\nvar spawn = function(file, args, options) {\n options = normalizeSpawnArguments(file, args, options), validateTimeout(options.timeout), validateAbortSignal(options.signal, \"options.signal\");\n const killSignal2 = sanitizeKillSignal(options.killSignal), child = new ChildProcess;\n if (child.spawn(options), options.timeout > 0) {\n let timeoutId = setTimeout(() => {\n if (timeoutId) {\n try {\n child.kill(killSignal2);\n } catch (err) {\n child.emit(\"error\", err);\n }\n timeoutId = null;\n }\n });\n child.once(\"exit\", () => {\n if (timeoutId)\n clearTimeout(timeoutId), timeoutId = null;\n });\n }\n if (options.signal) {\n let onAbortListener2 = function() {\n abortChildProcess(child, killSignal2, options.signal.reason);\n };\n var onAbortListener = onAbortListener2;\n const signal = options.signal;\n if (signal.aborted)\n process.nextTick(onAbortListener2);\n else\n signal.addEventListener(\"abort\", onAbortListener2, { once: !0 }), child.once(\"exit\", () => signal.removeEventListener(\"abort\", onAbortListener2));\n }\n return child;\n}, execFile = function(file, args, options, callback) {\n ({ file, args, options, callback } = normalizeExecFileArgs(file, args, options, callback)), options = {\n encoding: \"utf8\",\n timeout: 0,\n maxBuffer: MAX_BUFFER,\n killSignal: \"SIGTERM\",\n cwd: null,\n env: null,\n shell: !1,\n ...options\n };\n const maxBuffer = options.maxBuffer;\n validateTimeout(options.timeout), validateMaxBuffer(maxBuffer), options.killSignal = sanitizeKillSignal(options.killSignal);\n const child = spawn(file, args, {\n cwd: options.cwd,\n env: options.env,\n shell: options.shell,\n signal: options.signal\n });\n let encoding;\n const _stdout = [], _stderr = [];\n if (options.encoding !== \"buffer\" && BufferIsEncoding(options.encoding))\n encoding = options.encoding;\n else\n encoding = null;\n let stdoutLen = 0, stderrLen = 0, killed = !1, exited = !1, timeoutId, encodedStdoutLen, encodedStderrLen, ex = null, cmd = file;\n function exitHandler(code, signal) {\n if (exited)\n return;\n if (exited = !0, timeoutId)\n clearTimeout(timeoutId), timeoutId = null;\n if (!callback)\n return;\n const readableEncoding = child\?.stdout\?.readableEncoding;\n let stdout, stderr;\n if (encoding || child.stdout && readableEncoding)\n stdout = ArrayPrototypeJoin.@call(_stdout, \"\");\n else\n stdout = BufferConcat(_stdout);\n if (encoding || child.stderr && readableEncoding)\n stderr = ArrayPrototypeJoin.@call(_stderr, \"\");\n else\n stderr = BufferConcat(_stderr);\n if (!ex && code === 0 && signal === null) {\n callback(null, stdout, stderr);\n return;\n }\n if (args\?.length)\n cmd += ` ${ArrayPrototypeJoin.@call(args, \" \")}`;\n if (!ex) {\n let message = `Command failed: ${cmd}`;\n if (stderr)\n message += `\\n${stderr}`;\n ex = genericNodeError(message, {\n code,\n killed: child.killed || killed,\n signal\n });\n }\n ex.cmd = cmd, callback(ex, stdout, stderr);\n }\n function errorHandler(e) {\n if (ex = e, child.stdout)\n child.stdout.destroy();\n if (child.stderr)\n child.stderr.destroy();\n exitHandler();\n }\n function kill() {\n if (child.stdout)\n child.stdout.destroy();\n if (child.stderr)\n child.stderr.destroy();\n killed = !0;\n try {\n child.kill(options.killSignal);\n } catch (e) {\n ex = e, exitHandler();\n }\n }\n if (options.timeout > 0)\n timeoutId = setTimeout(function delayedKill() {\n kill(), timeoutId = null;\n }, options.timeout);\n if (child.stdout) {\n if (encoding)\n child.stdout.setEncoding(encoding);\n child.stdout.on(\"data\", maxBuffer === @Infinity \? function onUnlimitedSizeBufferedData(chunk) {\n ArrayPrototypePush.@call(_stdout, chunk);\n } : encoding \? function onChildStdoutEncoded(chunk) {\n if (stdoutLen += chunk.length, stdoutLen * 4 > maxBuffer) {\n const encoding2 = child.stdout.readableEncoding, actualLen = @Buffer.byteLength(chunk, encoding2);\n if (encodedStdoutLen === @undefined)\n for (let i = 0;i < _stdout.length; i++)\n encodedStdoutLen += @Buffer.byteLength(_stdout[i], encoding2);\n else\n encodedStdoutLen += actualLen;\n const truncatedLen = maxBuffer - (encodedStdoutLen - actualLen);\n ArrayPrototypePush.@call(_stdout, StringPrototypeSlice.@apply(chunk, 0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stdout\"), kill();\n } else\n ArrayPrototypePush.@call(_stdout, chunk);\n } : function onChildStdoutRaw(chunk) {\n if (stdoutLen += chunk.length, stdoutLen > maxBuffer) {\n const truncatedLen = maxBuffer - (stdoutLen - chunk.length);\n ArrayPrototypePush.@call(_stdout, chunk.slice(0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stdout\"), kill();\n } else\n ArrayPrototypePush.@call(_stdout, chunk);\n });\n }\n if (child.stderr) {\n if (encoding)\n child.stderr.setEncoding(encoding);\n child.stderr.on(\"data\", maxBuffer === @Infinity \? function onUnlimitedSizeBufferedData(chunk) {\n ArrayPrototypePush.@call(_stderr, chunk);\n } : encoding \? function onChildStderrEncoded(chunk) {\n if (stderrLen += chunk.length, stderrLen * 4 > maxBuffer) {\n const encoding2 = child.stderr.readableEncoding, actualLen = @Buffer.byteLength(chunk, encoding2);\n if (encodedStderrLen === @undefined)\n for (let i = 0;i < _stderr.length; i++)\n encodedStderrLen += @Buffer.byteLength(_stderr[i], encoding2);\n else\n encodedStderrLen += actualLen;\n const truncatedLen = maxBuffer - (encodedStderrLen - actualLen);\n ArrayPrototypePush.@call(_stderr, StringPrototypeSlice.@call(chunk, 0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stderr\"), kill();\n } else\n ArrayPrototypePush.@call(_stderr, chunk);\n } : function onChildStderrRaw(chunk) {\n if (stderrLen += chunk.length, stderrLen > maxBuffer) {\n const truncatedLen = maxBuffer - (stderrLen - chunk.length);\n ArrayPrototypePush.@call(_stderr, StringPrototypeSlice.@call(chunk, 0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stderr\"), kill();\n } else\n ArrayPrototypePush.@call(_stderr, chunk);\n });\n }\n return child.addListener(\"close\", exitHandler), child.addListener(\"error\", errorHandler), child;\n}, exec = function(command, options, callback) {\n const opts = normalizeExecArgs(command, options, callback);\n return execFile(opts.file, opts.options, opts.callback);\n}, spawnSync = function(file, args, options) {\n options = {\n maxBuffer: MAX_BUFFER,\n ...normalizeSpawnArguments(file, args, options)\n };\n const { maxBuffer, encoding } = options;\n validateTimeout(options.timeout), validateMaxBuffer(maxBuffer), options.killSignal = sanitizeKillSignal(options.killSignal);\n const stdio = options.stdio || \"pipe\", bunStdio = getBunStdioFromOptions(stdio);\n var { input } = options;\n if (input)\n if (ArrayBufferIsView(input))\n bunStdio[0] = input;\n else if (typeof input === \"string\")\n bunStdio[0] = @Buffer.from(input, encoding || \"utf8\");\n else\n throw new ERR_INVALID_ARG_TYPE(\"options.stdio[0]\", [\"Buffer\", \"TypedArray\", \"DataView\", \"string\"], input);\n const { stdout, stderr, success, exitCode } = Bun.spawnSync({\n cmd: options.args,\n env: options.env || @undefined,\n cwd: options.cwd || @undefined,\n stdin: bunStdio[0],\n stdout: bunStdio[1],\n stderr: bunStdio[2]\n }), result = {\n signal: null,\n status: exitCode,\n output: [null, stdout, stderr]\n };\n if (stdout && encoding && encoding !== \"buffer\")\n result.output[1] = result.output[1]\?.toString(encoding);\n if (stderr && encoding && encoding !== \"buffer\")\n result.output[2] = result.output[2]\?.toString(encoding);\n if (result.stdout = result.output[1], result.stderr = result.output[2], !success)\n result.error = new SystemError(result.output[2], options.file, \"spawnSync\", -1, result.status), result.error.spawnargs = ArrayPrototypeSlice.@call(options.args, 1);\n return result;\n}, execFileSync = function(file, args, options) {\n ({ file, args, options } = normalizeExecFileArgs(file, args, options));\n const ret = spawnSync(file, args, options), errArgs = [options.argv0 || file];\n ArrayPrototypePush.@apply(errArgs, args);\n const err = checkExecSyncError(ret, errArgs);\n if (err)\n throw err;\n return ret.stdout;\n}, execSync = function(command, options) {\n const opts = normalizeExecArgs(command, options, null), ret = spawnSync(opts.file, opts.options), err = checkExecSyncError(ret, @undefined, command);\n if (err)\n throw err;\n return ret.stdout;\n}, stdioStringToArray = function(stdio, channel) {\n const options = [];\n switch (stdio) {\n case \"ignore\":\n case \"overlapped\":\n case \"pipe\":\n ArrayPrototypePush.@call(options, stdio, stdio, stdio);\n break;\n case \"inherit\":\n ArrayPrototypePush.@call(options, 0, 1, 2);\n break;\n default:\n throw new ERR_INVALID_ARG_VALUE(\"stdio\", stdio);\n }\n if (channel)\n ArrayPrototypePush.@call(options, channel);\n return options;\n}, fork = function(modulePath, args = [], options) {\n modulePath = getValidatedPath(modulePath, \"modulePath\");\n let execArgv;\n if (args == null)\n args = [];\n else if (typeof args === \"object\" && !ArrayIsArray(args))\n options = args, args = [];\n else\n validateArray(args, \"args\");\n if (options != null)\n validateObject(options, \"options\");\n if (options = { __proto__: null, ...options, shell: !1 }, options.execPath = options.execPath || process.execPath, validateArgumentNullCheck(options.execPath, \"options.execPath\"), args = [modulePath, ...args], typeof options.stdio === \"string\")\n options.stdio = stdioStringToArray(options.stdio, \"ipc\");\n else if (!ArrayIsArray(options.stdio))\n options.stdio = stdioStringToArray(options.silent \? \"pipe\" : \"inherit\", \"ipc\");\n else if (!ArrayPrototypeIncludes.@call(options.stdio, \"ipc\"))\n throw new ERR_CHILD_PROCESS_IPC_REQUIRED(\"options.stdio\");\n return spawn(options.execPath, args, options);\n}, convertToValidSignal = function(signal) {\n if (typeof signal === \"number\" && getSignalsToNamesMapping()[signal])\n return signal;\n if (typeof signal === \"string\") {\n const signalName = signals[StringPrototypeToUpperCase.@call(signal)];\n if (signalName)\n return signalName;\n }\n throw new ERR_UNKNOWN_SIGNAL(signal);\n}, sanitizeKillSignal = function(killSignal2) {\n if (typeof killSignal2 === \"string\" || typeof killSignal2 === \"number\")\n return convertToValidSignal(killSignal2);\n else if (killSignal2 != null)\n throw new ERR_INVALID_ARG_TYPE(\"options.killSignal\", [\"string\", \"number\"], killSignal2);\n}, getSignalsToNamesMapping = function() {\n if (signalsToNamesMapping !== @undefined)\n return signalsToNamesMapping;\n signalsToNamesMapping = ObjectCreate(null);\n for (let key in signals)\n signalsToNamesMapping[signals[key]] = key;\n return signalsToNamesMapping;\n}, normalizeExecFileArgs = function(file, args, options, callback) {\n if (ArrayIsArray(args))\n args = ArrayPrototypeSlice.@call(args);\n else if (args != null && typeof args === \"object\")\n callback = options, options = args, args = null;\n else if (typeof args === \"function\")\n callback = args, options = null, args = null;\n if (args == null)\n args = [];\n if (typeof options === \"function\")\n callback = options;\n else if (options != null)\n validateObject(options, \"options\");\n if (options == null)\n options = kEmptyObject;\n if (callback != null)\n validateFunction(callback, \"callback\");\n if (options.argv0 != null)\n validateString(options.argv0, \"options.argv0\"), validateArgumentNullCheck(options.argv0, \"options.argv0\");\n return { file, args, options, callback };\n}, normalizeExecArgs = function(command, options, callback) {\n if (validateString(command, \"command\"), validateArgumentNullCheck(command, \"command\"), typeof options === \"function\")\n callback = options, options = @undefined;\n return options = { ...options }, options.shell = typeof options.shell === \"string\" \? options.shell : !0, {\n file: command,\n options,\n callback\n };\n}, normalizeSpawnArguments = function(file, args, options) {\n if (validateString(file, \"file\"), validateArgumentNullCheck(file, \"file\"), file.length === 0)\n throw new ERR_INVALID_ARG_VALUE(\"file\", file, \"cannot be empty\");\n if (ArrayIsArray(args))\n args = ArrayPrototypeSlice.@call(args);\n else if (args == null)\n args = [];\n else if (typeof args !== \"object\")\n throw new ERR_INVALID_ARG_TYPE(\"args\", \"object\", args);\n else\n options = args, args = [];\n if (validateArgumentsNullCheck(args, \"args\"), options === @undefined)\n options = {};\n else\n validateObject(options, \"options\");\n let cwd = options.cwd;\n if (cwd != null)\n cwd = getValidatedPath(cwd, \"options.cwd\");\n var detached = !1;\n const { detached: detachedOption } = options;\n if (detachedOption != null)\n detached = !!detachedOption;\n if (options.shell != null && typeof options.shell !== \"boolean\" && typeof options.shell !== \"string\")\n throw new ERR_INVALID_ARG_TYPE(\"options.shell\", [\"boolean\", \"string\"], options.shell);\n if (options.argv0 != null)\n validateString(options.argv0, \"options.argv0\"), validateArgumentNullCheck(options.argv0, \"options.argv0\");\n if (options.shell) {\n validateArgumentNullCheck(options.shell, \"options.shell\");\n const command = ArrayPrototypeJoin.@call([file, ...args], \" \");\n if (typeof options.shell === \"string\")\n file = options.shell;\n else\n file = \"sh\";\n args = [\"-c\", command];\n }\n if (typeof options.argv0 === \"string\")\n ArrayPrototypeUnshift.@call(args, options.argv0);\n else\n ArrayPrototypeUnshift.@call(args, file);\n const envPairs = options.env || process.env;\n return { ...options, detached, file, args, cwd, envPairs };\n}, checkExecSyncError = function(ret, args, cmd) {\n let err;\n if (ret.error)\n err = ret.error, ObjectAssign(err, ret);\n else if (ret.status !== 0) {\n let msg = \"Command failed: \";\n if (msg += cmd || ArrayPrototypeJoin.@call(args, \" \"), ret.stderr && ret.stderr.length > 0)\n msg += `\\n${ret.stderr.toString()}`;\n err = genericNodeError(msg, ret);\n }\n return err;\n}, nodeToBun = function(item) {\n if (typeof item === \"number\")\n return item;\n else {\n const result = nodeToBunLookup[item];\n if (result === @undefined)\n throw new Error(`Invalid stdio option \"${item}\"`);\n return result;\n }\n}, fdToStdioName = function(fd) {\n switch (fd) {\n case 0:\n return \"stdin\";\n case 1:\n return \"stdout\";\n case 2:\n return \"stderr\";\n default:\n return null;\n }\n}, getBunStdioFromOptions = function(stdio) {\n return normalizeStdio(stdio).map((item) => nodeToBun(item));\n}, normalizeStdio = function(stdio) {\n if (typeof stdio === \"string\")\n switch (stdio) {\n case \"ignore\":\n return [\"ignore\", \"ignore\", \"ignore\"];\n case \"pipe\":\n return [\"pipe\", \"pipe\", \"pipe\"];\n case \"inherit\":\n return [\"inherit\", \"inherit\", \"inherit\"];\n default:\n throw new ERR_INVALID_OPT_VALUE(\"stdio\", stdio);\n }\n else if (ArrayIsArray(stdio)) {\n let processedStdio;\n if (stdio.length === 0)\n processedStdio = [\"pipe\", \"pipe\", \"pipe\"];\n else if (stdio.length === 1)\n processedStdio = [stdio[0], \"pipe\", \"pipe\"];\n else if (stdio.length === 2)\n processedStdio = [stdio[0], stdio[1], \"pipe\"];\n else if (stdio.length >= 3)\n processedStdio = [stdio[0], stdio[1], stdio[2]];\n return processedStdio.map((item) => !item \? \"pipe\" : item);\n } else\n throw new ERR_INVALID_OPT_VALUE(\"stdio\", stdio);\n}, flushStdio = function(subprocess) {\n const stdio = subprocess.stdio;\n if (stdio == null)\n return;\n for (let i = 0;i < stdio.length; i++) {\n const stream = stdio[i];\n if (!stream || !stream.readable)\n continue;\n stream.resume();\n }\n}, onSpawnNT = function(self) {\n self.emit(\"spawn\");\n}, abortChildProcess = function(child, killSignal2, reason) {\n if (!child)\n return;\n try {\n if (child.kill(killSignal2))\n child.emit(\"error\", new AbortError(@undefined, { cause: reason }));\n } catch (err) {\n child.emit(\"error\", err);\n }\n}, validateMaxBuffer = function(maxBuffer) {\n if (maxBuffer != null && !(typeof maxBuffer === \"number\" && maxBuffer >= 0))\n throw new ERR_OUT_OF_RANGE(\"options.maxBuffer\", \"a positive number\", maxBuffer);\n}, validateArgumentNullCheck = function(arg, propName) {\n if (typeof arg === \"string\" && StringPrototypeIncludes.@call(arg, \"\\0\"))\n throw new ERR_INVALID_ARG_VALUE(propName, arg, \"must be a string without null bytes\");\n}, validateArgumentsNullCheck = function(args, propName) {\n for (let i = 0;i < args.length; ++i)\n validateArgumentNullCheck(args[i], `${propName}[${i}]`);\n}, validateTimeout = function(timeout) {\n if (timeout != null && !(NumberIsInteger(timeout) && timeout >= 0))\n throw new ERR_OUT_OF_RANGE(\"timeout\", \"an unsigned integer\", timeout);\n};\nvar validateFunction = function(value, name) {\n if (typeof value !== \"function\")\n throw new ERR_INVALID_ARG_TYPE(name, \"Function\", value);\n}, validateString = function(value, name) {\n if (typeof value !== \"string\")\n throw new ERR_INVALID_ARG_TYPE(name, \"string\", value);\n}, nullCheck = function(path, propName, throwError = !0) {\n const pathIsString = typeof path === \"string\", pathIsUint8Array = isUint8Array(path);\n if (!pathIsString && !pathIsUint8Array || pathIsString && !StringPrototypeIncludes.@call(path, \"\\0\") || pathIsUint8Array && !Uint8ArrayPrototypeIncludes.@call(path, 0))\n return;\n const err = new ERR_INVALID_ARG_VALUE(propName, path, \"must be a string or Uint8Array without null bytes\");\n if (throwError)\n throw err;\n return err;\n}, validatePath = function(path, propName = \"path\") {\n if (typeof path !== \"string\" && !isUint8Array(path))\n throw new ERR_INVALID_ARG_TYPE(propName, [\"string\", \"Buffer\", \"URL\"], path);\n const err = nullCheck(path, propName, !1);\n if (err !== @undefined)\n throw err;\n}, getValidatedPath = function(fileURLOrPath, propName = \"path\") {\n const path = toPathIfFileURL(fileURLOrPath);\n return validatePath(path, propName), path;\n}, isUint8Array = function(value) {\n return typeof value === \"object\" && value !== null && value instanceof @Uint8Array;\n}, isURLInstance = function(fileURLOrPath) {\n return fileURLOrPath != null && fileURLOrPath.href && fileURLOrPath.origin;\n}, toPathIfFileURL = function(fileURLOrPath) {\n if (!isURLInstance(fileURLOrPath))\n return fileURLOrPath;\n return Bun.fileURLToPath(fileURLOrPath);\n}, genericNodeError = function(message, options) {\n const err = new Error(message);\n return err.code = options.code, err.killed = options.killed, err.signal = options.signal, err;\n}, ERR_OUT_OF_RANGE = function(str, range, input, replaceDefaultBoolean = !1) {\n return new RangeError(`The value of ${str} is out of range. It must be ${range}. Received ${input}`);\n}, ERR_CHILD_PROCESS_STDIO_MAXBUFFER = function(stdio) {\n return Error(`${stdio} maxBuffer length exceeded`);\n}, ERR_UNKNOWN_SIGNAL = function(name) {\n const err = @makeTypeError(`Unknown signal: ${name}`);\n return err.code = \"ERR_UNKNOWN_SIGNAL\", err;\n}, ERR_INVALID_ARG_TYPE = function(name, type, value) {\n const err = @makeTypeError(`The \"${name}\" argument must be of type ${type}. Received ${value\?.toString()}`);\n return err.code = \"ERR_INVALID_ARG_TYPE\", err;\n}, ERR_INVALID_OPT_VALUE = function(name, value) {\n return @makeTypeError(`The value \"${value}\" is invalid for option \"${name}\"`);\n}, ERR_INVALID_ARG_VALUE = function(name, value, reason) {\n return new Error(`The value \"${value}\" is invalid for argument '${name}'. Reason: ${reason}`);\n}, ERR_CHILD_PROCESS_IPC_REQUIRED = function(name) {\n const err = @makeTypeError(`Forked processes must have an IPC channel, missing value 'ipc' in ${name}`);\n return err.code = \"ERR_CHILD_PROCESS_IPC_REQUIRED\", err;\n}, $, EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20), StreamModule = @getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39), {\n constants: { signals }\n} = @getInternalField(@internalModuleRegistry, 28) || @createInternalModuleById(28), { promisify } = @getInternalField(@internalModuleRegistry, 48) || @createInternalModuleById(48), ObjectCreate = Object.create, ObjectAssign = Object.assign, ObjectDefineProperty = Object.defineProperty, BufferConcat = @Buffer.concat, BufferIsEncoding = @Buffer.isEncoding, kEmptyObject = ObjectCreate(null), ArrayPrototypePush = @Array.prototype.push, ArrayPrototypeJoin = @Array.prototype.join, ArrayPrototypeMap = @Array.prototype.map, ArrayPrototypeIncludes = @Array.prototype.includes, ArrayPrototypeSlice = @Array.prototype.slice, ArrayPrototypeUnshift = @Array.prototype.unshift, ArrayPrototypeLastIndexOf = @Array.prototype.lastIndexOf, ArrayPrototypeSplice = @Array.prototype.splice, ArrayIsArray = @Array.isArray, ArrayBufferIsView = @ArrayBuffer.isView, NumberIsInteger = Number.isInteger;\nvar StringPrototypeToUpperCase = @String.prototype.toUpperCase, StringPrototypeIncludes = @String.prototype.includes, StringPrototypeSlice = @String.prototype.slice, Uint8ArrayPrototypeIncludes = @Uint8Array.prototype.includes, MAX_BUFFER = 1048576, NativeWritable, ReadableFromWeb, customPromiseExecFunction = (orig) => {\n return (...args) => {\n let resolve, reject;\n const promise = new @Promise((res, rej) => {\n resolve = res, reject = rej;\n });\n return promise.child = orig(...args, (err, stdout, stderr) => {\n if (err !== null)\n err.stdout = stdout, err.stderr = stderr, reject(err);\n else\n resolve({ stdout, stderr });\n }), promise;\n };\n};\nObjectDefineProperty(exec, promisify.custom, {\n __proto__: null,\n enumerable: !1,\n value: customPromiseExecFunction(exec)\n});\nvar signalsToNamesMapping;\n\nclass ChildProcess extends EventEmitter {\n constructor() {\n super(...arguments);\n }\n #handle;\n #exited = !1;\n #closesNeeded = 1;\n #closesGot = 0;\n connected = !1;\n signalCode = null;\n exitCode = null;\n spawnfile;\n spawnargs;\n pid;\n channel;\n get killed() {\n if (this.#handle == null)\n return !1;\n }\n #handleOnExit(exitCode, signalCode, err) {\n if (this.#exited)\n return;\n if (signalCode)\n this.signalCode = signalCode;\n else\n this.exitCode = exitCode;\n if (this.#stdin)\n this.#stdin.destroy();\n if (this.#handle)\n this.#handle = null;\n if (exitCode < 0) {\n const err2 = new SystemError(`Spawned process exited with error code: ${exitCode}`, @undefined, \"spawn\", \"EUNKNOWN\", \"ERR_CHILD_PROCESS_UNKNOWN_ERROR\");\n if (this.spawnfile)\n err2.path = this.spawnfile;\n err2.spawnargs = ArrayPrototypeSlice.@call(this.spawnargs, 1), this.emit(\"error\", err2);\n } else\n this.emit(\"exit\", this.exitCode, this.signalCode);\n process.nextTick(flushStdio, this), this.#maybeClose(), this.#exited = !0, this.#stdioOptions = [\"destroyed\", \"destroyed\", \"destroyed\"];\n }\n #getBunSpawnIo(i, encoding) {\n NativeWritable ||= StreamModule.NativeWritable, ReadableFromWeb ||= StreamModule.Readable.fromWeb;\n const io = this.#stdioOptions[i];\n switch (i) {\n case 0:\n switch (io) {\n case \"pipe\":\n return new NativeWritable(this.#handle.stdin);\n case \"inherit\":\n return process.stdin || null;\n case \"destroyed\":\n return new ShimmedStdin;\n default:\n return null;\n }\n case 2:\n case 1:\n switch (io) {\n case \"pipe\":\n return ReadableFromWeb(this.#handle[fdToStdioName(i)], { encoding });\n case \"inherit\":\n return process[fdToStdioName(i)] || null;\n case \"destroyed\":\n return new ShimmedStdioOutStream;\n default:\n return null;\n }\n }\n }\n #stdin;\n #stdout;\n #stderr;\n #stdioObject;\n #encoding;\n #stdioOptions;\n #createStdioObject() {\n return Object.create(null, {\n 0: {\n get: () => this.stdin\n },\n 1: {\n get: () => this.stdout\n },\n 2: {\n get: () => this.stderr\n }\n });\n }\n get stdin() {\n return this.#stdin \?\?= this.#getBunSpawnIo(0, this.#encoding);\n }\n get stdout() {\n return this.#stdout \?\?= this.#getBunSpawnIo(1, this.#encoding);\n }\n get stderr() {\n return this.#stderr \?\?= this.#getBunSpawnIo(2, this.#encoding);\n }\n get stdio() {\n return this.#stdioObject \?\?= this.#createStdioObject();\n }\n spawn(options) {\n validateObject(options, \"options\"), validateString(options.file, \"options.file\");\n var file = this.spawnfile = options.file, spawnargs;\n if (options.args == null)\n spawnargs = this.spawnargs = [];\n else\n validateArray(options.args, \"options.args\"), spawnargs = this.spawnargs = options.args;\n const stdio = options.stdio || [\"pipe\", \"pipe\", \"pipe\"], bunStdio = getBunStdioFromOptions(stdio), ipc = @isArray(stdio) && stdio[3] === \"ipc\";\n var env = options.envPairs || @undefined;\n const detachedOption = options.detached;\n if (this.#encoding = options.encoding || @undefined, this.#stdioOptions = bunStdio, this.#handle = Bun.spawn({\n cmd: spawnargs,\n stdin: bunStdio[0],\n stdout: bunStdio[1],\n stderr: bunStdio[2],\n cwd: options.cwd || @undefined,\n env: env || process.env,\n detached: typeof detachedOption !== \"undefined\" \? !!detachedOption : !1,\n onExit: (handle, exitCode, signalCode, err) => {\n this.#handle = handle, this.pid = this.#handle.pid, process.nextTick((exitCode2, signalCode2, err2) => this.#handleOnExit(exitCode2, signalCode2, err2), exitCode, signalCode, err);\n },\n lazy: !0,\n ipc: ipc \? this.#emitIpcMessage.bind(this) : @undefined\n }), this.pid = this.#handle.pid, onSpawnNT(this), ipc)\n this.send = this.#send, this.disconnect = this.#disconnect;\n }\n #emitIpcMessage(message) {\n this.emit(\"message\", message);\n }\n #send(message, handle, options, callback) {\n if (typeof handle === \"function\")\n callback = handle, handle = @undefined, options = @undefined;\n else if (typeof options === \"function\")\n callback = options, options = @undefined;\n else if (options !== @undefined) {\n if (typeof options !== \"object\" || options === null)\n throw new ERR_INVALID_ARG_TYPE(\"options\", \"Object\", options);\n }\n if (!this.#handle) {\n if (callback)\n process.nextTick(callback, @makeTypeError(\"Process was closed while trying to send message\"));\n else\n this.emit(\"error\", @makeTypeError(\"Process was closed while trying to send message\"));\n return !1;\n }\n try {\n if (this.#handle.send(message), callback)\n process.nextTick(callback);\n return !0;\n } catch (error) {\n if (callback)\n process.nextTick(callback, error);\n else\n this.emit(\"error\", error);\n return !1;\n }\n }\n #disconnect() {\n if (!this.connected) {\n this.emit(\"error\", @makeTypeError(\"Process was closed while trying to send message\"));\n return;\n }\n this.connected = !1, this.#handle.disconnect();\n }\n kill(sig) {\n const signal = sig === 0 \? sig : convertToValidSignal(sig === @undefined \? \"SIGTERM\" : sig);\n if (this.#handle)\n this.#handle.kill(signal);\n return this.#maybeClose(), !0;\n }\n #maybeClose() {\n if (this.#closesGot++, this.#closesGot === this.#closesNeeded)\n this.emit(\"close\", this.exitCode, this.signalCode);\n }\n ref() {\n if (this.#handle)\n this.#handle.ref();\n }\n unref() {\n if (this.#handle)\n this.#handle.unref();\n }\n}\nvar nodeToBunLookup = {\n ignore: null,\n pipe: \"pipe\",\n overlapped: \"pipe\",\n inherit: \"inherit\"\n};\n\nclass ShimmedStdin extends EventEmitter {\n constructor() {\n super();\n }\n write() {\n return !1;\n }\n destroy() {\n }\n end() {\n }\n pipe() {\n }\n}\n\nclass ShimmedStdioOutStream extends EventEmitter {\n constructor() {\n super(...arguments);\n }\n pipe() {\n }\n}\nvar validateAbortSignal = (signal, name) => {\n if (signal !== @undefined && (signal === null || typeof signal !== \"object\" || !(\"aborted\" in signal)))\n throw new ERR_INVALID_ARG_TYPE(name, \"AbortSignal\", signal);\n};\nvar validateObject = (value, name, options = null) => {\n const allowArray = options\?.allowArray \?\? !1, allowFunction = options\?.allowFunction \?\? !1;\n if (!(options\?.nullable \?\? !1) && value === null || !allowArray && ArrayIsArray.@call(value) || typeof value !== \"object\" && (!allowFunction || typeof value !== \"function\"))\n throw new ERR_INVALID_ARG_TYPE(name, \"object\", value);\n}, validateArray = (value, name, minLength = 0) => {\n if (!ArrayIsArray(value))\n throw new ERR_INVALID_ARG_TYPE(name, \"Array\", value);\n if (value.length < minLength) {\n const reason = `must be longer than ${minLength}`;\n throw new ERR_INVALID_ARG_VALUE(name, value, reason);\n }\n}, Error = globalThis.Error, TypeError = globalThis.TypeError, RangeError = globalThis.RangeError;\n\nclass AbortError extends Error {\n code = \"ABORT_ERR\";\n name = \"AbortError\";\n constructor(message = \"The operation was aborted\", options = @undefined) {\n if (options !== @undefined && typeof options !== \"object\")\n throw new ERR_INVALID_ARG_TYPE(\"options\", \"Object\", options);\n super(message, options);\n }\n}\n\nclass SystemError extends Error {\n path;\n syscall;\n errno;\n code;\n constructor(message, path, syscall, errno, code) {\n super(message);\n this.path = path, this.syscall = syscall, this.errno = errno, this.code = code;\n }\n get name() {\n return \"SystemError\";\n }\n}\n$ = {\n ChildProcess,\n spawn,\n execFile,\n exec,\n fork,\n spawnSync,\n execFileSync,\n execSync\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeClusterCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/cluster.ts\nvar EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20), { throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6);\n\nclass Cluster extends EventEmitter {\n constructor() {\n super(...arguments);\n }\n isWorker = !1;\n isPrimary = !0;\n isMaster = !0;\n workers = {};\n settings = {};\n SCHED_NONE = 1;\n SCHED_RR = 2;\n schedulingPolicy = 2;\n Worker = function Worker() {\n throwNotImplemented(\"node:cluster Worker\", 2428);\n };\n setupPrimary() {\n throwNotImplemented(\"node:cluster\", 2428);\n }\n setupMaster() {\n throwNotImplemented(\"node:cluster\", 2428);\n }\n fork() {\n throwNotImplemented(\"node:cluster\", 2428);\n }\n disconnect() {\n throwNotImplemented(\"node:cluster\", 2428);\n }\n}\nreturn new Cluster})\n"); -// - -// -static constexpr ASCIILiteral NodeConsoleCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/console.ts\nreturn console})\n"); -// - -// -static constexpr ASCIILiteral NodeCryptoCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/crypto.ts\nvar exportIfKeyObject = function(key2) {\n if (key2 instanceof KeyObject)\n key2 = key2.export();\n else if (key2 instanceof CryptoKey)\n key2 = KeyObject.from(key2).export();\n return key2;\n}, getKeyFrom = function(key2, type) {\n if (key2 instanceof KeyObject)\n key2 = key2.export();\n else if (key2 instanceof CryptoKey)\n key2 = KeyObject.from(key2).export();\n else if (!Buffer.isBuffer(key2) && typeof key2 === \"object\") {\n if ((typeof key2.format === \"string\" || typeof key2.passphrase === \"string\") && typeof key2.key !== \"undefined\")\n key2 = type === \"public\" \? _createPublicKey(key2).export() : _createPrivateKey(key2).export();\n } else if (typeof key2 === \"string\" && type === \"public\")\n key2.indexOf(\"PRIVATE KEY-----\") !== -1 && (key2 = _createPublicKey(key2).export());\n return key2;\n}, getArrayBufferOrView = function(buffer, name, encoding) {\n if (buffer instanceof KeyObject) {\n if (buffer.type !== \"secret\") {\n const error2 = @makeTypeError(`ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE: Invalid key object type ${key.type}, expected secret`);\n throw error2.code = \"ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE\", error2;\n }\n buffer = buffer.export();\n }\n if (isAnyArrayBuffer(buffer))\n return buffer;\n if (typeof buffer === \"string\") {\n if (encoding === \"buffer\")\n encoding = \"utf8\";\n return Buffer.from(buffer, encoding);\n }\n if (!isArrayBufferView(buffer)) {\n var error = @makeTypeError(`ERR_INVALID_ARG_TYPE: The \"${name}\" argument must be of type string or an instance of ArrayBuffer, Buffer, TypedArray, or DataView. Received ` + buffer);\n throw error.code = \"ERR_INVALID_ARG_TYPE\", error;\n }\n return buffer;\n}, getCurves = function() {\n return harcoded_curves;\n}, _generateKeyPairSync = function(algorithm, options) {\n const result = generateKeyPairSync(algorithm, options);\n if (result) {\n const publicKeyEncoding = options\?.publicKeyEncoding, privateKeyEncoding = options\?.privateKeyEncoding;\n result.publicKey = publicKeyEncoding \? KeyObject.from(result.publicKey).export(publicKeyEncoding) : KeyObject.from(result.publicKey), result.privateKey = privateKeyEncoding \? KeyObject.from(result.privateKey).export(privateKeyEncoding) : KeyObject.from(result.privateKey);\n }\n return result;\n}, _createPrivateKey = function(key2) {\n if (typeof key2 === \"string\")\n return key2 = Buffer.from(key2, \"utf8\"), KeyObject.from(createPrivateKey({ key: key2, format: \"pem\" }));\n else if (isAnyArrayBuffer(key2) || isArrayBufferView(key2))\n return KeyObject.from(createPrivateKey({ key: key2, format: \"pem\" }));\n else if (typeof key2 === \"object\")\n if (key2 instanceof KeyObject || key2 instanceof CryptoKey) {\n const error2 = @makeTypeError(`ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE: Invalid key object type ${key2.type}`);\n throw error2.code = \"ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE\", error2;\n } else {\n let actual_key = key2.key;\n if (typeof actual_key === \"string\")\n actual_key = Buffer.from(actual_key, key2.encoding || \"utf8\"), key2.key = actual_key;\n else if (actual_key instanceof KeyObject || actual_key instanceof CryptoKey) {\n const error2 = @makeTypeError(`ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE: Invalid key object type ${key2.type}`);\n throw error2.code = \"ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE\", error2;\n }\n if (!isAnyArrayBuffer(actual_key) && !isArrayBufferView(actual_key) && typeof actual_key !== \"object\") {\n var error = @makeTypeError('ERR_INVALID_ARG_TYPE: The \"key\" argument must be of type string or an instance of ArrayBuffer, Buffer, TypedArray, DataView or object. Received ' + actual_key);\n throw error.code = \"ERR_INVALID_ARG_TYPE\", error;\n }\n if (!key2.format)\n key2.format = \"pem\";\n return KeyObject.from(createPrivateKey(key2));\n }\n else {\n var error = @makeTypeError('ERR_INVALID_ARG_TYPE: The \"key\" argument must be of type string or an instance of ArrayBuffer, Buffer, TypedArray, DataView or object. Received ' + key2);\n throw error.code = \"ERR_INVALID_ARG_TYPE\", error;\n }\n}, _createPublicKey = function(key2) {\n if (typeof key2 === \"string\")\n return key2 = Buffer.from(key2, \"utf8\"), KeyObject.from(createPublicKey({ key: key2, format: \"pem\" }));\n else if (isAnyArrayBuffer(key2) || isArrayBufferView(key2))\n return KeyObject.from(createPublicKey({ key: key2, format: \"pem\" }));\n else if (typeof key2 === \"object\")\n if (key2 instanceof KeyObject || key2 instanceof CryptoKey) {\n if (key2.type === \"private\")\n return KeyObject.from(createPublicKey({ key: key2[kCryptoKey] || key2, format: \"\" }));\n const error2 = @makeTypeError(`ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE: Invalid key object type ${key2.type}, expected private`);\n throw error2.code = \"ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE\", error2;\n } else {\n if (key2.passphrase) {\n let actual_key2 = key2.key;\n if (typeof actual_key2 === \"string\")\n actual_key2 = Buffer.from(actual_key2, key2.encoding || \"utf8\");\n return KeyObject.from(createPublicKey({\n key: createPrivateKey({ key: actual_key2, format: key2.format, passphrase: key2.passphrase }),\n format: \"\"\n }));\n }\n let actual_key = key2.key;\n if (typeof actual_key === \"string\")\n actual_key = Buffer.from(actual_key, key2.encoding || \"utf8\"), key2.key = actual_key;\n else if (actual_key instanceof KeyObject || actual_key instanceof CryptoKey) {\n if (actual_key.type === \"private\")\n return KeyObject.from(createPublicKey({ key: actual_key[kCryptoKey] || actual_key, format: \"\" }));\n const error2 = @makeTypeError(`ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE: Invalid key object type ${actual_key.type}, expected private`);\n throw error2.code = \"ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE\", error2;\n }\n if (!isAnyArrayBuffer(actual_key) && !isArrayBufferView(actual_key) && typeof actual_key !== \"object\") {\n var error = @makeTypeError('ERR_INVALID_ARG_TYPE: The \"key\" argument must be of type string or an instance of ArrayBuffer, Buffer, TypedArray, DataView or object. Received ' + key2);\n throw error.code = \"ERR_INVALID_ARG_TYPE\", error;\n }\n if (!key2.format)\n key2.format = \"pem\";\n return KeyObject.from(createPublicKey(key2));\n }\n else {\n var error = @makeTypeError('ERR_INVALID_ARG_TYPE: The \"key\" argument must be of type string or an instance of ArrayBuffer, Buffer, TypedArray, DataView or object. Received ' + key2);\n throw error.code = \"ERR_INVALID_ARG_TYPE\", error;\n }\n}, $, __defProp = Object.defineProperty, __getOwnPropNames = Object.getOwnPropertyNames, StreamModule = @getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39), BufferModule = @requireNativeModule(\"buffer\"), StringDecoder = @requireNativeModule(\"string_decoder\").StringDecoder, MAX_STRING_LENGTH = 536870888, Buffer = globalThis.Buffer, EMPTY_BUFFER = Buffer.alloc(0), { isAnyArrayBuffer, isArrayBufferView } = @requireNativeModule(\"util/types\"), crypto = globalThis.crypto, globalCrypto = crypto, __commonJS = (cb, mod) => function() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n}, __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: !0 });\n}, require_safe_buffer = __commonJS({\n \"node_modules/safe-buffer/index.js\"(exports, module) {\n var buffer = BufferModule, Buffer2 = buffer.Buffer;\n function copyProps(src, dst) {\n for (var key2 in src)\n dst[key2] = src[key2];\n }\n Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow \? module.exports = buffer : (copyProps(buffer, exports), exports.Buffer = SafeBuffer);\n function SafeBuffer(arg, encodingOrOffset, length) {\n return Buffer2(arg, encodingOrOffset, length);\n }\n SafeBuffer.prototype = Object.create(Buffer2.prototype), copyProps(Buffer2, SafeBuffer), SafeBuffer.from = function(arg, encodingOrOffset, length) {\n if (typeof arg == \"number\")\n @throwTypeError(\"Argument must not be a number\");\n return Buffer2(arg, encodingOrOffset, length);\n }, SafeBuffer.alloc = function(size, fill, encoding) {\n if (typeof size != \"number\")\n @throwTypeError(\"Argument must be a number\");\n var buf = Buffer2(size);\n return fill !== void 0 \? typeof encoding == \"string\" \? buf.fill(fill, encoding) : buf.fill(fill) : buf.fill(0), buf;\n }, SafeBuffer.allocUnsafe = function(size) {\n if (typeof size != \"number\")\n @throwTypeError(\"Argument must be a number\");\n return Buffer2(size);\n }, SafeBuffer.allocUnsafeSlow = function(size) {\n if (typeof size != \"number\")\n @throwTypeError(\"Argument must be a number\");\n return buffer.SlowBuffer(size);\n };\n }\n}), require_browser = __commonJS({\n \"node_modules/randombytes/browser.js\"(exports, module) {\n var MAX_BYTES = 65536, MAX_UINT32 = 4294967295;\n function oldBrowser() {\n throw new Error(`Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11`);\n }\n var Buffer2 = require_safe_buffer().Buffer, crypto2 = globalCrypto;\n crypto2 && crypto2.getRandomValues \? module.exports = randomBytes : module.exports = oldBrowser;\n function randomBytes(size, cb) {\n if (size > MAX_UINT32)\n @throwRangeError(\"requested too many random bytes\");\n var bytes = Buffer2.allocUnsafe(size);\n if (size > 0)\n if (size > MAX_BYTES)\n for (var generated = 0;generated < size; generated += MAX_BYTES)\n crypto2.getRandomValues(bytes.slice(generated, generated + MAX_BYTES));\n else\n crypto2.getRandomValues(bytes);\n return typeof cb == \"function\" \? process.nextTick(function() {\n cb(null, bytes);\n }) : bytes;\n }\n }\n}), require_inherits_browser = __commonJS({\n \"node_modules/inherits/inherits_browser.js\"(exports, module) {\n module.exports = function(ctor, superCtor) {\n superCtor && (ctor.super_ = superCtor, ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: !1,\n writable: !0,\n configurable: !0\n }\n }));\n };\n }\n}), require_hash_base = __commonJS({\n \"node_modules/hash-base/index.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer, inherits = require_inherits_browser();\n function throwIfNotStringOrBuffer(val, prefix) {\n if (!Buffer2.isBuffer(val) && typeof val != \"string\")\n @throwTypeError(prefix + \" must be a string or a buffer\");\n }\n function HashBase(blockSize) {\n StreamModule.Transform.@call(this), this._block = Buffer2.allocUnsafe(blockSize), this._blockSize = blockSize, this._blockOffset = 0, this._length = [0, 0, 0, 0], this._finalized = !1;\n }\n inherits(HashBase, StreamModule.Transform), HashBase.prototype._transform = function(chunk, encoding, callback) {\n var error = null;\n try {\n this.update(chunk, encoding);\n } catch (err) {\n error = err;\n }\n callback(error);\n }, HashBase.prototype._flush = function(callback) {\n var error = null;\n try {\n this.push(this.digest());\n } catch (err) {\n error = err;\n }\n callback(error);\n }, HashBase.prototype.update = function(data, encoding) {\n if (throwIfNotStringOrBuffer(data, \"Data\"), this._finalized)\n throw new Error(\"Digest already called\");\n Buffer2.isBuffer(data) || (data = Buffer2.from(data, encoding));\n for (var block = this._block, offset = 0;this._blockOffset + data.length - offset >= this._blockSize; ) {\n for (var i = this._blockOffset;i < this._blockSize; )\n block[i++] = data[offset++];\n this._update(), this._blockOffset = 0;\n }\n for (;offset < data.length; )\n block[this._blockOffset++] = data[offset++];\n for (var j = 0, carry = data.length * 8;carry > 0; ++j)\n this._length[j] += carry, carry = this._length[j] / 4294967296 | 0, carry > 0 && (this._length[j] -= 4294967296 * carry);\n return this;\n }, HashBase.prototype._update = function() {\n throw new Error(\"_update is not implemented\");\n }, HashBase.prototype.digest = function(encoding) {\n if (this._finalized)\n throw new Error(\"Digest already called\");\n this._finalized = !0;\n var digest = this._digest();\n encoding !== void 0 && (digest = digest.toString(encoding)), this._block.fill(0), this._blockOffset = 0;\n for (var i = 0;i < 4; ++i)\n this._length[i] = 0;\n return digest;\n }, HashBase.prototype._digest = function() {\n throw new Error(\"_digest is not implemented\");\n }, module.exports = HashBase;\n }\n}), require_md5 = __commonJS({\n \"node_modules/md5.js/index.js\"(exports, module) {\n var inherits = require_inherits_browser(), HashBase = require_hash_base(), Buffer2 = require_safe_buffer().Buffer, ARRAY16 = new @Array(16);\n function MD5() {\n HashBase.@call(this, 64), this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878;\n }\n inherits(MD5, HashBase), MD5.prototype._update = function() {\n for (var M = ARRAY16, i = 0;i < 16; ++i)\n M[i] = this._block.readInt32LE(i * 4);\n var a = this._a, b = this._b, c = this._c, d = this._d;\n a = fnF(a, b, c, d, M[0], 3614090360, 7), d = fnF(d, a, b, c, M[1], 3905402710, 12), c = fnF(c, d, a, b, M[2], 606105819, 17), b = fnF(b, c, d, a, M[3], 3250441966, 22), a = fnF(a, b, c, d, M[4], 4118548399, 7), d = fnF(d, a, b, c, M[5], 1200080426, 12), c = fnF(c, d, a, b, M[6], 2821735955, 17), b = fnF(b, c, d, a, M[7], 4249261313, 22), a = fnF(a, b, c, d, M[8], 1770035416, 7), d = fnF(d, a, b, c, M[9], 2336552879, 12), c = fnF(c, d, a, b, M[10], 4294925233, 17), b = fnF(b, c, d, a, M[11], 2304563134, 22), a = fnF(a, b, c, d, M[12], 1804603682, 7), d = fnF(d, a, b, c, M[13], 4254626195, 12), c = fnF(c, d, a, b, M[14], 2792965006, 17), b = fnF(b, c, d, a, M[15], 1236535329, 22), a = fnG(a, b, c, d, M[1], 4129170786, 5), d = fnG(d, a, b, c, M[6], 3225465664, 9), c = fnG(c, d, a, b, M[11], 643717713, 14), b = fnG(b, c, d, a, M[0], 3921069994, 20), a = fnG(a, b, c, d, M[5], 3593408605, 5), d = fnG(d, a, b, c, M[10], 38016083, 9), c = fnG(c, d, a, b, M[15], 3634488961, 14), b = fnG(b, c, d, a, M[4], 3889429448, 20), a = fnG(a, b, c, d, M[9], 568446438, 5), d = fnG(d, a, b, c, M[14], 3275163606, 9), c = fnG(c, d, a, b, M[3], 4107603335, 14), b = fnG(b, c, d, a, M[8], 1163531501, 20), a = fnG(a, b, c, d, M[13], 2850285829, 5), d = fnG(d, a, b, c, M[2], 4243563512, 9), c = fnG(c, d, a, b, M[7], 1735328473, 14), b = fnG(b, c, d, a, M[12], 2368359562, 20), a = fnH(a, b, c, d, M[5], 4294588738, 4), d = fnH(d, a, b, c, M[8], 2272392833, 11), c = fnH(c, d, a, b, M[11], 1839030562, 16), b = fnH(b, c, d, a, M[14], 4259657740, 23), a = fnH(a, b, c, d, M[1], 2763975236, 4), d = fnH(d, a, b, c, M[4], 1272893353, 11), c = fnH(c, d, a, b, M[7], 4139469664, 16), b = fnH(b, c, d, a, M[10], 3200236656, 23), a = fnH(a, b, c, d, M[13], 681279174, 4), d = fnH(d, a, b, c, M[0], 3936430074, 11), c = fnH(c, d, a, b, M[3], 3572445317, 16), b = fnH(b, c, d, a, M[6], 76029189, 23), a = fnH(a, b, c, d, M[9], 3654602809, 4), d = fnH(d, a, b, c, M[12], 3873151461, 11), c = fnH(c, d, a, b, M[15], 530742520, 16), b = fnH(b, c, d, a, M[2], 3299628645, 23), a = fnI(a, b, c, d, M[0], 4096336452, 6), d = fnI(d, a, b, c, M[7], 1126891415, 10), c = fnI(c, d, a, b, M[14], 2878612391, 15), b = fnI(b, c, d, a, M[5], 4237533241, 21), a = fnI(a, b, c, d, M[12], 1700485571, 6), d = fnI(d, a, b, c, M[3], 2399980690, 10), c = fnI(c, d, a, b, M[10], 4293915773, 15), b = fnI(b, c, d, a, M[1], 2240044497, 21), a = fnI(a, b, c, d, M[8], 1873313359, 6), d = fnI(d, a, b, c, M[15], 4264355552, 10), c = fnI(c, d, a, b, M[6], 2734768916, 15), b = fnI(b, c, d, a, M[13], 1309151649, 21), a = fnI(a, b, c, d, M[4], 4149444226, 6), d = fnI(d, a, b, c, M[11], 3174756917, 10), c = fnI(c, d, a, b, M[2], 718787259, 15), b = fnI(b, c, d, a, M[9], 3951481745, 21), this._a = this._a + a | 0, this._b = this._b + b | 0, this._c = this._c + c | 0, this._d = this._d + d | 0;\n }, MD5.prototype._digest = function() {\n this._block[this._blockOffset++] = 128, this._blockOffset > 56 && (this._block.fill(0, this._blockOffset, 64), this._update(), this._blockOffset = 0), this._block.fill(0, this._blockOffset, 56), this._block.writeUInt32LE(this._length[0], 56), this._block.writeUInt32LE(this._length[1], 60), this._update();\n var buffer = Buffer2.allocUnsafe(16);\n return buffer.writeInt32LE(this._a, 0), buffer.writeInt32LE(this._b, 4), buffer.writeInt32LE(this._c, 8), buffer.writeInt32LE(this._d, 12), buffer;\n };\n function rotl(x, n) {\n return x << n | x >>> 32 - n;\n }\n function fnF(a, b, c, d, m, k, s) {\n return rotl(a + (b & c | ~b & d) + m + k | 0, s) + b | 0;\n }\n function fnG(a, b, c, d, m, k, s) {\n return rotl(a + (b & d | c & ~d) + m + k | 0, s) + b | 0;\n }\n function fnH(a, b, c, d, m, k, s) {\n return rotl(a + (b ^ c ^ d) + m + k | 0, s) + b | 0;\n }\n function fnI(a, b, c, d, m, k, s) {\n return rotl(a + (c ^ (b | ~d)) + m + k | 0, s) + b | 0;\n }\n module.exports = MD5;\n }\n}), require_ripemd160 = __commonJS({\n \"node_modules/ripemd160/index.js\"(exports, module) {\n var Buffer2 = Buffer, inherits = require_inherits_browser(), HashBase = require_hash_base(), ARRAY16 = new @Array(16), zl = [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 7,\n 4,\n 13,\n 1,\n 10,\n 6,\n 15,\n 3,\n 12,\n 0,\n 9,\n 5,\n 2,\n 14,\n 11,\n 8,\n 3,\n 10,\n 14,\n 4,\n 9,\n 15,\n 8,\n 1,\n 2,\n 7,\n 0,\n 6,\n 13,\n 11,\n 5,\n 12,\n 1,\n 9,\n 11,\n 10,\n 0,\n 8,\n 12,\n 4,\n 13,\n 3,\n 7,\n 15,\n 14,\n 5,\n 6,\n 2,\n 4,\n 0,\n 5,\n 9,\n 7,\n 12,\n 2,\n 10,\n 14,\n 1,\n 3,\n 8,\n 11,\n 6,\n 15,\n 13\n ], zr = [\n 5,\n 14,\n 7,\n 0,\n 9,\n 2,\n 11,\n 4,\n 13,\n 6,\n 15,\n 8,\n 1,\n 10,\n 3,\n 12,\n 6,\n 11,\n 3,\n 7,\n 0,\n 13,\n 5,\n 10,\n 14,\n 15,\n 8,\n 12,\n 4,\n 9,\n 1,\n 2,\n 15,\n 5,\n 1,\n 3,\n 7,\n 14,\n 6,\n 9,\n 11,\n 8,\n 12,\n 2,\n 10,\n 0,\n 4,\n 13,\n 8,\n 6,\n 4,\n 1,\n 3,\n 11,\n 15,\n 0,\n 5,\n 12,\n 2,\n 13,\n 9,\n 7,\n 10,\n 14,\n 12,\n 15,\n 10,\n 4,\n 1,\n 5,\n 8,\n 7,\n 6,\n 2,\n 13,\n 14,\n 0,\n 3,\n 9,\n 11\n ], sl = [\n 11,\n 14,\n 15,\n 12,\n 5,\n 8,\n 7,\n 9,\n 11,\n 13,\n 14,\n 15,\n 6,\n 7,\n 9,\n 8,\n 7,\n 6,\n 8,\n 13,\n 11,\n 9,\n 7,\n 15,\n 7,\n 12,\n 15,\n 9,\n 11,\n 7,\n 13,\n 12,\n 11,\n 13,\n 6,\n 7,\n 14,\n 9,\n 13,\n 15,\n 14,\n 8,\n 13,\n 6,\n 5,\n 12,\n 7,\n 5,\n 11,\n 12,\n 14,\n 15,\n 14,\n 15,\n 9,\n 8,\n 9,\n 14,\n 5,\n 6,\n 8,\n 6,\n 5,\n 12,\n 9,\n 15,\n 5,\n 11,\n 6,\n 8,\n 13,\n 12,\n 5,\n 12,\n 13,\n 14,\n 11,\n 8,\n 5,\n 6\n ], sr = [\n 8,\n 9,\n 9,\n 11,\n 13,\n 15,\n 15,\n 5,\n 7,\n 7,\n 8,\n 11,\n 14,\n 14,\n 12,\n 6,\n 9,\n 13,\n 15,\n 7,\n 12,\n 8,\n 9,\n 11,\n 7,\n 7,\n 12,\n 7,\n 6,\n 15,\n 13,\n 11,\n 9,\n 7,\n 15,\n 11,\n 8,\n 6,\n 6,\n 14,\n 12,\n 13,\n 5,\n 14,\n 13,\n 13,\n 7,\n 5,\n 15,\n 5,\n 8,\n 11,\n 14,\n 14,\n 6,\n 14,\n 6,\n 9,\n 12,\n 9,\n 12,\n 5,\n 15,\n 8,\n 8,\n 5,\n 12,\n 9,\n 12,\n 5,\n 14,\n 6,\n 8,\n 13,\n 6,\n 5,\n 15,\n 13,\n 11,\n 11\n ], hl = [0, 1518500249, 1859775393, 2400959708, 2840853838], hr = [1352829926, 1548603684, 1836072691, 2053994217, 0];\n function RIPEMD160() {\n HashBase.@call(this, 64), this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520;\n }\n inherits(RIPEMD160, HashBase), RIPEMD160.prototype._update = function() {\n for (var words = ARRAY16, j = 0;j < 16; ++j)\n words[j] = this._block.readInt32LE(j * 4);\n for (var al = this._a | 0, bl = this._b | 0, cl = this._c | 0, dl = this._d | 0, el = this._e | 0, ar = this._a | 0, br = this._b | 0, cr = this._c | 0, dr = this._d | 0, er = this._e | 0, i = 0;i < 80; i += 1) {\n var tl, tr;\n i < 16 \? (tl = fn1(al, bl, cl, dl, el, words[zl[i]], hl[0], sl[i]), tr = fn5(ar, br, cr, dr, er, words[zr[i]], hr[0], sr[i])) : i < 32 \? (tl = fn2(al, bl, cl, dl, el, words[zl[i]], hl[1], sl[i]), tr = fn4(ar, br, cr, dr, er, words[zr[i]], hr[1], sr[i])) : i < 48 \? (tl = fn3(al, bl, cl, dl, el, words[zl[i]], hl[2], sl[i]), tr = fn3(ar, br, cr, dr, er, words[zr[i]], hr[2], sr[i])) : i < 64 \? (tl = fn4(al, bl, cl, dl, el, words[zl[i]], hl[3], sl[i]), tr = fn2(ar, br, cr, dr, er, words[zr[i]], hr[3], sr[i])) : (tl = fn5(al, bl, cl, dl, el, words[zl[i]], hl[4], sl[i]), tr = fn1(ar, br, cr, dr, er, words[zr[i]], hr[4], sr[i])), al = el, el = dl, dl = rotl(cl, 10), cl = bl, bl = tl, ar = er, er = dr, dr = rotl(cr, 10), cr = br, br = tr;\n }\n var t = this._b + cl + dr | 0;\n this._b = this._c + dl + er | 0, this._c = this._d + el + ar | 0, this._d = this._e + al + br | 0, this._e = this._a + bl + cr | 0, this._a = t;\n }, RIPEMD160.prototype._digest = function() {\n this._block[this._blockOffset++] = 128, this._blockOffset > 56 && (this._block.fill(0, this._blockOffset, 64), this._update(), this._blockOffset = 0), this._block.fill(0, this._blockOffset, 56), this._block.writeUInt32LE(this._length[0], 56), this._block.writeUInt32LE(this._length[1], 60), this._update();\n var buffer = Buffer2.alloc \? Buffer2.alloc(20) : new Buffer2(20);\n return buffer.writeInt32LE(this._a, 0), buffer.writeInt32LE(this._b, 4), buffer.writeInt32LE(this._c, 8), buffer.writeInt32LE(this._d, 12), buffer.writeInt32LE(this._e, 16), buffer;\n };\n function rotl(x, n) {\n return x << n | x >>> 32 - n;\n }\n function fn1(a, b, c, d, e, m, k, s) {\n return rotl(a + (b ^ c ^ d) + m + k | 0, s) + e | 0;\n }\n function fn2(a, b, c, d, e, m, k, s) {\n return rotl(a + (b & c | ~b & d) + m + k | 0, s) + e | 0;\n }\n function fn3(a, b, c, d, e, m, k, s) {\n return rotl(a + ((b | ~c) ^ d) + m + k | 0, s) + e | 0;\n }\n function fn4(a, b, c, d, e, m, k, s) {\n return rotl(a + (b & d | c & ~d) + m + k | 0, s) + e | 0;\n }\n function fn5(a, b, c, d, e, m, k, s) {\n return rotl(a + (b ^ (c | ~d)) + m + k | 0, s) + e | 0;\n }\n module.exports = RIPEMD160;\n }\n}), require_hash = __commonJS({\n \"node_modules/sha.js/hash.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer;\n function Hash(blockSize, finalSize) {\n this._block = Buffer2.alloc(blockSize), this._finalSize = finalSize, this._blockSize = blockSize, this._len = 0;\n }\n Hash.prototype = {}, Hash.prototype.update = function(data, enc) {\n typeof data == \"string\" && (enc = enc || \"utf8\", data = Buffer2.from(data, enc));\n for (var block = this._block, blockSize = this._blockSize, length = data.length, accum = this._len, offset = 0;offset < length; ) {\n for (var assigned = accum % blockSize, remainder = Math.min(length - offset, blockSize - assigned), i = 0;i < remainder; i++)\n block[assigned + i] = data[offset + i];\n accum += remainder, offset += remainder, accum % blockSize === 0 && this._update(block);\n }\n return this._len += length, this;\n }, Hash.prototype.digest = function(enc) {\n var rem = this._len % this._blockSize;\n this._block[rem] = 128, this._block.fill(0, rem + 1), rem >= this._finalSize && (this._update(this._block), this._block.fill(0));\n var bits = this._len * 8;\n if (bits <= 4294967295)\n this._block.writeUInt32BE(bits, this._blockSize - 4);\n else {\n var lowBits = (bits & 4294967295) >>> 0, highBits = (bits - lowBits) / 4294967296;\n this._block.writeUInt32BE(highBits, this._blockSize - 8), this._block.writeUInt32BE(lowBits, this._blockSize - 4);\n }\n this._update(this._block);\n var hash = this._hash();\n return enc \? hash.toString(enc) : hash;\n }, Hash.prototype._update = function() {\n throw new Error(\"_update must be implemented by subclass\");\n }, module.exports = Hash;\n }\n}), require_sha = __commonJS({\n \"node_modules/sha.js/sha.js\"(exports, module) {\n var inherits = require_inherits_browser(), Hash = require_hash(), Buffer2 = require_safe_buffer().Buffer, K = [1518500249, 1859775393, -1894007588, -899497514], W = new @Array(80);\n function Sha() {\n this.init(), this._w = W, Hash.@call(this, 64, 56);\n }\n inherits(Sha, Hash), Sha.prototype.init = function() {\n return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520, this;\n };\n function rotl5(num) {\n return num << 5 | num >>> 27;\n }\n function rotl30(num) {\n return num << 30 | num >>> 2;\n }\n function ft(s, b, c, d) {\n return s === 0 \? b & c | ~b & d : s === 2 \? b & c | b & d | c & d : b ^ c ^ d;\n }\n Sha.prototype._update = function(M) {\n for (var W2 = this._w, a = this._a | 0, b = this._b | 0, c = this._c | 0, d = this._d | 0, e = this._e | 0, i = 0;i < 16; ++i)\n W2[i] = M.readInt32BE(i * 4);\n for (;i < 80; ++i)\n W2[i] = W2[i - 3] ^ W2[i - 8] ^ W2[i - 14] ^ W2[i - 16];\n for (var j = 0;j < 80; ++j) {\n var s = ~~(j / 20), t = rotl5(a) + ft(s, b, c, d) + e + W2[j] + K[s] | 0;\n e = d, d = c, c = rotl30(b), b = a, a = t;\n }\n this._a = a + this._a | 0, this._b = b + this._b | 0, this._c = c + this._c | 0, this._d = d + this._d | 0, this._e = e + this._e | 0;\n }, Sha.prototype._hash = function() {\n var H = Buffer2.allocUnsafe(20);\n return H.writeInt32BE(this._a | 0, 0), H.writeInt32BE(this._b | 0, 4), H.writeInt32BE(this._c | 0, 8), H.writeInt32BE(this._d | 0, 12), H.writeInt32BE(this._e | 0, 16), H;\n }, module.exports = Sha;\n }\n}), require_sha1 = __commonJS({\n \"node_modules/sha.js/sha1.js\"(exports, module) {\n var inherits = require_inherits_browser(), Hash = require_hash(), Buffer2 = require_safe_buffer().Buffer, K = [1518500249, 1859775393, -1894007588, -899497514], W = new @Array(80);\n function Sha1() {\n this.init(), this._w = W, Hash.@call(this, 64, 56);\n }\n inherits(Sha1, Hash), Sha1.prototype.init = function() {\n return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520, this;\n };\n function rotl1(num) {\n return num << 1 | num >>> 31;\n }\n function rotl5(num) {\n return num << 5 | num >>> 27;\n }\n function rotl30(num) {\n return num << 30 | num >>> 2;\n }\n function ft(s, b, c, d) {\n return s === 0 \? b & c | ~b & d : s === 2 \? b & c | b & d | c & d : b ^ c ^ d;\n }\n Sha1.prototype._update = function(M) {\n for (var W2 = this._w, a = this._a | 0, b = this._b | 0, c = this._c | 0, d = this._d | 0, e = this._e | 0, i = 0;i < 16; ++i)\n W2[i] = M.readInt32BE(i * 4);\n for (;i < 80; ++i)\n W2[i] = rotl1(W2[i - 3] ^ W2[i - 8] ^ W2[i - 14] ^ W2[i - 16]);\n for (var j = 0;j < 80; ++j) {\n var s = ~~(j / 20), t = rotl5(a) + ft(s, b, c, d) + e + W2[j] + K[s] | 0;\n e = d, d = c, c = rotl30(b), b = a, a = t;\n }\n this._a = a + this._a | 0, this._b = b + this._b | 0, this._c = c + this._c | 0, this._d = d + this._d | 0, this._e = e + this._e | 0;\n }, Sha1.prototype._hash = function() {\n var H = Buffer2.allocUnsafe(20);\n return H.writeInt32BE(this._a | 0, 0), H.writeInt32BE(this._b | 0, 4), H.writeInt32BE(this._c | 0, 8), H.writeInt32BE(this._d | 0, 12), H.writeInt32BE(this._e | 0, 16), H;\n }, module.exports = Sha1;\n }\n}), require_sha256 = __commonJS({\n \"node_modules/sha.js/sha256.js\"(exports, module) {\n var inherits = require_inherits_browser(), Hash = require_hash(), Buffer2 = require_safe_buffer().Buffer, K = [\n 1116352408,\n 1899447441,\n 3049323471,\n 3921009573,\n 961987163,\n 1508970993,\n 2453635748,\n 2870763221,\n 3624381080,\n 310598401,\n 607225278,\n 1426881987,\n 1925078388,\n 2162078206,\n 2614888103,\n 3248222580,\n 3835390401,\n 4022224774,\n 264347078,\n 604807628,\n 770255983,\n 1249150122,\n 1555081692,\n 1996064986,\n 2554220882,\n 2821834349,\n 2952996808,\n 3210313671,\n 3336571891,\n 3584528711,\n 113926993,\n 338241895,\n 666307205,\n 773529912,\n 1294757372,\n 1396182291,\n 1695183700,\n 1986661051,\n 2177026350,\n 2456956037,\n 2730485921,\n 2820302411,\n 3259730800,\n 3345764771,\n 3516065817,\n 3600352804,\n 4094571909,\n 275423344,\n 430227734,\n 506948616,\n 659060556,\n 883997877,\n 958139571,\n 1322822218,\n 1537002063,\n 1747873779,\n 1955562222,\n 2024104815,\n 2227730452,\n 2361852424,\n 2428436474,\n 2756734187,\n 3204031479,\n 3329325298\n ], W = new @Array(64);\n function Sha256() {\n this.init(), this._w = W, Hash.@call(this, 64, 56);\n }\n inherits(Sha256, Hash), Sha256.prototype.init = function() {\n return this._a = 1779033703, this._b = 3144134277, this._c = 1013904242, this._d = 2773480762, this._e = 1359893119, this._f = 2600822924, this._g = 528734635, this._h = 1541459225, this;\n };\n function ch(x, y, z) {\n return z ^ x & (y ^ z);\n }\n function maj(x, y, z) {\n return x & y | z & (x | y);\n }\n function sigma0(x) {\n return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10);\n }\n function sigma1(x) {\n return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7);\n }\n function gamma0(x) {\n return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ x >>> 3;\n }\n function gamma1(x) {\n return (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ x >>> 10;\n }\n Sha256.prototype._update = function(M) {\n for (var W2 = this._w, a = this._a | 0, b = this._b | 0, c = this._c | 0, d = this._d | 0, e = this._e | 0, f = this._f | 0, g = this._g | 0, h = this._h | 0, i = 0;i < 16; ++i)\n W2[i] = M.readInt32BE(i * 4);\n for (;i < 64; ++i)\n W2[i] = gamma1(W2[i - 2]) + W2[i - 7] + gamma0(W2[i - 15]) + W2[i - 16] | 0;\n for (var j = 0;j < 64; ++j) {\n var T1 = h + sigma1(e) + ch(e, f, g) + K[j] + W2[j] | 0, T2 = sigma0(a) + maj(a, b, c) | 0;\n h = g, g = f, f = e, e = d + T1 | 0, d = c, c = b, b = a, a = T1 + T2 | 0;\n }\n this._a = a + this._a | 0, this._b = b + this._b | 0, this._c = c + this._c | 0, this._d = d + this._d | 0, this._e = e + this._e | 0, this._f = f + this._f | 0, this._g = g + this._g | 0, this._h = h + this._h | 0;\n }, Sha256.prototype._hash = function() {\n var H = Buffer2.allocUnsafe(32);\n return H.writeInt32BE(this._a, 0), H.writeInt32BE(this._b, 4), H.writeInt32BE(this._c, 8), H.writeInt32BE(this._d, 12), H.writeInt32BE(this._e, 16), H.writeInt32BE(this._f, 20), H.writeInt32BE(this._g, 24), H.writeInt32BE(this._h, 28), H;\n }, module.exports = Sha256;\n }\n}), require_sha224 = __commonJS({\n \"node_modules/sha.js/sha224.js\"(exports, module) {\n var inherits = require_inherits_browser(), Sha256 = require_sha256(), Hash = require_hash(), Buffer2 = require_safe_buffer().Buffer, W = new @Array(64);\n function Sha224() {\n this.init(), this._w = W, Hash.@call(this, 64, 56);\n }\n inherits(Sha224, Sha256), Sha224.prototype.init = function() {\n return this._a = 3238371032, this._b = 914150663, this._c = 812702999, this._d = 4144912697, this._e = 4290775857, this._f = 1750603025, this._g = 1694076839, this._h = 3204075428, this;\n }, Sha224.prototype._hash = function() {\n var H = Buffer2.allocUnsafe(28);\n return H.writeInt32BE(this._a, 0), H.writeInt32BE(this._b, 4), H.writeInt32BE(this._c, 8), H.writeInt32BE(this._d, 12), H.writeInt32BE(this._e, 16), H.writeInt32BE(this._f, 20), H.writeInt32BE(this._g, 24), H;\n }, module.exports = Sha224;\n }\n}), require_sha512 = __commonJS({\n \"node_modules/sha.js/sha512.js\"(exports, module) {\n var inherits = require_inherits_browser(), Hash = require_hash(), Buffer2 = require_safe_buffer().Buffer, K = [\n 1116352408,\n 3609767458,\n 1899447441,\n 602891725,\n 3049323471,\n 3964484399,\n 3921009573,\n 2173295548,\n 961987163,\n 4081628472,\n 1508970993,\n 3053834265,\n 2453635748,\n 2937671579,\n 2870763221,\n 3664609560,\n 3624381080,\n 2734883394,\n 310598401,\n 1164996542,\n 607225278,\n 1323610764,\n 1426881987,\n 3590304994,\n 1925078388,\n 4068182383,\n 2162078206,\n 991336113,\n 2614888103,\n 633803317,\n 3248222580,\n 3479774868,\n 3835390401,\n 2666613458,\n 4022224774,\n 944711139,\n 264347078,\n 2341262773,\n 604807628,\n 2007800933,\n 770255983,\n 1495990901,\n 1249150122,\n 1856431235,\n 1555081692,\n 3175218132,\n 1996064986,\n 2198950837,\n 2554220882,\n 3999719339,\n 2821834349,\n 766784016,\n 2952996808,\n 2566594879,\n 3210313671,\n 3203337956,\n 3336571891,\n 1034457026,\n 3584528711,\n 2466948901,\n 113926993,\n 3758326383,\n 338241895,\n 168717936,\n 666307205,\n 1188179964,\n 773529912,\n 1546045734,\n 1294757372,\n 1522805485,\n 1396182291,\n 2643833823,\n 1695183700,\n 2343527390,\n 1986661051,\n 1014477480,\n 2177026350,\n 1206759142,\n 2456956037,\n 344077627,\n 2730485921,\n 1290863460,\n 2820302411,\n 3158454273,\n 3259730800,\n 3505952657,\n 3345764771,\n 106217008,\n 3516065817,\n 3606008344,\n 3600352804,\n 1432725776,\n 4094571909,\n 1467031594,\n 275423344,\n 851169720,\n 430227734,\n 3100823752,\n 506948616,\n 1363258195,\n 659060556,\n 3750685593,\n 883997877,\n 3785050280,\n 958139571,\n 3318307427,\n 1322822218,\n 3812723403,\n 1537002063,\n 2003034995,\n 1747873779,\n 3602036899,\n 1955562222,\n 1575990012,\n 2024104815,\n 1125592928,\n 2227730452,\n 2716904306,\n 2361852424,\n 442776044,\n 2428436474,\n 593698344,\n 2756734187,\n 3733110249,\n 3204031479,\n 2999351573,\n 3329325298,\n 3815920427,\n 3391569614,\n 3928383900,\n 3515267271,\n 566280711,\n 3940187606,\n 3454069534,\n 4118630271,\n 4000239992,\n 116418474,\n 1914138554,\n 174292421,\n 2731055270,\n 289380356,\n 3203993006,\n 460393269,\n 320620315,\n 685471733,\n 587496836,\n 852142971,\n 1086792851,\n 1017036298,\n 365543100,\n 1126000580,\n 2618297676,\n 1288033470,\n 3409855158,\n 1501505948,\n 4234509866,\n 1607167915,\n 987167468,\n 1816402316,\n 1246189591\n ], W = new @Array(160);\n function Sha512() {\n this.init(), this._w = W, Hash.@call(this, 128, 112);\n }\n inherits(Sha512, Hash), Sha512.prototype.init = function() {\n return this._ah = 1779033703, this._bh = 3144134277, this._ch = 1013904242, this._dh = 2773480762, this._eh = 1359893119, this._fh = 2600822924, this._gh = 528734635, this._hh = 1541459225, this._al = 4089235720, this._bl = 2227873595, this._cl = 4271175723, this._dl = 1595750129, this._el = 2917565137, this._fl = 725511199, this._gl = 4215389547, this._hl = 327033209, this;\n };\n function Ch(x, y, z) {\n return z ^ x & (y ^ z);\n }\n function maj(x, y, z) {\n return x & y | z & (x | y);\n }\n function sigma0(x, xl) {\n return (x >>> 28 | xl << 4) ^ (xl >>> 2 | x << 30) ^ (xl >>> 7 | x << 25);\n }\n function sigma1(x, xl) {\n return (x >>> 14 | xl << 18) ^ (x >>> 18 | xl << 14) ^ (xl >>> 9 | x << 23);\n }\n function Gamma0(x, xl) {\n return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ x >>> 7;\n }\n function Gamma0l(x, xl) {\n return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7 | xl << 25);\n }\n function Gamma1(x, xl) {\n return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ x >>> 6;\n }\n function Gamma1l(x, xl) {\n return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6 | xl << 26);\n }\n function getCarry(a, b) {\n return a >>> 0 < b >>> 0 \? 1 : 0;\n }\n Sha512.prototype._update = function(M) {\n for (var W2 = this._w, ah = this._ah | 0, bh = this._bh | 0, ch = this._ch | 0, dh = this._dh | 0, eh = this._eh | 0, fh = this._fh | 0, gh = this._gh | 0, hh = this._hh | 0, al = this._al | 0, bl = this._bl | 0, cl = this._cl | 0, dl = this._dl | 0, el = this._el | 0, fl = this._fl | 0, gl = this._gl | 0, hl = this._hl | 0, i = 0;i < 32; i += 2)\n W2[i] = M.readInt32BE(i * 4), W2[i + 1] = M.readInt32BE(i * 4 + 4);\n for (;i < 160; i += 2) {\n var xh = W2[i - 30], xl = W2[i - 30 + 1], gamma0 = Gamma0(xh, xl), gamma0l = Gamma0l(xl, xh);\n xh = W2[i - 4], xl = W2[i - 4 + 1];\n var gamma1 = Gamma1(xh, xl), gamma1l = Gamma1l(xl, xh), Wi7h = W2[i - 14], Wi7l = W2[i - 14 + 1], Wi16h = W2[i - 32], Wi16l = W2[i - 32 + 1], Wil = gamma0l + Wi7l | 0, Wih = gamma0 + Wi7h + getCarry(Wil, gamma0l) | 0;\n Wil = Wil + gamma1l | 0, Wih = Wih + gamma1 + getCarry(Wil, gamma1l) | 0, Wil = Wil + Wi16l | 0, Wih = Wih + Wi16h + getCarry(Wil, Wi16l) | 0, W2[i] = Wih, W2[i + 1] = Wil;\n }\n for (var j = 0;j < 160; j += 2) {\n Wih = W2[j], Wil = W2[j + 1];\n var majh = maj(ah, bh, ch), majl = maj(al, bl, cl), sigma0h = sigma0(ah, al), sigma0l = sigma0(al, ah), sigma1h = sigma1(eh, el), sigma1l = sigma1(el, eh), Kih = K[j], Kil = K[j + 1], chh = Ch(eh, fh, gh), chl = Ch(el, fl, gl), t1l = hl + sigma1l | 0, t1h = hh + sigma1h + getCarry(t1l, hl) | 0;\n t1l = t1l + chl | 0, t1h = t1h + chh + getCarry(t1l, chl) | 0, t1l = t1l + Kil | 0, t1h = t1h + Kih + getCarry(t1l, Kil) | 0, t1l = t1l + Wil | 0, t1h = t1h + Wih + getCarry(t1l, Wil) | 0;\n var t2l = sigma0l + majl | 0, t2h = sigma0h + majh + getCarry(t2l, sigma0l) | 0;\n hh = gh, hl = gl, gh = fh, gl = fl, fh = eh, fl = el, el = dl + t1l | 0, eh = dh + t1h + getCarry(el, dl) | 0, dh = ch, dl = cl, ch = bh, cl = bl, bh = ah, bl = al, al = t1l + t2l | 0, ah = t1h + t2h + getCarry(al, t1l) | 0;\n }\n this._al = this._al + al | 0, this._bl = this._bl + bl | 0, this._cl = this._cl + cl | 0, this._dl = this._dl + dl | 0, this._el = this._el + el | 0, this._fl = this._fl + fl | 0, this._gl = this._gl + gl | 0, this._hl = this._hl + hl | 0, this._ah = this._ah + ah + getCarry(this._al, al) | 0, this._bh = this._bh + bh + getCarry(this._bl, bl) | 0, this._ch = this._ch + ch + getCarry(this._cl, cl) | 0, this._dh = this._dh + dh + getCarry(this._dl, dl) | 0, this._eh = this._eh + eh + getCarry(this._el, el) | 0, this._fh = this._fh + fh + getCarry(this._fl, fl) | 0, this._gh = this._gh + gh + getCarry(this._gl, gl) | 0, this._hh = this._hh + hh + getCarry(this._hl, hl) | 0;\n }, Sha512.prototype._hash = function() {\n var H = Buffer2.allocUnsafe(64);\n function writeInt64BE(h, l, offset) {\n H.writeInt32BE(h, offset), H.writeInt32BE(l, offset + 4);\n }\n return writeInt64BE(this._ah, this._al, 0), writeInt64BE(this._bh, this._bl, 8), writeInt64BE(this._ch, this._cl, 16), writeInt64BE(this._dh, this._dl, 24), writeInt64BE(this._eh, this._el, 32), writeInt64BE(this._fh, this._fl, 40), writeInt64BE(this._gh, this._gl, 48), writeInt64BE(this._hh, this._hl, 56), H;\n }, module.exports = Sha512;\n }\n}), require_sha384 = __commonJS({\n \"node_modules/sha.js/sha384.js\"(exports, module) {\n var inherits = require_inherits_browser(), SHA512 = require_sha512(), Hash = require_hash(), Buffer2 = require_safe_buffer().Buffer, W = new @Array(160);\n function Sha384() {\n this.init(), this._w = W, Hash.@call(this, 128, 112);\n }\n inherits(Sha384, SHA512), Sha384.prototype.init = function() {\n return this._ah = 3418070365, this._bh = 1654270250, this._ch = 2438529370, this._dh = 355462360, this._eh = 1731405415, this._fh = 2394180231, this._gh = 3675008525, this._hh = 1203062813, this._al = 3238371032, this._bl = 914150663, this._cl = 812702999, this._dl = 4144912697, this._el = 4290775857, this._fl = 1750603025, this._gl = 1694076839, this._hl = 3204075428, this;\n }, Sha384.prototype._hash = function() {\n var H = Buffer2.allocUnsafe(48);\n function writeInt64BE(h, l, offset) {\n H.writeInt32BE(h, offset), H.writeInt32BE(l, offset + 4);\n }\n return writeInt64BE(this._ah, this._al, 0), writeInt64BE(this._bh, this._bl, 8), writeInt64BE(this._ch, this._cl, 16), writeInt64BE(this._dh, this._dl, 24), writeInt64BE(this._eh, this._el, 32), writeInt64BE(this._fh, this._fl, 40), H;\n }, module.exports = Sha384;\n }\n}), require_sha2 = __commonJS({\n \"node_modules/sha.js/index.js\"(exports, module) {\n var exports = module.exports = function(algorithm) {\n algorithm = algorithm.toLowerCase();\n var Algorithm = exports[algorithm];\n if (!Algorithm)\n throw new Error(algorithm + \" is not supported (we accept pull requests)\");\n return new Algorithm;\n };\n exports.sha = require_sha(), exports.sha1 = require_sha1(), exports.sha224 = require_sha224(), exports.sha256 = require_sha256(), exports.sha384 = require_sha384(), exports.sha512 = require_sha512();\n }\n}), require_cipher_base = __commonJS({\n \"node_modules/cipher-base/index.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer, inherits = require_inherits_browser();\n function CipherBase(hashMode) {\n StreamModule.Transform.@call(this), this.hashMode = typeof hashMode == \"string\", this.hashMode \? this[hashMode] = this._finalOrDigest : this.final = this._finalOrDigest, this._final && (this.__final = this._final, this._final = null), this._decoder = null, this._encoding = null, this._finalized = !1;\n }\n inherits(CipherBase, StreamModule.Transform), CipherBase.prototype.update = function(data, inputEnc, outputEnc) {\n if (outputEnc === \"buffer\")\n outputEnc = @undefined;\n typeof data == \"string\" && (data = Buffer2.from(data, inputEnc));\n var outData = this._update(data);\n return this.hashMode \? this : (outputEnc && (outData = this._toString(outData, outputEnc)), outData);\n }, CipherBase.prototype.setAutoPadding = function() {\n }, CipherBase.prototype.getAuthTag = function() {\n throw new Error(\"trying to get auth tag in unsupported state\");\n }, CipherBase.prototype.setAuthTag = function() {\n throw new Error(\"trying to set auth tag in unsupported state\");\n }, CipherBase.prototype.setAAD = function() {\n throw new Error(\"trying to set aad in unsupported state\");\n }, CipherBase.prototype._transform = function(data, _, next) {\n var err;\n try {\n this.hashMode \? this._update(data) : this.push(this._update(data));\n } catch (e) {\n err = e;\n } finally {\n next(err);\n }\n }, CipherBase.prototype._flush = function(done) {\n var err;\n try {\n this.push(this.__final());\n } catch (e) {\n err = e;\n }\n done(err);\n }, CipherBase.prototype._finalOrDigest = function(outputEnc) {\n if (outputEnc === \"buffer\")\n outputEnc = @undefined;\n if (this._finalized) {\n if (!this._encoding)\n return Buffer2.alloc(0);\n return \"\";\n }\n this._finalized = !0;\n var outData = this.__final() || Buffer2.alloc(0);\n return outputEnc && (outData = this._toString(outData, outputEnc, !0)), outData;\n }, CipherBase.prototype._toString = function(value, enc, fin) {\n if (this._decoder || (this._decoder = new StringDecoder(enc), this._encoding = enc), this._encoding !== enc)\n throw new Error(\"can't switch encodings\");\n var out = this._decoder.write(value);\n return fin && (out += this._decoder.end()), out;\n }, module.exports = CipherBase;\n }\n}), require_browser2 = __commonJS({\n \"node_modules/create-hash/browser.js\"(exports, module) {\n const LazyHash = function Hash(algorithm, options) {\n this._options = options, this._hasher = new CryptoHasher(algorithm, options), this._finalized = !1;\n };\n LazyHash.prototype = Object.create(StreamModule.Transform.prototype), LazyHash.prototype.update = function update(data, encoding) {\n return this._checkFinalized(), this._hasher.update(data, encoding), this;\n }, LazyHash.prototype.digest = function update(data, encoding) {\n return this._checkFinalized(), this._finalized = !0, this._hasher.digest(data, encoding);\n }, LazyHash.prototype._checkFinalized = function _checkFinalized() {\n if (this._finalized) {\n var err = new Error(\"Digest already called\");\n throw err.code = \"ERR_CRYPTO_HASH_FINALIZED\", err;\n }\n }, LazyHash.prototype.copy = function copy() {\n const copy = Object.create(LazyHash.prototype);\n return copy._options = this._options, copy._hasher = this._hasher.copy(), copy._finalized = this._finalized, copy;\n };\n const lazyHashFullInitProto = {\n __proto__: StreamModule.Transform.prototype,\n ...LazyHash.prototype,\n _transform(data, encoding, callback) {\n this.update(data, encoding), callback && callback();\n },\n _flush(callback) {\n this.push(this.digest()), callback();\n }\n }, triggerMethods = [\n \"_events\",\n \"_eventsCount\",\n \"_final\",\n \"_maxListeners\",\n \"_maxListeners\",\n \"_read\",\n \"_undestroy\",\n \"_writableState\",\n \"_write\",\n \"_writev\",\n \"addListener\",\n \"asIndexedPairs\",\n \"closed\",\n \"compose\",\n \"constructor\",\n \"cork\",\n \"destroy\",\n \"destroyed\",\n \"drop\",\n \"emit\",\n \"end\",\n \"errored\",\n \"eventNames\",\n \"every\",\n \"filter\",\n \"find\",\n \"flatMap\",\n \"forEach\",\n \"getMaxListeners\",\n \"hasOwnProperty\",\n \"isPaused\",\n \"isPrototypeOf\",\n \"iterator\",\n \"listenerCount\",\n \"listeners\",\n \"map\",\n \"off\",\n \"on\",\n \"once\",\n \"pause\",\n \"pipe\",\n \"prependListener\",\n \"prependOnceListener\",\n \"propertyIsEnumerable\",\n \"push\",\n \"rawListeners\",\n \"read\",\n \"readable\",\n \"readableAborted\",\n \"readableBuffer\",\n \"readableDidRead\",\n \"readableEncoding\",\n \"readableEnded\",\n \"readableFlowing\",\n \"readableHighWaterMark\",\n \"readableLength\",\n \"readableObjectMode\",\n \"reduce\",\n \"removeAllListeners\",\n \"removeListener\",\n \"resume\",\n \"setDefaultEncoding\",\n \"setEncoding\",\n \"setMaxListeners\",\n \"some\",\n \"take\",\n \"toArray\",\n \"toLocaleString\",\n \"toString\",\n \"uncork\",\n \"unpipe\",\n \"unshift\",\n \"valueOf\",\n \"wrap\",\n \"writable\",\n \"writableBuffer\",\n \"writableCorked\",\n \"writableEnded\",\n \"writableFinished\",\n \"writableHighWaterMark\",\n \"writableLength\",\n \"writableNeedDrain\",\n \"writableObjectMode\",\n \"write\"\n ];\n for (let method of triggerMethods)\n Object.defineProperty(LazyHash.prototype, method, {\n get() {\n return Object.setPrototypeOf(this, lazyHashFullInitProto), StreamModule.Transform.@call(this, this._options), this[method];\n },\n enumerable: !1,\n configurable: !0\n });\n module.exports = function createHash(algorithm) {\n return new LazyHash(algorithm);\n }, module.exports.createHash = module.exports, module.exports.Hash = LazyHash;\n }\n}), require_legacy = __commonJS({\n \"node_modules/create-hmac/legacy.js\"(exports, module) {\n var inherits = require_inherits_browser(), Buffer2 = require_safe_buffer().Buffer, Base = require_cipher_base(), ZEROS = Buffer2.alloc(128), blocksize = 64;\n function Hmac(alg, key2) {\n key2 = exportIfKeyObject(key2), Base.@call(this, \"digest\"), typeof key2 == \"string\" && (key2 = Buffer2.from(key2)), this._alg = alg, this._key = key2, key2.length > blocksize \? key2 = alg(key2) : key2.length < blocksize && (key2 = Buffer2.concat([key2, ZEROS], blocksize));\n for (var ipad = this._ipad = Buffer2.allocUnsafe(blocksize), opad = this._opad = Buffer2.allocUnsafe(blocksize), i = 0;i < blocksize; i++)\n ipad[i] = key2[i] ^ 54, opad[i] = key2[i] ^ 92;\n this._hash = [ipad];\n }\n Hmac.prototype = {}, inherits(Hmac, Base), Hmac.prototype._update = function(data) {\n this._hash.push(data);\n }, Hmac.prototype._final = function() {\n var h = this._alg(Buffer2.concat(this._hash));\n return this._alg(Buffer2.concat([this._opad, h]));\n }, module.exports = Hmac;\n }\n}), require_md52 = __commonJS({\n \"node_modules/create-hash/md5.js\"(exports, module) {\n var MD5 = require_md5();\n module.exports = function(buffer) {\n return new MD5().update(buffer).digest();\n };\n }\n}), require_browser3 = __commonJS({\n \"node_modules/create-hmac/browser.js\"(exports, module) {\n var inherits = require_inherits_browser(), Legacy = require_legacy(), Base = require_cipher_base(), Buffer2 = require_safe_buffer().Buffer, md5 = require_md52(), RIPEMD160 = require_ripemd160(), sha = require_sha2(), ZEROS = Buffer2.alloc(128);\n function Hmac(alg, key2) {\n key2 = exportIfKeyObject(key2), Base.@call(this, \"digest\"), typeof key2 == \"string\" && (key2 = Buffer2.from(key2));\n var blocksize = alg === \"sha512\" || alg === \"sha384\" \? 128 : 64;\n if (this._alg = alg, this._key = key2, key2.length > blocksize) {\n var hash = alg === \"rmd160\" \? new RIPEMD160 : sha(alg);\n key2 = hash.update(key2).digest();\n } else\n key2.length < blocksize && (key2 = Buffer2.concat([key2, ZEROS], blocksize));\n for (var ipad = this._ipad = Buffer2.allocUnsafe(blocksize), opad = this._opad = Buffer2.allocUnsafe(blocksize), i = 0;i < blocksize; i++)\n ipad[i] = key2[i] ^ 54, opad[i] = key2[i] ^ 92;\n this._hash = alg === \"rmd160\" \? new RIPEMD160 : sha(alg), this._hash.update(ipad);\n }\n inherits(Hmac, Base), Hmac.prototype._update = function(data) {\n this._hash.update(data);\n }, Hmac.prototype._final = function() {\n var h = this._hash.digest(), hash = this._alg === \"rmd160\" \? new RIPEMD160 : sha(this._alg);\n return hash.update(this._opad).update(h).digest();\n }, module.exports = function(alg, key2) {\n return key2 = exportIfKeyObject(key2), alg = alg.toLowerCase(), alg === \"rmd160\" || alg === \"ripemd160\" \? new Hmac(\"rmd160\", key2) : alg === \"md5\" \? new Legacy(md5, key2) : new Hmac(alg, key2);\n };\n }\n}), require_algorithms = __commonJS({\n \"node_modules/browserify-sign/browser/algorithms.json\"(exports, module) {\n module.exports = {\n sha224WithRSAEncryption: {\n sign: \"rsa\",\n hash: \"sha224\",\n id: \"302d300d06096086480165030402040500041c\"\n },\n \"RSA-SHA224\": {\n sign: \"ecdsa/rsa\",\n hash: \"sha224\",\n id: \"302d300d06096086480165030402040500041c\"\n },\n sha256WithRSAEncryption: {\n sign: \"rsa\",\n hash: \"sha256\",\n id: \"3031300d060960864801650304020105000420\"\n },\n \"RSA-SHA256\": {\n sign: \"ecdsa/rsa\",\n hash: \"sha256\",\n id: \"3031300d060960864801650304020105000420\"\n },\n sha384WithRSAEncryption: {\n sign: \"rsa\",\n hash: \"sha384\",\n id: \"3041300d060960864801650304020205000430\"\n },\n \"RSA-SHA384\": {\n sign: \"ecdsa/rsa\",\n hash: \"sha384\",\n id: \"3041300d060960864801650304020205000430\"\n },\n sha512WithRSAEncryption: {\n sign: \"rsa\",\n hash: \"sha512\",\n id: \"3051300d060960864801650304020305000440\"\n },\n \"RSA-SHA512\": {\n sign: \"ecdsa/rsa\",\n hash: \"sha512\",\n id: \"3051300d060960864801650304020305000440\"\n },\n \"RSA-SHA1\": {\n sign: \"rsa\",\n hash: \"sha1\",\n id: \"3021300906052b0e03021a05000414\"\n },\n \"ecdsa-with-SHA1\": {\n sign: \"ecdsa\",\n hash: \"sha1\",\n id: \"\"\n },\n sha1: {\n sign: \"ecdsa/rsa\",\n hash: \"sha1\",\n id: \"\"\n },\n sha256: {\n sign: \"ecdsa/rsa\",\n hash: \"sha256\",\n id: \"\"\n },\n sha224: {\n sign: \"ecdsa/rsa\",\n hash: \"sha224\",\n id: \"\"\n },\n sha384: {\n sign: \"ecdsa/rsa\",\n hash: \"sha384\",\n id: \"\"\n },\n sha512: {\n sign: \"ecdsa/rsa\",\n hash: \"sha512\",\n id: \"\"\n },\n \"DSA-SHA\": {\n sign: \"dsa\",\n hash: \"sha1\",\n id: \"\"\n },\n \"DSA-SHA1\": {\n sign: \"dsa\",\n hash: \"sha1\",\n id: \"\"\n },\n DSA: {\n sign: \"dsa\",\n hash: \"sha1\",\n id: \"\"\n },\n \"DSA-WITH-SHA224\": {\n sign: \"dsa\",\n hash: \"sha224\",\n id: \"\"\n },\n \"DSA-SHA224\": {\n sign: \"dsa\",\n hash: \"sha224\",\n id: \"\"\n },\n \"DSA-WITH-SHA256\": {\n sign: \"dsa\",\n hash: \"sha256\",\n id: \"\"\n },\n \"DSA-SHA256\": {\n sign: \"dsa\",\n hash: \"sha256\",\n id: \"\"\n },\n \"DSA-WITH-SHA384\": {\n sign: \"dsa\",\n hash: \"sha384\",\n id: \"\"\n },\n \"DSA-SHA384\": {\n sign: \"dsa\",\n hash: \"sha384\",\n id: \"\"\n },\n \"DSA-WITH-SHA512\": {\n sign: \"dsa\",\n hash: \"sha512\",\n id: \"\"\n },\n \"DSA-SHA512\": {\n sign: \"dsa\",\n hash: \"sha512\",\n id: \"\"\n },\n \"DSA-RIPEMD160\": {\n sign: \"dsa\",\n hash: \"rmd160\",\n id: \"\"\n },\n ripemd160WithRSA: {\n sign: \"rsa\",\n hash: \"rmd160\",\n id: \"3021300906052b2403020105000414\"\n },\n \"RSA-RIPEMD160\": {\n sign: \"rsa\",\n hash: \"rmd160\",\n id: \"3021300906052b2403020105000414\"\n },\n md5WithRSAEncryption: {\n sign: \"rsa\",\n hash: \"md5\",\n id: \"3020300c06082a864886f70d020505000410\"\n },\n \"RSA-MD5\": {\n sign: \"rsa\",\n hash: \"md5\",\n id: \"3020300c06082a864886f70d020505000410\"\n }\n };\n }\n}), require_algos = __commonJS({\n \"node_modules/browserify-sign/algos.js\"(exports, module) {\n module.exports = require_algorithms();\n }\n}), require_precondition = __commonJS({\n \"node_modules/pbkdf2/lib/precondition.js\"(exports, module) {\n var MAX_ALLOC = Math.pow(2, 30) - 1;\n module.exports = function(iterations, keylen) {\n if (typeof iterations != \"number\")\n @throwTypeError(\"Iterations not a number\");\n if (iterations < 0)\n @throwTypeError(\"Bad iterations\");\n if (typeof keylen != \"number\")\n @throwTypeError(\"Key length not a number\");\n if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen)\n @throwTypeError(\"Bad key length\");\n };\n }\n}), require_default_encoding = __commonJS({\n \"node_modules/pbkdf2/lib/default-encoding.js\"(exports, module) {\n var defaultEncoding;\n global.process && global.process.browser \? defaultEncoding = \"utf-8\" : global.process && global.process.version \? (pVersionMajor = parseInt(process.version.split(\".\")[0].slice(1), 10), defaultEncoding = pVersionMajor >= 6 \? \"utf-8\" : \"binary\") : defaultEncoding = \"utf-8\";\n var pVersionMajor;\n module.exports = defaultEncoding;\n }\n}), require_to_buffer = __commonJS({\n \"node_modules/pbkdf2/lib/to-buffer.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer;\n module.exports = function(thing, encoding, name) {\n if (Buffer2.isBuffer(thing))\n return thing;\n if (typeof thing == \"string\")\n return Buffer2.from(thing, encoding);\n if (@ArrayBuffer.isView(thing))\n return Buffer2.from(thing.buffer);\n @throwTypeError(name + \" must be a string, a Buffer, a typed array or a DataView\");\n };\n }\n}), require_sync_browser = __commonJS({\n \"node_modules/pbkdf2/lib/sync-browser.js\"(exports, module) {\n var md5 = require_md52(), RIPEMD160 = require_ripemd160(), sha = require_sha2(), Buffer2 = require_safe_buffer().Buffer, checkParameters = require_precondition(), defaultEncoding = require_default_encoding(), toBuffer = require_to_buffer(), ZEROS = Buffer2.alloc(128), sizes = {\n md5: 16,\n sha1: 20,\n sha224: 28,\n sha256: 32,\n sha384: 48,\n sha512: 64,\n rmd160: 20,\n ripemd160: 20\n };\n function Hmac(alg, key2, saltLen) {\n key2 = exportIfKeyObject(key2);\n var hash = getDigest(alg), blocksize = alg === \"sha512\" || alg === \"sha384\" \? 128 : 64;\n key2.length > blocksize \? key2 = hash(key2) : key2.length < blocksize && (key2 = Buffer2.concat([key2, ZEROS], blocksize));\n for (var ipad = Buffer2.allocUnsafe(blocksize + sizes[alg]), opad = Buffer2.allocUnsafe(blocksize + sizes[alg]), i = 0;i < blocksize; i++)\n ipad[i] = key2[i] ^ 54, opad[i] = key2[i] ^ 92;\n var ipad1 = Buffer2.allocUnsafe(blocksize + saltLen + 4);\n ipad.copy(ipad1, 0, 0, blocksize), this.ipad1 = ipad1, this.ipad2 = ipad, this.opad = opad, this.alg = alg, this.blocksize = blocksize, this.hash = hash, this.size = sizes[alg];\n }\n Hmac.prototype = {}, Hmac.prototype.run = function(data, ipad) {\n data.copy(ipad, this.blocksize);\n var h = this.hash(ipad);\n return h.copy(this.opad, this.blocksize), this.hash(this.opad);\n };\n function getDigest(alg) {\n function shaFunc(data) {\n return sha(alg).update(data).digest();\n }\n function rmd160Func(data) {\n return new RIPEMD160().update(data).digest();\n }\n return alg === \"rmd160\" || alg === \"ripemd160\" \? rmd160Func : alg === \"md5\" \? md5 : shaFunc;\n }\n function pbkdf2(password, salt, iterations, keylen, digest) {\n checkParameters(iterations, keylen), password = toBuffer(password, defaultEncoding, \"Password\"), salt = toBuffer(salt, defaultEncoding, \"Salt\"), digest = digest || \"sha1\";\n var hmac = new Hmac(digest, password, salt.length), DK = Buffer2.allocUnsafe(keylen), block1 = Buffer2.allocUnsafe(salt.length + 4);\n salt.copy(block1, 0, 0, salt.length);\n for (var destPos = 0, hLen = sizes[digest], l = Math.ceil(keylen / hLen), i = 1;i <= l; i++) {\n block1.writeUInt32BE(i, salt.length);\n for (var T = hmac.run(block1, hmac.ipad1), U = T, j = 1;j < iterations; j++) {\n U = hmac.run(U, hmac.ipad2);\n for (var k = 0;k < hLen; k++)\n T[k] ^= U[k];\n }\n T.copy(DK, destPos), destPos += hLen;\n }\n return DK;\n }\n module.exports = pbkdf2;\n }\n}), require_async = __commonJS({\n \"node_modules/pbkdf2/lib/async.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer, checkParameters = require_precondition(), defaultEncoding = require_default_encoding(), sync = require_sync_browser(), toBuffer = require_to_buffer(), ZERO_BUF, subtle = globalCrypto.subtle, toBrowser = {\n sha: \"SHA-1\",\n \"sha-1\": \"SHA-1\",\n sha1: \"SHA-1\",\n sha256: \"SHA-256\",\n \"sha-256\": \"SHA-256\",\n sha384: \"SHA-384\",\n \"sha-384\": \"SHA-384\",\n \"sha-512\": \"SHA-512\",\n sha512: \"SHA-512\"\n }, checks = [];\n function checkNative(algo) {\n if (global.process && !global.process.browser || !subtle || !subtle.importKey || !subtle.deriveBits)\n return @Promise.resolve(!1);\n if (checks[algo] !== void 0)\n return checks[algo];\n ZERO_BUF = ZERO_BUF || Buffer2.alloc(8);\n var prom = browserPbkdf2(ZERO_BUF, ZERO_BUF, 10, 128, algo).then(function() {\n return !0;\n }).catch(function() {\n return !1;\n });\n return checks[algo] = prom, prom;\n }\n var nextTick;\n function getNextTick() {\n return nextTick || (global.process && global.process.nextTick \? nextTick = global.process.nextTick : global.queueMicrotask \? nextTick = global.queueMicrotask : global.setImmediate \? nextTick = global.setImmediate : nextTick = global.setTimeout, nextTick);\n }\n function browserPbkdf2(password, salt, iterations, length, algo) {\n return subtle.importKey(\"raw\", password, { name: \"PBKDF2\" }, !1, [\"deriveBits\"]).then(function(key2) {\n return subtle.deriveBits({\n name: \"PBKDF2\",\n salt,\n iterations,\n hash: {\n name: algo\n }\n }, key2, length << 3);\n }).then(function(res) {\n return Buffer2.from(res);\n });\n }\n function resolvePromise(promise, callback) {\n promise.then(function(out) {\n getNextTick()(function() {\n callback(null, out);\n });\n }, function(e) {\n getNextTick()(function() {\n callback(e);\n });\n });\n }\n module.exports = function(password, salt, iterations, keylen, digest, callback) {\n typeof digest == \"function\" && (callback = digest, digest = void 0), digest = digest || \"sha1\";\n var algo = toBrowser[digest.toLowerCase()];\n if (!algo || typeof global.Promise != \"function\") {\n getNextTick()(function() {\n var out;\n try {\n out = sync(password, salt, iterations, keylen, digest);\n } catch (e) {\n return callback(e);\n }\n callback(null, out);\n });\n return;\n }\n if (checkParameters(iterations, keylen), password = toBuffer(password, defaultEncoding, \"Password\"), salt = toBuffer(salt, defaultEncoding, \"Salt\"), typeof callback != \"function\")\n throw new Error(\"No callback provided to pbkdf2\");\n resolvePromise(checkNative(algo).then(function(resp) {\n return resp \? browserPbkdf2(password, salt, iterations, keylen, algo) : sync(password, salt, iterations, keylen, digest);\n }), callback);\n };\n }\n}), require_browser4 = __commonJS({\n \"node_modules/pbkdf2/browser.js\"(exports) {\n exports.pbkdf2 = require_async(), exports.pbkdf2Sync = require_sync_browser();\n }\n}), require_utils = __commonJS({\n \"node_modules/des.js/lib/des/utils.js\"(exports) {\n exports.readUInt32BE = function(bytes, off) {\n var res = bytes[0 + off] << 24 | bytes[1 + off] << 16 | bytes[2 + off] << 8 | bytes[3 + off];\n return res >>> 0;\n }, exports.writeUInt32BE = function(bytes, value, off) {\n bytes[0 + off] = value >>> 24, bytes[1 + off] = value >>> 16 & 255, bytes[2 + off] = value >>> 8 & 255, bytes[3 + off] = value & 255;\n }, exports.ip = function(inL, inR, out, off) {\n for (var outL = 0, outR = 0, i = 6;i >= 0; i -= 2) {\n for (var j = 0;j <= 24; j += 8)\n outL <<= 1, outL |= inR >>> j + i & 1;\n for (var j = 0;j <= 24; j += 8)\n outL <<= 1, outL |= inL >>> j + i & 1;\n }\n for (var i = 6;i >= 0; i -= 2) {\n for (var j = 1;j <= 25; j += 8)\n outR <<= 1, outR |= inR >>> j + i & 1;\n for (var j = 1;j <= 25; j += 8)\n outR <<= 1, outR |= inL >>> j + i & 1;\n }\n out[off + 0] = outL >>> 0, out[off + 1] = outR >>> 0;\n }, exports.rip = function(inL, inR, out, off) {\n for (var outL = 0, outR = 0, i = 0;i < 4; i++)\n for (var j = 24;j >= 0; j -= 8)\n outL <<= 1, outL |= inR >>> j + i & 1, outL <<= 1, outL |= inL >>> j + i & 1;\n for (var i = 4;i < 8; i++)\n for (var j = 24;j >= 0; j -= 8)\n outR <<= 1, outR |= inR >>> j + i & 1, outR <<= 1, outR |= inL >>> j + i & 1;\n out[off + 0] = outL >>> 0, out[off + 1] = outR >>> 0;\n }, exports.pc1 = function(inL, inR, out, off) {\n for (var outL = 0, outR = 0, i = 7;i >= 5; i--) {\n for (var j = 0;j <= 24; j += 8)\n outL <<= 1, outL |= inR >> j + i & 1;\n for (var j = 0;j <= 24; j += 8)\n outL <<= 1, outL |= inL >> j + i & 1;\n }\n for (var j = 0;j <= 24; j += 8)\n outL <<= 1, outL |= inR >> j + i & 1;\n for (var i = 1;i <= 3; i++) {\n for (var j = 0;j <= 24; j += 8)\n outR <<= 1, outR |= inR >> j + i & 1;\n for (var j = 0;j <= 24; j += 8)\n outR <<= 1, outR |= inL >> j + i & 1;\n }\n for (var j = 0;j <= 24; j += 8)\n outR <<= 1, outR |= inL >> j + i & 1;\n out[off + 0] = outL >>> 0, out[off + 1] = outR >>> 0;\n }, exports.r28shl = function(num, shift) {\n return num << shift & 268435455 | num >>> 28 - shift;\n };\n var pc2table = [\n 14,\n 11,\n 17,\n 4,\n 27,\n 23,\n 25,\n 0,\n 13,\n 22,\n 7,\n 18,\n 5,\n 9,\n 16,\n 24,\n 2,\n 20,\n 12,\n 21,\n 1,\n 8,\n 15,\n 26,\n 15,\n 4,\n 25,\n 19,\n 9,\n 1,\n 26,\n 16,\n 5,\n 11,\n 23,\n 8,\n 12,\n 7,\n 17,\n 0,\n 22,\n 3,\n 10,\n 14,\n 6,\n 20,\n 27,\n 24\n ];\n exports.pc2 = function(inL, inR, out, off) {\n for (var outL = 0, outR = 0, len = pc2table.length >>> 1, i = 0;i < len; i++)\n outL <<= 1, outL |= inL >>> pc2table[i] & 1;\n for (var i = len;i < pc2table.length; i++)\n outR <<= 1, outR |= inR >>> pc2table[i] & 1;\n out[off + 0] = outL >>> 0, out[off + 1] = outR >>> 0;\n }, exports.expand = function(r, out, off) {\n var outL = 0, outR = 0;\n outL = (r & 1) << 5 | r >>> 27;\n for (var i = 23;i >= 15; i -= 4)\n outL <<= 6, outL |= r >>> i & 63;\n for (var i = 11;i >= 3; i -= 4)\n outR |= r >>> i & 63, outR <<= 6;\n outR |= (r & 31) << 1 | r >>> 31, out[off + 0] = outL >>> 0, out[off + 1] = outR >>> 0;\n };\n var sTable = [\n 14,\n 0,\n 4,\n 15,\n 13,\n 7,\n 1,\n 4,\n 2,\n 14,\n 15,\n 2,\n 11,\n 13,\n 8,\n 1,\n 3,\n 10,\n 10,\n 6,\n 6,\n 12,\n 12,\n 11,\n 5,\n 9,\n 9,\n 5,\n 0,\n 3,\n 7,\n 8,\n 4,\n 15,\n 1,\n 12,\n 14,\n 8,\n 8,\n 2,\n 13,\n 4,\n 6,\n 9,\n 2,\n 1,\n 11,\n 7,\n 15,\n 5,\n 12,\n 11,\n 9,\n 3,\n 7,\n 14,\n 3,\n 10,\n 10,\n 0,\n 5,\n 6,\n 0,\n 13,\n 15,\n 3,\n 1,\n 13,\n 8,\n 4,\n 14,\n 7,\n 6,\n 15,\n 11,\n 2,\n 3,\n 8,\n 4,\n 14,\n 9,\n 12,\n 7,\n 0,\n 2,\n 1,\n 13,\n 10,\n 12,\n 6,\n 0,\n 9,\n 5,\n 11,\n 10,\n 5,\n 0,\n 13,\n 14,\n 8,\n 7,\n 10,\n 11,\n 1,\n 10,\n 3,\n 4,\n 15,\n 13,\n 4,\n 1,\n 2,\n 5,\n 11,\n 8,\n 6,\n 12,\n 7,\n 6,\n 12,\n 9,\n 0,\n 3,\n 5,\n 2,\n 14,\n 15,\n 9,\n 10,\n 13,\n 0,\n 7,\n 9,\n 0,\n 14,\n 9,\n 6,\n 3,\n 3,\n 4,\n 15,\n 6,\n 5,\n 10,\n 1,\n 2,\n 13,\n 8,\n 12,\n 5,\n 7,\n 14,\n 11,\n 12,\n 4,\n 11,\n 2,\n 15,\n 8,\n 1,\n 13,\n 1,\n 6,\n 10,\n 4,\n 13,\n 9,\n 0,\n 8,\n 6,\n 15,\n 9,\n 3,\n 8,\n 0,\n 7,\n 11,\n 4,\n 1,\n 15,\n 2,\n 14,\n 12,\n 3,\n 5,\n 11,\n 10,\n 5,\n 14,\n 2,\n 7,\n 12,\n 7,\n 13,\n 13,\n 8,\n 14,\n 11,\n 3,\n 5,\n 0,\n 6,\n 6,\n 15,\n 9,\n 0,\n 10,\n 3,\n 1,\n 4,\n 2,\n 7,\n 8,\n 2,\n 5,\n 12,\n 11,\n 1,\n 12,\n 10,\n 4,\n 14,\n 15,\n 9,\n 10,\n 3,\n 6,\n 15,\n 9,\n 0,\n 0,\n 6,\n 12,\n 10,\n 11,\n 1,\n 7,\n 13,\n 13,\n 8,\n 15,\n 9,\n 1,\n 4,\n 3,\n 5,\n 14,\n 11,\n 5,\n 12,\n 2,\n 7,\n 8,\n 2,\n 4,\n 14,\n 2,\n 14,\n 12,\n 11,\n 4,\n 2,\n 1,\n 12,\n 7,\n 4,\n 10,\n 7,\n 11,\n 13,\n 6,\n 1,\n 8,\n 5,\n 5,\n 0,\n 3,\n 15,\n 15,\n 10,\n 13,\n 3,\n 0,\n 9,\n 14,\n 8,\n 9,\n 6,\n 4,\n 11,\n 2,\n 8,\n 1,\n 12,\n 11,\n 7,\n 10,\n 1,\n 13,\n 14,\n 7,\n 2,\n 8,\n 13,\n 15,\n 6,\n 9,\n 15,\n 12,\n 0,\n 5,\n 9,\n 6,\n 10,\n 3,\n 4,\n 0,\n 5,\n 14,\n 3,\n 12,\n 10,\n 1,\n 15,\n 10,\n 4,\n 15,\n 2,\n 9,\n 7,\n 2,\n 12,\n 6,\n 9,\n 8,\n 5,\n 0,\n 6,\n 13,\n 1,\n 3,\n 13,\n 4,\n 14,\n 14,\n 0,\n 7,\n 11,\n 5,\n 3,\n 11,\n 8,\n 9,\n 4,\n 14,\n 3,\n 15,\n 2,\n 5,\n 12,\n 2,\n 9,\n 8,\n 5,\n 12,\n 15,\n 3,\n 10,\n 7,\n 11,\n 0,\n 14,\n 4,\n 1,\n 10,\n 7,\n 1,\n 6,\n 13,\n 0,\n 11,\n 8,\n 6,\n 13,\n 4,\n 13,\n 11,\n 0,\n 2,\n 11,\n 14,\n 7,\n 15,\n 4,\n 0,\n 9,\n 8,\n 1,\n 13,\n 10,\n 3,\n 14,\n 12,\n 3,\n 9,\n 5,\n 7,\n 12,\n 5,\n 2,\n 10,\n 15,\n 6,\n 8,\n 1,\n 6,\n 1,\n 6,\n 4,\n 11,\n 11,\n 13,\n 13,\n 8,\n 12,\n 1,\n 3,\n 4,\n 7,\n 10,\n 14,\n 7,\n 10,\n 9,\n 15,\n 5,\n 6,\n 0,\n 8,\n 15,\n 0,\n 14,\n 5,\n 2,\n 9,\n 3,\n 2,\n 12,\n 13,\n 1,\n 2,\n 15,\n 8,\n 13,\n 4,\n 8,\n 6,\n 10,\n 15,\n 3,\n 11,\n 7,\n 1,\n 4,\n 10,\n 12,\n 9,\n 5,\n 3,\n 6,\n 14,\n 11,\n 5,\n 0,\n 0,\n 14,\n 12,\n 9,\n 7,\n 2,\n 7,\n 2,\n 11,\n 1,\n 4,\n 14,\n 1,\n 7,\n 9,\n 4,\n 12,\n 10,\n 14,\n 8,\n 2,\n 13,\n 0,\n 15,\n 6,\n 12,\n 10,\n 9,\n 13,\n 0,\n 15,\n 3,\n 3,\n 5,\n 5,\n 6,\n 8,\n 11\n ];\n exports.substitute = function(inL, inR) {\n for (var out = 0, i = 0;i < 4; i++) {\n var b = inL >>> 18 - i * 6 & 63, sb = sTable[i * 64 + b];\n out <<= 4, out |= sb;\n }\n for (var i = 0;i < 4; i++) {\n var b = inR >>> 18 - i * 6 & 63, sb = sTable[256 + i * 64 + b];\n out <<= 4, out |= sb;\n }\n return out >>> 0;\n };\n var permuteTable = [\n 16,\n 25,\n 12,\n 11,\n 3,\n 20,\n 4,\n 15,\n 31,\n 17,\n 9,\n 6,\n 27,\n 14,\n 1,\n 22,\n 30,\n 24,\n 8,\n 18,\n 0,\n 5,\n 29,\n 23,\n 13,\n 19,\n 2,\n 26,\n 10,\n 21,\n 28,\n 7\n ];\n exports.permute = function(num) {\n for (var out = 0, i = 0;i < permuteTable.length; i++)\n out <<= 1, out |= num >>> permuteTable[i] & 1;\n return out >>> 0;\n }, exports.padSplit = function(num, size, group) {\n for (var str = num.toString(2);str.length < size; )\n str = \"0\" + str;\n for (var out = [], i = 0;i < size; i += group)\n out.push(str.slice(i, i + group));\n return out.join(\" \");\n };\n }\n}), require_minimalistic_assert = __commonJS({\n \"node_modules/minimalistic-assert/index.js\"(exports, module) {\n module.exports = assert;\n function assert(val, msg) {\n if (!val)\n throw new Error(msg || \"Assertion failed\");\n }\n assert.equal = function(l, r, msg) {\n if (l != r)\n throw new Error(msg || \"Assertion failed: \" + l + \" != \" + r);\n };\n }\n}), require_cipher = __commonJS({\n \"node_modules/des.js/lib/des/cipher.js\"(exports, module) {\n var assert = require_minimalistic_assert();\n function Cipher(options) {\n this.options = options, this.type = this.options.type, this.blockSize = 8, this._init(), this.buffer = new @Array(this.blockSize), this.bufferOff = 0;\n }\n Cipher.prototype = {}, module.exports = Cipher, Cipher.prototype._init = function() {\n }, Cipher.prototype.update = function(data) {\n return data.length === 0 \? [] : this.type === \"decrypt\" \? this._updateDecrypt(data) : this._updateEncrypt(data);\n }, Cipher.prototype._buffer = function(data, off) {\n for (var min = Math.min(this.buffer.length - this.bufferOff, data.length - off), i = 0;i < min; i++)\n this.buffer[this.bufferOff + i] = data[off + i];\n return this.bufferOff += min, min;\n }, Cipher.prototype._flushBuffer = function(out, off) {\n return this._update(this.buffer, 0, out, off), this.bufferOff = 0, this.blockSize;\n }, Cipher.prototype._updateEncrypt = function(data) {\n var inputOff = 0, outputOff = 0, count = (this.bufferOff + data.length) / this.blockSize | 0, out = new @Array(count * this.blockSize);\n this.bufferOff !== 0 && (inputOff += this._buffer(data, inputOff), this.bufferOff === this.buffer.length && (outputOff += this._flushBuffer(out, outputOff)));\n for (var max = data.length - (data.length - inputOff) % this.blockSize;inputOff < max; inputOff += this.blockSize)\n this._update(data, inputOff, out, outputOff), outputOff += this.blockSize;\n for (;inputOff < data.length; inputOff++, this.bufferOff++)\n this.buffer[this.bufferOff] = data[inputOff];\n return out;\n }, Cipher.prototype._updateDecrypt = function(data) {\n for (var inputOff = 0, outputOff = 0, count = Math.ceil((this.bufferOff + data.length) / this.blockSize) - 1, out = new @Array(count * this.blockSize);count > 0; count--)\n inputOff += this._buffer(data, inputOff), outputOff += this._flushBuffer(out, outputOff);\n return inputOff += this._buffer(data, inputOff), out;\n }, Cipher.prototype.final = function(buffer) {\n var first;\n buffer && (first = this.update(buffer));\n var last;\n return this.type === \"encrypt\" \? last = this._finalEncrypt() : last = this._finalDecrypt(), first \? first.concat(last) : last;\n }, Cipher.prototype._pad = function(buffer, off) {\n if (off === 0)\n return !1;\n for (;off < buffer.length; )\n buffer[off++] = 0;\n return !0;\n }, Cipher.prototype._finalEncrypt = function() {\n if (!this._pad(this.buffer, this.bufferOff))\n return [];\n var out = new @Array(this.blockSize);\n return this._update(this.buffer, 0, out, 0), out;\n }, Cipher.prototype._unpad = function(buffer) {\n return buffer;\n }, Cipher.prototype._finalDecrypt = function() {\n assert.equal(this.bufferOff, this.blockSize, \"Not enough data to decrypt\");\n var out = new @Array(this.blockSize);\n return this._flushBuffer(out, 0), this._unpad(out);\n };\n }\n}), require_des = __commonJS({\n \"node_modules/des.js/lib/des/des.js\"(exports, module) {\n var assert = require_minimalistic_assert(), inherits = require_inherits_browser(), utils = require_utils(), Cipher = require_cipher();\n function DESState() {\n this.tmp = new @Array(2), this.keys = null;\n }\n function DES(options) {\n Cipher.@call(this, options);\n var state = new DESState;\n this._desState = state, this.deriveKeys(state, options.key);\n }\n inherits(DES, Cipher), module.exports = DES, DES.create = function(options) {\n return new DES(options);\n };\n var shiftTable = [1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1];\n DES.prototype.deriveKeys = function(state, key2) {\n state.keys = new @Array(32), assert.equal(key2.length, this.blockSize, \"Invalid key length\");\n var kL = utils.readUInt32BE(key2, 0), kR = utils.readUInt32BE(key2, 4);\n utils.pc1(kL, kR, state.tmp, 0), kL = state.tmp[0], kR = state.tmp[1];\n for (var i = 0;i < state.keys.length; i += 2) {\n var shift = shiftTable[i >>> 1];\n kL = utils.r28shl(kL, shift), kR = utils.r28shl(kR, shift), utils.pc2(kL, kR, state.keys, i);\n }\n }, DES.prototype._update = function(inp, inOff, out, outOff) {\n var state = this._desState, l = utils.readUInt32BE(inp, inOff), r = utils.readUInt32BE(inp, inOff + 4);\n utils.ip(l, r, state.tmp, 0), l = state.tmp[0], r = state.tmp[1], this.type === \"encrypt\" \? this._encrypt(state, l, r, state.tmp, 0) : this._decrypt(state, l, r, state.tmp, 0), l = state.tmp[0], r = state.tmp[1], utils.writeUInt32BE(out, l, outOff), utils.writeUInt32BE(out, r, outOff + 4);\n }, DES.prototype._pad = function(buffer, off) {\n for (var value = buffer.length - off, i = off;i < buffer.length; i++)\n buffer[i] = value;\n return !0;\n }, DES.prototype._unpad = function(buffer) {\n for (var pad = buffer[buffer.length - 1], i = buffer.length - pad;i < buffer.length; i++)\n assert.equal(buffer[i], pad);\n return buffer.slice(0, buffer.length - pad);\n }, DES.prototype._encrypt = function(state, lStart, rStart, out, off) {\n for (var l = lStart, r = rStart, i = 0;i < state.keys.length; i += 2) {\n var keyL = state.keys[i], keyR = state.keys[i + 1];\n utils.expand(r, state.tmp, 0), keyL ^= state.tmp[0], keyR ^= state.tmp[1];\n var s = utils.substitute(keyL, keyR), f = utils.permute(s), t = r;\n r = (l ^ f) >>> 0, l = t;\n }\n utils.rip(r, l, out, off);\n }, DES.prototype._decrypt = function(state, lStart, rStart, out, off) {\n for (var l = rStart, r = lStart, i = state.keys.length - 2;i >= 0; i -= 2) {\n var keyL = state.keys[i], keyR = state.keys[i + 1];\n utils.expand(l, state.tmp, 0), keyL ^= state.tmp[0], keyR ^= state.tmp[1];\n var s = utils.substitute(keyL, keyR), f = utils.permute(s), t = l;\n l = (r ^ f) >>> 0, r = t;\n }\n utils.rip(l, r, out, off);\n };\n }\n}), require_cbc = __commonJS({\n \"node_modules/des.js/lib/des/cbc.js\"(exports) {\n var assert = require_minimalistic_assert(), inherits = require_inherits_browser(), proto = {};\n function CBCState(iv) {\n assert.equal(iv.length, 8, \"Invalid IV length\"), this.iv = new @Array(8);\n for (var i = 0;i < this.iv.length; i++)\n this.iv[i] = iv[i];\n }\n function instantiate(Base) {\n function CBC(options) {\n Base.@call(this, options), this._cbcInit();\n }\n inherits(CBC, Base);\n for (var keys = Object.keys(proto), i = 0;i < keys.length; i++) {\n var key2 = keys[i];\n CBC.prototype[key2] = proto[key2];\n }\n return CBC.create = function(options) {\n return new CBC(options);\n }, CBC;\n }\n exports.instantiate = instantiate, proto._cbcInit = function() {\n var state = new CBCState(this.options.iv);\n this._cbcState = state;\n }, proto._update = function(inp, inOff, out, outOff) {\n var state = this._cbcState, superProto = this.constructor.super_.prototype, iv = state.iv;\n if (this.type === \"encrypt\") {\n for (var i = 0;i < this.blockSize; i++)\n iv[i] ^= inp[inOff + i];\n superProto._update.@call(this, iv, 0, out, outOff);\n for (var i = 0;i < this.blockSize; i++)\n iv[i] = out[outOff + i];\n } else {\n superProto._update.@call(this, inp, inOff, out, outOff);\n for (var i = 0;i < this.blockSize; i++)\n out[outOff + i] ^= iv[i];\n for (var i = 0;i < this.blockSize; i++)\n iv[i] = inp[inOff + i];\n }\n };\n }\n}), require_ede = __commonJS({\n \"node_modules/des.js/lib/des/ede.js\"(exports, module) {\n var assert = require_minimalistic_assert(), inherits = require_inherits_browser(), Cipher = require_cipher(), DES = require_des();\n function EDEState(type, key2) {\n assert.equal(key2.length, 24, \"Invalid key length\");\n var k1 = key2.slice(0, 8), k2 = key2.slice(8, 16), k3 = key2.slice(16, 24);\n type === \"encrypt\" \? this.ciphers = [\n DES.create({ type: \"encrypt\", key: k1 }),\n DES.create({ type: \"decrypt\", key: k2 }),\n DES.create({ type: \"encrypt\", key: k3 })\n ] : this.ciphers = [\n DES.create({ type: \"decrypt\", key: k3 }),\n DES.create({ type: \"encrypt\", key: k2 }),\n DES.create({ type: \"decrypt\", key: k1 })\n ];\n }\n function EDE(options) {\n Cipher.@call(this, options);\n var state = new EDEState(this.type, this.options.key);\n this._edeState = state;\n }\n inherits(EDE, Cipher), module.exports = EDE, EDE.create = function(options) {\n return new EDE(options);\n }, EDE.prototype._update = function(inp, inOff, out, outOff) {\n var state = this._edeState;\n state.ciphers[0]._update(inp, inOff, out, outOff), state.ciphers[1]._update(out, outOff, out, outOff), state.ciphers[2]._update(out, outOff, out, outOff);\n }, EDE.prototype._pad = DES.prototype._pad, EDE.prototype._unpad = DES.prototype._unpad;\n }\n}), require_des2 = __commonJS({\n \"node_modules/des.js/lib/des.js\"(exports) {\n exports.utils = require_utils(), exports.Cipher = require_cipher(), exports.DES = require_des(), exports.CBC = require_cbc(), exports.EDE = require_ede();\n }\n}), require_browserify_des = __commonJS({\n \"node_modules/browserify-des/index.js\"(exports, module) {\n var CipherBase = require_cipher_base(), des = require_des2(), inherits = require_inherits_browser(), Buffer2 = require_safe_buffer().Buffer, modes = {\n \"des-ede3-cbc\": des.CBC.instantiate(des.EDE),\n \"des-ede3\": des.EDE,\n \"des-ede-cbc\": des.CBC.instantiate(des.EDE),\n \"des-ede\": des.EDE,\n \"des-cbc\": des.CBC.instantiate(des.DES),\n \"des-ecb\": des.DES\n };\n modes.des = modes[\"des-cbc\"], modes.des3 = modes[\"des-ede3-cbc\"], module.exports = DES, inherits(DES, CipherBase);\n function DES(opts) {\n CipherBase.@call(this);\n var modeName = opts.mode.toLowerCase(), mode = modes[modeName], type;\n opts.decrypt \? type = \"decrypt\" : type = \"encrypt\";\n var key2 = opts.key;\n Buffer2.isBuffer(key2) || (key2 = Buffer2.from(key2)), (modeName === \"des-ede\" || modeName === \"des-ede-cbc\") && (key2 = Buffer2.concat([key2, key2.slice(0, 8)]));\n var iv = opts.iv;\n Buffer2.isBuffer(iv) || (iv = Buffer2.from(iv)), this._des = mode.create({\n key: key2,\n iv,\n type\n });\n }\n DES.prototype._update = function(data) {\n return Buffer2.from(this._des.update(data));\n }, DES.prototype._final = function() {\n return Buffer2.from(this._des.final());\n };\n }\n}), require_ecb = __commonJS({\n \"node_modules/browserify-aes/modes/ecb.js\"(exports) {\n exports.encrypt = function(self2, block) {\n return self2._cipher.encryptBlock(block);\n }, exports.decrypt = function(self2, block) {\n return self2._cipher.decryptBlock(block);\n };\n }\n}), require_buffer_xor = __commonJS({\n \"node_modules/buffer-xor/index.js\"(exports, module) {\n module.exports = function(a, b) {\n for (var length = Math.min(a.length, b.length), buffer = new Buffer(length), i = 0;i < length; ++i)\n buffer[i] = a[i] ^ b[i];\n return buffer;\n };\n }\n}), require_cbc2 = __commonJS({\n \"node_modules/browserify-aes/modes/cbc.js\"(exports) {\n var xor = require_buffer_xor();\n exports.encrypt = function(self2, block) {\n var data = xor(block, self2._prev);\n return self2._prev = self2._cipher.encryptBlock(data), self2._prev;\n }, exports.decrypt = function(self2, block) {\n var pad = self2._prev;\n self2._prev = block;\n var out = self2._cipher.decryptBlock(block);\n return xor(out, pad);\n };\n }\n}), require_cfb = __commonJS({\n \"node_modules/browserify-aes/modes/cfb.js\"(exports) {\n var Buffer2 = require_safe_buffer().Buffer, xor = require_buffer_xor();\n function encryptStart(self2, data, decrypt) {\n var len = data.length, out = xor(data, self2._cache);\n return self2._cache = self2._cache.slice(len), self2._prev = Buffer2.concat([self2._prev, decrypt \? data : out]), out;\n }\n exports.encrypt = function(self2, data, decrypt) {\n for (var out = Buffer2.allocUnsafe(0), len;data.length; )\n if (self2._cache.length === 0 && (self2._cache = self2._cipher.encryptBlock(self2._prev), self2._prev = Buffer2.allocUnsafe(0)), self2._cache.length <= data.length)\n len = self2._cache.length, out = Buffer2.concat([out, encryptStart(self2, data.slice(0, len), decrypt)]), data = data.slice(len);\n else {\n out = Buffer2.concat([out, encryptStart(self2, data, decrypt)]);\n break;\n }\n return out;\n };\n }\n}), require_cfb8 = __commonJS({\n \"node_modules/browserify-aes/modes/cfb8.js\"(exports) {\n var Buffer2 = require_safe_buffer().Buffer;\n function encryptByte(self2, byteParam, decrypt) {\n var pad = self2._cipher.encryptBlock(self2._prev), out = pad[0] ^ byteParam;\n return self2._prev = Buffer2.concat([self2._prev.slice(1), Buffer2.from([decrypt \? byteParam : out])]), out;\n }\n exports.encrypt = function(self2, chunk, decrypt) {\n for (var len = chunk.length, out = Buffer2.allocUnsafe(len), i = -1;++i < len; )\n out[i] = encryptByte(self2, chunk[i], decrypt);\n return out;\n };\n }\n}), require_cfb1 = __commonJS({\n \"node_modules/browserify-aes/modes/cfb1.js\"(exports) {\n var Buffer2 = require_safe_buffer().Buffer;\n function encryptByte(self2, byteParam, decrypt) {\n for (var pad, i = -1, len = 8, out = 0, bit, value;++i < len; )\n pad = self2._cipher.encryptBlock(self2._prev), bit = byteParam & 1 << 7 - i \? 128 : 0, value = pad[0] ^ bit, out += (value & 128) >> i % 8, self2._prev = shiftIn(self2._prev, decrypt \? bit : value);\n return out;\n }\n function shiftIn(buffer, value) {\n var len = buffer.length, i = -1, out = Buffer2.allocUnsafe(buffer.length);\n for (buffer = Buffer2.concat([buffer, Buffer2.from([value])]);++i < len; )\n out[i] = buffer[i] << 1 | buffer[i + 1] >> 7;\n return out;\n }\n exports.encrypt = function(self2, chunk, decrypt) {\n for (var len = chunk.length, out = Buffer2.allocUnsafe(len), i = -1;++i < len; )\n out[i] = encryptByte(self2, chunk[i], decrypt);\n return out;\n };\n }\n}), require_ofb = __commonJS({\n \"node_modules/browserify-aes/modes/ofb.js\"(exports) {\n var xor = require_buffer_xor();\n function getBlock(self2) {\n return self2._prev = self2._cipher.encryptBlock(self2._prev), self2._prev;\n }\n exports.encrypt = function(self2, chunk) {\n for (;self2._cache.length < chunk.length; )\n self2._cache = Buffer.concat([self2._cache, getBlock(self2)]);\n var pad = self2._cache.slice(0, chunk.length);\n return self2._cache = self2._cache.slice(chunk.length), xor(chunk, pad);\n };\n }\n}), require_incr32 = __commonJS({\n \"node_modules/browserify-aes/incr32.js\"(exports, module) {\n function incr32(iv) {\n for (var len = iv.length, item;len--; )\n if (item = iv.readUInt8(len), item === 255)\n iv.writeUInt8(0, len);\n else {\n item++, iv.writeUInt8(item, len);\n break;\n }\n }\n module.exports = incr32;\n }\n}), require_ctr = __commonJS({\n \"node_modules/browserify-aes/modes/ctr.js\"(exports) {\n var xor = require_buffer_xor(), Buffer2 = require_safe_buffer().Buffer, incr32 = require_incr32();\n function getBlock(self2) {\n var out = self2._cipher.encryptBlockRaw(self2._prev);\n return incr32(self2._prev), out;\n }\n var blockSize = 16;\n exports.encrypt = function(self2, chunk) {\n var chunkNum = Math.ceil(chunk.length / blockSize), start = self2._cache.length;\n self2._cache = Buffer2.concat([self2._cache, Buffer2.allocUnsafe(chunkNum * blockSize)]);\n for (var i = 0;i < chunkNum; i++) {\n var out = getBlock(self2), offset = start + i * blockSize;\n self2._cache.writeUInt32BE(out[0], offset + 0), self2._cache.writeUInt32BE(out[1], offset + 4), self2._cache.writeUInt32BE(out[2], offset + 8), self2._cache.writeUInt32BE(out[3], offset + 12);\n }\n var pad = self2._cache.slice(0, chunk.length);\n return self2._cache = self2._cache.slice(chunk.length), xor(chunk, pad);\n };\n }\n}), require_list = __commonJS({\n \"node_modules/browserify-aes/modes/list.json\"(exports, module) {\n module.exports = {\n \"aes-128-ecb\": {\n cipher: \"AES\",\n key: 128,\n iv: 0,\n mode: \"ECB\",\n type: \"block\"\n },\n \"aes-192-ecb\": {\n cipher: \"AES\",\n key: 192,\n iv: 0,\n mode: \"ECB\",\n type: \"block\"\n },\n \"aes-256-ecb\": {\n cipher: \"AES\",\n key: 256,\n iv: 0,\n mode: \"ECB\",\n type: \"block\"\n },\n \"aes-128-cbc\": {\n cipher: \"AES\",\n key: 128,\n iv: 16,\n mode: \"CBC\",\n type: \"block\"\n },\n \"aes-192-cbc\": {\n cipher: \"AES\",\n key: 192,\n iv: 16,\n mode: \"CBC\",\n type: \"block\"\n },\n \"aes-256-cbc\": {\n cipher: \"AES\",\n key: 256,\n iv: 16,\n mode: \"CBC\",\n type: \"block\"\n },\n aes128: {\n cipher: \"AES\",\n key: 128,\n iv: 16,\n mode: \"CBC\",\n type: \"block\"\n },\n aes192: {\n cipher: \"AES\",\n key: 192,\n iv: 16,\n mode: \"CBC\",\n type: \"block\"\n },\n aes256: {\n cipher: \"AES\",\n key: 256,\n iv: 16,\n mode: \"CBC\",\n type: \"block\"\n },\n \"aes-128-cfb\": {\n cipher: \"AES\",\n key: 128,\n iv: 16,\n mode: \"CFB\",\n type: \"stream\"\n },\n \"aes-192-cfb\": {\n cipher: \"AES\",\n key: 192,\n iv: 16,\n mode: \"CFB\",\n type: \"stream\"\n },\n \"aes-256-cfb\": {\n cipher: \"AES\",\n key: 256,\n iv: 16,\n mode: \"CFB\",\n type: \"stream\"\n },\n \"aes-128-cfb8\": {\n cipher: \"AES\",\n key: 128,\n iv: 16,\n mode: \"CFB8\",\n type: \"stream\"\n },\n \"aes-192-cfb8\": {\n cipher: \"AES\",\n key: 192,\n iv: 16,\n mode: \"CFB8\",\n type: \"stream\"\n },\n \"aes-256-cfb8\": {\n cipher: \"AES\",\n key: 256,\n iv: 16,\n mode: \"CFB8\",\n type: \"stream\"\n },\n \"aes-128-cfb1\": {\n cipher: \"AES\",\n key: 128,\n iv: 16,\n mode: \"CFB1\",\n type: \"stream\"\n },\n \"aes-192-cfb1\": {\n cipher: \"AES\",\n key: 192,\n iv: 16,\n mode: \"CFB1\",\n type: \"stream\"\n },\n \"aes-256-cfb1\": {\n cipher: \"AES\",\n key: 256,\n iv: 16,\n mode: \"CFB1\",\n type: \"stream\"\n },\n \"aes-128-ofb\": {\n cipher: \"AES\",\n key: 128,\n iv: 16,\n mode: \"OFB\",\n type: \"stream\"\n },\n \"aes-192-ofb\": {\n cipher: \"AES\",\n key: 192,\n iv: 16,\n mode: \"OFB\",\n type: \"stream\"\n },\n \"aes-256-ofb\": {\n cipher: \"AES\",\n key: 256,\n iv: 16,\n mode: \"OFB\",\n type: \"stream\"\n },\n \"aes-128-ctr\": {\n cipher: \"AES\",\n key: 128,\n iv: 16,\n mode: \"CTR\",\n type: \"stream\"\n },\n \"aes-192-ctr\": {\n cipher: \"AES\",\n key: 192,\n iv: 16,\n mode: \"CTR\",\n type: \"stream\"\n },\n \"aes-256-ctr\": {\n cipher: \"AES\",\n key: 256,\n iv: 16,\n mode: \"CTR\",\n type: \"stream\"\n },\n \"aes-128-gcm\": {\n cipher: \"AES\",\n key: 128,\n iv: 12,\n mode: \"GCM\",\n type: \"auth\"\n },\n \"aes-192-gcm\": {\n cipher: \"AES\",\n key: 192,\n iv: 12,\n mode: \"GCM\",\n type: \"auth\"\n },\n \"aes-256-gcm\": {\n cipher: \"AES\",\n key: 256,\n iv: 12,\n mode: \"GCM\",\n type: \"auth\"\n }\n };\n }\n}), require_modes = __commonJS({\n \"node_modules/browserify-aes/modes/index.js\"(exports, module) {\n var modeModules = {\n ECB: require_ecb(),\n CBC: require_cbc2(),\n CFB: require_cfb(),\n CFB8: require_cfb8(),\n CFB1: require_cfb1(),\n OFB: require_ofb(),\n CTR: require_ctr(),\n GCM: require_ctr()\n }, modes = require_list();\n for (key2 in modes)\n modes[key2].module = modeModules[modes[key2].mode];\n var key2;\n module.exports = modes;\n }\n}), require_aes = __commonJS({\n \"node_modules/browserify-aes/aes.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer;\n function asUInt32Array(buf) {\n if (buf instanceof KeyObject)\n buf = buf.export();\n else if (buf instanceof CryptoKey)\n buf = KeyObject.from(buf).export();\n Buffer2.isBuffer(buf) || (buf = Buffer2.from(buf));\n for (var len = buf.length / 4 | 0, out = new @Array(len), i = 0;i < len; i++)\n out[i] = buf.readUInt32BE(i * 4);\n return out;\n }\n function scrubVec(v) {\n for (var i = 0;i < v.length; v++)\n v[i] = 0;\n }\n function cryptBlock(M, keySchedule, SUB_MIX, SBOX, nRounds) {\n for (var SUB_MIX0 = SUB_MIX[0], SUB_MIX1 = SUB_MIX[1], SUB_MIX2 = SUB_MIX[2], SUB_MIX3 = SUB_MIX[3], s0 = M[0] ^ keySchedule[0], s1 = M[1] ^ keySchedule[1], s2 = M[2] ^ keySchedule[2], s3 = M[3] ^ keySchedule[3], t0, t1, t2, t3, ksRow = 4, round = 1;round < nRounds; round++)\n t0 = SUB_MIX0[s0 >>> 24] ^ SUB_MIX1[s1 >>> 16 & 255] ^ SUB_MIX2[s2 >>> 8 & 255] ^ SUB_MIX3[s3 & 255] ^ keySchedule[ksRow++], t1 = SUB_MIX0[s1 >>> 24] ^ SUB_MIX1[s2 >>> 16 & 255] ^ SUB_MIX2[s3 >>> 8 & 255] ^ SUB_MIX3[s0 & 255] ^ keySchedule[ksRow++], t2 = SUB_MIX0[s2 >>> 24] ^ SUB_MIX1[s3 >>> 16 & 255] ^ SUB_MIX2[s0 >>> 8 & 255] ^ SUB_MIX3[s1 & 255] ^ keySchedule[ksRow++], t3 = SUB_MIX0[s3 >>> 24] ^ SUB_MIX1[s0 >>> 16 & 255] ^ SUB_MIX2[s1 >>> 8 & 255] ^ SUB_MIX3[s2 & 255] ^ keySchedule[ksRow++], s0 = t0, s1 = t1, s2 = t2, s3 = t3;\n return t0 = (SBOX[s0 >>> 24] << 24 | SBOX[s1 >>> 16 & 255] << 16 | SBOX[s2 >>> 8 & 255] << 8 | SBOX[s3 & 255]) ^ keySchedule[ksRow++], t1 = (SBOX[s1 >>> 24] << 24 | SBOX[s2 >>> 16 & 255] << 16 | SBOX[s3 >>> 8 & 255] << 8 | SBOX[s0 & 255]) ^ keySchedule[ksRow++], t2 = (SBOX[s2 >>> 24] << 24 | SBOX[s3 >>> 16 & 255] << 16 | SBOX[s0 >>> 8 & 255] << 8 | SBOX[s1 & 255]) ^ keySchedule[ksRow++], t3 = (SBOX[s3 >>> 24] << 24 | SBOX[s0 >>> 16 & 255] << 16 | SBOX[s1 >>> 8 & 255] << 8 | SBOX[s2 & 255]) ^ keySchedule[ksRow++], t0 = t0 >>> 0, t1 = t1 >>> 0, t2 = t2 >>> 0, t3 = t3 >>> 0, [t0, t1, t2, t3];\n }\n var RCON = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], G = function() {\n for (var d = new @Array(256), j = 0;j < 256; j++)\n j < 128 \? d[j] = j << 1 : d[j] = j << 1 ^ 283;\n for (var SBOX = [], INV_SBOX = [], SUB_MIX = [[], [], [], []], INV_SUB_MIX = [[], [], [], []], x = 0, xi = 0, i = 0;i < 256; ++i) {\n var sx = xi ^ xi << 1 ^ xi << 2 ^ xi << 3 ^ xi << 4;\n sx = sx >>> 8 ^ sx & 255 ^ 99, SBOX[x] = sx, INV_SBOX[sx] = x;\n var x2 = d[x], x4 = d[x2], x8 = d[x4], t = d[sx] * 257 ^ sx * 16843008;\n SUB_MIX[0][x] = t << 24 | t >>> 8, SUB_MIX[1][x] = t << 16 | t >>> 16, SUB_MIX[2][x] = t << 8 | t >>> 24, SUB_MIX[3][x] = t, t = x8 * 16843009 ^ x4 * 65537 ^ x2 * 257 ^ x * 16843008, INV_SUB_MIX[0][sx] = t << 24 | t >>> 8, INV_SUB_MIX[1][sx] = t << 16 | t >>> 16, INV_SUB_MIX[2][sx] = t << 8 | t >>> 24, INV_SUB_MIX[3][sx] = t, x === 0 \? x = xi = 1 : (x = x2 ^ d[d[d[x8 ^ x2]]], xi ^= d[d[xi]]);\n }\n return {\n SBOX,\n INV_SBOX,\n SUB_MIX,\n INV_SUB_MIX\n };\n }();\n function AES(key2) {\n this._key = asUInt32Array(key2), this._reset();\n }\n AES.prototype = {}, AES.blockSize = 16, AES.keySize = 32, AES.prototype.blockSize = AES.blockSize, AES.prototype.keySize = AES.keySize, AES.prototype._reset = function() {\n for (var keyWords = this._key, keySize = keyWords.length, nRounds = keySize + 6, ksRows = (nRounds + 1) * 4, keySchedule = [], k = 0;k < keySize; k++)\n keySchedule[k] = keyWords[k];\n for (k = keySize;k < ksRows; k++) {\n var t = keySchedule[k - 1];\n k % keySize === 0 \? (t = t << 8 | t >>> 24, t = G.SBOX[t >>> 24] << 24 | G.SBOX[t >>> 16 & 255] << 16 | G.SBOX[t >>> 8 & 255] << 8 | G.SBOX[t & 255], t ^= RCON[k / keySize | 0] << 24) : keySize > 6 && k % keySize === 4 && (t = G.SBOX[t >>> 24] << 24 | G.SBOX[t >>> 16 & 255] << 16 | G.SBOX[t >>> 8 & 255] << 8 | G.SBOX[t & 255]), keySchedule[k] = keySchedule[k - keySize] ^ t;\n }\n for (var invKeySchedule = [], ik = 0;ik < ksRows; ik++) {\n var ksR = ksRows - ik, tt = keySchedule[ksR - (ik % 4 \? 0 : 4)];\n ik < 4 || ksR <= 4 \? invKeySchedule[ik] = tt : invKeySchedule[ik] = G.INV_SUB_MIX[0][G.SBOX[tt >>> 24]] ^ G.INV_SUB_MIX[1][G.SBOX[tt >>> 16 & 255]] ^ G.INV_SUB_MIX[2][G.SBOX[tt >>> 8 & 255]] ^ G.INV_SUB_MIX[3][G.SBOX[tt & 255]];\n }\n this._nRounds = nRounds, this._keySchedule = keySchedule, this._invKeySchedule = invKeySchedule;\n }, AES.prototype.encryptBlockRaw = function(M) {\n return M = asUInt32Array(M), cryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX, this._nRounds);\n }, AES.prototype.encryptBlock = function(M) {\n var out = this.encryptBlockRaw(M), buf = Buffer2.allocUnsafe(16);\n return buf.writeUInt32BE(out[0], 0), buf.writeUInt32BE(out[1], 4), buf.writeUInt32BE(out[2], 8), buf.writeUInt32BE(out[3], 12), buf;\n }, AES.prototype.decryptBlock = function(M) {\n M = asUInt32Array(M);\n var m1 = M[1];\n M[1] = M[3], M[3] = m1;\n var out = cryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX, this._nRounds), buf = Buffer2.allocUnsafe(16);\n return buf.writeUInt32BE(out[0], 0), buf.writeUInt32BE(out[3], 4), buf.writeUInt32BE(out[2], 8), buf.writeUInt32BE(out[1], 12), buf;\n }, AES.prototype.scrub = function() {\n scrubVec(this._keySchedule), scrubVec(this._invKeySchedule), scrubVec(this._key);\n }, module.exports.AES = AES;\n }\n}), require_ghash = __commonJS({\n \"node_modules/browserify-aes/ghash.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer, ZEROES = Buffer2.alloc(16, 0);\n function toArray(buf) {\n return [buf.readUInt32BE(0), buf.readUInt32BE(4), buf.readUInt32BE(8), buf.readUInt32BE(12)];\n }\n function fromArray(out) {\n var buf = Buffer2.allocUnsafe(16);\n return buf.writeUInt32BE(out[0] >>> 0, 0), buf.writeUInt32BE(out[1] >>> 0, 4), buf.writeUInt32BE(out[2] >>> 0, 8), buf.writeUInt32BE(out[3] >>> 0, 12), buf;\n }\n function GHASH(key2) {\n this.h = key2, this.state = Buffer2.alloc(16, 0), this.cache = Buffer2.allocUnsafe(0);\n }\n GHASH.prototype = {}, GHASH.prototype.ghash = function(block) {\n for (var i = -1;++i < block.length; )\n this.state[i] ^= block[i];\n this._multiply();\n }, GHASH.prototype._multiply = function() {\n for (var Vi = toArray(this.h), Zi = [0, 0, 0, 0], j, xi, lsbVi, i = -1;++i < 128; ) {\n for (xi = (this.state[~~(i / 8)] & 1 << 7 - i % 8) !== 0, xi && (Zi[0] ^= Vi[0], Zi[1] ^= Vi[1], Zi[2] ^= Vi[2], Zi[3] ^= Vi[3]), lsbVi = (Vi[3] & 1) !== 0, j = 3;j > 0; j--)\n Vi[j] = Vi[j] >>> 1 | (Vi[j - 1] & 1) << 31;\n Vi[0] = Vi[0] >>> 1, lsbVi && (Vi[0] = Vi[0] ^ 225 << 24);\n }\n this.state = fromArray(Zi);\n }, GHASH.prototype.update = function(buf) {\n this.cache = Buffer2.concat([this.cache, buf]);\n for (var chunk;this.cache.length >= 16; )\n chunk = this.cache.slice(0, 16), this.cache = this.cache.slice(16), this.ghash(chunk);\n }, GHASH.prototype.final = function(abl, bl) {\n return this.cache.length && this.ghash(Buffer2.concat([this.cache, ZEROES], 16)), this.ghash(fromArray([0, abl, 0, bl])), this.state;\n }, module.exports = GHASH;\n }\n}), require_authCipher = __commonJS({\n \"node_modules/browserify-aes/authCipher.js\"(exports, module) {\n var aes = require_aes(), Buffer2 = require_safe_buffer().Buffer, Transform = require_cipher_base(), inherits = require_inherits_browser(), GHASH = require_ghash(), xor = require_buffer_xor(), incr32 = require_incr32();\n function xorTest(a, b) {\n var out = 0;\n a.length !== b.length && out++;\n for (var len = Math.min(a.length, b.length), i = 0;i < len; ++i)\n out += a[i] ^ b[i];\n return out;\n }\n function calcIv(self2, iv, ck) {\n if (iv.length === 12)\n return self2._finID = Buffer2.concat([iv, Buffer2.from([0, 0, 0, 1])]), Buffer2.concat([iv, Buffer2.from([0, 0, 0, 2])]);\n var ghash = new GHASH(ck), len = iv.length, toPad = len % 16;\n ghash.update(iv), toPad && (toPad = 16 - toPad, ghash.update(Buffer2.alloc(toPad, 0))), ghash.update(Buffer2.alloc(8, 0));\n var ivBits = len * 8, tail = Buffer2.alloc(8);\n tail.writeUIntBE(ivBits, 2, 6), ghash.update(tail), self2._finID = ghash.state;\n var out = Buffer2.from(self2._finID);\n return incr32(out), out;\n }\n function StreamCipher(mode, key2, iv, decrypt) {\n Transform.@call(this);\n var h = Buffer2.alloc(4, 0);\n this._cipher = new aes.AES(key2);\n var ck = this._cipher.encryptBlock(h);\n this._ghash = new GHASH(ck), iv = calcIv(this, iv, ck), this._prev = Buffer2.from(iv), this._cache = Buffer2.allocUnsafe(0), this._secCache = Buffer2.allocUnsafe(0), this._decrypt = decrypt, this._alen = 0, this._len = 0, this._mode = mode, this._authTag = null, this._called = !1;\n }\n inherits(StreamCipher, Transform), StreamCipher.prototype._update = function(chunk) {\n if (!this._called && this._alen) {\n var rump = 16 - this._alen % 16;\n rump < 16 && (rump = Buffer2.alloc(rump, 0), this._ghash.update(rump));\n }\n this._called = !0;\n var out = this._mode.encrypt(this, chunk);\n return this._decrypt \? this._ghash.update(chunk) : this._ghash.update(out), this._len += chunk.length, out;\n }, StreamCipher.prototype._final = function() {\n if (this._decrypt && !this._authTag)\n throw new Error(\"Unsupported state or unable to authenticate data\");\n var tag = xor(this._ghash.final(this._alen * 8, this._len * 8), this._cipher.encryptBlock(this._finID));\n if (this._decrypt && xorTest(tag, this._authTag))\n throw new Error(\"Unsupported state or unable to authenticate data\");\n this._authTag = tag, this._cipher.scrub();\n }, StreamCipher.prototype.getAuthTag = function() {\n if (this._decrypt || !Buffer2.isBuffer(this._authTag))\n throw new Error(\"Attempting to get auth tag in unsupported state\");\n return this._authTag;\n }, StreamCipher.prototype.setAuthTag = function(tag) {\n if (!this._decrypt)\n throw new Error(\"Attempting to set auth tag in unsupported state\");\n this._authTag = tag;\n }, StreamCipher.prototype.setAAD = function(buf) {\n if (this._called)\n throw new Error(\"Attempting to set AAD in unsupported state\");\n this._ghash.update(buf), this._alen += buf.length;\n }, module.exports = StreamCipher;\n }\n}), require_streamCipher = __commonJS({\n \"node_modules/browserify-aes/streamCipher.js\"(exports, module) {\n var aes = require_aes(), Buffer2 = require_safe_buffer().Buffer, Transform = require_cipher_base(), inherits = require_inherits_browser();\n function StreamCipher(mode, key2, iv, decrypt) {\n Transform.@call(this), this._cipher = new aes.AES(key2), this._prev = Buffer2.from(iv), this._cache = Buffer2.allocUnsafe(0), this._secCache = Buffer2.allocUnsafe(0), this._decrypt = decrypt, this._mode = mode;\n }\n inherits(StreamCipher, Transform), StreamCipher.prototype._update = function(chunk) {\n return this._mode.encrypt(this, chunk, this._decrypt);\n }, StreamCipher.prototype._final = function() {\n this._cipher.scrub();\n }, module.exports = StreamCipher;\n }\n}), require_evp_bytestokey = __commonJS({\n \"node_modules/evp_bytestokey/index.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer, MD5 = require_md5();\n function EVP_BytesToKey(password, salt, keyBits, ivLen) {\n if (Buffer2.isBuffer(password) || (password = Buffer2.from(password, \"binary\")), salt && (Buffer2.isBuffer(salt) || (salt = Buffer2.from(salt, \"binary\")), salt.length !== 8))\n @throwRangeError(\"salt should be Buffer with 8 byte length\");\n for (var keyLen = keyBits / 8, key2 = Buffer2.alloc(keyLen), iv = Buffer2.alloc(ivLen || 0), tmp = Buffer2.alloc(0);keyLen > 0 || ivLen > 0; ) {\n var hash = new MD5;\n hash.update(tmp), hash.update(password), salt && hash.update(salt), tmp = hash.digest();\n var used = 0;\n if (keyLen > 0) {\n var keyStart = key2.length - keyLen;\n used = Math.min(keyLen, tmp.length), tmp.copy(key2, keyStart, 0, used), keyLen -= used;\n }\n if (used < tmp.length && ivLen > 0) {\n var ivStart = iv.length - ivLen, length = Math.min(ivLen, tmp.length - used);\n tmp.copy(iv, ivStart, used, used + length), ivLen -= length;\n }\n }\n return tmp.fill(0), { key: key2, iv };\n }\n module.exports = EVP_BytesToKey;\n }\n}), require_encrypter = __commonJS({\n \"node_modules/browserify-aes/encrypter.js\"(exports) {\n var MODES = require_modes(), AuthCipher = require_authCipher(), Buffer2 = require_safe_buffer().Buffer, StreamCipher = require_streamCipher(), Transform = require_cipher_base(), aes = require_aes(), ebtk = require_evp_bytestokey(), inherits = require_inherits_browser();\n function Cipher(mode, key2, iv) {\n Transform.@call(this), this._cache = new Splitter, this._cipher = new aes.AES(key2), this._prev = Buffer2.from(iv), this._mode = mode, this._autopadding = !0;\n }\n inherits(Cipher, Transform), Cipher.prototype._update = function(data) {\n this._cache.add(data);\n for (var chunk, thing, out = [];chunk = this._cache.get(); )\n thing = this._mode.encrypt(this, chunk), out.push(thing);\n return Buffer2.concat(out);\n };\n var PADDING = Buffer2.alloc(16, 16);\n Cipher.prototype._final = function() {\n var chunk = this._cache.flush();\n if (this._autopadding)\n return chunk = this._mode.encrypt(this, chunk), this._cipher.scrub(), chunk;\n if (!chunk.equals(PADDING))\n throw this._cipher.scrub(), new Error(\"data not multiple of block length\");\n }, Cipher.prototype.setAutoPadding = function(setTo) {\n return this._autopadding = !!setTo, this;\n };\n function Splitter() {\n this.cache = Buffer2.allocUnsafe(0);\n }\n Splitter.prototype = {}, Splitter.prototype.add = function(data) {\n this.cache = Buffer2.concat([this.cache, data]);\n }, Splitter.prototype.get = function() {\n if (this.cache.length > 15) {\n var out = this.cache.slice(0, 16);\n return this.cache = this.cache.slice(16), out;\n }\n return null;\n }, Splitter.prototype.flush = function() {\n for (var len = 16 - this.cache.length, padBuff = Buffer2.allocUnsafe(len), i = -1;++i < len; )\n padBuff.writeUInt8(len, i);\n return Buffer2.concat([this.cache, padBuff]);\n };\n function createCipheriv(suite, password, iv) {\n var config = MODES[suite.toLowerCase()];\n if (!config)\n @throwTypeError(\"invalid suite type\");\n password = getArrayBufferOrView(password, \"password\");\n const iv_length = iv\?.length || 0, required_iv_length = config.iv || 0;\n if (iv = iv === null \? EMPTY_BUFFER : getArrayBufferOrView(iv, \"iv\"), password\?.length !== config.key / 8) {\n var error = new RangeError(\"Invalid key length\");\n throw error.code = \"ERR_CRYPTO_INVALID_KEYLEN\", error;\n }\n if (config.mode !== \"GCM\" && iv_length !== required_iv_length) {\n var error = new RangeError(\"Invalid key length\");\n throw error.code = \"ERR_CRYPTO_INVALID_KEYLEN\", error;\n }\n return config.type === \"stream\" \? new StreamCipher(config.module, password, iv) : config.type === \"auth\" \? new AuthCipher(config.module, password, iv) : new Cipher(config.module, password, iv);\n }\n function createCipher(suite, password) {\n var config = MODES[suite.toLowerCase()];\n if (!config)\n @throwTypeError(\"invalid suite type\");\n var keys = ebtk(password, !1, config.key, config.iv);\n return createCipheriv(suite, keys.key, keys.iv);\n }\n exports.createCipheriv = createCipheriv, exports.createCipher = createCipher;\n }\n}), require_decrypter = __commonJS({\n \"node_modules/browserify-aes/decrypter.js\"(exports) {\n var AuthCipher = require_authCipher(), Buffer2 = require_safe_buffer().Buffer, MODES = require_modes(), StreamCipher = require_streamCipher(), Transform = require_cipher_base(), aes = require_aes(), ebtk = require_evp_bytestokey(), inherits = require_inherits_browser();\n function Decipher(mode, key2, iv) {\n Transform.@call(this), this._cache = new Splitter, this._last = void 0, this._cipher = new aes.AES(key2), this._prev = Buffer2.from(iv), this._mode = mode, this._autopadding = !0;\n }\n inherits(Decipher, Transform), Decipher.prototype._update = function(data) {\n this._cache.add(data);\n for (var chunk, thing, out = [];chunk = this._cache.get(this._autopadding); )\n thing = this._mode.decrypt(this, chunk), out.push(thing);\n return Buffer2.concat(out);\n }, Decipher.prototype._final = function() {\n var chunk = this._cache.flush();\n if (this._autopadding)\n return unpad(this._mode.decrypt(this, chunk));\n if (chunk)\n throw new Error(\"data not multiple of block length\");\n }, Decipher.prototype.setAutoPadding = function(setTo) {\n return this._autopadding = !!setTo, this;\n };\n function Splitter() {\n this.cache = Buffer2.allocUnsafe(0);\n }\n Splitter.prototype = {}, Splitter.prototype.add = function(data) {\n this.cache = Buffer2.concat([this.cache, data]);\n }, Splitter.prototype.get = function(autoPadding) {\n var out;\n if (autoPadding) {\n if (this.cache.length > 16)\n return out = this.cache.slice(0, 16), this.cache = this.cache.slice(16), out;\n } else if (this.cache.length >= 16)\n return out = this.cache.slice(0, 16), this.cache = this.cache.slice(16), out;\n return null;\n }, Splitter.prototype.flush = function() {\n if (this.cache.length)\n return this.cache;\n };\n function unpad(last) {\n var padded = last[15];\n if (padded < 1 || padded > 16)\n throw new Error(\"unable to decrypt data\");\n for (var i = -1;++i < padded; )\n if (last[i + (16 - padded)] !== padded)\n throw new Error(\"unable to decrypt data\");\n if (padded !== 16)\n return last.slice(0, 16 - padded);\n }\n function createDecipheriv(suite, password, iv) {\n var config = MODES[suite.toLowerCase()];\n if (!config)\n @throwTypeError(\"invalid suite type\");\n password = getArrayBufferOrView(password, \"password\");\n const iv_length = iv\?.length || 0, required_iv_length = config.iv || 0;\n if (iv = iv === null \? EMPTY_BUFFER : getArrayBufferOrView(iv, \"iv\"), config.mode !== \"GCM\" && iv_length !== required_iv_length) {\n var error = new RangeError(\"Invalid key length\");\n throw error.code = \"ERR_CRYPTO_INVALID_KEYLEN\", error;\n }\n if (password.length !== config.key / 8) {\n var error = new RangeError(\"Invalid key length\");\n throw error.code = \"ERR_CRYPTO_INVALID_KEYLEN\", error;\n }\n return config.type === \"stream\" \? new StreamCipher(config.module, password, iv, !0) : config.type === \"auth\" \? new AuthCipher(config.module, password, iv, !0) : new Decipher(config.module, password, iv);\n }\n function createDecipher(suite, password) {\n var config = MODES[suite.toLowerCase()];\n if (!config)\n @throwTypeError(\"invalid suite type\");\n var keys = ebtk(password, !1, config.key, config.iv);\n return createDecipheriv(suite, keys.key, keys.iv);\n }\n exports.createDecipher = createDecipher, exports.createDecipheriv = createDecipheriv;\n }\n}), require_browser5 = __commonJS({\n \"node_modules/browserify-aes/browser.js\"(exports) {\n var ciphers = require_encrypter(), deciphers = require_decrypter(), modes = require_list();\n function getCiphers() {\n return Object.keys(modes);\n }\n exports.createCipher = exports.Cipher = ciphers.createCipher, exports.createCipheriv = exports.Cipheriv = ciphers.createCipheriv, exports.createDecipher = exports.Decipher = deciphers.createDecipher, exports.createDecipheriv = exports.Decipheriv = deciphers.createDecipheriv, exports.listCiphers = exports.getCiphers = getCiphers;\n }\n}), require_modes2 = __commonJS({\n \"node_modules/browserify-des/modes.js\"(exports) {\n exports[\"des-ecb\"] = {\n key: 8,\n iv: 0\n }, exports[\"des-cbc\"] = exports.des = {\n key: 8,\n iv: 8\n }, exports[\"des-ede3-cbc\"] = exports.des3 = {\n key: 24,\n iv: 8\n }, exports[\"des-ede3\"] = {\n key: 24,\n iv: 0\n }, exports[\"des-ede-cbc\"] = {\n key: 16,\n iv: 8\n }, exports[\"des-ede\"] = {\n key: 16,\n iv: 0\n };\n }\n}), require_browser6 = __commonJS({\n \"node_modules/browserify-cipher/browser.js\"(exports) {\n var DES = require_browserify_des(), aes = require_browser5(), aesModes = require_modes(), desModes = require_modes2(), ebtk = require_evp_bytestokey();\n function createCipher(suite, password) {\n suite = suite.toLowerCase();\n var keyLen, ivLen;\n if (aesModes[suite])\n keyLen = aesModes[suite].key, ivLen = aesModes[suite].iv;\n else if (desModes[suite])\n keyLen = desModes[suite].key * 8, ivLen = desModes[suite].iv;\n else\n @throwTypeError(\"invalid suite type\");\n var keys = ebtk(password, !1, keyLen, ivLen);\n return createCipheriv(suite, keys.key, keys.iv);\n }\n function createDecipher(suite, password) {\n suite = suite.toLowerCase();\n var keyLen, ivLen;\n if (aesModes[suite])\n keyLen = aesModes[suite].key, ivLen = aesModes[suite].iv;\n else if (desModes[suite])\n keyLen = desModes[suite].key * 8, ivLen = desModes[suite].iv;\n else\n @throwTypeError(\"invalid suite type\");\n var keys = ebtk(password, !1, keyLen, ivLen);\n return createDecipheriv(suite, keys.key, keys.iv);\n }\n function createCipheriv(suite, key2, iv) {\n if (suite = suite.toLowerCase(), aesModes[suite])\n return aes.createCipheriv(suite, key2, iv);\n if (desModes[suite])\n return new DES({ key: key2, iv, mode: suite });\n @throwTypeError(\"invalid suite type\");\n }\n function createDecipheriv(suite, key2, iv) {\n if (suite = suite.toLowerCase(), aesModes[suite])\n return aes.createDecipheriv(suite, key2, iv);\n if (desModes[suite])\n return new DES({ key: key2, iv, mode: suite, decrypt: !0 });\n @throwTypeError(\"invalid suite type\");\n }\n function getCiphers() {\n return Object.keys(desModes).concat(aes.getCiphers());\n }\n exports.createCipher = exports.Cipher = createCipher, exports.createCipheriv = exports.Cipheriv = createCipheriv, exports.createDecipher = exports.Decipher = createDecipher, exports.createDecipheriv = exports.Decipheriv = createDecipheriv, exports.listCiphers = exports.getCiphers = getCiphers;\n }\n}), require_bn = __commonJS({\n \"node_modules/diffie-hellman/node_modules/bn.js/lib/bn.js\"(exports, module) {\n (function(module2, exports2) {\n function assert(val, msg) {\n if (!val)\n throw new Error(msg || \"Assertion failed\");\n }\n function inherits(ctor, superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function() {\n };\n TempCtor.prototype = superCtor.prototype, ctor.prototype = new TempCtor, ctor.prototype.constructor = ctor;\n }\n function BN(number, base, endian) {\n if (BN.isBN(number))\n return number;\n this.negative = 0, this.words = null, this.length = 0, this.red = null, number !== null && ((base === \"le\" || base === \"be\") && (endian = base, base = 10), this._init(number || 0, base || 10, endian || \"be\"));\n }\n BN.prototype = {}, typeof module2 == \"object\" \? module2.exports = BN : exports2.BN = BN, BN.BN = BN, BN.wordSize = 26;\n var Buffer2 = Buffer;\n BN.isBN = function(num) {\n return num instanceof BN \? !0 : num !== null && typeof num == \"object\" && num.constructor.wordSize === BN.wordSize && @Array.isArray(num.words);\n }, BN.max = function(left, right) {\n return left.cmp(right) > 0 \? left : right;\n }, BN.min = function(left, right) {\n return left.cmp(right) < 0 \? left : right;\n }, BN.prototype._init = function(number, base, endian) {\n if (typeof number == \"number\")\n return this._initNumber(number, base, endian);\n if (typeof number == \"object\")\n return this._initArray(number, base, endian);\n base === \"hex\" && (base = 16), assert(base === (base | 0) && base >= 2 && base <= 36), number = number.toString().replace(/\\s+/g, \"\");\n var start = 0;\n number[0] === \"-\" && (start++, this.negative = 1), start < number.length && (base === 16 \? this._parseHex(number, start, endian) : (this._parseBase(number, base, start), endian === \"le\" && this._initArray(this.toArray(), base, endian)));\n }, BN.prototype._initNumber = function(number, base, endian) {\n number < 0 && (this.negative = 1, number = -number), number < 67108864 \? (this.words = [number & 67108863], this.length = 1) : number < 4503599627370496 \? (this.words = [number & 67108863, number / 67108864 & 67108863], this.length = 2) : (assert(number < 9007199254740992), this.words = [number & 67108863, number / 67108864 & 67108863, 1], this.length = 3), endian === \"le\" && this._initArray(this.toArray(), base, endian);\n }, BN.prototype._initArray = function(number, base, endian) {\n if (assert(typeof number.length == \"number\"), number.length <= 0)\n return this.words = [0], this.length = 1, this;\n this.length = Math.ceil(number.length / 3), this.words = new @Array(this.length);\n for (var i = 0;i < this.length; i++)\n this.words[i] = 0;\n var j, w, off = 0;\n if (endian === \"be\")\n for (i = number.length - 1, j = 0;i >= 0; i -= 3)\n w = number[i] | number[i - 1] << 8 | number[i - 2] << 16, this.words[j] |= w << off & 67108863, this.words[j + 1] = w >>> 26 - off & 67108863, off += 24, off >= 26 && (off -= 26, j++);\n else if (endian === \"le\")\n for (i = 0, j = 0;i < number.length; i += 3)\n w = number[i] | number[i + 1] << 8 | number[i + 2] << 16, this.words[j] |= w << off & 67108863, this.words[j + 1] = w >>> 26 - off & 67108863, off += 24, off >= 26 && (off -= 26, j++);\n return this.strip();\n };\n function parseHex4Bits(string, index) {\n var c = string.charCodeAt(index);\n return c >= 65 && c <= 70 \? c - 55 : c >= 97 && c <= 102 \? c - 87 : c - 48 & 15;\n }\n function parseHexByte(string, lowerBound, index) {\n var r = parseHex4Bits(string, index);\n return index - 1 >= lowerBound && (r |= parseHex4Bits(string, index - 1) << 4), r;\n }\n BN.prototype._parseHex = function(number, start, endian) {\n this.length = Math.ceil((number.length - start) / 6), this.words = new @Array(this.length);\n for (var i = 0;i < this.length; i++)\n this.words[i] = 0;\n var off = 0, j = 0, w;\n if (endian === \"be\")\n for (i = number.length - 1;i >= start; i -= 2)\n w = parseHexByte(number, start, i) << off, this.words[j] |= w & 67108863, off >= 18 \? (off -= 18, j += 1, this.words[j] |= w >>> 26) : off += 8;\n else {\n var parseLength = number.length - start;\n for (i = parseLength % 2 === 0 \? start + 1 : start;i < number.length; i += 2)\n w = parseHexByte(number, start, i) << off, this.words[j] |= w & 67108863, off >= 18 \? (off -= 18, j += 1, this.words[j] |= w >>> 26) : off += 8;\n }\n this.strip();\n };\n function parseBase(str, start, end, mul) {\n for (var r = 0, len = Math.min(str.length, end), i = start;i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n r *= mul, c >= 49 \? r += c - 49 + 10 : c >= 17 \? r += c - 17 + 10 : r += c;\n }\n return r;\n }\n BN.prototype._parseBase = function(number, base, start) {\n this.words = [0], this.length = 1;\n for (var limbLen = 0, limbPow = 1;limbPow <= 67108863; limbPow *= base)\n limbLen++;\n limbLen--, limbPow = limbPow / base | 0;\n for (var total = number.length - start, mod = total % limbLen, end = Math.min(total, total - mod) + start, word = 0, i = start;i < end; i += limbLen)\n word = parseBase(number, i, i + limbLen, base), this.imuln(limbPow), this.words[0] + word < 67108864 \? this.words[0] += word : this._iaddn(word);\n if (mod !== 0) {\n var pow = 1;\n for (word = parseBase(number, i, number.length, base), i = 0;i < mod; i++)\n pow *= base;\n this.imuln(pow), this.words[0] + word < 67108864 \? this.words[0] += word : this._iaddn(word);\n }\n this.strip();\n }, BN.prototype.copy = function(dest) {\n dest.words = new @Array(this.length);\n for (var i = 0;i < this.length; i++)\n dest.words[i] = this.words[i];\n dest.length = this.length, dest.negative = this.negative, dest.red = this.red;\n }, BN.prototype.clone = function() {\n var r = new BN(null);\n return this.copy(r), r;\n }, BN.prototype._expand = function(size) {\n for (;this.length < size; )\n this.words[this.length++] = 0;\n return this;\n }, BN.prototype.strip = function() {\n for (;this.length > 1 && this.words[this.length - 1] === 0; )\n this.length--;\n return this._normSign();\n }, BN.prototype._normSign = function() {\n return this.length === 1 && this.words[0] === 0 && (this.negative = 0), this;\n }, BN.prototype.inspect = function() {\n return (this.red \? \"\";\n };\n var zeros = [\n \"\",\n \"0\",\n \"00\",\n \"000\",\n \"0000\",\n \"00000\",\n \"000000\",\n \"0000000\",\n \"00000000\",\n \"000000000\",\n \"0000000000\",\n \"00000000000\",\n \"000000000000\",\n \"0000000000000\",\n \"00000000000000\",\n \"000000000000000\",\n \"0000000000000000\",\n \"00000000000000000\",\n \"000000000000000000\",\n \"0000000000000000000\",\n \"00000000000000000000\",\n \"000000000000000000000\",\n \"0000000000000000000000\",\n \"00000000000000000000000\",\n \"000000000000000000000000\",\n \"0000000000000000000000000\"\n ], groupSizes = [\n 0,\n 0,\n 25,\n 16,\n 12,\n 11,\n 10,\n 9,\n 8,\n 8,\n 7,\n 7,\n 7,\n 7,\n 6,\n 6,\n 6,\n 6,\n 6,\n 6,\n 6,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5\n ], groupBases = [\n 0,\n 0,\n 33554432,\n 43046721,\n 16777216,\n 48828125,\n 60466176,\n 40353607,\n 16777216,\n 43046721,\n 1e7,\n 19487171,\n 35831808,\n 62748517,\n 7529536,\n 11390625,\n 16777216,\n 24137569,\n 34012224,\n 47045881,\n 64000000,\n 4084101,\n 5153632,\n 6436343,\n 7962624,\n 9765625,\n 11881376,\n 14348907,\n 17210368,\n 20511149,\n 24300000,\n 28629151,\n 33554432,\n 39135393,\n 45435424,\n 52521875,\n 60466176\n ];\n BN.prototype.toString = function(base, padding) {\n base = base || 10, padding = padding | 0 || 1;\n var out;\n if (base === 16 || base === \"hex\") {\n out = \"\";\n for (var off = 0, carry = 0, i = 0;i < this.length; i++) {\n var w = this.words[i], word = ((w << off | carry) & 16777215).toString(16);\n carry = w >>> 24 - off & 16777215, carry !== 0 || i !== this.length - 1 \? out = zeros[6 - word.length] + word + out : out = word + out, off += 2, off >= 26 && (off -= 26, i--);\n }\n for (carry !== 0 && (out = carry.toString(16) + out);out.length % padding !== 0; )\n out = \"0\" + out;\n return this.negative !== 0 && (out = \"-\" + out), out;\n }\n if (base === (base | 0) && base >= 2 && base <= 36) {\n var groupSize = groupSizes[base], groupBase = groupBases[base];\n out = \"\";\n var c = this.clone();\n for (c.negative = 0;!c.isZero(); ) {\n var r = c.modn(groupBase).toString(base);\n c = c.idivn(groupBase), c.isZero() \? out = r + out : out = zeros[groupSize - r.length] + r + out;\n }\n for (this.isZero() && (out = \"0\" + out);out.length % padding !== 0; )\n out = \"0\" + out;\n return this.negative !== 0 && (out = \"-\" + out), out;\n }\n assert(!1, \"Base should be between 2 and 36\");\n }, BN.prototype.toNumber = function() {\n var ret = this.words[0];\n return this.length === 2 \? ret += this.words[1] * 67108864 : this.length === 3 && this.words[2] === 1 \? ret += 4503599627370496 + this.words[1] * 67108864 : this.length > 2 && assert(!1, \"Number can only safely store up to 53 bits\"), this.negative !== 0 \? -ret : ret;\n }, BN.prototype.toJSON = function() {\n return this.toString(16);\n }, BN.prototype.toBuffer = function(endian, length) {\n return assert(typeof Buffer2 < \"u\"), this.toArrayLike(Buffer2, endian, length);\n }, BN.prototype.toArray = function(endian, length) {\n return this.toArrayLike(@Array, endian, length);\n }, BN.prototype.toArrayLike = function(ArrayType, endian, length) {\n var byteLength = this.byteLength(), reqLength = length || Math.max(1, byteLength);\n assert(byteLength <= reqLength, \"byte array longer than desired length\"), assert(reqLength > 0, \"Requested array length <= 0\"), this.strip();\n var littleEndian = endian === \"le\", res = new ArrayType(reqLength), b, i, q = this.clone();\n if (littleEndian) {\n for (i = 0;!q.isZero(); i++)\n b = q.andln(255), q.iushrn(8), res[i] = b;\n for (;i < reqLength; i++)\n res[i] = 0;\n } else {\n for (i = 0;i < reqLength - byteLength; i++)\n res[i] = 0;\n for (i = 0;!q.isZero(); i++)\n b = q.andln(255), q.iushrn(8), res[reqLength - i - 1] = b;\n }\n return res;\n }, Math.clz32 \? BN.prototype._countBits = function(w) {\n return 32 - Math.clz32(w);\n } : BN.prototype._countBits = function(w) {\n var t = w, r = 0;\n return t >= 4096 && (r += 13, t >>>= 13), t >= 64 && (r += 7, t >>>= 7), t >= 8 && (r += 4, t >>>= 4), t >= 2 && (r += 2, t >>>= 2), r + t;\n }, BN.prototype._zeroBits = function(w) {\n if (w === 0)\n return 26;\n var t = w, r = 0;\n return (t & 8191) === 0 && (r += 13, t >>>= 13), (t & 127) === 0 && (r += 7, t >>>= 7), (t & 15) === 0 && (r += 4, t >>>= 4), (t & 3) === 0 && (r += 2, t >>>= 2), (t & 1) === 0 && r++, r;\n }, BN.prototype.bitLength = function() {\n var w = this.words[this.length - 1], hi = this._countBits(w);\n return (this.length - 1) * 26 + hi;\n };\n function toBitArray(num) {\n for (var w = new @Array(num.bitLength()), bit = 0;bit < w.length; bit++) {\n var off = bit / 26 | 0, wbit = bit % 26;\n w[bit] = (num.words[off] & 1 << wbit) >>> wbit;\n }\n return w;\n }\n BN.prototype.zeroBits = function() {\n if (this.isZero())\n return 0;\n for (var r = 0, i = 0;i < this.length; i++) {\n var b = this._zeroBits(this.words[i]);\n if (r += b, b !== 26)\n break;\n }\n return r;\n }, BN.prototype.byteLength = function() {\n return Math.ceil(this.bitLength() / 8);\n }, BN.prototype.toTwos = function(width) {\n return this.negative !== 0 \? this.abs().inotn(width).iaddn(1) : this.clone();\n }, BN.prototype.fromTwos = function(width) {\n return this.testn(width - 1) \? this.notn(width).iaddn(1).ineg() : this.clone();\n }, BN.prototype.isNeg = function() {\n return this.negative !== 0;\n }, BN.prototype.neg = function() {\n return this.clone().ineg();\n }, BN.prototype.ineg = function() {\n return this.isZero() || (this.negative ^= 1), this;\n }, BN.prototype.iuor = function(num) {\n for (;this.length < num.length; )\n this.words[this.length++] = 0;\n for (var i = 0;i < num.length; i++)\n this.words[i] = this.words[i] | num.words[i];\n return this.strip();\n }, BN.prototype.ior = function(num) {\n return assert((this.negative | num.negative) === 0), this.iuor(num);\n }, BN.prototype.or = function(num) {\n return this.length > num.length \? this.clone().ior(num) : num.clone().ior(this);\n }, BN.prototype.uor = function(num) {\n return this.length > num.length \? this.clone().iuor(num) : num.clone().iuor(this);\n }, BN.prototype.iuand = function(num) {\n var b;\n this.length > num.length \? b = num : b = this;\n for (var i = 0;i < b.length; i++)\n this.words[i] = this.words[i] & num.words[i];\n return this.length = b.length, this.strip();\n }, BN.prototype.iand = function(num) {\n return assert((this.negative | num.negative) === 0), this.iuand(num);\n }, BN.prototype.and = function(num) {\n return this.length > num.length \? this.clone().iand(num) : num.clone().iand(this);\n }, BN.prototype.uand = function(num) {\n return this.length > num.length \? this.clone().iuand(num) : num.clone().iuand(this);\n }, BN.prototype.iuxor = function(num) {\n var a, b;\n this.length > num.length \? (a = this, b = num) : (a = num, b = this);\n for (var i = 0;i < b.length; i++)\n this.words[i] = a.words[i] ^ b.words[i];\n if (this !== a)\n for (;i < a.length; i++)\n this.words[i] = a.words[i];\n return this.length = a.length, this.strip();\n }, BN.prototype.ixor = function(num) {\n return assert((this.negative | num.negative) === 0), this.iuxor(num);\n }, BN.prototype.xor = function(num) {\n return this.length > num.length \? this.clone().ixor(num) : num.clone().ixor(this);\n }, BN.prototype.uxor = function(num) {\n return this.length > num.length \? this.clone().iuxor(num) : num.clone().iuxor(this);\n }, BN.prototype.inotn = function(width) {\n assert(typeof width == \"number\" && width >= 0);\n var bytesNeeded = Math.ceil(width / 26) | 0, bitsLeft = width % 26;\n this._expand(bytesNeeded), bitsLeft > 0 && bytesNeeded--;\n for (var i = 0;i < bytesNeeded; i++)\n this.words[i] = ~this.words[i] & 67108863;\n return bitsLeft > 0 && (this.words[i] = ~this.words[i] & 67108863 >> 26 - bitsLeft), this.strip();\n }, BN.prototype.notn = function(width) {\n return this.clone().inotn(width);\n }, BN.prototype.setn = function(bit, val) {\n assert(typeof bit == \"number\" && bit >= 0);\n var off = bit / 26 | 0, wbit = bit % 26;\n return this._expand(off + 1), val \? this.words[off] = this.words[off] | 1 << wbit : this.words[off] = this.words[off] & ~(1 << wbit), this.strip();\n }, BN.prototype.iadd = function(num) {\n var r;\n if (this.negative !== 0 && num.negative === 0)\n return this.negative = 0, r = this.isub(num), this.negative ^= 1, this._normSign();\n if (this.negative === 0 && num.negative !== 0)\n return num.negative = 0, r = this.isub(num), num.negative = 1, r._normSign();\n var a, b;\n this.length > num.length \? (a = this, b = num) : (a = num, b = this);\n for (var carry = 0, i = 0;i < b.length; i++)\n r = (a.words[i] | 0) + (b.words[i] | 0) + carry, this.words[i] = r & 67108863, carry = r >>> 26;\n for (;carry !== 0 && i < a.length; i++)\n r = (a.words[i] | 0) + carry, this.words[i] = r & 67108863, carry = r >>> 26;\n if (this.length = a.length, carry !== 0)\n this.words[this.length] = carry, this.length++;\n else if (a !== this)\n for (;i < a.length; i++)\n this.words[i] = a.words[i];\n return this;\n }, BN.prototype.add = function(num) {\n var res;\n return num.negative !== 0 && this.negative === 0 \? (num.negative = 0, res = this.sub(num), num.negative ^= 1, res) : num.negative === 0 && this.negative !== 0 \? (this.negative = 0, res = num.sub(this), this.negative = 1, res) : this.length > num.length \? this.clone().iadd(num) : num.clone().iadd(this);\n }, BN.prototype.isub = function(num) {\n if (num.negative !== 0) {\n num.negative = 0;\n var r = this.iadd(num);\n return num.negative = 1, r._normSign();\n } else if (this.negative !== 0)\n return this.negative = 0, this.iadd(num), this.negative = 1, this._normSign();\n var cmp = this.cmp(num);\n if (cmp === 0)\n return this.negative = 0, this.length = 1, this.words[0] = 0, this;\n var a, b;\n cmp > 0 \? (a = this, b = num) : (a = num, b = this);\n for (var carry = 0, i = 0;i < b.length; i++)\n r = (a.words[i] | 0) - (b.words[i] | 0) + carry, carry = r >> 26, this.words[i] = r & 67108863;\n for (;carry !== 0 && i < a.length; i++)\n r = (a.words[i] | 0) + carry, carry = r >> 26, this.words[i] = r & 67108863;\n if (carry === 0 && i < a.length && a !== this)\n for (;i < a.length; i++)\n this.words[i] = a.words[i];\n return this.length = Math.max(this.length, i), a !== this && (this.negative = 1), this.strip();\n }, BN.prototype.sub = function(num) {\n return this.clone().isub(num);\n };\n function smallMulTo(self2, num, out) {\n out.negative = num.negative ^ self2.negative;\n var len = self2.length + num.length | 0;\n out.length = len, len = len - 1 | 0;\n var a = self2.words[0] | 0, b = num.words[0] | 0, r = a * b, lo = r & 67108863, carry = r / 67108864 | 0;\n out.words[0] = lo;\n for (var k = 1;k < len; k++) {\n for (var ncarry = carry >>> 26, rword = carry & 67108863, maxJ = Math.min(k, num.length - 1), j = Math.max(0, k - self2.length + 1);j <= maxJ; j++) {\n var i = k - j | 0;\n a = self2.words[i] | 0, b = num.words[j] | 0, r = a * b + rword, ncarry += r / 67108864 | 0, rword = r & 67108863;\n }\n out.words[k] = rword | 0, carry = ncarry | 0;\n }\n return carry !== 0 \? out.words[k] = carry | 0 : out.length--, out.strip();\n }\n var comb10MulTo = function(self2, num, out) {\n var a = self2.words, b = num.words, o = out.words, c = 0, lo, mid, hi, a0 = a[0] | 0, al0 = a0 & 8191, ah0 = a0 >>> 13, a1 = a[1] | 0, al1 = a1 & 8191, ah1 = a1 >>> 13, a2 = a[2] | 0, al2 = a2 & 8191, ah2 = a2 >>> 13, a3 = a[3] | 0, al3 = a3 & 8191, ah3 = a3 >>> 13, a4 = a[4] | 0, al4 = a4 & 8191, ah4 = a4 >>> 13, a5 = a[5] | 0, al5 = a5 & 8191, ah5 = a5 >>> 13, a6 = a[6] | 0, al6 = a6 & 8191, ah6 = a6 >>> 13, a7 = a[7] | 0, al7 = a7 & 8191, ah7 = a7 >>> 13, a8 = a[8] | 0, al8 = a8 & 8191, ah8 = a8 >>> 13, a9 = a[9] | 0, al9 = a9 & 8191, ah9 = a9 >>> 13, b0 = b[0] | 0, bl0 = b0 & 8191, bh0 = b0 >>> 13, b1 = b[1] | 0, bl1 = b1 & 8191, bh1 = b1 >>> 13, b2 = b[2] | 0, bl2 = b2 & 8191, bh2 = b2 >>> 13, b3 = b[3] | 0, bl3 = b3 & 8191, bh3 = b3 >>> 13, b4 = b[4] | 0, bl4 = b4 & 8191, bh4 = b4 >>> 13, b5 = b[5] | 0, bl5 = b5 & 8191, bh5 = b5 >>> 13, b6 = b[6] | 0, bl6 = b6 & 8191, bh6 = b6 >>> 13, b7 = b[7] | 0, bl7 = b7 & 8191, bh7 = b7 >>> 13, b8 = b[8] | 0, bl8 = b8 & 8191, bh8 = b8 >>> 13, b9 = b[9] | 0, bl9 = b9 & 8191, bh9 = b9 >>> 13;\n out.negative = self2.negative ^ num.negative, out.length = 19, lo = Math.imul(al0, bl0), mid = Math.imul(al0, bh0), mid = mid + Math.imul(ah0, bl0) | 0, hi = Math.imul(ah0, bh0);\n var w0 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w0 >>> 26) | 0, w0 &= 67108863, lo = Math.imul(al1, bl0), mid = Math.imul(al1, bh0), mid = mid + Math.imul(ah1, bl0) | 0, hi = Math.imul(ah1, bh0), lo = lo + Math.imul(al0, bl1) | 0, mid = mid + Math.imul(al0, bh1) | 0, mid = mid + Math.imul(ah0, bl1) | 0, hi = hi + Math.imul(ah0, bh1) | 0;\n var w1 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w1 >>> 26) | 0, w1 &= 67108863, lo = Math.imul(al2, bl0), mid = Math.imul(al2, bh0), mid = mid + Math.imul(ah2, bl0) | 0, hi = Math.imul(ah2, bh0), lo = lo + Math.imul(al1, bl1) | 0, mid = mid + Math.imul(al1, bh1) | 0, mid = mid + Math.imul(ah1, bl1) | 0, hi = hi + Math.imul(ah1, bh1) | 0, lo = lo + Math.imul(al0, bl2) | 0, mid = mid + Math.imul(al0, bh2) | 0, mid = mid + Math.imul(ah0, bl2) | 0, hi = hi + Math.imul(ah0, bh2) | 0;\n var w2 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w2 >>> 26) | 0, w2 &= 67108863, lo = Math.imul(al3, bl0), mid = Math.imul(al3, bh0), mid = mid + Math.imul(ah3, bl0) | 0, hi = Math.imul(ah3, bh0), lo = lo + Math.imul(al2, bl1) | 0, mid = mid + Math.imul(al2, bh1) | 0, mid = mid + Math.imul(ah2, bl1) | 0, hi = hi + Math.imul(ah2, bh1) | 0, lo = lo + Math.imul(al1, bl2) | 0, mid = mid + Math.imul(al1, bh2) | 0, mid = mid + Math.imul(ah1, bl2) | 0, hi = hi + Math.imul(ah1, bh2) | 0, lo = lo + Math.imul(al0, bl3) | 0, mid = mid + Math.imul(al0, bh3) | 0, mid = mid + Math.imul(ah0, bl3) | 0, hi = hi + Math.imul(ah0, bh3) | 0;\n var w3 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w3 >>> 26) | 0, w3 &= 67108863, lo = Math.imul(al4, bl0), mid = Math.imul(al4, bh0), mid = mid + Math.imul(ah4, bl0) | 0, hi = Math.imul(ah4, bh0), lo = lo + Math.imul(al3, bl1) | 0, mid = mid + Math.imul(al3, bh1) | 0, mid = mid + Math.imul(ah3, bl1) | 0, hi = hi + Math.imul(ah3, bh1) | 0, lo = lo + Math.imul(al2, bl2) | 0, mid = mid + Math.imul(al2, bh2) | 0, mid = mid + Math.imul(ah2, bl2) | 0, hi = hi + Math.imul(ah2, bh2) | 0, lo = lo + Math.imul(al1, bl3) | 0, mid = mid + Math.imul(al1, bh3) | 0, mid = mid + Math.imul(ah1, bl3) | 0, hi = hi + Math.imul(ah1, bh3) | 0, lo = lo + Math.imul(al0, bl4) | 0, mid = mid + Math.imul(al0, bh4) | 0, mid = mid + Math.imul(ah0, bl4) | 0, hi = hi + Math.imul(ah0, bh4) | 0;\n var w4 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w4 >>> 26) | 0, w4 &= 67108863, lo = Math.imul(al5, bl0), mid = Math.imul(al5, bh0), mid = mid + Math.imul(ah5, bl0) | 0, hi = Math.imul(ah5, bh0), lo = lo + Math.imul(al4, bl1) | 0, mid = mid + Math.imul(al4, bh1) | 0, mid = mid + Math.imul(ah4, bl1) | 0, hi = hi + Math.imul(ah4, bh1) | 0, lo = lo + Math.imul(al3, bl2) | 0, mid = mid + Math.imul(al3, bh2) | 0, mid = mid + Math.imul(ah3, bl2) | 0, hi = hi + Math.imul(ah3, bh2) | 0, lo = lo + Math.imul(al2, bl3) | 0, mid = mid + Math.imul(al2, bh3) | 0, mid = mid + Math.imul(ah2, bl3) | 0, hi = hi + Math.imul(ah2, bh3) | 0, lo = lo + Math.imul(al1, bl4) | 0, mid = mid + Math.imul(al1, bh4) | 0, mid = mid + Math.imul(ah1, bl4) | 0, hi = hi + Math.imul(ah1, bh4) | 0, lo = lo + Math.imul(al0, bl5) | 0, mid = mid + Math.imul(al0, bh5) | 0, mid = mid + Math.imul(ah0, bl5) | 0, hi = hi + Math.imul(ah0, bh5) | 0;\n var w5 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w5 >>> 26) | 0, w5 &= 67108863, lo = Math.imul(al6, bl0), mid = Math.imul(al6, bh0), mid = mid + Math.imul(ah6, bl0) | 0, hi = Math.imul(ah6, bh0), lo = lo + Math.imul(al5, bl1) | 0, mid = mid + Math.imul(al5, bh1) | 0, mid = mid + Math.imul(ah5, bl1) | 0, hi = hi + Math.imul(ah5, bh1) | 0, lo = lo + Math.imul(al4, bl2) | 0, mid = mid + Math.imul(al4, bh2) | 0, mid = mid + Math.imul(ah4, bl2) | 0, hi = hi + Math.imul(ah4, bh2) | 0, lo = lo + Math.imul(al3, bl3) | 0, mid = mid + Math.imul(al3, bh3) | 0, mid = mid + Math.imul(ah3, bl3) | 0, hi = hi + Math.imul(ah3, bh3) | 0, lo = lo + Math.imul(al2, bl4) | 0, mid = mid + Math.imul(al2, bh4) | 0, mid = mid + Math.imul(ah2, bl4) | 0, hi = hi + Math.imul(ah2, bh4) | 0, lo = lo + Math.imul(al1, bl5) | 0, mid = mid + Math.imul(al1, bh5) | 0, mid = mid + Math.imul(ah1, bl5) | 0, hi = hi + Math.imul(ah1, bh5) | 0, lo = lo + Math.imul(al0, bl6) | 0, mid = mid + Math.imul(al0, bh6) | 0, mid = mid + Math.imul(ah0, bl6) | 0, hi = hi + Math.imul(ah0, bh6) | 0;\n var w6 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w6 >>> 26) | 0, w6 &= 67108863, lo = Math.imul(al7, bl0), mid = Math.imul(al7, bh0), mid = mid + Math.imul(ah7, bl0) | 0, hi = Math.imul(ah7, bh0), lo = lo + Math.imul(al6, bl1) | 0, mid = mid + Math.imul(al6, bh1) | 0, mid = mid + Math.imul(ah6, bl1) | 0, hi = hi + Math.imul(ah6, bh1) | 0, lo = lo + Math.imul(al5, bl2) | 0, mid = mid + Math.imul(al5, bh2) | 0, mid = mid + Math.imul(ah5, bl2) | 0, hi = hi + Math.imul(ah5, bh2) | 0, lo = lo + Math.imul(al4, bl3) | 0, mid = mid + Math.imul(al4, bh3) | 0, mid = mid + Math.imul(ah4, bl3) | 0, hi = hi + Math.imul(ah4, bh3) | 0, lo = lo + Math.imul(al3, bl4) | 0, mid = mid + Math.imul(al3, bh4) | 0, mid = mid + Math.imul(ah3, bl4) | 0, hi = hi + Math.imul(ah3, bh4) | 0, lo = lo + Math.imul(al2, bl5) | 0, mid = mid + Math.imul(al2, bh5) | 0, mid = mid + Math.imul(ah2, bl5) | 0, hi = hi + Math.imul(ah2, bh5) | 0, lo = lo + Math.imul(al1, bl6) | 0, mid = mid + Math.imul(al1, bh6) | 0, mid = mid + Math.imul(ah1, bl6) | 0, hi = hi + Math.imul(ah1, bh6) | 0, lo = lo + Math.imul(al0, bl7) | 0, mid = mid + Math.imul(al0, bh7) | 0, mid = mid + Math.imul(ah0, bl7) | 0, hi = hi + Math.imul(ah0, bh7) | 0;\n var w7 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w7 >>> 26) | 0, w7 &= 67108863, lo = Math.imul(al8, bl0), mid = Math.imul(al8, bh0), mid = mid + Math.imul(ah8, bl0) | 0, hi = Math.imul(ah8, bh0), lo = lo + Math.imul(al7, bl1) | 0, mid = mid + Math.imul(al7, bh1) | 0, mid = mid + Math.imul(ah7, bl1) | 0, hi = hi + Math.imul(ah7, bh1) | 0, lo = lo + Math.imul(al6, bl2) | 0, mid = mid + Math.imul(al6, bh2) | 0, mid = mid + Math.imul(ah6, bl2) | 0, hi = hi + Math.imul(ah6, bh2) | 0, lo = lo + Math.imul(al5, bl3) | 0, mid = mid + Math.imul(al5, bh3) | 0, mid = mid + Math.imul(ah5, bl3) | 0, hi = hi + Math.imul(ah5, bh3) | 0, lo = lo + Math.imul(al4, bl4) | 0, mid = mid + Math.imul(al4, bh4) | 0, mid = mid + Math.imul(ah4, bl4) | 0, hi = hi + Math.imul(ah4, bh4) | 0, lo = lo + Math.imul(al3, bl5) | 0, mid = mid + Math.imul(al3, bh5) | 0, mid = mid + Math.imul(ah3, bl5) | 0, hi = hi + Math.imul(ah3, bh5) | 0, lo = lo + Math.imul(al2, bl6) | 0, mid = mid + Math.imul(al2, bh6) | 0, mid = mid + Math.imul(ah2, bl6) | 0, hi = hi + Math.imul(ah2, bh6) | 0, lo = lo + Math.imul(al1, bl7) | 0, mid = mid + Math.imul(al1, bh7) | 0, mid = mid + Math.imul(ah1, bl7) | 0, hi = hi + Math.imul(ah1, bh7) | 0, lo = lo + Math.imul(al0, bl8) | 0, mid = mid + Math.imul(al0, bh8) | 0, mid = mid + Math.imul(ah0, bl8) | 0, hi = hi + Math.imul(ah0, bh8) | 0;\n var w8 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w8 >>> 26) | 0, w8 &= 67108863, lo = Math.imul(al9, bl0), mid = Math.imul(al9, bh0), mid = mid + Math.imul(ah9, bl0) | 0, hi = Math.imul(ah9, bh0), lo = lo + Math.imul(al8, bl1) | 0, mid = mid + Math.imul(al8, bh1) | 0, mid = mid + Math.imul(ah8, bl1) | 0, hi = hi + Math.imul(ah8, bh1) | 0, lo = lo + Math.imul(al7, bl2) | 0, mid = mid + Math.imul(al7, bh2) | 0, mid = mid + Math.imul(ah7, bl2) | 0, hi = hi + Math.imul(ah7, bh2) | 0, lo = lo + Math.imul(al6, bl3) | 0, mid = mid + Math.imul(al6, bh3) | 0, mid = mid + Math.imul(ah6, bl3) | 0, hi = hi + Math.imul(ah6, bh3) | 0, lo = lo + Math.imul(al5, bl4) | 0, mid = mid + Math.imul(al5, bh4) | 0, mid = mid + Math.imul(ah5, bl4) | 0, hi = hi + Math.imul(ah5, bh4) | 0, lo = lo + Math.imul(al4, bl5) | 0, mid = mid + Math.imul(al4, bh5) | 0, mid = mid + Math.imul(ah4, bl5) | 0, hi = hi + Math.imul(ah4, bh5) | 0, lo = lo + Math.imul(al3, bl6) | 0, mid = mid + Math.imul(al3, bh6) | 0, mid = mid + Math.imul(ah3, bl6) | 0, hi = hi + Math.imul(ah3, bh6) | 0, lo = lo + Math.imul(al2, bl7) | 0, mid = mid + Math.imul(al2, bh7) | 0, mid = mid + Math.imul(ah2, bl7) | 0, hi = hi + Math.imul(ah2, bh7) | 0, lo = lo + Math.imul(al1, bl8) | 0, mid = mid + Math.imul(al1, bh8) | 0, mid = mid + Math.imul(ah1, bl8) | 0, hi = hi + Math.imul(ah1, bh8) | 0, lo = lo + Math.imul(al0, bl9) | 0, mid = mid + Math.imul(al0, bh9) | 0, mid = mid + Math.imul(ah0, bl9) | 0, hi = hi + Math.imul(ah0, bh9) | 0;\n var w9 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w9 >>> 26) | 0, w9 &= 67108863, lo = Math.imul(al9, bl1), mid = Math.imul(al9, bh1), mid = mid + Math.imul(ah9, bl1) | 0, hi = Math.imul(ah9, bh1), lo = lo + Math.imul(al8, bl2) | 0, mid = mid + Math.imul(al8, bh2) | 0, mid = mid + Math.imul(ah8, bl2) | 0, hi = hi + Math.imul(ah8, bh2) | 0, lo = lo + Math.imul(al7, bl3) | 0, mid = mid + Math.imul(al7, bh3) | 0, mid = mid + Math.imul(ah7, bl3) | 0, hi = hi + Math.imul(ah7, bh3) | 0, lo = lo + Math.imul(al6, bl4) | 0, mid = mid + Math.imul(al6, bh4) | 0, mid = mid + Math.imul(ah6, bl4) | 0, hi = hi + Math.imul(ah6, bh4) | 0, lo = lo + Math.imul(al5, bl5) | 0, mid = mid + Math.imul(al5, bh5) | 0, mid = mid + Math.imul(ah5, bl5) | 0, hi = hi + Math.imul(ah5, bh5) | 0, lo = lo + Math.imul(al4, bl6) | 0, mid = mid + Math.imul(al4, bh6) | 0, mid = mid + Math.imul(ah4, bl6) | 0, hi = hi + Math.imul(ah4, bh6) | 0, lo = lo + Math.imul(al3, bl7) | 0, mid = mid + Math.imul(al3, bh7) | 0, mid = mid + Math.imul(ah3, bl7) | 0, hi = hi + Math.imul(ah3, bh7) | 0, lo = lo + Math.imul(al2, bl8) | 0, mid = mid + Math.imul(al2, bh8) | 0, mid = mid + Math.imul(ah2, bl8) | 0, hi = hi + Math.imul(ah2, bh8) | 0, lo = lo + Math.imul(al1, bl9) | 0, mid = mid + Math.imul(al1, bh9) | 0, mid = mid + Math.imul(ah1, bl9) | 0, hi = hi + Math.imul(ah1, bh9) | 0;\n var w10 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w10 >>> 26) | 0, w10 &= 67108863, lo = Math.imul(al9, bl2), mid = Math.imul(al9, bh2), mid = mid + Math.imul(ah9, bl2) | 0, hi = Math.imul(ah9, bh2), lo = lo + Math.imul(al8, bl3) | 0, mid = mid + Math.imul(al8, bh3) | 0, mid = mid + Math.imul(ah8, bl3) | 0, hi = hi + Math.imul(ah8, bh3) | 0, lo = lo + Math.imul(al7, bl4) | 0, mid = mid + Math.imul(al7, bh4) | 0, mid = mid + Math.imul(ah7, bl4) | 0, hi = hi + Math.imul(ah7, bh4) | 0, lo = lo + Math.imul(al6, bl5) | 0, mid = mid + Math.imul(al6, bh5) | 0, mid = mid + Math.imul(ah6, bl5) | 0, hi = hi + Math.imul(ah6, bh5) | 0, lo = lo + Math.imul(al5, bl6) | 0, mid = mid + Math.imul(al5, bh6) | 0, mid = mid + Math.imul(ah5, bl6) | 0, hi = hi + Math.imul(ah5, bh6) | 0, lo = lo + Math.imul(al4, bl7) | 0, mid = mid + Math.imul(al4, bh7) | 0, mid = mid + Math.imul(ah4, bl7) | 0, hi = hi + Math.imul(ah4, bh7) | 0, lo = lo + Math.imul(al3, bl8) | 0, mid = mid + Math.imul(al3, bh8) | 0, mid = mid + Math.imul(ah3, bl8) | 0, hi = hi + Math.imul(ah3, bh8) | 0, lo = lo + Math.imul(al2, bl9) | 0, mid = mid + Math.imul(al2, bh9) | 0, mid = mid + Math.imul(ah2, bl9) | 0, hi = hi + Math.imul(ah2, bh9) | 0;\n var w11 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w11 >>> 26) | 0, w11 &= 67108863, lo = Math.imul(al9, bl3), mid = Math.imul(al9, bh3), mid = mid + Math.imul(ah9, bl3) | 0, hi = Math.imul(ah9, bh3), lo = lo + Math.imul(al8, bl4) | 0, mid = mid + Math.imul(al8, bh4) | 0, mid = mid + Math.imul(ah8, bl4) | 0, hi = hi + Math.imul(ah8, bh4) | 0, lo = lo + Math.imul(al7, bl5) | 0, mid = mid + Math.imul(al7, bh5) | 0, mid = mid + Math.imul(ah7, bl5) | 0, hi = hi + Math.imul(ah7, bh5) | 0, lo = lo + Math.imul(al6, bl6) | 0, mid = mid + Math.imul(al6, bh6) | 0, mid = mid + Math.imul(ah6, bl6) | 0, hi = hi + Math.imul(ah6, bh6) | 0, lo = lo + Math.imul(al5, bl7) | 0, mid = mid + Math.imul(al5, bh7) | 0, mid = mid + Math.imul(ah5, bl7) | 0, hi = hi + Math.imul(ah5, bh7) | 0, lo = lo + Math.imul(al4, bl8) | 0, mid = mid + Math.imul(al4, bh8) | 0, mid = mid + Math.imul(ah4, bl8) | 0, hi = hi + Math.imul(ah4, bh8) | 0, lo = lo + Math.imul(al3, bl9) | 0, mid = mid + Math.imul(al3, bh9) | 0, mid = mid + Math.imul(ah3, bl9) | 0, hi = hi + Math.imul(ah3, bh9) | 0;\n var w12 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w12 >>> 26) | 0, w12 &= 67108863, lo = Math.imul(al9, bl4), mid = Math.imul(al9, bh4), mid = mid + Math.imul(ah9, bl4) | 0, hi = Math.imul(ah9, bh4), lo = lo + Math.imul(al8, bl5) | 0, mid = mid + Math.imul(al8, bh5) | 0, mid = mid + Math.imul(ah8, bl5) | 0, hi = hi + Math.imul(ah8, bh5) | 0, lo = lo + Math.imul(al7, bl6) | 0, mid = mid + Math.imul(al7, bh6) | 0, mid = mid + Math.imul(ah7, bl6) | 0, hi = hi + Math.imul(ah7, bh6) | 0, lo = lo + Math.imul(al6, bl7) | 0, mid = mid + Math.imul(al6, bh7) | 0, mid = mid + Math.imul(ah6, bl7) | 0, hi = hi + Math.imul(ah6, bh7) | 0, lo = lo + Math.imul(al5, bl8) | 0, mid = mid + Math.imul(al5, bh8) | 0, mid = mid + Math.imul(ah5, bl8) | 0, hi = hi + Math.imul(ah5, bh8) | 0, lo = lo + Math.imul(al4, bl9) | 0, mid = mid + Math.imul(al4, bh9) | 0, mid = mid + Math.imul(ah4, bl9) | 0, hi = hi + Math.imul(ah4, bh9) | 0;\n var w13 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w13 >>> 26) | 0, w13 &= 67108863, lo = Math.imul(al9, bl5), mid = Math.imul(al9, bh5), mid = mid + Math.imul(ah9, bl5) | 0, hi = Math.imul(ah9, bh5), lo = lo + Math.imul(al8, bl6) | 0, mid = mid + Math.imul(al8, bh6) | 0, mid = mid + Math.imul(ah8, bl6) | 0, hi = hi + Math.imul(ah8, bh6) | 0, lo = lo + Math.imul(al7, bl7) | 0, mid = mid + Math.imul(al7, bh7) | 0, mid = mid + Math.imul(ah7, bl7) | 0, hi = hi + Math.imul(ah7, bh7) | 0, lo = lo + Math.imul(al6, bl8) | 0, mid = mid + Math.imul(al6, bh8) | 0, mid = mid + Math.imul(ah6, bl8) | 0, hi = hi + Math.imul(ah6, bh8) | 0, lo = lo + Math.imul(al5, bl9) | 0, mid = mid + Math.imul(al5, bh9) | 0, mid = mid + Math.imul(ah5, bl9) | 0, hi = hi + Math.imul(ah5, bh9) | 0;\n var w14 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w14 >>> 26) | 0, w14 &= 67108863, lo = Math.imul(al9, bl6), mid = Math.imul(al9, bh6), mid = mid + Math.imul(ah9, bl6) | 0, hi = Math.imul(ah9, bh6), lo = lo + Math.imul(al8, bl7) | 0, mid = mid + Math.imul(al8, bh7) | 0, mid = mid + Math.imul(ah8, bl7) | 0, hi = hi + Math.imul(ah8, bh7) | 0, lo = lo + Math.imul(al7, bl8) | 0, mid = mid + Math.imul(al7, bh8) | 0, mid = mid + Math.imul(ah7, bl8) | 0, hi = hi + Math.imul(ah7, bh8) | 0, lo = lo + Math.imul(al6, bl9) | 0, mid = mid + Math.imul(al6, bh9) | 0, mid = mid + Math.imul(ah6, bl9) | 0, hi = hi + Math.imul(ah6, bh9) | 0;\n var w15 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w15 >>> 26) | 0, w15 &= 67108863, lo = Math.imul(al9, bl7), mid = Math.imul(al9, bh7), mid = mid + Math.imul(ah9, bl7) | 0, hi = Math.imul(ah9, bh7), lo = lo + Math.imul(al8, bl8) | 0, mid = mid + Math.imul(al8, bh8) | 0, mid = mid + Math.imul(ah8, bl8) | 0, hi = hi + Math.imul(ah8, bh8) | 0, lo = lo + Math.imul(al7, bl9) | 0, mid = mid + Math.imul(al7, bh9) | 0, mid = mid + Math.imul(ah7, bl9) | 0, hi = hi + Math.imul(ah7, bh9) | 0;\n var w16 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w16 >>> 26) | 0, w16 &= 67108863, lo = Math.imul(al9, bl8), mid = Math.imul(al9, bh8), mid = mid + Math.imul(ah9, bl8) | 0, hi = Math.imul(ah9, bh8), lo = lo + Math.imul(al8, bl9) | 0, mid = mid + Math.imul(al8, bh9) | 0, mid = mid + Math.imul(ah8, bl9) | 0, hi = hi + Math.imul(ah8, bh9) | 0;\n var w17 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w17 >>> 26) | 0, w17 &= 67108863, lo = Math.imul(al9, bl9), mid = Math.imul(al9, bh9), mid = mid + Math.imul(ah9, bl9) | 0, hi = Math.imul(ah9, bh9);\n var w18 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n return c = (hi + (mid >>> 13) | 0) + (w18 >>> 26) | 0, w18 &= 67108863, o[0] = w0, o[1] = w1, o[2] = w2, o[3] = w3, o[4] = w4, o[5] = w5, o[6] = w6, o[7] = w7, o[8] = w8, o[9] = w9, o[10] = w10, o[11] = w11, o[12] = w12, o[13] = w13, o[14] = w14, o[15] = w15, o[16] = w16, o[17] = w17, o[18] = w18, c !== 0 && (o[19] = c, out.length++), out;\n };\n Math.imul || (comb10MulTo = smallMulTo);\n function bigMulTo(self2, num, out) {\n out.negative = num.negative ^ self2.negative, out.length = self2.length + num.length;\n for (var carry = 0, hncarry = 0, k = 0;k < out.length - 1; k++) {\n var ncarry = hncarry;\n hncarry = 0;\n for (var rword = carry & 67108863, maxJ = Math.min(k, num.length - 1), j = Math.max(0, k - self2.length + 1);j <= maxJ; j++) {\n var i = k - j, a = self2.words[i] | 0, b = num.words[j] | 0, r = a * b, lo = r & 67108863;\n ncarry = ncarry + (r / 67108864 | 0) | 0, lo = lo + rword | 0, rword = lo & 67108863, ncarry = ncarry + (lo >>> 26) | 0, hncarry += ncarry >>> 26, ncarry &= 67108863;\n }\n out.words[k] = rword, carry = ncarry, ncarry = hncarry;\n }\n return carry !== 0 \? out.words[k] = carry : out.length--, out.strip();\n }\n function jumboMulTo(self2, num, out) {\n var fftm = new FFTM;\n return fftm.mulp(self2, num, out);\n }\n BN.prototype.mulTo = function(num, out) {\n var res, len = this.length + num.length;\n return this.length === 10 && num.length === 10 \? res = comb10MulTo(this, num, out) : len < 63 \? res = smallMulTo(this, num, out) : len < 1024 \? res = bigMulTo(this, num, out) : res = jumboMulTo(this, num, out), res;\n };\n function FFTM(x, y) {\n this.x = x, this.y = y;\n }\n FFTM.prototype = {}, FFTM.prototype.makeRBT = function(N) {\n for (var t = new @Array(N), l = BN.prototype._countBits(N) - 1, i = 0;i < N; i++)\n t[i] = this.revBin(i, l, N);\n return t;\n }, FFTM.prototype.revBin = function(x, l, N) {\n if (x === 0 || x === N - 1)\n return x;\n for (var rb = 0, i = 0;i < l; i++)\n rb |= (x & 1) << l - i - 1, x >>= 1;\n return rb;\n }, FFTM.prototype.permute = function(rbt, rws, iws, rtws, itws, N) {\n for (var i = 0;i < N; i++)\n rtws[i] = rws[rbt[i]], itws[i] = iws[rbt[i]];\n }, FFTM.prototype.transform = function(rws, iws, rtws, itws, N, rbt) {\n this.permute(rbt, rws, iws, rtws, itws, N);\n for (var s = 1;s < N; s <<= 1)\n for (var l = s << 1, rtwdf = Math.cos(2 * Math.PI / l), itwdf = Math.sin(2 * Math.PI / l), p = 0;p < N; p += l)\n for (var rtwdf_ = rtwdf, itwdf_ = itwdf, j = 0;j < s; j++) {\n var re = rtws[p + j], ie = itws[p + j], ro = rtws[p + j + s], io = itws[p + j + s], rx = rtwdf_ * ro - itwdf_ * io;\n io = rtwdf_ * io + itwdf_ * ro, ro = rx, rtws[p + j] = re + ro, itws[p + j] = ie + io, rtws[p + j + s] = re - ro, itws[p + j + s] = ie - io, j !== l && (rx = rtwdf * rtwdf_ - itwdf * itwdf_, itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_, rtwdf_ = rx);\n }\n }, FFTM.prototype.guessLen13b = function(n, m) {\n var N = Math.max(m, n) | 1, odd = N & 1, i = 0;\n for (N = N / 2 | 0;N; N = N >>> 1)\n i++;\n return 1 << i + 1 + odd;\n }, FFTM.prototype.conjugate = function(rws, iws, N) {\n if (!(N <= 1))\n for (var i = 0;i < N / 2; i++) {\n var t = rws[i];\n rws[i] = rws[N - i - 1], rws[N - i - 1] = t, t = iws[i], iws[i] = -iws[N - i - 1], iws[N - i - 1] = -t;\n }\n }, FFTM.prototype.normalize13b = function(ws, N) {\n for (var carry = 0, i = 0;i < N / 2; i++) {\n var w = Math.round(ws[2 * i + 1] / N) * 8192 + Math.round(ws[2 * i] / N) + carry;\n ws[i] = w & 67108863, w < 67108864 \? carry = 0 : carry = w / 67108864 | 0;\n }\n return ws;\n }, FFTM.prototype.convert13b = function(ws, len, rws, N) {\n for (var carry = 0, i = 0;i < len; i++)\n carry = carry + (ws[i] | 0), rws[2 * i] = carry & 8191, carry = carry >>> 13, rws[2 * i + 1] = carry & 8191, carry = carry >>> 13;\n for (i = 2 * len;i < N; ++i)\n rws[i] = 0;\n assert(carry === 0), assert((carry & -8192) === 0);\n }, FFTM.prototype.stub = function(N) {\n for (var ph = new @Array(N), i = 0;i < N; i++)\n ph[i] = 0;\n return ph;\n }, FFTM.prototype.mulp = function(x, y, out) {\n var N = 2 * this.guessLen13b(x.length, y.length), rbt = this.makeRBT(N), _ = this.stub(N), rws = new @Array(N), rwst = new @Array(N), iwst = new @Array(N), nrws = new @Array(N), nrwst = new @Array(N), niwst = new @Array(N), rmws = out.words;\n rmws.length = N, this.convert13b(x.words, x.length, rws, N), this.convert13b(y.words, y.length, nrws, N), this.transform(rws, _, rwst, iwst, N, rbt), this.transform(nrws, _, nrwst, niwst, N, rbt);\n for (var i = 0;i < N; i++) {\n var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];\n iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i], rwst[i] = rx;\n }\n return this.conjugate(rwst, iwst, N), this.transform(rwst, iwst, rmws, _, N, rbt), this.conjugate(rmws, _, N), this.normalize13b(rmws, N), out.negative = x.negative ^ y.negative, out.length = x.length + y.length, out.strip();\n }, BN.prototype.mul = function(num) {\n var out = new BN(null);\n return out.words = new @Array(this.length + num.length), this.mulTo(num, out);\n }, BN.prototype.mulf = function(num) {\n var out = new BN(null);\n return out.words = new @Array(this.length + num.length), jumboMulTo(this, num, out);\n }, BN.prototype.imul = function(num) {\n return this.clone().mulTo(num, this);\n }, BN.prototype.imuln = function(num) {\n assert(typeof num == \"number\"), assert(num < 67108864);\n for (var carry = 0, i = 0;i < this.length; i++) {\n var w = (this.words[i] | 0) * num, lo = (w & 67108863) + (carry & 67108863);\n carry >>= 26, carry += w / 67108864 | 0, carry += lo >>> 26, this.words[i] = lo & 67108863;\n }\n return carry !== 0 && (this.words[i] = carry, this.length++), this;\n }, BN.prototype.muln = function(num) {\n return this.clone().imuln(num);\n }, BN.prototype.sqr = function() {\n return this.mul(this);\n }, BN.prototype.isqr = function() {\n return this.imul(this.clone());\n }, BN.prototype.pow = function(num) {\n var w = toBitArray(num);\n if (w.length === 0)\n return new BN(1);\n for (var res = this, i = 0;i < w.length && w[i] === 0; i++, res = res.sqr())\n ;\n if (++i < w.length)\n for (var q = res.sqr();i < w.length; i++, q = q.sqr())\n w[i] !== 0 && (res = res.mul(q));\n return res;\n }, BN.prototype.iushln = function(bits) {\n assert(typeof bits == \"number\" && bits >= 0);\n var r = bits % 26, s = (bits - r) / 26, carryMask = 67108863 >>> 26 - r << 26 - r, i;\n if (r !== 0) {\n var carry = 0;\n for (i = 0;i < this.length; i++) {\n var newCarry = this.words[i] & carryMask, c = (this.words[i] | 0) - newCarry << r;\n this.words[i] = c | carry, carry = newCarry >>> 26 - r;\n }\n carry && (this.words[i] = carry, this.length++);\n }\n if (s !== 0) {\n for (i = this.length - 1;i >= 0; i--)\n this.words[i + s] = this.words[i];\n for (i = 0;i < s; i++)\n this.words[i] = 0;\n this.length += s;\n }\n return this.strip();\n }, BN.prototype.ishln = function(bits) {\n return assert(this.negative === 0), this.iushln(bits);\n }, BN.prototype.iushrn = function(bits, hint, extended) {\n assert(typeof bits == \"number\" && bits >= 0);\n var h;\n hint \? h = (hint - hint % 26) / 26 : h = 0;\n var r = bits % 26, s = Math.min((bits - r) / 26, this.length), mask = 67108863 ^ 67108863 >>> r << r, maskedWords = extended;\n if (h -= s, h = Math.max(0, h), maskedWords) {\n for (var i = 0;i < s; i++)\n maskedWords.words[i] = this.words[i];\n maskedWords.length = s;\n }\n if (s !== 0)\n if (this.length > s)\n for (this.length -= s, i = 0;i < this.length; i++)\n this.words[i] = this.words[i + s];\n else\n this.words[0] = 0, this.length = 1;\n var carry = 0;\n for (i = this.length - 1;i >= 0 && (carry !== 0 || i >= h); i--) {\n var word = this.words[i] | 0;\n this.words[i] = carry << 26 - r | word >>> r, carry = word & mask;\n }\n return maskedWords && carry !== 0 && (maskedWords.words[maskedWords.length++] = carry), this.length === 0 && (this.words[0] = 0, this.length = 1), this.strip();\n }, BN.prototype.ishrn = function(bits, hint, extended) {\n return assert(this.negative === 0), this.iushrn(bits, hint, extended);\n }, BN.prototype.shln = function(bits) {\n return this.clone().ishln(bits);\n }, BN.prototype.ushln = function(bits) {\n return this.clone().iushln(bits);\n }, BN.prototype.shrn = function(bits) {\n return this.clone().ishrn(bits);\n }, BN.prototype.ushrn = function(bits) {\n return this.clone().iushrn(bits);\n }, BN.prototype.testn = function(bit) {\n assert(typeof bit == \"number\" && bit >= 0);\n var r = bit % 26, s = (bit - r) / 26, q = 1 << r;\n if (this.length <= s)\n return !1;\n var w = this.words[s];\n return !!(w & q);\n }, BN.prototype.imaskn = function(bits) {\n assert(typeof bits == \"number\" && bits >= 0);\n var r = bits % 26, s = (bits - r) / 26;\n if (assert(this.negative === 0, \"imaskn works only with positive numbers\"), this.length <= s)\n return this;\n if (r !== 0 && s++, this.length = Math.min(s, this.length), r !== 0) {\n var mask = 67108863 ^ 67108863 >>> r << r;\n this.words[this.length - 1] &= mask;\n }\n return this.strip();\n }, BN.prototype.maskn = function(bits) {\n return this.clone().imaskn(bits);\n }, BN.prototype.iaddn = function(num) {\n return assert(typeof num == \"number\"), assert(num < 67108864), num < 0 \? this.isubn(-num) : this.negative !== 0 \? this.length === 1 && (this.words[0] | 0) < num \? (this.words[0] = num - (this.words[0] | 0), this.negative = 0, this) : (this.negative = 0, this.isubn(num), this.negative = 1, this) : this._iaddn(num);\n }, BN.prototype._iaddn = function(num) {\n this.words[0] += num;\n for (var i = 0;i < this.length && this.words[i] >= 67108864; i++)\n this.words[i] -= 67108864, i === this.length - 1 \? this.words[i + 1] = 1 : this.words[i + 1]++;\n return this.length = Math.max(this.length, i + 1), this;\n }, BN.prototype.isubn = function(num) {\n if (assert(typeof num == \"number\"), assert(num < 67108864), num < 0)\n return this.iaddn(-num);\n if (this.negative !== 0)\n return this.negative = 0, this.iaddn(num), this.negative = 1, this;\n if (this.words[0] -= num, this.length === 1 && this.words[0] < 0)\n this.words[0] = -this.words[0], this.negative = 1;\n else\n for (var i = 0;i < this.length && this.words[i] < 0; i++)\n this.words[i] += 67108864, this.words[i + 1] -= 1;\n return this.strip();\n }, BN.prototype.addn = function(num) {\n return this.clone().iaddn(num);\n }, BN.prototype.subn = function(num) {\n return this.clone().isubn(num);\n }, BN.prototype.iabs = function() {\n return this.negative = 0, this;\n }, BN.prototype.abs = function() {\n return this.clone().iabs();\n }, BN.prototype._ishlnsubmul = function(num, mul, shift) {\n var len = num.length + shift, i;\n this._expand(len);\n var w, carry = 0;\n for (i = 0;i < num.length; i++) {\n w = (this.words[i + shift] | 0) + carry;\n var right = (num.words[i] | 0) * mul;\n w -= right & 67108863, carry = (w >> 26) - (right / 67108864 | 0), this.words[i + shift] = w & 67108863;\n }\n for (;i < this.length - shift; i++)\n w = (this.words[i + shift] | 0) + carry, carry = w >> 26, this.words[i + shift] = w & 67108863;\n if (carry === 0)\n return this.strip();\n for (assert(carry === -1), carry = 0, i = 0;i < this.length; i++)\n w = -(this.words[i] | 0) + carry, carry = w >> 26, this.words[i] = w & 67108863;\n return this.negative = 1, this.strip();\n }, BN.prototype._wordDiv = function(num, mode) {\n var shift = this.length - num.length, a = this.clone(), b = num, bhi = b.words[b.length - 1] | 0, bhiBits = this._countBits(bhi);\n shift = 26 - bhiBits, shift !== 0 && (b = b.ushln(shift), a.iushln(shift), bhi = b.words[b.length - 1] | 0);\n var m = a.length - b.length, q;\n if (mode !== \"mod\") {\n q = new BN(null), q.length = m + 1, q.words = new @Array(q.length);\n for (var i = 0;i < q.length; i++)\n q.words[i] = 0;\n }\n var diff = a.clone()._ishlnsubmul(b, 1, m);\n diff.negative === 0 && (a = diff, q && (q.words[m] = 1));\n for (var j = m - 1;j >= 0; j--) {\n var qj = (a.words[b.length + j] | 0) * 67108864 + (a.words[b.length + j - 1] | 0);\n for (qj = Math.min(qj / bhi | 0, 67108863), a._ishlnsubmul(b, qj, j);a.negative !== 0; )\n qj--, a.negative = 0, a._ishlnsubmul(b, 1, j), a.isZero() || (a.negative ^= 1);\n q && (q.words[j] = qj);\n }\n return q && q.strip(), a.strip(), mode !== \"div\" && shift !== 0 && a.iushrn(shift), {\n div: q || null,\n mod: a\n };\n }, BN.prototype.divmod = function(num, mode, positive) {\n if (assert(!num.isZero()), this.isZero())\n return {\n div: new BN(0),\n mod: new BN(0)\n };\n var div, mod, res;\n return this.negative !== 0 && num.negative === 0 \? (res = this.neg().divmod(num, mode), mode !== \"mod\" && (div = res.div.neg()), mode !== \"div\" && (mod = res.mod.neg(), positive && mod.negative !== 0 && mod.iadd(num)), {\n div,\n mod\n }) : this.negative === 0 && num.negative !== 0 \? (res = this.divmod(num.neg(), mode), mode !== \"mod\" && (div = res.div.neg()), {\n div,\n mod: res.mod\n }) : (this.negative & num.negative) !== 0 \? (res = this.neg().divmod(num.neg(), mode), mode !== \"div\" && (mod = res.mod.neg(), positive && mod.negative !== 0 && mod.isub(num)), {\n div: res.div,\n mod\n }) : num.length > this.length || this.cmp(num) < 0 \? {\n div: new BN(0),\n mod: this\n } : num.length === 1 \? mode === \"div\" \? {\n div: this.divn(num.words[0]),\n mod: null\n } : mode === \"mod\" \? {\n div: null,\n mod: new BN(this.modn(num.words[0]))\n } : {\n div: this.divn(num.words[0]),\n mod: new BN(this.modn(num.words[0]))\n } : this._wordDiv(num, mode);\n }, BN.prototype.div = function(num) {\n return this.divmod(num, \"div\", !1).div;\n }, BN.prototype.mod = function(num) {\n return this.divmod(num, \"mod\", !1).mod;\n }, BN.prototype.umod = function(num) {\n return this.divmod(num, \"mod\", !0).mod;\n }, BN.prototype.divRound = function(num) {\n var dm = this.divmod(num);\n if (dm.mod.isZero())\n return dm.div;\n var mod = dm.div.negative !== 0 \? dm.mod.isub(num) : dm.mod, half = num.ushrn(1), r2 = num.andln(1), cmp = mod.cmp(half);\n return cmp < 0 || r2 === 1 && cmp === 0 \? dm.div : dm.div.negative !== 0 \? dm.div.isubn(1) : dm.div.iaddn(1);\n }, BN.prototype.modn = function(num) {\n assert(num <= 67108863);\n for (var p = (1 << 26) % num, acc = 0, i = this.length - 1;i >= 0; i--)\n acc = (p * acc + (this.words[i] | 0)) % num;\n return acc;\n }, BN.prototype.idivn = function(num) {\n assert(num <= 67108863);\n for (var carry = 0, i = this.length - 1;i >= 0; i--) {\n var w = (this.words[i] | 0) + carry * 67108864;\n this.words[i] = w / num | 0, carry = w % num;\n }\n return this.strip();\n }, BN.prototype.divn = function(num) {\n return this.clone().idivn(num);\n }, BN.prototype.egcd = function(p) {\n assert(p.negative === 0), assert(!p.isZero());\n var x = this, y = p.clone();\n x.negative !== 0 \? x = x.umod(p) : x = x.clone();\n for (var A = new BN(1), B = new BN(0), C = new BN(0), D = new BN(1), g = 0;x.isEven() && y.isEven(); )\n x.iushrn(1), y.iushrn(1), ++g;\n for (var yp = y.clone(), xp = x.clone();!x.isZero(); ) {\n for (var i = 0, im = 1;(x.words[0] & im) === 0 && i < 26; ++i, im <<= 1)\n ;\n if (i > 0)\n for (x.iushrn(i);i-- > 0; )\n (A.isOdd() || B.isOdd()) && (A.iadd(yp), B.isub(xp)), A.iushrn(1), B.iushrn(1);\n for (var j = 0, jm = 1;(y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1)\n ;\n if (j > 0)\n for (y.iushrn(j);j-- > 0; )\n (C.isOdd() || D.isOdd()) && (C.iadd(yp), D.isub(xp)), C.iushrn(1), D.iushrn(1);\n x.cmp(y) >= 0 \? (x.isub(y), A.isub(C), B.isub(D)) : (y.isub(x), C.isub(A), D.isub(B));\n }\n return {\n a: C,\n b: D,\n gcd: y.iushln(g)\n };\n }, BN.prototype._invmp = function(p) {\n assert(p.negative === 0), assert(!p.isZero());\n var a = this, b = p.clone();\n a.negative !== 0 \? a = a.umod(p) : a = a.clone();\n for (var x1 = new BN(1), x2 = new BN(0), delta = b.clone();a.cmpn(1) > 0 && b.cmpn(1) > 0; ) {\n for (var i = 0, im = 1;(a.words[0] & im) === 0 && i < 26; ++i, im <<= 1)\n ;\n if (i > 0)\n for (a.iushrn(i);i-- > 0; )\n x1.isOdd() && x1.iadd(delta), x1.iushrn(1);\n for (var j = 0, jm = 1;(b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1)\n ;\n if (j > 0)\n for (b.iushrn(j);j-- > 0; )\n x2.isOdd() && x2.iadd(delta), x2.iushrn(1);\n a.cmp(b) >= 0 \? (a.isub(b), x1.isub(x2)) : (b.isub(a), x2.isub(x1));\n }\n var res;\n return a.cmpn(1) === 0 \? res = x1 : res = x2, res.cmpn(0) < 0 && res.iadd(p), res;\n }, BN.prototype.gcd = function(num) {\n if (this.isZero())\n return num.abs();\n if (num.isZero())\n return this.abs();\n var a = this.clone(), b = num.clone();\n a.negative = 0, b.negative = 0;\n for (var shift = 0;a.isEven() && b.isEven(); shift++)\n a.iushrn(1), b.iushrn(1);\n do {\n for (;a.isEven(); )\n a.iushrn(1);\n for (;b.isEven(); )\n b.iushrn(1);\n var r = a.cmp(b);\n if (r < 0) {\n var t = a;\n a = b, b = t;\n } else if (r === 0 || b.cmpn(1) === 0)\n break;\n a.isub(b);\n } while (!0);\n return b.iushln(shift);\n }, BN.prototype.invm = function(num) {\n return this.egcd(num).a.umod(num);\n }, BN.prototype.isEven = function() {\n return (this.words[0] & 1) === 0;\n }, BN.prototype.isOdd = function() {\n return (this.words[0] & 1) === 1;\n }, BN.prototype.andln = function(num) {\n return this.words[0] & num;\n }, BN.prototype.bincn = function(bit) {\n assert(typeof bit == \"number\");\n var r = bit % 26, s = (bit - r) / 26, q = 1 << r;\n if (this.length <= s)\n return this._expand(s + 1), this.words[s] |= q, this;\n for (var carry = q, i = s;carry !== 0 && i < this.length; i++) {\n var w = this.words[i] | 0;\n w += carry, carry = w >>> 26, w &= 67108863, this.words[i] = w;\n }\n return carry !== 0 && (this.words[i] = carry, this.length++), this;\n }, BN.prototype.isZero = function() {\n return this.length === 1 && this.words[0] === 0;\n }, BN.prototype.cmpn = function(num) {\n var negative = num < 0;\n if (this.negative !== 0 && !negative)\n return -1;\n if (this.negative === 0 && negative)\n return 1;\n this.strip();\n var res;\n if (this.length > 1)\n res = 1;\n else {\n negative && (num = -num), assert(num <= 67108863, \"Number is too big\");\n var w = this.words[0] | 0;\n res = w === num \? 0 : w < num \? -1 : 1;\n }\n return this.negative !== 0 \? -res | 0 : res;\n }, BN.prototype.cmp = function(num) {\n if (this.negative !== 0 && num.negative === 0)\n return -1;\n if (this.negative === 0 && num.negative !== 0)\n return 1;\n var res = this.ucmp(num);\n return this.negative !== 0 \? -res | 0 : res;\n }, BN.prototype.ucmp = function(num) {\n if (this.length > num.length)\n return 1;\n if (this.length < num.length)\n return -1;\n for (var res = 0, i = this.length - 1;i >= 0; i--) {\n var a = this.words[i] | 0, b = num.words[i] | 0;\n if (a !== b) {\n a < b \? res = -1 : a > b && (res = 1);\n break;\n }\n }\n return res;\n }, BN.prototype.gtn = function(num) {\n return this.cmpn(num) === 1;\n }, BN.prototype.gt = function(num) {\n return this.cmp(num) === 1;\n }, BN.prototype.gten = function(num) {\n return this.cmpn(num) >= 0;\n }, BN.prototype.gte = function(num) {\n return this.cmp(num) >= 0;\n }, BN.prototype.ltn = function(num) {\n return this.cmpn(num) === -1;\n }, BN.prototype.lt = function(num) {\n return this.cmp(num) === -1;\n }, BN.prototype.lten = function(num) {\n return this.cmpn(num) <= 0;\n }, BN.prototype.lte = function(num) {\n return this.cmp(num) <= 0;\n }, BN.prototype.eqn = function(num) {\n return this.cmpn(num) === 0;\n }, BN.prototype.eq = function(num) {\n return this.cmp(num) === 0;\n }, BN.red = function(num) {\n return new Red(num);\n }, BN.prototype.toRed = function(ctx) {\n return assert(!this.red, \"Already a number in reduction context\"), assert(this.negative === 0, \"red works only with positives\"), ctx.convertTo(this)._forceRed(ctx);\n }, BN.prototype.fromRed = function() {\n return assert(this.red, \"fromRed works only with numbers in reduction context\"), this.red.convertFrom(this);\n }, BN.prototype._forceRed = function(ctx) {\n return this.red = ctx, this;\n }, BN.prototype.forceRed = function(ctx) {\n return assert(!this.red, \"Already a number in reduction context\"), this._forceRed(ctx);\n }, BN.prototype.redAdd = function(num) {\n return assert(this.red, \"redAdd works only with red numbers\"), this.red.add(this, num);\n }, BN.prototype.redIAdd = function(num) {\n return assert(this.red, \"redIAdd works only with red numbers\"), this.red.iadd(this, num);\n }, BN.prototype.redSub = function(num) {\n return assert(this.red, \"redSub works only with red numbers\"), this.red.sub(this, num);\n }, BN.prototype.redISub = function(num) {\n return assert(this.red, \"redISub works only with red numbers\"), this.red.isub(this, num);\n }, BN.prototype.redShl = function(num) {\n return assert(this.red, \"redShl works only with red numbers\"), this.red.shl(this, num);\n }, BN.prototype.redMul = function(num) {\n return assert(this.red, \"redMul works only with red numbers\"), this.red._verify2(this, num), this.red.mul(this, num);\n }, BN.prototype.redIMul = function(num) {\n return assert(this.red, \"redMul works only with red numbers\"), this.red._verify2(this, num), this.red.imul(this, num);\n }, BN.prototype.redSqr = function() {\n return assert(this.red, \"redSqr works only with red numbers\"), this.red._verify1(this), this.red.sqr(this);\n }, BN.prototype.redISqr = function() {\n return assert(this.red, \"redISqr works only with red numbers\"), this.red._verify1(this), this.red.isqr(this);\n }, BN.prototype.redSqrt = function() {\n return assert(this.red, \"redSqrt works only with red numbers\"), this.red._verify1(this), this.red.sqrt(this);\n }, BN.prototype.redInvm = function() {\n return assert(this.red, \"redInvm works only with red numbers\"), this.red._verify1(this), this.red.invm(this);\n }, BN.prototype.redNeg = function() {\n return assert(this.red, \"redNeg works only with red numbers\"), this.red._verify1(this), this.red.neg(this);\n }, BN.prototype.redPow = function(num) {\n return assert(this.red && !num.red, \"redPow(normalNum)\"), this.red._verify1(this), this.red.pow(this, num);\n };\n var primes = {\n k256: null,\n p224: null,\n p192: null,\n p25519: null\n };\n function MPrime(name, p) {\n this.name = name, this.p = new BN(p, 16), this.n = this.p.bitLength(), this.k = new BN(1).iushln(this.n).isub(this.p), this.tmp = this._tmp();\n }\n MPrime.prototype = {}, MPrime.prototype._tmp = function() {\n var tmp = new BN(null);\n return tmp.words = new @Array(Math.ceil(this.n / 13)), tmp;\n }, MPrime.prototype.ireduce = function(num) {\n var r = num, rlen;\n do\n this.split(r, this.tmp), r = this.imulK(r), r = r.iadd(this.tmp), rlen = r.bitLength();\n while (rlen > this.n);\n var cmp = rlen < this.n \? -1 : r.ucmp(this.p);\n return cmp === 0 \? (r.words[0] = 0, r.length = 1) : cmp > 0 \? r.isub(this.p) : r.strip !== void 0 \? r.strip() : r._strip(), r;\n }, MPrime.prototype.split = function(input, out) {\n input.iushrn(this.n, 0, out);\n }, MPrime.prototype.imulK = function(num) {\n return num.imul(this.k);\n };\n function K256() {\n MPrime.@call(this, \"k256\", \"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f\");\n }\n inherits(K256, MPrime), K256.prototype.split = function(input, output) {\n for (var mask = 4194303, outLen = Math.min(input.length, 9), i = 0;i < outLen; i++)\n output.words[i] = input.words[i];\n if (output.length = outLen, input.length <= 9) {\n input.words[0] = 0, input.length = 1;\n return;\n }\n var prev = input.words[9];\n for (output.words[output.length++] = prev & mask, i = 10;i < input.length; i++) {\n var next = input.words[i] | 0;\n input.words[i - 10] = (next & mask) << 4 | prev >>> 22, prev = next;\n }\n prev >>>= 22, input.words[i - 10] = prev, prev === 0 && input.length > 10 \? input.length -= 10 : input.length -= 9;\n }, K256.prototype.imulK = function(num) {\n num.words[num.length] = 0, num.words[num.length + 1] = 0, num.length += 2;\n for (var lo = 0, i = 0;i < num.length; i++) {\n var w = num.words[i] | 0;\n lo += w * 977, num.words[i] = lo & 67108863, lo = w * 64 + (lo / 67108864 | 0);\n }\n return num.words[num.length - 1] === 0 && (num.length--, num.words[num.length - 1] === 0 && num.length--), num;\n };\n function P224() {\n MPrime.@call(this, \"p224\", \"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001\");\n }\n inherits(P224, MPrime);\n function P192() {\n MPrime.@call(this, \"p192\", \"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff\");\n }\n inherits(P192, MPrime);\n function P25519() {\n MPrime.@call(this, \"25519\", \"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed\");\n }\n inherits(P25519, MPrime), P25519.prototype.imulK = function(num) {\n for (var carry = 0, i = 0;i < num.length; i++) {\n var hi = (num.words[i] | 0) * 19 + carry, lo = hi & 67108863;\n hi >>>= 26, num.words[i] = lo, carry = hi;\n }\n return carry !== 0 && (num.words[num.length++] = carry), num;\n }, BN._prime = function(name) {\n if (primes[name])\n return primes[name];\n var prime2;\n if (name === \"k256\")\n prime2 = new K256;\n else if (name === \"p224\")\n prime2 = new P224;\n else if (name === \"p192\")\n prime2 = new P192;\n else if (name === \"p25519\")\n prime2 = new P25519;\n else\n throw new Error(\"Unknown prime \" + name);\n return primes[name] = prime2, prime2;\n };\n function Red(m) {\n if (typeof m == \"string\") {\n var prime = BN._prime(m);\n this.m = prime.p, this.prime = prime;\n } else\n assert(m.gtn(1), \"modulus must be greater than 1\"), this.m = m, this.prime = null;\n }\n Red.prototype = {}, Red.prototype._verify1 = function(a) {\n assert(a.negative === 0, \"red works only with positives\"), assert(a.red, \"red works only with red numbers\");\n }, Red.prototype._verify2 = function(a, b) {\n assert((a.negative | b.negative) === 0, \"red works only with positives\"), assert(a.red && a.red === b.red, \"red works only with red numbers\");\n }, Red.prototype.imod = function(a) {\n return this.prime \? this.prime.ireduce(a)._forceRed(this) : a.umod(this.m)._forceRed(this);\n }, Red.prototype.neg = function(a) {\n return a.isZero() \? a.clone() : this.m.sub(a)._forceRed(this);\n }, Red.prototype.add = function(a, b) {\n this._verify2(a, b);\n var res = a.add(b);\n return res.cmp(this.m) >= 0 && res.isub(this.m), res._forceRed(this);\n }, Red.prototype.iadd = function(a, b) {\n this._verify2(a, b);\n var res = a.iadd(b);\n return res.cmp(this.m) >= 0 && res.isub(this.m), res;\n }, Red.prototype.sub = function(a, b) {\n this._verify2(a, b);\n var res = a.sub(b);\n return res.cmpn(0) < 0 && res.iadd(this.m), res._forceRed(this);\n }, Red.prototype.isub = function(a, b) {\n this._verify2(a, b);\n var res = a.isub(b);\n return res.cmpn(0) < 0 && res.iadd(this.m), res;\n }, Red.prototype.shl = function(a, num) {\n return this._verify1(a), this.imod(a.ushln(num));\n }, Red.prototype.imul = function(a, b) {\n return this._verify2(a, b), this.imod(a.imul(b));\n }, Red.prototype.mul = function(a, b) {\n return this._verify2(a, b), this.imod(a.mul(b));\n }, Red.prototype.isqr = function(a) {\n return this.imul(a, a.clone());\n }, Red.prototype.sqr = function(a) {\n return this.mul(a, a);\n }, Red.prototype.sqrt = function(a) {\n if (a.isZero())\n return a.clone();\n var mod3 = this.m.andln(3);\n if (assert(mod3 % 2 === 1), mod3 === 3) {\n var pow = this.m.add(new BN(1)).iushrn(2);\n return this.pow(a, pow);\n }\n for (var q = this.m.subn(1), s = 0;!q.isZero() && q.andln(1) === 0; )\n s++, q.iushrn(1);\n assert(!q.isZero());\n var one = new BN(1).toRed(this), nOne = one.redNeg(), lpow = this.m.subn(1).iushrn(1), z = this.m.bitLength();\n for (z = new BN(2 * z * z).toRed(this);this.pow(z, lpow).cmp(nOne) !== 0; )\n z.redIAdd(nOne);\n for (var c = this.pow(z, q), r = this.pow(a, q.addn(1).iushrn(1)), t = this.pow(a, q), m = s;t.cmp(one) !== 0; ) {\n for (var tmp = t, i = 0;tmp.cmp(one) !== 0; i++)\n tmp = tmp.redSqr();\n assert(i < m);\n var b = this.pow(c, new BN(1).iushln(m - i - 1));\n r = r.redMul(b), c = b.redSqr(), t = t.redMul(c), m = i;\n }\n return r;\n }, Red.prototype.invm = function(a) {\n var inv = a._invmp(this.m);\n return inv.negative !== 0 \? (inv.negative = 0, this.imod(inv).redNeg()) : this.imod(inv);\n }, Red.prototype.pow = function(a, num) {\n if (num.isZero())\n return new BN(1).toRed(this);\n if (num.cmpn(1) === 0)\n return a.clone();\n var windowSize = 4, wnd = new @Array(1 << windowSize);\n wnd[0] = new BN(1).toRed(this), wnd[1] = a;\n for (var i = 2;i < wnd.length; i++)\n wnd[i] = this.mul(wnd[i - 1], a);\n var res = wnd[0], current = 0, currentLen = 0, start = num.bitLength() % 26;\n for (start === 0 && (start = 26), i = num.length - 1;i >= 0; i--) {\n for (var word = num.words[i], j = start - 1;j >= 0; j--) {\n var bit = word >> j & 1;\n if (res !== wnd[0] && (res = this.sqr(res)), bit === 0 && current === 0) {\n currentLen = 0;\n continue;\n }\n current <<= 1, current |= bit, currentLen++, !(currentLen !== windowSize && (i !== 0 || j !== 0)) && (res = this.mul(res, wnd[current]), currentLen = 0, current = 0);\n }\n start = 26;\n }\n return res;\n }, Red.prototype.convertTo = function(num) {\n var r = num.umod(this.m);\n return r === num \? r.clone() : r;\n }, Red.prototype.convertFrom = function(num) {\n var res = num.clone();\n return res.red = null, res;\n }, BN.mont = function(num) {\n return new Mont(num);\n };\n function Mont(m) {\n Red.@call(this, m), this.shift = this.m.bitLength(), this.shift % 26 !== 0 && (this.shift += 26 - this.shift % 26), this.r = new BN(1).iushln(this.shift), this.r2 = this.imod(this.r.sqr()), this.rinv = this.r._invmp(this.m), this.minv = this.rinv.mul(this.r).isubn(1).div(this.m), this.minv = this.minv.umod(this.r), this.minv = this.r.sub(this.minv);\n }\n inherits(Mont, Red), Mont.prototype.convertTo = function(num) {\n return this.imod(num.ushln(this.shift));\n }, Mont.prototype.convertFrom = function(num) {\n var r = this.imod(num.mul(this.rinv));\n return r.red = null, r;\n }, Mont.prototype.imul = function(a, b) {\n if (a.isZero() || b.isZero())\n return a.words[0] = 0, a.length = 1, a;\n var t = a.imul(b), c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), u = t.isub(c).iushrn(this.shift), res = u;\n return u.cmp(this.m) >= 0 \? res = u.isub(this.m) : u.cmpn(0) < 0 && (res = u.iadd(this.m)), res._forceRed(this);\n }, Mont.prototype.mul = function(a, b) {\n if (a.isZero() || b.isZero())\n return new BN(0)._forceRed(this);\n var t = a.mul(b), c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), u = t.isub(c).iushrn(this.shift), res = u;\n return u.cmp(this.m) >= 0 \? res = u.isub(this.m) : u.cmpn(0) < 0 && (res = u.iadd(this.m)), res._forceRed(this);\n }, Mont.prototype.invm = function(a) {\n var res = this.imod(a._invmp(this.m).mul(this.r2));\n return res._forceRed(this);\n };\n })(typeof module > \"u\" || module, exports);\n }\n}), require_bn2 = require_bn, require_brorand = __commonJS({\n \"node_modules/brorand/index.js\"(exports, module) {\n var r;\n module.exports = function(len) {\n return r || (r = new Rand(null)), r.generate(len);\n };\n function Rand(rand) {\n this.rand = rand;\n }\n Rand.prototype = {}, module.exports.Rand = Rand, Rand.prototype.generate = function(len) {\n return this._rand(len);\n }, Rand.prototype._rand = function(n) {\n var out = new Buffer(n);\n return crypto.getRandomValues(out), out;\n };\n }\n}), require_mr = __commonJS({\n \"node_modules/miller-rabin/lib/mr.js\"(exports, module) {\n var bn = require_bn2(), brorand = require_brorand();\n function MillerRabin(rand) {\n this.rand = rand || new brorand.Rand;\n }\n module.exports = MillerRabin, MillerRabin.create = function(rand) {\n return new MillerRabin(rand);\n }, MillerRabin.prototype = {}, MillerRabin.prototype._randbelow = function(n) {\n var len = n.bitLength(), min_bytes = Math.ceil(len / 8);\n do\n var a = new bn(this.rand.generate(min_bytes));\n while (a.cmp(n) >= 0);\n return a;\n }, MillerRabin.prototype._randrange = function(start, stop) {\n var size = stop.sub(start);\n return start.add(this._randbelow(size));\n }, MillerRabin.prototype.test = function(n, k, cb) {\n var len = n.bitLength(), red = bn.mont(n), rone = new bn(1).toRed(red);\n k || (k = Math.max(1, len / 48 | 0));\n for (var n1 = n.subn(1), s = 0;!n1.testn(s); s++)\n ;\n for (var d = n.shrn(s), rn1 = n1.toRed(red), prime = !0;k > 0; k--) {\n var a = this._randrange(new bn(2), n1);\n cb && cb(a);\n var x = a.toRed(red).redPow(d);\n if (!(x.cmp(rone) === 0 || x.cmp(rn1) === 0)) {\n for (var i = 1;i < s; i++) {\n if (x = x.redSqr(), x.cmp(rone) === 0)\n return !1;\n if (x.cmp(rn1) === 0)\n break;\n }\n if (i === s)\n return !1;\n }\n }\n return prime;\n }, MillerRabin.prototype.getDivisor = function(n, k) {\n var len = n.bitLength(), red = bn.mont(n), rone = new bn(1).toRed(red);\n k || (k = Math.max(1, len / 48 | 0));\n for (var n1 = n.subn(1), s = 0;!n1.testn(s); s++)\n ;\n for (var d = n.shrn(s), rn1 = n1.toRed(red);k > 0; k--) {\n var a = this._randrange(new bn(2), n1), g = n.gcd(a);\n if (g.cmpn(1) !== 0)\n return g;\n var x = a.toRed(red).redPow(d);\n if (!(x.cmp(rone) === 0 || x.cmp(rn1) === 0)) {\n for (var i = 1;i < s; i++) {\n if (x = x.redSqr(), x.cmp(rone) === 0)\n return x.fromRed().subn(1).gcd(n);\n if (x.cmp(rn1) === 0)\n break;\n }\n if (i === s)\n return x = x.redSqr(), x.fromRed().subn(1).gcd(n);\n }\n }\n return !1;\n };\n }\n}), require_generatePrime = __commonJS({\n \"node_modules/diffie-hellman/lib/generatePrime.js\"(exports, module) {\n var randomBytes = require_browser();\n module.exports = findPrime, findPrime.simpleSieve = simpleSieve, findPrime.fermatTest = fermatTest;\n var BN = require_bn(), TWENTYFOUR = new BN(24), MillerRabin = require_mr(), millerRabin = new MillerRabin, ONE = new BN(1), TWO = new BN(2), FIVE = new BN(5), SIXTEEN = new BN(16), EIGHT = new BN(8), TEN = new BN(10), THREE = new BN(3), SEVEN = new BN(7), ELEVEN = new BN(11), FOUR = new BN(4), TWELVE = new BN(12), primes = null;\n function _getPrimes() {\n if (primes !== null)\n return primes;\n var limit = 1048576, res = [];\n res[0] = 2;\n for (var i = 1, k = 3;k < limit; k += 2) {\n for (var sqrt = Math.ceil(Math.sqrt(k)), j = 0;j < i && res[j] <= sqrt && k % res[j] !== 0; j++)\n ;\n i !== j && res[j] <= sqrt || (res[i++] = k);\n }\n return primes = res, res;\n }\n function simpleSieve(p) {\n for (var primes2 = _getPrimes(), i = 0;i < primes2.length; i++)\n if (p.modn(primes2[i]) === 0)\n return p.cmpn(primes2[i]) === 0;\n return !0;\n }\n function fermatTest(p) {\n var red = BN.mont(p);\n return TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1) === 0;\n }\n function findPrime(bits, gen) {\n if (bits < 16)\n return gen === 2 || gen === 5 \? new BN([140, 123]) : new BN([140, 39]);\n gen = new BN(gen);\n for (var num, n2;; ) {\n for (num = new BN(randomBytes(Math.ceil(bits / 8)));num.bitLength() > bits; )\n num.ishrn(1);\n if (num.isEven() && num.iadd(ONE), num.testn(1) || num.iadd(TWO), gen.cmp(TWO)) {\n if (!gen.cmp(FIVE))\n for (;num.mod(TEN).cmp(THREE); )\n num.iadd(FOUR);\n } else\n for (;num.mod(TWENTYFOUR).cmp(ELEVEN); )\n num.iadd(FOUR);\n if (n2 = num.shrn(1), simpleSieve(n2) && simpleSieve(num) && fermatTest(n2) && fermatTest(num) && millerRabin.test(n2) && millerRabin.test(num))\n return num;\n }\n }\n }\n}), require_primes = __commonJS({\n \"node_modules/diffie-hellman/lib/primes.json\"(exports, module) {\n module.exports = {\n modp1: {\n gen: \"02\",\n prime: \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff\"\n },\n modp2: {\n gen: \"02\",\n prime: \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff\"\n },\n modp5: {\n gen: \"02\",\n prime: \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff\"\n },\n modp14: {\n gen: \"02\",\n prime: \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff\"\n },\n modp15: {\n gen: \"02\",\n prime: \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff\"\n },\n modp16: {\n gen: \"02\",\n prime: \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff\"\n },\n modp17: {\n gen: \"02\",\n prime: \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff\"\n },\n modp18: {\n gen: \"02\",\n prime: \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff\"\n }\n };\n }\n}), require_dh = __commonJS({\n \"node_modules/diffie-hellman/lib/dh.js\"(exports, module) {\n var BN = require_bn(), MillerRabin = require_mr(), millerRabin = new MillerRabin, TWENTYFOUR = new BN(24), ELEVEN = new BN(11), TEN = new BN(10), THREE = new BN(3), SEVEN = new BN(7), primes = require_generatePrime(), randomBytes = require_browser();\n module.exports = DH;\n function setPublicKey(pub, enc) {\n return enc = enc || \"utf8\", Buffer.isBuffer(pub) || (pub = new Buffer(pub, enc)), this._pub = new BN(pub), this;\n }\n function setPrivateKey(priv, enc) {\n return enc = enc || \"utf8\", Buffer.isBuffer(priv) || (priv = new Buffer(priv, enc)), this._priv = new BN(priv), this;\n }\n var primeCache = {};\n function checkPrime(prime, generator) {\n var gen = generator.toString(\"hex\"), hex = [gen, prime.toString(16)].join(\"_\");\n if (hex in primeCache)\n return primeCache[hex];\n var error = 0;\n if (prime.isEven() || !primes.simpleSieve || !primes.fermatTest(prime) || !millerRabin.test(prime))\n return error += 1, gen === \"02\" || gen === \"05\" \? error += 8 : error += 4, primeCache[hex] = error, error;\n millerRabin.test(prime.shrn(1)) || (error += 2);\n var rem;\n switch (gen) {\n case \"02\":\n prime.mod(TWENTYFOUR).cmp(ELEVEN) && (error += 8);\n break;\n case \"05\":\n rem = prime.mod(TEN), rem.cmp(THREE) && rem.cmp(SEVEN) && (error += 8);\n break;\n default:\n error += 4;\n }\n return primeCache[hex] = error, error;\n }\n function DH(prime, generator, malleable) {\n this.setGenerator(generator), this.__prime = new BN(prime), this._prime = BN.mont(this.__prime), this._primeLen = prime.length, this._pub = void 0, this._priv = void 0, this._primeCode = void 0, malleable \? (this.setPublicKey = setPublicKey, this.setPrivateKey = setPrivateKey) : this._primeCode = 8;\n }\n DH.prototype = {}, Object.defineProperty(DH.prototype, \"verifyError\", {\n enumerable: !0,\n get: function() {\n return typeof this._primeCode != \"number\" && (this._primeCode = checkPrime(this.__prime, this.__gen)), this._primeCode;\n }\n }), DH.prototype.generateKeys = function() {\n return this._priv || (this._priv = new BN(randomBytes(this._primeLen))), this._pub = this._gen.toRed(this._prime).redPow(this._priv).fromRed(), this.getPublicKey();\n }, DH.prototype.computeSecret = function(other) {\n other = new BN(other), other = other.toRed(this._prime);\n var secret = other.redPow(this._priv).fromRed(), out = new Buffer(secret.toArray()), prime = this.getPrime();\n if (out.length < prime.length) {\n var front = new Buffer(prime.length - out.length);\n front.fill(0), out = Buffer.concat([front, out]);\n }\n return out;\n }, DH.prototype.getPublicKey = function(enc) {\n return formatReturnValue(this._pub, enc);\n }, DH.prototype.getPrivateKey = function(enc) {\n return formatReturnValue(this._priv, enc);\n }, DH.prototype.getPrime = function(enc) {\n return formatReturnValue(this.__prime, enc);\n }, DH.prototype.getGenerator = function(enc) {\n return formatReturnValue(this._gen, enc);\n }, DH.prototype.setGenerator = function(gen, enc) {\n return enc = enc || \"utf8\", Buffer.isBuffer(gen) || (gen = new Buffer(gen, enc)), this.__gen = gen, this._gen = new BN(gen), this;\n };\n function formatReturnValue(bn, enc) {\n var buf = new Buffer(bn.toArray());\n return enc \? buf.toString(enc) : buf;\n }\n }\n}), require_browser7 = __commonJS({\n \"node_modules/diffie-hellman/browser.js\"(exports) {\n var generatePrime = require_generatePrime(), primes = require_primes(), DH = require_dh();\n function getDiffieHellman(mod) {\n var prime = new Buffer(primes[mod].prime, \"hex\"), gen = new Buffer(primes[mod].gen, \"hex\");\n return new DH(prime, gen);\n }\n var ENCODINGS = {\n binary: !0,\n hex: !0,\n base64: !0\n };\n function createDiffieHellman(prime, enc, generator, genc) {\n return Buffer.isBuffer(enc) || ENCODINGS[enc] === void 0 \? createDiffieHellman(prime, \"binary\", enc, generator) : (enc = enc || \"binary\", genc = genc || \"binary\", generator = generator || new Buffer([2]), Buffer.isBuffer(generator) || (generator = new Buffer(generator, genc)), typeof prime == \"number\" \? new DH(generatePrime(prime, generator), generator, !0) : (Buffer.isBuffer(prime) || (prime = new Buffer(prime, enc)), new DH(prime, generator, !0)));\n }\n exports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffieHellman = getDiffieHellman, exports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman;\n }\n}), require_bn3 = require_bn, require_browserify_rsa = __commonJS({\n \"node_modules/browserify-rsa/index.js\"(exports, module) {\n var BN = require_bn3(), randomBytes = require_browser();\n function blind(priv) {\n var r = getr(priv), blinder = r.toRed(BN.mont(priv.modulus)).redPow(new BN(priv.publicExponent)).fromRed();\n return { blinder, unblinder: r.invm(priv.modulus) };\n }\n function getr(priv) {\n var len = priv.modulus.byteLength(), r;\n do\n r = new BN(randomBytes(len));\n while (r.cmp(priv.modulus) >= 0 || !r.umod(priv.prime1) || !r.umod(priv.prime2));\n return r;\n }\n function crt(msg, priv) {\n var blinds = blind(priv), len = priv.modulus.byteLength(), blinded = new BN(msg).mul(blinds.blinder).umod(priv.modulus), c1 = blinded.toRed(BN.mont(priv.prime1)), c2 = blinded.toRed(BN.mont(priv.prime2)), qinv = priv.coefficient, p = priv.prime1, q = priv.prime2, m1 = c1.redPow(priv.exponent1).fromRed(), m2 = c2.redPow(priv.exponent2).fromRed(), h = m1.isub(m2).imul(qinv).umod(p).imul(q);\n return m2.iadd(h).imul(blinds.unblinder).umod(priv.modulus).toArrayLike(Buffer, \"be\", len);\n }\n crt.getr = getr, module.exports = crt;\n }\n}), require_package = __commonJS({\n \"node_modules/elliptic/package.json\"(exports, module) {\n module.exports = {\n name: \"elliptic\",\n version: \"6.5.4\",\n description: \"EC cryptography\",\n main: \"lib/elliptic.js\",\n files: [\"lib\"],\n scripts: {\n lint: \"eslint lib test\",\n \"lint:fix\": \"npm run lint -- --fix\",\n unit: \"istanbul test _mocha --reporter=spec test/index.js\",\n test: \"npm run lint && npm run unit\",\n version: \"grunt dist && git add dist/\"\n },\n repository: {\n type: \"git\",\n url: \"git@github.com:indutny/elliptic\"\n },\n keywords: [\"EC\", \"Elliptic\", \"curve\", \"Cryptography\"],\n author: \"Fedor Indutny \",\n license: \"MIT\",\n bugs: {\n url: \"https://github.com/indutny/elliptic/issues\"\n },\n homepage: \"https://github.com/indutny/elliptic\",\n devDependencies: {\n brfs: \"^2.0.2\",\n coveralls: \"^3.1.0\",\n eslint: \"^7.6.0\",\n grunt: \"^1.2.1\",\n \"grunt-browserify\": \"^5.3.0\",\n \"grunt-cli\": \"^1.3.2\",\n \"grunt-contrib-connect\": \"^3.0.0\",\n \"grunt-contrib-copy\": \"^1.0.0\",\n \"grunt-contrib-uglify\": \"^5.0.0\",\n \"grunt-mocha-istanbul\": \"^5.0.2\",\n \"grunt-saucelabs\": \"^9.0.1\",\n istanbul: \"^0.4.5\",\n mocha: \"^8.0.1\"\n },\n dependencies: {\n \"bn.js\": \"^4.11.9\",\n brorand: \"^1.1.0\",\n \"hash.js\": \"^1.0.0\",\n \"hmac-drbg\": \"^1.0.1\",\n inherits: \"^2.0.4\",\n \"minimalistic-assert\": \"^1.0.1\",\n \"minimalistic-crypto-utils\": \"^1.0.1\"\n }\n };\n }\n}), require_bn4 = require_bn, require_utils2 = __commonJS({\n \"node_modules/minimalistic-crypto-utils/lib/utils.js\"(exports) {\n var utils = exports;\n function toArray(msg, enc) {\n if (@Array.isArray(msg))\n return msg.slice();\n if (!msg)\n return [];\n var res = [];\n if (typeof msg != \"string\") {\n for (var i = 0;i < msg.length; i++)\n res[i] = msg[i] | 0;\n return res;\n }\n if (enc === \"hex\") {\n msg = msg.replace(/[^a-z0-9]+/gi, \"\"), msg.length % 2 !== 0 && (msg = \"0\" + msg);\n for (var i = 0;i < msg.length; i += 2)\n res.push(parseInt(msg[i] + msg[i + 1], 16));\n } else\n for (var i = 0;i < msg.length; i++) {\n var c = msg.charCodeAt(i), hi = c >> 8, lo = c & 255;\n hi \? res.push(hi, lo) : res.push(lo);\n }\n return res;\n }\n utils.toArray = toArray;\n function zero2(word) {\n return word.length === 1 \? \"0\" + word : word;\n }\n utils.zero2 = zero2;\n function toHex(msg) {\n for (var res = \"\", i = 0;i < msg.length; i++)\n res += zero2(msg[i].toString(16));\n return res;\n }\n utils.toHex = toHex, utils.encode = function(arr, enc) {\n return enc === \"hex\" \? toHex(arr) : arr;\n };\n }\n}), require_utils3 = __commonJS({\n \"node_modules/elliptic/lib/elliptic/utils.js\"(exports) {\n var utils = exports, BN = require_bn4(), minAssert = require_minimalistic_assert(), minUtils = require_utils2();\n utils.assert = minAssert, utils.toArray = minUtils.toArray, utils.zero2 = minUtils.zero2, utils.toHex = minUtils.toHex, utils.encode = minUtils.encode;\n function getNAF(num, w, bits) {\n var naf = new @Array(Math.max(num.bitLength(), bits) + 1);\n naf.fill(0);\n for (var ws = 1 << w + 1, k = num.clone(), i = 0;i < naf.length; i++) {\n var z, mod = k.andln(ws - 1);\n k.isOdd() \? (mod > (ws >> 1) - 1 \? z = (ws >> 1) - mod : z = mod, k.isubn(z)) : z = 0, naf[i] = z, k.iushrn(1);\n }\n return naf;\n }\n utils.getNAF = getNAF;\n function getJSF(k1, k2) {\n var jsf = [[], []];\n k1 = k1.clone(), k2 = k2.clone();\n for (var d1 = 0, d2 = 0, m8;k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0; ) {\n var m14 = k1.andln(3) + d1 & 3, m24 = k2.andln(3) + d2 & 3;\n m14 === 3 && (m14 = -1), m24 === 3 && (m24 = -1);\n var u1;\n (m14 & 1) === 0 \? u1 = 0 : (m8 = k1.andln(7) + d1 & 7, (m8 === 3 || m8 === 5) && m24 === 2 \? u1 = -m14 : u1 = m14), jsf[0].push(u1);\n var u2;\n (m24 & 1) === 0 \? u2 = 0 : (m8 = k2.andln(7) + d2 & 7, (m8 === 3 || m8 === 5) && m14 === 2 \? u2 = -m24 : u2 = m24), jsf[1].push(u2), 2 * d1 === u1 + 1 && (d1 = 1 - d1), 2 * d2 === u2 + 1 && (d2 = 1 - d2), k1.iushrn(1), k2.iushrn(1);\n }\n return jsf;\n }\n utils.getJSF = getJSF;\n function cachedProperty(obj, name, computer) {\n var key2 = \"_\" + name;\n obj.prototype[name] = function() {\n return this[key2] !== void 0 \? this[key2] : this[key2] = computer.@call(this);\n };\n }\n utils.cachedProperty = cachedProperty;\n function parseBytes(bytes) {\n if (bytes instanceof KeyObject)\n bytes = bytes.export();\n else if (bytes instanceof CryptoKey)\n bytes = KeyObject.from(bytes).export();\n return typeof bytes == \"string\" \? utils.toArray(bytes, \"hex\") : bytes;\n }\n utils.parseBytes = parseBytes;\n function intFromLE(bytes) {\n return new BN(bytes, \"hex\", \"le\");\n }\n utils.intFromLE = intFromLE;\n }\n}), require_base = __commonJS({\n \"node_modules/elliptic/lib/elliptic/curve/base.js\"(exports, module) {\n var BN = require_bn4(), utils = require_utils3(), getNAF = utils.getNAF, getJSF = utils.getJSF, assert = utils.assert;\n function BaseCurve(type, conf) {\n this.type = type, this.p = new BN(conf.p, 16), this.red = conf.prime \? BN.red(conf.prime) : BN.mont(this.p), this.zero = new BN(0).toRed(this.red), this.one = new BN(1).toRed(this.red), this.two = new BN(2).toRed(this.red), this.n = conf.n && new BN(conf.n, 16), this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed), this._wnafT1 = new @Array(4), this._wnafT2 = new @Array(4), this._wnafT3 = new @Array(4), this._wnafT4 = new @Array(4), this._bitLength = this.n \? this.n.bitLength() : 0;\n var adjustCount = this.n && this.p.div(this.n);\n !adjustCount || adjustCount.cmpn(100) > 0 \? this.redN = null : (this._maxwellTrick = !0, this.redN = this.n.toRed(this.red));\n }\n module.exports = BaseCurve, BaseCurve.prototype = {}, BaseCurve.prototype.point = function() {\n throw new Error(\"Not implemented\");\n }, BaseCurve.prototype.validate = function() {\n throw new Error(\"Not implemented\");\n }, BaseCurve.prototype._fixedNafMul = function(p, k) {\n assert(p.precomputed);\n var doubles = p._getDoubles(), naf = getNAF(k, 1, this._bitLength), I = (1 << doubles.step + 1) - (doubles.step % 2 === 0 \? 2 : 1);\n I /= 3;\n var repr = [], j, nafW;\n for (j = 0;j < naf.length; j += doubles.step) {\n nafW = 0;\n for (var l = j + doubles.step - 1;l >= j; l--)\n nafW = (nafW << 1) + naf[l];\n repr.push(nafW);\n }\n for (var a = this.jpoint(null, null, null), b = this.jpoint(null, null, null), i = I;i > 0; i--) {\n for (j = 0;j < repr.length; j++)\n nafW = repr[j], nafW === i \? b = b.mixedAdd(doubles.points[j]) : nafW === -i && (b = b.mixedAdd(doubles.points[j].neg()));\n a = a.add(b);\n }\n return a.toP();\n }, BaseCurve.prototype._wnafMul = function(p, k) {\n var w = 4, nafPoints = p._getNAFPoints(w);\n w = nafPoints.wnd;\n for (var wnd = nafPoints.points, naf = getNAF(k, w, this._bitLength), acc = this.jpoint(null, null, null), i = naf.length - 1;i >= 0; i--) {\n for (var l = 0;i >= 0 && naf[i] === 0; i--)\n l++;\n if (i >= 0 && l++, acc = acc.dblp(l), i < 0)\n break;\n var z = naf[i];\n assert(z !== 0), p.type === \"affine\" \? z > 0 \? acc = acc.mixedAdd(wnd[z - 1 >> 1]) : acc = acc.mixedAdd(wnd[-z - 1 >> 1].neg()) : z > 0 \? acc = acc.add(wnd[z - 1 >> 1]) : acc = acc.add(wnd[-z - 1 >> 1].neg());\n }\n return p.type === \"affine\" \? acc.toP() : acc;\n }, BaseCurve.prototype._wnafMulAdd = function(defW, points, coeffs, len, jacobianResult) {\n var wndWidth = this._wnafT1, wnd = this._wnafT2, naf = this._wnafT3, max = 0, i, j, p;\n for (i = 0;i < len; i++) {\n p = points[i];\n var nafPoints = p._getNAFPoints(defW);\n wndWidth[i] = nafPoints.wnd, wnd[i] = nafPoints.points;\n }\n for (i = len - 1;i >= 1; i -= 2) {\n var a = i - 1, b = i;\n if (wndWidth[a] !== 1 || wndWidth[b] !== 1) {\n naf[a] = getNAF(coeffs[a], wndWidth[a], this._bitLength), naf[b] = getNAF(coeffs[b], wndWidth[b], this._bitLength), max = Math.max(naf[a].length, max), max = Math.max(naf[b].length, max);\n continue;\n }\n var comb = [points[a], null, null, points[b]];\n points[a].y.cmp(points[b].y) === 0 \? (comb[1] = points[a].add(points[b]), comb[2] = points[a].toJ().mixedAdd(points[b].neg())) : points[a].y.cmp(points[b].y.redNeg()) === 0 \? (comb[1] = points[a].toJ().mixedAdd(points[b]), comb[2] = points[a].add(points[b].neg())) : (comb[1] = points[a].toJ().mixedAdd(points[b]), comb[2] = points[a].toJ().mixedAdd(points[b].neg()));\n var index = [-3, -1, -5, -7, 0, 7, 5, 1, 3], jsf = getJSF(coeffs[a], coeffs[b]);\n for (max = Math.max(jsf[0].length, max), naf[a] = new @Array(max), naf[b] = new @Array(max), j = 0;j < max; j++) {\n var ja = jsf[0][j] | 0, jb = jsf[1][j] | 0;\n naf[a][j] = index[(ja + 1) * 3 + (jb + 1)], naf[b][j] = 0, wnd[a] = comb;\n }\n }\n var acc = this.jpoint(null, null, null), tmp = this._wnafT4;\n for (i = max;i >= 0; i--) {\n for (var k = 0;i >= 0; ) {\n var zero = !0;\n for (j = 0;j < len; j++)\n tmp[j] = naf[j][i] | 0, tmp[j] !== 0 && (zero = !1);\n if (!zero)\n break;\n k++, i--;\n }\n if (i >= 0 && k++, acc = acc.dblp(k), i < 0)\n break;\n for (j = 0;j < len; j++) {\n var z = tmp[j];\n z !== 0 && (z > 0 \? p = wnd[j][z - 1 >> 1] : z < 0 && (p = wnd[j][-z - 1 >> 1].neg()), p.type === \"affine\" \? acc = acc.mixedAdd(p) : acc = acc.add(p));\n }\n }\n for (i = 0;i < len; i++)\n wnd[i] = null;\n return jacobianResult \? acc : acc.toP();\n };\n function BasePoint(curve, type) {\n this.curve = curve, this.type = type, this.precomputed = null;\n }\n BasePoint.prototype = {}, BaseCurve.BasePoint = BasePoint, BasePoint.prototype.eq = function() {\n throw new Error(\"Not implemented\");\n }, BasePoint.prototype.validate = function() {\n return this.curve.validate(this);\n }, BaseCurve.prototype.decodePoint = function(bytes, enc) {\n bytes = utils.toArray(bytes, enc);\n var len = this.p.byteLength();\n if ((bytes[0] === 4 || bytes[0] === 6 || bytes[0] === 7) && bytes.length - 1 === 2 * len) {\n bytes[0] === 6 \? assert(bytes[bytes.length - 1] % 2 === 0) : bytes[0] === 7 && assert(bytes[bytes.length - 1] % 2 === 1);\n var res = this.point(bytes.slice(1, 1 + len), bytes.slice(1 + len, 1 + 2 * len));\n return res;\n } else if ((bytes[0] === 2 || bytes[0] === 3) && bytes.length - 1 === len)\n return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 3);\n throw new Error(\"Unknown point format\");\n }, BasePoint.prototype.encodeCompressed = function(enc) {\n return this.encode(enc, !0);\n }, BasePoint.prototype._encode = function(compact) {\n var len = this.curve.p.byteLength(), x = this.getX().toArray(\"be\", len);\n return compact \? [this.getY().isEven() \? 2 : 3].concat(x) : [4].concat(x, this.getY().toArray(\"be\", len));\n }, BasePoint.prototype.encode = function(enc, compact) {\n return utils.encode(this._encode(compact), enc);\n }, BasePoint.prototype.precompute = function(power) {\n if (this.precomputed)\n return this;\n var precomputed = {\n doubles: null,\n naf: null,\n beta: null\n };\n return precomputed.naf = this._getNAFPoints(8), precomputed.doubles = this._getDoubles(4, power), precomputed.beta = this._getBeta(), this.precomputed = precomputed, this;\n }, BasePoint.prototype._hasDoubles = function(k) {\n if (!this.precomputed)\n return !1;\n var doubles = this.precomputed.doubles;\n return doubles \? doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step) : !1;\n }, BasePoint.prototype._getDoubles = function(step, power) {\n if (this.precomputed && this.precomputed.doubles)\n return this.precomputed.doubles;\n for (var doubles = [this], acc = this, i = 0;i < power; i += step) {\n for (var j = 0;j < step; j++)\n acc = acc.dbl();\n doubles.push(acc);\n }\n return {\n step,\n points: doubles\n };\n }, BasePoint.prototype._getNAFPoints = function(wnd) {\n if (this.precomputed && this.precomputed.naf)\n return this.precomputed.naf;\n for (var res = [this], max = (1 << wnd) - 1, dbl = max === 1 \? null : this.dbl(), i = 1;i < max; i++)\n res[i] = res[i - 1].add(dbl);\n return {\n wnd,\n points: res\n };\n }, BasePoint.prototype._getBeta = function() {\n return null;\n }, BasePoint.prototype.dblp = function(k) {\n for (var r = this, i = 0;i < k; i++)\n r = r.dbl();\n return r;\n };\n }\n}), require_short = __commonJS({\n \"node_modules/elliptic/lib/elliptic/curve/short.js\"(exports, module) {\n var utils = require_utils3(), BN = require_bn4(), inherits = require_inherits_browser(), Base = require_base(), assert = utils.assert;\n function ShortCurve(conf) {\n Base.@call(this, \"short\", conf), this.a = new BN(conf.a, 16).toRed(this.red), this.b = new BN(conf.b, 16).toRed(this.red), this.tinv = this.two.redInvm(), this.zeroA = this.a.fromRed().cmpn(0) === 0, this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0, this.endo = this._getEndomorphism(conf), this._endoWnafT1 = new @Array(4), this._endoWnafT2 = new @Array(4);\n }\n inherits(ShortCurve, Base), module.exports = ShortCurve, ShortCurve.prototype._getEndomorphism = function(conf) {\n if (!(!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)) {\n var beta, lambda;\n if (conf.beta)\n beta = new BN(conf.beta, 16).toRed(this.red);\n else {\n var betas = this._getEndoRoots(this.p);\n beta = betas[0].cmp(betas[1]) < 0 \? betas[0] : betas[1], beta = beta.toRed(this.red);\n }\n if (conf.lambda)\n lambda = new BN(conf.lambda, 16);\n else {\n var lambdas = this._getEndoRoots(this.n);\n this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0 \? lambda = lambdas[0] : (lambda = lambdas[1], assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0));\n }\n var basis;\n return conf.basis \? basis = conf.basis.map(function(vec) {\n return {\n a: new BN(vec.a, 16),\n b: new BN(vec.b, 16)\n };\n }) : basis = this._getEndoBasis(lambda), {\n beta,\n lambda,\n basis\n };\n }\n }, ShortCurve.prototype._getEndoRoots = function(num) {\n var red = num === this.p \? this.red : BN.mont(num), tinv = new BN(2).toRed(red).redInvm(), ntinv = tinv.redNeg(), s = new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv), l1 = ntinv.redAdd(s).fromRed(), l2 = ntinv.redSub(s).fromRed();\n return [l1, l2];\n }, ShortCurve.prototype._getEndoBasis = function(lambda) {\n for (var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), u = lambda, v = this.n.clone(), x1 = new BN(1), y1 = new BN(0), x2 = new BN(0), y2 = new BN(1), a0, b0, a1, b1, a2, b2, prevR, i = 0, r, x;u.cmpn(0) !== 0; ) {\n var q = v.div(u);\n r = v.sub(q.mul(u)), x = x2.sub(q.mul(x1));\n var y = y2.sub(q.mul(y1));\n if (!a1 && r.cmp(aprxSqrt) < 0)\n a0 = prevR.neg(), b0 = x1, a1 = r.neg(), b1 = x;\n else if (a1 && ++i === 2)\n break;\n prevR = r, v = u, u = r, x2 = x1, x1 = x, y2 = y1, y1 = y;\n }\n a2 = r.neg(), b2 = x;\n var len1 = a1.sqr().add(b1.sqr()), len2 = a2.sqr().add(b2.sqr());\n return len2.cmp(len1) >= 0 && (a2 = a0, b2 = b0), a1.negative && (a1 = a1.neg(), b1 = b1.neg()), a2.negative && (a2 = a2.neg(), b2 = b2.neg()), [\n { a: a1, b: b1 },\n { a: a2, b: b2 }\n ];\n }, ShortCurve.prototype._endoSplit = function(k) {\n var basis = this.endo.basis, v1 = basis[0], v2 = basis[1], c1 = v2.b.mul(k).divRound(this.n), c2 = v1.b.neg().mul(k).divRound(this.n), p1 = c1.mul(v1.a), p2 = c2.mul(v2.a), q1 = c1.mul(v1.b), q2 = c2.mul(v2.b), k1 = k.sub(p1).sub(p2), k2 = q1.add(q2).neg();\n return { k1, k2 };\n }, ShortCurve.prototype.pointFromX = function(x, odd) {\n x = new BN(x, 16), x.red || (x = x.toRed(this.red));\n var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b), y = y2.redSqrt();\n if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)\n throw new Error(\"invalid point\");\n var isOdd = y.fromRed().isOdd();\n return (odd && !isOdd || !odd && isOdd) && (y = y.redNeg()), this.point(x, y);\n }, ShortCurve.prototype.validate = function(point) {\n if (point.inf)\n return !0;\n var { x, y } = point, ax = this.a.redMul(x), rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);\n return y.redSqr().redISub(rhs).cmpn(0) === 0;\n }, ShortCurve.prototype._endoWnafMulAdd = function(points, coeffs, jacobianResult) {\n for (var npoints = this._endoWnafT1, ncoeffs = this._endoWnafT2, i = 0;i < points.length; i++) {\n var split = this._endoSplit(coeffs[i]), p = points[i], beta = p._getBeta();\n split.k1.negative && (split.k1.ineg(), p = p.neg(!0)), split.k2.negative && (split.k2.ineg(), beta = beta.neg(!0)), npoints[i * 2] = p, npoints[i * 2 + 1] = beta, ncoeffs[i * 2] = split.k1, ncoeffs[i * 2 + 1] = split.k2;\n }\n for (var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult), j = 0;j < i * 2; j++)\n npoints[j] = null, ncoeffs[j] = null;\n return res;\n };\n function Point(curve, x, y, isRed) {\n Base.BasePoint.@call(this, curve, \"affine\"), x === null && y === null \? (this.x = null, this.y = null, this.inf = !0) : (this.x = new BN(x, 16), this.y = new BN(y, 16), isRed && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1);\n }\n inherits(Point, Base.BasePoint), ShortCurve.prototype.point = function(x, y, isRed) {\n return new Point(this, x, y, isRed);\n }, ShortCurve.prototype.pointFromJSON = function(obj, red) {\n return Point.fromJSON(this, obj, red);\n }, Point.prototype._getBeta = function() {\n if (this.curve.endo) {\n var pre = this.precomputed;\n if (pre && pre.beta)\n return pre.beta;\n var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y);\n if (pre) {\n var curve = this.curve, endoMul = function(p) {\n return curve.point(p.x.redMul(curve.endo.beta), p.y);\n };\n pre.beta = beta, beta.precomputed = {\n beta: null,\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: pre.naf.points.map(endoMul)\n },\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: pre.doubles.points.map(endoMul)\n }\n };\n }\n return beta;\n }\n }, Point.prototype.toJSON = function() {\n return this.precomputed \? [\n this.x,\n this.y,\n this.precomputed && {\n doubles: this.precomputed.doubles && {\n step: this.precomputed.doubles.step,\n points: this.precomputed.doubles.points.slice(1)\n },\n naf: this.precomputed.naf && {\n wnd: this.precomputed.naf.wnd,\n points: this.precomputed.naf.points.slice(1)\n }\n }\n ] : [this.x, this.y];\n }, Point.fromJSON = function(curve, obj, red) {\n typeof obj == \"string\" && (obj = JSON.parse(obj));\n var res = curve.point(obj[0], obj[1], red);\n if (!obj[2])\n return res;\n function obj2point(obj2) {\n return curve.point(obj2[0], obj2[1], red);\n }\n var pre = obj[2];\n return res.precomputed = {\n beta: null,\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: [res].concat(pre.doubles.points.map(obj2point))\n },\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: [res].concat(pre.naf.points.map(obj2point))\n }\n }, res;\n }, Point.prototype.inspect = function() {\n return this.isInfinity() \? \"\" : \"\";\n }, Point.prototype.isInfinity = function() {\n return this.inf;\n }, Point.prototype.add = function(p) {\n if (this.inf)\n return p;\n if (p.inf)\n return this;\n if (this.eq(p))\n return this.dbl();\n if (this.neg().eq(p))\n return this.curve.point(null, null);\n if (this.x.cmp(p.x) === 0)\n return this.curve.point(null, null);\n var c = this.y.redSub(p.y);\n c.cmpn(0) !== 0 && (c = c.redMul(this.x.redSub(p.x).redInvm()));\n var nx = c.redSqr().redISub(this.x).redISub(p.x), ny = c.redMul(this.x.redSub(nx)).redISub(this.y);\n return this.curve.point(nx, ny);\n }, Point.prototype.dbl = function() {\n if (this.inf)\n return this;\n var ys1 = this.y.redAdd(this.y);\n if (ys1.cmpn(0) === 0)\n return this.curve.point(null, null);\n var a = this.curve.a, x2 = this.x.redSqr(), dyinv = ys1.redInvm(), c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv), nx = c.redSqr().redISub(this.x.redAdd(this.x)), ny = c.redMul(this.x.redSub(nx)).redISub(this.y);\n return this.curve.point(nx, ny);\n }, Point.prototype.getX = function() {\n return this.x.fromRed();\n }, Point.prototype.getY = function() {\n return this.y.fromRed();\n }, Point.prototype.mul = function(k) {\n return k = new BN(k, 16), this.isInfinity() \? this : this._hasDoubles(k) \? this.curve._fixedNafMul(this, k) : this.curve.endo \? this.curve._endoWnafMulAdd([this], [k]) : this.curve._wnafMul(this, k);\n }, Point.prototype.mulAdd = function(k1, p2, k2) {\n var points = [this, p2], coeffs = [k1, k2];\n return this.curve.endo \? this.curve._endoWnafMulAdd(points, coeffs) : this.curve._wnafMulAdd(1, points, coeffs, 2);\n }, Point.prototype.jmulAdd = function(k1, p2, k2) {\n var points = [this, p2], coeffs = [k1, k2];\n return this.curve.endo \? this.curve._endoWnafMulAdd(points, coeffs, !0) : this.curve._wnafMulAdd(1, points, coeffs, 2, !0);\n }, Point.prototype.eq = function(p) {\n return this === p || this.inf === p.inf && (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0);\n }, Point.prototype.neg = function(_precompute) {\n if (this.inf)\n return this;\n var res = this.curve.point(this.x, this.y.redNeg());\n if (_precompute && this.precomputed) {\n var pre = this.precomputed, negate = function(p) {\n return p.neg();\n };\n res.precomputed = {\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: pre.naf.points.map(negate)\n },\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: pre.doubles.points.map(negate)\n }\n };\n }\n return res;\n }, Point.prototype.toJ = function() {\n if (this.inf)\n return this.curve.jpoint(null, null, null);\n var res = this.curve.jpoint(this.x, this.y, this.curve.one);\n return res;\n };\n function JPoint(curve, x, y, z) {\n Base.BasePoint.@call(this, curve, \"jacobian\"), x === null && y === null && z === null \? (this.x = this.curve.one, this.y = this.curve.one, this.z = new BN(0)) : (this.x = new BN(x, 16), this.y = new BN(y, 16), this.z = new BN(z, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one;\n }\n inherits(JPoint, Base.BasePoint), ShortCurve.prototype.jpoint = function(x, y, z) {\n return new JPoint(this, x, y, z);\n }, JPoint.prototype.toP = function() {\n if (this.isInfinity())\n return this.curve.point(null, null);\n var zinv = this.z.redInvm(), zinv2 = zinv.redSqr(), ax = this.x.redMul(zinv2), ay = this.y.redMul(zinv2).redMul(zinv);\n return this.curve.point(ax, ay);\n }, JPoint.prototype.neg = function() {\n return this.curve.jpoint(this.x, this.y.redNeg(), this.z);\n }, JPoint.prototype.add = function(p) {\n if (this.isInfinity())\n return p;\n if (p.isInfinity())\n return this;\n var pz2 = p.z.redSqr(), z2 = this.z.redSqr(), u1 = this.x.redMul(pz2), u2 = p.x.redMul(z2), s1 = this.y.redMul(pz2.redMul(p.z)), s2 = p.y.redMul(z2.redMul(this.z)), h = u1.redSub(u2), r = s1.redSub(s2);\n if (h.cmpn(0) === 0)\n return r.cmpn(0) !== 0 \? this.curve.jpoint(null, null, null) : this.dbl();\n var h2 = h.redSqr(), h3 = h2.redMul(h), v = u1.redMul(h2), nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v), ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)), nz = this.z.redMul(p.z).redMul(h);\n return this.curve.jpoint(nx, ny, nz);\n }, JPoint.prototype.mixedAdd = function(p) {\n if (this.isInfinity())\n return p.toJ();\n if (p.isInfinity())\n return this;\n var z2 = this.z.redSqr(), u1 = this.x, u2 = p.x.redMul(z2), s1 = this.y, s2 = p.y.redMul(z2).redMul(this.z), h = u1.redSub(u2), r = s1.redSub(s2);\n if (h.cmpn(0) === 0)\n return r.cmpn(0) !== 0 \? this.curve.jpoint(null, null, null) : this.dbl();\n var h2 = h.redSqr(), h3 = h2.redMul(h), v = u1.redMul(h2), nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v), ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)), nz = this.z.redMul(h);\n return this.curve.jpoint(nx, ny, nz);\n }, JPoint.prototype.dblp = function(pow) {\n if (pow === 0)\n return this;\n if (this.isInfinity())\n return this;\n if (!pow)\n return this.dbl();\n var i;\n if (this.curve.zeroA || this.curve.threeA) {\n var r = this;\n for (i = 0;i < pow; i++)\n r = r.dbl();\n return r;\n }\n var a = this.curve.a, tinv = this.curve.tinv, jx = this.x, jy = this.y, jz = this.z, jz4 = jz.redSqr().redSqr(), jyd = jy.redAdd(jy);\n for (i = 0;i < pow; i++) {\n var jx2 = jx.redSqr(), jyd2 = jyd.redSqr(), jyd4 = jyd2.redSqr(), c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)), t1 = jx.redMul(jyd2), nx = c.redSqr().redISub(t1.redAdd(t1)), t2 = t1.redISub(nx), dny = c.redMul(t2);\n dny = dny.redIAdd(dny).redISub(jyd4);\n var nz = jyd.redMul(jz);\n i + 1 < pow && (jz4 = jz4.redMul(jyd4)), jx = nx, jz = nz, jyd = dny;\n }\n return this.curve.jpoint(jx, jyd.redMul(tinv), jz);\n }, JPoint.prototype.dbl = function() {\n return this.isInfinity() \? this : this.curve.zeroA \? this._zeroDbl() : this.curve.threeA \? this._threeDbl() : this._dbl();\n }, JPoint.prototype._zeroDbl = function() {\n var nx, ny, nz;\n if (this.zOne) {\n var xx = this.x.redSqr(), yy = this.y.redSqr(), yyyy = yy.redSqr(), s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n s = s.redIAdd(s);\n var m = xx.redAdd(xx).redIAdd(xx), t = m.redSqr().redISub(s).redISub(s), yyyy8 = yyyy.redIAdd(yyyy);\n yyyy8 = yyyy8.redIAdd(yyyy8), yyyy8 = yyyy8.redIAdd(yyyy8), nx = t, ny = m.redMul(s.redISub(t)).redISub(yyyy8), nz = this.y.redAdd(this.y);\n } else {\n var a = this.x.redSqr(), b = this.y.redSqr(), c = b.redSqr(), d = this.x.redAdd(b).redSqr().redISub(a).redISub(c);\n d = d.redIAdd(d);\n var e = a.redAdd(a).redIAdd(a), f = e.redSqr(), c8 = c.redIAdd(c);\n c8 = c8.redIAdd(c8), c8 = c8.redIAdd(c8), nx = f.redISub(d).redISub(d), ny = e.redMul(d.redISub(nx)).redISub(c8), nz = this.y.redMul(this.z), nz = nz.redIAdd(nz);\n }\n return this.curve.jpoint(nx, ny, nz);\n }, JPoint.prototype._threeDbl = function() {\n var nx, ny, nz;\n if (this.zOne) {\n var xx = this.x.redSqr(), yy = this.y.redSqr(), yyyy = yy.redSqr(), s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n s = s.redIAdd(s);\n var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a), t = m.redSqr().redISub(s).redISub(s);\n nx = t;\n var yyyy8 = yyyy.redIAdd(yyyy);\n yyyy8 = yyyy8.redIAdd(yyyy8), yyyy8 = yyyy8.redIAdd(yyyy8), ny = m.redMul(s.redISub(t)).redISub(yyyy8), nz = this.y.redAdd(this.y);\n } else {\n var delta = this.z.redSqr(), gamma = this.y.redSqr(), beta = this.x.redMul(gamma), alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta));\n alpha = alpha.redAdd(alpha).redIAdd(alpha);\n var beta4 = beta.redIAdd(beta);\n beta4 = beta4.redIAdd(beta4);\n var beta8 = beta4.redAdd(beta4);\n nx = alpha.redSqr().redISub(beta8), nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta);\n var ggamma8 = gamma.redSqr();\n ggamma8 = ggamma8.redIAdd(ggamma8), ggamma8 = ggamma8.redIAdd(ggamma8), ggamma8 = ggamma8.redIAdd(ggamma8), ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8);\n }\n return this.curve.jpoint(nx, ny, nz);\n }, JPoint.prototype._dbl = function() {\n var a = this.curve.a, jx = this.x, jy = this.y, jz = this.z, jz4 = jz.redSqr().redSqr(), jx2 = jx.redSqr(), jy2 = jy.redSqr(), c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)), jxd4 = jx.redAdd(jx);\n jxd4 = jxd4.redIAdd(jxd4);\n var t1 = jxd4.redMul(jy2), nx = c.redSqr().redISub(t1.redAdd(t1)), t2 = t1.redISub(nx), jyd8 = jy2.redSqr();\n jyd8 = jyd8.redIAdd(jyd8), jyd8 = jyd8.redIAdd(jyd8), jyd8 = jyd8.redIAdd(jyd8);\n var ny = c.redMul(t2).redISub(jyd8), nz = jy.redAdd(jy).redMul(jz);\n return this.curve.jpoint(nx, ny, nz);\n }, JPoint.prototype.trpl = function() {\n if (!this.curve.zeroA)\n return this.dbl().add(this);\n var xx = this.x.redSqr(), yy = this.y.redSqr(), zz = this.z.redSqr(), yyyy = yy.redSqr(), m = xx.redAdd(xx).redIAdd(xx), mm = m.redSqr(), e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n e = e.redIAdd(e), e = e.redAdd(e).redIAdd(e), e = e.redISub(mm);\n var ee = e.redSqr(), t = yyyy.redIAdd(yyyy);\n t = t.redIAdd(t), t = t.redIAdd(t), t = t.redIAdd(t);\n var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t), yyu4 = yy.redMul(u);\n yyu4 = yyu4.redIAdd(yyu4), yyu4 = yyu4.redIAdd(yyu4);\n var nx = this.x.redMul(ee).redISub(yyu4);\n nx = nx.redIAdd(nx), nx = nx.redIAdd(nx);\n var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee)));\n ny = ny.redIAdd(ny), ny = ny.redIAdd(ny), ny = ny.redIAdd(ny);\n var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee);\n return this.curve.jpoint(nx, ny, nz);\n }, JPoint.prototype.mul = function(k, kbase) {\n return k = new BN(k, kbase), this.curve._wnafMul(this, k);\n }, JPoint.prototype.eq = function(p) {\n if (p.type === \"affine\")\n return this.eq(p.toJ());\n if (this === p)\n return !0;\n var z2 = this.z.redSqr(), pz2 = p.z.redSqr();\n if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0)\n return !1;\n var z3 = z2.redMul(this.z), pz3 = pz2.redMul(p.z);\n return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0;\n }, JPoint.prototype.eqXToP = function(x) {\n var zs = this.z.redSqr(), rx = x.toRed(this.curve.red).redMul(zs);\n if (this.x.cmp(rx) === 0)\n return !0;\n for (var xc = x.clone(), t = this.curve.redN.redMul(zs);; ) {\n if (xc.iadd(this.curve.n), xc.cmp(this.curve.p) >= 0)\n return !1;\n if (rx.redIAdd(t), this.x.cmp(rx) === 0)\n return !0;\n }\n }, JPoint.prototype.inspect = function() {\n return this.isInfinity() \? \"\" : \"\";\n }, JPoint.prototype.isInfinity = function() {\n return this.z.cmpn(0) === 0;\n };\n }\n}), require_mont = __commonJS({\n \"node_modules/elliptic/lib/elliptic/curve/mont.js\"(exports, module) {\n var BN = require_bn4(), inherits = require_inherits_browser(), Base = require_base(), utils = require_utils3();\n function MontCurve(conf) {\n Base.@call(this, \"mont\", conf), this.a = new BN(conf.a, 16).toRed(this.red), this.b = new BN(conf.b, 16).toRed(this.red), this.i4 = new BN(4).toRed(this.red).redInvm(), this.two = new BN(2).toRed(this.red), this.a24 = this.i4.redMul(this.a.redAdd(this.two));\n }\n inherits(MontCurve, Base), module.exports = MontCurve, MontCurve.prototype.validate = function(point) {\n var x = point.normalize().x, x2 = x.redSqr(), rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x), y = rhs.redSqrt();\n return y.redSqr().cmp(rhs) === 0;\n };\n function Point(curve, x, z) {\n Base.BasePoint.@call(this, curve, \"projective\"), x === null && z === null \? (this.x = this.curve.one, this.z = this.curve.zero) : (this.x = new BN(x, 16), this.z = new BN(z, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)));\n }\n inherits(Point, Base.BasePoint), MontCurve.prototype.decodePoint = function(bytes, enc) {\n return this.point(utils.toArray(bytes, enc), 1);\n }, MontCurve.prototype.point = function(x, z) {\n return new Point(this, x, z);\n }, MontCurve.prototype.pointFromJSON = function(obj) {\n return Point.fromJSON(this, obj);\n }, Point.prototype.precompute = function() {\n }, Point.prototype._encode = function() {\n return this.getX().toArray(\"be\", this.curve.p.byteLength());\n }, Point.fromJSON = function(curve, obj) {\n return new Point(curve, obj[0], obj[1] || curve.one);\n }, Point.prototype.inspect = function() {\n return this.isInfinity() \? \"\" : \"\";\n }, Point.prototype.isInfinity = function() {\n return this.z.cmpn(0) === 0;\n }, Point.prototype.dbl = function() {\n var a = this.x.redAdd(this.z), aa = a.redSqr(), b = this.x.redSub(this.z), bb = b.redSqr(), c = aa.redSub(bb), nx = aa.redMul(bb), nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c)));\n return this.curve.point(nx, nz);\n }, Point.prototype.add = function() {\n throw new Error(\"Not supported on Montgomery curve\");\n }, Point.prototype.diffAdd = function(p, diff) {\n var a = this.x.redAdd(this.z), b = this.x.redSub(this.z), c = p.x.redAdd(p.z), d = p.x.redSub(p.z), da = d.redMul(a), cb = c.redMul(b), nx = diff.z.redMul(da.redAdd(cb).redSqr()), nz = diff.x.redMul(da.redISub(cb).redSqr());\n return this.curve.point(nx, nz);\n }, Point.prototype.mul = function(k) {\n for (var t = k.clone(), a = this, b = this.curve.point(null, null), c = this, bits = [];t.cmpn(0) !== 0; t.iushrn(1))\n bits.push(t.andln(1));\n for (var i = bits.length - 1;i >= 0; i--)\n bits[i] === 0 \? (a = a.diffAdd(b, c), b = b.dbl()) : (b = a.diffAdd(b, c), a = a.dbl());\n return b;\n }, Point.prototype.mulAdd = function() {\n throw new Error(\"Not supported on Montgomery curve\");\n }, Point.prototype.jumlAdd = function() {\n throw new Error(\"Not supported on Montgomery curve\");\n }, Point.prototype.eq = function(other) {\n return this.getX().cmp(other.getX()) === 0;\n }, Point.prototype.normalize = function() {\n return this.x = this.x.redMul(this.z.redInvm()), this.z = this.curve.one, this;\n }, Point.prototype.getX = function() {\n return this.normalize(), this.x.fromRed();\n };\n }\n}), require_edwards = __commonJS({\n \"node_modules/elliptic/lib/elliptic/curve/edwards.js\"(exports, module) {\n var utils = require_utils3(), BN = require_bn4(), inherits = require_inherits_browser(), Base = require_base(), assert = utils.assert;\n function EdwardsCurve(conf) {\n this.twisted = (conf.a | 0) !== 1, this.mOneA = this.twisted && (conf.a | 0) === -1, this.extended = this.mOneA, Base.@call(this, \"edwards\", conf), this.a = new BN(conf.a, 16).umod(this.red.m), this.a = this.a.toRed(this.red), this.c = new BN(conf.c, 16).toRed(this.red), this.c2 = this.c.redSqr(), this.d = new BN(conf.d, 16).toRed(this.red), this.dd = this.d.redAdd(this.d), assert(!this.twisted || this.c.fromRed().cmpn(1) === 0), this.oneC = (conf.c | 0) === 1;\n }\n inherits(EdwardsCurve, Base), module.exports = EdwardsCurve, EdwardsCurve.prototype._mulA = function(num) {\n return this.mOneA \? num.redNeg() : this.a.redMul(num);\n }, EdwardsCurve.prototype._mulC = function(num) {\n return this.oneC \? num : this.c.redMul(num);\n }, EdwardsCurve.prototype.jpoint = function(x, y, z, t) {\n return this.point(x, y, z, t);\n }, EdwardsCurve.prototype.pointFromX = function(x, odd) {\n x = new BN(x, 16), x.red || (x = x.toRed(this.red));\n var x2 = x.redSqr(), rhs = this.c2.redSub(this.a.redMul(x2)), lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2)), y2 = rhs.redMul(lhs.redInvm()), y = y2.redSqrt();\n if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)\n throw new Error(\"invalid point\");\n var isOdd = y.fromRed().isOdd();\n return (odd && !isOdd || !odd && isOdd) && (y = y.redNeg()), this.point(x, y);\n }, EdwardsCurve.prototype.pointFromY = function(y, odd) {\n y = new BN(y, 16), y.red || (y = y.toRed(this.red));\n var y2 = y.redSqr(), lhs = y2.redSub(this.c2), rhs = y2.redMul(this.d).redMul(this.c2).redSub(this.a), x2 = lhs.redMul(rhs.redInvm());\n if (x2.cmp(this.zero) === 0) {\n if (odd)\n throw new Error(\"invalid point\");\n return this.point(this.zero, y);\n }\n var x = x2.redSqrt();\n if (x.redSqr().redSub(x2).cmp(this.zero) !== 0)\n throw new Error(\"invalid point\");\n return x.fromRed().isOdd() !== odd && (x = x.redNeg()), this.point(x, y);\n }, EdwardsCurve.prototype.validate = function(point) {\n if (point.isInfinity())\n return !0;\n point.normalize();\n var x2 = point.x.redSqr(), y2 = point.y.redSqr(), lhs = x2.redMul(this.a).redAdd(y2), rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2)));\n return lhs.cmp(rhs) === 0;\n };\n function Point(curve, x, y, z, t) {\n Base.BasePoint.@call(this, curve, \"projective\"), x === null && y === null && z === null \? (this.x = this.curve.zero, this.y = this.curve.one, this.z = this.curve.one, this.t = this.curve.zero, this.zOne = !0) : (this.x = new BN(x, 16), this.y = new BN(y, 16), this.z = z \? new BN(z, 16) : this.curve.one, this.t = t && new BN(t, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.t && !this.t.red && (this.t = this.t.toRed(this.curve.red)), this.zOne = this.z === this.curve.one, this.curve.extended && !this.t && (this.t = this.x.redMul(this.y), this.zOne || (this.t = this.t.redMul(this.z.redInvm()))));\n }\n inherits(Point, Base.BasePoint), EdwardsCurve.prototype.pointFromJSON = function(obj) {\n return Point.fromJSON(this, obj);\n }, EdwardsCurve.prototype.point = function(x, y, z, t) {\n return new Point(this, x, y, z, t);\n }, Point.fromJSON = function(curve, obj) {\n return new Point(curve, obj[0], obj[1], obj[2]);\n }, Point.prototype.inspect = function() {\n return this.isInfinity() \? \"\" : \"\";\n }, Point.prototype.isInfinity = function() {\n return this.x.cmpn(0) === 0 && (this.y.cmp(this.z) === 0 || this.zOne && this.y.cmp(this.curve.c) === 0);\n }, Point.prototype._extDbl = function() {\n var a = this.x.redSqr(), b = this.y.redSqr(), c = this.z.redSqr();\n c = c.redIAdd(c);\n var d = this.curve._mulA(a), e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b), g = d.redAdd(b), f = g.redSub(c), h = d.redSub(b), nx = e.redMul(f), ny = g.redMul(h), nt = e.redMul(h), nz = f.redMul(g);\n return this.curve.point(nx, ny, nz, nt);\n }, Point.prototype._projDbl = function() {\n var b = this.x.redAdd(this.y).redSqr(), c = this.x.redSqr(), d = this.y.redSqr(), nx, ny, nz, e, h, j;\n if (this.curve.twisted) {\n e = this.curve._mulA(c);\n var f = e.redAdd(d);\n this.zOne \? (nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two)), ny = f.redMul(e.redSub(d)), nz = f.redSqr().redSub(f).redSub(f)) : (h = this.z.redSqr(), j = f.redSub(h).redISub(h), nx = b.redSub(c).redISub(d).redMul(j), ny = f.redMul(e.redSub(d)), nz = f.redMul(j));\n } else\n e = c.redAdd(d), h = this.curve._mulC(this.z).redSqr(), j = e.redSub(h).redSub(h), nx = this.curve._mulC(b.redISub(e)).redMul(j), ny = this.curve._mulC(e).redMul(c.redISub(d)), nz = e.redMul(j);\n return this.curve.point(nx, ny, nz);\n }, Point.prototype.dbl = function() {\n return this.isInfinity() \? this : this.curve.extended \? this._extDbl() : this._projDbl();\n }, Point.prototype._extAdd = function(p) {\n var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x)), b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x)), c = this.t.redMul(this.curve.dd).redMul(p.t), d = this.z.redMul(p.z.redAdd(p.z)), e = b.redSub(a), f = d.redSub(c), g = d.redAdd(c), h = b.redAdd(a), nx = e.redMul(f), ny = g.redMul(h), nt = e.redMul(h), nz = f.redMul(g);\n return this.curve.point(nx, ny, nz, nt);\n }, Point.prototype._projAdd = function(p) {\n var a = this.z.redMul(p.z), b = a.redSqr(), c = this.x.redMul(p.x), d = this.y.redMul(p.y), e = this.curve.d.redMul(c).redMul(d), f = b.redSub(e), g = b.redAdd(e), tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d), nx = a.redMul(f).redMul(tmp), ny, nz;\n return this.curve.twisted \? (ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c))), nz = f.redMul(g)) : (ny = a.redMul(g).redMul(d.redSub(c)), nz = this.curve._mulC(f).redMul(g)), this.curve.point(nx, ny, nz);\n }, Point.prototype.add = function(p) {\n return this.isInfinity() \? p : p.isInfinity() \? this : this.curve.extended \? this._extAdd(p) : this._projAdd(p);\n }, Point.prototype.mul = function(k) {\n return this._hasDoubles(k) \? this.curve._fixedNafMul(this, k) : this.curve._wnafMul(this, k);\n }, Point.prototype.mulAdd = function(k1, p, k2) {\n return this.curve._wnafMulAdd(1, [this, p], [k1, k2], 2, !1);\n }, Point.prototype.jmulAdd = function(k1, p, k2) {\n return this.curve._wnafMulAdd(1, [this, p], [k1, k2], 2, !0);\n }, Point.prototype.normalize = function() {\n if (this.zOne)\n return this;\n var zi = this.z.redInvm();\n return this.x = this.x.redMul(zi), this.y = this.y.redMul(zi), this.t && (this.t = this.t.redMul(zi)), this.z = this.curve.one, this.zOne = !0, this;\n }, Point.prototype.neg = function() {\n return this.curve.point(this.x.redNeg(), this.y, this.z, this.t && this.t.redNeg());\n }, Point.prototype.getX = function() {\n return this.normalize(), this.x.fromRed();\n }, Point.prototype.getY = function() {\n return this.normalize(), this.y.fromRed();\n }, Point.prototype.eq = function(other) {\n return this === other || this.getX().cmp(other.getX()) === 0 && this.getY().cmp(other.getY()) === 0;\n }, Point.prototype.eqXToP = function(x) {\n var rx = x.toRed(this.curve.red).redMul(this.z);\n if (this.x.cmp(rx) === 0)\n return !0;\n for (var xc = x.clone(), t = this.curve.redN.redMul(this.z);; ) {\n if (xc.iadd(this.curve.n), xc.cmp(this.curve.p) >= 0)\n return !1;\n if (rx.redIAdd(t), this.x.cmp(rx) === 0)\n return !0;\n }\n }, Point.prototype.toP = Point.prototype.normalize, Point.prototype.mixedAdd = Point.prototype.add;\n }\n}), require_curve = __commonJS({\n \"node_modules/elliptic/lib/elliptic/curve/index.js\"(exports) {\n var curve = exports;\n curve.base = require_base(), curve.short = require_short(), curve.mont = require_mont(), curve.edwards = require_edwards();\n }\n}), require_utils4 = __commonJS({\n \"node_modules/hash.js/lib/hash/utils.js\"(exports) {\n var assert = require_minimalistic_assert(), inherits = require_inherits_browser();\n exports.inherits = inherits;\n function isSurrogatePair(msg, i) {\n return (msg.charCodeAt(i) & 64512) !== 55296 || i < 0 || i + 1 >= msg.length \? !1 : (msg.charCodeAt(i + 1) & 64512) === 56320;\n }\n function toArray(msg, enc) {\n if (@Array.isArray(msg))\n return msg.slice();\n if (!msg)\n return [];\n var res = [];\n if (typeof msg == \"string\")\n if (enc) {\n if (enc === \"hex\")\n for (msg = msg.replace(/[^a-z0-9]+/gi, \"\"), msg.length % 2 !== 0 && (msg = \"0\" + msg), i = 0;i < msg.length; i += 2)\n res.push(parseInt(msg[i] + msg[i + 1], 16));\n } else\n for (var p = 0, i = 0;i < msg.length; i++) {\n var c = msg.charCodeAt(i);\n c < 128 \? res[p++] = c : c < 2048 \? (res[p++] = c >> 6 | 192, res[p++] = c & 63 | 128) : isSurrogatePair(msg, i) \? (c = 65536 + ((c & 1023) << 10) + (msg.charCodeAt(++i) & 1023), res[p++] = c >> 18 | 240, res[p++] = c >> 12 & 63 | 128, res[p++] = c >> 6 & 63 | 128, res[p++] = c & 63 | 128) : (res[p++] = c >> 12 | 224, res[p++] = c >> 6 & 63 | 128, res[p++] = c & 63 | 128);\n }\n else\n for (i = 0;i < msg.length; i++)\n res[i] = msg[i] | 0;\n return res;\n }\n exports.toArray = toArray;\n function toHex(msg) {\n for (var res = \"\", i = 0;i < msg.length; i++)\n res += zero2(msg[i].toString(16));\n return res;\n }\n exports.toHex = toHex;\n function htonl(w) {\n var res = w >>> 24 | w >>> 8 & 65280 | w << 8 & 16711680 | (w & 255) << 24;\n return res >>> 0;\n }\n exports.htonl = htonl;\n function toHex32(msg, endian) {\n for (var res = \"\", i = 0;i < msg.length; i++) {\n var w = msg[i];\n endian === \"little\" && (w = htonl(w)), res += zero8(w.toString(16));\n }\n return res;\n }\n exports.toHex32 = toHex32;\n function zero2(word) {\n return word.length === 1 \? \"0\" + word : word;\n }\n exports.zero2 = zero2;\n function zero8(word) {\n return word.length === 7 \? \"0\" + word : word.length === 6 \? \"00\" + word : word.length === 5 \? \"000\" + word : word.length === 4 \? \"0000\" + word : word.length === 3 \? \"00000\" + word : word.length === 2 \? \"000000\" + word : word.length === 1 \? \"0000000\" + word : word;\n }\n exports.zero8 = zero8;\n function join32(msg, start, end, endian) {\n var len = end - start;\n assert(len % 4 === 0);\n for (var res = new @Array(len / 4), i = 0, k = start;i < res.length; i++, k += 4) {\n var w;\n endian === \"big\" \? w = msg[k] << 24 | msg[k + 1] << 16 | msg[k + 2] << 8 | msg[k + 3] : w = msg[k + 3] << 24 | msg[k + 2] << 16 | msg[k + 1] << 8 | msg[k], res[i] = w >>> 0;\n }\n return res;\n }\n exports.join32 = join32;\n function split32(msg, endian) {\n for (var res = new @Array(msg.length * 4), i = 0, k = 0;i < msg.length; i++, k += 4) {\n var m = msg[i];\n endian === \"big\" \? (res[k] = m >>> 24, res[k + 1] = m >>> 16 & 255, res[k + 2] = m >>> 8 & 255, res[k + 3] = m & 255) : (res[k + 3] = m >>> 24, res[k + 2] = m >>> 16 & 255, res[k + 1] = m >>> 8 & 255, res[k] = m & 255);\n }\n return res;\n }\n exports.split32 = split32;\n function rotr32(w, b) {\n return w >>> b | w << 32 - b;\n }\n exports.rotr32 = rotr32;\n function rotl32(w, b) {\n return w << b | w >>> 32 - b;\n }\n exports.rotl32 = rotl32;\n function sum32(a, b) {\n return a + b >>> 0;\n }\n exports.sum32 = sum32;\n function sum32_3(a, b, c) {\n return a + b + c >>> 0;\n }\n exports.sum32_3 = sum32_3;\n function sum32_4(a, b, c, d) {\n return a + b + c + d >>> 0;\n }\n exports.sum32_4 = sum32_4;\n function sum32_5(a, b, c, d, e) {\n return a + b + c + d + e >>> 0;\n }\n exports.sum32_5 = sum32_5;\n function sum64(buf, pos, ah, al) {\n var bh = buf[pos], bl = buf[pos + 1], lo = al + bl >>> 0, hi = (lo < al \? 1 : 0) + ah + bh;\n buf[pos] = hi >>> 0, buf[pos + 1] = lo;\n }\n exports.sum64 = sum64;\n function sum64_hi(ah, al, bh, bl) {\n var lo = al + bl >>> 0, hi = (lo < al \? 1 : 0) + ah + bh;\n return hi >>> 0;\n }\n exports.sum64_hi = sum64_hi;\n function sum64_lo(ah, al, bh, bl) {\n var lo = al + bl;\n return lo >>> 0;\n }\n exports.sum64_lo = sum64_lo;\n function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) {\n var carry = 0, lo = al;\n lo = lo + bl >>> 0, carry += lo < al \? 1 : 0, lo = lo + cl >>> 0, carry += lo < cl \? 1 : 0, lo = lo + dl >>> 0, carry += lo < dl \? 1 : 0;\n var hi = ah + bh + ch + dh + carry;\n return hi >>> 0;\n }\n exports.sum64_4_hi = sum64_4_hi;\n function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) {\n var lo = al + bl + cl + dl;\n return lo >>> 0;\n }\n exports.sum64_4_lo = sum64_4_lo;\n function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {\n var carry = 0, lo = al;\n lo = lo + bl >>> 0, carry += lo < al \? 1 : 0, lo = lo + cl >>> 0, carry += lo < cl \? 1 : 0, lo = lo + dl >>> 0, carry += lo < dl \? 1 : 0, lo = lo + el >>> 0, carry += lo < el \? 1 : 0;\n var hi = ah + bh + ch + dh + eh + carry;\n return hi >>> 0;\n }\n exports.sum64_5_hi = sum64_5_hi;\n function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {\n var lo = al + bl + cl + dl + el;\n return lo >>> 0;\n }\n exports.sum64_5_lo = sum64_5_lo;\n function rotr64_hi(ah, al, num) {\n var r = al << 32 - num | ah >>> num;\n return r >>> 0;\n }\n exports.rotr64_hi = rotr64_hi;\n function rotr64_lo(ah, al, num) {\n var r = ah << 32 - num | al >>> num;\n return r >>> 0;\n }\n exports.rotr64_lo = rotr64_lo;\n function shr64_hi(ah, al, num) {\n return ah >>> num;\n }\n exports.shr64_hi = shr64_hi;\n function shr64_lo(ah, al, num) {\n var r = ah << 32 - num | al >>> num;\n return r >>> 0;\n }\n exports.shr64_lo = shr64_lo;\n }\n}), require_common = __commonJS({\n \"node_modules/hash.js/lib/hash/common.js\"(exports) {\n var utils = require_utils4(), assert = require_minimalistic_assert();\n function BlockHash() {\n this.pending = null, this.pendingTotal = 0, this.blockSize = this.constructor.blockSize, this.outSize = this.constructor.outSize, this.hmacStrength = this.constructor.hmacStrength, this.padLength = this.constructor.padLength / 8, this.endian = \"big\", this._delta8 = this.blockSize / 8, this._delta32 = this.blockSize / 32;\n }\n BlockHash.prototype = {}, exports.BlockHash = BlockHash, BlockHash.prototype.update = function(msg, enc) {\n if (msg = utils.toArray(msg, enc), this.pending \? this.pending = this.pending.concat(msg) : this.pending = msg, this.pendingTotal += msg.length, this.pending.length >= this._delta8) {\n msg = this.pending;\n var r = msg.length % this._delta8;\n this.pending = msg.slice(msg.length - r, msg.length), this.pending.length === 0 && (this.pending = null), msg = utils.join32(msg, 0, msg.length - r, this.endian);\n for (var i = 0;i < msg.length; i += this._delta32)\n this._update(msg, i, i + this._delta32);\n }\n return this;\n }, BlockHash.prototype.digest = function(enc) {\n return this.update(this._pad()), assert(this.pending === null), this._digest(enc);\n }, BlockHash.prototype._pad = function() {\n var len = this.pendingTotal, bytes = this._delta8, k = bytes - (len + this.padLength) % bytes, res = new @Array(k + this.padLength);\n res[0] = 128;\n for (var i = 1;i < k; i++)\n res[i] = 0;\n if (len <<= 3, this.endian === \"big\") {\n for (var t = 8;t < this.padLength; t++)\n res[i++] = 0;\n res[i++] = 0, res[i++] = 0, res[i++] = 0, res[i++] = 0, res[i++] = len >>> 24 & 255, res[i++] = len >>> 16 & 255, res[i++] = len >>> 8 & 255, res[i++] = len & 255;\n } else\n for (res[i++] = len & 255, res[i++] = len >>> 8 & 255, res[i++] = len >>> 16 & 255, res[i++] = len >>> 24 & 255, res[i++] = 0, res[i++] = 0, res[i++] = 0, res[i++] = 0, t = 8;t < this.padLength; t++)\n res[i++] = 0;\n return res;\n };\n }\n}), require_common2 = __commonJS({\n \"node_modules/hash.js/lib/hash/sha/common.js\"(exports) {\n var utils = require_utils4(), rotr32 = utils.rotr32;\n function ft_1(s, x, y, z) {\n if (s === 0)\n return ch32(x, y, z);\n if (s === 1 || s === 3)\n return p32(x, y, z);\n if (s === 2)\n return maj32(x, y, z);\n }\n exports.ft_1 = ft_1;\n function ch32(x, y, z) {\n return x & y ^ ~x & z;\n }\n exports.ch32 = ch32;\n function maj32(x, y, z) {\n return x & y ^ x & z ^ y & z;\n }\n exports.maj32 = maj32;\n function p32(x, y, z) {\n return x ^ y ^ z;\n }\n exports.p32 = p32;\n function s0_256(x) {\n return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);\n }\n exports.s0_256 = s0_256;\n function s1_256(x) {\n return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);\n }\n exports.s1_256 = s1_256;\n function g0_256(x) {\n return rotr32(x, 7) ^ rotr32(x, 18) ^ x >>> 3;\n }\n exports.g0_256 = g0_256;\n function g1_256(x) {\n return rotr32(x, 17) ^ rotr32(x, 19) ^ x >>> 10;\n }\n exports.g1_256 = g1_256;\n }\n}), require__ = __commonJS({\n \"node_modules/hash.js/lib/hash/sha/1.js\"(exports, module) {\n var utils = require_utils4(), common = require_common(), shaCommon = require_common2(), rotl32 = utils.rotl32, sum32 = utils.sum32, sum32_5 = utils.sum32_5, ft_1 = shaCommon.ft_1, BlockHash = common.BlockHash, sha1_K = [1518500249, 1859775393, 2400959708, 3395469782];\n function SHA1() {\n if (!(this instanceof SHA1))\n return new SHA1;\n BlockHash.@call(this), this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.W = new @Array(80);\n }\n utils.inherits(SHA1, BlockHash), module.exports = SHA1, SHA1.blockSize = 512, SHA1.outSize = 160, SHA1.hmacStrength = 80, SHA1.padLength = 64, SHA1.prototype._update = function(msg, start) {\n for (var W = this.W, i = 0;i < 16; i++)\n W[i] = msg[start + i];\n for (;i < W.length; i++)\n W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);\n var a = this.h[0], b = this.h[1], c = this.h[2], d = this.h[3], e = this.h[4];\n for (i = 0;i < W.length; i++) {\n var s = ~~(i / 20), t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]);\n e = d, d = c, c = rotl32(b, 30), b = a, a = t;\n }\n this.h[0] = sum32(this.h[0], a), this.h[1] = sum32(this.h[1], b), this.h[2] = sum32(this.h[2], c), this.h[3] = sum32(this.h[3], d), this.h[4] = sum32(this.h[4], e);\n }, SHA1.prototype._digest = function(enc) {\n return enc === \"hex\" \? utils.toHex32(this.h, \"big\") : utils.split32(this.h, \"big\");\n };\n }\n}), require__2 = __commonJS({\n \"node_modules/hash.js/lib/hash/sha/256.js\"(exports, module) {\n var utils = require_utils4(), common = require_common(), shaCommon = require_common2(), assert = require_minimalistic_assert(), sum32 = utils.sum32, sum32_4 = utils.sum32_4, sum32_5 = utils.sum32_5, ch32 = shaCommon.ch32, maj32 = shaCommon.maj32, s0_256 = shaCommon.s0_256, s1_256 = shaCommon.s1_256, g0_256 = shaCommon.g0_256, g1_256 = shaCommon.g1_256, BlockHash = common.BlockHash, sha256_K = [\n 1116352408,\n 1899447441,\n 3049323471,\n 3921009573,\n 961987163,\n 1508970993,\n 2453635748,\n 2870763221,\n 3624381080,\n 310598401,\n 607225278,\n 1426881987,\n 1925078388,\n 2162078206,\n 2614888103,\n 3248222580,\n 3835390401,\n 4022224774,\n 264347078,\n 604807628,\n 770255983,\n 1249150122,\n 1555081692,\n 1996064986,\n 2554220882,\n 2821834349,\n 2952996808,\n 3210313671,\n 3336571891,\n 3584528711,\n 113926993,\n 338241895,\n 666307205,\n 773529912,\n 1294757372,\n 1396182291,\n 1695183700,\n 1986661051,\n 2177026350,\n 2456956037,\n 2730485921,\n 2820302411,\n 3259730800,\n 3345764771,\n 3516065817,\n 3600352804,\n 4094571909,\n 275423344,\n 430227734,\n 506948616,\n 659060556,\n 883997877,\n 958139571,\n 1322822218,\n 1537002063,\n 1747873779,\n 1955562222,\n 2024104815,\n 2227730452,\n 2361852424,\n 2428436474,\n 2756734187,\n 3204031479,\n 3329325298\n ];\n function SHA256() {\n if (!(this instanceof SHA256))\n return new SHA256;\n BlockHash.@call(this), this.h = [1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225], this.k = sha256_K, this.W = new @Array(64);\n }\n utils.inherits(SHA256, BlockHash), module.exports = SHA256, SHA256.blockSize = 512, SHA256.outSize = 256, SHA256.hmacStrength = 192, SHA256.padLength = 64, SHA256.prototype._update = function(msg, start) {\n for (var W = this.W, i = 0;i < 16; i++)\n W[i] = msg[start + i];\n for (;i < W.length; i++)\n W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]);\n var a = this.h[0], b = this.h[1], c = this.h[2], d = this.h[3], e = this.h[4], f = this.h[5], g = this.h[6], h = this.h[7];\n for (assert(this.k.length === W.length), i = 0;i < W.length; i++) {\n var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]), T2 = sum32(s0_256(a), maj32(a, b, c));\n h = g, g = f, f = e, e = sum32(d, T1), d = c, c = b, b = a, a = sum32(T1, T2);\n }\n this.h[0] = sum32(this.h[0], a), this.h[1] = sum32(this.h[1], b), this.h[2] = sum32(this.h[2], c), this.h[3] = sum32(this.h[3], d), this.h[4] = sum32(this.h[4], e), this.h[5] = sum32(this.h[5], f), this.h[6] = sum32(this.h[6], g), this.h[7] = sum32(this.h[7], h);\n }, SHA256.prototype._digest = function(enc) {\n return enc === \"hex\" \? utils.toHex32(this.h, \"big\") : utils.split32(this.h, \"big\");\n };\n }\n}), require__3 = __commonJS({\n \"node_modules/hash.js/lib/hash/sha/224.js\"(exports, module) {\n var utils = require_utils4(), SHA256 = require__2();\n function SHA224() {\n if (!(this instanceof SHA224))\n return new SHA224;\n SHA256.@call(this), this.h = [3238371032, 914150663, 812702999, 4144912697, 4290775857, 1750603025, 1694076839, 3204075428];\n }\n utils.inherits(SHA224, SHA256), module.exports = SHA224, SHA224.blockSize = 512, SHA224.outSize = 224, SHA224.hmacStrength = 192, SHA224.padLength = 64, SHA224.prototype._digest = function(enc) {\n return enc === \"hex\" \? utils.toHex32(this.h.slice(0, 7), \"big\") : utils.split32(this.h.slice(0, 7), \"big\");\n };\n }\n}), require__4 = __commonJS({\n \"node_modules/hash.js/lib/hash/sha/512.js\"(exports, module) {\n var utils = require_utils4(), common = require_common(), assert = require_minimalistic_assert(), rotr64_hi = utils.rotr64_hi, rotr64_lo = utils.rotr64_lo, shr64_hi = utils.shr64_hi, shr64_lo = utils.shr64_lo, sum64 = utils.sum64, sum64_hi = utils.sum64_hi, sum64_lo = utils.sum64_lo, sum64_4_hi = utils.sum64_4_hi, sum64_4_lo = utils.sum64_4_lo, sum64_5_hi = utils.sum64_5_hi, sum64_5_lo = utils.sum64_5_lo, BlockHash = common.BlockHash, sha512_K = [\n 1116352408,\n 3609767458,\n 1899447441,\n 602891725,\n 3049323471,\n 3964484399,\n 3921009573,\n 2173295548,\n 961987163,\n 4081628472,\n 1508970993,\n 3053834265,\n 2453635748,\n 2937671579,\n 2870763221,\n 3664609560,\n 3624381080,\n 2734883394,\n 310598401,\n 1164996542,\n 607225278,\n 1323610764,\n 1426881987,\n 3590304994,\n 1925078388,\n 4068182383,\n 2162078206,\n 991336113,\n 2614888103,\n 633803317,\n 3248222580,\n 3479774868,\n 3835390401,\n 2666613458,\n 4022224774,\n 944711139,\n 264347078,\n 2341262773,\n 604807628,\n 2007800933,\n 770255983,\n 1495990901,\n 1249150122,\n 1856431235,\n 1555081692,\n 3175218132,\n 1996064986,\n 2198950837,\n 2554220882,\n 3999719339,\n 2821834349,\n 766784016,\n 2952996808,\n 2566594879,\n 3210313671,\n 3203337956,\n 3336571891,\n 1034457026,\n 3584528711,\n 2466948901,\n 113926993,\n 3758326383,\n 338241895,\n 168717936,\n 666307205,\n 1188179964,\n 773529912,\n 1546045734,\n 1294757372,\n 1522805485,\n 1396182291,\n 2643833823,\n 1695183700,\n 2343527390,\n 1986661051,\n 1014477480,\n 2177026350,\n 1206759142,\n 2456956037,\n 344077627,\n 2730485921,\n 1290863460,\n 2820302411,\n 3158454273,\n 3259730800,\n 3505952657,\n 3345764771,\n 106217008,\n 3516065817,\n 3606008344,\n 3600352804,\n 1432725776,\n 4094571909,\n 1467031594,\n 275423344,\n 851169720,\n 430227734,\n 3100823752,\n 506948616,\n 1363258195,\n 659060556,\n 3750685593,\n 883997877,\n 3785050280,\n 958139571,\n 3318307427,\n 1322822218,\n 3812723403,\n 1537002063,\n 2003034995,\n 1747873779,\n 3602036899,\n 1955562222,\n 1575990012,\n 2024104815,\n 1125592928,\n 2227730452,\n 2716904306,\n 2361852424,\n 442776044,\n 2428436474,\n 593698344,\n 2756734187,\n 3733110249,\n 3204031479,\n 2999351573,\n 3329325298,\n 3815920427,\n 3391569614,\n 3928383900,\n 3515267271,\n 566280711,\n 3940187606,\n 3454069534,\n 4118630271,\n 4000239992,\n 116418474,\n 1914138554,\n 174292421,\n 2731055270,\n 289380356,\n 3203993006,\n 460393269,\n 320620315,\n 685471733,\n 587496836,\n 852142971,\n 1086792851,\n 1017036298,\n 365543100,\n 1126000580,\n 2618297676,\n 1288033470,\n 3409855158,\n 1501505948,\n 4234509866,\n 1607167915,\n 987167468,\n 1816402316,\n 1246189591\n ];\n function SHA512() {\n if (!(this instanceof SHA512))\n return new SHA512;\n BlockHash.@call(this), this.h = [\n 1779033703,\n 4089235720,\n 3144134277,\n 2227873595,\n 1013904242,\n 4271175723,\n 2773480762,\n 1595750129,\n 1359893119,\n 2917565137,\n 2600822924,\n 725511199,\n 528734635,\n 4215389547,\n 1541459225,\n 327033209\n ], this.k = sha512_K, this.W = new @Array(160);\n }\n utils.inherits(SHA512, BlockHash), module.exports = SHA512, SHA512.blockSize = 1024, SHA512.outSize = 512, SHA512.hmacStrength = 192, SHA512.padLength = 128, SHA512.prototype._prepareBlock = function(msg, start) {\n for (var W = this.W, i = 0;i < 32; i++)\n W[i] = msg[start + i];\n for (;i < W.length; i += 2) {\n var c0_hi = g1_512_hi(W[i - 4], W[i - 3]), c0_lo = g1_512_lo(W[i - 4], W[i - 3]), c1_hi = W[i - 14], c1_lo = W[i - 13], c2_hi = g0_512_hi(W[i - 30], W[i - 29]), c2_lo = g0_512_lo(W[i - 30], W[i - 29]), c3_hi = W[i - 32], c3_lo = W[i - 31];\n W[i] = sum64_4_hi(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo), W[i + 1] = sum64_4_lo(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo);\n }\n }, SHA512.prototype._update = function(msg, start) {\n this._prepareBlock(msg, start);\n var W = this.W, ah = this.h[0], al = this.h[1], bh = this.h[2], bl = this.h[3], ch = this.h[4], cl = this.h[5], dh = this.h[6], dl = this.h[7], eh = this.h[8], el = this.h[9], fh = this.h[10], fl = this.h[11], gh = this.h[12], gl = this.h[13], hh = this.h[14], hl = this.h[15];\n assert(this.k.length === W.length);\n for (var i = 0;i < W.length; i += 2) {\n var c0_hi = hh, c0_lo = hl, c1_hi = s1_512_hi(eh, el), c1_lo = s1_512_lo(eh, el), c2_hi = ch64_hi(eh, el, fh, fl, gh, gl), c2_lo = ch64_lo(eh, el, fh, fl, gh, gl), c3_hi = this.k[i], c3_lo = this.k[i + 1], c4_hi = W[i], c4_lo = W[i + 1], T1_hi = sum64_5_hi(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo, c4_hi, c4_lo), T1_lo = sum64_5_lo(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo, c4_hi, c4_lo);\n c0_hi = s0_512_hi(ah, al), c0_lo = s0_512_lo(ah, al), c1_hi = maj64_hi(ah, al, bh, bl, ch, cl), c1_lo = maj64_lo(ah, al, bh, bl, ch, cl);\n var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo), T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo);\n hh = gh, hl = gl, gh = fh, gl = fl, fh = eh, fl = el, eh = sum64_hi(dh, dl, T1_hi, T1_lo), el = sum64_lo(dl, dl, T1_hi, T1_lo), dh = ch, dl = cl, ch = bh, cl = bl, bh = ah, bl = al, ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo), al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo);\n }\n sum64(this.h, 0, ah, al), sum64(this.h, 2, bh, bl), sum64(this.h, 4, ch, cl), sum64(this.h, 6, dh, dl), sum64(this.h, 8, eh, el), sum64(this.h, 10, fh, fl), sum64(this.h, 12, gh, gl), sum64(this.h, 14, hh, hl);\n }, SHA512.prototype._digest = function(enc) {\n return enc === \"hex\" \? utils.toHex32(this.h, \"big\") : utils.split32(this.h, \"big\");\n };\n function ch64_hi(xh, xl, yh, yl, zh) {\n var r = xh & yh ^ ~xh & zh;\n return r < 0 && (r += 4294967296), r;\n }\n function ch64_lo(xh, xl, yh, yl, zh, zl) {\n var r = xl & yl ^ ~xl & zl;\n return r < 0 && (r += 4294967296), r;\n }\n function maj64_hi(xh, xl, yh, yl, zh) {\n var r = xh & yh ^ xh & zh ^ yh & zh;\n return r < 0 && (r += 4294967296), r;\n }\n function maj64_lo(xh, xl, yh, yl, zh, zl) {\n var r = xl & yl ^ xl & zl ^ yl & zl;\n return r < 0 && (r += 4294967296), r;\n }\n function s0_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 28), c1_hi = rotr64_hi(xl, xh, 2), c2_hi = rotr64_hi(xl, xh, 7), r = c0_hi ^ c1_hi ^ c2_hi;\n return r < 0 && (r += 4294967296), r;\n }\n function s0_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 28), c1_lo = rotr64_lo(xl, xh, 2), c2_lo = rotr64_lo(xl, xh, 7), r = c0_lo ^ c1_lo ^ c2_lo;\n return r < 0 && (r += 4294967296), r;\n }\n function s1_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 14), c1_hi = rotr64_hi(xh, xl, 18), c2_hi = rotr64_hi(xl, xh, 9), r = c0_hi ^ c1_hi ^ c2_hi;\n return r < 0 && (r += 4294967296), r;\n }\n function s1_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 14), c1_lo = rotr64_lo(xh, xl, 18), c2_lo = rotr64_lo(xl, xh, 9), r = c0_lo ^ c1_lo ^ c2_lo;\n return r < 0 && (r += 4294967296), r;\n }\n function g0_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 1), c1_hi = rotr64_hi(xh, xl, 8), c2_hi = shr64_hi(xh, xl, 7), r = c0_hi ^ c1_hi ^ c2_hi;\n return r < 0 && (r += 4294967296), r;\n }\n function g0_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 1), c1_lo = rotr64_lo(xh, xl, 8), c2_lo = shr64_lo(xh, xl, 7), r = c0_lo ^ c1_lo ^ c2_lo;\n return r < 0 && (r += 4294967296), r;\n }\n function g1_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 19), c1_hi = rotr64_hi(xl, xh, 29), c2_hi = shr64_hi(xh, xl, 6), r = c0_hi ^ c1_hi ^ c2_hi;\n return r < 0 && (r += 4294967296), r;\n }\n function g1_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 19), c1_lo = rotr64_lo(xl, xh, 29), c2_lo = shr64_lo(xh, xl, 6), r = c0_lo ^ c1_lo ^ c2_lo;\n return r < 0 && (r += 4294967296), r;\n }\n }\n}), require__5 = __commonJS({\n \"node_modules/hash.js/lib/hash/sha/384.js\"(exports, module) {\n var utils = require_utils4(), SHA512 = require__4();\n function SHA384() {\n if (!(this instanceof SHA384))\n return new SHA384;\n SHA512.@call(this), this.h = [\n 3418070365,\n 3238371032,\n 1654270250,\n 914150663,\n 2438529370,\n 812702999,\n 355462360,\n 4144912697,\n 1731405415,\n 4290775857,\n 2394180231,\n 1750603025,\n 3675008525,\n 1694076839,\n 1203062813,\n 3204075428\n ];\n }\n utils.inherits(SHA384, SHA512), module.exports = SHA384, SHA384.blockSize = 1024, SHA384.outSize = 384, SHA384.hmacStrength = 192, SHA384.padLength = 128, SHA384.prototype._digest = function(enc) {\n return enc === \"hex\" \? utils.toHex32(this.h.slice(0, 12), \"big\") : utils.split32(this.h.slice(0, 12), \"big\");\n };\n }\n}), require_sha3 = __commonJS({\n \"node_modules/hash.js/lib/hash/sha.js\"(exports) {\n exports.sha1 = require__(), exports.sha224 = require__3(), exports.sha256 = require__2(), exports.sha384 = require__5(), exports.sha512 = require__4();\n }\n}), require_ripemd = __commonJS({\n \"node_modules/hash.js/lib/hash/ripemd.js\"(exports) {\n var utils = require_utils4(), common = require_common(), rotl32 = utils.rotl32, sum32 = utils.sum32, sum32_3 = utils.sum32_3, sum32_4 = utils.sum32_4, BlockHash = common.BlockHash;\n function RIPEMD160() {\n if (!(this instanceof RIPEMD160))\n return new RIPEMD160;\n BlockHash.@call(this), this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.endian = \"little\";\n }\n utils.inherits(RIPEMD160, BlockHash), exports.ripemd160 = RIPEMD160, RIPEMD160.blockSize = 512, RIPEMD160.outSize = 160, RIPEMD160.hmacStrength = 192, RIPEMD160.padLength = 64, RIPEMD160.prototype._update = function(msg, start) {\n for (var A = this.h[0], B = this.h[1], C = this.h[2], D = this.h[3], E = this.h[4], Ah = A, Bh = B, Ch = C, Dh = D, Eh = E, j = 0;j < 80; j++) {\n var T = sum32(rotl32(sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)), s[j]), E);\n A = E, E = D, D = rotl32(C, 10), C = B, B = T, T = sum32(rotl32(sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)), sh[j]), Eh), Ah = Eh, Eh = Dh, Dh = rotl32(Ch, 10), Ch = Bh, Bh = T;\n }\n T = sum32_3(this.h[1], C, Dh), this.h[1] = sum32_3(this.h[2], D, Eh), this.h[2] = sum32_3(this.h[3], E, Ah), this.h[3] = sum32_3(this.h[4], A, Bh), this.h[4] = sum32_3(this.h[0], B, Ch), this.h[0] = T;\n }, RIPEMD160.prototype._digest = function(enc) {\n return enc === \"hex\" \? utils.toHex32(this.h, \"little\") : utils.split32(this.h, \"little\");\n };\n function f(j, x, y, z) {\n return j <= 15 \? x ^ y ^ z : j <= 31 \? x & y | ~x & z : j <= 47 \? (x | ~y) ^ z : j <= 63 \? x & z | y & ~z : x ^ (y | ~z);\n }\n function K(j) {\n return j <= 15 \? 0 : j <= 31 \? 1518500249 : j <= 47 \? 1859775393 : j <= 63 \? 2400959708 : 2840853838;\n }\n function Kh(j) {\n return j <= 15 \? 1352829926 : j <= 31 \? 1548603684 : j <= 47 \? 1836072691 : j <= 63 \? 2053994217 : 0;\n }\n var r = [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 7,\n 4,\n 13,\n 1,\n 10,\n 6,\n 15,\n 3,\n 12,\n 0,\n 9,\n 5,\n 2,\n 14,\n 11,\n 8,\n 3,\n 10,\n 14,\n 4,\n 9,\n 15,\n 8,\n 1,\n 2,\n 7,\n 0,\n 6,\n 13,\n 11,\n 5,\n 12,\n 1,\n 9,\n 11,\n 10,\n 0,\n 8,\n 12,\n 4,\n 13,\n 3,\n 7,\n 15,\n 14,\n 5,\n 6,\n 2,\n 4,\n 0,\n 5,\n 9,\n 7,\n 12,\n 2,\n 10,\n 14,\n 1,\n 3,\n 8,\n 11,\n 6,\n 15,\n 13\n ], rh = [\n 5,\n 14,\n 7,\n 0,\n 9,\n 2,\n 11,\n 4,\n 13,\n 6,\n 15,\n 8,\n 1,\n 10,\n 3,\n 12,\n 6,\n 11,\n 3,\n 7,\n 0,\n 13,\n 5,\n 10,\n 14,\n 15,\n 8,\n 12,\n 4,\n 9,\n 1,\n 2,\n 15,\n 5,\n 1,\n 3,\n 7,\n 14,\n 6,\n 9,\n 11,\n 8,\n 12,\n 2,\n 10,\n 0,\n 4,\n 13,\n 8,\n 6,\n 4,\n 1,\n 3,\n 11,\n 15,\n 0,\n 5,\n 12,\n 2,\n 13,\n 9,\n 7,\n 10,\n 14,\n 12,\n 15,\n 10,\n 4,\n 1,\n 5,\n 8,\n 7,\n 6,\n 2,\n 13,\n 14,\n 0,\n 3,\n 9,\n 11\n ], s = [\n 11,\n 14,\n 15,\n 12,\n 5,\n 8,\n 7,\n 9,\n 11,\n 13,\n 14,\n 15,\n 6,\n 7,\n 9,\n 8,\n 7,\n 6,\n 8,\n 13,\n 11,\n 9,\n 7,\n 15,\n 7,\n 12,\n 15,\n 9,\n 11,\n 7,\n 13,\n 12,\n 11,\n 13,\n 6,\n 7,\n 14,\n 9,\n 13,\n 15,\n 14,\n 8,\n 13,\n 6,\n 5,\n 12,\n 7,\n 5,\n 11,\n 12,\n 14,\n 15,\n 14,\n 15,\n 9,\n 8,\n 9,\n 14,\n 5,\n 6,\n 8,\n 6,\n 5,\n 12,\n 9,\n 15,\n 5,\n 11,\n 6,\n 8,\n 13,\n 12,\n 5,\n 12,\n 13,\n 14,\n 11,\n 8,\n 5,\n 6\n ], sh = [\n 8,\n 9,\n 9,\n 11,\n 13,\n 15,\n 15,\n 5,\n 7,\n 7,\n 8,\n 11,\n 14,\n 14,\n 12,\n 6,\n 9,\n 13,\n 15,\n 7,\n 12,\n 8,\n 9,\n 11,\n 7,\n 7,\n 12,\n 7,\n 6,\n 15,\n 13,\n 11,\n 9,\n 7,\n 15,\n 11,\n 8,\n 6,\n 6,\n 14,\n 12,\n 13,\n 5,\n 14,\n 13,\n 13,\n 7,\n 5,\n 15,\n 5,\n 8,\n 11,\n 14,\n 14,\n 6,\n 14,\n 6,\n 9,\n 12,\n 9,\n 12,\n 5,\n 15,\n 8,\n 8,\n 5,\n 12,\n 9,\n 12,\n 5,\n 14,\n 6,\n 8,\n 13,\n 6,\n 5,\n 15,\n 13,\n 11,\n 11\n ];\n }\n}), require_hmac = __commonJS({\n \"node_modules/hash.js/lib/hash/hmac.js\"(exports, module) {\n var utils = require_utils4(), assert = require_minimalistic_assert();\n function Hmac(hash, key2, enc) {\n if (key2 = exportIfKeyObject(key2), !(this instanceof Hmac))\n return new Hmac(hash, key2, enc);\n this.Hash = hash, this.blockSize = hash.blockSize / 8, this.outSize = hash.outSize / 8, this.inner = null, this.outer = null, this._init(utils.toArray(key2, enc));\n }\n Hmac.prototype = {}, module.exports = Hmac, Hmac.prototype._init = function(key2) {\n key2.length > this.blockSize && (key2 = new this.Hash().update(key2).digest()), assert(key2.length <= this.blockSize);\n for (var i = key2.length;i < this.blockSize; i++)\n key2.push(0);\n for (i = 0;i < key2.length; i++)\n key2[i] ^= 54;\n for (this.inner = new this.Hash().update(key2), i = 0;i < key2.length; i++)\n key2[i] ^= 106;\n this.outer = new this.Hash().update(key2);\n }, Hmac.prototype.update = function(msg, enc) {\n return this.inner.update(msg, enc), this;\n }, Hmac.prototype.digest = function(enc) {\n return this.outer.update(this.inner.digest()), this.outer.digest(enc);\n };\n }\n}), require_hash2 = __commonJS({\n \"node_modules/hash.js/lib/hash.js\"(exports) {\n var hash = exports;\n hash.utils = require_utils4(), hash.common = require_common(), hash.sha = require_sha3(), hash.ripemd = require_ripemd(), hash.hmac = require_hmac(), hash.sha1 = hash.sha.sha1, hash.sha256 = hash.sha.sha256, hash.sha224 = hash.sha.sha224, hash.sha384 = hash.sha.sha384, hash.sha512 = hash.sha.sha512, hash.ripemd160 = hash.ripemd.ripemd160;\n }\n}), require_secp256k1 = __commonJS({\n \"node_modules/elliptic/lib/elliptic/precomputed/secp256k1.js\"(exports, module) {\n module.exports = {\n doubles: {\n step: 4,\n points: [\n [\n \"e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a\",\n \"f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821\"\n ],\n [\n \"8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508\",\n \"11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf\"\n ],\n [\n \"175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739\",\n \"d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695\"\n ],\n [\n \"363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640\",\n \"4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9\"\n ],\n [\n \"8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c\",\n \"4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36\"\n ],\n [\n \"723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda\",\n \"96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f\"\n ],\n [\n \"eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa\",\n \"5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999\"\n ],\n [\n \"100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0\",\n \"cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09\"\n ],\n [\n \"e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d\",\n \"9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d\"\n ],\n [\n \"feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d\",\n \"e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088\"\n ],\n [\n \"da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1\",\n \"9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d\"\n ],\n [\n \"53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0\",\n \"5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8\"\n ],\n [\n \"8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047\",\n \"10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a\"\n ],\n [\n \"385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862\",\n \"283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453\"\n ],\n [\n \"6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7\",\n \"7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160\"\n ],\n [\n \"3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd\",\n \"56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0\"\n ],\n [\n \"85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83\",\n \"7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6\"\n ],\n [\n \"948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a\",\n \"53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589\"\n ],\n [\n \"6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8\",\n \"bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17\"\n ],\n [\n \"e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d\",\n \"4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda\"\n ],\n [\n \"e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725\",\n \"7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd\"\n ],\n [\n \"213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754\",\n \"4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2\"\n ],\n [\n \"4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c\",\n \"17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6\"\n ],\n [\n \"fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6\",\n \"6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f\"\n ],\n [\n \"76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39\",\n \"c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01\"\n ],\n [\n \"c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891\",\n \"893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3\"\n ],\n [\n \"d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b\",\n \"febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f\"\n ],\n [\n \"b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03\",\n \"2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7\"\n ],\n [\n \"e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d\",\n \"eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78\"\n ],\n [\n \"a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070\",\n \"7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1\"\n ],\n [\n \"90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4\",\n \"e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150\"\n ],\n [\n \"8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da\",\n \"662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82\"\n ],\n [\n \"e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11\",\n \"1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc\"\n ],\n [\n \"8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e\",\n \"efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b\"\n ],\n [\n \"e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41\",\n \"2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51\"\n ],\n [\n \"b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef\",\n \"67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45\"\n ],\n [\n \"d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8\",\n \"db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120\"\n ],\n [\n \"324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d\",\n \"648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84\"\n ],\n [\n \"4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96\",\n \"35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d\"\n ],\n [\n \"9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd\",\n \"ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d\"\n ],\n [\n \"6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5\",\n \"9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8\"\n ],\n [\n \"a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266\",\n \"40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8\"\n ],\n [\n \"7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71\",\n \"34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac\"\n ],\n [\n \"928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac\",\n \"c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f\"\n ],\n [\n \"85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751\",\n \"1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962\"\n ],\n [\n \"ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e\",\n \"493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907\"\n ],\n [\n \"827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241\",\n \"c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec\"\n ],\n [\n \"eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3\",\n \"be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d\"\n ],\n [\n \"e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f\",\n \"4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414\"\n ],\n [\n \"1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19\",\n \"aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd\"\n ],\n [\n \"146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be\",\n \"b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0\"\n ],\n [\n \"fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9\",\n \"6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811\"\n ],\n [\n \"da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2\",\n \"8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1\"\n ],\n [\n \"a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13\",\n \"7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c\"\n ],\n [\n \"174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c\",\n \"ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73\"\n ],\n [\n \"959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba\",\n \"2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd\"\n ],\n [\n \"d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151\",\n \"e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405\"\n ],\n [\n \"64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073\",\n \"d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589\"\n ],\n [\n \"8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458\",\n \"38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e\"\n ],\n [\n \"13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b\",\n \"69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27\"\n ],\n [\n \"bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366\",\n \"d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1\"\n ],\n [\n \"8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa\",\n \"40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482\"\n ],\n [\n \"8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0\",\n \"620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945\"\n ],\n [\n \"dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787\",\n \"7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573\"\n ],\n [\n \"f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e\",\n \"ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82\"\n ]\n ]\n },\n naf: {\n wnd: 7,\n points: [\n [\n \"f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9\",\n \"388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672\"\n ],\n [\n \"2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4\",\n \"d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6\"\n ],\n [\n \"5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc\",\n \"6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da\"\n ],\n [\n \"acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe\",\n \"cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37\"\n ],\n [\n \"774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb\",\n \"d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b\"\n ],\n [\n \"f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8\",\n \"ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81\"\n ],\n [\n \"d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e\",\n \"581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58\"\n ],\n [\n \"defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34\",\n \"4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77\"\n ],\n [\n \"2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c\",\n \"85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a\"\n ],\n [\n \"352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5\",\n \"321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c\"\n ],\n [\n \"2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f\",\n \"2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67\"\n ],\n [\n \"9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714\",\n \"73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402\"\n ],\n [\n \"daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729\",\n \"a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55\"\n ],\n [\n \"c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db\",\n \"2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482\"\n ],\n [\n \"6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4\",\n \"e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82\"\n ],\n [\n \"1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5\",\n \"b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396\"\n ],\n [\n \"605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479\",\n \"2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49\"\n ],\n [\n \"62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d\",\n \"80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf\"\n ],\n [\n \"80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f\",\n \"1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a\"\n ],\n [\n \"7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb\",\n \"d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7\"\n ],\n [\n \"d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9\",\n \"eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933\"\n ],\n [\n \"49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963\",\n \"758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a\"\n ],\n [\n \"77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74\",\n \"958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6\"\n ],\n [\n \"f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530\",\n \"e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37\"\n ],\n [\n \"463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b\",\n \"5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e\"\n ],\n [\n \"f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247\",\n \"cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6\"\n ],\n [\n \"caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1\",\n \"cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476\"\n ],\n [\n \"2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120\",\n \"4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40\"\n ],\n [\n \"7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435\",\n \"91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61\"\n ],\n [\n \"754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18\",\n \"673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683\"\n ],\n [\n \"e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8\",\n \"59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5\"\n ],\n [\n \"186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb\",\n \"3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b\"\n ],\n [\n \"df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f\",\n \"55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417\"\n ],\n [\n \"5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143\",\n \"efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868\"\n ],\n [\n \"290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba\",\n \"e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a\"\n ],\n [\n \"af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45\",\n \"f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6\"\n ],\n [\n \"766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a\",\n \"744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996\"\n ],\n [\n \"59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e\",\n \"c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e\"\n ],\n [\n \"f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8\",\n \"e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d\"\n ],\n [\n \"7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c\",\n \"30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2\"\n ],\n [\n \"948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519\",\n \"e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e\"\n ],\n [\n \"7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab\",\n \"100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437\"\n ],\n [\n \"3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca\",\n \"ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311\"\n ],\n [\n \"d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf\",\n \"8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4\"\n ],\n [\n \"1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610\",\n \"68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575\"\n ],\n [\n \"733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4\",\n \"f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d\"\n ],\n [\n \"15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c\",\n \"d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d\"\n ],\n [\n \"a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940\",\n \"edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629\"\n ],\n [\n \"e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980\",\n \"a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06\"\n ],\n [\n \"311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3\",\n \"66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374\"\n ],\n [\n \"34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf\",\n \"9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee\"\n ],\n [\n \"f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63\",\n \"4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1\"\n ],\n [\n \"d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448\",\n \"fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b\"\n ],\n [\n \"32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf\",\n \"5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661\"\n ],\n [\n \"7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5\",\n \"8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6\"\n ],\n [\n \"ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6\",\n \"8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e\"\n ],\n [\n \"16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5\",\n \"5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d\"\n ],\n [\n \"eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99\",\n \"f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc\"\n ],\n [\n \"78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51\",\n \"f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4\"\n ],\n [\n \"494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5\",\n \"42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c\"\n ],\n [\n \"a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5\",\n \"204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b\"\n ],\n [\n \"c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997\",\n \"4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913\"\n ],\n [\n \"841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881\",\n \"73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154\"\n ],\n [\n \"5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5\",\n \"39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865\"\n ],\n [\n \"36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66\",\n \"d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc\"\n ],\n [\n \"336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726\",\n \"ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224\"\n ],\n [\n \"8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede\",\n \"6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e\"\n ],\n [\n \"1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94\",\n \"60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6\"\n ],\n [\n \"85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31\",\n \"3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511\"\n ],\n [\n \"29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51\",\n \"b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b\"\n ],\n [\n \"a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252\",\n \"ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2\"\n ],\n [\n \"4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5\",\n \"cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c\"\n ],\n [\n \"d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b\",\n \"6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3\"\n ],\n [\n \"ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4\",\n \"322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d\"\n ],\n [\n \"af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f\",\n \"6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700\"\n ],\n [\n \"e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889\",\n \"2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4\"\n ],\n [\n \"591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246\",\n \"b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196\"\n ],\n [\n \"11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984\",\n \"998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4\"\n ],\n [\n \"3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a\",\n \"b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257\"\n ],\n [\n \"cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030\",\n \"bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13\"\n ],\n [\n \"c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197\",\n \"6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096\"\n ],\n [\n \"c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593\",\n \"c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38\"\n ],\n [\n \"a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef\",\n \"21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f\"\n ],\n [\n \"347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38\",\n \"60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448\"\n ],\n [\n \"da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a\",\n \"49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a\"\n ],\n [\n \"c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111\",\n \"5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4\"\n ],\n [\n \"4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502\",\n \"7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437\"\n ],\n [\n \"3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea\",\n \"be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7\"\n ],\n [\n \"cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26\",\n \"8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d\"\n ],\n [\n \"b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986\",\n \"39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a\"\n ],\n [\n \"d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e\",\n \"62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54\"\n ],\n [\n \"48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4\",\n \"25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77\"\n ],\n [\n \"dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda\",\n \"ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517\"\n ],\n [\n \"6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859\",\n \"cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10\"\n ],\n [\n \"e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f\",\n \"f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125\"\n ],\n [\n \"eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c\",\n \"6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e\"\n ],\n [\n \"13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942\",\n \"fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1\"\n ],\n [\n \"ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a\",\n \"1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2\"\n ],\n [\n \"b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80\",\n \"5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423\"\n ],\n [\n \"ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d\",\n \"438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8\"\n ],\n [\n \"8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1\",\n \"cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758\"\n ],\n [\n \"52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63\",\n \"c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375\"\n ],\n [\n \"e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352\",\n \"6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d\"\n ],\n [\n \"7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193\",\n \"ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec\"\n ],\n [\n \"5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00\",\n \"9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0\"\n ],\n [\n \"32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58\",\n \"ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c\"\n ],\n [\n \"e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7\",\n \"d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4\"\n ],\n [\n \"8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8\",\n \"c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f\"\n ],\n [\n \"4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e\",\n \"67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649\"\n ],\n [\n \"3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d\",\n \"cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826\"\n ],\n [\n \"674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b\",\n \"299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5\"\n ],\n [\n \"d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f\",\n \"f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87\"\n ],\n [\n \"30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6\",\n \"462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b\"\n ],\n [\n \"be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297\",\n \"62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc\"\n ],\n [\n \"93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a\",\n \"7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c\"\n ],\n [\n \"b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c\",\n \"ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f\"\n ],\n [\n \"d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52\",\n \"4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a\"\n ],\n [\n \"d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb\",\n \"bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46\"\n ],\n [\n \"463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065\",\n \"bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f\"\n ],\n [\n \"7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917\",\n \"603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03\"\n ],\n [\n \"74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9\",\n \"cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08\"\n ],\n [\n \"30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3\",\n \"553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8\"\n ],\n [\n \"9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57\",\n \"712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373\"\n ],\n [\n \"176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66\",\n \"ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3\"\n ],\n [\n \"75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8\",\n \"9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8\"\n ],\n [\n \"809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721\",\n \"9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1\"\n ],\n [\n \"1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180\",\n \"4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9\"\n ]\n ]\n }\n };\n }\n}), require_curves = __commonJS({\n \"node_modules/elliptic/lib/elliptic/curves.js\"(exports) {\n var curves = exports, hash = require_hash2(), curve = require_curve(), utils = require_utils3(), assert = utils.assert;\n function PresetCurve(options) {\n options.type === \"short\" \? this.curve = new curve.short(options) : options.type === \"edwards\" \? this.curve = new curve.edwards(options) : this.curve = new curve.mont(options), this.g = this.curve.g, this.n = this.curve.n, this.hash = options.hash, assert(this.g.validate(), \"Invalid curve\"), assert(this.g.mul(this.n).isInfinity(), \"Invalid curve, G*N != O\");\n }\n PresetCurve.prototype = {}, curves.PresetCurve = PresetCurve;\n function defineCurve(name, options) {\n Object.defineProperty(curves, name, {\n configurable: !0,\n enumerable: !0,\n get: function() {\n var curve2 = new PresetCurve(options);\n return Object.defineProperty(curves, name, {\n configurable: !0,\n enumerable: !0,\n value: curve2\n }), curve2;\n }\n });\n }\n defineCurve(\"p192\", {\n type: \"short\",\n prime: \"p192\",\n p: \"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff\",\n a: \"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc\",\n b: \"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1\",\n n: \"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831\",\n hash: hash.sha256,\n gRed: !1,\n g: [\n \"188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012\",\n \"07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811\"\n ]\n }), defineCurve(\"p224\", {\n type: \"short\",\n prime: \"p224\",\n p: \"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001\",\n a: \"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe\",\n b: \"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4\",\n n: \"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d\",\n hash: hash.sha256,\n gRed: !1,\n g: [\n \"b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21\",\n \"bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34\"\n ]\n }), defineCurve(\"p256\", {\n type: \"short\",\n prime: null,\n p: \"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff\",\n a: \"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc\",\n b: \"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b\",\n n: \"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551\",\n hash: hash.sha256,\n gRed: !1,\n g: [\n \"6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296\",\n \"4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5\"\n ]\n }), defineCurve(\"p384\", {\n type: \"short\",\n prime: null,\n p: \"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff\",\n a: \"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc\",\n b: \"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef\",\n n: \"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973\",\n hash: hash.sha384,\n gRed: !1,\n g: [\n \"aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7\",\n \"3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f\"\n ]\n }), defineCurve(\"p521\", {\n type: \"short\",\n prime: null,\n p: \"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff\",\n a: \"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc\",\n b: \"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00\",\n n: \"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409\",\n hash: hash.sha512,\n gRed: !1,\n g: [\n \"000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66\",\n \"00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650\"\n ]\n }), defineCurve(\"curve25519\", {\n type: \"mont\",\n prime: \"p25519\",\n p: \"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed\",\n a: \"76d06\",\n b: \"1\",\n n: \"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed\",\n hash: hash.sha256,\n gRed: !1,\n g: [\"9\"]\n }), defineCurve(\"ed25519\", {\n type: \"edwards\",\n prime: \"p25519\",\n p: \"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed\",\n a: \"-1\",\n c: \"1\",\n d: \"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3\",\n n: \"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed\",\n hash: hash.sha256,\n gRed: !1,\n g: [\n \"216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a\",\n \"6666666666666666666666666666666666666666666666666666666666666658\"\n ]\n });\n var pre;\n try {\n pre = require_secp256k1();\n } catch {\n pre = void 0;\n }\n defineCurve(\"secp256k1\", {\n type: \"short\",\n prime: \"k256\",\n p: \"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f\",\n a: \"0\",\n b: \"7\",\n n: \"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141\",\n h: \"1\",\n hash: hash.sha256,\n beta: \"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee\",\n lambda: \"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72\",\n basis: [\n {\n a: \"3086d221a7d46bcde86c90e49284eb15\",\n b: \"-e4437ed6010e88286f547fa90abfe4c3\"\n },\n {\n a: \"114ca50f7a8e2f3f657c1108d9d44cfd8\",\n b: \"3086d221a7d46bcde86c90e49284eb15\"\n }\n ],\n gRed: !1,\n g: [\n \"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798\",\n \"483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8\",\n pre\n ]\n });\n }\n}), require_hmac_drbg = __commonJS({\n \"node_modules/hmac-drbg/lib/hmac-drbg.js\"(exports, module) {\n var hash = require_hash2(), utils = require_utils2(), assert = require_minimalistic_assert();\n function HmacDRBG(options) {\n if (!(this instanceof HmacDRBG))\n return new HmacDRBG(options);\n this.hash = options.hash, this.predResist = !!options.predResist, this.outLen = this.hash.outSize, this.minEntropy = options.minEntropy || this.hash.hmacStrength, this._reseed = null, this.reseedInterval = null, this.K = null, this.V = null;\n var entropy = utils.toArray(options.entropy, options.entropyEnc || \"hex\"), nonce = utils.toArray(options.nonce, options.nonceEnc || \"hex\"), pers = utils.toArray(options.pers, options.persEnc || \"hex\");\n assert(entropy.length >= this.minEntropy / 8, \"Not enough entropy. Minimum is: \" + this.minEntropy + \" bits\"), this._init(entropy, nonce, pers);\n }\n HmacDRBG.prototype = {}, module.exports = HmacDRBG, HmacDRBG.prototype._init = function(entropy, nonce, pers) {\n var seed = entropy.concat(nonce).concat(pers);\n this.K = new @Array(this.outLen / 8), this.V = new @Array(this.outLen / 8);\n for (var i = 0;i < this.V.length; i++)\n this.K[i] = 0, this.V[i] = 1;\n this._update(seed), this._reseed = 1, this.reseedInterval = 281474976710656;\n }, HmacDRBG.prototype._hmac = function() {\n return new hash.hmac(this.hash, this.K);\n }, HmacDRBG.prototype._update = function(seed) {\n var kmac = this._hmac().update(this.V).update([0]);\n seed && (kmac = kmac.update(seed)), this.K = kmac.digest(), this.V = this._hmac().update(this.V).digest(), seed && (this.K = this._hmac().update(this.V).update([1]).update(seed).digest(), this.V = this._hmac().update(this.V).digest());\n }, HmacDRBG.prototype.reseed = function(entropy, entropyEnc, add, addEnc) {\n typeof entropyEnc != \"string\" && (addEnc = add, add = entropyEnc, entropyEnc = null), entropy = utils.toArray(entropy, entropyEnc), add = utils.toArray(add, addEnc), assert(entropy.length >= this.minEntropy / 8, \"Not enough entropy. Minimum is: \" + this.minEntropy + \" bits\"), this._update(entropy.concat(add || [])), this._reseed = 1;\n }, HmacDRBG.prototype.generate = function(len, enc, add, addEnc) {\n if (this._reseed > this.reseedInterval)\n throw new Error(\"Reseed is required\");\n typeof enc != \"string\" && (addEnc = add, add = enc, enc = null), add && (add = utils.toArray(add, addEnc || \"hex\"), this._update(add));\n for (var temp = [];temp.length < len; )\n this.V = this._hmac().update(this.V).digest(), temp = temp.concat(this.V);\n var res = temp.slice(0, len);\n return this._update(add), this._reseed++, utils.encode(res, enc);\n };\n }\n}), require_key = __commonJS({\n \"node_modules/elliptic/lib/elliptic/ec/key.js\"(exports, module) {\n var BN = require_bn4(), utils = require_utils3(), assert = utils.assert;\n function KeyPair(ec, options) {\n this.ec = ec, this.priv = null, this.pub = null, options.priv && this._importPrivate(options.priv, options.privEnc), options.pub && this._importPublic(options.pub, options.pubEnc);\n }\n KeyPair.prototype = {}, module.exports = KeyPair, KeyPair.fromPublic = function(ec, pub, enc) {\n return pub instanceof KeyPair \? pub : new KeyPair(ec, {\n pub,\n pubEnc: enc\n });\n }, KeyPair.fromPrivate = function(ec, priv, enc) {\n return priv instanceof KeyPair \? priv : new KeyPair(ec, {\n priv,\n privEnc: enc\n });\n }, KeyPair.prototype.validate = function() {\n var pub = this.getPublic();\n return pub.isInfinity() \? { result: !1, reason: \"Invalid public key\" } : pub.validate() \? pub.mul(this.ec.curve.n).isInfinity() \? { result: !0, reason: null } : { result: !1, reason: \"Public key * N != O\" } : { result: !1, reason: \"Public key is not a point\" };\n }, KeyPair.prototype.getPublic = function(compact, enc) {\n return typeof compact == \"string\" && (enc = compact, compact = null), this.pub || (this.pub = this.ec.g.mul(this.priv)), enc \? this.pub.encode(enc, compact) : this.pub;\n }, KeyPair.prototype.getPrivate = function(enc) {\n return enc === \"hex\" \? this.priv.toString(16, 2) : this.priv;\n }, KeyPair.prototype._importPrivate = function(key2, enc) {\n this.priv = new BN(key2, enc || 16), this.priv = this.priv.umod(this.ec.curve.n);\n }, KeyPair.prototype._importPublic = function(key2, enc) {\n if (key2.x || key2.y) {\n this.ec.curve.type === \"mont\" \? assert(key2.x, \"Need x coordinate\") : (this.ec.curve.type === \"short\" || this.ec.curve.type === \"edwards\") && assert(key2.x && key2.y, \"Need both x and y coordinate\"), this.pub = this.ec.curve.point(key2.x, key2.y);\n return;\n }\n this.pub = this.ec.curve.decodePoint(key2, enc);\n }, KeyPair.prototype.derive = function(pub) {\n return pub.validate() || assert(pub.validate(), \"public point not validated\"), pub.mul(this.priv).getX();\n }, KeyPair.prototype.sign = function(msg, enc, options) {\n return this.ec.sign(msg, this, enc, options);\n }, KeyPair.prototype.verify = function(msg, signature) {\n return this.ec.verify(msg, signature, this);\n }, KeyPair.prototype.inspect = function() {\n return \"\";\n };\n }\n}), require_signature = __commonJS({\n \"node_modules/elliptic/lib/elliptic/ec/signature.js\"(exports, module) {\n var BN = require_bn4(), utils = require_utils3(), assert = utils.assert;\n function Signature(options, enc) {\n if (options instanceof Signature)\n return options;\n this._importDER(options, enc) || (assert(options.r && options.s, \"Signature without r or s\"), this.r = new BN(options.r, 16), this.s = new BN(options.s, 16), options.recoveryParam === void 0 \? this.recoveryParam = null : this.recoveryParam = options.recoveryParam);\n }\n Signature.prototype = {}, module.exports = Signature;\n function Position() {\n this.place = 0;\n }\n function getLength(buf, p) {\n var initial = buf[p.place++];\n if (!(initial & 128))\n return initial;\n var octetLen = initial & 15;\n if (octetLen === 0 || octetLen > 4)\n return !1;\n for (var val = 0, i = 0, off = p.place;i < octetLen; i++, off++)\n val <<= 8, val |= buf[off], val >>>= 0;\n return val <= 127 \? !1 : (p.place = off, val);\n }\n function rmPadding(buf) {\n for (var i = 0, len = buf.length - 1;!buf[i] && !(buf[i + 1] & 128) && i < len; )\n i++;\n return i === 0 \? buf : buf.slice(i);\n }\n Signature.prototype._importDER = function(data, enc) {\n data = utils.toArray(data, enc);\n var p = new Position;\n if (data[p.place++] !== 48)\n return !1;\n var len = getLength(data, p);\n if (len === !1 || len + p.place !== data.length || data[p.place++] !== 2)\n return !1;\n var rlen = getLength(data, p);\n if (rlen === !1)\n return !1;\n var r = data.slice(p.place, rlen + p.place);\n if (p.place += rlen, data[p.place++] !== 2)\n return !1;\n var slen = getLength(data, p);\n if (slen === !1 || data.length !== slen + p.place)\n return !1;\n var s = data.slice(p.place, slen + p.place);\n if (r[0] === 0)\n if (r[1] & 128)\n r = r.slice(1);\n else\n return !1;\n if (s[0] === 0)\n if (s[1] & 128)\n s = s.slice(1);\n else\n return !1;\n return this.r = new BN(r), this.s = new BN(s), this.recoveryParam = null, !0;\n };\n function constructLength(arr, len) {\n if (len < 128) {\n arr.push(len);\n return;\n }\n var octets = 1 + (Math.log(len) / Math.LN2 >>> 3);\n for (arr.push(octets | 128);--octets; )\n arr.push(len >>> (octets << 3) & 255);\n arr.push(len);\n }\n Signature.prototype.toDER = function(enc) {\n var r = this.r.toArray(), s = this.s.toArray();\n for (r[0] & 128 && (r = [0].concat(r)), s[0] & 128 && (s = [0].concat(s)), r = rmPadding(r), s = rmPadding(s);!s[0] && !(s[1] & 128); )\n s = s.slice(1);\n var arr = [2];\n constructLength(arr, r.length), arr = arr.concat(r), arr.push(2), constructLength(arr, s.length);\n var backHalf = arr.concat(s), res = [48];\n return constructLength(res, backHalf.length), res = res.concat(backHalf), utils.encode(res, enc);\n };\n }\n}), require_ec = __commonJS({\n \"node_modules/elliptic/lib/elliptic/ec/index.js\"(exports, module) {\n var BN = require_bn4(), HmacDRBG = require_hmac_drbg(), utils = require_utils3(), curves = require_curves(), rand = require_brorand(), assert = utils.assert, KeyPair = require_key(), Signature = require_signature();\n function EC(options) {\n if (!(this instanceof EC))\n return new EC(options);\n typeof options == \"string\" && (assert(Object.prototype.hasOwnProperty.@call(curves, options), \"Unknown curve \" + options), options = curves[options]), options instanceof curves.PresetCurve && (options = { curve: options }), this.curve = options.curve.curve, this.n = this.curve.n, this.nh = this.n.ushrn(1), this.g = this.curve.g, this.g = options.curve.g, this.g.precompute(options.curve.n.bitLength() + 1), this.hash = options.hash || options.curve.hash;\n }\n EC.prototype = {}, module.exports = EC, EC.prototype.keyPair = function(options) {\n return new KeyPair(this, options);\n }, EC.prototype.keyFromPrivate = function(priv, enc) {\n return KeyPair.fromPrivate(this, priv, enc);\n }, EC.prototype.keyFromPublic = function(pub, enc) {\n return KeyPair.fromPublic(this, pub, enc);\n }, EC.prototype.genKeyPair = function(options) {\n options || (options = {});\n for (var drbg = new HmacDRBG({\n hash: this.hash,\n pers: options.pers,\n persEnc: options.persEnc || \"utf8\",\n entropy: options.entropy || rand(this.hash.hmacStrength),\n entropyEnc: options.entropy && options.entropyEnc || \"utf8\",\n nonce: this.n.toArray()\n }), bytes = this.n.byteLength(), ns2 = this.n.sub(new BN(2));; ) {\n var priv = new BN(drbg.generate(bytes));\n if (!(priv.cmp(ns2) > 0))\n return priv.iaddn(1), this.keyFromPrivate(priv);\n }\n }, EC.prototype._truncateToN = function(msg, truncOnly) {\n var delta = msg.byteLength() * 8 - this.n.bitLength();\n return delta > 0 && (msg = msg.ushrn(delta)), !truncOnly && msg.cmp(this.n) >= 0 \? msg.sub(this.n) : msg;\n }, EC.prototype.sign = function(msg, key2, enc, options) {\n typeof enc == \"object\" && (options = enc, enc = null), options || (options = {}), key2 = this.keyFromPrivate(key2, enc), msg = this._truncateToN(new BN(msg, 16));\n for (var bytes = this.n.byteLength(), bkey = key2.getPrivate().toArray(\"be\", bytes), nonce = msg.toArray(\"be\", bytes), drbg = new HmacDRBG({\n hash: this.hash,\n entropy: bkey,\n nonce,\n pers: options.pers,\n persEnc: options.persEnc || \"utf8\"\n }), ns1 = this.n.sub(new BN(1)), iter = 0;; iter++) {\n var k = options.k \? options.k(iter) : new BN(drbg.generate(this.n.byteLength()));\n if (k = this._truncateToN(k, !0), !(k.cmpn(1) <= 0 || k.cmp(ns1) >= 0)) {\n var kp = this.g.mul(k);\n if (!kp.isInfinity()) {\n var kpX = kp.getX(), r = kpX.umod(this.n);\n if (r.cmpn(0) !== 0) {\n var s = k.invm(this.n).mul(r.mul(key2.getPrivate()).iadd(msg));\n if (s = s.umod(this.n), s.cmpn(0) !== 0) {\n var recoveryParam = (kp.getY().isOdd() \? 1 : 0) | (kpX.cmp(r) !== 0 \? 2 : 0);\n return options.canonical && s.cmp(this.nh) > 0 && (s = this.n.sub(s), recoveryParam ^= 1), new Signature({ r, s, recoveryParam });\n }\n }\n }\n }\n }\n }, EC.prototype.verify = function(msg, signature, key2, enc) {\n msg = this._truncateToN(new BN(msg, 16)), key2 = this.keyFromPublic(key2, enc), signature = new Signature(signature, \"hex\");\n var { r, s } = signature;\n if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0 || s.cmpn(1) < 0 || s.cmp(this.n) >= 0)\n return !1;\n var sinv = s.invm(this.n), u1 = sinv.mul(msg).umod(this.n), u2 = sinv.mul(r).umod(this.n), p;\n return this.curve._maxwellTrick \? (p = this.g.jmulAdd(u1, key2.getPublic(), u2), p.isInfinity() \? !1 : p.eqXToP(r)) : (p = this.g.mulAdd(u1, key2.getPublic(), u2), p.isInfinity() \? !1 : p.getX().umod(this.n).cmp(r) === 0);\n }, EC.prototype.recoverPubKey = function(msg, signature, j, enc) {\n assert((3 & j) === j, \"The recovery param is more than two bits\"), signature = new Signature(signature, enc);\n var n = this.n, e = new BN(msg), r = signature.r, s = signature.s, isYOdd = j & 1, isSecondKey = j >> 1;\n if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey)\n throw new Error(\"Unable to find sencond key candinate\");\n isSecondKey \? r = this.curve.pointFromX(r.add(this.curve.n), isYOdd) : r = this.curve.pointFromX(r, isYOdd);\n var rInv = signature.r.invm(n), s1 = n.sub(e).mul(rInv).umod(n), s2 = s.mul(rInv).umod(n);\n return this.g.mulAdd(s1, r, s2);\n }, EC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) {\n if (signature = new Signature(signature, enc), signature.recoveryParam !== null)\n return signature.recoveryParam;\n for (var i = 0;i < 4; i++) {\n var Qprime;\n try {\n Qprime = this.recoverPubKey(e, signature, i);\n } catch {\n continue;\n }\n if (Qprime.eq(Q))\n return i;\n }\n throw new Error(\"Unable to find valid recovery factor\");\n };\n }\n}), require_key2 = __commonJS({\n \"node_modules/elliptic/lib/elliptic/eddsa/key.js\"(exports, module) {\n var utils = require_utils3(), assert = utils.assert, parseBytes = utils.parseBytes, cachedProperty = utils.cachedProperty;\n function KeyPair(eddsa, params) {\n this.eddsa = eddsa, this._secret = parseBytes(params.secret), eddsa.isPoint(params.pub) \? this._pub = params.pub : this._pubBytes = parseBytes(params.pub);\n }\n KeyPair.prototype = {}, KeyPair.fromPublic = function(eddsa, pub) {\n return pub instanceof KeyPair \? pub : new KeyPair(eddsa, { pub });\n }, KeyPair.fromSecret = function(eddsa, secret) {\n return secret instanceof KeyPair \? secret : new KeyPair(eddsa, { secret });\n }, KeyPair.prototype.secret = function() {\n return this._secret;\n }, cachedProperty(KeyPair, \"pubBytes\", function() {\n return this.eddsa.encodePoint(this.pub());\n }), cachedProperty(KeyPair, \"pub\", function() {\n return this._pubBytes \? this.eddsa.decodePoint(this._pubBytes) : this.eddsa.g.mul(this.priv());\n }), cachedProperty(KeyPair, \"privBytes\", function() {\n var eddsa = this.eddsa, hash = this.hash(), lastIx = eddsa.encodingLength - 1, a = hash.slice(0, eddsa.encodingLength);\n return a[0] &= 248, a[lastIx] &= 127, a[lastIx] |= 64, a;\n }), cachedProperty(KeyPair, \"priv\", function() {\n return this.eddsa.decodeInt(this.privBytes());\n }), cachedProperty(KeyPair, \"hash\", function() {\n return this.eddsa.hash().update(this.secret()).digest();\n }), cachedProperty(KeyPair, \"messagePrefix\", function() {\n return this.hash().slice(this.eddsa.encodingLength);\n }), KeyPair.prototype.sign = function(message) {\n return assert(this._secret, \"KeyPair can only verify\"), this.eddsa.sign(message, this);\n }, KeyPair.prototype.verify = function(message, sig) {\n return this.eddsa.verify(message, sig, this);\n }, KeyPair.prototype.getSecret = function(enc) {\n return assert(this._secret, \"KeyPair is public only\"), utils.encode(this.secret(), enc);\n }, KeyPair.prototype.getPublic = function(enc) {\n return utils.encode(this.pubBytes(), enc);\n }, module.exports = KeyPair;\n }\n}), require_signature2 = __commonJS({\n \"node_modules/elliptic/lib/elliptic/eddsa/signature.js\"(exports, module) {\n var BN = require_bn4(), utils = require_utils3(), assert = utils.assert, cachedProperty = utils.cachedProperty, parseBytes = utils.parseBytes;\n function Signature(eddsa, sig) {\n this.eddsa = eddsa, typeof sig != \"object\" && (sig = parseBytes(sig)), @Array.isArray(sig) && (sig = {\n R: sig.slice(0, eddsa.encodingLength),\n S: sig.slice(eddsa.encodingLength)\n }), assert(sig.R && sig.S, \"Signature without R or S\"), eddsa.isPoint(sig.R) && (this._R = sig.R), sig.S instanceof BN && (this._S = sig.S), this._Rencoded = @Array.isArray(sig.R) \? sig.R : sig.Rencoded, this._Sencoded = @Array.isArray(sig.S) \? sig.S : sig.Sencoded;\n }\n Signature.prototype = {}, cachedProperty(Signature, \"S\", function() {\n return this.eddsa.decodeInt(this.Sencoded());\n }), cachedProperty(Signature, \"R\", function() {\n return this.eddsa.decodePoint(this.Rencoded());\n }), cachedProperty(Signature, \"Rencoded\", function() {\n return this.eddsa.encodePoint(this.R());\n }), cachedProperty(Signature, \"Sencoded\", function() {\n return this.eddsa.encodeInt(this.S());\n }), Signature.prototype.toBytes = function() {\n return this.Rencoded().concat(this.Sencoded());\n }, Signature.prototype.toHex = function() {\n return utils.encode(this.toBytes(), \"hex\").toUpperCase();\n }, module.exports = Signature;\n }\n}), require_eddsa = __commonJS({\n \"node_modules/elliptic/lib/elliptic/eddsa/index.js\"(exports, module) {\n var hash = require_hash2(), curves = require_curves(), utils = require_utils3(), assert = utils.assert, parseBytes = utils.parseBytes, KeyPair = require_key2(), Signature = require_signature2();\n function EDDSA(curve) {\n if (assert(curve === \"ed25519\", \"only tested with ed25519 so far\"), !(this instanceof EDDSA))\n return new EDDSA(curve);\n curve = curves[curve].curve, this.curve = curve, this.g = curve.g, this.g.precompute(curve.n.bitLength() + 1), this.pointClass = curve.point().constructor, this.encodingLength = Math.ceil(curve.n.bitLength() / 8), this.hash = hash.sha512;\n }\n EDDSA.prototype = {}, module.exports = EDDSA, EDDSA.prototype.sign = function(message, secret) {\n message = parseBytes(message);\n var key2 = this.keyFromSecret(secret), r = this.hashInt(key2.messagePrefix(), message), R = this.g.mul(r), Rencoded = this.encodePoint(R), s_ = this.hashInt(Rencoded, key2.pubBytes(), message).mul(key2.priv()), S = r.add(s_).umod(this.curve.n);\n return this.makeSignature({ R, S, Rencoded });\n }, EDDSA.prototype.verify = function(message, sig, pub) {\n message = parseBytes(message), sig = this.makeSignature(sig);\n var key2 = this.keyFromPublic(pub), h = this.hashInt(sig.Rencoded(), key2.pubBytes(), message), SG = this.g.mul(sig.S()), RplusAh = sig.R().add(key2.pub().mul(h));\n return RplusAh.eq(SG);\n }, EDDSA.prototype.hashInt = function() {\n for (var hash2 = this.hash(), i = 0;i < arguments.length; i++)\n hash2.update(arguments[i]);\n return utils.intFromLE(hash2.digest()).umod(this.curve.n);\n }, EDDSA.prototype.keyFromPublic = function(pub) {\n return KeyPair.fromPublic(this, pub);\n }, EDDSA.prototype.keyFromSecret = function(secret) {\n return KeyPair.fromSecret(this, secret);\n }, EDDSA.prototype.makeSignature = function(sig) {\n return sig instanceof Signature \? sig : new Signature(this, sig);\n }, EDDSA.prototype.encodePoint = function(point) {\n var enc = point.getY().toArray(\"le\", this.encodingLength);\n return enc[this.encodingLength - 1] |= point.getX().isOdd() \? 128 : 0, enc;\n }, EDDSA.prototype.decodePoint = function(bytes) {\n bytes = utils.parseBytes(bytes);\n var lastIx = bytes.length - 1, normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & -129), xIsOdd = (bytes[lastIx] & 128) !== 0, y = utils.intFromLE(normed);\n return this.curve.pointFromY(y, xIsOdd);\n }, EDDSA.prototype.encodeInt = function(num) {\n return num.toArray(\"le\", this.encodingLength);\n }, EDDSA.prototype.decodeInt = function(bytes) {\n return utils.intFromLE(bytes);\n }, EDDSA.prototype.isPoint = function(val) {\n return val instanceof this.pointClass;\n };\n }\n}), require_elliptic = __commonJS({\n \"node_modules/elliptic/lib/elliptic.js\"(exports) {\n var elliptic = exports;\n elliptic.version = require_package().version, elliptic.utils = require_utils3(), elliptic.rand = require_brorand(), elliptic.curve = require_curve(), elliptic.curves = require_curves(), elliptic.ec = require_ec(), elliptic.eddsa = require_eddsa();\n }\n}), require_bn5 = require_bn, require_safer = __commonJS({\n \"node_modules/safer-buffer/safer.js\"(exports, module) {\n var buffer = BufferModule, Buffer2 = Buffer, safer = {}, key2;\n for (key2 in buffer)\n !buffer.hasOwnProperty(key2) || key2 === \"SlowBuffer\" || key2 === \"Buffer\" || (safer[key2] = buffer[key2]);\n var Safer = safer.Buffer = {};\n for (key2 in Buffer2)\n !Buffer2.hasOwnProperty(key2) || key2 === \"allocUnsafe\" || key2 === \"allocUnsafeSlow\" || (Safer[key2] = Buffer2[key2]);\n if (safer.Buffer.prototype = Buffer2.prototype, (!Safer.from || Safer.from === @Uint8Array.from) && (Safer.from = function(value, encodingOrOffset, length) {\n if (typeof value == \"number\")\n @throwTypeError('The \"value\" argument must not be of type number. Received type ' + typeof value);\n if (value && typeof value.length > \"u\")\n @throwTypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \" + typeof value);\n return Buffer2(value, encodingOrOffset, length);\n }), Safer.alloc || (Safer.alloc = function(size, fill, encoding) {\n if (typeof size != \"number\")\n @throwTypeError('The \"size\" argument must be of type number. Received type ' + typeof size);\n if (size < 0 || size >= 2 * (1 << 30))\n @throwRangeError('The value \"' + size + '\" is invalid for option \"size\"');\n var buf = Buffer2(size);\n return !fill || fill.length === 0 \? buf.fill(0) : typeof encoding == \"string\" \? buf.fill(fill, encoding) : buf.fill(fill), buf;\n }), !safer.kStringMaxLength)\n try {\n safer.kStringMaxLength = MAX_STRING_LENGTH;\n } catch {\n }\n safer.constants || (safer.constants = {\n MAX_LENGTH: safer.kMaxLength\n }, safer.kStringMaxLength && (safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength)), module.exports = safer;\n }\n}), require_reporter = __commonJS({\n \"node_modules/asn1.js/lib/asn1/base/reporter.js\"(exports) {\n var inherits = require_inherits_browser();\n function Reporter(options) {\n this._reporterState = {\n obj: null,\n path: [],\n options: options || {},\n errors: []\n };\n }\n Reporter.prototype = {}, exports.Reporter = Reporter, Reporter.prototype.isError = function(obj) {\n return obj instanceof ReporterError;\n }, Reporter.prototype.save = function() {\n let state = this._reporterState;\n return { obj: state.obj, pathLen: state.path.length };\n }, Reporter.prototype.restore = function(data) {\n let state = this._reporterState;\n state.obj = data.obj, state.path = state.path.slice(0, data.pathLen);\n }, Reporter.prototype.enterKey = function(key2) {\n return this._reporterState.path.push(key2);\n }, Reporter.prototype.exitKey = function(index) {\n let state = this._reporterState;\n state.path = state.path.slice(0, index - 1);\n }, Reporter.prototype.leaveKey = function(index, key2, value) {\n let state = this._reporterState;\n this.exitKey(index), state.obj !== null && (state.obj[key2] = value);\n }, Reporter.prototype.path = function() {\n return this._reporterState.path.join(\"/\");\n }, Reporter.prototype.enterObject = function() {\n let state = this._reporterState, prev = state.obj;\n return state.obj = {}, prev;\n }, Reporter.prototype.leaveObject = function(prev) {\n let state = this._reporterState, now = state.obj;\n return state.obj = prev, now;\n }, Reporter.prototype.error = function(msg) {\n let err, state = this._reporterState, inherited = msg instanceof ReporterError;\n if (inherited \? err = msg : err = new ReporterError(state.path.map(function(elem) {\n return \"[\" + JSON.stringify(elem) + \"]\";\n }).join(\"\"), msg.message || msg, msg.stack), !state.options.partial)\n throw err;\n return inherited || state.errors.push(err), err;\n }, Reporter.prototype.wrapResult = function(result) {\n let state = this._reporterState;\n return state.options.partial \? {\n result: this.isError(result) \? null : result,\n errors: state.errors\n } : result;\n };\n function ReporterError(path, msg) {\n this.path = path, this.rethrow(msg);\n }\n inherits(ReporterError, Error), ReporterError.prototype.rethrow = function(msg) {\n if (this.message = msg + \" at: \" + (this.path || \"(shallow)\"), Error.captureStackTrace && Error.captureStackTrace(this, ReporterError), !this.stack)\n try {\n throw new Error(this.message);\n } catch (e) {\n this.stack = e.stack;\n }\n return this;\n };\n }\n}), require_buffer = __commonJS({\n \"node_modules/asn1.js/lib/asn1/base/buffer.js\"(exports) {\n var inherits = require_inherits_browser(), Reporter = require_reporter().Reporter, Buffer2 = require_safer().Buffer;\n function DecoderBuffer(base, options) {\n if (Reporter.@call(this, options), !Buffer2.isBuffer(base)) {\n this.error(\"Input not Buffer\");\n return;\n }\n this.base = base, this.offset = 0, this.length = base.length;\n }\n inherits(DecoderBuffer, Reporter), exports.DecoderBuffer = DecoderBuffer, DecoderBuffer.isDecoderBuffer = function(data) {\n return data instanceof DecoderBuffer \? !0 : typeof data == \"object\" && Buffer2.isBuffer(data.base) && data.constructor.name === \"DecoderBuffer\" && typeof data.offset == \"number\" && typeof data.length == \"number\" && typeof data.save == \"function\" && typeof data.restore == \"function\" && typeof data.isEmpty == \"function\" && typeof data.readUInt8 == \"function\" && typeof data.skip == \"function\" && typeof data.raw == \"function\";\n }, DecoderBuffer.prototype.save = function() {\n return {\n offset: this.offset,\n reporter: Reporter.prototype.save.@call(this)\n };\n }, DecoderBuffer.prototype.restore = function(save) {\n let res = new DecoderBuffer(this.base);\n return res.offset = save.offset, res.length = this.offset, this.offset = save.offset, Reporter.prototype.restore.@call(this, save.reporter), res;\n }, DecoderBuffer.prototype.isEmpty = function() {\n return this.offset === this.length;\n }, DecoderBuffer.prototype.readUInt8 = function(fail) {\n return this.offset + 1 <= this.length \? this.base.readUInt8(this.offset++, !0) : this.error(fail || \"DecoderBuffer overrun\");\n }, DecoderBuffer.prototype.skip = function(bytes, fail) {\n if (!(this.offset + bytes <= this.length))\n return this.error(fail || \"DecoderBuffer overrun\");\n let res = new DecoderBuffer(this.base);\n return res._reporterState = this._reporterState, res.offset = this.offset, res.length = this.offset + bytes, this.offset += bytes, res;\n }, DecoderBuffer.prototype.raw = function(save) {\n return this.base.slice(save \? save.offset : this.offset, this.length);\n };\n function EncoderBuffer(value, reporter) {\n if (@Array.isArray(value))\n this.length = 0, this.value = value.map(function(item) {\n return EncoderBuffer.isEncoderBuffer(item) || (item = new EncoderBuffer(item, reporter)), this.length += item.length, item;\n }, this);\n else if (typeof value == \"number\") {\n if (!(0 <= value && value <= 255))\n return reporter.error(\"non-byte EncoderBuffer value\");\n this.value = value, this.length = 1;\n } else if (typeof value == \"string\")\n this.value = value, this.length = Buffer2.byteLength(value);\n else if (Buffer2.isBuffer(value))\n this.value = value, this.length = value.length;\n else\n return reporter.error(\"Unsupported type: \" + typeof value);\n }\n EncoderBuffer.prototype = {}, exports.EncoderBuffer = EncoderBuffer, EncoderBuffer.isEncoderBuffer = function(data) {\n return data instanceof EncoderBuffer \? !0 : typeof data == \"object\" && data.constructor.name === \"EncoderBuffer\" && typeof data.length == \"number\" && typeof data.join == \"function\";\n }, EncoderBuffer.prototype.join = function(out, offset) {\n return out || (out = Buffer2.alloc(this.length)), offset || (offset = 0), this.length === 0 || (@Array.isArray(this.value) \? this.value.forEach(function(item) {\n item.join(out, offset), offset += item.length;\n }) : (typeof this.value == \"number\" \? out[offset] = this.value : typeof this.value == \"string\" \? out.write(this.value, offset) : Buffer2.isBuffer(this.value) && this.value.copy(out, offset), offset += this.length)), out;\n };\n }\n}), require_node = __commonJS({\n \"node_modules/asn1.js/lib/asn1/base/node.js\"(exports, module) {\n var Reporter = require_reporter().Reporter, EncoderBuffer = require_buffer().EncoderBuffer, DecoderBuffer = require_buffer().DecoderBuffer, assert = require_minimalistic_assert(), tags = [\n \"seq\",\n \"seqof\",\n \"set\",\n \"setof\",\n \"objid\",\n \"bool\",\n \"gentime\",\n \"utctime\",\n \"null_\",\n \"enum\",\n \"int\",\n \"objDesc\",\n \"bitstr\",\n \"bmpstr\",\n \"charstr\",\n \"genstr\",\n \"graphstr\",\n \"ia5str\",\n \"iso646str\",\n \"numstr\",\n \"octstr\",\n \"printstr\",\n \"t61str\",\n \"unistr\",\n \"utf8str\",\n \"videostr\"\n ], methods = [\"key\", \"obj\", \"use\", \"optional\", \"explicit\", \"implicit\", \"def\", \"choice\", \"any\", \"contains\"].concat(tags), overrided = [\n \"_peekTag\",\n \"_decodeTag\",\n \"_use\",\n \"_decodeStr\",\n \"_decodeObjid\",\n \"_decodeTime\",\n \"_decodeNull\",\n \"_decodeInt\",\n \"_decodeBool\",\n \"_decodeList\",\n \"_encodeComposite\",\n \"_encodeStr\",\n \"_encodeObjid\",\n \"_encodeTime\",\n \"_encodeNull\",\n \"_encodeInt\",\n \"_encodeBool\"\n ];\n function Node(enc, parent, name) {\n let state = {};\n this._baseState = state, state.name = name, state.enc = enc, state.parent = parent || null, state.children = null, state.tag = null, state.args = null, state.reverseArgs = null, state.choice = null, state.optional = !1, state.any = !1, state.obj = !1, state.use = null, state.useDecoder = null, state.key = null, state.default = null, state.explicit = null, state.implicit = null, state.contains = null, state.parent || (state.children = [], this._wrap());\n }\n Node.prototype = {}, module.exports = Node;\n var stateProps = [\n \"enc\",\n \"parent\",\n \"children\",\n \"tag\",\n \"args\",\n \"reverseArgs\",\n \"choice\",\n \"optional\",\n \"any\",\n \"obj\",\n \"use\",\n \"alteredUse\",\n \"key\",\n \"default\",\n \"explicit\",\n \"implicit\",\n \"contains\"\n ];\n Node.prototype.clone = function() {\n let state = this._baseState, cstate = {};\n stateProps.forEach(function(prop) {\n cstate[prop] = state[prop];\n });\n let res = new this.constructor(cstate.parent);\n return res._baseState = cstate, res;\n }, Node.prototype._wrap = function() {\n let state = this._baseState;\n methods.forEach(function(method) {\n this[method] = function() {\n let clone = new this.constructor(this);\n return state.children.push(clone), clone[method].@apply(clone, arguments);\n };\n }, this);\n }, Node.prototype._init = function(body) {\n let state = this._baseState;\n assert(state.parent === null), body.@call(this), state.children = state.children.filter(function(child) {\n return child._baseState.parent === this;\n }, this), assert.equal(state.children.length, 1, \"Root node can have only one child\");\n }, Node.prototype._useArgs = function(args) {\n let state = this._baseState, children = args.filter(function(arg) {\n return arg instanceof this.constructor;\n }, this);\n args = args.filter(function(arg) {\n return !(arg instanceof this.constructor);\n }, this), children.length !== 0 && (assert(state.children === null), state.children = children, children.forEach(function(child) {\n child._baseState.parent = this;\n }, this)), args.length !== 0 && (assert(state.args === null), state.args = args, state.reverseArgs = args.map(function(arg) {\n if (typeof arg != \"object\" || arg.constructor !== Object)\n return arg;\n let res = {};\n return Object.keys(arg).forEach(function(key2) {\n key2 == (key2 | 0) && (key2 |= 0);\n let value = arg[key2];\n res[value] = key2;\n }), res;\n }));\n }, overrided.forEach(function(method) {\n Node.prototype[method] = function() {\n let state = this._baseState;\n throw new Error(method + \" not implemented for encoding: \" + state.enc);\n };\n }), tags.forEach(function(tag) {\n Node.prototype[tag] = function() {\n let state = this._baseState, args = @Array.prototype.slice.@call(arguments);\n return assert(state.tag === null), state.tag = tag, this._useArgs(args), this;\n };\n }), Node.prototype.use = function(item) {\n assert(item);\n let state = this._baseState;\n return assert(state.use === null), state.use = item, this;\n }, Node.prototype.optional = function() {\n let state = this._baseState;\n return state.optional = !0, this;\n }, Node.prototype.def = function(val) {\n let state = this._baseState;\n return assert(state.default === null), state.default = val, state.optional = !0, this;\n }, Node.prototype.explicit = function(num) {\n let state = this._baseState;\n return assert(state.explicit === null && state.implicit === null), state.explicit = num, this;\n }, Node.prototype.implicit = function(num) {\n let state = this._baseState;\n return assert(state.explicit === null && state.implicit === null), state.implicit = num, this;\n }, Node.prototype.obj = function() {\n let state = this._baseState, args = @Array.prototype.slice.@call(arguments);\n return state.obj = !0, args.length !== 0 && this._useArgs(args), this;\n }, Node.prototype.key = function(newKey) {\n let state = this._baseState;\n return assert(state.key === null), state.key = newKey, this;\n }, Node.prototype.any = function() {\n let state = this._baseState;\n return state.any = !0, this;\n }, Node.prototype.choice = function(obj) {\n let state = this._baseState;\n return assert(state.choice === null), state.choice = obj, this._useArgs(Object.keys(obj).map(function(key2) {\n return obj[key2];\n })), this;\n }, Node.prototype.contains = function(item) {\n let state = this._baseState;\n return assert(state.use === null), state.contains = item, this;\n }, Node.prototype._decode = function(input, options) {\n let state = this._baseState;\n if (state.parent === null)\n return input.wrapResult(state.children[0]._decode(input, options));\n let result = state.default, present = !0, prevKey = null;\n if (state.key !== null && (prevKey = input.enterKey(state.key)), state.optional) {\n let tag = null;\n if (state.explicit !== null \? tag = state.explicit : state.implicit !== null \? tag = state.implicit : state.tag !== null && (tag = state.tag), tag === null && !state.any) {\n let save = input.save();\n try {\n state.choice === null \? this._decodeGeneric(state.tag, input, options) : this._decodeChoice(input, options), present = !0;\n } catch {\n present = !1;\n }\n input.restore(save);\n } else if (present = this._peekTag(input, tag, state.any), input.isError(present))\n return present;\n }\n let prevObj;\n if (state.obj && present && (prevObj = input.enterObject()), present) {\n if (state.explicit !== null) {\n let explicit = this._decodeTag(input, state.explicit);\n if (input.isError(explicit))\n return explicit;\n input = explicit;\n }\n let start = input.offset;\n if (state.use === null && state.choice === null) {\n let save;\n state.any && (save = input.save());\n let body = this._decodeTag(input, state.implicit !== null \? state.implicit : state.tag, state.any);\n if (input.isError(body))\n return body;\n state.any \? result = input.raw(save) : input = body;\n }\n if (options && options.track && state.tag !== null && options.track(input.path(), start, input.length, \"tagged\"), options && options.track && state.tag !== null && options.track(input.path(), input.offset, input.length, \"content\"), state.any || (state.choice === null \? result = this._decodeGeneric(state.tag, input, options) : result = this._decodeChoice(input, options)), input.isError(result))\n return result;\n if (!state.any && state.choice === null && state.children !== null && state.children.forEach(function(child) {\n child._decode(input, options);\n }), state.contains && (state.tag === \"octstr\" || state.tag === \"bitstr\")) {\n let data = new DecoderBuffer(result);\n result = this._getUse(state.contains, input._reporterState.obj)._decode(data, options);\n }\n }\n return state.obj && present && (result = input.leaveObject(prevObj)), state.key !== null && (result !== null || present === !0) \? input.leaveKey(prevKey, state.key, result) : prevKey !== null && input.exitKey(prevKey), result;\n }, Node.prototype._decodeGeneric = function(tag, input, options) {\n let state = this._baseState;\n return tag === \"seq\" || tag === \"set\" \? null : tag === \"seqof\" || tag === \"setof\" \? this._decodeList(input, tag, state.args[0], options) : /str$/.test(tag) \? this._decodeStr(input, tag, options) : tag === \"objid\" && state.args \? this._decodeObjid(input, state.args[0], state.args[1], options) : tag === \"objid\" \? this._decodeObjid(input, null, null, options) : tag === \"gentime\" || tag === \"utctime\" \? this._decodeTime(input, tag, options) : tag === \"null_\" \? this._decodeNull(input, options) : tag === \"bool\" \? this._decodeBool(input, options) : tag === \"objDesc\" \? this._decodeStr(input, tag, options) : tag === \"int\" || tag === \"enum\" \? this._decodeInt(input, state.args && state.args[0], options) : state.use !== null \? this._getUse(state.use, input._reporterState.obj)._decode(input, options) : input.error(\"unknown tag: \" + tag);\n }, Node.prototype._getUse = function(entity, obj) {\n let state = this._baseState;\n return state.useDecoder = this._use(entity, obj), assert(state.useDecoder._baseState.parent === null), state.useDecoder = state.useDecoder._baseState.children[0], state.implicit !== state.useDecoder._baseState.implicit && (state.useDecoder = state.useDecoder.clone(), state.useDecoder._baseState.implicit = state.implicit), state.useDecoder;\n }, Node.prototype._decodeChoice = function(input, options) {\n let state = this._baseState, result = null, match = !1;\n return Object.keys(state.choice).some(function(key2) {\n let save = input.save(), node = state.choice[key2];\n try {\n let value = node._decode(input, options);\n if (input.isError(value))\n return !1;\n result = { type: key2, value }, match = !0;\n } catch {\n return input.restore(save), !1;\n }\n return !0;\n }, this), match \? result : input.error(\"Choice not matched\");\n }, Node.prototype._createEncoderBuffer = function(data) {\n return new EncoderBuffer(data, this.reporter);\n }, Node.prototype._encode = function(data, reporter, parent) {\n let state = this._baseState;\n if (state.default !== null && state.default === data)\n return;\n let result = this._encodeValue(data, reporter, parent);\n if (result !== void 0 && !this._skipDefault(result, reporter, parent))\n return result;\n }, Node.prototype._encodeValue = function(data, reporter, parent) {\n let state = this._baseState;\n if (state.parent === null)\n return state.children[0]._encode(data, reporter || new Reporter);\n let result = null;\n if (this.reporter = reporter, state.optional && data === void 0)\n if (state.default !== null)\n data = state.default;\n else\n return;\n let content = null, primitive = !1;\n if (state.any)\n result = this._createEncoderBuffer(data);\n else if (state.choice)\n result = this._encodeChoice(data, reporter);\n else if (state.contains)\n content = this._getUse(state.contains, parent)._encode(data, reporter), primitive = !0;\n else if (state.children)\n content = state.children.map(function(child) {\n if (child._baseState.tag === \"null_\")\n return child._encode(null, reporter, data);\n if (child._baseState.key === null)\n return reporter.error(\"Child should have a key\");\n let prevKey = reporter.enterKey(child._baseState.key);\n if (typeof data != \"object\")\n return reporter.error(\"Child expected, but input is not object\");\n let res = child._encode(data[child._baseState.key], reporter, data);\n return reporter.leaveKey(prevKey), res;\n }, this).filter(function(child) {\n return child;\n }), content = this._createEncoderBuffer(content);\n else if (state.tag === \"seqof\" || state.tag === \"setof\") {\n if (!(state.args && state.args.length === 1))\n return reporter.error(\"Too many args for : \" + state.tag);\n if (!@Array.isArray(data))\n return reporter.error(\"seqof/setof, but data is not Array\");\n let child = this.clone();\n child._baseState.implicit = null, content = this._createEncoderBuffer(data.map(function(item) {\n let state2 = this._baseState;\n return this._getUse(state2.args[0], data)._encode(item, reporter);\n }, child));\n } else\n state.use !== null \? result = this._getUse(state.use, parent)._encode(data, reporter) : (content = this._encodePrimitive(state.tag, data), primitive = !0);\n if (!state.any && state.choice === null) {\n let tag = state.implicit !== null \? state.implicit : state.tag, cls = state.implicit === null \? \"universal\" : \"context\";\n tag === null \? state.use === null && reporter.error(\"Tag could be omitted only for .use()\") : state.use === null && (result = this._encodeComposite(tag, primitive, cls, content));\n }\n return state.explicit !== null && (result = this._encodeComposite(state.explicit, !1, \"context\", result)), result;\n }, Node.prototype._encodeChoice = function(data, reporter) {\n let state = this._baseState, node = state.choice[data.type];\n return node || assert(!1, data.type + \" not found in \" + JSON.stringify(Object.keys(state.choice))), node._encode(data.value, reporter);\n }, Node.prototype._encodePrimitive = function(tag, data) {\n let state = this._baseState;\n if (/str$/.test(tag))\n return this._encodeStr(data, tag);\n if (tag === \"objid\" && state.args)\n return this._encodeObjid(data, state.reverseArgs[0], state.args[1]);\n if (tag === \"objid\")\n return this._encodeObjid(data, null, null);\n if (tag === \"gentime\" || tag === \"utctime\")\n return this._encodeTime(data, tag);\n if (tag === \"null_\")\n return this._encodeNull();\n if (tag === \"int\" || tag === \"enum\")\n return this._encodeInt(data, state.args && state.reverseArgs[0]);\n if (tag === \"bool\")\n return this._encodeBool(data);\n if (tag === \"objDesc\")\n return this._encodeStr(data, tag);\n throw new Error(\"Unsupported tag: \" + tag);\n }, Node.prototype._isNumstr = function(str) {\n return /^[0-9 ]*$/.test(str);\n }, Node.prototype._isPrintstr = function(str) {\n return /^[A-Za-z0-9 '()+,-./:=\?]*$/.test(str);\n };\n }\n}), require_der = __commonJS({\n \"node_modules/asn1.js/lib/asn1/constants/der.js\"(exports) {\n function reverse(map) {\n let res = {};\n return Object.keys(map).forEach(function(key2) {\n (key2 | 0) == key2 && (key2 = key2 | 0);\n let value = map[key2];\n res[value] = key2;\n }), res;\n }\n exports.tagClass = {\n 0: \"universal\",\n 1: \"application\",\n 2: \"context\",\n 3: \"private\"\n }, exports.tagClassByName = reverse(exports.tagClass), exports.tag = {\n 0: \"end\",\n 1: \"bool\",\n 2: \"int\",\n 3: \"bitstr\",\n 4: \"octstr\",\n 5: \"null_\",\n 6: \"objid\",\n 7: \"objDesc\",\n 8: \"external\",\n 9: \"real\",\n 10: \"enum\",\n 11: \"embed\",\n 12: \"utf8str\",\n 13: \"relativeOid\",\n 16: \"seq\",\n 17: \"set\",\n 18: \"numstr\",\n 19: \"printstr\",\n 20: \"t61str\",\n 21: \"videostr\",\n 22: \"ia5str\",\n 23: \"utctime\",\n 24: \"gentime\",\n 25: \"graphstr\",\n 26: \"iso646str\",\n 27: \"genstr\",\n 28: \"unistr\",\n 29: \"charstr\",\n 30: \"bmpstr\"\n }, exports.tagByName = reverse(exports.tag);\n }\n}), require_der2 = __commonJS({\n \"node_modules/asn1.js/lib/asn1/encoders/der.js\"(exports, module) {\n var inherits = require_inherits_browser(), Buffer2 = require_safer().Buffer, Node = require_node(), der = require_der();\n function DEREncoder(entity) {\n this.enc = \"der\", this.name = entity.name, this.entity = entity, this.tree = new DERNode, this.tree._init(entity.body);\n }\n DEREncoder.prototype = {}, module.exports = DEREncoder, DEREncoder.prototype.encode = function(data, reporter) {\n return this.tree._encode(data, reporter).join();\n };\n function DERNode(parent) {\n Node.@call(this, \"der\", parent);\n }\n inherits(DERNode, Node), DERNode.prototype._encodeComposite = function(tag, primitive, cls, content) {\n let encodedTag = encodeTag(tag, primitive, cls, this.reporter);\n if (content.length < 128) {\n let header2 = Buffer2.alloc(2);\n return header2[0] = encodedTag, header2[1] = content.length, this._createEncoderBuffer([header2, content]);\n }\n let lenOctets = 1;\n for (let i = content.length;i >= 256; i >>= 8)\n lenOctets++;\n let header = Buffer2.alloc(2 + lenOctets);\n header[0] = encodedTag, header[1] = 128 | lenOctets;\n for (let i = 1 + lenOctets, j = content.length;j > 0; i--, j >>= 8)\n header[i] = j & 255;\n return this._createEncoderBuffer([header, content]);\n }, DERNode.prototype._encodeStr = function(str, tag) {\n if (tag === \"bitstr\")\n return this._createEncoderBuffer([str.unused | 0, str.data]);\n if (tag === \"bmpstr\") {\n let buf = Buffer2.alloc(str.length * 2);\n for (let i = 0;i < str.length; i++)\n buf.writeUInt16BE(str.charCodeAt(i), i * 2);\n return this._createEncoderBuffer(buf);\n } else\n return tag === \"numstr\" \? this._isNumstr(str) \? this._createEncoderBuffer(str) : this.reporter.error(\"Encoding of string type: numstr supports only digits and space\") : tag === \"printstr\" \? this._isPrintstr(str) \? this._createEncoderBuffer(str) : this.reporter.error(\"Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark\") : /str$/.test(tag) \? this._createEncoderBuffer(str) : tag === \"objDesc\" \? this._createEncoderBuffer(str) : this.reporter.error(\"Encoding of string type: \" + tag + \" unsupported\");\n }, DERNode.prototype._encodeObjid = function(id, values, relative) {\n if (typeof id == \"string\") {\n if (!values)\n return this.reporter.error(\"string objid given, but no values map found\");\n if (!values.hasOwnProperty(id))\n return this.reporter.error(\"objid not found in values map\");\n id = values[id].split(/[\\s.]+/g);\n for (let i = 0;i < id.length; i++)\n id[i] |= 0;\n } else if (@Array.isArray(id)) {\n id = id.slice();\n for (let i = 0;i < id.length; i++)\n id[i] |= 0;\n }\n if (!@Array.isArray(id))\n return this.reporter.error(\"objid() should be either array or string, got: \" + JSON.stringify(id));\n if (!relative) {\n if (id[1] >= 40)\n return this.reporter.error(\"Second objid identifier OOB\");\n id.splice(0, 2, id[0] * 40 + id[1]);\n }\n let size = 0;\n for (let i = 0;i < id.length; i++) {\n let ident = id[i];\n for (size++;ident >= 128; ident >>= 7)\n size++;\n }\n let objid = Buffer2.alloc(size), offset = objid.length - 1;\n for (let i = id.length - 1;i >= 0; i--) {\n let ident = id[i];\n for (objid[offset--] = ident & 127;(ident >>= 7) > 0; )\n objid[offset--] = 128 | ident & 127;\n }\n return this._createEncoderBuffer(objid);\n };\n function two(num) {\n return num < 10 \? \"0\" + num : num;\n }\n DERNode.prototype._encodeTime = function(time, tag) {\n let str, date = new Date(time);\n return tag === \"gentime\" \? str = [\n two(date.getUTCFullYear()),\n two(date.getUTCMonth() + 1),\n two(date.getUTCDate()),\n two(date.getUTCHours()),\n two(date.getUTCMinutes()),\n two(date.getUTCSeconds()),\n \"Z\"\n ].join(\"\") : tag === \"utctime\" \? str = [\n two(date.getUTCFullYear() % 100),\n two(date.getUTCMonth() + 1),\n two(date.getUTCDate()),\n two(date.getUTCHours()),\n two(date.getUTCMinutes()),\n two(date.getUTCSeconds()),\n \"Z\"\n ].join(\"\") : this.reporter.error(\"Encoding \" + tag + \" time is not supported yet\"), this._encodeStr(str, \"octstr\");\n }, DERNode.prototype._encodeNull = function() {\n return this._createEncoderBuffer(\"\");\n }, DERNode.prototype._encodeInt = function(num, values) {\n if (typeof num == \"string\") {\n if (!values)\n return this.reporter.error(\"String int or enum given, but no values map\");\n if (!values.hasOwnProperty(num))\n return this.reporter.error(\"Values map doesn't contain: \" + JSON.stringify(num));\n num = values[num];\n }\n if (typeof num != \"number\" && !Buffer2.isBuffer(num)) {\n let numArray = num.toArray();\n !num.sign && numArray[0] & 128 && numArray.unshift(0), num = Buffer2.from(numArray);\n }\n if (Buffer2.isBuffer(num)) {\n let size2 = num.length;\n num.length === 0 && size2++;\n let out2 = Buffer2.alloc(size2);\n return num.copy(out2), num.length === 0 && (out2[0] = 0), this._createEncoderBuffer(out2);\n }\n if (num < 128)\n return this._createEncoderBuffer(num);\n if (num < 256)\n return this._createEncoderBuffer([0, num]);\n let size = 1;\n for (let i = num;i >= 256; i >>= 8)\n size++;\n let out = new @Array(size);\n for (let i = out.length - 1;i >= 0; i--)\n out[i] = num & 255, num >>= 8;\n return out[0] & 128 && out.unshift(0), this._createEncoderBuffer(Buffer2.from(out));\n }, DERNode.prototype._encodeBool = function(value) {\n return this._createEncoderBuffer(value \? 255 : 0);\n }, DERNode.prototype._use = function(entity, obj) {\n return typeof entity == \"function\" && (entity = entity(obj)), entity._getEncoder(\"der\").tree;\n }, DERNode.prototype._skipDefault = function(dataBuffer, reporter, parent) {\n let state = this._baseState, i;\n if (state.default === null)\n return !1;\n let data = dataBuffer.join();\n if (state.defaultBuffer === void 0 && (state.defaultBuffer = this._encodeValue(state.default, reporter, parent).join()), data.length !== state.defaultBuffer.length)\n return !1;\n for (i = 0;i < data.length; i++)\n if (data[i] !== state.defaultBuffer[i])\n return !1;\n return !0;\n };\n function encodeTag(tag, primitive, cls, reporter) {\n let res;\n if (tag === \"seqof\" \? tag = \"seq\" : tag === \"setof\" && (tag = \"set\"), der.tagByName.hasOwnProperty(tag))\n res = der.tagByName[tag];\n else if (typeof tag == \"number\" && (tag | 0) === tag)\n res = tag;\n else\n return reporter.error(\"Unknown tag: \" + tag);\n return res >= 31 \? reporter.error(\"Multi-octet tag encoding unsupported\") : (primitive || (res |= 32), res |= der.tagClassByName[cls || \"universal\"] << 6, res);\n }\n }\n}), require_pem = __commonJS({\n \"node_modules/asn1.js/lib/asn1/encoders/pem.js\"(exports, module) {\n var inherits = require_inherits_browser(), DEREncoder = require_der2();\n function PEMEncoder(entity) {\n DEREncoder.@call(this, entity), this.enc = \"pem\";\n }\n inherits(PEMEncoder, DEREncoder), module.exports = PEMEncoder, PEMEncoder.prototype.encode = function(data, options) {\n let p = DEREncoder.prototype.encode.@call(this, data).toString(\"base64\"), out = [\"-----BEGIN \" + options.label + \"-----\"];\n for (let i = 0;i < p.length; i += 64)\n out.push(p.slice(i, i + 64));\n return out.push(\"-----END \" + options.label + \"-----\"), out.join(`\n`);\n };\n }\n}), require_encoders = __commonJS({\n \"node_modules/asn1.js/lib/asn1/encoders/index.js\"(exports) {\n var encoders = exports;\n encoders.der = require_der2(), encoders.pem = require_pem();\n }\n}), require_der3 = __commonJS({\n \"node_modules/asn1.js/lib/asn1/decoders/der.js\"(exports, module) {\n var inherits = require_inherits_browser(), bignum = require_bn5(), DecoderBuffer = require_buffer().DecoderBuffer, Node = require_node(), der = require_der();\n function DERDecoder(entity) {\n this.enc = \"der\", this.name = entity.name, this.entity = entity, this.tree = new DERNode, this.tree._init(entity.body);\n }\n DERDecoder.prototype = {}, module.exports = DERDecoder, DERDecoder.prototype.decode = function(data, options) {\n return DecoderBuffer.isDecoderBuffer(data) || (data = new DecoderBuffer(data, options)), this.tree._decode(data, options);\n };\n function DERNode(parent) {\n Node.@call(this, \"der\", parent);\n }\n inherits(DERNode, Node), DERNode.prototype._peekTag = function(buffer, tag, any) {\n if (buffer.isEmpty())\n return !1;\n let state = buffer.save(), decodedTag = derDecodeTag(buffer, 'Failed to peek tag: \"' + tag + '\"');\n return buffer.isError(decodedTag) \? decodedTag : (buffer.restore(state), decodedTag.tag === tag || decodedTag.tagStr === tag || decodedTag.tagStr + \"of\" === tag || any);\n }, DERNode.prototype._decodeTag = function(buffer, tag, any) {\n let decodedTag = derDecodeTag(buffer, 'Failed to decode tag of \"' + tag + '\"');\n if (buffer.isError(decodedTag))\n return decodedTag;\n let len = derDecodeLen(buffer, decodedTag.primitive, 'Failed to get length of \"' + tag + '\"');\n if (buffer.isError(len))\n return len;\n if (!any && decodedTag.tag !== tag && decodedTag.tagStr !== tag && decodedTag.tagStr + \"of\" !== tag)\n return buffer.error('Failed to match tag: \"' + tag + '\"');\n if (decodedTag.primitive || len !== null)\n return buffer.skip(len, 'Failed to match body of: \"' + tag + '\"');\n let state = buffer.save(), res = this._skipUntilEnd(buffer, 'Failed to skip indefinite length body: \"' + this.tag + '\"');\n return buffer.isError(res) \? res : (len = buffer.offset - state.offset, buffer.restore(state), buffer.skip(len, 'Failed to match body of: \"' + tag + '\"'));\n }, DERNode.prototype._skipUntilEnd = function(buffer, fail) {\n for (;; ) {\n let tag = derDecodeTag(buffer, fail);\n if (buffer.isError(tag))\n return tag;\n let len = derDecodeLen(buffer, tag.primitive, fail);\n if (buffer.isError(len))\n return len;\n let res;\n if (tag.primitive || len !== null \? res = buffer.skip(len) : res = this._skipUntilEnd(buffer, fail), buffer.isError(res))\n return res;\n if (tag.tagStr === \"end\")\n break;\n }\n }, DERNode.prototype._decodeList = function(buffer, tag, decoder, options) {\n let result = [];\n for (;!buffer.isEmpty(); ) {\n let possibleEnd = this._peekTag(buffer, \"end\");\n if (buffer.isError(possibleEnd))\n return possibleEnd;\n let res = decoder.decode(buffer, \"der\", options);\n if (buffer.isError(res) && possibleEnd)\n break;\n result.push(res);\n }\n return result;\n }, DERNode.prototype._decodeStr = function(buffer, tag) {\n if (tag === \"bitstr\") {\n let unused = buffer.readUInt8();\n return buffer.isError(unused) \? unused : { unused, data: buffer.raw() };\n } else if (tag === \"bmpstr\") {\n let raw = buffer.raw();\n if (raw.length % 2 === 1)\n return buffer.error(\"Decoding of string type: bmpstr length mismatch\");\n let str = \"\";\n for (let i = 0;i < raw.length / 2; i++)\n str += @String.fromCharCode(raw.readUInt16BE(i * 2));\n return str;\n } else if (tag === \"numstr\") {\n let numstr = buffer.raw().toString(\"ascii\");\n return this._isNumstr(numstr) \? numstr : buffer.error(\"Decoding of string type: numstr unsupported characters\");\n } else {\n if (tag === \"octstr\")\n return buffer.raw();\n if (tag === \"objDesc\")\n return buffer.raw();\n if (tag === \"printstr\") {\n let printstr = buffer.raw().toString(\"ascii\");\n return this._isPrintstr(printstr) \? printstr : buffer.error(\"Decoding of string type: printstr unsupported characters\");\n } else\n return /str$/.test(tag) \? buffer.raw().toString() : buffer.error(\"Decoding of string type: \" + tag + \" unsupported\");\n }\n }, DERNode.prototype._decodeObjid = function(buffer, values, relative) {\n let result, identifiers = [], ident = 0, subident = 0;\n for (;!buffer.isEmpty(); )\n subident = buffer.readUInt8(), ident <<= 7, ident |= subident & 127, (subident & 128) === 0 && (identifiers.push(ident), ident = 0);\n subident & 128 && identifiers.push(ident);\n let first = identifiers[0] / 40 | 0, second = identifiers[0] % 40;\n if (relative \? result = identifiers : result = [first, second].concat(identifiers.slice(1)), values) {\n let tmp = values[result.join(\" \")];\n tmp === void 0 && (tmp = values[result.join(\".\")]), tmp !== void 0 && (result = tmp);\n }\n return result;\n }, DERNode.prototype._decodeTime = function(buffer, tag) {\n let str = buffer.raw().toString(), year, mon, day, hour, min, sec;\n if (tag === \"gentime\")\n year = str.slice(0, 4) | 0, mon = str.slice(4, 6) | 0, day = str.slice(6, 8) | 0, hour = str.slice(8, 10) | 0, min = str.slice(10, 12) | 0, sec = str.slice(12, 14) | 0;\n else if (tag === \"utctime\")\n year = str.slice(0, 2) | 0, mon = str.slice(2, 4) | 0, day = str.slice(4, 6) | 0, hour = str.slice(6, 8) | 0, min = str.slice(8, 10) | 0, sec = str.slice(10, 12) | 0, year < 70 \? year = 2000 + year : year = 1900 + year;\n else\n return buffer.error(\"Decoding \" + tag + \" time is not supported yet\");\n return Date.UTC(year, mon - 1, day, hour, min, sec, 0);\n }, DERNode.prototype._decodeNull = function() {\n return null;\n }, DERNode.prototype._decodeBool = function(buffer) {\n let res = buffer.readUInt8();\n return buffer.isError(res) \? res : res !== 0;\n }, DERNode.prototype._decodeInt = function(buffer, values) {\n let raw = buffer.raw(), res = new bignum(raw);\n return values && (res = values[res.toString(10)] || res), res;\n }, DERNode.prototype._use = function(entity, obj) {\n return typeof entity == \"function\" && (entity = entity(obj)), entity._getDecoder(\"der\").tree;\n };\n function derDecodeTag(buf, fail) {\n let tag = buf.readUInt8(fail);\n if (buf.isError(tag))\n return tag;\n let cls = der.tagClass[tag >> 6], primitive = (tag & 32) === 0;\n if ((tag & 31) === 31) {\n let oct = tag;\n for (tag = 0;(oct & 128) === 128; ) {\n if (oct = buf.readUInt8(fail), buf.isError(oct))\n return oct;\n tag <<= 7, tag |= oct & 127;\n }\n } else\n tag &= 31;\n let tagStr = der.tag[tag];\n return {\n cls,\n primitive,\n tag,\n tagStr\n };\n }\n function derDecodeLen(buf, primitive, fail) {\n let len = buf.readUInt8(fail);\n if (buf.isError(len))\n return len;\n if (!primitive && len === 128)\n return null;\n if ((len & 128) === 0)\n return len;\n let num = len & 127;\n if (num > 4)\n return buf.error(\"length octect is too long\");\n len = 0;\n for (let i = 0;i < num; i++) {\n len <<= 8;\n let j = buf.readUInt8(fail);\n if (buf.isError(j))\n return j;\n len |= j;\n }\n return len;\n }\n }\n}), require_pem2 = __commonJS({\n \"node_modules/asn1.js/lib/asn1/decoders/pem.js\"(exports, module) {\n var inherits = require_inherits_browser(), Buffer2 = require_safer().Buffer, DERDecoder = require_der3();\n function PEMDecoder(entity) {\n DERDecoder.@call(this, entity), this.enc = \"pem\";\n }\n inherits(PEMDecoder, DERDecoder), module.exports = PEMDecoder, PEMDecoder.prototype.decode = function(data, options) {\n let lines = data.toString().split(/[\\r\\n]+/g), label = options.label.toUpperCase(), re = /^-----(BEGIN|END) ([^-]+)-----$/, start = -1, end = -1;\n for (let i = 0;i < lines.length; i++) {\n let match = lines[i].match(re);\n if (match !== null && match[2] === label)\n if (start === -1) {\n if (match[1] !== \"BEGIN\")\n break;\n start = i;\n } else {\n if (match[1] !== \"END\")\n break;\n end = i;\n break;\n }\n }\n if (start === -1 || end === -1)\n throw new Error(\"PEM section not found for: \" + label);\n let base64 = lines.slice(start + 1, end).join(\"\");\n base64.replace(/[^a-z0-9+/=]+/gi, \"\");\n let input = Buffer2.from(base64, \"base64\");\n return DERDecoder.prototype.decode.@call(this, input, options);\n };\n }\n}), require_decoders = __commonJS({\n \"node_modules/asn1.js/lib/asn1/decoders/index.js\"(exports) {\n var decoders = exports;\n decoders.der = require_der3(), decoders.pem = require_pem2();\n }\n}), require_api = __commonJS({\n \"node_modules/asn1.js/lib/asn1/api.js\"(exports) {\n var encoders = require_encoders(), decoders = require_decoders(), inherits = require_inherits_browser(), api = exports;\n api.define = function(name, body) {\n return new Entity(name, body);\n };\n function Entity(name, body) {\n this.name = name, this.body = body, this.decoders = {}, this.encoders = {};\n }\n Entity.prototype = {}, Entity.prototype._createNamed = function(Base) {\n let name = this.name;\n function Generated(entity) {\n this._initNamed(entity, name);\n }\n return inherits(Generated, Base), Generated.prototype._initNamed = function(entity, name2) {\n Base.@call(this, entity, name2);\n }, new Generated(this);\n }, Entity.prototype._getDecoder = function(enc) {\n return enc = enc || \"der\", this.decoders.hasOwnProperty(enc) || (this.decoders[enc] = this._createNamed(decoders[enc])), this.decoders[enc];\n }, Entity.prototype.decode = function(data, enc, options) {\n return this._getDecoder(enc).decode(data, options);\n }, Entity.prototype._getEncoder = function(enc) {\n return enc = enc || \"der\", this.encoders.hasOwnProperty(enc) || (this.encoders[enc] = this._createNamed(encoders[enc])), this.encoders[enc];\n }, Entity.prototype.encode = function(data, enc, reporter) {\n return this._getEncoder(enc).encode(data, reporter);\n };\n }\n}), require_base2 = __commonJS({\n \"node_modules/asn1.js/lib/asn1/base/index.js\"(exports) {\n var base = exports;\n base.Reporter = require_reporter().Reporter, base.DecoderBuffer = require_buffer().DecoderBuffer, base.EncoderBuffer = require_buffer().EncoderBuffer, base.Node = require_node();\n }\n}), require_constants = __commonJS({\n \"node_modules/asn1.js/lib/asn1/constants/index.js\"(exports) {\n var constants = exports;\n constants._reverse = function(map) {\n let res = {};\n return Object.keys(map).forEach(function(key2) {\n (key2 | 0) == key2 && (key2 = key2 | 0);\n let value = map[key2];\n res[value] = key2;\n }), res;\n }, constants.der = require_der();\n }\n}), require_asn1 = __commonJS({\n \"node_modules/asn1.js/lib/asn1.js\"(exports) {\n var asn1 = exports;\n asn1.bignum = require_bn5(), asn1.define = require_api().define, asn1.base = require_base2(), asn1.constants = require_constants(), asn1.decoders = require_decoders(), asn1.encoders = require_encoders();\n }\n}), require_certificate = __commonJS({\n \"node_modules/parse-asn1/certificate.js\"(exports, module) {\n var asn = require_asn1(), Time = asn.define(\"Time\", function() {\n this.choice({\n utcTime: this.utctime(),\n generalTime: this.gentime()\n });\n }), AttributeTypeValue = asn.define(\"AttributeTypeValue\", function() {\n this.seq().obj(this.key(\"type\").objid(), this.key(\"value\").any());\n }), AlgorithmIdentifier = asn.define(\"AlgorithmIdentifier\", function() {\n this.seq().obj(this.key(\"algorithm\").objid(), this.key(\"parameters\").optional(), this.key(\"curve\").objid().optional());\n }), SubjectPublicKeyInfo = asn.define(\"SubjectPublicKeyInfo\", function() {\n this.seq().obj(this.key(\"algorithm\").use(AlgorithmIdentifier), this.key(\"subjectPublicKey\").bitstr());\n }), RelativeDistinguishedName = asn.define(\"RelativeDistinguishedName\", function() {\n this.setof(AttributeTypeValue);\n }), RDNSequence = asn.define(\"RDNSequence\", function() {\n this.seqof(RelativeDistinguishedName);\n }), Name = asn.define(\"Name\", function() {\n this.choice({\n rdnSequence: this.use(RDNSequence)\n });\n }), Validity = asn.define(\"Validity\", function() {\n this.seq().obj(this.key(\"notBefore\").use(Time), this.key(\"notAfter\").use(Time));\n }), Extension = asn.define(\"Extension\", function() {\n this.seq().obj(this.key(\"extnID\").objid(), this.key(\"critical\").bool().def(!1), this.key(\"extnValue\").octstr());\n }), TBSCertificate = asn.define(\"TBSCertificate\", function() {\n this.seq().obj(this.key(\"version\").explicit(0).int().optional(), this.key(\"serialNumber\").int(), this.key(\"signature\").use(AlgorithmIdentifier), this.key(\"issuer\").use(Name), this.key(\"validity\").use(Validity), this.key(\"subject\").use(Name), this.key(\"subjectPublicKeyInfo\").use(SubjectPublicKeyInfo), this.key(\"issuerUniqueID\").implicit(1).bitstr().optional(), this.key(\"subjectUniqueID\").implicit(2).bitstr().optional(), this.key(\"extensions\").explicit(3).seqof(Extension).optional());\n }), X509Certificate = asn.define(\"X509Certificate\", function() {\n this.seq().obj(this.key(\"tbsCertificate\").use(TBSCertificate), this.key(\"signatureAlgorithm\").use(AlgorithmIdentifier), this.key(\"signatureValue\").bitstr());\n });\n module.exports = X509Certificate;\n }\n}), require_asn12 = __commonJS({\n \"node_modules/parse-asn1/asn1.js\"(exports) {\n var asn1 = require_asn1();\n exports.certificate = require_certificate();\n var RSAPrivateKey = asn1.define(\"RSAPrivateKey\", function() {\n this.seq().obj(this.key(\"version\").int(), this.key(\"modulus\").int(), this.key(\"publicExponent\").int(), this.key(\"privateExponent\").int(), this.key(\"prime1\").int(), this.key(\"prime2\").int(), this.key(\"exponent1\").int(), this.key(\"exponent2\").int(), this.key(\"coefficient\").int());\n });\n exports.RSAPrivateKey = RSAPrivateKey;\n var RSAPublicKey = asn1.define(\"RSAPublicKey\", function() {\n this.seq().obj(this.key(\"modulus\").int(), this.key(\"publicExponent\").int());\n });\n exports.RSAPublicKey = RSAPublicKey;\n var PublicKey = asn1.define(\"SubjectPublicKeyInfo\", function() {\n this.seq().obj(this.key(\"algorithm\").use(AlgorithmIdentifier), this.key(\"subjectPublicKey\").bitstr());\n });\n exports.PublicKey = PublicKey;\n var AlgorithmIdentifier = asn1.define(\"AlgorithmIdentifier\", function() {\n this.seq().obj(this.key(\"algorithm\").objid(), this.key(\"none\").null_().optional(), this.key(\"curve\").objid().optional(), this.key(\"params\").seq().obj(this.key(\"p\").int(), this.key(\"q\").int(), this.key(\"g\").int()).optional());\n }), PrivateKeyInfo = asn1.define(\"PrivateKeyInfo\", function() {\n this.seq().obj(this.key(\"version\").int(), this.key(\"algorithm\").use(AlgorithmIdentifier), this.key(\"subjectPrivateKey\").octstr());\n });\n exports.PrivateKey = PrivateKeyInfo;\n var EncryptedPrivateKeyInfo = asn1.define(\"EncryptedPrivateKeyInfo\", function() {\n this.seq().obj(this.key(\"algorithm\").seq().obj(this.key(\"id\").objid(), this.key(\"decrypt\").seq().obj(this.key(\"kde\").seq().obj(this.key(\"id\").objid(), this.key(\"kdeparams\").seq().obj(this.key(\"salt\").octstr(), this.key(\"iters\").int())), this.key(\"cipher\").seq().obj(this.key(\"algo\").objid(), this.key(\"iv\").octstr()))), this.key(\"subjectPrivateKey\").octstr());\n });\n exports.EncryptedPrivateKey = EncryptedPrivateKeyInfo;\n var DSAPrivateKey = asn1.define(\"DSAPrivateKey\", function() {\n this.seq().obj(this.key(\"version\").int(), this.key(\"p\").int(), this.key(\"q\").int(), this.key(\"g\").int(), this.key(\"pub_key\").int(), this.key(\"priv_key\").int());\n });\n exports.DSAPrivateKey = DSAPrivateKey, exports.DSAparam = asn1.define(\"DSAparam\", function() {\n this.int();\n });\n var ECPrivateKey = asn1.define(\"ECPrivateKey\", function() {\n this.seq().obj(this.key(\"version\").int(), this.key(\"privateKey\").octstr(), this.key(\"parameters\").optional().explicit(0).use(ECParameters), this.key(\"publicKey\").optional().explicit(1).bitstr());\n });\n exports.ECPrivateKey = ECPrivateKey;\n var ECParameters = asn1.define(\"ECParameters\", function() {\n this.choice({\n namedCurve: this.objid()\n });\n });\n exports.signature = asn1.define(\"signature\", function() {\n this.seq().obj(this.key(\"r\").int(), this.key(\"s\").int());\n });\n }\n}), require_aesid = __commonJS({\n \"node_modules/parse-asn1/aesid.json\"(exports, module) {\n module.exports = {\n \"2.16.840.1.101.3.4.1.1\": \"aes-128-ecb\",\n \"2.16.840.1.101.3.4.1.2\": \"aes-128-cbc\",\n \"2.16.840.1.101.3.4.1.3\": \"aes-128-ofb\",\n \"2.16.840.1.101.3.4.1.4\": \"aes-128-cfb\",\n \"2.16.840.1.101.3.4.1.21\": \"aes-192-ecb\",\n \"2.16.840.1.101.3.4.1.22\": \"aes-192-cbc\",\n \"2.16.840.1.101.3.4.1.23\": \"aes-192-ofb\",\n \"2.16.840.1.101.3.4.1.24\": \"aes-192-cfb\",\n \"2.16.840.1.101.3.4.1.41\": \"aes-256-ecb\",\n \"2.16.840.1.101.3.4.1.42\": \"aes-256-cbc\",\n \"2.16.840.1.101.3.4.1.43\": \"aes-256-ofb\",\n \"2.16.840.1.101.3.4.1.44\": \"aes-256-cfb\"\n };\n }\n}), require_fixProc = __commonJS({\n \"node_modules/parse-asn1/fixProc.js\"(exports, module) {\n var findProc = /Proc-Type: 4,ENCRYPTED[\\n\\r]+DEK-Info: AES-((\?:128)|(\?:192)|(\?:256))-CBC,([0-9A-H]+)[\\n\\r]+([0-9A-z\\n\\r+/=]+)[\\n\\r]+/m, startRegex = /^-----BEGIN ((\?:.*\? KEY)|CERTIFICATE)-----/m, fullRegex = /^-----BEGIN ((\?:.*\? KEY)|CERTIFICATE)-----([0-9A-z\\n\\r+/=]+)-----END \\1-----$/m, evp = require_evp_bytestokey(), ciphers = require_browser5(), Buffer2 = require_safe_buffer().Buffer;\n module.exports = function(okey, password) {\n var key2 = okey.toString(), match = key2.match(findProc), decrypted;\n if (match) {\n var suite = \"aes\" + match[1], iv = Buffer2.from(match[2], \"hex\"), cipherText = Buffer2.from(match[3].replace(/[\\r\\n]/g, \"\"), \"base64\"), cipherKey = evp(password, iv.slice(0, 8), parseInt(match[1], 10)).key, out = [], cipher = ciphers.createDecipheriv(suite, cipherKey, iv);\n out.push(cipher.update(cipherText)), out.push(cipher.final()), decrypted = Buffer2.concat(out);\n } else {\n var match2 = key2.match(fullRegex);\n decrypted = Buffer2.from(match2[2].replace(/[\\r\\n]/g, \"\"), \"base64\");\n }\n var tag = key2.match(startRegex)[1];\n return {\n tag,\n data: decrypted\n };\n };\n }\n}), require_parse_asn1 = __commonJS({\n \"node_modules/parse-asn1/index.js\"(exports, module) {\n var asn1 = require_asn12(), aesid = require_aesid(), fixProc = require_fixProc(), ciphers = require_browser5(), compat = require_browser4(), Buffer2 = require_safe_buffer().Buffer;\n module.exports = parseKeys;\n function parseKeys(buffer) {\n var password;\n if (buffer instanceof KeyObject)\n buffer = buffer.export();\n else if (buffer instanceof CryptoKey)\n buffer = KeyObject.from(buffer).export();\n else if (typeof buffer == \"object\" && !Buffer2.isBuffer(buffer)) {\n if (password = buffer.passphrase, buffer = buffer.key, buffer instanceof KeyObject) {\n var options;\n switch (buffer.type) {\n case \"secret\":\n options = {\n format: \"buffer\"\n };\n break;\n case \"public\":\n options = {\n format: \"pem\",\n type: \"spki\",\n passphrase: password\n };\n break;\n case \"private\":\n options = {\n format: \"pem\",\n type: \"pkcs8\",\n passphrase: password\n };\n break;\n }\n buffer = buffer.export(options);\n } else if (buffer instanceof CryptoKey) {\n var options;\n switch (buffer.type) {\n case \"secret\":\n options = {\n format: \"buffer\"\n };\n break;\n case \"public\":\n options = {\n format: \"pem\",\n type: \"spki\",\n passphrase: password\n };\n break;\n case \"private\":\n options = {\n format: \"pem\",\n type: \"pkcs8\",\n passphrase: password\n };\n break;\n }\n buffer = KeyObject.from(buffer).export(options);\n }\n }\n typeof buffer == \"string\" && (buffer = Buffer2.from(buffer));\n var stripped = fixProc(buffer, password), type = stripped.tag, data = stripped.data, subtype, ndata;\n switch (type) {\n case \"CERTIFICATE\":\n ndata = asn1.certificate.decode(data, \"der\").tbsCertificate.subjectPublicKeyInfo;\n case \"PUBLIC KEY\":\n switch (ndata || (ndata = asn1.PublicKey.decode(data, \"der\")), subtype = ndata.algorithm.algorithm.join(\".\"), subtype) {\n case \"1.2.840.113549.1.1.1\":\n return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, \"der\");\n case \"1.2.840.10045.2.1\":\n return ndata.subjectPrivateKey = ndata.subjectPublicKey, {\n type: \"ec\",\n data: ndata\n };\n case \"1.2.840.10040.4.1\":\n return ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, \"der\"), {\n type: \"dsa\",\n data: ndata.algorithm.params\n };\n default:\n throw new Error(\"unknown key id \" + subtype);\n }\n case \"ENCRYPTED PRIVATE KEY\":\n data = asn1.EncryptedPrivateKey.decode(data, \"der\"), data = decrypt(data, password);\n case \"PRIVATE KEY\":\n switch (ndata = asn1.PrivateKey.decode(data, \"der\"), subtype = ndata.algorithm.algorithm.join(\".\"), subtype) {\n case \"1.2.840.113549.1.1.1\":\n return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, \"der\");\n case \"1.2.840.10045.2.1\":\n return {\n curve: ndata.algorithm.curve,\n privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, \"der\").privateKey\n };\n case \"1.2.840.10040.4.1\":\n return ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, \"der\"), {\n type: \"dsa\",\n params: ndata.algorithm.params\n };\n default:\n throw new Error(\"unknown key id \" + subtype);\n }\n case \"RSA PUBLIC KEY\":\n return asn1.RSAPublicKey.decode(data, \"der\");\n case \"RSA PRIVATE KEY\":\n return asn1.RSAPrivateKey.decode(data, \"der\");\n case \"DSA PRIVATE KEY\":\n return {\n type: \"dsa\",\n params: asn1.DSAPrivateKey.decode(data, \"der\")\n };\n case \"EC PRIVATE KEY\":\n return data = asn1.ECPrivateKey.decode(data, \"der\"), {\n curve: data.parameters.value,\n privateKey: data.privateKey\n };\n default:\n throw new Error(\"unknown key type \" + type);\n }\n }\n parseKeys.signature = asn1.signature;\n function decrypt(data, password) {\n var salt = data.algorithm.decrypt.kde.kdeparams.salt, iters = parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(), 10), algo = aesid[data.algorithm.decrypt.cipher.algo.join(\".\")], iv = data.algorithm.decrypt.cipher.iv, cipherText = data.subjectPrivateKey, keylen = parseInt(algo.split(\"-\")[1], 10) / 8, key2 = compat.pbkdf2Sync(password, salt, iters, keylen, \"sha1\"), cipher = ciphers.createDecipheriv(algo, key2, iv), out = [];\n return out.push(cipher.update(cipherText)), out.push(cipher.final()), Buffer2.concat(out);\n }\n }\n}), require_curves2 = __commonJS({\n \"node_modules/browserify-sign/browser/curves.json\"(exports, module) {\n module.exports = {\n \"1.3.132.0.10\": \"secp256k1\",\n \"1.3.132.0.33\": \"p224\",\n \"1.2.840.10045.3.1.1\": \"p192\",\n \"1.2.840.10045.3.1.7\": \"p256\",\n \"1.3.132.0.34\": \"p384\",\n \"1.3.132.0.35\": \"p521\"\n };\n }\n}), require_sign = __commonJS({\n \"node_modules/browserify-sign/browser/sign.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer, createHmac = require_browser3(), crt = require_browserify_rsa(), EC = require_elliptic().ec, BN = require_bn3(), parseKeys = require_parse_asn1(), curves = require_curves2();\n function sign(hash, key2, hashType, signType, tag) {\n var priv = parseKeys(getKeyFrom(key2, \"private\"));\n if (priv.curve) {\n if (signType !== \"ecdsa\" && signType !== \"ecdsa/rsa\")\n throw new Error(\"wrong private key type\");\n return ecSign(hash, priv);\n } else if (priv.type === \"dsa\") {\n if (signType !== \"dsa\")\n throw new Error(\"wrong private key type\");\n return dsaSign(hash, priv, hashType);\n } else if (signType !== \"rsa\" && signType !== \"ecdsa/rsa\")\n throw new Error(\"wrong private key type\");\n hash = Buffer2.concat([tag, hash]);\n for (var len = priv.modulus.byteLength(), pad = [0, 1];hash.length + pad.length + 1 < len; )\n pad.push(255);\n pad.push(0);\n for (var i = -1;++i < hash.length; )\n pad.push(hash[i]);\n var out = crt(pad, priv);\n return out;\n }\n function ecSign(hash, priv) {\n var curveId = curves[priv.curve.join(\".\")];\n if (!curveId)\n throw new Error(\"unknown curve \" + priv.curve.join(\".\"));\n var curve = new EC(curveId), key2 = curve.keyFromPrivate(priv.privateKey), out = key2.sign(hash);\n return Buffer2.from(out.toDER());\n }\n function dsaSign(hash, priv, algo) {\n for (var x = priv.params.priv_key, p = priv.params.p, q = priv.params.q, g = priv.params.g, r = new BN(0), k, H = bits2int(hash, q).mod(q), s = !1, kv = getKey(x, q, hash, algo);s === !1; )\n k = makeKey(q, kv, algo), r = makeR(g, k, p, q), s = k.invm(q).imul(H.add(x.mul(r))).mod(q), s.cmpn(0) === 0 && (s = !1, r = new BN(0));\n return toDER(r, s);\n }\n function toDER(r, s) {\n r = r.toArray(), s = s.toArray(), r[0] & 128 && (r = [0].concat(r)), s[0] & 128 && (s = [0].concat(s));\n var total = r.length + s.length + 4, res = [48, total, 2, r.length];\n return res = res.concat(r, [2, s.length], s), Buffer2.from(res);\n }\n function getKey(x, q, hash, algo) {\n if (x = Buffer2.from(x.toArray()), x.length < q.byteLength()) {\n var zeros = Buffer2.alloc(q.byteLength() - x.length);\n x = Buffer2.concat([zeros, x]);\n }\n var hlen = hash.length, hbits = bits2octets(hash, q), v = Buffer2.alloc(hlen);\n v.fill(1);\n var k = Buffer2.alloc(hlen);\n return k = createHmac(algo, k).update(v).update(Buffer2.from([0])).update(x).update(hbits).digest(), v = createHmac(algo, k).update(v).digest(), k = createHmac(algo, k).update(v).update(Buffer2.from([1])).update(x).update(hbits).digest(), v = createHmac(algo, k).update(v).digest(), { k, v };\n }\n function bits2int(obits, q) {\n var bits = new BN(obits), shift = (obits.length << 3) - q.bitLength();\n return shift > 0 && bits.ishrn(shift), bits;\n }\n function bits2octets(bits, q) {\n bits = bits2int(bits, q), bits = bits.mod(q);\n var out = Buffer2.from(bits.toArray());\n if (out.length < q.byteLength()) {\n var zeros = Buffer2.alloc(q.byteLength() - out.length);\n out = Buffer2.concat([zeros, out]);\n }\n return out;\n }\n function makeKey(q, kv, algo) {\n var t, k;\n do {\n for (t = Buffer2.alloc(0);t.length * 8 < q.bitLength(); )\n kv.v = createHmac(algo, kv.k).update(kv.v).digest(), t = Buffer2.concat([t, kv.v]);\n k = bits2int(t, q), kv.k = createHmac(algo, kv.k).update(kv.v).update(Buffer2.from([0])).digest(), kv.v = createHmac(algo, kv.k).update(kv.v).digest();\n } while (k.cmp(q) !== -1);\n return k;\n }\n function makeR(g, k, p, q) {\n return g.toRed(BN.mont(p)).redPow(k).fromRed().mod(q);\n }\n module.exports = sign, module.exports.getKey = getKey, module.exports.makeKey = makeKey;\n }\n}), require_verify = __commonJS({\n \"node_modules/browserify-sign/browser/verify.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer, BN = require_bn3(), EC = require_elliptic().ec, parseKeys = require_parse_asn1(), curves = require_curves2();\n function verify(sig, hash, key2, signType, tag) {\n var pub = parseKeys(getKeyFrom(key2, \"public\"));\n if (pub.type === \"ec\") {\n if (signType !== \"ecdsa\" && signType !== \"ecdsa/rsa\")\n throw new Error(\"wrong public key type\");\n return ecVerify(sig, hash, pub);\n } else if (pub.type === \"dsa\") {\n if (signType !== \"dsa\")\n throw new Error(\"wrong public key type\");\n return dsaVerify(sig, hash, pub);\n } else if (signType !== \"rsa\" && signType !== \"ecdsa/rsa\")\n throw new Error(\"wrong public key type\");\n hash = Buffer2.concat([tag, hash]);\n for (var len = pub.modulus.byteLength(), pad = [1], padNum = 0;hash.length + pad.length + 2 < len; )\n pad.push(255), padNum++;\n pad.push(0);\n for (var i = -1;++i < hash.length; )\n pad.push(hash[i]);\n pad = Buffer2.from(pad);\n var red = BN.mont(pub.modulus);\n sig = new BN(sig).toRed(red), sig = sig.redPow(new BN(pub.publicExponent)), sig = Buffer2.from(sig.fromRed().toArray());\n var out = padNum < 8 \? 1 : 0;\n for (len = Math.min(sig.length, pad.length), sig.length !== pad.length && (out = 1), i = -1;++i < len; )\n out |= sig[i] ^ pad[i];\n return out === 0;\n }\n function ecVerify(sig, hash, pub) {\n var curveId = curves[pub.data.algorithm.curve.join(\".\")];\n if (!curveId)\n throw new Error(\"unknown curve \" + pub.data.algorithm.curve.join(\".\"));\n var curve = new EC(curveId), pubkey = pub.data.subjectPrivateKey.data;\n return curve.verify(hash, sig, pubkey);\n }\n function dsaVerify(sig, hash, pub) {\n var p = pub.data.p, q = pub.data.q, g = pub.data.g, y = pub.data.pub_key, unpacked = parseKeys.signature.decode(sig, \"der\"), s = unpacked.s, r = unpacked.r;\n checkValue(s, q), checkValue(r, q);\n var montp = BN.mont(p), w = s.invm(q), v = g.toRed(montp).redPow(new BN(hash).mul(w).mod(q)).fromRed().mul(y.toRed(montp).redPow(r.mul(w).mod(q)).fromRed()).mod(p).mod(q);\n return v.cmp(r) === 0;\n }\n function checkValue(b, q) {\n if (b.cmpn(0) <= 0)\n throw new Error(\"invalid sig\");\n if (b.cmp(q) >= q)\n throw new Error(\"invalid sig\");\n }\n module.exports = verify;\n }\n}), require_browser8 = __commonJS({\n \"node_modules/browserify-sign/browser/index.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer, createHash = require_browser2(), inherits = require_inherits_browser(), sign = require_sign(), verify = require_verify(), algorithms = require_algorithms();\n Object.keys(algorithms).forEach(function(key2) {\n algorithms[key2].id = Buffer2.from(algorithms[key2].id, \"hex\"), algorithms[key2.toLowerCase()] = algorithms[key2];\n });\n function Sign(algorithm) {\n if (typeof algorithm === \"string\")\n algorithm = algorithm.toLowerCase();\n StreamModule.Writable.@call(this);\n var data = algorithms[algorithm];\n if (!data)\n throw new Error(\"Unknown message digest\");\n this._hashType = data.hash, this._hash = createHash(data.hash), this._tag = data.id, this._signType = data.sign;\n }\n inherits(Sign, StreamModule.Writable), Sign.prototype._write = function(data, _, done) {\n this._hash.update(data), done();\n }, Sign.prototype.update = function(data, enc) {\n return typeof data == \"string\" && (data = Buffer2.from(data, enc)), this._hash.update(data), this;\n }, Sign.prototype.sign = function(key2, enc) {\n this.end();\n var hash = this._hash.digest(), sig = sign(hash, key2, this._hashType, this._signType, this._tag);\n return enc \? sig.toString(enc) : sig;\n };\n function Verify(algorithm) {\n if (StreamModule.Writable.@call(this), typeof algorithm === \"string\")\n algorithm = algorithm.toLowerCase();\n var data = algorithms[algorithm];\n if (!data)\n throw new Error(\"Unknown message digest\");\n this._hash = createHash(data.hash), this._tag = data.id, this._signType = data.sign;\n }\n inherits(Verify, StreamModule.Writable), Verify.prototype._write = function(data, _, done) {\n this._hash.update(data), done();\n }, Verify.prototype.update = function(data, enc) {\n return typeof data == \"string\" && (data = Buffer2.from(data, enc)), this._hash.update(data), this;\n }, Verify.prototype.verify = function(key2, sig, enc) {\n typeof sig == \"string\" && (sig = Buffer2.from(sig, enc)), this.end();\n var hash = this._hash.digest();\n return verify(sig, hash, key2, this._signType, this._tag);\n };\n function createSign(algorithm) {\n return new Sign(algorithm);\n }\n function createVerify(algorithm) {\n return new Verify(algorithm);\n }\n module.exports = {\n Sign: createSign,\n Verify: createVerify,\n createSign,\n createVerify\n };\n }\n}), require_bn6 = require_bn, require_browser9 = __commonJS({\n \"node_modules/create-ecdh/browser.js\"(exports, module) {\n var elliptic = require_elliptic(), BN = require_bn6();\n module.exports = function(curve) {\n return new ECDH(curve);\n };\n var aliases = {\n secp256k1: {\n name: \"secp256k1\",\n byteLength: 32\n },\n secp224r1: {\n name: \"p224\",\n byteLength: 28\n },\n prime256v1: {\n name: \"p256\",\n byteLength: 32\n },\n prime192v1: {\n name: \"p192\",\n byteLength: 24\n },\n ed25519: {\n name: \"ed25519\",\n byteLength: 32\n },\n secp384r1: {\n name: \"p384\",\n byteLength: 48\n },\n secp521r1: {\n name: \"p521\",\n byteLength: 66\n }\n };\n aliases.p224 = aliases.secp224r1, aliases.p256 = aliases.secp256r1 = aliases.prime256v1, aliases.p192 = aliases.secp192r1 = aliases.prime192v1, aliases.p384 = aliases.secp384r1, aliases.p521 = aliases.secp521r1;\n function ECDH(curve) {\n this.curveType = aliases[curve], this.curveType || (this.curveType = {\n name: curve\n }), this.curve = new elliptic.ec(this.curveType.name), this.keys = void 0;\n }\n ECDH.prototype = {}, ECDH.prototype.generateKeys = function(enc, format) {\n return this.keys = this.curve.genKeyPair(), this.getPublicKey(enc, format);\n }, ECDH.prototype.computeSecret = function(other, inenc, enc) {\n inenc = inenc || \"utf8\", Buffer.isBuffer(other) || (other = new Buffer(other, inenc));\n var otherPub = this.curve.keyFromPublic(other).getPublic(), out = otherPub.mul(this.keys.getPrivate()).getX();\n return formatReturnValue(out, enc, this.curveType.byteLength);\n }, ECDH.prototype.getPublicKey = function(enc, format) {\n var key2 = this.keys.getPublic(format === \"compressed\", !0);\n return format === \"hybrid\" && (key2[key2.length - 1] % 2 \? key2[0] = 7 : key2[0] = 6), formatReturnValue(key2, enc);\n }, ECDH.prototype.getPrivateKey = function(enc) {\n return formatReturnValue(this.keys.getPrivate(), enc);\n }, ECDH.prototype.setPublicKey = function(pub, enc) {\n return enc = enc || \"utf8\", Buffer.isBuffer(pub) || (pub = new Buffer(pub, enc)), this.keys._importPublic(pub), this;\n }, ECDH.prototype.setPrivateKey = function(priv, enc) {\n enc = enc || \"utf8\", Buffer.isBuffer(priv) || (priv = new Buffer(priv, enc));\n var _priv = new BN(priv);\n return _priv = _priv.toString(16), this.keys = this.curve.genKeyPair(), this.keys._importPrivate(_priv), this;\n };\n function formatReturnValue(bn, enc, len) {\n @Array.isArray(bn) || (bn = bn.toArray());\n var buf = new Buffer(bn);\n if (len && buf.length < len) {\n var zeros = new Buffer(len - buf.length);\n zeros.fill(0), buf = Buffer.concat([zeros, buf]);\n }\n return enc \? buf.toString(enc) : buf;\n }\n }\n}), require_mgf = __commonJS({\n \"node_modules/public-encrypt/mgf.js\"(exports, module) {\n var createHash = require_browser2(), Buffer2 = require_safe_buffer().Buffer;\n module.exports = function(seed, len) {\n for (var t = Buffer2.alloc(0), i = 0, c;t.length < len; )\n c = i2ops(i++), t = Buffer2.concat([t, createHash(\"sha1\").update(seed).update(c).digest()]);\n return t.slice(0, len);\n };\n function i2ops(c) {\n var out = Buffer2.allocUnsafe(4);\n return out.writeUInt32BE(c, 0), out;\n }\n }\n}), require_xor = __commonJS({\n \"node_modules/public-encrypt/xor.js\"(exports, module) {\n module.exports = function(a, b) {\n for (var len = a.length, i = -1;++i < len; )\n a[i] ^= b[i];\n return a;\n };\n }\n}), require_bn7 = require_bn, { CryptoHasher } = globalThis.Bun, require_withPublic = __commonJS({\n \"node_modules/public-encrypt/withPublic.js\"(exports, module) {\n var BN = require_bn7(), Buffer2 = require_safe_buffer().Buffer;\n function withPublic(paddedMsg, key2) {\n return Buffer2.from(paddedMsg.toRed(BN.mont(key2.modulus)).redPow(new BN(key2.publicExponent)).fromRed().toArray());\n }\n module.exports = withPublic;\n }\n}), require_publicEncrypt = __commonJS({\n \"node_modules/public-encrypt/publicEncrypt.js\"(exports, module) {\n var parseKeys = require_parse_asn1(), randomBytes = require_browser(), createHash = require_browser2(), mgf = require_mgf(), xor = require_xor(), BN = require_bn7(), withPublic = require_withPublic(), crt = require_browserify_rsa(), Buffer2 = require_safe_buffer().Buffer;\n module.exports = function(publicKey, msg, reverse) {\n var padding;\n publicKey.padding \? padding = publicKey.padding : reverse \? padding = 1 : padding = 4;\n var key2 = parseKeys(publicKey), paddedMsg;\n if (padding === 4)\n paddedMsg = oaep(key2, msg);\n else if (padding === 1)\n paddedMsg = pkcs1(key2, msg, reverse);\n else if (padding === 3) {\n if (paddedMsg = new BN(msg), paddedMsg.cmp(key2.modulus) >= 0)\n throw new Error(\"data too long for modulus\");\n } else\n throw new Error(\"unknown padding\");\n return reverse \? crt(paddedMsg, key2) : withPublic(paddedMsg, key2);\n };\n function oaep(key2, msg) {\n var k = key2.modulus.byteLength(), mLen = msg.length, iHash = createHash(\"sha1\").update(Buffer2.alloc(0)).digest(), hLen = iHash.length, hLen2 = 2 * hLen;\n if (mLen > k - hLen2 - 2)\n throw new Error(\"message too long\");\n var ps = Buffer2.alloc(k - mLen - hLen2 - 2), dblen = k - hLen - 1, seed = randomBytes(hLen), maskedDb = xor(Buffer2.concat([iHash, ps, Buffer2.alloc(1, 1), msg], dblen), mgf(seed, dblen)), maskedSeed = xor(seed, mgf(maskedDb, hLen));\n return new BN(Buffer2.concat([Buffer2.alloc(1), maskedSeed, maskedDb], k));\n }\n function pkcs1(key2, msg, reverse) {\n var mLen = msg.length, k = key2.modulus.byteLength();\n if (mLen > k - 11)\n throw new Error(\"message too long\");\n var ps;\n return reverse \? ps = Buffer2.alloc(k - mLen - 3, 255) : ps = nonZero(k - mLen - 3), new BN(Buffer2.concat([Buffer2.from([0, reverse \? 1 : 2]), ps, Buffer2.alloc(1), msg], k));\n }\n function nonZero(len) {\n for (var out = Buffer2.allocUnsafe(len), i = 0, cache = randomBytes(len * 2), cur = 0, num;i < len; )\n cur === cache.length && (cache = randomBytes(len * 2), cur = 0), num = cache[cur++], num && (out[i++] = num);\n return out;\n }\n }\n}), require_privateDecrypt = __commonJS({\n \"node_modules/public-encrypt/privateDecrypt.js\"(exports, module) {\n var parseKeys = require_parse_asn1(), mgf = require_mgf(), xor = require_xor(), BN = require_bn7(), crt = require_browserify_rsa(), createHash = require_browser2(), withPublic = require_withPublic(), Buffer2 = require_safe_buffer().Buffer;\n module.exports = function(privateKey, enc, reverse) {\n var padding;\n privateKey.padding \? padding = privateKey.padding : reverse \? padding = 1 : padding = 4;\n var key2 = parseKeys(privateKey), k = key2.modulus.byteLength();\n if (enc.length > k || new BN(enc).cmp(key2.modulus) >= 0)\n throw new Error(\"decryption error\");\n var msg;\n reverse \? msg = withPublic(new BN(enc), key2) : msg = crt(enc, key2);\n var zBuffer = Buffer2.alloc(k - msg.length);\n if (msg = Buffer2.concat([zBuffer, msg], k), padding === 4)\n return oaep(key2, msg);\n if (padding === 1)\n return pkcs1(key2, msg, reverse);\n if (padding === 3)\n return msg;\n throw new Error(\"unknown padding\");\n };\n function oaep(key2, msg) {\n var k = key2.modulus.byteLength(), iHash = createHash(\"sha1\").update(Buffer2.alloc(0)).digest(), hLen = iHash.length;\n if (msg[0] !== 0)\n throw new Error(\"decryption error\");\n var maskedSeed = msg.slice(1, hLen + 1), maskedDb = msg.slice(hLen + 1), seed = xor(maskedSeed, mgf(maskedDb, hLen)), db = xor(maskedDb, mgf(seed, k - hLen - 1));\n if (compare(iHash, db.slice(0, hLen)))\n throw new Error(\"decryption error\");\n for (var i = hLen;db[i] === 0; )\n i++;\n if (db[i++] !== 1)\n throw new Error(\"decryption error\");\n return db.slice(i);\n }\n function pkcs1(key2, msg, reverse) {\n for (var p1 = msg.slice(0, 2), i = 2, status = 0;msg[i++] !== 0; )\n if (i >= msg.length) {\n status++;\n break;\n }\n var ps = msg.slice(2, i - 1);\n if ((p1.toString(\"hex\") !== \"0002\" && !reverse || p1.toString(\"hex\") !== \"0001\" && reverse) && status++, ps.length < 8 && status++, status)\n throw new Error(\"decryption error\");\n return msg.slice(i);\n }\n function compare(a, b) {\n a = Buffer2.from(a), b = Buffer2.from(b);\n var dif = 0, len = a.length;\n a.length !== b.length && (dif++, len = Math.min(a.length, b.length));\n for (var i = -1;++i < len; )\n dif += a[i] ^ b[i];\n return dif;\n }\n }\n}), require_browser10 = __commonJS({\n \"node_modules/public-encrypt/browser.js\"(exports) {\n var publicEncrypt = require_publicEncrypt();\n exports.publicEncrypt = function(key2, buf, options) {\n return publicEncrypt(getKeyFrom(key2, \"public\"), buf, options);\n };\n var privateDecrypt = require_privateDecrypt();\n exports.privateDecrypt = function(key2, buf, options) {\n return privateDecrypt(getKeyFrom(key2, \"private\"), buf, options);\n }, exports.privateEncrypt = function(key2, buf) {\n return publicEncrypt(getKeyFrom(key2, \"private\"), buf, !0);\n }, exports.publicDecrypt = function(key2, buf) {\n return privateDecrypt(getKeyFrom(key2, \"public\"), buf, !0);\n };\n }\n}), require_browser11 = __commonJS({\n \"node_modules/randomfill/browser.js\"(exports) {\n var safeBuffer = require_safe_buffer(), randombytes = require_browser(), Buffer2 = safeBuffer.Buffer, kBufferMaxLength = safeBuffer.kMaxLength, kMaxUint32 = Math.pow(2, 32) - 1;\n function assertOffset(offset, length) {\n if (typeof offset != \"number\" || offset !== offset)\n @throwTypeError(\"offset must be a number\");\n if (offset > kMaxUint32 || offset < 0)\n @throwTypeError(\"offset must be a uint32\");\n if (offset > kBufferMaxLength || offset > length)\n @throwRangeError(\"offset out of range\");\n }\n function assertSize(size, offset, length) {\n if (typeof size != \"number\" || size !== size)\n @throwTypeError(\"size must be a number\");\n if (size > kMaxUint32 || size < 0)\n @throwTypeError(\"size must be a uint32\");\n if (size + offset > length || size > kBufferMaxLength)\n @throwRangeError(\"buffer too small\");\n }\n exports.randomFill = randomFill, exports.randomFillSync = randomFillSync;\n function randomFill(buf, offset, size, cb) {\n if (!Buffer2.isBuffer(buf) && !(buf instanceof global.Uint8Array))\n @throwTypeError('\"buf\" argument must be a Buffer or Uint8Array');\n if (typeof offset == \"function\")\n cb = offset, offset = 0, size = buf.length;\n else if (typeof size == \"function\")\n cb = size, size = buf.length - offset;\n else if (typeof cb != \"function\")\n @throwTypeError('\"cb\" argument must be a function');\n return assertOffset(offset, buf.length), assertSize(size, offset, buf.length), actualFill(buf, offset, size, cb);\n }\n function actualFill(buf, offset, size, cb) {\n if (cb) {\n randombytes(size, function(err, bytes2) {\n if (err)\n return cb(err);\n bytes2.copy(buf, offset), cb(null, buf);\n });\n return;\n }\n var bytes = randombytes(size);\n return bytes.copy(buf, offset), buf;\n }\n function randomFillSync(buf, offset, size) {\n if (typeof offset > \"u\" && (offset = 0), !Buffer2.isBuffer(buf) && !(buf instanceof global.Uint8Array))\n @throwTypeError('\"buf\" argument must be a Buffer or Uint8Array');\n return assertOffset(offset, buf.length), size === void 0 && (size = buf.length - offset), assertSize(size, offset, buf.length), actualFill(buf, offset, size);\n }\n }\n}), require_crypto_browserify2 = __commonJS({\n \"node_modules/crypto-browserify/index.js\"(exports) {\n exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = require_browser(), exports.createHash = require_browser2(), exports.Hash = exports.createHash.Hash, exports.createHmac = exports.Hmac = require_browser3();\n var algos = require_algos(), algoKeys = Object.keys(algos), hashes = [\"sha1\", \"sha224\", \"sha256\", \"sha384\", \"sha512\", \"md5\", \"rmd160\"].concat(algoKeys);\n exports.getHashes = function() {\n return hashes;\n };\n var p = require_browser4();\n exports.pbkdf2 = p.pbkdf2, exports.pbkdf2Sync = p.pbkdf2Sync;\n var aes = require_browser6();\n exports.Cipher = aes.Cipher, exports.createCipher = aes.createCipher, exports.Cipheriv = aes.Cipheriv, exports.createCipheriv = aes.createCipheriv, exports.Decipher = aes.Decipher, exports.createDecipher = aes.createDecipher, exports.Decipheriv = aes.Decipheriv, exports.createDecipheriv = aes.createDecipheriv, exports.getCiphers = aes.getCiphers, exports.listCiphers = aes.listCiphers;\n var dh = require_browser7();\n exports.DiffieHellmanGroup = dh.DiffieHellmanGroup, exports.createDiffieHellmanGroup = dh.createDiffieHellmanGroup, exports.getDiffieHellman = dh.getDiffieHellman, exports.createDiffieHellman = dh.createDiffieHellman, exports.DiffieHellman = dh.DiffieHellman;\n var sign = require_browser8();\n exports.createSign = sign.createSign, exports.Sign = sign.Sign, exports.createVerify = sign.createVerify, exports.Verify = sign.Verify, exports.createECDH = require_browser9();\n var publicEncrypt = require_browser10();\n exports.publicEncrypt = publicEncrypt.publicEncrypt, exports.privateEncrypt = publicEncrypt.privateEncrypt, exports.publicDecrypt = publicEncrypt.publicDecrypt, exports.privateDecrypt = publicEncrypt.privateDecrypt, exports.getRandomValues = (values) => crypto.getRandomValues(values);\n var rf = require_browser11();\n exports.randomFill = rf.randomFill, exports.randomFillSync = rf.randomFillSync, exports.createCredentials = function() {\n throw new Error([\n \"sorry, createCredentials is not implemented yet\",\n \"we accept pull requests\",\n \"https://github.com/crypto-browserify/crypto-browserify\"\n ].join(`\n`));\n }, exports.constants = @processBindingConstants.crypto;\n }\n}), crypto_exports = require_crypto_browserify2(), DEFAULT_ENCODING = \"buffer\", getRandomValues = (array) => crypto.getRandomValues(array), randomUUID = () => crypto.randomUUID(), randomInt = (...args) => crypto.randomInt(...args), timingSafeEqual = \"timingSafeEqual\" in crypto \? (a, b) => {\n let { byteLength: byteLengthA } = a, { byteLength: byteLengthB } = b;\n if (typeof byteLengthA != \"number\" || typeof byteLengthB != \"number\")\n @throwTypeError(\"Input must be an array buffer view\");\n if (byteLengthA !== byteLengthB)\n @throwRangeError(\"Input buffers must have the same length\");\n return crypto.timingSafeEqual(a, b);\n} : void 0, scryptSync = \"scryptSync\" in crypto \? (password, salt, keylen, options) => {\n let res = crypto.scryptSync(password, salt, keylen, options);\n return DEFAULT_ENCODING !== \"buffer\" \? new Buffer(res).toString(DEFAULT_ENCODING) : new Buffer(res);\n} : void 0, scrypt = \"scryptSync\" in crypto \? function(password, salt, keylen, options, callback) {\n if (typeof options == \"function\" && (callback = options, options = void 0), typeof callback != \"function\") {\n var err = @makeTypeError(\"callback must be a function\");\n throw err.code = \"ERR_INVALID_CALLBACK\", err;\n }\n try {\n let result = crypto.scryptSync(password, salt, keylen, options);\n process.nextTick(callback, null, DEFAULT_ENCODING !== \"buffer\" \? new Buffer(result).toString(DEFAULT_ENCODING) : new Buffer(result));\n } catch (err2) {\n throw err2;\n }\n} : void 0;\ntimingSafeEqual && (Object.defineProperty(timingSafeEqual, \"name\", {\n value: \"::bunternal::\"\n}), Object.defineProperty(scrypt, \"name\", {\n value: \"::bunternal::\"\n}), Object.defineProperty(scryptSync, \"name\", {\n value: \"::bunternal::\"\n}));\nvar harcoded_curves = [\n \"p192\",\n \"p224\",\n \"p256\",\n \"p384\",\n \"p521\",\n \"curve25519\",\n \"ed25519\",\n \"secp256k1\",\n \"secp224r1\",\n \"prime256v1\",\n \"prime192v1\",\n \"ed25519\",\n \"secp384r1\",\n \"secp521r1\"\n], {\n symmetricKeySize,\n asymmetricKeyDetails,\n asymmetricKeyType,\n equals,\n exports,\n createSecretKey,\n createPublicKey,\n createPrivateKey,\n generateKeySync,\n generateKeyPairSync\n} = @lazy(\"internal/crypto\"), kCryptoKey = Symbol.for(\"::bunKeyObjectCryptoKey::\");\n\nclass KeyObject {\n [kCryptoKey];\n constructor(key2) {\n if (typeof key2 !== \"object\")\n @throwTypeError('The \"key\" argument must be an instance of CryptoKey.');\n this[kCryptoKey] = key2;\n }\n toString() {\n return \"[object KeyObject]\";\n }\n static from(key2) {\n if (key2 instanceof KeyObject)\n key2 = key2[kCryptoKey];\n return new KeyObject(key2);\n }\n get asymmetricKeyDetails() {\n return asymmetricKeyDetails(this[kCryptoKey]);\n }\n get symmetricKeySize() {\n return symmetricKeySize(this[kCryptoKey]);\n }\n get asymmetricKeyType() {\n return asymmetricKeyType(this[kCryptoKey]);\n }\n [\"export\"](options) {\n switch (arguments.length) {\n case 0:\n switch (this.type) {\n case \"secret\":\n options = {\n format: \"buffer\"\n };\n break;\n case \"public\":\n options = {\n format: \"pem\",\n type: \"spki\"\n };\n break;\n case \"private\":\n options = {\n format: \"pem\",\n type: \"pkcs8\"\n };\n break;\n }\n break;\n case 1:\n if (typeof options === \"object\" && !options.format)\n switch (this.type) {\n case \"secret\":\n options.format = \"buffer\";\n break;\n default:\n options.format = \"pem\";\n break;\n }\n }\n return exports(this[kCryptoKey], options);\n }\n equals(otherKey) {\n if (!(otherKey instanceof KeyObject))\n @throwTypeError(\"otherKey must be a KeyObject\");\n return equals(this[kCryptoKey], otherKey[kCryptoKey]);\n }\n get type() {\n return this[kCryptoKey].type;\n }\n}\ncrypto_exports.generateKeySync = function(algorithm, options) {\n return KeyObject.from(generateKeySync(algorithm, options\?.length));\n};\ncrypto_exports.generateKey = function(algorithm, options, callback) {\n try {\n const key2 = KeyObject.from(generateKeySync(algorithm, options\?.length));\n typeof callback === \"function\" && callback(null, KeyObject.from(key2));\n } catch (err) {\n typeof callback === \"function\" && callback(err);\n }\n};\ncrypto_exports.generateKeyPairSync = _generateKeyPairSync;\ncrypto_exports.generateKeyPair = function(algorithm, options, callback) {\n try {\n const result = _generateKeyPairSync(algorithm, options);\n typeof callback === \"function\" && callback(null, result.publicKey, result.privateKey);\n } catch (err) {\n typeof callback === \"function\" && callback(err);\n }\n};\ncrypto_exports.createSecretKey = function(key2, encoding) {\n if (key2 instanceof KeyObject || key2 instanceof CryptoKey) {\n if (key2.type !== \"secret\") {\n const error = @makeTypeError(`ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE: Invalid key object type ${key2.type}, expected secret`);\n throw error.code = \"ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE\", error;\n }\n return KeyObject.from(key2);\n }\n const buffer = getArrayBufferOrView(key2, encoding || \"utf8\");\n return KeyObject.from(createSecretKey(buffer));\n};\ncrypto_exports.createPrivateKey = _createPrivateKey;\ncrypto_exports.createPublicKey = _createPublicKey;\ncrypto_exports.KeyObject = KeyObject;\nvar _createSign = crypto_exports.createSign;\ncrypto_exports.sign = function(algorithm, data, key2, encoding, callback) {\n if (typeof callback === \"function\")\n try {\n const result = _createSign(algorithm).update(data, encoding).sign(key2, encoding);\n callback(null, result);\n } catch (err) {\n callback(err);\n }\n else\n return _createSign(algorithm).update(data, encoding).sign(key2, encoding);\n};\nvar _createVerify = crypto_exports.createVerify;\ncrypto_exports.verify = function(algorithm, data, key2, signature, callback) {\n if (typeof callback === \"function\")\n try {\n const result = _createVerify(algorithm).update(data).verify(key2, signature);\n callback(null, result);\n } catch (err) {\n callback(err);\n }\n else\n return _createVerify(algorithm).update(data).verify(key2, signature);\n};\nvar webcrypto = crypto;\n__export(crypto_exports, {\n DEFAULT_ENCODING: () => DEFAULT_ENCODING,\n getRandomValues: () => getRandomValues,\n randomUUID: () => randomUUID,\n randomInt: () => randomInt,\n getCurves: () => getCurves,\n scrypt: () => scrypt,\n scryptSync: () => scryptSync,\n timingSafeEqual: () => timingSafeEqual,\n webcrypto: () => webcrypto,\n subtle: () => webcrypto.subtle\n});\n$ = crypto_exports;\n/*! safe-buffer. MIT License. Feross Aboukhadijeh */\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeDgramCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/dgram.ts\nvar createSocket = function() {\n throwNotImplemented(\"node:dgram createSocket\", 1630);\n}, Socket = function() {\n throwNotImplemented(\"node:dgram Socket\", 1630);\n}, _createSocketHandle = function() {\n throwNotImplemented(\"node:dgram _createSocketHandle\", 1630);\n}, $, { hideFromStack, throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6);\n$ = {\n createSocket,\n Socket,\n _createSocketHandle\n};\nhideFromStack(createSocket, Socket, _createSocketHandle);\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeDiagnosticsChannelCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/diagnostics_channel.ts\nvar markActive = function(channel) {\n ObjectSetPrototypeOf(channel, ActiveChannel.prototype), channel._subscribers = [], channel._stores = new SafeMap;\n}, maybeMarkInactive = function(channel) {\n if (!channel._subscribers.length && !channel._stores.size)\n ObjectSetPrototypeOf(channel, Channel.prototype), channel._subscribers = @undefined, channel._stores = @undefined;\n}, defaultTransform = function(data) {\n return data;\n}, wrapStoreRun = function(store, data, next, transform = defaultTransform) {\n return () => {\n let context;\n try {\n context = transform(data);\n } catch (err) {\n return process.nextTick(() => reportError(err)), next();\n }\n return store.run(context, next);\n };\n}, channel = function(name) {\n const channel2 = channels.get(name);\n if (channel2)\n return channel2;\n if (typeof name !== \"string\" && typeof name !== \"symbol\")\n throw new ERR_INVALID_ARG_TYPE(\"channel\", [\"string\", \"symbol\"], name);\n return new Channel(name);\n}, subscribe = function(name, subscription) {\n return channel(name).subscribe(subscription);\n}, unsubscribe = function(name, subscription) {\n return channel(name).unsubscribe(subscription);\n}, hasSubscribers = function(name) {\n const channel2 = channels.get(name);\n if (!channel2)\n return !1;\n return channel2.hasSubscribers;\n}, assertChannel = function(value, name) {\n if (!(value instanceof Channel))\n throw new ERR_INVALID_ARG_TYPE(name, [\"Channel\"], value);\n}, tracingChannel = function(nameOrChannels) {\n return new TracingChannel(nameOrChannels);\n}, validateFunction = function(callable, field) {\n if (typeof callable !== \"function\")\n throw new ERR_INVALID_ARG_TYPE(field, \"Function\", callable);\n return callable;\n}, $, SafeMap = Map, SafeFinalizationRegistry = FinalizationRegistry, ArrayPrototypeAt = (array, index) => array[index], ArrayPrototypeIndexOf = (array, value) => array.indexOf(value), ArrayPrototypePush = (array, value) => array.push(value), ArrayPrototypeSplice = (array, start, deleteCount) => array.splice(start, deleteCount), ObjectGetPrototypeOf = Object.getPrototypeOf, ObjectSetPrototypeOf = Object.setPrototypeOf, SymbolHasInstance = Symbol.hasInstance, ReflectApply = @getByIdDirect(Reflect, \"apply\"), PromiseResolve = @Promise.resolve, PromiseReject = @Promise.reject, PromisePrototypeThen = (promise, onFulfilled, onRejected) => promise.then(onFulfilled, onRejected);\n\nclass WeakReference extends WeakRef {\n constructor() {\n super(...arguments);\n }\n #refs = 0;\n get() {\n return this.deref();\n }\n incRef() {\n return ++this.#refs;\n }\n decRef() {\n return --this.#refs;\n }\n}\n\nclass WeakRefMap extends SafeMap {\n constructor() {\n super(...arguments);\n }\n #finalizers = new SafeFinalizationRegistry((key) => {\n this.delete(key);\n });\n set(key, value) {\n return this.#finalizers.register(value, key), super.set(key, new WeakReference(value));\n }\n get(key) {\n return super.get(key)\?.get();\n }\n incRef(key) {\n return super.get(key)\?.incRef();\n }\n decRef(key) {\n return super.get(key)\?.decRef();\n }\n}\n\nclass ActiveChannel {\n subscribe(subscription) {\n validateFunction(subscription, \"subscription\"), ArrayPrototypePush(this._subscribers, subscription), channels.incRef(this.name);\n }\n unsubscribe(subscription) {\n const index = ArrayPrototypeIndexOf(this._subscribers, subscription);\n if (index === -1)\n return !1;\n return ArrayPrototypeSplice(this._subscribers, index, 1), channels.decRef(this.name), maybeMarkInactive(this), !0;\n }\n bindStore(store, transform) {\n if (!this._stores.has(store))\n channels.incRef(this.name);\n this._stores.set(store, transform);\n }\n unbindStore(store) {\n if (!this._stores.has(store))\n return !1;\n return this._stores.delete(store), channels.decRef(this.name), maybeMarkInactive(this), !0;\n }\n get hasSubscribers() {\n return !0;\n }\n publish(data) {\n for (let i = 0;i < (this._subscribers\?.length || 0); i++)\n try {\n const onMessage = this._subscribers[i];\n onMessage(data, this.name);\n } catch (err) {\n process.nextTick(() => reportError(err));\n }\n }\n runStores(data, fn, thisArg, ...args) {\n let run = () => {\n return this.publish(data), ReflectApply(fn, thisArg, args);\n };\n for (let entry of this._stores.entries()) {\n const store = entry[0], transform = entry[1];\n run = wrapStoreRun(store, data, run, transform);\n }\n return run();\n }\n}\n\nclass Channel {\n constructor(name) {\n this._subscribers = @undefined, this._stores = @undefined, this.name = name, channels.set(name, this);\n }\n static [SymbolHasInstance](instance) {\n const prototype = ObjectGetPrototypeOf(instance);\n return prototype === Channel.prototype || prototype === ActiveChannel.prototype;\n }\n subscribe(subscription) {\n markActive(this), this.subscribe(subscription);\n }\n unsubscribe() {\n return !1;\n }\n bindStore(store, transform) {\n markActive(this), this.bindStore(store, transform);\n }\n unbindStore() {\n return !1;\n }\n get hasSubscribers() {\n return !1;\n }\n publish() {\n }\n runStores(data, fn, thisArg, ...args) {\n return ReflectApply(fn, thisArg, args);\n }\n}\nvar channels = new WeakRefMap, traceEvents = [\"start\", \"end\", \"asyncStart\", \"asyncEnd\", \"error\"];\n\nclass TracingChannel {\n constructor(nameOrChannels) {\n if (typeof nameOrChannels === \"string\")\n this.start = channel(`tracing:${nameOrChannels}:start`), this.end = channel(`tracing:${nameOrChannels}:end`), this.asyncStart = channel(`tracing:${nameOrChannels}:asyncStart`), this.asyncEnd = channel(`tracing:${nameOrChannels}:asyncEnd`), this.error = channel(`tracing:${nameOrChannels}:error`);\n else if (typeof nameOrChannels === \"object\") {\n const { start, end, asyncStart, asyncEnd, error } = nameOrChannels;\n assertChannel(start, \"nameOrChannels.start\"), assertChannel(end, \"nameOrChannels.end\"), assertChannel(asyncStart, \"nameOrChannels.asyncStart\"), assertChannel(asyncEnd, \"nameOrChannels.asyncEnd\"), assertChannel(error, \"nameOrChannels.error\"), this.start = start, this.end = end, this.asyncStart = asyncStart, this.asyncEnd = asyncEnd, this.error = error;\n } else\n throw new ERR_INVALID_ARG_TYPE(\"nameOrChannels\", [\"string\", \"object\", \"Channel\"], nameOrChannels);\n }\n subscribe(handlers) {\n for (let name of traceEvents) {\n if (!handlers[name])\n continue;\n this[name]\?.subscribe(handlers[name]);\n }\n }\n unsubscribe(handlers) {\n let done = !0;\n for (let name of traceEvents) {\n if (!handlers[name])\n continue;\n if (!this[name]\?.unsubscribe(handlers[name]))\n done = !1;\n }\n return done;\n }\n traceSync(fn, context = {}, thisArg, ...args) {\n const { start, end, error } = this;\n return start.runStores(context, () => {\n try {\n const result = ReflectApply(fn, thisArg, args);\n return context.result = result, result;\n } catch (err) {\n throw context.error = err, error.publish(context), err;\n } finally {\n end.publish(context);\n }\n });\n }\n tracePromise(fn, context = {}, thisArg, ...args) {\n const { start, end, asyncStart, asyncEnd, error } = this;\n function reject(err) {\n return context.error = err, error.publish(context), asyncStart.publish(context), asyncEnd.publish(context), PromiseReject(err);\n }\n function resolve(result) {\n return context.result = result, asyncStart.publish(context), asyncEnd.publish(context), result;\n }\n return start.runStores(context, () => {\n try {\n let promise = ReflectApply(fn, thisArg, args);\n if (!(promise instanceof @Promise))\n promise = PromiseResolve(promise);\n return PromisePrototypeThen(promise, resolve, reject);\n } catch (err) {\n throw context.error = err, error.publish(context), err;\n } finally {\n end.publish(context);\n }\n });\n }\n traceCallback(fn, position = -1, context = {}, thisArg, ...args) {\n const { start, end, asyncStart, asyncEnd, error } = this;\n function wrappedCallback(err, res) {\n if (err)\n context.error = err, error.publish(context);\n else\n context.result = res;\n asyncStart.runStores(context, () => {\n try {\n if (callback)\n return ReflectApply(callback, this, arguments);\n } finally {\n asyncEnd.publish(context);\n }\n });\n }\n const callback = ArrayPrototypeAt(args, position);\n if (typeof callback !== \"function\")\n throw new ERR_INVALID_ARG_TYPE(\"callback\", [\"function\"], callback);\n return ArrayPrototypeSplice(args, position, 1, wrappedCallback), start.runStores(context, () => {\n try {\n return ReflectApply(fn, thisArg, args);\n } catch (err) {\n throw context.error = err, error.publish(context), err;\n } finally {\n end.publish(context);\n }\n });\n }\n}\n\nclass ERR_INVALID_ARG_TYPE extends TypeError {\n constructor(name, expected, actual) {\n super(`The ${name} argument must be of type ${expected}. Received type ${typeof actual}`);\n this.code = \"ERR_INVALID_ARG_TYPE\";\n }\n}\n$ = {\n channel,\n hasSubscribers,\n subscribe,\n tracingChannel,\n unsubscribe,\n Channel\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeDNSCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/dns.ts\nvar getServers = function() {\n return dns.getServers();\n}, lookup = function(domain, options, callback) {\n if (typeof options == \"function\")\n callback = options;\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n if (typeof options == \"number\")\n options = { family: options };\n if (domain !== domain || typeof domain !== \"number\" && !domain) {\n console.warn(`DeprecationWarning: The provided hostname \"${@String(domain)}\" is not a valid hostname, and is supported in the dns module solely for compatibility.`), callback(null, null, 4);\n return;\n }\n dns.lookup(domain, options).then((res) => {\n if (res.sort((a, b) => a.family - b.family), options\?.all)\n callback(null, res.map(mapLookupAll));\n else {\n const [{ address, family }] = res;\n callback(null, address, family);\n }\n }, (error) => {\n callback(error);\n });\n}, resolveSrv = function(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveSrv(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, resolveTxt = function(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveTxt(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, resolveSoa = function(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveSoa(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, resolveNaptr = function(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveNaptr(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, resolveMx = function(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveMx(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, resolveCaa = function(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveCaa(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, resolveNs = function(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveNs(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, resolvePtr = function(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolvePtr(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, resolveCname = function(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveCname(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, lookupService = function(address, port, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.lookupService(address, port, callback).then((results) => {\n callback(null, ...results);\n }, (error) => {\n callback(error);\n });\n}, reverse = function(ip, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.reverse(ip, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, resolve = function(hostname, rrtype, callback) {\n if (typeof rrtype == \"function\")\n callback = rrtype;\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolve(hostname).then((results) => {\n switch (rrtype\?.toLowerCase()) {\n case \"a\":\n case \"aaaa\":\n callback(null, hostname, results.map(({ address }) => address));\n break;\n default:\n callback(null, results);\n break;\n }\n }, (error) => {\n callback(error);\n });\n}, Resolver = function(options) {\n return new InternalResolver(options);\n}, setDefaultResultOrder = function() {\n}, setServers = function() {\n}, $, dns = Bun.dns, InternalResolver = class Resolver2 {\n constructor(options) {\n }\n cancel() {\n }\n getServers() {\n return [];\n }\n resolve(hostname, rrtype, callback) {\n if (typeof rrtype == \"function\")\n callback = rrtype, rrtype = null;\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolve(hostname).then((results) => {\n switch (rrtype\?.toLowerCase()) {\n case \"a\":\n case \"aaaa\":\n callback(null, hostname, results.map(mapResolveX));\n break;\n default:\n callback(null, results);\n break;\n }\n }, (error) => {\n callback(error);\n });\n }\n resolve4(hostname, options, callback) {\n if (typeof options == \"function\")\n callback = options, options = null;\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.lookup(hostname, { family: 4 }).then((addresses) => {\n callback(null, options\?.ttl \? addresses : addresses.map(mapResolveX));\n }, (error) => {\n callback(error);\n });\n }\n resolve6(hostname, options, callback) {\n if (typeof options == \"function\")\n callback = options, options = null;\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.lookup(hostname, { family: 6 }).then((addresses) => {\n callback(null, options\?.ttl \? addresses : addresses.map(({ address }) => address));\n }, (error) => {\n callback(error);\n });\n }\n resolveAny(hostname, callback) {\n callback(null, []);\n }\n resolveCname(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveCname(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n resolveMx(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveMx(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n resolveNaptr(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveNaptr(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n resolveNs(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveNs(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n resolvePtr(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolvePtr(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n resolveSrv(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveSrv(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n resolveCaa(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveCaa(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n resolveTxt(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveTxt(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n resolveSoa(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveSoa(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n reverse(ip, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.reverse(ip, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n setServers(servers) {\n }\n};\nResolver.prototype = {};\nObject.setPrototypeOf(Resolver.prototype, InternalResolver.prototype);\nObject.setPrototypeOf(Resolver, InternalResolver);\nvar {\n resolve,\n resolve4,\n resolve6,\n resolveAny,\n resolveCname,\n resolveCaa,\n resolveMx,\n resolveNaptr,\n resolveNs,\n resolvePtr,\n resolveSoa,\n resolveSrv,\n reverse,\n resolveTxt\n} = InternalResolver.prototype, promisifyLookup = (res) => {\n res.sort((a, b) => a.family - b.family);\n const [{ address, family }] = res;\n return { address, family };\n}, mapLookupAll = (res) => {\n const { address, family } = res;\n return { address, family };\n}, promisifyLookupAll = (res) => {\n return res.sort((a, b) => a.family - b.family), res.map(mapLookupAll);\n}, mapResolveX = (a) => a.address, promisifyResolveX = (res) => {\n return res\?.map(mapResolveX);\n}, promises = {\n lookup(domain, options) {\n if (options\?.all)\n return dns.lookup(domain, options).then(promisifyLookupAll);\n return dns.lookup(domain, options).then(promisifyLookup);\n },\n lookupService(address, port) {\n return dns.lookupService(address, port);\n },\n resolve(hostname, rrtype) {\n if (typeof rrtype !== \"string\")\n rrtype = null;\n switch (rrtype\?.toLowerCase()) {\n case \"a\":\n case \"aaaa\":\n return dns.resolve(hostname, rrtype).then(promisifyLookup);\n default:\n return dns.resolve(hostname, rrtype);\n }\n },\n resolve4(hostname, options) {\n if (options\?.ttl)\n return dns.lookup(hostname, { family: 4 });\n return dns.lookup(hostname, { family: 4 }).then(promisifyResolveX);\n },\n resolve6(hostname, options) {\n if (options\?.ttl)\n return dns.lookup(hostname, { family: 6 });\n return dns.lookup(hostname, { family: 6 }).then(promisifyResolveX);\n },\n resolveSrv(hostname) {\n return dns.resolveSrv(hostname);\n },\n resolveTxt(hostname) {\n return dns.resolveTxt(hostname);\n },\n resolveSoa(hostname) {\n return dns.resolveSoa(hostname);\n },\n resolveNaptr(hostname) {\n return dns.resolveNaptr(hostname);\n },\n resolveMx(hostname) {\n return dns.resolveMx(hostname);\n },\n resolveCaa(hostname) {\n return dns.resolveCaa(hostname);\n },\n resolveNs(hostname) {\n return dns.resolveNs(hostname);\n },\n resolvePtr(hostname) {\n return dns.resolvePtr(hostname);\n },\n resolveCname(hostname) {\n return dns.resolveCname(hostname);\n },\n reverse(ip) {\n return dns.reverse(ip);\n },\n Resolver: class Resolver3 {\n constructor(options) {\n }\n cancel() {\n }\n getServers() {\n return [];\n }\n resolve(hostname, rrtype) {\n if (typeof rrtype !== \"string\")\n rrtype = null;\n switch (rrtype\?.toLowerCase()) {\n case \"a\":\n case \"aaaa\":\n return dns.resolve(hostname, rrtype).then(promisifyLookup);\n default:\n return dns.resolve(hostname, rrtype);\n }\n }\n resolve4(hostname, options) {\n if (options\?.ttl)\n return dns.lookup(hostname, { family: 4 });\n return dns.lookup(hostname, { family: 4 }).then(promisifyResolveX);\n }\n resolve6(hostname, options) {\n if (options\?.ttl)\n return dns.lookup(hostname, { family: 6 });\n return dns.lookup(hostname, { family: 6 }).then(promisifyResolveX);\n }\n resolveAny(hostname) {\n return @Promise.resolve([]);\n }\n resolveCname(hostname) {\n return dns.resolveCname(hostname);\n }\n resolveMx(hostname) {\n return dns.resolveMx(hostname);\n }\n resolveNaptr(hostname) {\n return dns.resolveNaptr(hostname);\n }\n resolveNs(hostname) {\n return dns.resolveNs(hostname);\n }\n resolvePtr(hostname) {\n return dns.resolvePtr(hostname);\n }\n resolveSoa(hostname) {\n return dns.resolveSoa(hostname);\n }\n resolveSrv(hostname) {\n return dns.resolveSrv(hostname);\n }\n resolveCaa(hostname) {\n return dns.resolveCaa(hostname);\n }\n resolveTxt(hostname) {\n return dns.resolveTxt(hostname);\n }\n reverse(ip) {\n return dns.reverse(ip);\n }\n setServers(servers) {\n }\n }\n};\nfor (let key of [\"resolveAny\"])\n promises[key] = () => @Promise.resolve(@undefined);\n$ = {\n ADDRCONFIG: 0,\n ALL: 1,\n V4MAPPED: 2,\n NODATA: \"DNS_ENODATA\",\n FORMERR: \"DNS_EFORMERR\",\n SERVFAIL: \"DNS_ESERVFAIL\",\n NOTFOUND: \"DNS_ENOTFOUND\",\n NOTIMP: \"DNS_ENOTIMP\",\n REFUSED: \"DNS_EREFUSED\",\n BADQUERY: \"DNS_EBADQUERY\",\n BADNAME: \"DNS_EBADNAME\",\n BADFAMILY: \"DNS_EBADFAMILY\",\n BADRESP: \"DNS_EBADRESP\",\n CONNREFUSED: \"DNS_ECONNREFUSED\",\n TIMEOUT: \"DNS_ETIMEOUT\",\n EOF: \"DNS_EEOF\",\n FILE: \"DNS_EFILE\",\n NOMEM: \"DNS_ENOMEM\",\n DESTRUCTION: \"DNS_EDESTRUCTION\",\n BADSTR: \"DNS_EBADSTR\",\n BADFLAGS: \"DNS_EBADFLAGS\",\n NONAME: \"DNS_ENONAME\",\n BADHINTS: \"DNS_EBADHINTS\",\n NOTINITIALIZED: \"DNS_ENOTINITIALIZED\",\n LOADIPHLPAPI: \"DNS_ELOADIPHLPAPI\",\n ADDRGETNETWORKPARAMS: \"DNS_EADDRGETNETWORKPARAMS\",\n CANCELLED: \"DNS_ECANCELLED\",\n lookup,\n lookupService,\n Resolver,\n setServers,\n setDefaultResultOrder,\n resolve,\n reverse,\n resolve4,\n resolve6,\n resolveAny,\n resolveCname,\n resolveCaa,\n resolveMx,\n resolveNs,\n resolvePtr,\n resolveSoa,\n resolveSrv,\n resolveTxt,\n resolveNaptr,\n promises,\n getServers\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeDNSPromisesCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/dns.promises.ts\nreturn (@getInternalField(@internalModuleRegistry, 17) || @createInternalModuleById(17)).promises})\n"); -// - -// -static constexpr ASCIILiteral NodeDomainCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/domain.ts\nvar EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20), domain = {};\ndomain.createDomain = domain.create = function() {\n var d = new EventEmitter;\n function emitError(e) {\n d.emit(\"error\", e);\n }\n return d.add = function(emitter) {\n emitter.on(\"error\", emitError);\n }, d.remove = function(emitter) {\n emitter.removeListener(\"error\", emitError);\n }, d.bind = function(fn) {\n return function() {\n var args = @Array.prototype.slice.@call(arguments);\n try {\n fn.@apply(null, args);\n } catch (err) {\n emitError(err);\n }\n };\n }, d.intercept = function(fn) {\n return function(err) {\n if (err)\n emitError(err);\n else {\n var args = @Array.prototype.slice.@call(arguments, 1);\n try {\n fn.@apply(null, args);\n } catch (err2) {\n emitError(err2);\n }\n }\n };\n }, d.run = function(fn) {\n try {\n fn();\n } catch (err) {\n emitError(err);\n }\n return this;\n }, d.dispose = function() {\n return this.removeAllListeners(), this;\n }, d.enter = d.exit = function() {\n return this;\n }, d;\n};\nreturn domain})\n"); -// - -// -static constexpr ASCIILiteral NodeEventsCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/events.ts\nvar emitError = function(emitter, args) {\n var { _events: events } = emitter;\n if (args[0] \?\?= new Error(\"Unhandled error.\"), !events)\n throw args[0];\n var errorMonitor = events[kErrorMonitor];\n if (errorMonitor)\n for (var handler of ArrayPrototypeSlice.@call(errorMonitor))\n handler.@apply(emitter, args);\n var handlers = events.error;\n if (!handlers)\n throw args[0];\n for (var handler of ArrayPrototypeSlice.@call(handlers))\n handler.@apply(emitter, args);\n return !0;\n}, addCatch = function(emitter, promise, type, args) {\n promise.then(@undefined, function(err) {\n process.nextTick(emitUnhandledRejectionOrErr, emitter, err, type, args);\n });\n}, emitUnhandledRejectionOrErr = function(emitter, err, type, args) {\n if (typeof emitter[kRejection] === \"function\")\n emitter[kRejection](err, type, ...args);\n else\n try {\n emitter[kCapture] = !1, emitter.emit(\"error\", err);\n } finally {\n emitter[kCapture] = !0;\n }\n}, overflowWarning = function(emitter, type, handlers) {\n handlers.warned = !0;\n const warn = new Error(`Possible EventEmitter memory leak detected. ${handlers.length} ${@String(type)} listeners ` + `added to [${emitter.constructor.name}]. Use emitter.setMaxListeners() to increase limit`);\n warn.name = \"MaxListenersExceededWarning\", warn.emitter = emitter, warn.type = type, warn.count = handlers.length, process.emitWarning(warn);\n}, onceWrapper = function(type, listener, ...args) {\n this.removeListener(type, listener), listener.@apply(this, args);\n}, once = function(emitter, type, options) {\n var signal = options\?.signal;\n if (validateAbortSignal(signal, \"options.signal\"), signal\?.aborted)\n throw new AbortError(@undefined, { cause: signal\?.reason });\n return new @Promise((resolve, reject) => {\n const errorListener = (err) => {\n if (emitter.removeListener(type, resolver), signal != null)\n eventTargetAgnosticRemoveListener(signal, \"abort\", abortListener);\n reject(err);\n }, resolver = (...args) => {\n if (typeof emitter.removeListener === \"function\")\n emitter.removeListener(\"error\", errorListener);\n if (signal != null)\n eventTargetAgnosticRemoveListener(signal, \"abort\", abortListener);\n resolve(args);\n };\n if (eventTargetAgnosticAddListener(emitter, type, resolver, { once: !0 }), type !== \"error\" && typeof emitter.once === \"function\")\n emitter.once(\"error\", errorListener);\n function abortListener() {\n eventTargetAgnosticRemoveListener(emitter, type, resolver), eventTargetAgnosticRemoveListener(emitter, \"error\", errorListener), reject(new AbortError(@undefined, { cause: signal\?.reason }));\n }\n if (signal != null)\n eventTargetAgnosticAddListener(signal, \"abort\", abortListener, { once: !0 });\n });\n}, on = function(emitter, type, options) {\n var { signal, close, highWatermark = Number.MAX_SAFE_INTEGER, lowWatermark = 1 } = options || {};\n throwNotImplemented(\"events.on\", 2679);\n}, getEventListeners = function(emitter, type) {\n if (emitter instanceof EventTarget)\n throwNotImplemented(\"getEventListeners with an EventTarget\", 2678);\n return emitter.listeners(type);\n}, setMaxListeners = function(n, ...eventTargets) {\n validateNumber(n, \"setMaxListeners\", 0);\n var length;\n if (eventTargets && (length = eventTargets.length))\n for (let i = 0;i < length; i++)\n eventTargets[i].setMaxListeners(n);\n else\n defaultMaxListeners = n;\n}, listenerCount = function(emitter, type) {\n return emitter.listenerCount(type);\n}, eventTargetAgnosticRemoveListener = function(emitter, name, listener, flags) {\n if (typeof emitter.removeListener === \"function\")\n emitter.removeListener(name, listener);\n else\n emitter.removeEventListener(name, listener, flags);\n}, eventTargetAgnosticAddListener = function(emitter, name, listener, flags) {\n if (typeof emitter.on === \"function\")\n if (flags.once)\n emitter.once(name, listener);\n else\n emitter.on(name, listener);\n else\n emitter.addEventListener(name, listener, flags);\n}, ERR_INVALID_ARG_TYPE = function(name, type, value) {\n const err = @makeTypeError(`The \"${name}\" argument must be of type ${type}. Received ${value}`);\n return err.code = \"ERR_INVALID_ARG_TYPE\", err;\n}, ERR_OUT_OF_RANGE = function(name, range, value) {\n const err = new RangeError(`The \"${name}\" argument is out of range. It must be ${range}. Received ${value}`);\n return err.code = \"ERR_OUT_OF_RANGE\", err;\n}, validateAbortSignal = function(signal, name) {\n if (signal !== @undefined && (signal === null || typeof signal !== \"object\" || !(\"aborted\" in signal)))\n throw new ERR_INVALID_ARG_TYPE(name, \"AbortSignal\", signal);\n}, validateNumber = function(value, name, min = @undefined, max) {\n if (typeof value !== \"number\")\n throw new ERR_INVALID_ARG_TYPE(name, \"number\", value);\n if (min != null && value < min || max != null && value > max || (min != null || max != null) && Number.isNaN(value))\n throw new ERR_OUT_OF_RANGE(name, `${min != null \? `>= ${min}` : \"\"}${min != null && max != null \? \" && \" : \"\"}${max != null \? `<= ${max}` : \"\"}`, value);\n}, checkListener = function(listener) {\n if (typeof listener !== \"function\")\n @throwTypeError(\"The listener must be a function\");\n}, { throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6), SymbolFor = Symbol.for, kCapture = Symbol(\"kCapture\"), kErrorMonitor = SymbolFor(\"events.errorMonitor\"), kMaxEventTargetListeners = Symbol(\"events.maxEventTargetListeners\"), kMaxEventTargetListenersWarned = Symbol(\"events.maxEventTargetListenersWarned\"), kWatermarkData = SymbolFor(\"nodejs.watermarkData\"), kRejection = SymbolFor(\"nodejs.rejection\"), captureRejectionSymbol = SymbolFor(\"nodejs.rejection\"), ArrayPrototypeSlice = @Array.prototype.slice, defaultMaxListeners = 10, EventEmitter = function EventEmitter2(opts) {\n if (this._events === @undefined || this._events === this.__proto__._events)\n this._events = { __proto__: null }, this._eventsCount = 0;\n if (this._maxListeners \?\?= @undefined, this[kCapture] = opts\?.captureRejections \? Boolean(opts\?.captureRejections) : EventEmitterPrototype[kCapture])\n this.emit = emitWithRejectionCapture;\n}, EventEmitterPrototype = EventEmitter.prototype = {};\nEventEmitterPrototype._events = @undefined;\nEventEmitterPrototype._eventsCount = 0;\nEventEmitterPrototype._maxListeners = @undefined;\nEventEmitterPrototype.setMaxListeners = function setMaxListeners2(n) {\n return validateNumber(n, \"setMaxListeners\", 0), this._maxListeners = n, this;\n};\nEventEmitterPrototype.constructor = EventEmitter;\nEventEmitterPrototype.getMaxListeners = function getMaxListeners() {\n return this._maxListeners \?\? defaultMaxListeners;\n};\nvar emitWithoutRejectionCapture = function emit(type, ...args) {\n if (type === \"error\")\n return emitError(this, args);\n var { _events: events } = this;\n if (events === @undefined)\n return !1;\n var handlers = events[type];\n if (handlers === @undefined)\n return !1;\n const maybeClonedHandlers = handlers.length > 1 \? handlers.slice() : handlers;\n for (let i = 0, { length } = maybeClonedHandlers;i < length; i++) {\n const handler = maybeClonedHandlers[i];\n switch (args.length) {\n case 0:\n handler.@call(this);\n break;\n case 1:\n handler.@call(this, args[0]);\n break;\n case 2:\n handler.@call(this, args[0], args[1]);\n break;\n case 3:\n handler.@call(this, args[0], args[1], args[2]);\n break;\n default:\n handler.@apply(this, args);\n break;\n }\n }\n return !0;\n}, emitWithRejectionCapture = function emit2(type, ...args) {\n if (type === \"error\")\n return emitError(this, args);\n var { _events: events } = this;\n if (events === @undefined)\n return !1;\n var handlers = events[type];\n if (handlers === @undefined)\n return !1;\n const maybeClonedHandlers = handlers.length > 1 \? handlers.slice() : handlers;\n for (let i = 0, { length } = maybeClonedHandlers;i < length; i++) {\n const handler = maybeClonedHandlers[i];\n let result;\n switch (args.length) {\n case 0:\n result = handler.@call(this);\n break;\n case 1:\n result = handler.@call(this, args[0]);\n break;\n case 2:\n result = handler.@call(this, args[0], args[1]);\n break;\n case 3:\n result = handler.@call(this, args[0], args[1], args[2]);\n break;\n default:\n result = handler.@apply(this, args);\n break;\n }\n if (result !== @undefined && @isPromise(result))\n addCatch(this, result, type, args);\n }\n return !0;\n};\nEventEmitterPrototype.emit = emitWithoutRejectionCapture;\nEventEmitterPrototype.addListener = function addListener(type, fn) {\n checkListener(fn);\n var events = this._events;\n if (!events)\n events = this._events = { __proto__: null }, this._eventsCount = 0;\n else if (events.newListener)\n this.emit(\"newListener\", type, fn.listener \?\? fn);\n var handlers = events[type];\n if (!handlers)\n events[type] = [fn], this._eventsCount++;\n else {\n handlers.push(fn);\n var m = this._maxListeners \?\? defaultMaxListeners;\n if (m > 0 && handlers.length > m && !handlers.warned)\n overflowWarning(this, type, handlers);\n }\n return this;\n};\nEventEmitterPrototype.on = EventEmitterPrototype.addListener;\nEventEmitterPrototype.prependListener = function prependListener(type, fn) {\n checkListener(fn);\n var events = this._events;\n if (!events)\n events = this._events = { __proto__: null }, this._eventsCount = 0;\n else if (events.newListener)\n this.emit(\"newListener\", type, fn.listener \?\? fn);\n var handlers = events[type];\n if (!handlers)\n events[type] = [fn], this._eventsCount++;\n else {\n handlers.unshift(fn);\n var m = this._maxListeners \?\? defaultMaxListeners;\n if (m > 0 && handlers.length > m && !handlers.warned)\n overflowWarning(this, type, handlers);\n }\n return this;\n};\nEventEmitterPrototype.once = function once2(type, fn) {\n checkListener(fn);\n const bound = onceWrapper.bind(this, type, fn);\n return bound.listener = fn, this.addListener(type, bound), this;\n};\nEventEmitterPrototype.prependOnceListener = function prependOnceListener(type, fn) {\n checkListener(fn);\n const bound = onceWrapper.bind(this, type, fn);\n return bound.listener = fn, this.prependListener(type, bound), this;\n};\nEventEmitterPrototype.removeListener = function removeListener(type, fn) {\n checkListener(fn);\n var { _events: events } = this;\n if (!events)\n return this;\n var handlers = events[type];\n if (!handlers)\n return this;\n var length = handlers.length;\n let position = -1;\n for (let i = length - 1;i >= 0; i--)\n if (handlers[i] === fn || handlers[i].listener === fn) {\n position = i;\n break;\n }\n if (position < 0)\n return this;\n if (position === 0)\n handlers.shift();\n else\n handlers.splice(position, 1);\n if (handlers.length === 0)\n delete events[type], this._eventsCount--;\n return this;\n};\nEventEmitterPrototype.off = EventEmitterPrototype.removeListener;\nEventEmitterPrototype.removeAllListeners = function removeAllListeners(type) {\n var { _events: events } = this;\n if (type && events) {\n if (events[type])\n delete events[type], this._eventsCount--;\n } else\n this._events = { __proto__: null };\n return this;\n};\nEventEmitterPrototype.listeners = function listeners(type) {\n var { _events: events } = this;\n if (!events)\n return [];\n var handlers = events[type];\n if (!handlers)\n return [];\n return handlers.map((x) => x.listener \?\? x);\n};\nEventEmitterPrototype.rawListeners = function rawListeners(type) {\n var { _events } = this;\n if (!_events)\n return [];\n var handlers = _events[type];\n if (!handlers)\n return [];\n return handlers.slice();\n};\nEventEmitterPrototype.listenerCount = function listenerCount2(type) {\n var { _events: events } = this;\n if (!events)\n return 0;\n return events[type]\?.length \?\? 0;\n};\nEventEmitterPrototype.eventNames = function eventNames() {\n return this._eventsCount > 0 \? Reflect.ownKeys(this._events) : [];\n};\nEventEmitterPrototype[kCapture] = !1;\n\nclass AbortError extends Error {\n constructor(message = \"The operation was aborted\", options = @undefined) {\n if (options !== @undefined && typeof options !== \"object\")\n throw new codes.ERR_INVALID_ARG_TYPE(\"options\", \"Object\", options);\n super(message, options);\n this.code = \"ABORT_ERR\", this.name = \"AbortError\";\n }\n}\nvar AsyncResource = null;\n\nclass EventEmitterAsyncResource extends EventEmitter {\n triggerAsyncId;\n asyncResource;\n constructor(options) {\n if (!AsyncResource)\n AsyncResource = (@getInternalField(@internalModuleRegistry, 10) || @createInternalModuleById(10)).AsyncResource;\n var { captureRejections = !1, triggerAsyncId, name = new.target.name, requireManualDestroy } = options || {};\n super({ captureRejections });\n this.triggerAsyncId = triggerAsyncId \?\? 0, this.asyncResource = new AsyncResource(name, { triggerAsyncId, requireManualDestroy });\n }\n emit(...args) {\n this.asyncResource.runInAsyncScope(() => super.emit(...args));\n }\n emitDestroy() {\n this.asyncResource.emitDestroy();\n }\n}\nObject.defineProperties(EventEmitter, {\n captureRejections: {\n get() {\n return EventEmitterPrototype[kCapture];\n },\n set(value) {\n validateBoolean(value, \"EventEmitter.captureRejections\"), EventEmitterPrototype[kCapture] = value;\n },\n enumerable: !0\n },\n defaultMaxListeners: {\n enumerable: !0,\n get: () => {\n return defaultMaxListeners;\n },\n set: (arg) => {\n validateNumber(arg, \"defaultMaxListeners\", 0), defaultMaxListeners = arg;\n }\n },\n kMaxEventTargetListeners: {\n value: kMaxEventTargetListeners,\n enumerable: !1,\n configurable: !1,\n writable: !1\n },\n kMaxEventTargetListenersWarned: {\n value: kMaxEventTargetListenersWarned,\n enumerable: !1,\n configurable: !1,\n writable: !1\n }\n});\nObject.assign(EventEmitter, {\n once,\n on,\n getEventListeners,\n setMaxListeners,\n EventEmitter,\n usingDomains: !1,\n captureRejectionSymbol,\n EventEmitterAsyncResource,\n errorMonitor: kErrorMonitor,\n setMaxListeners,\n init: EventEmitter,\n listenerCount\n});\nreturn EventEmitter})\n"); -// - -// -static constexpr ASCIILiteral NodeFSCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/fs.ts\nvar getValidatedPath = function(p) {\n if (p instanceof URL)\n return Bun.fileURLToPath(p);\n if (typeof p !== \"string\")\n @throwTypeError(\"Path must be a string or URL.\");\n return (_pathModule \?\?= @getInternalField(@internalModuleRegistry, 30) || @createInternalModuleById(30)).resolve(p);\n}, watchFile = function(filename, options, listener) {\n if (filename = getValidatedPath(filename), typeof options === \"function\")\n listener = options, options = {};\n if (typeof listener !== \"function\")\n @throwTypeError(\"listener must be a function\");\n var stat = statWatchers.get(filename);\n if (!stat)\n stat = new StatWatcher(filename, options), statWatchers.set(filename, stat);\n return stat.addListener(\"change\", listener), stat;\n}, unwatchFile = function(filename, listener) {\n filename = getValidatedPath(filename);\n var stat = statWatchers.get(filename);\n if (!stat)\n return;\n if (listener) {\n if (stat.removeListener(\"change\", listener), stat.listenerCount(\"change\") !== 0)\n return;\n } else\n stat.removeAllListeners(\"change\");\n stat.stop(), statWatchers.delete(filename);\n}, callbackify = function(fsFunction, args) {\n const callback = args[args.length - 1];\n try {\n var result = fsFunction.@apply(fs, args.slice(0, args.length - 1));\n result.then((...args2) => callback(null, ...args2), (err) => callback(err));\n } catch (e) {\n if (typeof callback === \"function\")\n callback(e);\n else\n throw e;\n }\n}, createReadStream = function(path, options) {\n return new ReadStream(path, options);\n}, WriteStream_handleWrite = function(er, bytes) {\n if (er)\n return WriteStream_errorOrDestroy.@call(this, er);\n this.bytesWritten += bytes;\n}, WriteStream_internalClose = function(err, cb) {\n this[_writeStreamPathFastPathSymbol] = !1;\n var fd = this.fd;\n this[_fs].close(fd, (er) => {\n this.fd = null, cb(err || er);\n });\n}, WriteStream_errorOrDestroy = function(err) {\n var {\n _readableState: r = { destroyed: !1, autoDestroy: !1 },\n _writableState: w = { destroyed: !1, autoDestroy: !1 }\n } = this;\n if (w\?.destroyed || r\?.destroyed)\n return this;\n if (r\?.autoDestroy || w\?.autoDestroy)\n this.destroy(err);\n else if (err)\n this.emit(\"error\", err);\n}, createWriteStream = function(path, options) {\n return new WriteStream(path, options);\n}, cpSync = function(src, dest, options) {\n if (!options)\n return fs.cpSync(src, dest);\n if (typeof options !== \"object\")\n @throwTypeError(\"options must be an object\");\n if (options.dereference || options.filter || options.preserveTimestamps || options.verbatimSymlinks) {\n if (!lazy_cpSync)\n lazy_cpSync = @getInternalField(@internalModuleRegistry, 3) || @createInternalModuleById(3);\n return lazy_cpSync(src, dest, options);\n }\n return fs.cpSync(src, dest, options.recursive, options.errorOnExist, options.force \?\? !0, options.mode);\n}, cp = function(src, dest, options, callback) {\n if (typeof options === \"function\")\n callback = options, options = @undefined;\n promises.cp(src, dest, options).then(() => callback(), callback);\n}, _toUnixTimestamp = function(time, name = \"time\") {\n if (typeof time === \"string\" && +time == time)\n return +time;\n if (NumberIsFinite(time)) {\n if (time < 0)\n return DateNow() / 1000;\n return time;\n }\n if (isDate(time))\n return DatePrototypeGetTime(time) / 1000;\n @throwTypeError(`Expected ${name} to be a number or Date`);\n}, $, ReadStream, WriteStream, EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20), promises = @getInternalField(@internalModuleRegistry, 22) || @createInternalModuleById(22), Stream = @getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39), { isArrayBufferView } = @requireNativeModule(\"util/types\"), _writeStreamPathFastPathSymbol = Symbol.for(\"Bun.NodeWriteStreamFastPath\"), _fs = Symbol.for(\"#fs\"), constants = @processBindingConstants.fs, fs = Bun.fs();\n\nclass FSWatcher extends EventEmitter {\n #watcher;\n #listener;\n constructor(path, options, listener) {\n super();\n if (typeof options === \"function\")\n listener = options, options = {};\n else if (typeof options === \"string\")\n options = { encoding: options };\n if (typeof listener !== \"function\")\n listener = () => {\n };\n this.#listener = listener;\n try {\n this.#watcher = fs.watch(path, options || {}, this.#onEvent.bind(this));\n } catch (e) {\n if (!e.message\?.startsWith(\"FileNotFound\"))\n throw e;\n const notFound = new Error(`ENOENT: no such file or directory, watch '${path}'`);\n throw notFound.code = \"ENOENT\", notFound.errno = -2, notFound.path = path, notFound.syscall = \"watch\", notFound.filename = path, notFound;\n }\n }\n #onEvent(eventType, filenameOrError) {\n if (eventType === \"error\" || eventType === \"close\")\n this.emit(eventType, filenameOrError);\n else\n this.emit(\"change\", eventType, filenameOrError), this.#listener(eventType, filenameOrError);\n }\n close() {\n this.#watcher\?.close(), this.#watcher = null;\n }\n ref() {\n this.#watcher\?.ref();\n }\n unref() {\n this.#watcher\?.unref();\n }\n start() {\n }\n}\n\nclass StatWatcher extends EventEmitter {\n constructor(path, options) {\n super();\n this._handle = fs.watchFile(path, options, this.#onChange.bind(this));\n }\n #onChange(curr, prev) {\n this.emit(\"change\", curr, prev);\n }\n start() {\n }\n stop() {\n this._handle\?.close(), this._handle = null;\n }\n ref() {\n this._handle\?.ref();\n }\n unref() {\n this._handle\?.unref();\n }\n}\nvar access = function access2(...args) {\n callbackify(fs.access, args);\n}, appendFile = function appendFile2(...args) {\n callbackify(fs.appendFile, args);\n}, close = function close2(...args) {\n callbackify(fs.close, args);\n}, rm = function rm2(...args) {\n callbackify(fs.rm, args);\n}, rmdir = function rmdir2(...args) {\n callbackify(fs.rmdir, args);\n}, copyFile = function copyFile2(...args) {\n const callback = args[args.length - 1];\n if (typeof callback !== \"function\") {\n const err = @makeTypeError(\"Callback must be a function\");\n throw err.code = \"ERR_INVALID_ARG_TYPE\", err;\n }\n fs.copyFile(...args).then((result) => callback(null, result), callback);\n}, exists = function exists2(path, callback) {\n if (typeof callback !== \"function\") {\n const err = @makeTypeError(\"Callback must be a function\");\n throw err.code = \"ERR_INVALID_ARG_TYPE\", err;\n }\n try {\n fs.exists.@apply(fs, [path]).then((existed) => callback(existed), (_) => callback(!1));\n } catch (e) {\n callback(!1);\n }\n}, chown = function chown2(...args) {\n callbackify(fs.chown, args);\n}, chmod = function chmod2(...args) {\n callbackify(fs.chmod, args);\n}, fchmod = function fchmod2(...args) {\n callbackify(fs.fchmod, args);\n}, fchown = function fchown2(...args) {\n callbackify(fs.fchown, args);\n}, fstat = function fstat2(...args) {\n callbackify(fs.fstat, args);\n}, fsync = function fsync2(...args) {\n callbackify(fs.fsync, args);\n}, ftruncate = function ftruncate2(...args) {\n callbackify(fs.ftruncate, args);\n}, futimes = function futimes2(...args) {\n callbackify(fs.futimes, args);\n}, lchmod = function lchmod2(...args) {\n callbackify(fs.lchmod, args);\n}, lchown = function lchown2(...args) {\n callbackify(fs.lchown, args);\n}, link = function link2(...args) {\n callbackify(fs.link, args);\n}, mkdir = function mkdir2(...args) {\n callbackify(fs.mkdir, args);\n}, mkdtemp = function mkdtemp2(...args) {\n callbackify(fs.mkdtemp, args);\n}, open = function open2(...args) {\n callbackify(fs.open, args);\n}, read = function read2(fd, buffer, offsetOrOptions, length, position, callback) {\n let offset = offsetOrOptions, params = null;\n if (arguments.length <= 4) {\n if (arguments.length === 4)\n callback = length, params = offsetOrOptions;\n else if (arguments.length === 3) {\n if (!isArrayBufferView(buffer))\n params = buffer, { buffer = @Buffer.alloc(16384) } = params \?\? {};\n callback = offsetOrOptions;\n } else\n callback = buffer, buffer = @Buffer.alloc(16384);\n ({ offset = 0, length = buffer\?.byteLength - offset, position = null } = params \?\? {});\n }\n queueMicrotask(() => {\n try {\n var bytesRead = fs.readSync(fd, buffer, offset, length, position);\n } catch (e) {\n callback(e);\n }\n callback(null, bytesRead, buffer);\n });\n}, write = function write2(...args) {\n callbackify(fs.write, args);\n}, readdir = function readdir2(...args) {\n const callback = args[args.length - 1];\n if (typeof callback !== \"function\")\n @throwTypeError(\"Callback must be a function\");\n fs.readdir(...args).then((result) => callback(null, result), callback);\n}, readFile = function readFile2(...args) {\n const callback = args[args.length - 1];\n if (typeof callback !== \"function\")\n @throwTypeError(\"Callback must be a function\");\n fs.readFile(...args).then((result) => callback(null, result), callback);\n}, writeFile = function writeFile2(...args) {\n callbackify(fs.writeFile, args);\n}, readlink = function readlink2(...args) {\n callbackify(fs.readlink, args);\n}, realpath = function realpath2(...args) {\n const callback = args[args.length - 1];\n if (typeof callback !== \"function\")\n @throwTypeError(\"Callback must be a function\");\n fs.realpath(...args).then((result) => callback(null, result), callback);\n}, rename = function rename2(...args) {\n callbackify(fs.rename, args);\n}, lstat = function lstat2(...args) {\n const callback = args[args.length - 1];\n if (typeof callback !== \"function\")\n @throwTypeError(\"Callback must be a function\");\n fs.lstat(...args).then((result) => callback(null, result), callback);\n}, stat = function stat2(...args) {\n const callback = args[args.length - 1];\n if (typeof callback !== \"function\")\n @throwTypeError(\"Callback must be a function\");\n fs.stat(...args).then((result) => callback(null, result), callback);\n}, symlink = function symlink2(...args) {\n callbackify(fs.symlink, args);\n}, truncate = function truncate2(...args) {\n callbackify(fs.truncate, args);\n}, unlink = function unlink2(...args) {\n callbackify(fs.unlink, args);\n}, utimes = function utimes2(...args) {\n callbackify(fs.utimes, args);\n}, lutimes = function lutimes2(...args) {\n callbackify(fs.lutimes, args);\n}, accessSync = fs.accessSync.bind(fs), appendFileSync = fs.appendFileSync.bind(fs), closeSync = fs.closeSync.bind(fs), copyFileSync = fs.copyFileSync.bind(fs), existsSync = fs.existsSync.bind(fs), chownSync = fs.chownSync.bind(fs), chmodSync = fs.chmodSync.bind(fs), fchmodSync = fs.fchmodSync.bind(fs), fchownSync = fs.fchownSync.bind(fs), fstatSync = fs.fstatSync.bind(fs), fsyncSync = fs.fsyncSync.bind(fs), ftruncateSync = fs.ftruncateSync.bind(fs), futimesSync = fs.futimesSync.bind(fs), lchmodSync = fs.lchmodSync.bind(fs), lchownSync = fs.lchownSync.bind(fs), linkSync = fs.linkSync.bind(fs), lstatSync = fs.lstatSync.bind(fs), mkdirSync = fs.mkdirSync.bind(fs), mkdtempSync = fs.mkdtempSync.bind(fs), openSync = fs.openSync.bind(fs), readSync = fs.readSync.bind(fs), writeSync = fs.writeSync.bind(fs), readdirSync = fs.readdirSync.bind(fs), readFileSync = fs.readFileSync.bind(fs), writeFileSync = fs.writeFileSync.bind(fs), readlinkSync = fs.readlinkSync.bind(fs), realpathSync = fs.realpathSync.bind(fs), renameSync = fs.renameSync.bind(fs), statSync = fs.statSync.bind(fs), symlinkSync = fs.symlinkSync.bind(fs), truncateSync = fs.truncateSync.bind(fs), unlinkSync = fs.unlinkSync.bind(fs), utimesSync = fs.utimesSync.bind(fs), lutimesSync = fs.lutimesSync.bind(fs), rmSync = fs.rmSync.bind(fs), rmdirSync = fs.rmdirSync.bind(fs), writev = (fd, buffers, position, callback) => {\n if (typeof position === \"function\")\n callback = position, position = null;\n queueMicrotask(() => {\n try {\n var written = fs.writevSync(fd, buffers, position);\n } catch (e) {\n callback(e);\n }\n callback(null, written, buffers);\n });\n}, writevSync = fs.writevSync.bind(fs), readv = (fd, buffers, position, callback) => {\n if (typeof position === \"function\")\n callback = position, position = null;\n queueMicrotask(() => {\n try {\n var written = fs.readvSync(fd, buffers, position);\n } catch (e) {\n callback(e);\n }\n callback(null, written, buffers);\n });\n}, readvSync = fs.readvSync.bind(fs), Dirent = fs.Dirent, Stats = fs.Stats, watch = function watch2(path, options, listener) {\n return new FSWatcher(path, options, listener);\n}, statWatchers = new Map, _pathModule, readStreamPathFastPathSymbol = Symbol.for(\"Bun.Node.readStreamPathFastPath\"), readStreamSymbol = Symbol.for(\"Bun.NodeReadStream\"), readStreamPathOrFdSymbol = Symbol.for(\"Bun.NodeReadStreamPathOrFd\"), writeStreamSymbol = Symbol.for(\"Bun.NodeWriteStream\"), writeStreamPathFastPathSymbol = Symbol.for(\"Bun.NodeWriteStreamFastPath\"), writeStreamPathFastPathCallSymbol = Symbol.for(\"Bun.NodeWriteStreamFastPathCall\"), kIoDone = Symbol.for(\"kIoDone\"), defaultReadStreamOptions = {\n file: @undefined,\n fd: null,\n flags: \"r\",\n encoding: @undefined,\n mode: 438,\n autoClose: !0,\n emitClose: !0,\n start: 0,\n end: @Infinity,\n highWaterMark: 65536,\n fs: {\n read,\n open: (path, flags, mode, cb) => {\n var fd;\n try {\n fd = openSync(path, flags, mode);\n } catch (e) {\n cb(e);\n return;\n }\n cb(null, fd);\n },\n openSync,\n close\n },\n autoDestroy: !0\n}, ReadStreamClass;\nReadStream = function(InternalReadStream) {\n ReadStreamClass = InternalReadStream, Object.defineProperty(ReadStreamClass.prototype, Symbol.toStringTag, {\n value: \"ReadStream\",\n enumerable: !1\n });\n function ReadStream3(path, options) {\n return new InternalReadStream(path, options);\n }\n return ReadStream3.prototype = InternalReadStream.prototype, Object.defineProperty(ReadStream3, Symbol.hasInstance, {\n value(instance) {\n return instance instanceof InternalReadStream;\n }\n });\n}(class ReadStream2 extends Stream._getNativeReadableStreamPrototype(2, Stream.Readable) {\n constructor(pathOrFd, options = defaultReadStreamOptions) {\n if (typeof options !== \"object\" || !options)\n @throwTypeError(\"Expected options to be an object\");\n var {\n flags = defaultReadStreamOptions.flags,\n encoding = defaultReadStreamOptions.encoding,\n mode = defaultReadStreamOptions.mode,\n autoClose = defaultReadStreamOptions.autoClose,\n emitClose = defaultReadStreamOptions.emitClose,\n start = defaultReadStreamOptions.start,\n end = defaultReadStreamOptions.end,\n autoDestroy = defaultReadStreamOptions.autoClose,\n fs: fs2 = defaultReadStreamOptions.fs,\n highWaterMark = defaultReadStreamOptions.highWaterMark,\n fd = defaultReadStreamOptions.fd\n } = options;\n if (pathOrFd\?.constructor\?.name === \"URL\")\n pathOrFd = Bun.fileURLToPath(pathOrFd);\n var tempThis = {};\n if (fd != null) {\n if (typeof fd !== \"number\")\n @throwTypeError(\"Expected options.fd to be a number\");\n tempThis.fd = tempThis[readStreamPathOrFdSymbol] = fd, tempThis.autoClose = !1;\n } else if (typeof pathOrFd === \"string\") {\n if (pathOrFd.startsWith(\"file://\"))\n pathOrFd = Bun.fileURLToPath(pathOrFd);\n if (pathOrFd.length === 0)\n @throwTypeError(\"Expected path to be a non-empty string\");\n tempThis.path = tempThis.file = tempThis[readStreamPathOrFdSymbol] = pathOrFd;\n } else if (typeof pathOrFd === \"number\") {\n if (pathOrFd |= 0, pathOrFd < 0)\n @throwTypeError(\"Expected fd to be a positive integer\");\n tempThis.fd = tempThis[readStreamPathOrFdSymbol] = pathOrFd, tempThis.autoClose = !1;\n } else\n @throwTypeError(\"Expected a path or file descriptor\");\n if (tempThis.fd === @undefined)\n tempThis.fd = fs2.openSync(pathOrFd, flags, mode);\n var fileRef = Bun.file(tempThis.fd), stream = fileRef.stream(), native = @direct(stream);\n if (!native)\n throw new Error(\"no native readable stream\");\n var { stream: ptr } = native;\n super(ptr, {\n ...options,\n encoding,\n autoDestroy,\n autoClose,\n emitClose,\n highWaterMark\n });\n if (Object.assign(this, tempThis), this.#fileRef = fileRef, this.end = end, this._read = this.#internalRead, this.start = start, this.flags = flags, this.mode = mode, this.emitClose = emitClose, this[readStreamPathFastPathSymbol] = start === 0 && end === @Infinity && autoClose && fs2 === defaultReadStreamOptions.fs && (encoding === \"buffer\" || encoding === \"binary\" || encoding == null || encoding === \"utf-8\" || encoding === \"utf8\"), this._readableState.autoClose = autoDestroy = autoClose, this._readableState.highWaterMark = highWaterMark, start !== @undefined)\n this.pos = start;\n }\n #fileRef;\n #fs;\n file;\n path;\n fd = null;\n flags;\n mode;\n start;\n end;\n pos;\n bytesRead = 0;\n #fileSize = -1;\n _read;\n [readStreamSymbol] = !0;\n [readStreamPathOrFdSymbol];\n [readStreamPathFastPathSymbol];\n _construct(callback) {\n if (super._construct)\n super._construct(callback);\n else\n callback();\n this.emit(\"open\", this.fd), this.emit(\"ready\");\n }\n _destroy(err, cb) {\n super._destroy(err, cb);\n try {\n var fd = this.fd;\n if (this[readStreamPathFastPathSymbol] = !1, !fd)\n cb(err);\n else\n this.#fs.close(fd, (er) => {\n cb(er || err);\n }), this.fd = null;\n } catch (e) {\n throw e;\n }\n }\n close(cb) {\n if (typeof cb === \"function\")\n Stream.eos(this, cb);\n this.destroy();\n }\n push(chunk) {\n var bytesRead = chunk\?.length \?\? 0;\n if (bytesRead > 0) {\n this.bytesRead += bytesRead;\n var currPos = this.pos;\n if (currPos !== @undefined) {\n if (this.bytesRead < currPos)\n return !0;\n if (currPos === this.start) {\n var n = this.bytesRead - currPos;\n chunk = chunk.slice(-n);\n var [_, ...rest] = arguments;\n if (this.pos = this.bytesRead, this.end !== @undefined && this.bytesRead > this.end)\n chunk = chunk.slice(0, this.end - this.start + 1);\n return super.push(chunk, ...rest);\n }\n var end = this.end;\n if (end !== @undefined && this.bytesRead > end) {\n chunk = chunk.slice(0, end - currPos + 1);\n var [_, ...rest] = arguments;\n return this.pos = this.bytesRead, super.push(chunk, ...rest);\n }\n this.pos = this.bytesRead;\n }\n }\n return super.push(...arguments);\n }\n #internalRead(n) {\n var { pos, end, bytesRead, fd, encoding } = this;\n if (n = pos !== @undefined \? Math.min(end - pos + 1, n) : Math.min(end - bytesRead + 1, n), n <= 0) {\n this.push(null);\n return;\n }\n if (this.#fileSize === -1 && bytesRead === 0 && pos === @undefined) {\n var stat3 = fstatSync(fd);\n if (this.#fileSize = stat3.size, this.#fileSize > 0 && n > this.#fileSize)\n n = this.#fileSize + 1;\n }\n this[kIoDone] = !1;\n var res = super._read(n);\n if (@isPromise(res)) {\n var then = res\?.then;\n if (then && @isCallable(then))\n res.then(() => {\n if (this[kIoDone] = !0, this.destroyed)\n this.emit(kIoDone);\n }, (er) => {\n this[kIoDone] = !0, this.#errorOrDestroy(er);\n });\n } else if (this[kIoDone] = !0, this.destroyed)\n this.emit(kIoDone), this.#errorOrDestroy(new Error(\"ERR_STREAM_PREMATURE_CLOSE\"));\n }\n #errorOrDestroy(err, sync = null) {\n var {\n _readableState: r = { destroyed: !1, autoDestroy: !1 },\n _writableState: w = { destroyed: !1, autoDestroy: !1 }\n } = this;\n if (w\?.destroyed || r\?.destroyed)\n return this;\n if (r\?.autoDestroy || w\?.autoDestroy)\n this.destroy(err);\n else if (err)\n this.emit(\"error\", err);\n }\n pause() {\n return this[readStreamPathFastPathSymbol] = !1, super.pause();\n }\n resume() {\n return this[readStreamPathFastPathSymbol] = !1, super.resume();\n }\n unshift(...args) {\n return this[readStreamPathFastPathSymbol] = !1, super.unshift(...args);\n }\n pipe(dest, pipeOpts) {\n if (this[readStreamPathFastPathSymbol] && (pipeOpts\?.end \?\? !0) && this._readableState\?.pipes\?.length === 0) {\n if ((writeStreamPathFastPathSymbol in dest) && dest[writeStreamPathFastPathSymbol]) {\n if (dest[writeStreamPathFastPathCallSymbol](this, pipeOpts))\n return this;\n }\n }\n return this[readStreamPathFastPathSymbol] = !1, super.pipe(dest, pipeOpts);\n }\n});\nvar defaultWriteStreamOptions = {\n fd: null,\n start: @undefined,\n pos: @undefined,\n encoding: @undefined,\n flags: \"w\",\n mode: 438,\n fs: {\n write,\n close,\n open,\n openSync\n }\n}, WriteStreamClass = WriteStream = function WriteStream2(path, options = defaultWriteStreamOptions) {\n if (!(this instanceof WriteStream2))\n return new WriteStream2(path, options);\n if (!options)\n @throwTypeError(\"Expected options to be an object\");\n var {\n fs: fs2 = defaultWriteStreamOptions.fs,\n start = defaultWriteStreamOptions.start,\n flags = defaultWriteStreamOptions.flags,\n mode = defaultWriteStreamOptions.mode,\n autoClose = !0,\n emitClose = !1,\n autoDestroy = autoClose,\n encoding = defaultWriteStreamOptions.encoding,\n fd = defaultWriteStreamOptions.fd,\n pos = defaultWriteStreamOptions.pos\n } = options, tempThis = {};\n if (fd != null) {\n if (typeof fd !== \"number\")\n throw new Error(\"Expected options.fd to be a number\");\n tempThis.fd = fd, tempThis[_writeStreamPathFastPathSymbol] = !1;\n } else if (typeof path === \"string\") {\n if (path.length === 0)\n @throwTypeError(\"Expected a non-empty path\");\n if (path.startsWith(\"file:\"))\n path = Bun.fileURLToPath(path);\n tempThis.path = path, tempThis.fd = null, tempThis[_writeStreamPathFastPathSymbol] = autoClose && (start === @undefined || start === 0) && fs2.write === defaultWriteStreamOptions.fs.write && fs2.close === defaultWriteStreamOptions.fs.close;\n }\n if (tempThis.fd == null)\n tempThis.fd = fs2.openSync(path, flags, mode);\n if (NativeWritable.@call(this, tempThis.fd, {\n ...options,\n decodeStrings: !1,\n autoDestroy,\n emitClose,\n fd: tempThis\n }), Object.assign(this, tempThis), typeof fs2\?.write !== \"function\")\n @throwTypeError(\"Expected fs.write to be a function\");\n if (typeof fs2\?.close !== \"function\")\n @throwTypeError(\"Expected fs.close to be a function\");\n if (typeof fs2\?.open !== \"function\")\n @throwTypeError(\"Expected fs.open to be a function\");\n if (typeof path === \"object\" && path) {\n if (path instanceof URL)\n path = Bun.fileURLToPath(path);\n }\n if (typeof path !== \"string\" && typeof fd !== \"number\")\n @throwTypeError(\"Expected a path or file descriptor\");\n if (this.start = start, this[_fs] = fs2, this.flags = flags, this.mode = mode, this.bytesWritten = 0, this[writeStreamSymbol] = !0, this[kIoDone] = !1, this.start !== @undefined)\n this.pos = this.start;\n if (encoding !== defaultWriteStreamOptions.encoding) {\n if (this.setDefaultEncoding(encoding), encoding !== \"buffer\" && encoding !== \"utf8\" && encoding !== \"utf-8\" && encoding !== \"binary\")\n this[_writeStreamPathFastPathSymbol] = !1;\n }\n return this;\n}, NativeWritable = Stream.NativeWritable, WriteStreamPrototype = WriteStream.prototype = Object.create(NativeWritable.prototype);\nObject.defineProperties(WriteStreamPrototype, {\n autoClose: {\n get() {\n return this._writableState.autoDestroy;\n },\n set(val) {\n this._writableState.autoDestroy = val;\n }\n },\n pending: {\n get() {\n return this.fd === null;\n }\n }\n});\nWriteStreamPrototype.destroySoon = WriteStreamPrototype.end;\nWriteStreamPrototype.open = function open3() {\n};\nWriteStreamPrototype[writeStreamPathFastPathCallSymbol] = function WriteStreamPathFastPathCallSymbol(readStream, pipeOpts) {\n if (!this[_writeStreamPathFastPathSymbol])\n return !1;\n if (this.fd !== null)\n return this[_writeStreamPathFastPathSymbol] = !1, !1;\n return this[kIoDone] = !1, readStream[kIoDone] = !1, Bun.write(this[_writeStreamPathFastPathSymbol], readStream[readStreamPathOrFdSymbol]).then((bytesWritten) => {\n readStream[kIoDone] = this[kIoDone] = !0, this.bytesWritten += bytesWritten, readStream.bytesRead += bytesWritten, this.end(), readStream.close();\n }, (err) => {\n readStream[kIoDone] = this[kIoDone] = !0, WriteStream_errorOrDestroy.@call(this, err), readStream.emit(\"error\", err);\n });\n};\nWriteStreamPrototype.isBunFastPathEnabled = function isBunFastPathEnabled() {\n return this[_writeStreamPathFastPathSymbol];\n};\nWriteStreamPrototype.disableBunFastPath = function disableBunFastPath() {\n this[_writeStreamPathFastPathSymbol] = !1;\n};\nWriteStreamPrototype._construct = function _construct(callback) {\n if (typeof this.fd === \"number\") {\n callback();\n return;\n }\n callback(), this.emit(\"open\", this.fd), this.emit(\"ready\");\n};\nWriteStreamPrototype._destroy = function _destroy(err, cb) {\n if (this.fd === null)\n return cb(err);\n if (this[kIoDone]) {\n this.once(kIoDone, () => WriteStream_internalClose.@call(this, err, cb));\n return;\n }\n WriteStream_internalClose.@call(this, err, cb);\n};\nWriteStreamPrototype.close = function close3(cb) {\n if (cb) {\n if (this.closed) {\n process.nextTick(cb);\n return;\n }\n this.on(\"close\", cb);\n }\n if (!this.autoClose)\n this.on(\"finish\", this.destroy);\n this.end();\n};\nWriteStreamPrototype.write = function write3(chunk, encoding, cb) {\n if (encoding \?\?= this._writableState\?.defaultEncoding, this[_writeStreamPathFastPathSymbol] = !1, typeof chunk === \"string\")\n chunk = @Buffer.from(chunk, encoding);\n var native = this.pos === @undefined;\n const callback = native \? (err, bytes) => {\n if (this[kIoDone] = !1, WriteStream_handleWrite.@call(this, err, bytes), this.emit(kIoDone), cb)\n !err \? cb() : cb(err);\n } : () => {\n };\n if (this[kIoDone] = !0, this._write)\n return this._write(chunk, encoding, callback);\n else\n return NativeWritable.prototype.write.@call(this, chunk, encoding, callback, native);\n};\nWriteStreamPrototype._write = @undefined;\nWriteStreamPrototype._writev = @undefined;\nWriteStreamPrototype.end = function end(chunk, encoding, cb) {\n var native = this.pos === @undefined;\n return NativeWritable.prototype.end.@call(this, chunk, encoding, cb, native);\n};\nWriteStreamPrototype._destroy = function _destroy2(err, cb) {\n this.close(err, cb);\n};\nObject.defineProperties(fs, {\n createReadStream: {\n value: createReadStream\n },\n createWriteStream: {\n value: createWriteStream\n },\n ReadStream: {\n value: ReadStream\n },\n WriteStream: {\n value: WriteStream\n }\n});\nrealpath.native = realpath;\nrealpathSync.native = realpathSync;\nvar lazy_cpSync = null;\n$ = {\n Dirent,\n FSWatcher,\n ReadStream,\n Stats,\n WriteStream,\n _toUnixTimestamp,\n access,\n accessSync,\n appendFile,\n appendFileSync,\n chmod,\n chmodSync,\n chown,\n chownSync,\n close,\n closeSync,\n constants,\n copyFile,\n copyFileSync,\n cp,\n cpSync,\n createReadStream,\n createWriteStream,\n exists,\n existsSync,\n fchmod,\n fchmodSync,\n fchown,\n fchownSync,\n fstat,\n fstatSync,\n fsync,\n fsyncSync,\n ftruncate,\n ftruncateSync,\n futimes,\n futimesSync,\n lchmod,\n lchmodSync,\n lchown,\n lchownSync,\n link,\n linkSync,\n lstat,\n lstatSync,\n lutimes,\n lutimesSync,\n mkdir,\n mkdirSync,\n mkdtemp,\n mkdtempSync,\n open,\n openSync,\n promises,\n read,\n readFile,\n readFileSync,\n readSync,\n readdir,\n readdirSync,\n readlink,\n readlinkSync,\n readv,\n readvSync,\n realpath,\n realpathSync,\n rename,\n renameSync,\n rm,\n rmSync,\n rmdir,\n rmdirSync,\n stat,\n statSync,\n symlink,\n symlinkSync,\n truncate,\n truncateSync,\n unlink,\n unlinkSync,\n unwatchFile,\n utimes,\n utimesSync,\n watch,\n watchFile,\n write,\n writeFile,\n writeFileSync,\n writeSync,\n writev,\n writevSync,\n [Symbol.for(\"::bunternal::\")]: {\n ReadStreamClass,\n WriteStreamClass\n }\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeFSPromisesCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/fs.promises.ts\nvar watch = function(filename, options = {}) {\n if (filename instanceof URL)\n @throwTypeError(\"Watch URLs are not supported yet\");\n else if (@Buffer.isBuffer(filename))\n filename = filename.toString();\n else if (typeof filename !== \"string\")\n @throwTypeError(\"Expected path to be a string or Buffer\");\n let nextEventResolve = null;\n if (typeof options === \"string\")\n options = { encoding: options };\n const queue = @createFIFO(), watcher = fs.watch(filename, options || {}, (eventType, filename2) => {\n if (queue.push({ eventType, filename: filename2 }), nextEventResolve) {\n const resolve = nextEventResolve;\n nextEventResolve = null, resolve();\n }\n });\n return {\n [Symbol.asyncIterator]() {\n let closed = !1;\n return {\n async next() {\n while (!closed) {\n let event;\n while (event = queue.shift()) {\n if (event.eventType === \"close\")\n return closed = !0, { value: @undefined, done: !0 };\n if (event.eventType === \"error\")\n throw closed = !0, event.filename;\n return { value: event, done: !1 };\n }\n const { promise, resolve } = @Promise.withResolvers();\n nextEventResolve = resolve, await promise;\n }\n return { value: @undefined, done: !0 };\n },\n return() {\n if (!closed) {\n if (watcher.close(), closed = !0, nextEventResolve) {\n const resolve = nextEventResolve;\n nextEventResolve = null, resolve();\n }\n }\n return { value: @undefined, done: !0 };\n }\n };\n }\n };\n}, cp = function(src, dest, options) {\n if (!options)\n return fs.cp(src, dest);\n if (typeof options !== \"object\")\n @throwTypeError(\"options must be an object\");\n if (options.dereference || options.filter || options.preserveTimestamps || options.verbatimSymlinks) {\n if (!lazy_cp)\n lazy_cp = @getInternalField(@internalModuleRegistry, 3) || @createInternalModuleById(3);\n return lazy_cp(src, dest, options);\n }\n return fs.cp(src, dest, options.recursive, options.errorOnExist, options.force \?\? !0, options.mode);\n};\nasync function opendir(dir) {\n const entries = await fs.readdir(dir, { withFileTypes: !0 });\n return new Dir(entries);\n}\nvar $, constants = @processBindingConstants.fs, fs = Bun.fs();\nvar lazy_cp = null;\n\nclass Dir {\n #entries;\n constructor(e) {\n this.#entries = e;\n }\n readSync() {\n return this.#entries.shift() \?\? null;\n }\n read(c) {\n if (c)\n process.nextTick(c, null, this.readSync());\n return @Promise.resolve(this.readSync());\n }\n closeSync() {\n }\n close(c) {\n if (c)\n process.nextTick(c);\n return @Promise.resolve();\n }\n *[Symbol.asyncIterator]() {\n var next;\n while (next = this.readSync())\n yield next;\n }\n}\n$ = {\n access: fs.access.bind(fs),\n appendFile: fs.appendFile.bind(fs),\n close: fs.close.bind(fs),\n copyFile: fs.copyFile.bind(fs),\n cp,\n exists: fs.exists.bind(fs),\n chown: fs.chown.bind(fs),\n chmod: fs.chmod.bind(fs),\n fchmod: fs.fchmod.bind(fs),\n fchown: fs.fchown.bind(fs),\n fstat: fs.fstat.bind(fs),\n fsync: fs.fsync.bind(fs),\n ftruncate: fs.ftruncate.bind(fs),\n futimes: fs.futimes.bind(fs),\n lchmod: fs.lchmod.bind(fs),\n lchown: fs.lchown.bind(fs),\n link: fs.link.bind(fs),\n lstat: fs.lstat.bind(fs),\n mkdir: fs.mkdir.bind(fs),\n mkdtemp: fs.mkdtemp.bind(fs),\n open: fs.open.bind(fs),\n read: fs.read.bind(fs),\n write: fs.write.bind(fs),\n readdir: fs.readdir.bind(fs),\n readFile: fs.readFile.bind(fs),\n writeFile: fs.writeFile.bind(fs),\n readlink: fs.readlink.bind(fs),\n realpath: fs.realpath.bind(fs),\n rename: fs.rename.bind(fs),\n stat: fs.stat.bind(fs),\n symlink: fs.symlink.bind(fs),\n truncate: fs.truncate.bind(fs),\n unlink: fs.unlink.bind(fs),\n utimes: fs.utimes.bind(fs),\n lutimes: fs.lutimes.bind(fs),\n rm: fs.rm.bind(fs),\n rmdir: fs.rmdir.bind(fs),\n writev: async (fd, buffers, position) => {\n var bytesWritten = await fs.writev(fd, buffers, position);\n return {\n bytesWritten,\n buffers\n };\n },\n readv: async (fd, buffers, position) => {\n var bytesRead = await fs.readv(fd, buffers, position);\n return {\n bytesRead,\n buffers\n };\n },\n constants,\n watch,\n opendir\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeHttpCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/http.ts\nvar checkInvalidHeaderChar = function(val) {\n return RegExpPrototypeExec.@call(headerCharRegex, val) !== null;\n};\nvar isValidTLSArray = function(obj) {\n if (typeof obj === \"string\" || isTypedArray(obj) || obj instanceof @ArrayBuffer || obj instanceof Blob)\n return !0;\n if (@Array.isArray(obj)) {\n for (var i = 0;i < obj.length; i++)\n if (typeof obj !== \"string\" && !isTypedArray(obj) && !(obj instanceof @ArrayBuffer) && !(obj instanceof Blob))\n return !1;\n return !0;\n }\n}, validateMsecs = function(numberlike, field) {\n if (typeof numberlike !== \"number\" || numberlike < 0)\n throw new ERR_INVALID_ARG_TYPE(field, \"number\", numberlike);\n return numberlike;\n}, validateFunction = function(callable, field) {\n if (typeof callable !== \"function\")\n throw new ERR_INVALID_ARG_TYPE(field, \"Function\", callable);\n return callable;\n}, createServer = function(options, callback) {\n return new Server(options, callback);\n}, emitListeningNextTick = function(self, onListen, err, hostname, port) {\n if (typeof onListen === \"function\")\n try {\n onListen(err, hostname, port);\n } catch (err2) {\n self.emit(\"error\", err2);\n }\n if (self.listening = !err, err)\n self.emit(\"error\", err);\n else\n self.emit(\"listening\", hostname, port);\n}, assignHeaders = function(object, req) {\n var headers = req.headers.toJSON();\n const rawHeaders = @newArrayWithSize(req.headers.count * 2);\n var i = 0;\n for (let key in headers)\n rawHeaders[i++] = key, rawHeaders[i++] = headers[key];\n object.headers = headers, object.rawHeaders = rawHeaders;\n}, destroyBodyStreamNT = function(bodyStream) {\n bodyStream.destroy();\n}, getDefaultHTTPSAgent = function() {\n return _defaultHTTPSAgent \?\?= new Agent({ defaultPort: 443, protocol: \"https:\" });\n};\nvar urlToHttpOptions = function(url) {\n var { protocol, hostname, hash, search, pathname, href, port, username, password } = url;\n return {\n protocol,\n hostname: typeof hostname === \"string\" && StringPrototypeStartsWith.@call(hostname, \"[\") \? StringPrototypeSlice.@call(hostname, 1, -1) : hostname,\n hash,\n search,\n pathname,\n path: `${pathname || \"\"}${search || \"\"}`,\n href,\n port: port \? Number(port) : protocol === \"https:\" \? 443 : protocol === \"http:\" \? 80 : @undefined,\n auth: username || password \? `${decodeURIComponent(username)}:${decodeURIComponent(password)}` : @undefined\n };\n}, validateHost = function(host, name) {\n if (host !== null && host !== @undefined && typeof host !== \"string\")\n throw new Error(\"Invalid arg type in options\");\n return host;\n}, checkIsHttpToken = function(val) {\n return RegExpPrototypeExec.@call(tokenRegExp, val) !== null;\n};\nvar _writeHead = function(statusCode, reason, obj, response) {\n if (statusCode |= 0, statusCode < 100 || statusCode > 999)\n throw new Error(\"status code must be between 100 and 999\");\n if (typeof reason === \"string\")\n response.statusMessage = reason;\n else {\n if (!response.statusMessage)\n response.statusMessage = STATUS_CODES[statusCode] || \"unknown\";\n obj = reason;\n }\n response.statusCode = statusCode;\n {\n let k;\n if (@Array.isArray(obj)) {\n if (obj.length % 2 !== 0)\n throw new Error(\"raw headers must have an even number of elements\");\n for (let n = 0;n < obj.length; n += 2)\n if (k = obj[n + 0], k)\n response.setHeader(k, obj[n + 1]);\n } else if (obj) {\n const keys = Object.keys(obj);\n for (let i = 0;i < keys.length; i++)\n if (k = keys[i], k)\n response.setHeader(k, obj[k]);\n }\n }\n if (statusCode === 204 || statusCode === 304 || statusCode >= 100 && statusCode <= 199)\n response._hasBody = !1;\n}, request = function(url, options, cb) {\n return new ClientRequest(url, options, cb);\n}, get = function(url, options, cb) {\n const req = request(url, options, cb);\n return req.end(), req;\n}, $, EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20), { isTypedArray } = @requireNativeModule(\"util/types\"), { Duplex, Readable, Writable } = @getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39), { getHeader, setHeader } = @lazy(\"http\"), headerCharRegex = /[^\\t\\x20-\\x7e\\x80-\\xff]/, validateHeaderName = (name, label) => {\n if (typeof name !== \"string\" || !name || !checkIsHttpToken(name))\n throw new Error(\"ERR_INVALID_HTTP_TOKEN\");\n}, validateHeaderValue = (name, value) => {\n if (value === @undefined)\n throw new Error(\"ERR_HTTP_INVALID_HEADER_VALUE\");\n if (checkInvalidHeaderChar(value))\n throw new Error(\"ERR_INVALID_CHAR\");\n}, { URL } = globalThis, globalReportError = globalThis.reportError, setTimeout = globalThis.setTimeout, fetch = Bun.fetch;\nvar kEmptyObject = Object.freeze(Object.create(null)), kOutHeaders = Symbol.for(\"kOutHeaders\"), kEndCalled = Symbol.for(\"kEndCalled\"), kAbortController = Symbol.for(\"kAbortController\"), kClearTimeout = Symbol(\"kClearTimeout\"), kCorked = Symbol.for(\"kCorked\"), searchParamsSymbol = Symbol.for(\"query\"), StringPrototypeSlice = @String.prototype.slice, StringPrototypeStartsWith = @String.prototype.startsWith, StringPrototypeToUpperCase = @String.prototype.toUpperCase, ArrayIsArray = @Array.isArray, RegExpPrototypeExec = @RegExp.prototype.exec, ObjectAssign = Object.assign, INVALID_PATH_REGEX = /[^\\u0021-\\u00ff]/;\nvar _defaultHTTPSAgent, kInternalRequest = Symbol(\"kInternalRequest\"), kInternalSocketData = Symbol.for(\"::bunternal::\"), kEmptyBuffer = @Buffer.alloc(0);\n\nclass ERR_INVALID_ARG_TYPE extends TypeError {\n constructor(name, expected, actual) {\n super(`The ${name} argument must be of type ${expected}. Received type ${typeof actual}`);\n this.code = \"ERR_INVALID_ARG_TYPE\";\n }\n}\nvar FakeSocket = class Socket extends Duplex {\n [kInternalSocketData];\n bytesRead = 0;\n bytesWritten = 0;\n connecting = !1;\n timeout = 0;\n isServer = !1;\n #address;\n address() {\n var internalData;\n return this.#address \?\?= (internalData = this[kInternalSocketData])\?.[0]\?.requestIP(internalData[2]) \?\? {};\n }\n get bufferSize() {\n return this.writableLength;\n }\n connect(port, host, connectListener) {\n return this;\n }\n _destroy(err, callback) {\n }\n _final(callback) {\n }\n get localAddress() {\n return \"127.0.0.1\";\n }\n get localFamily() {\n return \"IPv4\";\n }\n get localPort() {\n return 80;\n }\n get pending() {\n return this.connecting;\n }\n _read(size) {\n }\n get readyState() {\n if (this.connecting)\n return \"opening\";\n if (this.readable)\n return this.writable \? \"open\" : \"readOnly\";\n else\n return this.writable \? \"writeOnly\" : \"closed\";\n }\n ref() {\n }\n get remoteAddress() {\n return this.address()\?.address;\n }\n set remoteAddress(val) {\n this.address().address = val;\n }\n get remotePort() {\n return this.address()\?.port;\n }\n set remotePort(val) {\n this.address().port = val;\n }\n get remoteFamily() {\n return this.address()\?.family;\n }\n set remoteFamily(val) {\n this.address().family = val;\n }\n resetAndDestroy() {\n }\n setKeepAlive(enable = !1, initialDelay = 0) {\n }\n setNoDelay(noDelay = !0) {\n return this;\n }\n setTimeout(timeout, callback) {\n return this;\n }\n unref() {\n }\n _write(chunk, encoding, callback) {\n }\n};\n\nclass Agent extends EventEmitter {\n defaultPort = 80;\n protocol = \"http:\";\n options;\n requests;\n sockets;\n freeSockets;\n keepAliveMsecs;\n keepAlive;\n maxSockets;\n maxFreeSockets;\n scheduling;\n maxTotalSockets;\n totalSocketCount;\n #fakeSocket;\n static get globalAgent() {\n return globalAgent;\n }\n static get defaultMaxSockets() {\n return @Infinity;\n }\n constructor(options = kEmptyObject) {\n super();\n if (this.options = options = { ...options, path: null }, options.noDelay === @undefined)\n options.noDelay = !0;\n this.requests = kEmptyObject, this.sockets = kEmptyObject, this.freeSockets = kEmptyObject, this.keepAliveMsecs = options.keepAliveMsecs || 1000, this.keepAlive = options.keepAlive || !1, this.maxSockets = options.maxSockets || Agent.defaultMaxSockets, this.maxFreeSockets = options.maxFreeSockets || 256, this.scheduling = options.scheduling || \"lifo\", this.maxTotalSockets = options.maxTotalSockets, this.totalSocketCount = 0, this.defaultPort = options.defaultPort || 80, this.protocol = options.protocol || \"http:\";\n }\n createConnection() {\n return this.#fakeSocket \?\?= new FakeSocket;\n }\n getName(options = kEmptyObject) {\n let name = `http:${options.host || \"localhost\"}:`;\n if (options.port)\n name += options.port;\n if (name += \":\", options.localAddress)\n name += options.localAddress;\n if (options.family === 4 || options.family === 6)\n name += `:${options.family}`;\n if (options.socketPath)\n name += `:${options.socketPath}`;\n return name;\n }\n addRequest() {\n }\n createSocket(req, options, cb) {\n cb(null, this.#fakeSocket \?\?= new FakeSocket);\n }\n removeSocket() {\n }\n keepSocketAlive() {\n return !0;\n }\n reuseSocket() {\n }\n destroy() {\n }\n}\n\nclass Server extends EventEmitter {\n #server;\n #options;\n #tls;\n #is_tls = !1;\n listening = !1;\n serverName;\n constructor(options, callback) {\n super();\n if (typeof options === \"function\")\n callback = options, options = {};\n else if (options == null || typeof options === \"object\") {\n options = { ...options }, this.#tls = null;\n let key = options.key;\n if (key) {\n if (!isValidTLSArray(key))\n @throwTypeError(\"key argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");\n this.#is_tls = !0;\n }\n let cert = options.cert;\n if (cert) {\n if (!isValidTLSArray(cert))\n @throwTypeError(\"cert argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");\n this.#is_tls = !0;\n }\n let ca = options.ca;\n if (ca) {\n if (!isValidTLSArray(ca))\n @throwTypeError(\"ca argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");\n this.#is_tls = !0;\n }\n let passphrase = options.passphrase;\n if (passphrase && typeof passphrase !== \"string\")\n @throwTypeError(\"passphrase argument must be an string\");\n let serverName = options.servername;\n if (serverName && typeof serverName !== \"string\")\n @throwTypeError(\"servername argument must be an string\");\n let secureOptions = options.secureOptions || 0;\n if (secureOptions && typeof secureOptions !== \"number\")\n @throwTypeError(\"secureOptions argument must be an number\");\n if (this.#is_tls)\n this.#tls = {\n serverName,\n key,\n cert,\n ca,\n passphrase,\n secureOptions\n };\n else\n this.#tls = null;\n } else\n throw new Error(\"bun-http-polyfill: invalid arguments\");\n if (this.#options = options, callback)\n this.on(\"request\", callback);\n }\n closeAllConnections() {\n const server = this.#server;\n if (!server)\n return;\n this.#server = @undefined, server.stop(!0), this.emit(\"close\");\n }\n closeIdleConnections() {\n }\n close(optionalCallback) {\n const server = this.#server;\n if (!server) {\n if (typeof optionalCallback === \"function\")\n process.nextTick(optionalCallback, new Error(\"Server is not running\"));\n return;\n }\n if (this.#server = @undefined, typeof optionalCallback === \"function\")\n this.once(\"close\", optionalCallback);\n server.stop(), this.emit(\"close\");\n }\n address() {\n if (!this.#server)\n return null;\n return this.#server.address;\n }\n listen(port, host, backlog, onListen) {\n const server = this;\n let socketPath;\n if (typeof port == \"string\" && !Number.isSafeInteger(Number(port)))\n socketPath = port;\n if (typeof host === \"function\")\n onListen = host, host = @undefined;\n if (typeof port === \"function\")\n onListen = port;\n else if (typeof port === \"object\") {\n if (port\?.signal\?.addEventListener(\"abort\", () => {\n this.close();\n }), host = port\?.host, port = port\?.port, typeof port\?.callback === \"function\")\n onListen = port\?.callback;\n }\n if (typeof backlog === \"function\")\n onListen = backlog;\n const ResponseClass = this.#options.ServerResponse || ServerResponse, RequestClass = this.#options.IncomingMessage || IncomingMessage;\n try {\n const tls = this.#tls;\n if (tls)\n this.serverName = tls.serverName || host || \"localhost\";\n this.#server = Bun.serve({\n tls,\n port,\n hostname: host,\n unix: socketPath,\n websocket: {\n open(ws) {\n ws.data.open(ws);\n },\n message(ws, message) {\n ws.data.message(ws, message);\n },\n close(ws, code, reason) {\n ws.data.close(ws, code, reason);\n },\n drain(ws) {\n ws.data.drain(ws);\n }\n },\n fetch(req, _server) {\n var pendingResponse, pendingError, rejectFunction, resolveFunction, reject = (err) => {\n if (pendingError)\n return;\n if (pendingError = err, rejectFunction)\n rejectFunction(err);\n }, reply = function(resp) {\n if (pendingResponse)\n return;\n if (pendingResponse = resp, resolveFunction)\n resolveFunction(resp);\n };\n const http_req = new RequestClass(req), http_res = new ResponseClass({ reply, req: http_req });\n if (http_req.socket[kInternalSocketData] = [_server, http_res, req], http_req.once(\"error\", (err) => reject(err)), http_res.once(\"error\", (err) => reject(err)), req.headers.get(\"upgrade\"))\n server.emit(\"upgrade\", http_req, http_req.socket, kEmptyBuffer);\n else\n server.emit(\"request\", http_req, http_res);\n if (pendingError)\n throw pendingError;\n if (pendingResponse)\n return pendingResponse;\n return new @Promise((resolve, reject2) => {\n resolveFunction = resolve, rejectFunction = reject2;\n });\n }\n }), setTimeout(emitListeningNextTick, 1, this, onListen, null, this.#server.hostname, this.#server.port);\n } catch (err) {\n server.emit(\"error\", err);\n }\n return this;\n }\n setTimeout(msecs, callback) {\n }\n}\nclass IncomingMessage extends Readable {\n method;\n complete;\n constructor(req, defaultIncomingOpts) {\n const method = req.method;\n super();\n const url = new URL(req.url);\n var { type = \"request\", [kInternalRequest]: nodeReq } = defaultIncomingOpts || {};\n this.#noBody = type === \"request\" \? method === \"GET\" || method === \"HEAD\" || method === \"TRACE\" || method === \"CONNECT\" || method === \"OPTIONS\" || (parseInt(req.headers.get(\"Content-Length\") || \"\") || 0) === 0 : !1, this.#req = req, this.method = method, this.#type = type, this.complete = !!this.#noBody, this.#bodyStream = @undefined;\n const socket = new FakeSocket;\n if (url.protocol === \"https:\")\n socket.encrypted = !0;\n this.#fakeSocket = socket, this.url = url.pathname + url.search, this.req = nodeReq, assignHeaders(this, req);\n }\n headers;\n rawHeaders;\n _consuming = !1;\n _dumped = !1;\n #bodyStream;\n #fakeSocket;\n #noBody = !1;\n #aborted = !1;\n #req;\n url;\n #type;\n _construct(callback) {\n if (this.#type === \"response\" || this.#noBody) {\n callback();\n return;\n }\n const contentLength = this.#req.headers.get(\"content-length\");\n if ((contentLength \? parseInt(contentLength, 10) : 0) === 0) {\n this.#noBody = !0, callback();\n return;\n }\n callback();\n }\n async#consumeStream(reader) {\n while (!0) {\n var { done, value } = await reader.readMany();\n if (this.#aborted)\n return;\n if (done) {\n this.push(null), process.nextTick(destroyBodyStreamNT, this);\n break;\n }\n for (var v of value)\n this.push(v);\n }\n }\n _read(size) {\n if (this.#noBody)\n this.push(null), this.complete = !0;\n else if (this.#bodyStream == null) {\n const reader = this.#req.body\?.getReader();\n if (!reader) {\n this.push(null);\n return;\n }\n this.#bodyStream = reader, this.#consumeStream(reader);\n }\n }\n get aborted() {\n return this.#aborted;\n }\n #abort() {\n if (this.#aborted)\n return;\n this.#aborted = !0;\n var bodyStream = this.#bodyStream;\n if (!bodyStream)\n return;\n bodyStream.cancel(), this.complete = !0, this.#bodyStream = @undefined, this.push(null);\n }\n get connection() {\n return this.#fakeSocket;\n }\n get statusCode() {\n return this.#req.status;\n }\n get statusMessage() {\n return STATUS_CODES[this.#req.status];\n }\n get httpVersion() {\n return \"1.1\";\n }\n get rawTrailers() {\n return [];\n }\n get httpVersionMajor() {\n return 1;\n }\n get httpVersionMinor() {\n return 1;\n }\n get trailers() {\n return kEmptyObject;\n }\n get socket() {\n return this.#fakeSocket \?\?= new FakeSocket;\n }\n set socket(val) {\n this.#fakeSocket = val;\n }\n setTimeout(msecs, callback) {\n throw new Error(\"not implemented\");\n }\n}\n\nclass OutgoingMessage extends Writable {\n constructor() {\n super(...arguments);\n }\n #headers;\n headersSent = !1;\n sendDate = !0;\n req;\n timeout;\n #finished = !1;\n [kEndCalled] = !1;\n #fakeSocket;\n #timeoutTimer;\n [kAbortController] = null;\n _implicitHeader() {\n }\n get headers() {\n if (!this.#headers)\n return kEmptyObject;\n return this.#headers.toJSON();\n }\n get shouldKeepAlive() {\n return !0;\n }\n get chunkedEncoding() {\n return !1;\n }\n set chunkedEncoding(value) {\n }\n set shouldKeepAlive(value) {\n }\n get useChunkedEncodingByDefault() {\n return !0;\n }\n set useChunkedEncodingByDefault(value) {\n }\n get socket() {\n return this.#fakeSocket \?\?= new FakeSocket;\n }\n set socket(val) {\n this.#fakeSocket = val;\n }\n get connection() {\n return this.socket;\n }\n get finished() {\n return this.#finished;\n }\n appendHeader(name, value) {\n var headers = this.#headers \?\?= new Headers;\n headers.append(name, value);\n }\n flushHeaders() {\n }\n getHeader(name) {\n return getHeader(this.#headers, name);\n }\n getHeaders() {\n if (!this.#headers)\n return kEmptyObject;\n return this.#headers.toJSON();\n }\n getHeaderNames() {\n var headers = this.#headers;\n if (!headers)\n return [];\n return @Array.from(headers.keys());\n }\n removeHeader(name) {\n if (!this.#headers)\n return;\n this.#headers.delete(name);\n }\n setHeader(name, value) {\n var headers = this.#headers \?\?= new Headers;\n return headers.set(name, value), this;\n }\n hasHeader(name) {\n if (!this.#headers)\n return !1;\n return this.#headers.has(name);\n }\n addTrailers(headers) {\n throw new Error(\"not implemented\");\n }\n [kClearTimeout]() {\n if (this.#timeoutTimer)\n clearTimeout(this.#timeoutTimer), this.removeAllListeners(\"timeout\"), this.#timeoutTimer = @undefined;\n }\n #onTimeout() {\n this.#timeoutTimer = @undefined, this[kAbortController]\?.abort(), this.emit(\"timeout\");\n }\n setTimeout(msecs, callback) {\n if (this.destroyed)\n return this;\n if (this.timeout = msecs = validateMsecs(msecs, \"msecs\"), clearTimeout(this.#timeoutTimer), msecs === 0) {\n if (callback !== @undefined)\n validateFunction(callback, \"callback\"), this.removeListener(\"timeout\", callback);\n this.#timeoutTimer = @undefined;\n } else if (this.#timeoutTimer = setTimeout(this.#onTimeout.bind(this), msecs).unref(), callback !== @undefined)\n validateFunction(callback, \"callback\"), this.once(\"timeout\", callback);\n return this;\n }\n}\nvar OriginalWriteHeadFn, OriginalImplicitHeadFn;\n\nclass ServerResponse extends Writable {\n constructor(c) {\n super();\n if (!c)\n c = {};\n var req = c.req || {}, reply = c.reply;\n if (this.req = req, this._reply = reply, this.sendDate = !0, this.statusCode = 200, this.headersSent = !1, this.statusMessage = @undefined, this.#controller = @undefined, this.#firstWrite = @undefined, this._writableState.decodeStrings = !1, this.#deferred = @undefined, req.method === \"HEAD\")\n this._hasBody = !1;\n }\n req;\n _reply;\n sendDate;\n statusCode;\n #headers;\n headersSent = !1;\n statusMessage;\n #controller;\n #firstWrite;\n _sent100 = !1;\n _defaultKeepAlive = !1;\n _removedConnection = !1;\n _removedContLen = !1;\n _hasBody = !0;\n #deferred = @undefined;\n #finished = !1;\n _implicitHeader() {\n this.writeHead(this.statusCode);\n }\n _write(chunk, encoding, callback) {\n if (!this.#firstWrite && !this.headersSent) {\n this.#firstWrite = chunk, callback();\n return;\n }\n this.#ensureReadableStreamController((controller) => {\n controller.write(chunk), callback();\n });\n }\n _writev(chunks, callback) {\n if (chunks.length === 1 && !this.headersSent && !this.#firstWrite) {\n this.#firstWrite = chunks[0].chunk, callback();\n return;\n }\n this.#ensureReadableStreamController((controller) => {\n for (let chunk of chunks)\n controller.write(chunk.chunk);\n callback();\n });\n }\n #ensureReadableStreamController(run) {\n var thisController = this.#controller;\n if (thisController)\n return run(thisController);\n this.headersSent = !0;\n var firstWrite = this.#firstWrite;\n this.#firstWrite = @undefined, this._reply(new Response(new @ReadableStream({\n type: \"direct\",\n pull: (controller) => {\n if (this.#controller = controller, firstWrite)\n controller.write(firstWrite);\n if (firstWrite = @undefined, run(controller), !this.#finished)\n return new @Promise((resolve) => {\n this.#deferred = resolve;\n });\n }\n }), {\n headers: this.#headers,\n status: this.statusCode,\n statusText: this.statusMessage \?\? STATUS_CODES[this.statusCode]\n }));\n }\n #drainHeadersIfObservable() {\n if (this._implicitHeader === OriginalImplicitHeadFn && this.writeHead === OriginalWriteHeadFn)\n return;\n this._implicitHeader();\n }\n _final(callback) {\n if (!this.headersSent) {\n var data = this.#firstWrite || \"\";\n this.#firstWrite = @undefined, this.#finished = !0, this.#drainHeadersIfObservable(), this._reply(new Response(data, {\n headers: this.#headers,\n status: this.statusCode,\n statusText: this.statusMessage \?\? STATUS_CODES[this.statusCode]\n })), callback && callback();\n return;\n }\n this.#finished = !0, this.#ensureReadableStreamController((controller) => {\n controller.end(), callback();\n var deferred = this.#deferred;\n if (deferred)\n this.#deferred = @undefined, deferred();\n });\n }\n writeProcessing() {\n throw new Error(\"not implemented\");\n }\n addTrailers(headers) {\n throw new Error(\"not implemented\");\n }\n assignSocket(socket) {\n throw new Error(\"not implemented\");\n }\n detachSocket(socket) {\n throw new Error(\"not implemented\");\n }\n writeContinue(callback) {\n throw new Error(\"not implemented\");\n }\n setTimeout(msecs, callback) {\n throw new Error(\"not implemented\");\n }\n get shouldKeepAlive() {\n return !0;\n }\n get chunkedEncoding() {\n return !1;\n }\n set chunkedEncoding(value) {\n }\n set shouldKeepAlive(value) {\n }\n get useChunkedEncodingByDefault() {\n return !0;\n }\n set useChunkedEncodingByDefault(value) {\n }\n appendHeader(name, value) {\n var headers = this.#headers \?\?= new Headers;\n headers.append(name, value);\n }\n flushHeaders() {\n }\n getHeader(name) {\n return getHeader(this.#headers, name);\n }\n getHeaders() {\n var headers = this.#headers;\n if (!headers)\n return kEmptyObject;\n return headers.toJSON();\n }\n getHeaderNames() {\n var headers = this.#headers;\n if (!headers)\n return [];\n return @Array.from(headers.keys());\n }\n removeHeader(name) {\n if (!this.#headers)\n return;\n this.#headers.delete(name);\n }\n setHeader(name, value) {\n var headers = this.#headers \?\?= new Headers;\n return setHeader(headers, name, value), this;\n }\n hasHeader(name) {\n if (!this.#headers)\n return !1;\n return this.#headers.has(name);\n }\n writeHead(statusCode, statusMessage, headers) {\n return _writeHead(statusCode, statusMessage, headers, this), this;\n }\n}\nOriginalWriteHeadFn = ServerResponse.prototype.writeHead;\nOriginalImplicitHeadFn = ServerResponse.prototype._implicitHeader;\n\nclass ClientRequest extends OutgoingMessage {\n #timeout;\n #res = null;\n #upgradeOrConnect = !1;\n #parser = null;\n #maxHeadersCount = null;\n #reusedSocket = !1;\n #host;\n #protocol;\n #method;\n #port;\n #useDefaultPort;\n #joinDuplicateHeaders;\n #maxHeaderSize;\n #agent = globalAgent;\n #path;\n #socketPath;\n #bodyChunks = null;\n #fetchRequest;\n #signal = null;\n [kAbortController] = null;\n #timeoutTimer = @undefined;\n #options;\n #finished;\n get path() {\n return this.#path;\n }\n get port() {\n return this.#port;\n }\n get method() {\n return this.#method;\n }\n get host() {\n return this.#host;\n }\n get protocol() {\n return this.#protocol;\n }\n _write(chunk, encoding, callback) {\n if (!this.#bodyChunks) {\n this.#bodyChunks = [chunk], callback();\n return;\n }\n this.#bodyChunks.push(chunk), callback();\n }\n _writev(chunks, callback) {\n if (!this.#bodyChunks) {\n this.#bodyChunks = chunks, callback();\n return;\n }\n this.#bodyChunks.push(...chunks), callback();\n }\n _final(callback) {\n if (this.#finished = !0, this[kAbortController] = new AbortController, this[kAbortController].signal.addEventListener(\"abort\", () => {\n this[kClearTimeout]();\n }), this.#signal\?.aborted)\n this[kAbortController].abort();\n var method = this.#method, body = this.#bodyChunks\?.length === 1 \? this.#bodyChunks[0] : @Buffer.concat(this.#bodyChunks || []);\n let url, proxy;\n if (this.#path.startsWith(\"http://\") || this.#path.startsWith(\"https://\"))\n url = this.#path, proxy = `${this.#protocol}//${this.#host}${this.#useDefaultPort \? \"\" : \":\" + this.#port}`;\n else\n url = `${this.#protocol}//${this.#host}${this.#useDefaultPort \? \"\" : \":\" + this.#port}${this.#path}`;\n try {\n this.#fetchRequest = fetch(url, {\n method,\n headers: this.getHeaders(),\n body: body && method !== \"GET\" && method !== \"HEAD\" && method !== \"OPTIONS\" \? body : @undefined,\n redirect: \"manual\",\n verbose: !1,\n signal: this[kAbortController].signal,\n proxy,\n timeout: !1,\n decompress: !1\n }).then((response) => {\n var res = this.#res = new IncomingMessage(response, {\n type: \"response\",\n [kInternalRequest]: this\n });\n this.emit(\"response\", res);\n }).catch((err) => {\n this.emit(\"error\", err);\n }).finally(() => {\n this.#fetchRequest = null, this[kClearTimeout]();\n });\n } catch (err) {\n this.emit(\"error\", err);\n } finally {\n callback();\n }\n }\n get aborted() {\n return this.#signal\?.aborted || !!this[kAbortController]\?.signal.aborted;\n }\n abort() {\n if (this.aborted)\n return;\n this[kAbortController].abort();\n }\n constructor(input, options, cb) {\n super();\n if (typeof input === \"string\") {\n const urlStr = input;\n try {\n var urlObject = new URL(urlStr);\n } catch (e) {\n @throwTypeError(`Invalid URL: ${urlStr}`);\n }\n input = urlToHttpOptions(urlObject);\n } else if (input && typeof input === \"object\" && input instanceof URL)\n input = urlToHttpOptions(input);\n else\n cb = options, options = input, input = null;\n if (typeof options === \"function\")\n cb = options, options = input || kEmptyObject;\n else\n options = ObjectAssign(input || {}, options);\n var defaultAgent = options._defaultAgent || Agent.globalAgent;\n let protocol = options.protocol;\n if (!protocol)\n if (options.port === 443)\n protocol = \"https:\";\n else\n protocol = defaultAgent.protocol || \"http:\";\n switch (this.#protocol = protocol, this.#agent\?.protocol) {\n case @undefined:\n break;\n case \"http:\":\n if (protocol === \"https:\") {\n defaultAgent = this.#agent = getDefaultHTTPSAgent();\n break;\n }\n case \"https:\":\n if (protocol === \"https\") {\n defaultAgent = this.#agent = Agent.globalAgent;\n break;\n }\n default:\n break;\n }\n if (options.path) {\n const path = @String(options.path);\n if (RegExpPrototypeExec.@call(INVALID_PATH_REGEX, path) !== null)\n throw new Error(\"Path contains unescaped characters\");\n }\n if (protocol !== \"http:\" && protocol !== \"https:\" && protocol) {\n const expectedProtocol = defaultAgent\?.protocol \?\? \"http:\";\n throw new Error(`Protocol mismatch. Expected: ${expectedProtocol}. Got: ${protocol}`);\n }\n const defaultPort = protocol === \"https:\" \? 443 : 80;\n this.#port = options.port || options.defaultPort || this.#agent\?.defaultPort || defaultPort, this.#useDefaultPort = this.#port === defaultPort;\n const host = this.#host = options.host = validateHost(options.hostname, \"hostname\") || validateHost(options.host, \"host\") || \"localhost\";\n this.#socketPath = options.socketPath;\n const signal = options.signal;\n if (signal)\n signal.addEventListener(\"abort\", () => {\n this[kAbortController]\?.abort();\n }), this.#signal = signal;\n let method = options.method;\n const methodIsString = typeof method === \"string\";\n if (method !== null && method !== @undefined && !methodIsString)\n throw new Error(\"ERR_INVALID_ARG_TYPE: options.method\");\n if (methodIsString && method) {\n if (!checkIsHttpToken(method))\n throw new Error(\"ERR_INVALID_HTTP_TOKEN: Method\");\n method = this.#method = StringPrototypeToUpperCase.@call(method);\n } else\n method = this.#method = \"GET\";\n const _maxHeaderSize = options.maxHeaderSize;\n this.#maxHeaderSize = _maxHeaderSize;\n var _joinDuplicateHeaders = options.joinDuplicateHeaders;\n if (this.#joinDuplicateHeaders = _joinDuplicateHeaders, this.#path = options.path || \"/\", cb)\n this.once(\"response\", cb);\n this.#finished = !1, this.#res = null, this.#upgradeOrConnect = !1, this.#parser = null, this.#maxHeadersCount = null, this.#reusedSocket = !1, this.#host = host, this.#protocol = protocol;\n var timeout = options.timeout;\n if (timeout !== @undefined && timeout !== 0)\n this.setTimeout(timeout, @undefined);\n if (!ArrayIsArray(headers)) {\n var headers = options.headers;\n if (headers)\n for (let key in headers)\n this.setHeader(key, headers[key]);\n var auth = options.auth;\n if (auth && !this.getHeader(\"Authorization\"))\n this.setHeader(\"Authorization\", \"Basic \" + @Buffer.from(auth).toString(\"base64\"));\n }\n var { signal: _signal, ...optsWithoutSignal } = options;\n this.#options = optsWithoutSignal;\n }\n setSocketKeepAlive(enable = !0, initialDelay = 0) {\n }\n setNoDelay(noDelay = !0) {\n }\n [kClearTimeout]() {\n if (this.#timeoutTimer)\n clearTimeout(this.#timeoutTimer), this.#timeoutTimer = @undefined, this.removeAllListeners(\"timeout\");\n }\n #onTimeout() {\n this.#timeoutTimer = @undefined, this[kAbortController]\?.abort(), this.emit(\"timeout\");\n }\n setTimeout(msecs, callback) {\n if (this.destroyed)\n return this;\n if (this.timeout = msecs = validateMsecs(msecs, \"msecs\"), clearTimeout(this.#timeoutTimer), msecs === 0) {\n if (callback !== @undefined)\n validateFunction(callback, \"callback\"), this.removeListener(\"timeout\", callback);\n this.#timeoutTimer = @undefined;\n } else if (this.#timeoutTimer = setTimeout(this.#onTimeout.bind(this), msecs).unref(), callback !== @undefined)\n validateFunction(callback, \"callback\"), this.once(\"timeout\", callback);\n return this;\n }\n}\nvar tokenRegExp = /^[\\^_`a-zA-Z\\-0-9!#$%&'*+.|~]+$/, METHODS = [\n \"ACL\",\n \"BIND\",\n \"CHECKOUT\",\n \"CONNECT\",\n \"COPY\",\n \"DELETE\",\n \"GET\",\n \"HEAD\",\n \"LINK\",\n \"LOCK\",\n \"M-SEARCH\",\n \"MERGE\",\n \"MKACTIVITY\",\n \"MKCALENDAR\",\n \"MKCOL\",\n \"MOVE\",\n \"NOTIFY\",\n \"OPTIONS\",\n \"PATCH\",\n \"POST\",\n \"PROPFIND\",\n \"PROPPATCH\",\n \"PURGE\",\n \"PUT\",\n \"REBIND\",\n \"REPORT\",\n \"SEARCH\",\n \"SOURCE\",\n \"SUBSCRIBE\",\n \"TRACE\",\n \"UNBIND\",\n \"UNLINK\",\n \"UNLOCK\",\n \"UNSUBSCRIBE\"\n], STATUS_CODES = {\n 100: \"Continue\",\n 101: \"Switching Protocols\",\n 102: \"Processing\",\n 103: \"Early Hints\",\n 200: \"OK\",\n 201: \"Created\",\n 202: \"Accepted\",\n 203: \"Non-Authoritative Information\",\n 204: \"No Content\",\n 205: \"Reset Content\",\n 206: \"Partial Content\",\n 207: \"Multi-Status\",\n 208: \"Already Reported\",\n 226: \"IM Used\",\n 300: \"Multiple Choices\",\n 301: \"Moved Permanently\",\n 302: \"Found\",\n 303: \"See Other\",\n 304: \"Not Modified\",\n 305: \"Use Proxy\",\n 307: \"Temporary Redirect\",\n 308: \"Permanent Redirect\",\n 400: \"Bad Request\",\n 401: \"Unauthorized\",\n 402: \"Payment Required\",\n 403: \"Forbidden\",\n 404: \"Not Found\",\n 405: \"Method Not Allowed\",\n 406: \"Not Acceptable\",\n 407: \"Proxy Authentication Required\",\n 408: \"Request Timeout\",\n 409: \"Conflict\",\n 410: \"Gone\",\n 411: \"Length Required\",\n 412: \"Precondition Failed\",\n 413: \"Payload Too Large\",\n 414: \"URI Too Long\",\n 415: \"Unsupported Media Type\",\n 416: \"Range Not Satisfiable\",\n 417: \"Expectation Failed\",\n 418: \"I'm a Teapot\",\n 421: \"Misdirected Request\",\n 422: \"Unprocessable Entity\",\n 423: \"Locked\",\n 424: \"Failed Dependency\",\n 425: \"Too Early\",\n 426: \"Upgrade Required\",\n 428: \"Precondition Required\",\n 429: \"Too Many Requests\",\n 431: \"Request Header Fields Too Large\",\n 451: \"Unavailable For Legal Reasons\",\n 500: \"Internal Server Error\",\n 501: \"Not Implemented\",\n 502: \"Bad Gateway\",\n 503: \"Service Unavailable\",\n 504: \"Gateway Timeout\",\n 505: \"HTTP Version Not Supported\",\n 506: \"Variant Also Negotiates\",\n 507: \"Insufficient Storage\",\n 508: \"Loop Detected\",\n 509: \"Bandwidth Limit Exceeded\",\n 510: \"Not Extended\",\n 511: \"Network Authentication Required\"\n}, globalAgent = new Agent;\n$ = {\n Agent,\n Server,\n METHODS,\n STATUS_CODES,\n createServer,\n ServerResponse,\n IncomingMessage,\n request,\n get,\n maxHeaderSize: 16384,\n validateHeaderName,\n validateHeaderValue,\n setMaxIdleHTTPParsers(max) {\n },\n globalAgent,\n ClientRequest,\n OutgoingMessage\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeHttp2Code = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/http2.ts\nvar connect = function() {\n throwNotImplemented(\"node:http2 connect\", 887);\n}, createServer = function() {\n throwNotImplemented(\"node:http2 createServer\", 887);\n}, createSecureServer = function() {\n throwNotImplemented(\"node:http2 createSecureServer\", 887);\n}, getDefaultSettings = function() {\n return {\n headerTableSize: 4096,\n enablePush: !0,\n initialWindowSize: 65535,\n maxFrameSize: 16384,\n maxConcurrentStreams: 4294967295,\n maxHeaderSize: 65535,\n maxHeaderListSize: 65535,\n enableConnectProtocol: !1\n };\n}, getPackedSettings = function() {\n return @Buffer.alloc(0);\n}, getUnpackedSettings = function() {\n return @Buffer.alloc(0);\n}, Http2ServerRequest = function() {\n throwNotImplemented(\"node:http2 Http2ServerRequest\", 887);\n}, Http2ServerResponse = function() {\n throwNotImplemented(\"node:http2 Http2ServerResponse\", 887);\n}, $, { hideFromStack, throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6), constants = {\n NGHTTP2_ERR_FRAME_SIZE_ERROR: -522,\n NGHTTP2_SESSION_SERVER: 0,\n NGHTTP2_SESSION_CLIENT: 1,\n NGHTTP2_STREAM_STATE_IDLE: 1,\n NGHTTP2_STREAM_STATE_OPEN: 2,\n NGHTTP2_STREAM_STATE_RESERVED_LOCAL: 3,\n NGHTTP2_STREAM_STATE_RESERVED_REMOTE: 4,\n NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL: 5,\n NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE: 6,\n NGHTTP2_STREAM_STATE_CLOSED: 7,\n NGHTTP2_FLAG_NONE: 0,\n NGHTTP2_FLAG_END_STREAM: 1,\n NGHTTP2_FLAG_END_HEADERS: 4,\n NGHTTP2_FLAG_ACK: 1,\n NGHTTP2_FLAG_PADDED: 8,\n NGHTTP2_FLAG_PRIORITY: 32,\n DEFAULT_SETTINGS_HEADER_TABLE_SIZE: 4096,\n DEFAULT_SETTINGS_ENABLE_PUSH: 1,\n DEFAULT_SETTINGS_MAX_CONCURRENT_STREAMS: 4294967295,\n DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE: 65535,\n DEFAULT_SETTINGS_MAX_FRAME_SIZE: 16384,\n DEFAULT_SETTINGS_MAX_HEADER_LIST_SIZE: 65535,\n DEFAULT_SETTINGS_ENABLE_CONNECT_PROTOCOL: 0,\n MAX_MAX_FRAME_SIZE: 16777215,\n MIN_MAX_FRAME_SIZE: 16384,\n MAX_INITIAL_WINDOW_SIZE: 2147483647,\n NGHTTP2_SETTINGS_HEADER_TABLE_SIZE: 1,\n NGHTTP2_SETTINGS_ENABLE_PUSH: 2,\n NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS: 3,\n NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE: 4,\n NGHTTP2_SETTINGS_MAX_FRAME_SIZE: 5,\n NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: 6,\n NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL: 8,\n PADDING_STRATEGY_NONE: 0,\n PADDING_STRATEGY_ALIGNED: 1,\n PADDING_STRATEGY_MAX: 2,\n PADDING_STRATEGY_CALLBACK: 1,\n NGHTTP2_NO_ERROR: 0,\n NGHTTP2_PROTOCOL_ERROR: 1,\n NGHTTP2_INTERNAL_ERROR: 2,\n NGHTTP2_FLOW_CONTROL_ERROR: 3,\n NGHTTP2_SETTINGS_TIMEOUT: 4,\n NGHTTP2_STREAM_CLOSED: 5,\n NGHTTP2_FRAME_SIZE_ERROR: 6,\n NGHTTP2_REFUSED_STREAM: 7,\n NGHTTP2_CANCEL: 8,\n NGHTTP2_COMPRESSION_ERROR: 9,\n NGHTTP2_CONNECT_ERROR: 10,\n NGHTTP2_ENHANCE_YOUR_CALM: 11,\n NGHTTP2_INADEQUATE_SECURITY: 12,\n NGHTTP2_HTTP_1_1_REQUIRED: 13,\n NGHTTP2_DEFAULT_WEIGHT: 16,\n HTTP2_HEADER_STATUS: \":status\",\n HTTP2_HEADER_METHOD: \":method\",\n HTTP2_HEADER_AUTHORITY: \":authority\",\n HTTP2_HEADER_SCHEME: \":scheme\",\n HTTP2_HEADER_PATH: \":path\",\n HTTP2_HEADER_PROTOCOL: \":protocol\",\n HTTP2_HEADER_ACCEPT_ENCODING: \"accept-encoding\",\n HTTP2_HEADER_ACCEPT_LANGUAGE: \"accept-language\",\n HTTP2_HEADER_ACCEPT_RANGES: \"accept-ranges\",\n HTTP2_HEADER_ACCEPT: \"accept\",\n HTTP2_HEADER_ACCESS_CONTROL_ALLOW_CREDENTIALS: \"access-control-allow-credentials\",\n HTTP2_HEADER_ACCESS_CONTROL_ALLOW_HEADERS: \"access-control-allow-headers\",\n HTTP2_HEADER_ACCESS_CONTROL_ALLOW_METHODS: \"access-control-allow-methods\",\n HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN: \"access-control-allow-origin\",\n HTTP2_HEADER_ACCESS_CONTROL_EXPOSE_HEADERS: \"access-control-expose-headers\",\n HTTP2_HEADER_ACCESS_CONTROL_REQUEST_HEADERS: \"access-control-request-headers\",\n HTTP2_HEADER_ACCESS_CONTROL_REQUEST_METHOD: \"access-control-request-method\",\n HTTP2_HEADER_AGE: \"age\",\n HTTP2_HEADER_AUTHORIZATION: \"authorization\",\n HTTP2_HEADER_CACHE_CONTROL: \"cache-control\",\n HTTP2_HEADER_CONNECTION: \"connection\",\n HTTP2_HEADER_CONTENT_DISPOSITION: \"content-disposition\",\n HTTP2_HEADER_CONTENT_ENCODING: \"content-encoding\",\n HTTP2_HEADER_CONTENT_LENGTH: \"content-length\",\n HTTP2_HEADER_CONTENT_TYPE: \"content-type\",\n HTTP2_HEADER_COOKIE: \"cookie\",\n HTTP2_HEADER_DATE: \"date\",\n HTTP2_HEADER_ETAG: \"etag\",\n HTTP2_HEADER_FORWARDED: \"forwarded\",\n HTTP2_HEADER_HOST: \"host\",\n HTTP2_HEADER_IF_MODIFIED_SINCE: \"if-modified-since\",\n HTTP2_HEADER_IF_NONE_MATCH: \"if-none-match\",\n HTTP2_HEADER_IF_RANGE: \"if-range\",\n HTTP2_HEADER_LAST_MODIFIED: \"last-modified\",\n HTTP2_HEADER_LINK: \"link\",\n HTTP2_HEADER_LOCATION: \"location\",\n HTTP2_HEADER_RANGE: \"range\",\n HTTP2_HEADER_REFERER: \"referer\",\n HTTP2_HEADER_SERVER: \"server\",\n HTTP2_HEADER_SET_COOKIE: \"set-cookie\",\n HTTP2_HEADER_STRICT_TRANSPORT_SECURITY: \"strict-transport-security\",\n HTTP2_HEADER_TRANSFER_ENCODING: \"transfer-encoding\",\n HTTP2_HEADER_TE: \"te\",\n HTTP2_HEADER_UPGRADE_INSECURE_REQUESTS: \"upgrade-insecure-requests\",\n HTTP2_HEADER_UPGRADE: \"upgrade\",\n HTTP2_HEADER_USER_AGENT: \"user-agent\",\n HTTP2_HEADER_VARY: \"vary\",\n HTTP2_HEADER_X_CONTENT_TYPE_OPTIONS: \"x-content-type-options\",\n HTTP2_HEADER_X_FRAME_OPTIONS: \"x-frame-options\",\n HTTP2_HEADER_KEEP_ALIVE: \"keep-alive\",\n HTTP2_HEADER_PROXY_CONNECTION: \"proxy-connection\",\n HTTP2_HEADER_X_XSS_PROTECTION: \"x-xss-protection\",\n HTTP2_HEADER_ALT_SVC: \"alt-svc\",\n HTTP2_HEADER_CONTENT_SECURITY_POLICY: \"content-security-policy\",\n HTTP2_HEADER_EARLY_DATA: \"early-data\",\n HTTP2_HEADER_EXPECT_CT: \"expect-ct\",\n HTTP2_HEADER_ORIGIN: \"origin\",\n HTTP2_HEADER_PURPOSE: \"purpose\",\n HTTP2_HEADER_TIMING_ALLOW_ORIGIN: \"timing-allow-origin\",\n HTTP2_HEADER_X_FORWARDED_FOR: \"x-forwarded-for\",\n HTTP2_HEADER_PRIORITY: \"priority\",\n HTTP2_HEADER_ACCEPT_CHARSET: \"accept-charset\",\n HTTP2_HEADER_ACCESS_CONTROL_MAX_AGE: \"access-control-max-age\",\n HTTP2_HEADER_ALLOW: \"allow\",\n HTTP2_HEADER_CONTENT_LANGUAGE: \"content-language\",\n HTTP2_HEADER_CONTENT_LOCATION: \"content-location\",\n HTTP2_HEADER_CONTENT_MD5: \"content-md5\",\n HTTP2_HEADER_CONTENT_RANGE: \"content-range\",\n HTTP2_HEADER_DNT: \"dnt\",\n HTTP2_HEADER_EXPECT: \"expect\",\n HTTP2_HEADER_EXPIRES: \"expires\",\n HTTP2_HEADER_FROM: \"from\",\n HTTP2_HEADER_IF_MATCH: \"if-match\",\n HTTP2_HEADER_IF_UNMODIFIED_SINCE: \"if-unmodified-since\",\n HTTP2_HEADER_MAX_FORWARDS: \"max-forwards\",\n HTTP2_HEADER_PREFER: \"prefer\",\n HTTP2_HEADER_PROXY_AUTHENTICATE: \"proxy-authenticate\",\n HTTP2_HEADER_PROXY_AUTHORIZATION: \"proxy-authorization\",\n HTTP2_HEADER_REFRESH: \"refresh\",\n HTTP2_HEADER_RETRY_AFTER: \"retry-after\",\n HTTP2_HEADER_TRAILER: \"trailer\",\n HTTP2_HEADER_TK: \"tk\",\n HTTP2_HEADER_VIA: \"via\",\n HTTP2_HEADER_WARNING: \"warning\",\n HTTP2_HEADER_WWW_AUTHENTICATE: \"www-authenticate\",\n HTTP2_HEADER_HTTP2_SETTINGS: \"http2-settings\",\n HTTP2_METHOD_ACL: \"ACL\",\n HTTP2_METHOD_BASELINE_CONTROL: \"BASELINE-CONTROL\",\n HTTP2_METHOD_BIND: \"BIND\",\n HTTP2_METHOD_CHECKIN: \"CHECKIN\",\n HTTP2_METHOD_CHECKOUT: \"CHECKOUT\",\n HTTP2_METHOD_CONNECT: \"CONNECT\",\n HTTP2_METHOD_COPY: \"COPY\",\n HTTP2_METHOD_DELETE: \"DELETE\",\n HTTP2_METHOD_GET: \"GET\",\n HTTP2_METHOD_HEAD: \"HEAD\",\n HTTP2_METHOD_LABEL: \"LABEL\",\n HTTP2_METHOD_LINK: \"LINK\",\n HTTP2_METHOD_LOCK: \"LOCK\",\n HTTP2_METHOD_MERGE: \"MERGE\",\n HTTP2_METHOD_MKACTIVITY: \"MKACTIVITY\",\n HTTP2_METHOD_MKCALENDAR: \"MKCALENDAR\",\n HTTP2_METHOD_MKCOL: \"MKCOL\",\n HTTP2_METHOD_MKREDIRECTREF: \"MKREDIRECTREF\",\n HTTP2_METHOD_MKWORKSPACE: \"MKWORKSPACE\",\n HTTP2_METHOD_MOVE: \"MOVE\",\n HTTP2_METHOD_OPTIONS: \"OPTIONS\",\n HTTP2_METHOD_ORDERPATCH: \"ORDERPATCH\",\n HTTP2_METHOD_PATCH: \"PATCH\",\n HTTP2_METHOD_POST: \"POST\",\n HTTP2_METHOD_PRI: \"PRI\",\n HTTP2_METHOD_PROPFIND: \"PROPFIND\",\n HTTP2_METHOD_PROPPATCH: \"PROPPATCH\",\n HTTP2_METHOD_PUT: \"PUT\",\n HTTP2_METHOD_REBIND: \"REBIND\",\n HTTP2_METHOD_REPORT: \"REPORT\",\n HTTP2_METHOD_SEARCH: \"SEARCH\",\n HTTP2_METHOD_TRACE: \"TRACE\",\n HTTP2_METHOD_UNBIND: \"UNBIND\",\n HTTP2_METHOD_UNCHECKOUT: \"UNCHECKOUT\",\n HTTP2_METHOD_UNLINK: \"UNLINK\",\n HTTP2_METHOD_UNLOCK: \"UNLOCK\",\n HTTP2_METHOD_UPDATE: \"UPDATE\",\n HTTP2_METHOD_UPDATEREDIRECTREF: \"UPDATEREDIRECTREF\",\n HTTP2_METHOD_VERSION_CONTROL: \"VERSION-CONTROL\",\n HTTP_STATUS_CONTINUE: 100,\n HTTP_STATUS_SWITCHING_PROTOCOLS: 101,\n HTTP_STATUS_PROCESSING: 102,\n HTTP_STATUS_EARLY_HINTS: 103,\n HTTP_STATUS_OK: 200,\n HTTP_STATUS_CREATED: 201,\n HTTP_STATUS_ACCEPTED: 202,\n HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION: 203,\n HTTP_STATUS_NO_CONTENT: 204,\n HTTP_STATUS_RESET_CONTENT: 205,\n HTTP_STATUS_PARTIAL_CONTENT: 206,\n HTTP_STATUS_MULTI_STATUS: 207,\n HTTP_STATUS_ALREADY_REPORTED: 208,\n HTTP_STATUS_IM_USED: 226,\n HTTP_STATUS_MULTIPLE_CHOICES: 300,\n HTTP_STATUS_MOVED_PERMANENTLY: 301,\n HTTP_STATUS_FOUND: 302,\n HTTP_STATUS_SEE_OTHER: 303,\n HTTP_STATUS_NOT_MODIFIED: 304,\n HTTP_STATUS_USE_PROXY: 305,\n HTTP_STATUS_TEMPORARY_REDIRECT: 307,\n HTTP_STATUS_PERMANENT_REDIRECT: 308,\n HTTP_STATUS_BAD_REQUEST: 400,\n HTTP_STATUS_UNAUTHORIZED: 401,\n HTTP_STATUS_PAYMENT_REQUIRED: 402,\n HTTP_STATUS_FORBIDDEN: 403,\n HTTP_STATUS_NOT_FOUND: 404,\n HTTP_STATUS_METHOD_NOT_ALLOWED: 405,\n HTTP_STATUS_NOT_ACCEPTABLE: 406,\n HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED: 407,\n HTTP_STATUS_REQUEST_TIMEOUT: 408,\n HTTP_STATUS_CONFLICT: 409,\n HTTP_STATUS_GONE: 410,\n HTTP_STATUS_LENGTH_REQUIRED: 411,\n HTTP_STATUS_PRECONDITION_FAILED: 412,\n HTTP_STATUS_PAYLOAD_TOO_LARGE: 413,\n HTTP_STATUS_URI_TOO_LONG: 414,\n HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE: 415,\n HTTP_STATUS_RANGE_NOT_SATISFIABLE: 416,\n HTTP_STATUS_EXPECTATION_FAILED: 417,\n HTTP_STATUS_TEAPOT: 418,\n HTTP_STATUS_MISDIRECTED_REQUEST: 421,\n HTTP_STATUS_UNPROCESSABLE_ENTITY: 422,\n HTTP_STATUS_LOCKED: 423,\n HTTP_STATUS_FAILED_DEPENDENCY: 424,\n HTTP_STATUS_TOO_EARLY: 425,\n HTTP_STATUS_UPGRADE_REQUIRED: 426,\n HTTP_STATUS_PRECONDITION_REQUIRED: 428,\n HTTP_STATUS_TOO_MANY_REQUESTS: 429,\n HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE: 431,\n HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS: 451,\n HTTP_STATUS_INTERNAL_SERVER_ERROR: 500,\n HTTP_STATUS_NOT_IMPLEMENTED: 501,\n HTTP_STATUS_BAD_GATEWAY: 502,\n HTTP_STATUS_SERVICE_UNAVAILABLE: 503,\n HTTP_STATUS_GATEWAY_TIMEOUT: 504,\n HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED: 505,\n HTTP_STATUS_VARIANT_ALSO_NEGOTIATES: 506,\n HTTP_STATUS_INSUFFICIENT_STORAGE: 507,\n HTTP_STATUS_LOOP_DETECTED: 508,\n HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED: 509,\n HTTP_STATUS_NOT_EXTENDED: 510,\n HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED: 511\n}, sensitiveHeaders = Symbol.for(\"nodejs.http2.sensitiveHeaders\");\nHttp2ServerRequest.prototype = {};\nHttp2ServerResponse.prototype = {};\n$ = {\n constants,\n createServer,\n createSecureServer,\n getDefaultSettings,\n getPackedSettings,\n getUnpackedSettings,\n sensitiveHeaders,\n Http2ServerRequest,\n Http2ServerResponse,\n connect\n};\nhideFromStack([\n Http2ServerRequest,\n Http2ServerResponse,\n connect,\n createServer,\n createSecureServer,\n getDefaultSettings,\n getPackedSettings,\n getUnpackedSettings\n]);\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeHttpsCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/https.ts\nvar request = function(input, options, cb) {\n if (input && typeof input === \"object\" && !(input instanceof URL))\n input.protocol \?\?= \"https:\";\n else if (typeof options === \"object\")\n options.protocol \?\?= \"https:\";\n return http.request(input, options, cb);\n}, get = function(input, options, cb) {\n const req = request(input, options, cb);\n return req.end(), req;\n}, $, http = @getInternalField(@internalModuleRegistry, 23) || @createInternalModuleById(23);\n$ = {\n ...http,\n get,\n request\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeInspectorCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/inspector.ts\nvar open = function() {\n throwNotImplemented(\"node:inspector open\", 2445);\n}, close = function() {\n throwNotImplemented(\"node:inspector close\", 2445);\n}, url = function() {\n throwNotImplemented(\"node:inspector url\", 2445);\n}, waitForDebugger = function() {\n throwNotImplemented(\"node:inspector waitForDebugger\", 2445);\n}, $, { hideFromStack, throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6), EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20);\n\nclass Session extends EventEmitter {\n constructor() {\n super();\n throwNotImplemented(\"node:inspector Session\", 2445);\n }\n}\nvar console = {\n ...globalThis.console,\n context: {\n console: globalThis.console\n }\n};\n$ = {\n console,\n open,\n close,\n url,\n waitForDebugger,\n Session\n};\nhideFromStack(open, close, url, waitForDebugger, Session.prototype.constructor);\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeNetCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/net.ts\nvar isIPv4 = function(s) {\n return IPv4Reg.test(s);\n}, isIPv6 = function(s) {\n return IPv6Reg.test(s);\n}, isIP = function(s) {\n if (isIPv4(s))\n return 4;\n if (isIPv6(s))\n return 6;\n return 0;\n}, closeNT = function(self) {\n self.emit(\"close\");\n}, endNT = function(socket, callback, err) {\n socket.end(), callback(err);\n}, createConnection = function(port, host, connectListener) {\n if (typeof port === \"object\")\n return new Socket(port).connect(port, host, connectListener);\n return new Socket().connect(port, host, connectListener);\n}, emitErrorNextTick = function(self, error) {\n self.emit(\"error\", error);\n}, emitErrorAndCloseNextTick = function(self, error) {\n self.emit(\"error\", error), self.emit(\"close\");\n}, emitListeningNextTick = function(self, onListen) {\n if (typeof onListen === \"function\")\n try {\n onListen();\n } catch (err) {\n self.emit(\"error\", err);\n }\n self.emit(\"listening\");\n}, createServer = function(options, connectionListener) {\n return new Server(options, connectionListener);\n}, $, { Duplex } = @getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39), EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20);\nvar IPv4Reg = new @RegExp(\"^((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$\");\nvar IPv6Reg = new @RegExp(\"^((\?:(\?:[0-9a-fA-F]{1,4}):){7}(\?:(\?:[0-9a-fA-F]{1,4})|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){6}(\?:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|:(\?:[0-9a-fA-F]{1,4})|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){5}(\?::((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,2}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){4}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,1}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,3}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){3}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,2}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,4}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){2}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,3}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,5}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){1}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,4}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,6}|:)|(\?::((\?::(\?:[0-9a-fA-F]{1,4})){0,5}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(\?::(\?:[0-9a-fA-F]{1,4})){1,7}|:)))(%[0-9a-zA-Z-.:]{1,})\?$\"), { connect: bunConnect } = Bun, { setTimeout } = globalThis, bunTlsSymbol = Symbol.for(\"::buntls::\"), bunSocketServerHandlers = Symbol.for(\"::bunsocket_serverhandlers::\"), bunSocketServerConnections = Symbol.for(\"::bunnetserverconnections::\"), bunSocketServerOptions = Symbol.for(\"::bunnetserveroptions::\"), bunSocketInternal = Symbol.for(\"::bunnetsocketinternal::\"), bunTLSConnectOptions = Symbol.for(\"::buntlsconnectoptions::\"), SocketClass, Socket = function(InternalSocket) {\n SocketClass = InternalSocket, Object.defineProperty(SocketClass.prototype, Symbol.toStringTag, {\n value: \"Socket\",\n enumerable: !1\n });\n function Socket3(options) {\n return new InternalSocket(options);\n }\n return Socket3.prototype = InternalSocket.prototype, Object.defineProperty(Socket3, Symbol.hasInstance, {\n value(instance) {\n return instance instanceof InternalSocket;\n }\n });\n}(class Socket2 extends Duplex {\n static #Handlers = {\n close: Socket2.#Close,\n data({ data: self }, buffer) {\n self.bytesRead += buffer.length;\n const queue = self.#readQueue;\n if (queue.isEmpty()) {\n if (self.push(buffer))\n return;\n }\n queue.push(buffer);\n },\n drain: Socket2.#Drain,\n end: Socket2.#Close,\n error(socket, error) {\n const self = socket.data, callback = self.#writeCallback;\n if (callback)\n self.#writeCallback = null, callback(error);\n self.emit(\"error\", error);\n },\n open(socket) {\n const self = socket.data;\n socket.timeout(self.timeout), socket.ref(), self[bunSocketInternal] = socket, self.connecting = !1;\n const options = self[bunTLSConnectOptions];\n if (options) {\n const { session } = options;\n if (session)\n self.setSession(session);\n }\n if (!self.#upgraded)\n self.emit(\"connect\", self);\n Socket2.#Drain(socket);\n },\n handshake(socket, success, verifyError) {\n const { data: self } = socket;\n self._securePending = !1, self.secureConnecting = !1, self._secureEstablished = !!success, self.emit(\"secure\", self);\n const { checkServerIdentity } = self[bunTLSConnectOptions];\n if (!verifyError && typeof checkServerIdentity === \"function\" && self.servername) {\n const cert = self.getPeerCertificate(!0);\n verifyError = checkServerIdentity(self.servername, cert);\n }\n if (self._requestCert || self._rejectUnauthorized) {\n if (verifyError) {\n if (self.authorized = !1, self.authorizationError = verifyError.code || verifyError.message, self._rejectUnauthorized) {\n self.destroy(verifyError);\n return;\n }\n }\n } else\n self.authorized = !0;\n self.emit(\"secureConnect\", verifyError);\n },\n timeout(socket) {\n const self = socket.data;\n self.emit(\"timeout\", self);\n },\n binaryType: \"buffer\"\n };\n static #Close(socket) {\n const self = socket.data;\n if (self.#closed)\n return;\n self.#closed = !0, self[bunSocketInternal] = null;\n const queue = self.#readQueue;\n if (queue.isEmpty()) {\n if (self.push(null))\n return;\n }\n queue.push(null);\n }\n static #Drain(socket) {\n const self = socket.data, callback = self.#writeCallback;\n if (callback) {\n const chunk = self.#writeChunk, written = socket.write(chunk);\n if (self.bytesWritten += written, written < chunk.length)\n self.#writeChunk = chunk.slice(written);\n else\n self.#writeCallback = null, self.#writeChunk = null, callback(null);\n }\n }\n static [bunSocketServerHandlers] = {\n data: Socket2.#Handlers.data,\n close(socket) {\n Socket2.#Handlers.close(socket), this.data[bunSocketServerConnections]--;\n },\n end(socket) {\n Socket2.#Handlers.end(socket), this.data[bunSocketServerConnections]--;\n },\n open(socket) {\n const self = this.data, options = self[bunSocketServerOptions], { pauseOnConnect, connectionListener, InternalSocketClass, requestCert, rejectUnauthorized } = options, _socket = new InternalSocketClass({});\n if (_socket.isServer = !0, _socket._requestCert = requestCert, _socket._rejectUnauthorized = rejectUnauthorized, _socket.#attach(this.localPort, socket), self.maxConnections && self[bunSocketServerConnections] >= self.maxConnections) {\n const data = {\n localAddress: _socket.localAddress,\n localPort: _socket.localPort,\n localFamily: _socket.localFamily,\n remoteAddress: _socket.remoteAddress,\n remotePort: _socket.remotePort,\n remoteFamily: _socket.remoteFamily || \"IPv4\"\n };\n socket.end(), self.emit(\"drop\", data);\n return;\n }\n if (!pauseOnConnect)\n _socket.resume();\n if (self[bunSocketServerConnections]++, typeof connectionListener == \"function\")\n if (InternalSocketClass.name === \"TLSSocket\")\n self.once(\"secureConnection\", () => connectionListener(_socket));\n else\n connectionListener(_socket);\n self.emit(\"connection\", _socket);\n },\n handshake(socket, success, verifyError) {\n const { data: self } = socket;\n if (self.emit(\"secure\", self), self._securePending = !1, self.secureConnecting = !1, self._secureEstablished = !!success, self._requestCert || self._rejectUnauthorized) {\n if (verifyError) {\n if (self.authorized = !1, self.authorizationError = verifyError.code || verifyError.message, self._rejectUnauthorized) {\n self.destroy(verifyError);\n return;\n }\n }\n } else\n self.authorized = !0;\n self.emit(\"secureConnection\", verifyError);\n },\n error(socket, error) {\n Socket2.#Handlers.error(socket, error), this.data.emit(\"error\", error);\n },\n timeout: Socket2.#Handlers.timeout,\n connectError: Socket2.#Handlers.connectError,\n drain: Socket2.#Handlers.drain,\n binaryType: \"buffer\"\n };\n bytesRead = 0;\n bytesWritten = 0;\n #closed = !1;\n connecting = !1;\n localAddress = \"127.0.0.1\";\n #readQueue = @createFIFO();\n remotePort;\n [bunSocketInternal] = null;\n [bunTLSConnectOptions] = null;\n timeout = 0;\n #writeCallback;\n #writeChunk;\n #pendingRead;\n isServer = !1;\n _handle;\n _parent;\n _parentWrap;\n #socket;\n #upgraded;\n constructor(options) {\n const { socket, signal, write, read, allowHalfOpen = !1, ...opts } = options || {};\n super({\n ...opts,\n allowHalfOpen,\n readable: !0,\n writable: !0\n });\n if (this._handle = this, this._parent = this, this._parentWrap = this, this.#pendingRead = @undefined, this.#upgraded = null, socket instanceof Socket2)\n this.#socket = socket;\n signal\?.once(\"abort\", () => this.destroy()), this.once(\"connect\", () => this.emit(\"ready\"));\n }\n address() {\n return {\n address: this.localAddress,\n family: this.localFamily,\n port: this.localPort\n };\n }\n get bufferSize() {\n return this.writableLength;\n }\n #attach(port, socket) {\n if (this.remotePort = port, socket.data = this, socket.timeout(this.timeout), socket.ref(), this[bunSocketInternal] = socket, this.connecting = !1, !this.#upgraded)\n this.emit(\"connect\", this);\n Socket2.#Drain(socket);\n }\n #closeRawConnection() {\n const connection = this.#upgraded;\n connection[bunSocketInternal] = null, connection.unref(), connection.destroy(), process.nextTick(closeNT, connection);\n }\n connect(port, host, connectListener) {\n var path, connection = this.#socket, _checkServerIdentity = @undefined;\n if (typeof port === \"string\") {\n if (path = port, port = @undefined, typeof host === \"function\")\n connectListener = host, host = @undefined;\n } else if (typeof host == \"function\") {\n if (typeof port === \"string\")\n path = port, port = @undefined;\n connectListener = host, host = @undefined;\n }\n if (typeof port == \"object\") {\n var {\n port,\n host,\n path,\n socket,\n localAddress,\n localPort,\n family,\n hints,\n lookup,\n noDelay,\n keepAlive,\n keepAliveInitialDelay,\n requestCert,\n rejectUnauthorized,\n pauseOnConnect,\n servername,\n checkServerIdentity,\n session\n } = port;\n if (_checkServerIdentity = checkServerIdentity, this.servername = servername, socket)\n connection = socket;\n }\n if (!pauseOnConnect)\n this.resume();\n this.connecting = !0, this.remotePort = port;\n const bunTLS = this[bunTlsSymbol];\n var tls = @undefined;\n if (typeof bunTLS === \"function\") {\n if (tls = bunTLS.@call(this, port, host, !0), this._requestCert = !0, this._rejectUnauthorized = rejectUnauthorized, tls) {\n if (tls.rejectUnauthorized = rejectUnauthorized, tls.requestCert = !0, tls.session = session || tls.session, this.servername = tls.servername, tls.checkServerIdentity = _checkServerIdentity || tls.checkServerIdentity, this[bunTLSConnectOptions] = tls, !connection && tls.socket)\n connection = tls.socket;\n }\n if (connection) {\n if (typeof connection !== \"object\" || !(connection instanceof Socket2) || typeof connection[bunTlsSymbol] === \"function\")\n @throwTypeError(\"socket must be an instance of net.Socket\");\n }\n if (this.authorized = !1, this.secureConnecting = !0, this._secureEstablished = !1, this._securePending = !0, connectListener)\n this.on(\"secureConnect\", connectListener);\n } else if (connectListener)\n this.on(\"connect\", connectListener);\n try {\n if (connection) {\n const socket2 = connection[bunSocketInternal];\n if (socket2) {\n this.connecting = !0, this.#upgraded = connection;\n const result = socket2.upgradeTLS({\n data: this,\n tls,\n socket: Socket2.#Handlers\n });\n if (result) {\n const [raw, tls2] = result;\n connection[bunSocketInternal] = raw, raw.timeout(raw.timeout), this.once(\"end\", this.#closeRawConnection), raw.connecting = !1, this[bunSocketInternal] = tls2;\n } else\n throw this[bunSocketInternal] = null, new Error(\"Invalid socket\");\n } else\n connection.once(\"connect\", () => {\n const socket3 = connection[bunSocketInternal];\n if (!socket3)\n return;\n this.connecting = !0, this.#upgraded = connection;\n const result = socket3.upgradeTLS({\n data: this,\n tls,\n socket: Socket2.#Handlers\n });\n if (result) {\n const [raw, tls2] = result;\n connection[bunSocketInternal] = raw, raw.timeout(raw.timeout), this.once(\"end\", this.#closeRawConnection), raw.connecting = !1, this[bunSocketInternal] = tls2;\n } else\n throw this[bunSocketInternal] = null, new Error(\"Invalid socket\");\n });\n } else if (path)\n bunConnect({\n data: this,\n unix: path,\n socket: Socket2.#Handlers,\n tls\n }).catch((error) => {\n this.emit(\"error\", error), this.emit(\"close\");\n });\n else\n bunConnect({\n data: this,\n hostname: host || \"localhost\",\n port,\n socket: Socket2.#Handlers,\n tls\n }).catch((error) => {\n this.emit(\"error\", error), this.emit(\"close\");\n });\n } catch (error) {\n process.nextTick(emitErrorAndCloseNextTick, this, error);\n }\n return this;\n }\n _destroy(err, callback) {\n const socket = this[bunSocketInternal];\n socket && process.nextTick(endNT, socket, callback, err);\n }\n _final(callback) {\n this[bunSocketInternal]\?.end(), callback(), process.nextTick(closeNT, this);\n }\n get localAddress() {\n return \"127.0.0.1\";\n }\n get localFamily() {\n return \"IPv4\";\n }\n get localPort() {\n return this[bunSocketInternal]\?.localPort;\n }\n get pending() {\n return this.connecting;\n }\n _read(size) {\n const queue = this.#readQueue;\n let chunk;\n while (chunk = queue.peek()) {\n const can_continue = !this.push(chunk);\n if (queue.shift(), !can_continue)\n break;\n }\n }\n get readyState() {\n if (this.connecting)\n return \"opening\";\n if (this.readable)\n return this.writable \? \"open\" : \"readOnly\";\n else\n return this.writable \? \"writeOnly\" : \"closed\";\n }\n ref() {\n this[bunSocketInternal]\?.ref();\n }\n get remoteAddress() {\n return this[bunSocketInternal]\?.remoteAddress;\n }\n get remoteFamily() {\n return \"IPv4\";\n }\n resetAndDestroy() {\n this[bunSocketInternal]\?.end();\n }\n setKeepAlive(enable = !1, initialDelay = 0) {\n return this;\n }\n setNoDelay(noDelay = !0) {\n return this;\n }\n setTimeout(timeout, callback) {\n if (this[bunSocketInternal]\?.timeout(timeout), this.timeout = timeout, callback)\n this.once(\"timeout\", callback);\n return this;\n }\n unref() {\n this[bunSocketInternal]\?.unref();\n }\n _write(chunk, encoding, callback) {\n if (typeof chunk == \"string\" && encoding !== \"ascii\")\n chunk = @Buffer.from(chunk, encoding);\n var written = this[bunSocketInternal]\?.write(chunk);\n if (written == chunk.length)\n callback();\n else if (this.#writeCallback)\n callback(new Error(\"overlapping _write()\"));\n else {\n if (written > 0)\n if (typeof chunk == \"string\")\n chunk = chunk.slice(written);\n else\n chunk = chunk.subarray(written);\n this.#writeCallback = callback, this.#writeChunk = chunk;\n }\n }\n}), connect = createConnection;\n\nclass Server extends EventEmitter {\n #server;\n #listening = !1;\n [bunSocketServerConnections] = 0;\n [bunSocketServerOptions];\n maxConnections = 0;\n constructor(options, connectionListener) {\n super();\n if (typeof options === \"function\")\n connectionListener = options, options = {};\n else if (options == null || typeof options === \"object\")\n options = { ...options };\n else\n throw new Error(\"bun-net-polyfill: invalid arguments\");\n const { maxConnections } = options;\n this.maxConnections = Number.isSafeInteger(maxConnections) && maxConnections > 0 \? maxConnections : 0, options.connectionListener = connectionListener, this[bunSocketServerOptions] = options;\n }\n ref() {\n return this.#server\?.ref(), this;\n }\n unref() {\n return this.#server\?.unref(), this;\n }\n close(callback) {\n if (this.#server) {\n if (this.#server.stop(!0), this.#server = null, this.#listening = !1, this[bunSocketServerConnections] = 0, this.emit(\"close\"), typeof callback === \"function\")\n callback();\n return this;\n }\n if (typeof callback === \"function\") {\n const error = new Error(\"Server is not running\");\n error.code = \"ERR_SERVER_NOT_RUNNING\", callback(error);\n }\n return this;\n }\n address() {\n const server = this.#server;\n if (server) {\n const unix = server.unix;\n if (unix)\n return unix;\n let address = server.hostname;\n const type = isIP(address), port = server.port;\n if (typeof port === \"number\")\n return {\n port,\n address,\n family: type \? `IPv${type}` : @undefined\n };\n if (type)\n return {\n address,\n family: type \? `IPv${type}` : @undefined\n };\n return address;\n }\n return null;\n }\n getConnections(callback) {\n if (typeof callback === \"function\")\n callback(null, this.#server \? this[bunSocketServerConnections] : 0);\n return this;\n }\n listen(port, hostname, onListen) {\n let backlog, path, exclusive = !1;\n if (typeof port === \"string\") {\n if (Number.isSafeInteger(hostname)) {\n if (hostname > 0)\n backlog = hostname;\n } else if (typeof hostname === \"function\")\n onListen = hostname;\n path = port, hostname = @undefined, port = @undefined;\n } else {\n if (typeof hostname === \"function\")\n onListen = hostname, hostname = @undefined;\n if (typeof port === \"function\")\n onListen = port, port = 0;\n else if (typeof port === \"object\") {\n const options = port;\n options.signal\?.addEventListener(\"abort\", () => this.close()), hostname = options.host, exclusive = options.exclusive === !0;\n const path2 = options.path;\n if (port = options.port, !Number.isSafeInteger(port) || port < 0)\n if (path2)\n hostname = path2, port = @undefined;\n else {\n let message = 'The argument \\'options\\' must have the property \"port\" or \"path\"';\n try {\n message = `${message}. Received ${JSON.stringify(options)}`;\n } catch {\n }\n const error = @makeTypeError(message);\n throw error.code = \"ERR_INVALID_ARG_VALUE\", error;\n }\n else if (!Number.isSafeInteger(port) || port < 0)\n port = 0;\n if (typeof port.callback === \"function\")\n onListen = port\?.callback;\n } else if (!Number.isSafeInteger(port) || port < 0)\n port = 0;\n hostname = hostname || \"::\";\n }\n try {\n var tls = @undefined, TLSSocketClass = @undefined;\n const bunTLS = this[bunTlsSymbol], options = this[bunSocketServerOptions];\n if (typeof bunTLS === \"function\")\n [tls, TLSSocketClass] = bunTLS.@call(this, port, hostname, !1), options.servername = tls.serverName, options.InternalSocketClass = TLSSocketClass;\n else\n options.InternalSocketClass = SocketClass;\n this.#server = Bun.listen(path \? {\n exclusive,\n unix: path,\n tls,\n socket: SocketClass[bunSocketServerHandlers]\n } : {\n exclusive,\n port,\n hostname,\n tls,\n socket: SocketClass[bunSocketServerHandlers]\n }), this.#server.data = this, this.#listening = !0, setTimeout(emitListeningNextTick, 1, this, onListen);\n } catch (err) {\n this.#listening = !1, setTimeout(emitErrorNextTick, 1, this, err);\n }\n return this;\n }\n}\n$ = {\n createServer,\n Server,\n createConnection,\n connect,\n isIP,\n isIPv4,\n isIPv6,\n Socket,\n [Symbol.for(\"::bunternal::\")]: SocketClass\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeOSCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/os.ts\nvar lazyCpus = function({ cpus }) {\n return () => {\n const array = new @Array(navigator.hardwareConcurrency);\n function populate() {\n const results = cpus(), length = results.length;\n array.length = length;\n for (let i = 0;i < length; i++)\n array[i] = results[i];\n }\n for (let i = 0;i < array.length; i++) {\n const instance = {\n get model() {\n if (array[i] === instance)\n populate();\n return array[i].model;\n },\n set model(value) {\n if (array[i] === instance)\n populate();\n array[i].model = value;\n },\n get speed() {\n if (array[i] === instance)\n populate();\n return array[i].speed;\n },\n set speed(value) {\n if (array[i] === instance)\n populate();\n array[i].speed = value;\n },\n get times() {\n if (array[i] === instance)\n populate();\n return array[i].times;\n },\n set times(value) {\n if (array[i] === instance)\n populate();\n array[i].times = value;\n },\n toJSON() {\n if (array[i] === instance)\n populate();\n return array[i];\n }\n };\n array[i] = instance;\n }\n return array;\n };\n}, bound = function(obj) {\n return {\n availableParallelism: () => {\n return navigator.hardwareConcurrency;\n },\n arch: obj.arch.bind(obj),\n cpus: lazyCpus(obj),\n endianness: obj.endianness.bind(obj),\n freemem: obj.freemem.bind(obj),\n getPriority: obj.getPriority.bind(obj),\n homedir: obj.homedir.bind(obj),\n hostname: obj.hostname.bind(obj),\n loadavg: obj.loadavg.bind(obj),\n networkInterfaces: obj.networkInterfaces.bind(obj),\n platform: obj.platform.bind(obj),\n release: obj.release.bind(obj),\n setPriority: obj.setPriority.bind(obj),\n get tmpdir() {\n return tmpdir;\n },\n totalmem: obj.totalmem.bind(obj),\n type: obj.type.bind(obj),\n uptime: obj.uptime.bind(obj),\n userInfo: obj.userInfo.bind(obj),\n version: obj.version.bind(obj),\n machine: obj.machine.bind(obj),\n devNull: obj.devNull,\n EOL: obj.EOL,\n constants: @processBindingConstants.os\n };\n}, tmpdir = function() {\n var env = Bun.env;\n return tmpdir = function() {\n var path = env.TMPDIR || env.TMP || env.TEMP || \"/tmp\";\n const length = path.length;\n if (length > 1 && path[length - 1] === \"/\")\n path = path.slice(0, -1);\n return path;\n }, tmpdir();\n};\nreturn bound(Bun._Os())})\n"); -// - -// -static constexpr ASCIILiteral NodePathPosixCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/path.posix.ts\nreturn (@getInternalField(@internalModuleRegistry, 30) || @createInternalModuleById(30)).posix})\n"); -// - -// -static constexpr ASCIILiteral NodePathCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/path.ts\nvar bound = function(obj) {\n const toNamespacedPath = obj.toNamespacedPath.bind(obj);\n return {\n resolve: obj.resolve.bind(obj),\n normalize: obj.normalize.bind(obj),\n isAbsolute: obj.isAbsolute.bind(obj),\n join: obj.join.bind(obj),\n relative: obj.relative.bind(obj),\n toNamespacedPath,\n dirname: obj.dirname.bind(obj),\n basename: obj.basename.bind(obj),\n extname: obj.extname.bind(obj),\n format: obj.format.bind(obj),\n parse: obj.parse.bind(obj),\n sep: obj.sep,\n delimiter: obj.delimiter,\n win32: @undefined,\n posix: @undefined,\n _makeLong: toNamespacedPath\n };\n}, posix = bound(Bun._Path(!1)), win32 = bound(Bun._Path(!0));\nposix.win32 = win32.win32 = win32;\nposix.posix = win32.posix = posix;\nreturn posix})\n"); -// - -// -static constexpr ASCIILiteral NodePathWin32Code = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/path.win32.ts\nreturn (@getInternalField(@internalModuleRegistry, 30) || @createInternalModuleById(30)).win32})\n"); -// - -// -static constexpr ASCIILiteral NodePerfHooksCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/perf_hooks.ts\nvar $, { throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6), constants = {\n NODE_PERFORMANCE_GC_MAJOR: 4,\n NODE_PERFORMANCE_GC_MINOR: 1,\n NODE_PERFORMANCE_GC_INCREMENTAL: 8,\n NODE_PERFORMANCE_GC_WEAKCB: 16,\n NODE_PERFORMANCE_GC_FLAGS_NO: 0,\n NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: 2,\n NODE_PERFORMANCE_GC_FLAGS_FORCED: 4,\n NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING: 8,\n NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE: 16,\n NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: 32,\n NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: 64\n}, performance = globalThis.performance;\n\nclass PerformanceObserver {\n constructor() {\n throwNotImplemented(\"PerformanceObserver\");\n }\n}\n\nclass PerformanceEntry {\n constructor() {\n throwNotImplemented(\"PerformanceEntry\");\n }\n}\n$ = {\n performance,\n constants,\n PerformanceEntry,\n PerformanceObserver\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodePunycodeCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/punycode.ts\nvar error = function(type) {\n @throwRangeError(errors[type]);\n}, map = function(array, callback) {\n const result = [];\n let length = array.length;\n while (length--)\n result[length] = callback(array[length]);\n return result;\n}, mapDomain = function(domain, callback) {\n const parts = domain.split(\"@\");\n let result = \"\";\n if (parts.length > 1)\n result = parts[0] + \"@\", domain = parts[1];\n domain = domain.replace(regexSeparators, \".\");\n const labels = domain.split(\".\"), encoded = map(labels, callback).join(\".\");\n return result + encoded;\n}, ucs2decode = function(string) {\n const output = [];\n let counter = 0;\n const length = string.length;\n while (counter < length) {\n const value = string.charCodeAt(counter++);\n if (value >= 55296 && value <= 56319 && counter < length) {\n const extra = string.charCodeAt(counter++);\n if ((extra & 64512) == 56320)\n output.push(((value & 1023) << 10) + (extra & 1023) + 65536);\n else\n output.push(value), counter--;\n } else\n output.push(value);\n }\n return output;\n}, $, maxInt = 2147483647, base = 36, tMin = 1, tMax = 26, skew = 38, damp = 700, initialBias = 72, initialN = 128, delimiter = \"-\", regexPunycode = /^xn--/, regexNonASCII = /[^\\0-\\x7F]/, regexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g, errors = {\n overflow: \"Overflow: input needs wider integers to process\",\n \"not-basic\": \"Illegal input >= 0x80 (not a basic code point)\",\n \"invalid-input\": \"Invalid input\"\n}, baseMinusTMin = base - tMin, floor = Math.floor, stringFromCharCode = @String.fromCharCode, ucs2encode = (codePoints) => @String.fromCodePoint(...codePoints), basicToDigit = function(codePoint) {\n if (codePoint >= 48 && codePoint < 58)\n return 26 + (codePoint - 48);\n if (codePoint >= 65 && codePoint < 91)\n return codePoint - 65;\n if (codePoint >= 97 && codePoint < 123)\n return codePoint - 97;\n return base;\n}, digitToBasic = function(digit, flag) {\n return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n}, adapt = function(delta, numPoints, firstTime) {\n let k = 0;\n delta = firstTime \? floor(delta / damp) : delta >> 1, delta += floor(delta / numPoints);\n for (;delta > baseMinusTMin * tMax >> 1; k += base)\n delta = floor(delta / baseMinusTMin);\n return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n}, decode = function(input) {\n const output = [], inputLength = input.length;\n let i = 0, n = initialN, bias = initialBias, basic = input.lastIndexOf(delimiter);\n if (basic < 0)\n basic = 0;\n for (let j = 0;j < basic; ++j) {\n if (input.charCodeAt(j) >= 128)\n error(\"not-basic\");\n output.push(input.charCodeAt(j));\n }\n for (let index = basic > 0 \? basic + 1 : 0;index < inputLength; ) {\n const oldi = i;\n for (let w = 1, k = base;; k += base) {\n if (index >= inputLength)\n error(\"invalid-input\");\n const digit = basicToDigit(input.charCodeAt(index++));\n if (digit >= base)\n error(\"invalid-input\");\n if (digit > floor((maxInt - i) / w))\n error(\"overflow\");\n i += digit * w;\n const t = k <= bias \? tMin : k >= bias + tMax \? tMax : k - bias;\n if (digit < t)\n break;\n const baseMinusT = base - t;\n if (w > floor(maxInt / baseMinusT))\n error(\"overflow\");\n w *= baseMinusT;\n }\n const out = output.length + 1;\n if (bias = adapt(i - oldi, out, oldi == 0), floor(i / out) > maxInt - n)\n error(\"overflow\");\n n += floor(i / out), i %= out, output.splice(i++, 0, n);\n }\n return @String.fromCodePoint(...output);\n}, encode = function(input) {\n const output = [];\n input = ucs2decode(input);\n const inputLength = input.length;\n let n = initialN, delta = 0, bias = initialBias;\n for (let currentValue of input)\n if (currentValue < 128)\n output.push(stringFromCharCode(currentValue));\n const basicLength = output.length;\n let handledCPCount = basicLength;\n if (basicLength)\n output.push(delimiter);\n while (handledCPCount < inputLength) {\n let m = maxInt;\n for (let currentValue of input)\n if (currentValue >= n && currentValue < m)\n m = currentValue;\n const handledCPCountPlusOne = handledCPCount + 1;\n if (m - n > floor((maxInt - delta) / handledCPCountPlusOne))\n error(\"overflow\");\n delta += (m - n) * handledCPCountPlusOne, n = m;\n for (let currentValue of input) {\n if (currentValue < n && ++delta > maxInt)\n error(\"overflow\");\n if (currentValue === n) {\n let q = delta;\n for (let k = base;; k += base) {\n const t = k <= bias \? tMin : k >= bias + tMax \? tMax : k - bias;\n if (q < t)\n break;\n const qMinusT = q - t, baseMinusT = base - t;\n output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))), q = floor(qMinusT / baseMinusT);\n }\n output.push(stringFromCharCode(digitToBasic(q, 0))), bias = adapt(delta, handledCPCountPlusOne, handledCPCount === basicLength), delta = 0, ++handledCPCount;\n }\n }\n ++delta, ++n;\n }\n return output.join(\"\");\n}, toUnicode = function(input) {\n return mapDomain(input, function(string) {\n return regexPunycode.test(string) \? decode(string.slice(4).toLowerCase()) : string;\n });\n}, toASCII = function(input) {\n return mapDomain(input, function(string) {\n return regexNonASCII.test(string) \? \"xn--\" + encode(string) : string;\n });\n};\n$ = {\n version: \"2.1.0\",\n ucs2: {\n decode: ucs2decode,\n encode: ucs2encode\n },\n decode,\n encode,\n toASCII,\n toUnicode\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeQuerystringCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/querystring.ts\nvar __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports), Buffer = @requireNativeModule(\"buffer\").Buffer, require_object_keys = __commonJS((exports, module) => {\n var objectKeys = Object.keys || function() {\n var hasOwnProperty = Object.prototype.hasOwnProperty, hasDontEnumBug = !{ toString: null }.propertyIsEnumerable(\"toString\"), dontEnums = [\n \"toString\",\n \"toLocaleString\",\n \"valueOf\",\n \"hasOwnProperty\",\n \"isPrototypeOf\",\n \"propertyIsEnumerable\",\n \"constructor\"\n ], dontEnumsLength = dontEnums.length;\n return function(obj) {\n if (typeof obj !== \"function\" && (typeof obj !== \"object\" || obj === null))\n @throwTypeError(\"Object.keys called on non-object\");\n var result = [], prop, i;\n for (prop in obj)\n if (hasOwnProperty.@call(obj, prop))\n result.push(prop);\n if (hasDontEnumBug) {\n for (i = 0;i < dontEnumsLength; i++)\n if (hasOwnProperty.@call(obj, dontEnums[i]))\n result.push(dontEnums[i]);\n }\n return result;\n };\n }();\n module.exports = objectKeys;\n}), require_src = __commonJS((exports, module) => {\n var ParsedQueryString = function() {\n }, unescapeBuffer = function(s, decodeSpaces) {\n var out = Buffer.allocUnsafe(s.length), state = 0, n, m, hexchar, c;\n for (var inIndex = 0, outIndex = 0;; inIndex++) {\n if (inIndex < s.length)\n c = s.charCodeAt(inIndex);\n else {\n if (state > 0) {\n if (out[outIndex++] = 37, state === 2)\n out[outIndex++] = hexchar;\n }\n break;\n }\n switch (state) {\n case 0:\n switch (c) {\n case 37:\n n = 0, m = 0, state = 1;\n break;\n case 43:\n if (decodeSpaces)\n c = 32;\n default:\n out[outIndex++] = c;\n break;\n }\n break;\n case 1:\n if (hexchar = c, n = unhexTable[c], !(n >= 0)) {\n out[outIndex++] = 37, out[outIndex++] = c, state = 0;\n break;\n }\n state = 2;\n break;\n case 2:\n if (state = 0, m = unhexTable[c], !(m >= 0)) {\n out[outIndex++] = 37, out[outIndex++] = hexchar, out[outIndex++] = c;\n break;\n }\n out[outIndex++] = 16 * n + m;\n break;\n }\n }\n return out.slice(0, outIndex);\n }, qsUnescape = function(s, decodeSpaces) {\n try {\n return decodeURIComponent(s);\n } catch (e) {\n return QueryString.unescapeBuffer(s, decodeSpaces).toString();\n }\n }, qsEscape = function(str) {\n if (typeof str !== \"string\")\n if (typeof str === \"object\")\n str = @String(str);\n else\n str += \"\";\n var out = \"\", lastPos = 0;\n for (var i2 = 0;i2 < str.length; ++i2) {\n var c = str.charCodeAt(i2);\n if (c < 128) {\n if (noEscape[c] === 1)\n continue;\n if (lastPos < i2)\n out += str.slice(lastPos, i2);\n lastPos = i2 + 1, out += hexTable[c];\n continue;\n }\n if (lastPos < i2)\n out += str.slice(lastPos, i2);\n if (c < 2048) {\n lastPos = i2 + 1, out += hexTable[192 | c >> 6] + hexTable[128 | c & 63];\n continue;\n }\n if (c < 55296 || c >= 57344) {\n lastPos = i2 + 1, out += hexTable[224 | c >> 12] + hexTable[128 | c >> 6 & 63] + hexTable[128 | c & 63];\n continue;\n }\n ++i2;\n var c2;\n if (i2 < str.length)\n c2 = str.charCodeAt(i2) & 1023;\n else\n throw new URIError(\"URI malformed\");\n lastPos = i2 + 1, c = 65536 + ((c & 1023) << 10 | c2), out += hexTable[240 | c >> 18] + hexTable[128 | c >> 12 & 63] + hexTable[128 | c >> 6 & 63] + hexTable[128 | c & 63];\n }\n if (lastPos === 0)\n return str;\n if (lastPos < str.length)\n return out + str.slice(lastPos);\n return out;\n }, stringifyPrimitive = function(v) {\n if (typeof v === \"string\")\n return v;\n if (typeof v === \"number\" && @isFinite(v))\n return \"\" + v;\n if (typeof v === \"boolean\")\n return v \? \"true\" : \"false\";\n return \"\";\n }, stringify = function(obj, sep, eq, options) {\n sep = sep || \"&\", eq = eq || \"=\";\n var encode = QueryString.escape;\n if (options && typeof options.encodeURIComponent === \"function\")\n encode = options.encodeURIComponent;\n if (obj !== null && typeof obj === \"object\") {\n var keys = objectKeys(obj), len = keys.length, flast = len - 1, fields = \"\";\n for (var i2 = 0;i2 < len; ++i2) {\n var k = keys[i2], v = obj[k], ks = encode(stringifyPrimitive(k)) + eq;\n if (isArray(v)) {\n var vlen = v.length, vlast = vlen - 1;\n for (var j = 0;j < vlen; ++j)\n if (fields += ks + encode(stringifyPrimitive(v[j])), j < vlast)\n fields += sep;\n if (vlen && i2 < flast)\n fields += sep;\n } else if (fields += ks + encode(stringifyPrimitive(v)), i2 < flast)\n fields += sep;\n }\n return fields;\n }\n return \"\";\n }, charCodes = function(str) {\n if (str.length === 0)\n return [];\n if (str.length === 1)\n return [str.charCodeAt(0)];\n const ret = [];\n for (var i2 = 0;i2 < str.length; ++i2)\n ret[ret.length] = str.charCodeAt(i2);\n return ret;\n }, parse = function(qs, sep, eq, options) {\n const obj = new ParsedQueryString;\n if (typeof qs !== \"string\" || qs.length === 0)\n return obj;\n var sepCodes = !sep \? defSepCodes : charCodes(sep + \"\"), eqCodes = !eq \? defEqCodes : charCodes(eq + \"\");\n const sepLen = sepCodes.length, eqLen = eqCodes.length;\n var pairs = 1000;\n if (options && typeof options.maxKeys === \"number\")\n pairs = options.maxKeys > 0 \? options.maxKeys : -1;\n var decode = QueryString.unescape;\n if (options && typeof options.decodeURIComponent === \"function\")\n decode = options.decodeURIComponent;\n const customDecode = decode !== qsUnescape, keys = [];\n var posIdx = 0, lastPos = 0, sepIdx = 0, eqIdx = 0, key = \"\", value = \"\", keyEncoded = customDecode, valEncoded = customDecode, encodeCheck = 0;\n for (var i2 = 0;i2 < qs.length; ++i2) {\n const code = qs.charCodeAt(i2);\n if (code === sepCodes[sepIdx]) {\n if (++sepIdx === sepLen) {\n const end = i2 - sepIdx + 1;\n if (eqIdx < eqLen) {\n if (lastPos < end)\n key += qs.slice(lastPos, end);\n } else if (lastPos < end)\n value += qs.slice(lastPos, end);\n if (keyEncoded)\n key = decodeStr(key, decode);\n if (valEncoded)\n value = decodeStr(value, decode);\n if (key || value || lastPos - posIdx > sepLen || i2 === 0)\n if (indexOf(keys, key) === -1)\n obj[key] = value, keys[keys.length] = key;\n else {\n const curValue = obj[key] || \"\";\n if (curValue.pop)\n curValue[curValue.length] = value;\n else if (curValue)\n obj[key] = [curValue, value];\n }\n else if (i2 === 1)\n delete obj[key];\n if (--pairs === 0)\n break;\n keyEncoded = valEncoded = customDecode, encodeCheck = 0, key = value = \"\", posIdx = lastPos, lastPos = i2 + 1, sepIdx = eqIdx = 0;\n }\n continue;\n } else if (sepIdx = 0, !valEncoded)\n if (code === 37)\n encodeCheck = 1;\n else if (encodeCheck > 0 && (code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) {\n if (++encodeCheck === 3)\n valEncoded = !0;\n } else\n encodeCheck = 0;\n if (eqIdx < eqLen) {\n if (code === eqCodes[eqIdx]) {\n if (++eqIdx === eqLen) {\n const end = i2 - eqIdx + 1;\n if (lastPos < end)\n key += qs.slice(lastPos, end);\n encodeCheck = 0, lastPos = i2 + 1;\n }\n continue;\n } else if (eqIdx = 0, !keyEncoded)\n if (code === 37)\n encodeCheck = 1;\n else if (encodeCheck > 0 && (code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) {\n if (++encodeCheck === 3)\n keyEncoded = !0;\n } else\n encodeCheck = 0;\n }\n if (code === 43) {\n if (eqIdx < eqLen) {\n if (lastPos < i2)\n key += qs.slice(lastPos, i2);\n key += \"%20\", keyEncoded = !0;\n } else {\n if (lastPos < i2)\n value += qs.slice(lastPos, i2);\n value += \"%20\", valEncoded = !0;\n }\n lastPos = i2 + 1;\n }\n }\n if (pairs !== 0 && (lastPos < qs.length || eqIdx > 0)) {\n if (lastPos < qs.length) {\n if (eqIdx < eqLen)\n key += qs.slice(lastPos);\n else if (sepIdx < sepLen)\n value += qs.slice(lastPos);\n }\n if (keyEncoded)\n key = decodeStr(key, decode);\n if (valEncoded)\n value = decodeStr(value, decode);\n if (indexOf(keys, key) === -1)\n obj[key] = value, keys[keys.length] = key;\n else {\n const curValue = obj[key];\n if (curValue.pop)\n curValue[curValue.length] = value;\n else\n obj[key] = [curValue, value];\n }\n }\n return obj;\n }, decodeStr = function(s, decoder) {\n try {\n return decoder(s);\n } catch (e) {\n return QueryString.unescape(s, !0);\n }\n }, QueryString = module.exports = {\n unescapeBuffer,\n unescape: qsUnescape,\n escape: qsEscape,\n stringify,\n encode: stringify,\n parse,\n decode: parse\n }, objectKeys = require_object_keys(), isArray = (arg) => Object.prototype.toString.@call(arg) === \"[object Array]\", indexOf = (arr, searchElement, fromIndex) => {\n var k;\n if (arr == null)\n @throwTypeError('\"arr\" is null or not defined');\n var o = Object(arr), len = o.length >>> 0;\n if (len === 0)\n return -1;\n var n = fromIndex | 0;\n if (n >= len)\n return -1;\n k = Math.max(n >= 0 \? n : len - Math.abs(n), 0);\n while (k < len) {\n if ((k in o) && o[k] === searchElement)\n return k;\n k++;\n }\n return -1;\n };\n ParsedQueryString.prototype = Object.create \? Object.create(null) : {};\n var unhexTable = [\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1\n ], hexTable = [];\n for (i = 0;i < 256; ++i)\n hexTable[i] = \"%\" + ((i < 16 \? \"0\" : \"\") + i.toString(16)).toUpperCase();\n var i, noEscape = [\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 0,\n 1,\n 1,\n 1,\n 1,\n 0,\n 0,\n 1,\n 1,\n 0,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 0,\n 0,\n 0,\n 1,\n 0\n ], defSepCodes = [38], defEqCodes = [61];\n});\nreturn require_src()})\n"); -// - -// -static constexpr ASCIILiteral NodeReadlineCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/readline.ts\nvar stripVTControlCharacters = function(str) {\n return validateString(str, \"str\"), RegExpPrototypeSymbolReplace.@call(ansi, str, \"\");\n}, promisify = function(original) {\n if (validateFunction(original, \"original\"), original[kCustomPromisifiedSymbol]) {\n var fn = original[kCustomPromisifiedSymbol];\n return validateFunction(fn, \"util.promisify.custom\"), ObjectDefineProperty(fn, kCustomPromisifiedSymbol, {\n __proto__: null,\n value: fn,\n enumerable: !1,\n writable: !1,\n configurable: !0\n });\n }\n var argumentNames = original[kCustomPromisifyArgsSymbol];\n function fn(...args) {\n return new @Promise((resolve, reject) => {\n ArrayPrototypePush.@call(args, (err, ...values) => {\n if (err)\n return reject(err);\n if (argumentNames !== @undefined && values.length > 1) {\n var obj = {};\n for (var i2 = 0;i2 < argumentNames.length; i2++)\n obj[argumentNames[i2]] = values[i2];\n resolve(obj);\n } else\n resolve(values[0]);\n }), ReflectApply(original, this, args);\n });\n }\n ObjectSetPrototypeOf(fn, ObjectGetPrototypeOf(original)), ObjectDefineProperty(fn, kCustomPromisifiedSymbol, {\n __proto__: null,\n value: fn,\n enumerable: !1,\n writable: !1,\n configurable: !0\n });\n var descriptors = ObjectGetOwnPropertyDescriptors(original), propertiesValues = ObjectValues(descriptors);\n for (var i = 0;i < propertiesValues.length; i++)\n ObjectSetPrototypeOf(propertiesValues[i], null);\n return ObjectDefineProperties(fn, descriptors);\n}, getNodeErrorByName = function(typeName) {\n var base = errorBases[typeName];\n if (base)\n return base;\n if (!ObjectKeys(VALID_NODE_ERROR_BASES).includes(typeName))\n throw new Error(\"Invalid NodeError type\");\n var Base = VALID_NODE_ERROR_BASES[typeName];\n\n class NodeError extends Base {\n [kIsNodeError] = !0;\n code;\n constructor(msg, opts) {\n super(msg, opts);\n this.code = opts\?.code || \"ERR_GENERIC\";\n }\n toString() {\n return `${this.name} [${this.code}]: ${this.message}`;\n }\n }\n return errorBases[typeName] = NodeError, NodeError;\n}, validateFunction = function(value, name) {\n if (typeof value !== \"function\")\n throw new ERR_INVALID_ARG_TYPE(name, \"Function\", value);\n}, validateAbortSignal = function(signal, name) {\n if (signal !== @undefined && (signal === null || typeof signal !== \"object\" || !(\"aborted\" in signal)))\n throw new ERR_INVALID_ARG_TYPE(name, \"AbortSignal\", signal);\n}, validateArray = function(value, name, minLength = 0) {\n if (!ArrayIsArray(value))\n throw new ERR_INVALID_ARG_TYPE(name, \"Array\", value);\n if (value.length < minLength) {\n var reason = `must be longer than ${minLength}`;\n throw new ERR_INVALID_ARG_VALUE(name, value, reason);\n }\n}, validateString = function(value, name) {\n if (typeof value !== \"string\")\n throw new ERR_INVALID_ARG_TYPE(name, \"string\", value);\n}, validateBoolean = function(value, name) {\n if (typeof value !== \"boolean\")\n throw new ERR_INVALID_ARG_TYPE(name, \"boolean\", value);\n};\nvar validateInteger = function(value, name, min = NumberMIN_SAFE_INTEGER, max = NumberMAX_SAFE_INTEGER) {\n if (typeof value !== \"number\")\n throw new ERR_INVALID_ARG_TYPE(name, \"number\", value);\n if (!NumberIsInteger(value))\n throw new ERR_OUT_OF_RANGE(name, \"an integer\", value);\n if (value < min || value > max)\n throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);\n}, validateUint32 = function(value, name, positive = !1) {\n if (typeof value !== \"number\")\n throw new ERR_INVALID_ARG_TYPE(name, \"number\", value);\n if (!NumberIsInteger(value))\n throw new ERR_OUT_OF_RANGE(name, \"an integer\", value);\n var min = positive \? 1 : 0, max = 4294967295;\n if (value < min || value > max)\n throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);\n}, CSI = function(strings, ...args) {\n var ret = `${kEscape}[`;\n for (var n = 0;n < strings.length; n++)\n if (ret += strings[n], n < args.length)\n ret += args[n];\n return ret;\n}, charLengthLeft = function(str, i) {\n if (i <= 0)\n return 0;\n if (i > 1 && StringPrototypeCodePointAt.@call(str, i - 2) >= kUTF16SurrogateThreshold || StringPrototypeCodePointAt.@call(str, i - 1) >= kUTF16SurrogateThreshold)\n return 2;\n return 1;\n}, charLengthAt = function(str, i) {\n if (str.length <= i)\n return 1;\n return StringPrototypeCodePointAt.@call(str, i) >= kUTF16SurrogateThreshold \? 2 : 1;\n};\nfunction* emitKeys(stream) {\n while (!0) {\n var ch = yield, s = ch, escaped = !1, keySeq = null, keyName, keyCtrl2 = !1, keyMeta = !1, keyShift = !1;\n if (ch === kEscape) {\n if (escaped = !0, s += ch = yield, ch === kEscape)\n s += ch = yield;\n }\n if (escaped && (ch === \"O\" || ch === \"[\")) {\n var code = ch, modifier = 0;\n if (ch === \"O\") {\n if (s += ch = yield, ch >= \"0\" && ch <= \"9\")\n modifier = (ch >> 0) - 1, s += ch = yield;\n code += ch;\n } else if (ch === \"[\") {\n if (s += ch = yield, ch === \"[\")\n code += ch, s += ch = yield;\n var cmdStart = s.length - 1;\n if (ch >= \"0\" && ch <= \"9\") {\n if (s += ch = yield, ch >= \"0\" && ch <= \"9\")\n s += ch = yield;\n }\n if (ch === \";\") {\n if (s += ch = yield, ch >= \"0\" && ch <= \"9\")\n s += yield;\n }\n var cmd = StringPrototypeSlice.@call(s, cmdStart), match;\n if (match = RegExpPrototypeExec.@call(/^(\\d\\d\?)(;(\\d))\?([~^$])$/, cmd))\n code += match[1] + match[4], modifier = (match[3] || 1) - 1;\n else if (match = RegExpPrototypeExec.@call(/^((\\d;)\?(\\d))\?([A-Za-z])$/, cmd))\n code += match[4], modifier = (match[3] || 1) - 1;\n else\n code += cmd;\n }\n switch (keyCtrl2 = !!(modifier & 4), keyMeta = !!(modifier & 10), keyShift = !!(modifier & 1), code) {\n case \"[P\":\n keyName = \"f1\";\n break;\n case \"[Q\":\n keyName = \"f2\";\n break;\n case \"[R\":\n keyName = \"f3\";\n break;\n case \"[S\":\n keyName = \"f4\";\n break;\n case \"OP\":\n keyName = \"f1\";\n break;\n case \"OQ\":\n keyName = \"f2\";\n break;\n case \"OR\":\n keyName = \"f3\";\n break;\n case \"OS\":\n keyName = \"f4\";\n break;\n case \"[11~\":\n keyName = \"f1\";\n break;\n case \"[12~\":\n keyName = \"f2\";\n break;\n case \"[13~\":\n keyName = \"f3\";\n break;\n case \"[14~\":\n keyName = \"f4\";\n break;\n case \"[[A\":\n keyName = \"f1\";\n break;\n case \"[[B\":\n keyName = \"f2\";\n break;\n case \"[[C\":\n keyName = \"f3\";\n break;\n case \"[[D\":\n keyName = \"f4\";\n break;\n case \"[[E\":\n keyName = \"f5\";\n break;\n case \"[15~\":\n keyName = \"f5\";\n break;\n case \"[17~\":\n keyName = \"f6\";\n break;\n case \"[18~\":\n keyName = \"f7\";\n break;\n case \"[19~\":\n keyName = \"f8\";\n break;\n case \"[20~\":\n keyName = \"f9\";\n break;\n case \"[21~\":\n keyName = \"f10\";\n break;\n case \"[23~\":\n keyName = \"f11\";\n break;\n case \"[24~\":\n keyName = \"f12\";\n break;\n case \"[A\":\n keyName = \"up\";\n break;\n case \"[B\":\n keyName = \"down\";\n break;\n case \"[C\":\n keyName = \"right\";\n break;\n case \"[D\":\n keyName = \"left\";\n break;\n case \"[E\":\n keyName = \"clear\";\n break;\n case \"[F\":\n keyName = \"end\";\n break;\n case \"[H\":\n keyName = \"home\";\n break;\n case \"OA\":\n keyName = \"up\";\n break;\n case \"OB\":\n keyName = \"down\";\n break;\n case \"OC\":\n keyName = \"right\";\n break;\n case \"OD\":\n keyName = \"left\";\n break;\n case \"OE\":\n keyName = \"clear\";\n break;\n case \"OF\":\n keyName = \"end\";\n break;\n case \"OH\":\n keyName = \"home\";\n break;\n case \"[1~\":\n keyName = \"home\";\n break;\n case \"[2~\":\n keyName = \"insert\";\n break;\n case \"[3~\":\n keyName = \"delete\";\n break;\n case \"[4~\":\n keyName = \"end\";\n break;\n case \"[5~\":\n keyName = \"pageup\";\n break;\n case \"[6~\":\n keyName = \"pagedown\";\n break;\n case \"[[5~\":\n keyName = \"pageup\";\n break;\n case \"[[6~\":\n keyName = \"pagedown\";\n break;\n case \"[7~\":\n keyName = \"home\";\n break;\n case \"[8~\":\n keyName = \"end\";\n break;\n case \"[a\":\n keyName = \"up\", keyShift = !0;\n break;\n case \"[b\":\n keyName = \"down\", keyShift = !0;\n break;\n case \"[c\":\n keyName = \"right\", keyShift = !0;\n break;\n case \"[d\":\n keyName = \"left\", keyShift = !0;\n break;\n case \"[e\":\n keyName = \"clear\", keyShift = !0;\n break;\n case \"[2$\":\n keyName = \"insert\", keyShift = !0;\n break;\n case \"[3$\":\n keyName = \"delete\", keyShift = !0;\n break;\n case \"[5$\":\n keyName = \"pageup\", keyShift = !0;\n break;\n case \"[6$\":\n keyName = \"pagedown\", keyShift = !0;\n break;\n case \"[7$\":\n keyName = \"home\", keyShift = !0;\n break;\n case \"[8$\":\n keyName = \"end\", keyShift = !0;\n break;\n case \"Oa\":\n keyName = \"up\", keyCtrl2 = !0;\n break;\n case \"Ob\":\n keyName = \"down\", keyCtrl2 = !0;\n break;\n case \"Oc\":\n keyName = \"right\", keyCtrl2 = !0;\n break;\n case \"Od\":\n keyName = \"left\", keyCtrl2 = !0;\n break;\n case \"Oe\":\n keyName = \"clear\", keyCtrl2 = !0;\n break;\n case \"[2^\":\n keyName = \"insert\", keyCtrl2 = !0;\n break;\n case \"[3^\":\n keyName = \"delete\", keyCtrl2 = !0;\n break;\n case \"[5^\":\n keyName = \"pageup\", keyCtrl2 = !0;\n break;\n case \"[6^\":\n keyName = \"pagedown\", keyCtrl2 = !0;\n break;\n case \"[7^\":\n keyName = \"home\", keyCtrl2 = !0;\n break;\n case \"[8^\":\n keyName = \"end\", keyCtrl2 = !0;\n break;\n case \"[Z\":\n keyName = \"tab\", keyShift = !0;\n break;\n default:\n keyName = \"undefined\";\n break;\n }\n } else if (ch === \"\\r\")\n keyName = \"return\", keyMeta = escaped;\n else if (ch === \"\\n\")\n keyName = \"enter\", keyMeta = escaped;\n else if (ch === \"\\t\")\n keyName = \"tab\", keyMeta = escaped;\n else if (ch === \"\\b\" || ch === \"\\x7F\")\n keyName = \"backspace\", keyMeta = escaped;\n else if (ch === kEscape)\n keyName = \"escape\", keyMeta = escaped;\n else if (ch === \" \")\n keyName = \"space\", keyMeta = escaped;\n else if (!escaped && ch <= \"\\x1A\")\n keyName = StringFromCharCode(StringPrototypeCharCodeAt.@call(ch) + StringPrototypeCharCodeAt.@call(\"a\") - 1), keyCtrl2 = !0;\n else if (RegExpPrototypeExec.@call(/^[0-9A-Za-z]$/, ch) !== null)\n keyName = StringPrototypeToLowerCase.@call(ch), keyShift = RegExpPrototypeExec.@call(/^[A-Z]$/, ch) !== null, keyMeta = escaped;\n else if (escaped)\n keyName = ch.length \? @undefined : \"escape\", keyMeta = !0;\n else\n keyName = @undefined;\n if (keySeq = s, s.length !== 0 && (keyName !== @undefined || escaped))\n stream.emit(\"keypress\", escaped \? @undefined : s, {\n sequence: keySeq,\n name: keyName,\n ctrl: keyCtrl2,\n meta: keyMeta,\n shift: keyShift\n });\n else if (charLengthAt(s, 0) === s.length)\n stream.emit(\"keypress\", s, {\n sequence: keySeq,\n name: keyName,\n ctrl: keyCtrl2,\n meta: keyMeta,\n shift: keyShift\n });\n }\n}\nvar commonPrefix = function(strings) {\n if (strings.length === 0)\n return \"\";\n if (strings.length === 1)\n return strings[0];\n var sorted = ArrayPrototypeSort.@call(ArrayPrototypeSlice.@call(strings)), min = sorted[0], max = sorted[sorted.length - 1];\n for (var i = 0;i < min.length; i++)\n if (min[i] !== max[i])\n return StringPrototypeSlice.@call(min, 0, i);\n return min;\n}, cursorTo = function(stream, x, y, callback) {\n if (callback !== @undefined)\n validateFunction(callback, \"callback\");\n if (typeof y === \"function\")\n callback = y, y = @undefined;\n if (NumberIsNaN(x))\n throw new ERR_INVALID_ARG_VALUE(\"x\", x);\n if (NumberIsNaN(y))\n throw new ERR_INVALID_ARG_VALUE(\"y\", y);\n if (stream == null || typeof x !== \"number\" && typeof y !== \"number\") {\n if (typeof callback === \"function\")\n process.nextTick(callback, null);\n return !0;\n }\n if (typeof x !== \"number\")\n throw new ERR_INVALID_CURSOR_POS;\n var data = typeof y !== \"number\" \? CSI`${x + 1}G` : CSI`${y + 1};${x + 1}H`;\n return stream.write(data, callback);\n}, moveCursor = function(stream, dx, dy, callback) {\n if (callback !== @undefined)\n validateFunction(callback, \"callback\");\n if (stream == null || !(dx || dy)) {\n if (typeof callback === \"function\")\n process.nextTick(callback, null);\n return !0;\n }\n var data = \"\";\n if (dx < 0)\n data += CSI`${-dx}D`;\n else if (dx > 0)\n data += CSI`${dx}C`;\n if (dy < 0)\n data += CSI`${-dy}A`;\n else if (dy > 0)\n data += CSI`${dy}B`;\n return stream.write(data, callback);\n}, clearLine = function(stream, dir, callback) {\n if (callback !== @undefined)\n validateFunction(callback, \"callback\");\n if (stream === null || stream === @undefined) {\n if (typeof callback === \"function\")\n process.nextTick(callback, null);\n return !0;\n }\n var type = dir < 0 \? kClearToLineBeginning : dir > 0 \? kClearToLineEnd : kClearLine;\n return stream.write(type, callback);\n}, clearScreenDown = function(stream, callback) {\n if (callback !== @undefined)\n validateFunction(callback, \"callback\");\n if (stream === null || stream === @undefined) {\n if (typeof callback === \"function\")\n process.nextTick(callback, null);\n return !0;\n }\n return stream.write(kClearScreenDown, callback);\n}, emitKeypressEvents = function(stream, iface = {}) {\n if (stream[KEYPRESS_DECODER])\n return;\n stream[KEYPRESS_DECODER] = new StringDecoder(\"utf8\"), stream[ESCAPE_DECODER] = emitKeys(stream), stream[ESCAPE_DECODER].next();\n var triggerEscape = () => stream[ESCAPE_DECODER].next(\"\"), { escapeCodeTimeout = ESCAPE_CODE_TIMEOUT } = iface, timeoutId;\n function onData(input) {\n if (stream.listenerCount(\"keypress\") > 0) {\n var string = stream[KEYPRESS_DECODER].write(input);\n if (string) {\n clearTimeout(timeoutId), iface[kSawKeyPress] = charLengthAt(string, 0) === string.length, iface.isCompletionEnabled = !1;\n var length = 0;\n for (var character of new SafeStringIterator(string)) {\n if (length += character.length, length === string.length)\n iface.isCompletionEnabled = !0;\n try {\n if (stream[ESCAPE_DECODER].next(character), length === string.length && character === kEscape)\n timeoutId = setTimeout(triggerEscape, escapeCodeTimeout);\n } catch (err) {\n throw stream[ESCAPE_DECODER] = emitKeys(stream), stream[ESCAPE_DECODER].next(), err;\n }\n }\n }\n } else\n stream.removeListener(\"data\", onData), stream.on(\"newListener\", onNewListener);\n }\n function onNewListener(event) {\n if (event === \"keypress\")\n stream.on(\"data\", onData), stream.removeListener(\"newListener\", onNewListener);\n }\n if (stream.listenerCount(\"keypress\") > 0)\n stream.on(\"data\", onData);\n else\n stream.on(\"newListener\", onNewListener);\n}, onSelfCloseWithTerminal = function() {\n var input = this.input, output = this.output;\n if (!input)\n throw new Error(\"Input not set, invalid state for readline!\");\n if (input.removeListener(\"keypress\", this[kOnKeyPress]), input.removeListener(\"error\", this[kOnError]), input.removeListener(\"end\", this[kOnTermEnd]), output !== null && output !== @undefined)\n output.removeListener(\"resize\", this[kOnResize]);\n}, onSelfCloseWithoutTerminal = function() {\n var input = this.input;\n if (!input)\n throw new Error(\"Input not set, invalid state for readline!\");\n input.removeListener(\"data\", this[kOnData]), input.removeListener(\"error\", this[kOnError]), input.removeListener(\"end\", this[kOnEnd]);\n}, onError = function(err) {\n this.emit(\"error\", err);\n}, onData = function(data) {\n debug(\"onData\"), this[kNormalWrite](data);\n}, onEnd = function() {\n if (debug(\"onEnd\"), typeof this[kLine_buffer] === \"string\" && this[kLine_buffer].length > 0)\n this.emit(\"line\", this[kLine_buffer]);\n this.close();\n}, onTermEnd = function() {\n if (debug(\"onTermEnd\"), typeof this.line === \"string\" && this.line.length > 0)\n this.emit(\"line\", this.line);\n this.close();\n}, onKeyPress = function(s, key) {\n if (this[kTtyWrite](s, key), key && key.sequence) {\n var ch = StringPrototypeCodePointAt.@call(key.sequence, 0);\n if (ch >= 55296 && ch <= 57343)\n this[kRefreshLine]();\n }\n}, onResize = function() {\n this[kRefreshLine]();\n}, InterfaceConstructor = function(input, output, completer, terminal) {\n if (!(this instanceof InterfaceConstructor))\n return new InterfaceConstructor(input, output, completer, terminal);\n EventEmitter.@call(this), this[kOnSelfCloseWithoutTerminal] = onSelfCloseWithoutTerminal.bind(this), this[kOnSelfCloseWithTerminal] = onSelfCloseWithTerminal.bind(this), this[kOnError] = onError.bind(this), this[kOnData] = onData.bind(this), this[kOnEnd] = onEnd.bind(this), this[kOnTermEnd] = onTermEnd.bind(this), this[kOnKeyPress] = onKeyPress.bind(this), this[kOnResize] = onResize.bind(this), this[kSawReturnAt] = 0, this.isCompletionEnabled = !0, this[kSawKeyPress] = !1, this[kPreviousKey] = null, this.escapeCodeTimeout = ESCAPE_CODE_TIMEOUT, this.tabSize = 8;\n var history, historySize, removeHistoryDuplicates = !1, crlfDelay, prompt = \"> \", signal;\n if (input\?.input) {\n output = input.output, completer = input.completer, terminal = input.terminal, history = input.history, historySize = input.historySize, signal = input.signal;\n var tabSize = input.tabSize;\n if (tabSize !== @undefined)\n validateUint32(tabSize, \"tabSize\", !0), this.tabSize = tabSize;\n removeHistoryDuplicates = input.removeHistoryDuplicates;\n var inputPrompt = input.prompt;\n if (inputPrompt !== @undefined)\n prompt = inputPrompt;\n var inputEscapeCodeTimeout = input.escapeCodeTimeout;\n if (inputEscapeCodeTimeout !== @undefined)\n if (NumberIsFinite(inputEscapeCodeTimeout))\n this.escapeCodeTimeout = inputEscapeCodeTimeout;\n else\n throw new ERR_INVALID_ARG_VALUE(\"input.escapeCodeTimeout\", this.escapeCodeTimeout);\n if (signal)\n validateAbortSignal(signal, \"options.signal\");\n crlfDelay = input.crlfDelay, input = input.input;\n }\n if (completer !== @undefined && typeof completer !== \"function\")\n throw new ERR_INVALID_ARG_VALUE(\"completer\", completer);\n if (history === @undefined)\n history = [];\n else\n validateArray(history, \"history\");\n if (historySize === @undefined)\n historySize = kHistorySize;\n if (typeof historySize !== \"number\" || NumberIsNaN(historySize) || historySize < 0)\n throw new ERR_INVALID_ARG_VALUE(\"historySize\", historySize);\n if (terminal === @undefined && !(output === null || output === @undefined))\n terminal = !!output.isTTY;\n if (this.line = \"\", this[kSubstringSearch] = null, this.output = output, this.input = input, this[kUndoStack] = [], this[kRedoStack] = [], this.history = history, this.historySize = historySize, this[kKillRing] = [], this[kKillRingCursor] = 0, this.removeHistoryDuplicates = !!removeHistoryDuplicates, this.crlfDelay = crlfDelay \? MathMax(kMincrlfDelay, crlfDelay) : kMincrlfDelay, this.completer = completer, this.setPrompt(prompt), this.terminal = !!terminal, this[kLineObjectStream] = @undefined, input.on(\"error\", this[kOnError]), !this.terminal)\n input.on(\"data\", this[kOnData]), input.on(\"end\", this[kOnEnd]), this.once(\"close\", this[kOnSelfCloseWithoutTerminal]), this[kDecoder] = new StringDecoder(\"utf8\");\n else {\n if (emitKeypressEvents(input, this), input.on(\"keypress\", this[kOnKeyPress]), input.on(\"end\", this[kOnTermEnd]), this[kSetRawMode](!0), this.terminal = !0, this.cursor = 0, this.historyIndex = -1, output !== null && output !== @undefined)\n output.on(\"resize\", this[kOnResize]);\n this.once(\"close\", this[kOnSelfCloseWithTerminal]);\n }\n if (signal) {\n var onAborted = (() => this.close()).bind(this);\n if (signal.aborted)\n process.nextTick(onAborted);\n else\n signal.addEventListener(\"abort\", onAborted, { once: !0 }), this.once(\"close\", () => signal.removeEventListener(\"abort\", onAborted));\n }\n this.line = \"\", input.resume();\n}, Interface = function(input, output, completer, terminal) {\n if (!(this instanceof Interface))\n return new Interface(input, output, completer, terminal);\n if (input\?.input && typeof input.completer === \"function\" && input.completer.length !== 2) {\n var { completer } = input;\n input.completer = (v, cb) => cb(null, completer(v));\n } else if (typeof completer === \"function\" && completer.length !== 2) {\n var realCompleter = completer;\n completer = (v, cb) => cb(null, realCompleter(v));\n }\n InterfaceConstructor.@call(this, input, output, completer, terminal);\n}, createInterface = function(input, output, completer, terminal) {\n return new Interface(input, output, completer, terminal);\n};\nvar $, EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20), { StringDecoder } = @requireNativeModule(\"string_decoder\"), isWritable, { inspect } = Bun, debug = process.env.BUN_JS_DEBUG \? console.log : () => {\n}, SymbolAsyncIterator = Symbol.asyncIterator, SymbolIterator = Symbol.iterator, SymbolFor = Symbol.for, SymbolReplace = Symbol.replace, ArrayFrom = @Array.from, ArrayIsArray = @Array.isArray, ArrayPrototypeFilter = @Array.prototype.filter, ArrayPrototypeSort = @Array.prototype.sort, ArrayPrototypeIndexOf = @Array.prototype.indexOf, ArrayPrototypeJoin = @Array.prototype.join, ArrayPrototypeMap = @Array.prototype.map, ArrayPrototypePop = @Array.prototype.pop, ArrayPrototypePush = @Array.prototype.push, ArrayPrototypeSlice = @Array.prototype.slice, ArrayPrototypeSplice = @Array.prototype.splice, ArrayPrototypeReverse = @Array.prototype.reverse, ArrayPrototypeShift = @Array.prototype.shift, ArrayPrototypeUnshift = @Array.prototype.unshift, RegExpPrototypeExec = @RegExp.prototype.exec, RegExpPrototypeSymbolReplace = @RegExp.prototype[SymbolReplace], StringFromCharCode = @String.fromCharCode, StringPrototypeCharCodeAt = @String.prototype.charCodeAt, StringPrototypeCodePointAt = @String.prototype.codePointAt, StringPrototypeSlice = @String.prototype.slice, StringPrototypeToLowerCase = @String.prototype.toLowerCase, StringPrototypeEndsWith = @String.prototype.endsWith, StringPrototypeRepeat = @String.prototype.repeat, StringPrototypeStartsWith = @String.prototype.startsWith, StringPrototypeTrim = @String.prototype.trim, StringPrototypeNormalize = @String.prototype.normalize, NumberIsNaN = Number.isNaN, NumberIsFinite = Number.isFinite, NumberIsInteger = Number.isInteger, NumberMAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER, NumberMIN_SAFE_INTEGER = Number.MIN_SAFE_INTEGER, MathCeil = Math.ceil, MathFloor = Math.floor, MathMax = Math.max, DateNow = Date.now, FunctionPrototype = Function.prototype, StringPrototype = @String.prototype, StringPrototypeSymbolIterator = StringPrototype[SymbolIterator], StringIteratorPrototypeNext = StringPrototypeSymbolIterator.@call(\"\").next, ObjectSetPrototypeOf = Object.setPrototypeOf, ObjectDefineProperty = Object.defineProperty, ObjectDefineProperties = Object.defineProperties, ObjectFreeze = Object.freeze;\nvar { create: ObjectCreate, keys: ObjectKeys } = Object;\nvar createSafeIterator = (factory, next) => {\n class SafeIterator {\n #iterator;\n constructor(iterable) {\n this.#iterator = factory.@call(iterable);\n }\n next() {\n return next.@call(this.#iterator);\n }\n [SymbolIterator]() {\n return this;\n }\n }\n return ObjectSetPrototypeOf(SafeIterator.prototype, null), ObjectFreeze(SafeIterator.prototype), ObjectFreeze(SafeIterator), SafeIterator;\n}, SafeStringIterator = createSafeIterator(StringPrototypeSymbolIterator, StringIteratorPrototypeNext), isFullWidthCodePoint = (code) => {\n return code >= 4352 && (code <= 4447 || code === 9001 || code === 9002 || code >= 11904 && code <= 12871 && code !== 12351 || code >= 12880 && code <= 19903 || code >= 19968 && code <= 42182 || code >= 43360 && code <= 43388 || code >= 44032 && code <= 55203 || code >= 63744 && code <= 64255 || code >= 65040 && code <= 65049 || code >= 65072 && code <= 65131 || code >= 65281 && code <= 65376 || code >= 65504 && code <= 65510 || code >= 110592 && code <= 110593 || code >= 127488 && code <= 127569 || code >= 127744 && code <= 128591 || code >= 131072 && code <= 262141);\n}, isZeroWidthCodePoint = (code) => {\n return code <= 31 || code >= 127 && code <= 159 || code >= 768 && code <= 879 || code >= 8203 && code <= 8207 || code >= 8400 && code <= 8447 || code >= 65024 && code <= 65039 || code >= 65056 && code <= 65071 || code >= 917760 && code <= 917999;\n}, getStringWidth = function getStringWidth2(str, removeControlChars = !0) {\n var width = 0;\n if (removeControlChars)\n str = stripVTControlCharacters(str);\n str = StringPrototypeNormalize.@call(str, \"NFC\");\n for (var char of new SafeStringIterator(str)) {\n var code = StringPrototypeCodePointAt.@call(char, 0);\n if (isFullWidthCodePoint(code))\n width += 2;\n else if (!isZeroWidthCodePoint(code))\n width++;\n }\n return width;\n}, ansiPattern = \"[\\\\u001B\\\\u009B][[\\\\]()#;\?]*(\?:(\?:(\?:(\?:;[-a-zA-Z\\\\d\\\\/#&.:=\?%@~_]+)*|[a-zA-Z\\\\d]+(\?:;[-a-zA-Z\\\\d\\\\/#&.:=\?%@~_]*)*)\?\\\\u0007)|(\?:(\?:\\\\d{1,4}(\?:;\\\\d{0,4})*)\?[\\\\dA-PR-TZcf-ntqry=><~]))\", ansi = new @RegExp(ansiPattern, \"g\"), kCustomPromisifiedSymbol = SymbolFor(\"nodejs.util.promisify.custom\"), kCustomPromisifyArgsSymbol = Symbol(\"customPromisifyArgs\");\npromisify.custom = kCustomPromisifiedSymbol;\nvar kUTF16SurrogateThreshold = 65536, kEscape = \"\\x1B\", kSubstringSearch = Symbol(\"kSubstringSearch\"), kIsNodeError = Symbol(\"kIsNodeError\"), errorBases = {}, VALID_NODE_ERROR_BASES = {\n TypeError,\n RangeError,\n Error\n}, NodeError = getNodeErrorByName(\"Error\"), NodeTypeError = getNodeErrorByName(\"TypeError\"), NodeRangeError = getNodeErrorByName(\"RangeError\");\n\nclass ERR_INVALID_ARG_TYPE extends NodeTypeError {\n constructor(name, type, value) {\n super(`The \"${name}\" argument must be of type ${type}. Received type ${typeof value}`, {\n code: \"ERR_INVALID_ARG_TYPE\"\n });\n }\n}\n\nclass ERR_INVALID_ARG_VALUE extends NodeTypeError {\n constructor(name, value, reason = \"not specified\") {\n super(`The value \"${@String(value)}\" is invalid for argument '${name}'. Reason: ${reason}`, {\n code: \"ERR_INVALID_ARG_VALUE\"\n });\n }\n}\n\nclass ERR_INVALID_CURSOR_POS extends NodeTypeError {\n constructor() {\n super(\"Cannot set cursor row without setting its column\", {\n code: \"ERR_INVALID_CURSOR_POS\"\n });\n }\n}\n\nclass ERR_OUT_OF_RANGE extends NodeRangeError {\n constructor(name, range, received) {\n super(`The value of \"${name}\" is out of range. It must be ${range}. Received ${received}`, {\n code: \"ERR_OUT_OF_RANGE\"\n });\n }\n}\n\nclass ERR_USE_AFTER_CLOSE extends NodeError {\n constructor() {\n super(\"This socket has been ended by the other party\", {\n code: \"ERR_USE_AFTER_CLOSE\"\n });\n }\n}\n\nclass AbortError extends Error {\n code;\n constructor() {\n super(\"The operation was aborted\");\n this.code = \"ABORT_ERR\";\n }\n}\nvar kClearLine, kClearScreenDown, kClearToLineBeginning, kClearToLineEnd;\nCSI.kEscape = kEscape;\nCSI.kClearLine = kClearLine = CSI`2K`;\nCSI.kClearScreenDown = kClearScreenDown = CSI`0J`;\nCSI.kClearToLineBeginning = kClearToLineBeginning = CSI`1K`;\nCSI.kClearToLineEnd = kClearToLineEnd = CSI`0K`;\nvar KEYPRESS_DECODER = Symbol(\"keypress-decoder\"), ESCAPE_DECODER = Symbol(\"escape-decoder\"), ESCAPE_CODE_TIMEOUT = 500, kEmptyObject = ObjectFreeze(ObjectCreate(null)), kHistorySize = 30, kMaxUndoRedoStackSize = 2048, kMincrlfDelay = 100, lineEnding = /\\r\?\\n|\\r(\?!\\n)/g, kMaxLengthOfKillRing = 32, kLineObjectStream = Symbol(\"line object stream\"), kQuestionCancel = Symbol(\"kQuestionCancel\"), kQuestion = Symbol(\"kQuestion\"), kAddHistory = Symbol(\"_addHistory\"), kBeforeEdit = Symbol(\"_beforeEdit\"), kDecoder = Symbol(\"_decoder\"), kDeleteLeft = Symbol(\"_deleteLeft\"), kDeleteLineLeft = Symbol(\"_deleteLineLeft\"), kDeleteLineRight = Symbol(\"_deleteLineRight\"), kDeleteRight = Symbol(\"_deleteRight\"), kDeleteWordLeft = Symbol(\"_deleteWordLeft\"), kDeleteWordRight = Symbol(\"_deleteWordRight\"), kGetDisplayPos = Symbol(\"_getDisplayPos\"), kHistoryNext = Symbol(\"_historyNext\"), kHistoryPrev = Symbol(\"_historyPrev\"), kInsertString = Symbol(\"_insertString\"), kLine = Symbol(\"_line\"), kLine_buffer = Symbol(\"_line_buffer\"), kKillRing = Symbol(\"_killRing\"), kKillRingCursor = Symbol(\"_killRingCursor\"), kMoveCursor = Symbol(\"_moveCursor\"), kNormalWrite = Symbol(\"_normalWrite\"), kOldPrompt = Symbol(\"_oldPrompt\"), kOnLine = Symbol(\"_onLine\"), kPreviousKey = Symbol(\"_previousKey\"), kPrompt = Symbol(\"_prompt\"), kPushToKillRing = Symbol(\"_pushToKillRing\"), kPushToUndoStack = Symbol(\"_pushToUndoStack\"), kQuestionCallback = Symbol(\"_questionCallback\"), kRedo = Symbol(\"_redo\"), kRedoStack = Symbol(\"_redoStack\"), kRefreshLine = Symbol(\"_refreshLine\"), kSawKeyPress = Symbol(\"_sawKeyPress\"), kSawReturnAt = Symbol(\"_sawReturnAt\"), kSetRawMode = Symbol(\"_setRawMode\"), kTabComplete = Symbol(\"_tabComplete\"), kTabCompleter = Symbol(\"_tabCompleter\"), kTtyWrite = Symbol(\"_ttyWrite\"), kUndo = Symbol(\"_undo\"), kUndoStack = Symbol(\"_undoStack\"), kWordLeft = Symbol(\"_wordLeft\"), kWordRight = Symbol(\"_wordRight\"), kWriteToOutput = Symbol(\"_writeToOutput\"), kYank = Symbol(\"_yank\"), kYanking = Symbol(\"_yanking\"), kYankPop = Symbol(\"_yankPop\"), kFirstEventParam = Symbol(\"nodejs.kFirstEventParam\"), kOnSelfCloseWithTerminal = Symbol(\"_onSelfCloseWithTerminal\"), kOnSelfCloseWithoutTerminal = Symbol(\"_onSelfCloseWithoutTerminal\"), kOnKeyPress = Symbol(\"_onKeyPress\"), kOnError = Symbol(\"_onError\"), kOnData = Symbol(\"_onData\"), kOnEnd = Symbol(\"_onEnd\"), kOnTermEnd = Symbol(\"_onTermEnd\"), kOnResize = Symbol(\"_onResize\");\nInterfaceConstructor.prototype = {};\nObjectSetPrototypeOf(InterfaceConstructor.prototype, EventEmitter.prototype);\nvar _Interface = class Interface2 extends InterfaceConstructor {\n constructor(input, output, completer, terminal) {\n super(input, output, completer, terminal);\n }\n get columns() {\n var output = this.output;\n if (output && output.columns)\n return output.columns;\n return @Infinity;\n }\n setPrompt(prompt) {\n this[kPrompt] = prompt;\n }\n getPrompt() {\n return this[kPrompt];\n }\n [kSetRawMode](flag) {\n const mode = flag + 0, wasInRawMode = this.input.isRaw;\n var setRawMode = this.input.setRawMode;\n if (typeof setRawMode === \"function\")\n setRawMode.@call(this.input, mode);\n return wasInRawMode;\n }\n prompt(preserveCursor) {\n if (this.paused)\n this.resume();\n if (this.terminal) {\n if (!preserveCursor)\n this.cursor = 0;\n this[kRefreshLine]();\n } else\n this[kWriteToOutput](this[kPrompt]);\n }\n [kQuestion](query, cb) {\n if (this.closed)\n throw new ERR_USE_AFTER_CLOSE(\"readline\");\n if (this[kQuestionCallback])\n this.prompt();\n else\n this[kOldPrompt] = this[kPrompt], this.setPrompt(query), this[kQuestionCallback] = cb, this.prompt();\n }\n [kOnLine](line) {\n if (this[kQuestionCallback]) {\n var cb = this[kQuestionCallback];\n this[kQuestionCallback] = null, this.setPrompt(this[kOldPrompt]), cb(line);\n } else\n this.emit(\"line\", line);\n }\n [kBeforeEdit](oldText, oldCursor) {\n this[kPushToUndoStack](oldText, oldCursor);\n }\n [kQuestionCancel]() {\n if (this[kQuestionCallback])\n this[kQuestionCallback] = null, this.setPrompt(this[kOldPrompt]), this.clearLine();\n }\n [kWriteToOutput](stringToWrite) {\n if (validateString(stringToWrite, \"stringToWrite\"), this.output !== null && this.output !== @undefined)\n this.output.write(stringToWrite);\n }\n [kAddHistory]() {\n if (this.line.length === 0)\n return \"\";\n if (this.historySize === 0)\n return this.line;\n if (StringPrototypeTrim.@call(this.line).length === 0)\n return this.line;\n if (this.history.length === 0 || this.history[0] !== this.line) {\n if (this.removeHistoryDuplicates) {\n var dupIndex = ArrayPrototypeIndexOf.@call(this.history, this.line);\n if (dupIndex !== -1)\n ArrayPrototypeSplice.@call(this.history, dupIndex, 1);\n }\n if (ArrayPrototypeUnshift.@call(this.history, this.line), this.history.length > this.historySize)\n ArrayPrototypePop.@call(this.history);\n }\n this.historyIndex = -1;\n var line = this.history[0];\n return this.emit(\"history\", this.history), line;\n }\n [kRefreshLine]() {\n var line = this[kPrompt] + this.line, dispPos = this[kGetDisplayPos](line), lineCols = dispPos.cols, lineRows = dispPos.rows, cursorPos = this.getCursorPos(), prevRows = this.prevRows || 0;\n if (prevRows > 0)\n moveCursor(this.output, 0, -prevRows);\n if (cursorTo(this.output, 0), clearScreenDown(this.output), this[kWriteToOutput](line), lineCols === 0)\n this[kWriteToOutput](\" \");\n cursorTo(this.output, cursorPos.cols);\n var diff = lineRows - cursorPos.rows;\n if (diff > 0)\n moveCursor(this.output, 0, -diff);\n this.prevRows = cursorPos.rows;\n }\n close() {\n if (this.closed)\n return;\n if (this.pause(), this.terminal)\n this[kSetRawMode](!1);\n this.closed = !0, this.emit(\"close\");\n }\n pause() {\n if (this.paused)\n return;\n return this.input.pause(), this.paused = !0, this.emit(\"pause\"), this;\n }\n resume() {\n if (!this.paused)\n return;\n return this.input.resume(), this.paused = !1, this.emit(\"resume\"), this;\n }\n write(d, key) {\n if (this.paused)\n this.resume();\n if (this.terminal)\n this[kTtyWrite](d, key);\n else\n this[kNormalWrite](d);\n }\n [kNormalWrite](b) {\n if (b === @undefined)\n return;\n var string = this[kDecoder].write(b);\n if (this[kSawReturnAt] && DateNow() - this[kSawReturnAt] <= this.crlfDelay) {\n if (StringPrototypeCodePointAt.@call(string) === 10)\n string = StringPrototypeSlice.@call(string, 1);\n this[kSawReturnAt] = 0;\n }\n var newPartContainsEnding = RegExpPrototypeExec.@call(lineEnding, string);\n if (newPartContainsEnding !== null) {\n if (this[kLine_buffer])\n string = this[kLine_buffer] + string, this[kLine_buffer] = null, newPartContainsEnding = RegExpPrototypeExec.@call(lineEnding, string);\n this[kSawReturnAt] = StringPrototypeEndsWith.@call(string, \"\\r\") \? DateNow() : 0;\n var indexes = [0, newPartContainsEnding.index, lineEnding.lastIndex], nextMatch;\n while ((nextMatch = RegExpPrototypeExec.@call(lineEnding, string)) !== null)\n ArrayPrototypePush.@call(indexes, nextMatch.index, lineEnding.lastIndex);\n var lastIndex = indexes.length - 1;\n this[kLine_buffer] = StringPrototypeSlice.@call(string, indexes[lastIndex]);\n for (var i = 1;i < lastIndex; i += 2)\n this[kOnLine](StringPrototypeSlice.@call(string, indexes[i - 1], indexes[i]));\n } else if (string)\n if (this[kLine_buffer])\n this[kLine_buffer] += string;\n else\n this[kLine_buffer] = string;\n }\n [kInsertString](c) {\n if (this[kBeforeEdit](this.line, this.cursor), this.cursor < this.line.length) {\n var beg = StringPrototypeSlice.@call(this.line, 0, this.cursor), end = StringPrototypeSlice.@call(this.line, this.cursor, this.line.length);\n this.line = beg + c + end, this.cursor += c.length, this[kRefreshLine]();\n } else {\n var oldPos = this.getCursorPos();\n this.line += c, this.cursor += c.length;\n var newPos = this.getCursorPos();\n if (oldPos.rows < newPos.rows)\n this[kRefreshLine]();\n else\n this[kWriteToOutput](c);\n }\n }\n async[kTabComplete](lastKeypressWasTab) {\n this.pause();\n var string = StringPrototypeSlice.@call(this.line, 0, this.cursor), value;\n try {\n value = await this.completer(string);\n } catch (err) {\n this[kWriteToOutput](`Tab completion error: ${inspect(err)}`);\n return;\n } finally {\n this.resume();\n }\n this[kTabCompleter](lastKeypressWasTab, value);\n }\n [kTabCompleter](lastKeypressWasTab, { 0: completions, 1: completeOn }) {\n if (!completions || completions.length === 0)\n return;\n var prefix = commonPrefix(ArrayPrototypeFilter.@call(completions, (e) => e !== \"\"));\n if (StringPrototypeStartsWith.@call(prefix, completeOn) && prefix.length > completeOn.length) {\n this[kInsertString](StringPrototypeSlice.@call(prefix, completeOn.length));\n return;\n } else if (!StringPrototypeStartsWith.@call(completeOn, prefix)) {\n this.line = StringPrototypeSlice.@call(this.line, 0, this.cursor - completeOn.length) + prefix + StringPrototypeSlice.@call(this.line, this.cursor, this.line.length), this.cursor = this.cursor - completeOn.length + prefix.length, this._refreshLine();\n return;\n }\n if (!lastKeypressWasTab)\n return;\n this[kBeforeEdit](this.line, this.cursor);\n var completionsWidth = ArrayPrototypeMap.@call(completions, (e) => getStringWidth(e)), width = MathMax.@apply(completionsWidth) + 2, maxColumns = MathFloor(this.columns / width) || 1;\n if (maxColumns === @Infinity)\n maxColumns = 1;\n var output = \"\\r\\n\", lineIndex = 0, whitespace = 0;\n for (var i = 0;i < completions.length; i++) {\n var completion = completions[i];\n if (completion === \"\" || lineIndex === maxColumns)\n output += \"\\r\\n\", lineIndex = 0, whitespace = 0;\n else\n output += StringPrototypeRepeat.@call(\" \", whitespace);\n if (completion !== \"\")\n output += completion, whitespace = width - completionsWidth[i], lineIndex++;\n else\n output += \"\\r\\n\";\n }\n if (lineIndex !== 0)\n output += \"\\r\\n\\r\\n\";\n this[kWriteToOutput](output), this[kRefreshLine]();\n }\n [kWordLeft]() {\n if (this.cursor > 0) {\n var leading = StringPrototypeSlice.@call(this.line, 0, this.cursor), reversed = ArrayPrototypeJoin.@call(ArrayPrototypeReverse.@call(ArrayFrom(leading)), \"\"), match = RegExpPrototypeExec.@call(/^\\s*(\?:[^\\w\\s]+|\\w+)\?/, reversed);\n this[kMoveCursor](-match[0].length);\n }\n }\n [kWordRight]() {\n if (this.cursor < this.line.length) {\n var trailing = StringPrototypeSlice.@call(this.line, this.cursor), match = RegExpPrototypeExec.@call(/^(\?:\\s+|[^\\w\\s]+|\\w+)\\s*/, trailing);\n this[kMoveCursor](match[0].length);\n }\n }\n [kDeleteLeft]() {\n if (this.cursor > 0 && this.line.length > 0) {\n this[kBeforeEdit](this.line, this.cursor);\n var charSize = charLengthLeft(this.line, this.cursor);\n this.line = StringPrototypeSlice.@call(this.line, 0, this.cursor - charSize) + StringPrototypeSlice.@call(this.line, this.cursor, this.line.length), this.cursor -= charSize, this[kRefreshLine]();\n }\n }\n [kDeleteRight]() {\n if (this.cursor < this.line.length) {\n this[kBeforeEdit](this.line, this.cursor);\n var charSize = charLengthAt(this.line, this.cursor);\n this.line = StringPrototypeSlice.@call(this.line, 0, this.cursor) + StringPrototypeSlice.@call(this.line, this.cursor + charSize, this.line.length), this[kRefreshLine]();\n }\n }\n [kDeleteWordLeft]() {\n if (this.cursor > 0) {\n this[kBeforeEdit](this.line, this.cursor);\n var leading = StringPrototypeSlice.@call(this.line, 0, this.cursor), reversed = ArrayPrototypeJoin.@call(ArrayPrototypeReverse.@call(ArrayFrom(leading)), \"\"), match = RegExpPrototypeExec.@call(/^\\s*(\?:[^\\w\\s]+|\\w+)\?/, reversed);\n leading = StringPrototypeSlice.@call(leading, 0, leading.length - match[0].length), this.line = leading + StringPrototypeSlice.@call(this.line, this.cursor, this.line.length), this.cursor = leading.length, this[kRefreshLine]();\n }\n }\n [kDeleteWordRight]() {\n if (this.cursor < this.line.length) {\n this[kBeforeEdit](this.line, this.cursor);\n var trailing = StringPrototypeSlice.@call(this.line, this.cursor), match = RegExpPrototypeExec.@call(/^(\?:\\s+|\\W+|\\w+)\\s*/, trailing);\n this.line = StringPrototypeSlice.@call(this.line, 0, this.cursor) + StringPrototypeSlice.@call(trailing, match[0].length), this[kRefreshLine]();\n }\n }\n [kDeleteLineLeft]() {\n this[kBeforeEdit](this.line, this.cursor);\n var del = StringPrototypeSlice.@call(this.line, 0, this.cursor);\n this.line = StringPrototypeSlice.@call(this.line, this.cursor), this.cursor = 0, this[kPushToKillRing](del), this[kRefreshLine]();\n }\n [kDeleteLineRight]() {\n this[kBeforeEdit](this.line, this.cursor);\n var del = StringPrototypeSlice.@call(this.line, this.cursor);\n this.line = StringPrototypeSlice.@call(this.line, 0, this.cursor), this[kPushToKillRing](del), this[kRefreshLine]();\n }\n [kPushToKillRing](del) {\n if (!del || del === this[kKillRing][0])\n return;\n ArrayPrototypeUnshift.@call(this[kKillRing], del), this[kKillRingCursor] = 0;\n while (this[kKillRing].length > kMaxLengthOfKillRing)\n ArrayPrototypePop.@call(this[kKillRing]);\n }\n [kYank]() {\n if (this[kKillRing].length > 0)\n this[kYanking] = !0, this[kInsertString](this[kKillRing][this[kKillRingCursor]]);\n }\n [kYankPop]() {\n if (!this[kYanking])\n return;\n if (this[kKillRing].length > 1) {\n var lastYank = this[kKillRing][this[kKillRingCursor]];\n if (this[kKillRingCursor]++, this[kKillRingCursor] >= this[kKillRing].length)\n this[kKillRingCursor] = 0;\n var currentYank = this[kKillRing][this[kKillRingCursor]], head = StringPrototypeSlice.@call(this.line, 0, this.cursor - lastYank.length), tail = StringPrototypeSlice.@call(this.line, this.cursor);\n this.line = head + currentYank + tail, this.cursor = head.length + currentYank.length, this[kRefreshLine]();\n }\n }\n clearLine() {\n this[kMoveCursor](+@Infinity), this[kWriteToOutput](\"\\r\\n\"), this.line = \"\", this.cursor = 0, this.prevRows = 0;\n }\n [kLine]() {\n var line = this[kAddHistory]();\n this[kUndoStack] = [], this[kRedoStack] = [], this.clearLine(), this[kOnLine](line);\n }\n [kPushToUndoStack](text, cursor) {\n if (ArrayPrototypePush.@call(this[kUndoStack], { text, cursor }) > kMaxUndoRedoStackSize)\n ArrayPrototypeShift.@call(this[kUndoStack]);\n }\n [kUndo]() {\n if (this[kUndoStack].length <= 0)\n return;\n ArrayPrototypePush.@call(this[kRedoStack], {\n text: this.line,\n cursor: this.cursor\n });\n var entry = ArrayPrototypePop.@call(this[kUndoStack]);\n this.line = entry.text, this.cursor = entry.cursor, this[kRefreshLine]();\n }\n [kRedo]() {\n if (this[kRedoStack].length <= 0)\n return;\n ArrayPrototypePush.@call(this[kUndoStack], {\n text: this.line,\n cursor: this.cursor\n });\n var entry = ArrayPrototypePop.@call(this[kRedoStack]);\n this.line = entry.text, this.cursor = entry.cursor, this[kRefreshLine]();\n }\n [kHistoryNext]() {\n if (this.historyIndex >= 0) {\n this[kBeforeEdit](this.line, this.cursor);\n var search = this[kSubstringSearch] || \"\", index = this.historyIndex - 1;\n while (index >= 0 && (!StringPrototypeStartsWith.@call(this.history[index], search) || this.line === this.history[index]))\n index--;\n if (index === -1)\n this.line = search;\n else\n this.line = this.history[index];\n this.historyIndex = index, this.cursor = this.line.length, this[kRefreshLine]();\n }\n }\n [kHistoryPrev]() {\n if (this.historyIndex < this.history.length && this.history.length) {\n this[kBeforeEdit](this.line, this.cursor);\n var search = this[kSubstringSearch] || \"\", index = this.historyIndex + 1;\n while (index < this.history.length && (!StringPrototypeStartsWith.@call(this.history[index], search) || this.line === this.history[index]))\n index++;\n if (index === this.history.length)\n this.line = search;\n else\n this.line = this.history[index];\n this.historyIndex = index, this.cursor = this.line.length, this[kRefreshLine]();\n }\n }\n [kGetDisplayPos](str) {\n var offset = 0, col = this.columns, rows = 0;\n str = stripVTControlCharacters(str);\n for (var char of new SafeStringIterator(str)) {\n if (char === \"\\n\") {\n rows += MathCeil(offset / col) || 1, offset = 0;\n continue;\n }\n if (char === \"\\t\") {\n offset += this.tabSize - offset % this.tabSize;\n continue;\n }\n var width = getStringWidth(char, !1);\n if (width === 0 || width === 1)\n offset += width;\n else {\n if ((offset + 1) % col === 0)\n offset++;\n offset += 2;\n }\n }\n var cols = offset % col;\n return rows += (offset - cols) / col, { cols, rows };\n }\n getCursorPos() {\n var strBeforeCursor = this[kPrompt] + StringPrototypeSlice.@call(this.line, 0, this.cursor);\n return this[kGetDisplayPos](strBeforeCursor);\n }\n [kMoveCursor](dx) {\n if (dx === 0)\n return;\n var oldPos = this.getCursorPos();\n if (this.cursor += dx, this.cursor < 0)\n this.cursor = 0;\n else if (this.cursor > this.line.length)\n this.cursor = this.line.length;\n var newPos = this.getCursorPos();\n if (oldPos.rows === newPos.rows) {\n var diffWidth = newPos.cols - oldPos.cols;\n moveCursor(this.output, diffWidth, 0);\n } else\n this[kRefreshLine]();\n }\n [kTtyWrite](s, key) {\n var previousKey = this[kPreviousKey];\n key = key || kEmptyObject, this[kPreviousKey] = key;\n var { name: keyName, meta: keyMeta, ctrl: keyCtrl2, shift: keyShift, sequence: keySeq } = key;\n if (!keyMeta || keyName !== \"y\")\n this[kYanking] = !1;\n if ((keyName === \"up\" || keyName === \"down\") && !keyCtrl2 && !keyMeta && !keyShift) {\n if (this[kSubstringSearch] === null)\n this[kSubstringSearch] = StringPrototypeSlice.@call(this.line, 0, this.cursor);\n } else if (this[kSubstringSearch] !== null) {\n if (this[kSubstringSearch] = null, this.history.length === this.historyIndex)\n this.historyIndex = -1;\n }\n if (typeof keySeq === \"string\")\n switch (StringPrototypeCodePointAt.@call(keySeq, 0)) {\n case 31:\n this[kUndo]();\n return;\n case 30:\n this[kRedo]();\n return;\n default:\n break;\n }\n if (keyName === \"escape\")\n return;\n if (keyCtrl2 && keyShift)\n switch (keyName) {\n case \"backspace\":\n this[kDeleteLineLeft]();\n break;\n case \"delete\":\n this[kDeleteLineRight]();\n break;\n }\n else if (keyCtrl2)\n switch (keyName) {\n case \"c\":\n if (this.listenerCount(\"SIGINT\") > 0)\n this.emit(\"SIGINT\");\n else\n this.close();\n break;\n case \"h\":\n this[kDeleteLeft]();\n break;\n case \"d\":\n if (this.cursor === 0 && this.line.length === 0)\n this.close();\n else if (this.cursor < this.line.length)\n this[kDeleteRight]();\n break;\n case \"u\":\n this[kDeleteLineLeft]();\n break;\n case \"k\":\n this[kDeleteLineRight]();\n break;\n case \"a\":\n this[kMoveCursor](-@Infinity);\n break;\n case \"e\":\n this[kMoveCursor](+@Infinity);\n break;\n case \"b\":\n this[kMoveCursor](-charLengthLeft(this.line, this.cursor));\n break;\n case \"f\":\n this[kMoveCursor](+charLengthAt(this.line, this.cursor));\n break;\n case \"l\":\n cursorTo(this.output, 0, 0), clearScreenDown(this.output), this[kRefreshLine]();\n break;\n case \"n\":\n this[kHistoryNext]();\n break;\n case \"p\":\n this[kHistoryPrev]();\n break;\n case \"y\":\n this[kYank]();\n break;\n case \"z\":\n if (this.listenerCount(\"SIGTSTP\") > 0)\n this.emit(\"SIGTSTP\");\n else\n process.once(\"SIGCONT\", () => {\n if (!this.paused)\n this.pause(), this.emit(\"SIGCONT\");\n this[kSetRawMode](!0), this[kRefreshLine]();\n }), this[kSetRawMode](!1), process.kill(process.pid, \"SIGTSTP\");\n break;\n case \"w\":\n case \"backspace\":\n this[kDeleteWordLeft]();\n break;\n case \"delete\":\n this[kDeleteWordRight]();\n break;\n case \"left\":\n this[kWordLeft]();\n break;\n case \"right\":\n this[kWordRight]();\n break;\n }\n else if (keyMeta)\n switch (keyName) {\n case \"b\":\n this[kWordLeft]();\n break;\n case \"f\":\n this[kWordRight]();\n break;\n case \"d\":\n case \"delete\":\n this[kDeleteWordRight]();\n break;\n case \"backspace\":\n this[kDeleteWordLeft]();\n break;\n case \"y\":\n this[kYankPop]();\n break;\n }\n else {\n if (this[kSawReturnAt] && keyName !== \"enter\")\n this[kSawReturnAt] = 0;\n switch (keyName) {\n case \"return\":\n this[kSawReturnAt] = DateNow(), this[kLine]();\n break;\n case \"enter\":\n if (this[kSawReturnAt] === 0 || DateNow() - this[kSawReturnAt] > this.crlfDelay)\n this[kLine]();\n this[kSawReturnAt] = 0;\n break;\n case \"backspace\":\n this[kDeleteLeft]();\n break;\n case \"delete\":\n this[kDeleteRight]();\n break;\n case \"left\":\n this[kMoveCursor](-charLengthLeft(this.line, this.cursor));\n break;\n case \"right\":\n this[kMoveCursor](+charLengthAt(this.line, this.cursor));\n break;\n case \"home\":\n this[kMoveCursor](-@Infinity);\n break;\n case \"end\":\n this[kMoveCursor](+@Infinity);\n break;\n case \"up\":\n this[kHistoryPrev]();\n break;\n case \"down\":\n this[kHistoryNext]();\n break;\n case \"tab\":\n if (typeof this.completer === \"function\" && this.isCompletionEnabled) {\n var lastKeypressWasTab = previousKey && previousKey.name === \"tab\";\n this[kTabComplete](lastKeypressWasTab);\n break;\n }\n default:\n if (typeof s === \"string\" && s) {\n var nextMatch = RegExpPrototypeExec.@call(lineEnding, s);\n if (nextMatch !== null) {\n this[kInsertString](StringPrototypeSlice.@call(s, 0, nextMatch.index));\n var { lastIndex } = lineEnding;\n while ((nextMatch = RegExpPrototypeExec.@call(lineEnding, s)) !== null)\n this[kLine](), this[kInsertString](StringPrototypeSlice.@call(s, lastIndex, nextMatch.index)), { lastIndex } = lineEnding;\n if (lastIndex === s.length)\n this[kLine]();\n } else\n this[kInsertString](s);\n }\n }\n }\n }\n [SymbolAsyncIterator]() {\n if (this[kLineObjectStream] === @undefined)\n this[kLineObjectStream] = EventEmitter.on(this, \"line\", {\n close: [\"close\"],\n highWatermark: 1024,\n [kFirstEventParam]: !0\n });\n return this[kLineObjectStream];\n }\n};\nInterface.prototype = {};\nObjectSetPrototypeOf(Interface.prototype, _Interface.prototype);\nObjectSetPrototypeOf(Interface, _Interface);\nInterface.prototype.question = function question(query, options, cb) {\n if (cb = typeof options === \"function\" \? options : cb, options === null || typeof options !== \"object\")\n options = kEmptyObject;\n var signal = options\?.signal;\n if (signal) {\n if (validateAbortSignal(signal, \"options.signal\"), signal.aborted)\n return;\n var onAbort = () => {\n this[kQuestionCancel]();\n };\n signal.addEventListener(\"abort\", onAbort, { once: !0 });\n var cleanup = () => {\n signal.removeEventListener(\"abort\", onAbort);\n }, originalCb = cb;\n cb = typeof cb === \"function\" \? (answer) => {\n return cleanup(), originalCb(answer);\n } : cleanup;\n }\n if (typeof cb === \"function\")\n this[kQuestion](query, cb);\n};\nInterface.prototype.question[promisify.custom] = function question2(query, options) {\n if (options === null || typeof options !== \"object\")\n options = kEmptyObject;\n var signal = options\?.signal;\n if (signal && signal.aborted)\n return PromiseReject(new AbortError(@undefined, { cause: signal.reason }));\n return new @Promise((resolve, reject) => {\n var cb = resolve;\n if (signal) {\n var onAbort = () => {\n reject(new AbortError(@undefined, { cause: signal.reason }));\n };\n signal.addEventListener(\"abort\", onAbort, { once: !0 }), cb = (answer) => {\n signal.removeEventListener(\"abort\", onAbort), resolve(answer);\n };\n }\n this.question(query, options, cb);\n });\n};\nObjectDefineProperties(Interface.prototype, {\n [kSetRawMode]: {\n __proto__: null,\n get() {\n return this._setRawMode;\n }\n },\n [kOnLine]: {\n __proto__: null,\n get() {\n return this._onLine;\n }\n },\n [kWriteToOutput]: {\n __proto__: null,\n get() {\n return this._writeToOutput;\n }\n },\n [kAddHistory]: {\n __proto__: null,\n get() {\n return this._addHistory;\n }\n },\n [kRefreshLine]: {\n __proto__: null,\n get() {\n return this._refreshLine;\n }\n },\n [kNormalWrite]: {\n __proto__: null,\n get() {\n return this._normalWrite;\n }\n },\n [kInsertString]: {\n __proto__: null,\n get() {\n return this._insertString;\n }\n },\n [kTabComplete]: {\n __proto__: null,\n get() {\n return this._tabComplete;\n }\n },\n [kWordLeft]: {\n __proto__: null,\n get() {\n return this._wordLeft;\n }\n },\n [kWordRight]: {\n __proto__: null,\n get() {\n return this._wordRight;\n }\n },\n [kDeleteLeft]: {\n __proto__: null,\n get() {\n return this._deleteLeft;\n }\n },\n [kDeleteRight]: {\n __proto__: null,\n get() {\n return this._deleteRight;\n }\n },\n [kDeleteWordLeft]: {\n __proto__: null,\n get() {\n return this._deleteWordLeft;\n }\n },\n [kDeleteWordRight]: {\n __proto__: null,\n get() {\n return this._deleteWordRight;\n }\n },\n [kDeleteLineLeft]: {\n __proto__: null,\n get() {\n return this._deleteLineLeft;\n }\n },\n [kDeleteLineRight]: {\n __proto__: null,\n get() {\n return this._deleteLineRight;\n }\n },\n [kLine]: {\n __proto__: null,\n get() {\n return this._line;\n }\n },\n [kHistoryNext]: {\n __proto__: null,\n get() {\n return this._historyNext;\n }\n },\n [kHistoryPrev]: {\n __proto__: null,\n get() {\n return this._historyPrev;\n }\n },\n [kGetDisplayPos]: {\n __proto__: null,\n get() {\n return this._getDisplayPos;\n }\n },\n [kMoveCursor]: {\n __proto__: null,\n get() {\n return this._moveCursor;\n }\n },\n [kTtyWrite]: {\n __proto__: null,\n get() {\n return this._ttyWrite;\n }\n },\n _decoder: {\n __proto__: null,\n get() {\n return this[kDecoder];\n },\n set(value) {\n this[kDecoder] = value;\n }\n },\n _line_buffer: {\n __proto__: null,\n get() {\n return this[kLine_buffer];\n },\n set(value) {\n this[kLine_buffer] = value;\n }\n },\n _oldPrompt: {\n __proto__: null,\n get() {\n return this[kOldPrompt];\n },\n set(value) {\n this[kOldPrompt] = value;\n }\n },\n _previousKey: {\n __proto__: null,\n get() {\n return this[kPreviousKey];\n },\n set(value) {\n this[kPreviousKey] = value;\n }\n },\n _prompt: {\n __proto__: null,\n get() {\n return this[kPrompt];\n },\n set(value) {\n this[kPrompt] = value;\n }\n },\n _questionCallback: {\n __proto__: null,\n get() {\n return this[kQuestionCallback];\n },\n set(value) {\n this[kQuestionCallback] = value;\n }\n },\n _sawKeyPress: {\n __proto__: null,\n get() {\n return this[kSawKeyPress];\n },\n set(value) {\n this[kSawKeyPress] = value;\n }\n },\n _sawReturnAt: {\n __proto__: null,\n get() {\n return this[kSawReturnAt];\n },\n set(value) {\n this[kSawReturnAt] = value;\n }\n }\n});\nInterface.prototype._setRawMode = _Interface.prototype[kSetRawMode];\nInterface.prototype._onLine = _Interface.prototype[kOnLine];\nInterface.prototype._writeToOutput = _Interface.prototype[kWriteToOutput];\nInterface.prototype._addHistory = _Interface.prototype[kAddHistory];\nInterface.prototype._refreshLine = _Interface.prototype[kRefreshLine];\nInterface.prototype._normalWrite = _Interface.prototype[kNormalWrite];\nInterface.prototype._insertString = _Interface.prototype[kInsertString];\nInterface.prototype._tabComplete = function(lastKeypressWasTab) {\n this.pause();\n var string = StringPrototypeSlice.@call(this.line, 0, this.cursor);\n this.completer(string, (err, value) => {\n if (this.resume(), err) {\n this._writeToOutput(`Tab completion error: ${inspect(err)}`);\n return;\n }\n this[kTabCompleter](lastKeypressWasTab, value);\n });\n};\nInterface.prototype._wordLeft = _Interface.prototype[kWordLeft];\nInterface.prototype._wordRight = _Interface.prototype[kWordRight];\nInterface.prototype._deleteLeft = _Interface.prototype[kDeleteLeft];\nInterface.prototype._deleteRight = _Interface.prototype[kDeleteRight];\nInterface.prototype._deleteWordLeft = _Interface.prototype[kDeleteWordLeft];\nInterface.prototype._deleteWordRight = _Interface.prototype[kDeleteWordRight];\nInterface.prototype._deleteLineLeft = _Interface.prototype[kDeleteLineLeft];\nInterface.prototype._deleteLineRight = _Interface.prototype[kDeleteLineRight];\nInterface.prototype._line = _Interface.prototype[kLine];\nInterface.prototype._historyNext = _Interface.prototype[kHistoryNext];\nInterface.prototype._historyPrev = _Interface.prototype[kHistoryPrev];\nInterface.prototype._getDisplayPos = _Interface.prototype[kGetDisplayPos];\nInterface.prototype._getCursorPos = _Interface.prototype.getCursorPos;\nInterface.prototype._moveCursor = _Interface.prototype[kMoveCursor];\nInterface.prototype._ttyWrite = _Interface.prototype[kTtyWrite];\n\nclass Readline {\n #autoCommit = !1;\n #stream;\n #todo = [];\n constructor(stream, options = @undefined) {\n if (isWritable \?\?= (@getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39)).isWritable, !isWritable(stream))\n throw new ERR_INVALID_ARG_TYPE(\"stream\", \"Writable\", stream);\n if (this.#stream = stream, options\?.autoCommit != null)\n validateBoolean(options.autoCommit, \"options.autoCommit\"), this.#autoCommit = options.autoCommit;\n }\n cursorTo(x, y = @undefined) {\n if (validateInteger(x, \"x\"), y != null)\n validateInteger(y, \"y\");\n var data = y == null \? CSI`${x + 1}G` : CSI`${y + 1};${x + 1}H`;\n if (this.#autoCommit)\n process.nextTick(() => this.#stream.write(data));\n else\n ArrayPrototypePush.@call(this.#todo, data);\n return this;\n }\n moveCursor(dx, dy) {\n if (dx || dy) {\n validateInteger(dx, \"dx\"), validateInteger(dy, \"dy\");\n var data = \"\";\n if (dx < 0)\n data += CSI`${-dx}D`;\n else if (dx > 0)\n data += CSI`${dx}C`;\n if (dy < 0)\n data += CSI`${-dy}A`;\n else if (dy > 0)\n data += CSI`${dy}B`;\n if (this.#autoCommit)\n process.nextTick(() => this.#stream.write(data));\n else\n ArrayPrototypePush.@call(this.#todo, data);\n }\n return this;\n }\n clearLine(dir) {\n validateInteger(dir, \"dir\", -1, 1);\n var data = dir < 0 \? kClearToLineBeginning : dir > 0 \? kClearToLineEnd : kClearLine;\n if (this.#autoCommit)\n process.nextTick(() => this.#stream.write(data));\n else\n ArrayPrototypePush.@call(this.#todo, data);\n return this;\n }\n clearScreenDown() {\n if (this.#autoCommit)\n process.nextTick(() => this.#stream.write(kClearScreenDown));\n else\n ArrayPrototypePush.@call(this.#todo, kClearScreenDown);\n return this;\n }\n commit() {\n return new @Promise((resolve) => {\n this.#stream.write(ArrayPrototypeJoin.@call(this.#todo, \"\"), resolve), this.#todo = [];\n });\n }\n rollback() {\n return this.#todo = [], this;\n }\n}\nvar PromisesInterface = class Interface3 extends _Interface {\n constructor(input, output, completer, terminal) {\n super(input, output, completer, terminal);\n }\n question(query, options = kEmptyObject) {\n var signal = options\?.signal;\n if (signal) {\n if (validateAbortSignal(signal, \"options.signal\"), signal.aborted)\n return PromiseReject(new AbortError(@undefined, { cause: signal.reason }));\n }\n return new @Promise((resolve, reject) => {\n var cb = resolve;\n if (options\?.signal) {\n var onAbort = () => {\n this[kQuestionCancel](), reject(new AbortError(@undefined, { cause: signal.reason }));\n };\n signal.addEventListener(\"abort\", onAbort, { once: !0 }), cb = (answer) => {\n signal.removeEventListener(\"abort\", onAbort), resolve(answer);\n };\n }\n this[kQuestion](query, cb);\n });\n }\n};\n$ = {\n Interface,\n clearLine,\n clearScreenDown,\n createInterface,\n cursorTo,\n emitKeypressEvents,\n moveCursor,\n promises: {\n Readline,\n Interface: PromisesInterface,\n createInterface(input, output, completer, terminal) {\n return new PromisesInterface(input, output, completer, terminal);\n }\n },\n [SymbolFor(\"__BUN_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED__\")]: {\n CSI,\n utils: {\n getStringWidth,\n stripVTControlCharacters\n }\n }\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeReadlinePromisesCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/readline.promises.ts\nreturn (@getInternalField(@internalModuleRegistry, 35) || @createInternalModuleById(35)).promises})\n"); -// - -// -static constexpr ASCIILiteral NodeReplCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/repl.ts\nvar $, { throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6);\n$ = {\n lines: [],\n context: globalThis,\n historyIndex: -1,\n cursor: 0,\n historySize: 1000,\n removeHistoryDuplicates: !1,\n crlfDelay: 100,\n completer: () => {\n throwNotImplemented(\"node:repl\");\n },\n history: [],\n _initialPrompt: \"> \",\n terminal: !0,\n input: new Proxy({}, {\n get() {\n throwNotImplemented(\"node:repl\");\n },\n has: () => !1,\n ownKeys: () => [],\n getOwnPropertyDescriptor: () => @undefined,\n set() {\n throwNotImplemented(\"node:repl\");\n }\n }),\n line: \"\",\n eval: () => {\n throwNotImplemented(\"node:repl\");\n },\n isCompletionEnabled: !0,\n escapeCodeTimeout: 500,\n tabSize: 8,\n breakEvalOnSigint: !0,\n useGlobal: !0,\n underscoreAssigned: !1,\n last: @undefined,\n _domain: @undefined,\n allowBlockingCompletions: !1,\n useColors: !0,\n output: new Proxy({}, {\n get() {\n throwNotImplemented(\"node:repl\");\n },\n has: () => !1,\n ownKeys: () => [],\n getOwnPropertyDescriptor: () => @undefined,\n set() {\n throwNotImplemented(\"node:repl\");\n }\n }),\n _builtinLibs: [\n \"bun\",\n \"ffi\",\n \"assert\",\n \"assert/strict\",\n \"async_hooks\",\n \"buffer\",\n \"child_process\",\n \"cluster\",\n \"console\",\n \"constants\",\n \"crypto\",\n \"dgram\",\n \"diagnostics_channel\",\n \"dns\",\n \"dns/promises\",\n \"domain\",\n \"events\",\n \"fs\",\n \"fs/promises\",\n \"http\",\n \"http2\",\n \"https\",\n \"inspector\",\n \"inspector/promises\",\n \"module\",\n \"net\",\n \"os\",\n \"path\",\n \"path/posix\",\n \"path/win32\",\n \"perf_hooks\",\n \"process\",\n \"punycode\",\n \"querystring\",\n \"readline\",\n \"readline/promises\",\n \"repl\",\n \"stream\",\n \"stream/consumers\",\n \"stream/promises\",\n \"stream/web\",\n \"string_decoder\",\n \"sys\",\n \"timers\",\n \"timers/promises\",\n \"tls\",\n \"trace_events\",\n \"tty\",\n \"url\",\n \"util\",\n \"util/types\",\n \"v8\",\n \"vm\",\n \"wasi\",\n \"worker_threads\",\n \"zlib\"\n ]\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeStreamConsumersCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/stream.consumers.ts\nvar $, arrayBuffer = Bun.readableStreamToArrayBuffer, text = Bun.readableStreamToText, json = (stream) => Bun.readableStreamToText(stream).then(JSON.parse), buffer = async (readableStream) => {\n return new @Buffer(await arrayBuffer(readableStream));\n}, blob = Bun.readableStreamToBlob;\n$ = {\n arrayBuffer,\n text,\n json,\n buffer,\n blob\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeStreamCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/stream.ts\nvar isReadableStream = function(value) {\n return typeof value === \"object\" && value !== null && value instanceof @ReadableStream;\n}, validateBoolean = function(value, name) {\n if (typeof value !== \"boolean\")\n throw new ERR_INVALID_ARG_TYPE(name, \"boolean\", value);\n};\nvar ERR_INVALID_ARG_TYPE = function(name, type, value) {\n return new Error(`The argument '${name}' is invalid. Received '${value}' for type '${type}'`);\n}, ERR_INVALID_ARG_VALUE = function(name, value, reason) {\n return new Error(`The value '${value}' is invalid for argument '${name}'. Reason: ${reason}`);\n}, createNativeStreamReadable = function(nativeType, Readable) {\n var [pull, start, cancel, setClose, deinit, updateRef, drainFn] = @lazy(nativeType), closer = [!1], handleNumberResult = function(nativeReadable, result, view, isClosed) {\n if (result > 0) {\n const slice = view.subarray(0, result), remainder = view.subarray(result);\n if (slice.byteLength > 0)\n nativeReadable.push(slice);\n if (isClosed)\n nativeReadable.push(null);\n return remainder.byteLength > 0 \? remainder : @undefined;\n }\n if (isClosed)\n nativeReadable.push(null);\n return view;\n }, handleArrayBufferViewResult = function(nativeReadable, result, view, isClosed) {\n if (result.byteLength > 0)\n nativeReadable.push(result);\n if (isClosed)\n nativeReadable.push(null);\n return view;\n }, DYNAMICALLY_ADJUST_CHUNK_SIZE = process.env.BUN_DISABLE_DYNAMIC_CHUNK_SIZE !== \"1\";\n const finalizer = new FinalizationRegistry((ptr) => ptr && deinit(ptr)), MIN_BUFFER_SIZE = 512;\n var NativeReadable = class NativeReadable2 extends Readable {\n #bunNativePtr;\n #refCount = 1;\n #constructed = !1;\n #remainingChunk = @undefined;\n #highWaterMark;\n #pendingRead = !1;\n #hasResized = !DYNAMICALLY_ADJUST_CHUNK_SIZE;\n #unregisterToken;\n constructor(ptr, options = {}) {\n super(options);\n if (typeof options.highWaterMark === \"number\")\n this.#highWaterMark = options.highWaterMark;\n else\n this.#highWaterMark = 262144;\n this.#bunNativePtr = ptr, this.#constructed = !1, this.#remainingChunk = @undefined, this.#pendingRead = !1, this.#unregisterToken = {}, finalizer.register(this, this.#bunNativePtr, this.#unregisterToken);\n }\n _read(maxToRead) {\n if (this.#pendingRead)\n return;\n var ptr = this.#bunNativePtr;\n if (ptr === 0) {\n this.push(null);\n return;\n }\n if (!this.#constructed)\n this.#internalConstruct(ptr);\n return this.#internalRead(this.#getRemainingChunk(maxToRead), ptr);\n }\n #internalConstruct(ptr) {\n this.#constructed = !0;\n const result = start(ptr, this.#highWaterMark);\n if (typeof result === \"number\" && result > 1)\n this.#hasResized = !0, this.#highWaterMark = Math.min(this.#highWaterMark, result);\n if (drainFn) {\n const drainResult = drainFn(ptr);\n if ((drainResult\?.byteLength \?\? 0) > 0)\n this.push(drainResult);\n }\n }\n #getRemainingChunk(maxToRead = this.#highWaterMark) {\n var chunk = this.#remainingChunk;\n if (chunk\?.byteLength \?\? 0 < MIN_BUFFER_SIZE) {\n var size = maxToRead > MIN_BUFFER_SIZE \? maxToRead : MIN_BUFFER_SIZE;\n this.#remainingChunk = chunk = new @Buffer(size);\n }\n return chunk;\n }\n #handleResult(result, view, isClosed) {\n if (typeof result === \"number\") {\n if (result >= this.#highWaterMark && !this.#hasResized && !isClosed)\n this.#highWaterMark *= 2, this.#hasResized = !0;\n return handleNumberResult(this, result, view, isClosed);\n } else if (typeof result === \"boolean\")\n return process.nextTick(() => {\n this.push(null);\n }), view\?.byteLength \?\? 0 > 0 \? view : @undefined;\n else if (@ArrayBuffer.isView(result)) {\n if (result.byteLength >= this.#highWaterMark && !this.#hasResized && !isClosed)\n this.#highWaterMark *= 2, this.#hasResized = !0;\n return handleArrayBufferViewResult(this, result, view, isClosed);\n } else\n throw new Error(\"Invalid result from pull\");\n }\n #internalRead(view, ptr) {\n closer[0] = !1;\n var result = pull(ptr, view, closer);\n if (@isPromise(result))\n return this.#pendingRead = !0, result.then((result2) => {\n this.#pendingRead = !1, this.#remainingChunk = this.#handleResult(result2, view, closer[0]);\n }, (reason) => {\n errorOrDestroy(this, reason);\n });\n else\n this.#remainingChunk = this.#handleResult(result, view, closer[0]);\n }\n _destroy(error, callback) {\n var ptr = this.#bunNativePtr;\n if (ptr === 0) {\n callback(error);\n return;\n }\n if (finalizer.unregister(this.#unregisterToken), this.#bunNativePtr = 0, updateRef)\n updateRef(ptr, !1);\n cancel(ptr, error), callback(error);\n }\n ref() {\n var ptr = this.#bunNativePtr;\n if (ptr === 0)\n return;\n if (this.#refCount++ === 0)\n updateRef(ptr, !0);\n }\n unref() {\n var ptr = this.#bunNativePtr;\n if (ptr === 0)\n return;\n if (this.#refCount-- === 1)\n updateRef(ptr, !1);\n }\n };\n if (!updateRef)\n NativeReadable.prototype.ref = @undefined, NativeReadable.prototype.unref = @undefined;\n return NativeReadable;\n}, getNativeReadableStreamPrototype = function(nativeType, Readable) {\n return nativeReadableStreamPrototypes[nativeType] ||= createNativeStreamReadable(nativeType, Readable);\n}, getNativeReadableStream = function(Readable, stream, options) {\n if (!(stream && typeof stream === \"object\" && stream instanceof @ReadableStream))\n return @undefined;\n const native = @direct(stream);\n if (!native)\n return @undefined;\n const { stream: ptr, data: type } = native;\n return new (getNativeReadableStreamPrototype(type, Readable))(ptr, options);\n}, NativeWritable = function(pathOrFdOrSink, options = {}) {\n Writable.@call(this, options), this[_native] = !0, this._construct = NativeWritable_internalConstruct, this._destroy = NativeWritable_internalDestroy, this._final = NativeWritable_internalFinal, this[_pathOrFdOrSink] = pathOrFdOrSink;\n}, NativeWritable_internalConstruct = function(cb) {\n if (this._writableState.constructed = !0, this.constructed = !0, typeof cb === \"function\")\n cb();\n process.nextTick(() => {\n this.emit(\"open\", this.fd), this.emit(\"ready\");\n });\n}, NativeWritable_lazyConstruct = function(stream) {\n var sink = stream[_pathOrFdOrSink];\n if (typeof sink === \"object\")\n if (typeof sink.write === \"function\")\n return stream[_fileSink] = sink;\n else\n throw new Error(\"Invalid FileSink\");\n else\n return stream[_fileSink] = Bun.file(sink).writer();\n}, NativeWritable_internalDestroy = function(error, cb) {\n const w = this._writableState, r = this._readableState;\n if (w)\n w.destroyed = !0, w.closeEmitted = !0;\n if (r)\n r.destroyed = !0, r.closeEmitted = !0;\n if (typeof cb === \"function\")\n cb(error);\n if (w\?.closeEmitted || r\?.closeEmitted)\n this.emit(\"close\");\n}, NativeWritable_internalFinal = function(cb) {\n var sink = this[_fileSink];\n if (sink)\n sink.end();\n if (cb)\n cb();\n}, EE = @lazy(\"events\"), StringDecoder = @requireNativeModule(\"string_decoder\").StringDecoder, __getOwnPropNames = Object.getOwnPropertyNames, __commonJS = (cb, mod) => function __require2() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n}, runOnNextTick = process.nextTick;\nvar ArrayIsArray = @Array.isArray, require_primordials = __commonJS({\n \"node_modules/readable-stream/lib/ours/primordials.js\"(exports, module) {\n module.exports = {\n ArrayIsArray(self) {\n return @Array.isArray(self);\n },\n ArrayPrototypeIncludes(self, el) {\n return self.includes(el);\n },\n ArrayPrototypeIndexOf(self, el) {\n return self.indexOf(el);\n },\n ArrayPrototypeJoin(self, sep) {\n return self.join(sep);\n },\n ArrayPrototypeMap(self, fn) {\n return self.map(fn);\n },\n ArrayPrototypePop(self, el) {\n return self.pop(el);\n },\n ArrayPrototypePush(self, el) {\n return self.push(el);\n },\n ArrayPrototypeSlice(self, start, end) {\n return self.slice(start, end);\n },\n Error,\n FunctionPrototypeCall(fn, thisArgs, ...args) {\n return fn.@call(thisArgs, ...args);\n },\n FunctionPrototypeSymbolHasInstance(self, instance) {\n return Function.prototype[Symbol.hasInstance].@call(self, instance);\n },\n MathFloor: Math.floor,\n Number,\n NumberIsInteger: Number.isInteger,\n NumberIsNaN: Number.isNaN,\n NumberMAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER,\n NumberMIN_SAFE_INTEGER: Number.MIN_SAFE_INTEGER,\n NumberParseInt: Number.parseInt,\n ObjectDefineProperties(self, props) {\n return Object.defineProperties(self, props);\n },\n ObjectDefineProperty(self, name, prop) {\n return Object.defineProperty(self, name, prop);\n },\n ObjectGetOwnPropertyDescriptor(self, name) {\n return Object.getOwnPropertyDescriptor(self, name);\n },\n ObjectKeys(obj) {\n return Object.keys(obj);\n },\n ObjectSetPrototypeOf(target, proto) {\n return Object.setPrototypeOf(target, proto);\n },\n Promise: @Promise,\n PromisePrototypeCatch(self, fn) {\n return self.catch(fn);\n },\n PromisePrototypeThen(self, thenFn, catchFn) {\n return self.then(thenFn, catchFn);\n },\n PromiseReject(err) {\n return @Promise.reject(err);\n },\n ReflectApply: @getByIdDirect(Reflect, \"apply\"),\n RegExpPrototypeTest(self, value) {\n return self.test(value);\n },\n SafeSet: Set,\n String: @String,\n StringPrototypeSlice(self, start, end) {\n return self.slice(start, end);\n },\n StringPrototypeToLowerCase(self) {\n return self.toLowerCase();\n },\n StringPrototypeToUpperCase(self) {\n return self.toUpperCase();\n },\n StringPrototypeTrim(self) {\n return self.trim();\n },\n Symbol,\n SymbolAsyncIterator: Symbol.asyncIterator,\n SymbolHasInstance: Symbol.hasInstance,\n SymbolIterator: Symbol.iterator,\n TypedArrayPrototypeSet(self, buf, len) {\n return self.set(buf, len);\n },\n Uint8Array: @Uint8Array\n };\n }\n}), require_util = __commonJS({\n \"node_modules/readable-stream/lib/ours/util.js\"(exports, module) {\n var AsyncFunction = Object.getPrototypeOf(async function() {\n }).constructor, isBlob = typeof Blob !== \"undefined\" \? function isBlob2(b) {\n return b instanceof Blob;\n } : function isBlob2(b) {\n return !1;\n }, AggregateError = class extends Error {\n constructor(errors) {\n if (!@Array.isArray(errors))\n @throwTypeError(`Expected input to be an Array, got ${typeof errors}`);\n let message = \"\";\n for (let i = 0;i < errors.length; i++)\n message += ` ${errors[i].stack}\n`;\n super(message);\n this.name = \"AggregateError\", this.errors = errors;\n }\n };\n module.exports = {\n AggregateError,\n once(callback) {\n let called = !1;\n return function(...args) {\n if (called)\n return;\n called = !0, callback.@apply(this, args);\n };\n },\n createDeferredPromise: function() {\n let resolve, reject;\n return {\n promise: new @Promise((res, rej) => {\n resolve = res, reject = rej;\n }),\n resolve,\n reject\n };\n },\n promisify(fn) {\n return new @Promise((resolve, reject) => {\n fn((err, ...args) => {\n if (err)\n return reject(err);\n return resolve(...args);\n });\n });\n },\n debuglog() {\n return function() {\n };\n },\n format(format, ...args) {\n return format.replace(/%([sdifj])/g, function(...[_unused, type]) {\n const replacement = args.shift();\n if (type === \"f\")\n return replacement.toFixed(6);\n else if (type === \"j\")\n return JSON.stringify(replacement);\n else if (type === \"s\" && typeof replacement === \"object\")\n return `${replacement.constructor !== Object \? replacement.constructor.name : \"\"} {}`.trim();\n else\n return replacement.toString();\n });\n },\n inspect(value) {\n switch (typeof value) {\n case \"string\":\n if (value.includes(\"'\")) {\n if (!value.includes('\"'))\n return `\"${value}\"`;\n else if (!value.includes(\"`\") && !value.includes(\"${\"))\n return `\\`${value}\\``;\n }\n return `'${value}'`;\n case \"number\":\n if (isNaN(value))\n return \"NaN\";\n else if (Object.is(value, -0))\n return @String(value);\n return value;\n case \"bigint\":\n return `${@String(value)}n`;\n case \"boolean\":\n case \"undefined\":\n return @String(value);\n case \"object\":\n return \"{}\";\n }\n },\n types: {\n isAsyncFunction(fn) {\n return fn instanceof AsyncFunction;\n },\n isArrayBufferView(arr) {\n return @ArrayBuffer.isView(arr);\n }\n },\n isBlob\n }, module.exports.promisify.custom = Symbol.for(\"nodejs.util.promisify.custom\");\n }\n}), require_errors = __commonJS({\n \"node_modules/readable-stream/lib/ours/errors.js\"(exports, module) {\n var { format, inspect, AggregateError: CustomAggregateError } = require_util(), AggregateError = globalThis.AggregateError || CustomAggregateError, kIsNodeError = Symbol(\"kIsNodeError\"), kTypes = [\"string\", \"function\", \"number\", \"object\", \"Function\", \"Object\", \"boolean\", \"bigint\", \"symbol\"], classRegExp = /^([A-Z][a-z0-9]*)+$/, nodeInternalPrefix = \"__node_internal_\", codes = {};\n function assert(value, message) {\n if (!value)\n throw new codes.ERR_INTERNAL_ASSERTION(message);\n }\n function addNumericalSeparator(val) {\n let res = \"\", i = val.length;\n const start = val[0] === \"-\" \? 1 : 0;\n for (;i >= start + 4; i -= 3)\n res = `_${val.slice(i - 3, i)}${res}`;\n return `${val.slice(0, i)}${res}`;\n }\n function getMessage(key, msg, args) {\n if (typeof msg === \"function\")\n return assert(msg.length <= args.length, `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${msg.length}).`), msg(...args);\n const expectedLength = (msg.match(/%[dfijoOs]/g) || []).length;\n if (assert(expectedLength === args.length, `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${expectedLength}).`), args.length === 0)\n return msg;\n return format(msg, ...args);\n }\n function E(code, message, Base) {\n if (!Base)\n Base = Error;\n\n class NodeError extends Base {\n constructor(...args) {\n super(getMessage(code, message, args));\n }\n toString() {\n return `${this.name} [${code}]: ${this.message}`;\n }\n }\n Object.defineProperties(NodeError.prototype, {\n name: {\n value: Base.name,\n writable: !0,\n enumerable: !1,\n configurable: !0\n },\n toString: {\n value() {\n return `${this.name} [${code}]: ${this.message}`;\n },\n writable: !0,\n enumerable: !1,\n configurable: !0\n }\n }), NodeError.prototype.code = code, NodeError.prototype[kIsNodeError] = !0, codes[code] = NodeError;\n }\n function hideStackFrames(fn) {\n const hidden = nodeInternalPrefix + fn.name;\n return Object.defineProperty(fn, \"name\", {\n value: hidden\n }), fn;\n }\n function aggregateTwoErrors(innerError, outerError) {\n if (innerError && outerError && innerError !== outerError) {\n if (@Array.isArray(outerError.errors))\n return outerError.errors.push(innerError), outerError;\n const err = new AggregateError([outerError, innerError], outerError.message);\n return err.code = outerError.code, err;\n }\n return innerError || outerError;\n }\n var AbortError2 = class extends Error {\n constructor(message = \"The operation was aborted\", options = void 0) {\n if (options !== void 0 && typeof options !== \"object\")\n throw new codes.ERR_INVALID_ARG_TYPE(\"options\", \"Object\", options);\n super(message, options);\n this.code = \"ABORT_ERR\", this.name = \"AbortError\";\n }\n };\n E(\"ERR_ASSERTION\", \"%s\", Error), E(\"ERR_INVALID_ARG_TYPE\", (name, expected, actual) => {\n if (assert(typeof name === \"string\", \"'name' must be a string\"), !@Array.isArray(expected))\n expected = [expected];\n let msg = \"The \";\n if (name.endsWith(\" argument\"))\n msg += `${name} `;\n else\n msg += `\"${name}\" ${name.includes(\".\") \? \"property\" : \"argument\"} `;\n msg += \"must be \";\n const types = [], instances = [], other = [];\n for (let value of expected)\n if (assert(typeof value === \"string\", \"All expected entries have to be of type string\"), kTypes.includes(value))\n types.push(value.toLowerCase());\n else if (classRegExp.test(value))\n instances.push(value);\n else\n assert(value !== \"object\", 'The value \"object\" should be written as \"Object\"'), other.push(value);\n if (instances.length > 0) {\n const pos = types.indexOf(\"object\");\n if (pos !== -1)\n types.splice(types, pos, 1), instances.push(\"Object\");\n }\n if (types.length > 0) {\n switch (types.length) {\n case 1:\n msg += `of type ${types[0]}`;\n break;\n case 2:\n msg += `one of type ${types[0]} or ${types[1]}`;\n break;\n default: {\n const last = types.pop();\n msg += `one of type ${types.join(\", \")}, or ${last}`;\n }\n }\n if (instances.length > 0 || other.length > 0)\n msg += \" or \";\n }\n if (instances.length > 0) {\n switch (instances.length) {\n case 1:\n msg += `an instance of ${instances[0]}`;\n break;\n case 2:\n msg += `an instance of ${instances[0]} or ${instances[1]}`;\n break;\n default: {\n const last = instances.pop();\n msg += `an instance of ${instances.join(\", \")}, or ${last}`;\n }\n }\n if (other.length > 0)\n msg += \" or \";\n }\n switch (other.length) {\n case 0:\n break;\n case 1:\n if (other[0].toLowerCase() !== other[0])\n msg += \"an \";\n msg += `${other[0]}`;\n break;\n case 2:\n msg += `one of ${other[0]} or ${other[1]}`;\n break;\n default: {\n const last = other.pop();\n msg += `one of ${other.join(\", \")}, or ${last}`;\n }\n }\n if (actual == null)\n msg += `. Received ${actual}`;\n else if (typeof actual === \"function\" && actual.name)\n msg += `. Received function ${actual.name}`;\n else if (typeof actual === \"object\") {\n var _actual$constructor;\n if ((_actual$constructor = actual.constructor) !== null && _actual$constructor !== void 0 && _actual$constructor.name)\n msg += `. Received an instance of ${actual.constructor.name}`;\n else {\n const inspected = inspect(actual, {\n depth: -1\n });\n msg += `. Received ${inspected}`;\n }\n } else {\n let inspected = inspect(actual, {\n colors: !1\n });\n if (inspected.length > 25)\n inspected = `${inspected.slice(0, 25)}...`;\n msg += `. Received type ${typeof actual} (${inspected})`;\n }\n return msg;\n }, TypeError), E(\"ERR_INVALID_ARG_VALUE\", (name, value, reason = \"is invalid\") => {\n let inspected = inspect(value);\n if (inspected.length > 128)\n inspected = inspected.slice(0, 128) + \"...\";\n return `The ${name.includes(\".\") \? \"property\" : \"argument\"} '${name}' ${reason}. Received ${inspected}`;\n }, TypeError), E(\"ERR_INVALID_RETURN_VALUE\", (input, name, value) => {\n var _value$constructor;\n const type = value !== null && value !== void 0 && (_value$constructor = value.constructor) !== null && _value$constructor !== void 0 && _value$constructor.name \? `instance of ${value.constructor.name}` : `type ${typeof value}`;\n return `Expected ${input} to be returned from the \"${name}\" function but got ${type}.`;\n }, TypeError), E(\"ERR_MISSING_ARGS\", (...args) => {\n assert(args.length > 0, \"At least one arg needs to be specified\");\n let msg;\n const len = args.length;\n switch (args = (@Array.isArray(args) \? args : [args]).map((a) => `\"${a}\"`).join(\" or \"), len) {\n case 1:\n msg += `The ${args[0]} argument`;\n break;\n case 2:\n msg += `The ${args[0]} and ${args[1]} arguments`;\n break;\n default:\n {\n const last = args.pop();\n msg += `The ${args.join(\", \")}, and ${last} arguments`;\n }\n break;\n }\n return `${msg} must be specified`;\n }, TypeError), E(\"ERR_OUT_OF_RANGE\", (str, range, input) => {\n assert(range, 'Missing \"range\" argument');\n let received;\n if (Number.isInteger(input) && Math.abs(input) > 4294967296)\n received = addNumericalSeparator(@String(input));\n else if (typeof input === \"bigint\") {\n if (received = @String(input), input > 2n ** 32n || input < -(2n ** 32n))\n received = addNumericalSeparator(received);\n received += \"n\";\n } else\n received = inspect(input);\n return `The value of \"${str}\" is out of range. It must be ${range}. Received ${received}`;\n }, RangeError), E(\"ERR_MULTIPLE_CALLBACK\", \"Callback called multiple times\", Error), E(\"ERR_METHOD_NOT_IMPLEMENTED\", \"The %s method is not implemented\", Error), E(\"ERR_STREAM_ALREADY_FINISHED\", \"Cannot call %s after a stream was finished\", Error), E(\"ERR_STREAM_CANNOT_PIPE\", \"Cannot pipe, not readable\", Error), E(\"ERR_STREAM_DESTROYED\", \"Cannot call %s after a stream was destroyed\", Error), E(\"ERR_STREAM_NULL_VALUES\", \"May not write null values to stream\", TypeError), E(\"ERR_STREAM_PREMATURE_CLOSE\", \"Premature close\", Error), E(\"ERR_STREAM_PUSH_AFTER_EOF\", \"stream.push() after EOF\", Error), E(\"ERR_STREAM_UNSHIFT_AFTER_END_EVENT\", \"stream.unshift() after end event\", Error), E(\"ERR_STREAM_WRITE_AFTER_END\", \"write after end\", Error), E(\"ERR_UNKNOWN_ENCODING\", \"Unknown encoding: %s\", TypeError), module.exports = {\n AbortError: AbortError2,\n aggregateTwoErrors: hideStackFrames(aggregateTwoErrors),\n hideStackFrames,\n codes\n };\n }\n}), require_validators = __commonJS({\n \"node_modules/readable-stream/lib/internal/validators.js\"(exports, module) {\n var {\n ArrayIsArray: ArrayIsArray2,\n ArrayPrototypeIncludes,\n ArrayPrototypeJoin,\n ArrayPrototypeMap,\n NumberIsInteger,\n NumberMAX_SAFE_INTEGER,\n NumberMIN_SAFE_INTEGER,\n NumberParseInt,\n RegExpPrototypeTest,\n String: String2,\n StringPrototypeToUpperCase,\n StringPrototypeTrim\n } = require_primordials(), {\n hideStackFrames,\n codes: { ERR_SOCKET_BAD_PORT, ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE2, ERR_INVALID_ARG_VALUE: ERR_INVALID_ARG_VALUE2, ERR_OUT_OF_RANGE, ERR_UNKNOWN_SIGNAL }\n } = require_errors(), { normalizeEncoding } = require_util(), { isAsyncFunction, isArrayBufferView } = require_util().types, signals = {};\n function isInt32(value) {\n return value === (value | 0);\n }\n function isUint32(value) {\n return value === value >>> 0;\n }\n var octalReg = /^[0-7]+$/, modeDesc = \"must be a 32-bit unsigned integer or an octal string\";\n function parseFileMode(value, name, def) {\n if (typeof value === \"undefined\")\n value = def;\n if (typeof value === \"string\") {\n if (!RegExpPrototypeTest(octalReg, value))\n throw new ERR_INVALID_ARG_VALUE2(name, value, modeDesc);\n value = NumberParseInt(value, 8);\n }\n return validateInt32(value, name, 0, 4294967295), value;\n }\n var validateInteger = hideStackFrames((value, name, min = NumberMIN_SAFE_INTEGER, max = NumberMAX_SAFE_INTEGER) => {\n if (typeof value !== \"number\")\n throw new ERR_INVALID_ARG_TYPE2(name, \"number\", value);\n if (!NumberIsInteger(value))\n throw new ERR_OUT_OF_RANGE(name, \"an integer\", value);\n if (value < min || value > max)\n throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);\n }), validateInt32 = hideStackFrames((value, name, min = -2147483648, max = 2147483647) => {\n if (typeof value !== \"number\")\n throw new ERR_INVALID_ARG_TYPE2(name, \"number\", value);\n if (!isInt32(value)) {\n if (!NumberIsInteger(value))\n throw new ERR_OUT_OF_RANGE(name, \"an integer\", value);\n throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);\n }\n if (value < min || value > max)\n throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);\n }), validateUint32 = hideStackFrames((value, name, positive) => {\n if (typeof value !== \"number\")\n throw new ERR_INVALID_ARG_TYPE2(name, \"number\", value);\n if (!isUint32(value)) {\n if (!NumberIsInteger(value))\n throw new ERR_OUT_OF_RANGE(name, \"an integer\", value);\n throw new ERR_OUT_OF_RANGE(name, `>= ${positive \? 1 : 0} && < 4294967296`, value);\n }\n if (positive && value === 0)\n throw new ERR_OUT_OF_RANGE(name, \">= 1 && < 4294967296\", value);\n });\n function validateString(value, name) {\n if (typeof value !== \"string\")\n throw new ERR_INVALID_ARG_TYPE2(name, \"string\", value);\n }\n function validateNumber(value, name) {\n if (typeof value !== \"number\")\n throw new ERR_INVALID_ARG_TYPE2(name, \"number\", value);\n }\n var validateOneOf = hideStackFrames((value, name, oneOf) => {\n if (!ArrayPrototypeIncludes(oneOf, value)) {\n const reason = \"must be one of: \" + ArrayPrototypeJoin(ArrayPrototypeMap(oneOf, (v) => typeof v === \"string\" \? `'${v}'` : String2(v)), \", \");\n throw new ERR_INVALID_ARG_VALUE2(name, value, reason);\n }\n });\n function validateBoolean2(value, name) {\n if (typeof value !== \"boolean\")\n throw new ERR_INVALID_ARG_TYPE2(name, \"boolean\", value);\n }\n var validateObject = hideStackFrames((value, name, options) => {\n const useDefaultOptions = options == null, allowArray = useDefaultOptions \? !1 : options.allowArray, allowFunction = useDefaultOptions \? !1 : options.allowFunction;\n if (!(useDefaultOptions \? !1 : options.nullable) && value === null || !allowArray && ArrayIsArray2(value) || typeof value !== \"object\" && (!allowFunction || typeof value !== \"function\"))\n throw new ERR_INVALID_ARG_TYPE2(name, \"Object\", value);\n }), validateArray = hideStackFrames((value, name, minLength = 0) => {\n if (!ArrayIsArray2(value))\n throw new ERR_INVALID_ARG_TYPE2(name, \"Array\", value);\n if (value.length < minLength) {\n const reason = `must be longer than ${minLength}`;\n throw new ERR_INVALID_ARG_VALUE2(name, value, reason);\n }\n });\n function validateSignalName(signal, name = \"signal\") {\n if (validateString(signal, name), signals[signal] === void 0) {\n if (signals[StringPrototypeToUpperCase(signal)] !== void 0)\n throw new ERR_UNKNOWN_SIGNAL(signal + \" (signals must use all capital letters)\");\n throw new ERR_UNKNOWN_SIGNAL(signal);\n }\n }\n var validateBuffer = hideStackFrames((buffer, name = \"buffer\") => {\n if (!isArrayBufferView(buffer))\n throw new ERR_INVALID_ARG_TYPE2(name, [\"Buffer\", \"TypedArray\", \"DataView\"], buffer);\n });\n function validateEncoding(data, encoding) {\n const normalizedEncoding = normalizeEncoding(encoding), length = data.length;\n if (normalizedEncoding === \"hex\" && length % 2 !== 0)\n throw new ERR_INVALID_ARG_VALUE2(\"encoding\", encoding, `is invalid for data of length ${length}`);\n }\n function validatePort(port, name = \"Port\", allowZero = !0) {\n if (typeof port !== \"number\" && typeof port !== \"string\" || typeof port === \"string\" && StringPrototypeTrim(port).length === 0 || +port !== +port >>> 0 || port > 65535 || port === 0 && !allowZero)\n throw new ERR_SOCKET_BAD_PORT(name, port, allowZero);\n return port | 0;\n }\n var validateAbortSignal = hideStackFrames((signal, name) => {\n if (signal !== void 0 && (signal === null || typeof signal !== \"object\" || !(\"aborted\" in signal)))\n throw new ERR_INVALID_ARG_TYPE2(name, \"AbortSignal\", signal);\n }), validateFunction = hideStackFrames((value, name) => {\n if (typeof value !== \"function\")\n throw new ERR_INVALID_ARG_TYPE2(name, \"Function\", value);\n }), validatePlainFunction = hideStackFrames((value, name) => {\n if (typeof value !== \"function\" || isAsyncFunction(value))\n throw new ERR_INVALID_ARG_TYPE2(name, \"Function\", value);\n }), validateUndefined = hideStackFrames((value, name) => {\n if (value !== void 0)\n throw new ERR_INVALID_ARG_TYPE2(name, \"undefined\", value);\n });\n module.exports = {\n isInt32,\n isUint32,\n parseFileMode,\n validateArray,\n validateBoolean: validateBoolean2,\n validateBuffer,\n validateEncoding,\n validateFunction,\n validateInt32,\n validateInteger,\n validateNumber,\n validateObject,\n validateOneOf,\n validatePlainFunction,\n validatePort,\n validateSignalName,\n validateString,\n validateUint32,\n validateUndefined,\n validateAbortSignal\n };\n }\n}), require_utils = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/utils.js\"(exports, module) {\n var { Symbol: Symbol2, SymbolAsyncIterator, SymbolIterator } = require_primordials(), kDestroyed = Symbol2(\"kDestroyed\"), kIsErrored = Symbol2(\"kIsErrored\"), kIsReadable = Symbol2(\"kIsReadable\"), kIsDisturbed = Symbol2(\"kIsDisturbed\");\n function isReadableNodeStream(obj, strict = !1) {\n var _obj$_readableState;\n return !!(obj && typeof obj.pipe === \"function\" && typeof obj.on === \"function\" && (!strict || typeof obj.pause === \"function\" && typeof obj.resume === \"function\") && (!obj._writableState || ((_obj$_readableState = obj._readableState) === null || _obj$_readableState === void 0 \? void 0 : _obj$_readableState.readable) !== !1) && (!obj._writableState || obj._readableState));\n }\n function isWritableNodeStream(obj) {\n var _obj$_writableState;\n return !!(obj && typeof obj.write === \"function\" && typeof obj.on === \"function\" && (!obj._readableState || ((_obj$_writableState = obj._writableState) === null || _obj$_writableState === void 0 \? void 0 : _obj$_writableState.writable) !== !1));\n }\n function isDuplexNodeStream(obj) {\n return !!(obj && typeof obj.pipe === \"function\" && obj._readableState && typeof obj.on === \"function\" && typeof obj.write === \"function\");\n }\n function isNodeStream(obj) {\n return obj && (obj._readableState || obj._writableState || typeof obj.write === \"function\" && typeof obj.on === \"function\" || typeof obj.pipe === \"function\" && typeof obj.on === \"function\");\n }\n function isIterable(obj, isAsync) {\n if (obj == null)\n return !1;\n if (isAsync === !0)\n return typeof obj[SymbolAsyncIterator] === \"function\";\n if (isAsync === !1)\n return typeof obj[SymbolIterator] === \"function\";\n return typeof obj[SymbolAsyncIterator] === \"function\" || typeof obj[SymbolIterator] === \"function\";\n }\n function isDestroyed(stream) {\n if (!isNodeStream(stream))\n return null;\n const { _writableState: wState, _readableState: rState } = stream, state = wState || rState;\n return !!(stream.destroyed || stream[kDestroyed] || state !== null && state !== void 0 && state.destroyed);\n }\n function isWritableEnded(stream) {\n if (!isWritableNodeStream(stream))\n return null;\n if (stream.writableEnded === !0)\n return !0;\n const wState = stream._writableState;\n if (wState !== null && wState !== void 0 && wState.errored)\n return !1;\n if (typeof (wState === null || wState === void 0 \? void 0 : wState.ended) !== \"boolean\")\n return null;\n return wState.ended;\n }\n function isWritableFinished(stream, strict) {\n if (!isWritableNodeStream(stream))\n return null;\n if (stream.writableFinished === !0)\n return !0;\n const wState = stream._writableState;\n if (wState !== null && wState !== void 0 && wState.errored)\n return !1;\n if (typeof (wState === null || wState === void 0 \? void 0 : wState.finished) !== \"boolean\")\n return null;\n return !!(wState.finished || strict === !1 && wState.ended === !0 && wState.length === 0);\n }\n function isReadableEnded(stream) {\n if (!isReadableNodeStream(stream))\n return null;\n if (stream.readableEnded === !0)\n return !0;\n const rState = stream._readableState;\n if (!rState || rState.errored)\n return !1;\n if (typeof (rState === null || rState === void 0 \? void 0 : rState.ended) !== \"boolean\")\n return null;\n return rState.ended;\n }\n function isReadableFinished(stream, strict) {\n if (!isReadableNodeStream(stream))\n return null;\n const rState = stream._readableState;\n if (rState !== null && rState !== void 0 && rState.errored)\n return !1;\n if (typeof (rState === null || rState === void 0 \? void 0 : rState.endEmitted) !== \"boolean\")\n return null;\n return !!(rState.endEmitted || strict === !1 && rState.ended === !0 && rState.length === 0);\n }\n function isReadable(stream) {\n if (stream && stream[kIsReadable] != null)\n return stream[kIsReadable];\n if (typeof (stream === null || stream === void 0 \? void 0 : stream.readable) !== \"boolean\")\n return null;\n if (isDestroyed(stream))\n return !1;\n return isReadableNodeStream(stream) && stream.readable && !isReadableFinished(stream);\n }\n function isWritable(stream) {\n if (typeof (stream === null || stream === void 0 \? void 0 : stream.writable) !== \"boolean\")\n return null;\n if (isDestroyed(stream))\n return !1;\n return isWritableNodeStream(stream) && stream.writable && !isWritableEnded(stream);\n }\n function isFinished(stream, opts) {\n if (!isNodeStream(stream))\n return null;\n if (isDestroyed(stream))\n return !0;\n if ((opts === null || opts === void 0 \? void 0 : opts.readable) !== !1 && isReadable(stream))\n return !1;\n if ((opts === null || opts === void 0 \? void 0 : opts.writable) !== !1 && isWritable(stream))\n return !1;\n return !0;\n }\n function isWritableErrored(stream) {\n var _stream$_writableStat, _stream$_writableStat2;\n if (!isNodeStream(stream))\n return null;\n if (stream.writableErrored)\n return stream.writableErrored;\n return (_stream$_writableStat = (_stream$_writableStat2 = stream._writableState) === null || _stream$_writableStat2 === void 0 \? void 0 : _stream$_writableStat2.errored) !== null && _stream$_writableStat !== void 0 \? _stream$_writableStat : null;\n }\n function isReadableErrored(stream) {\n var _stream$_readableStat, _stream$_readableStat2;\n if (!isNodeStream(stream))\n return null;\n if (stream.readableErrored)\n return stream.readableErrored;\n return (_stream$_readableStat = (_stream$_readableStat2 = stream._readableState) === null || _stream$_readableStat2 === void 0 \? void 0 : _stream$_readableStat2.errored) !== null && _stream$_readableStat !== void 0 \? _stream$_readableStat : null;\n }\n function isClosed(stream) {\n if (!isNodeStream(stream))\n return null;\n if (typeof stream.closed === \"boolean\")\n return stream.closed;\n const { _writableState: wState, _readableState: rState } = stream;\n if (typeof (wState === null || wState === void 0 \? void 0 : wState.closed) === \"boolean\" || typeof (rState === null || rState === void 0 \? void 0 : rState.closed) === \"boolean\")\n return (wState === null || wState === void 0 \? void 0 : wState.closed) || (rState === null || rState === void 0 \? void 0 : rState.closed);\n if (typeof stream._closed === \"boolean\" && isOutgoingMessage(stream))\n return stream._closed;\n return null;\n }\n function isOutgoingMessage(stream) {\n return typeof stream._closed === \"boolean\" && typeof stream._defaultKeepAlive === \"boolean\" && typeof stream._removedConnection === \"boolean\" && typeof stream._removedContLen === \"boolean\";\n }\n function isServerResponse(stream) {\n return typeof stream._sent100 === \"boolean\" && isOutgoingMessage(stream);\n }\n function isServerRequest(stream) {\n var _stream$req;\n return typeof stream._consuming === \"boolean\" && typeof stream._dumped === \"boolean\" && ((_stream$req = stream.req) === null || _stream$req === void 0 \? void 0 : _stream$req.upgradeOrConnect) === void 0;\n }\n function willEmitClose(stream) {\n if (!isNodeStream(stream))\n return null;\n const { _writableState: wState, _readableState: rState } = stream, state = wState || rState;\n return !state && isServerResponse(stream) || !!(state && state.autoDestroy && state.emitClose && state.closed === !1);\n }\n function isDisturbed(stream) {\n var _stream$kIsDisturbed;\n return !!(stream && ((_stream$kIsDisturbed = stream[kIsDisturbed]) !== null && _stream$kIsDisturbed !== void 0 \? _stream$kIsDisturbed : stream.readableDidRead || stream.readableAborted));\n }\n function isErrored(stream) {\n var _ref, _ref2, _ref3, _ref4, _ref5, _stream$kIsErrored, _stream$_readableStat3, _stream$_writableStat3, _stream$_readableStat4, _stream$_writableStat4;\n return !!(stream && ((_ref = (_ref2 = (_ref3 = (_ref4 = (_ref5 = (_stream$kIsErrored = stream[kIsErrored]) !== null && _stream$kIsErrored !== void 0 \? _stream$kIsErrored : stream.readableErrored) !== null && _ref5 !== void 0 \? _ref5 : stream.writableErrored) !== null && _ref4 !== void 0 \? _ref4 : (_stream$_readableStat3 = stream._readableState) === null || _stream$_readableStat3 === void 0 \? void 0 : _stream$_readableStat3.errorEmitted) !== null && _ref3 !== void 0 \? _ref3 : (_stream$_writableStat3 = stream._writableState) === null || _stream$_writableStat3 === void 0 \? void 0 : _stream$_writableStat3.errorEmitted) !== null && _ref2 !== void 0 \? _ref2 : (_stream$_readableStat4 = stream._readableState) === null || _stream$_readableStat4 === void 0 \? void 0 : _stream$_readableStat4.errored) !== null && _ref !== void 0 \? _ref : (_stream$_writableStat4 = stream._writableState) === null || _stream$_writableStat4 === void 0 \? void 0 : _stream$_writableStat4.errored));\n }\n module.exports = {\n kDestroyed,\n isDisturbed,\n kIsDisturbed,\n isErrored,\n kIsErrored,\n isReadable,\n kIsReadable,\n isClosed,\n isDestroyed,\n isDuplexNodeStream,\n isFinished,\n isIterable,\n isReadableNodeStream,\n isReadableEnded,\n isReadableFinished,\n isReadableErrored,\n isNodeStream,\n isWritable,\n isWritableNodeStream,\n isWritableEnded,\n isWritableFinished,\n isWritableErrored,\n isServerRequest,\n isServerResponse,\n willEmitClose\n };\n }\n}), require_end_of_stream = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/end-of-stream.js\"(exports, module) {\n var { AbortError: AbortError2, codes } = require_errors(), { ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE2, ERR_STREAM_PREMATURE_CLOSE } = codes, { once } = require_util(), { validateAbortSignal, validateFunction, validateObject } = require_validators(), { Promise: Promise2 } = require_primordials(), {\n isClosed,\n isReadable,\n isReadableNodeStream,\n isReadableFinished,\n isReadableErrored,\n isWritable,\n isWritableNodeStream,\n isWritableFinished,\n isWritableErrored,\n isNodeStream,\n willEmitClose: _willEmitClose\n } = require_utils();\n function isRequest(stream) {\n return stream.setHeader && typeof stream.abort === \"function\";\n }\n var nop = () => {\n };\n function eos(stream, options, callback) {\n var _options$readable, _options$writable;\n if (arguments.length === 2)\n callback = options, options = {};\n else if (options == null)\n options = {};\n else\n validateObject(options, \"options\");\n validateFunction(callback, \"callback\"), validateAbortSignal(options.signal, \"options.signal\"), callback = once(callback);\n const readable = (_options$readable = options.readable) !== null && _options$readable !== void 0 \? _options$readable : isReadableNodeStream(stream), writable = (_options$writable = options.writable) !== null && _options$writable !== void 0 \? _options$writable : isWritableNodeStream(stream);\n if (!isNodeStream(stream))\n throw new ERR_INVALID_ARG_TYPE2(\"stream\", \"Stream\", stream);\n const { _writableState: wState, _readableState: rState } = stream, onlegacyfinish = () => {\n if (!stream.writable)\n onfinish();\n };\n let willEmitClose = _willEmitClose(stream) && isReadableNodeStream(stream) === readable && isWritableNodeStream(stream) === writable, writableFinished = isWritableFinished(stream, !1);\n const onfinish = () => {\n if (writableFinished = !0, stream.destroyed)\n willEmitClose = !1;\n if (willEmitClose && (!stream.readable || readable))\n return;\n if (!readable || readableFinished)\n callback.@call(stream);\n };\n let readableFinished = isReadableFinished(stream, !1);\n const onend = () => {\n if (readableFinished = !0, stream.destroyed)\n willEmitClose = !1;\n if (willEmitClose && (!stream.writable || writable))\n return;\n if (!writable || writableFinished)\n callback.@call(stream);\n }, onerror = (err) => {\n callback.@call(stream, err);\n };\n let closed = isClosed(stream);\n const onclose = () => {\n closed = !0;\n const errored = isWritableErrored(stream) || isReadableErrored(stream);\n if (errored && typeof errored !== \"boolean\")\n return callback.@call(stream, errored);\n if (readable && !readableFinished && isReadableNodeStream(stream, !0)) {\n if (!isReadableFinished(stream, !1))\n return callback.@call(stream, new ERR_STREAM_PREMATURE_CLOSE);\n }\n if (writable && !writableFinished) {\n if (!isWritableFinished(stream, !1))\n return callback.@call(stream, new ERR_STREAM_PREMATURE_CLOSE);\n }\n callback.@call(stream);\n }, onrequest = () => {\n stream.req.on(\"finish\", onfinish);\n };\n if (isRequest(stream)) {\n if (stream.on(\"complete\", onfinish), !willEmitClose)\n stream.on(\"abort\", onclose);\n if (stream.req)\n onrequest();\n else\n stream.on(\"request\", onrequest);\n } else if (writable && !wState)\n stream.on(\"end\", onlegacyfinish), stream.on(\"close\", onlegacyfinish);\n if (!willEmitClose && typeof stream.aborted === \"boolean\")\n stream.on(\"aborted\", onclose);\n if (stream.on(\"end\", onend), stream.on(\"finish\", onfinish), options.error !== !1)\n stream.on(\"error\", onerror);\n if (stream.on(\"close\", onclose), closed)\n runOnNextTick(onclose);\n else if (wState !== null && wState !== void 0 && wState.errorEmitted || rState !== null && rState !== void 0 && rState.errorEmitted) {\n if (!willEmitClose)\n runOnNextTick(onclose);\n } else if (!readable && (!willEmitClose || isReadable(stream)) && (writableFinished || isWritable(stream) === !1))\n runOnNextTick(onclose);\n else if (!writable && (!willEmitClose || isWritable(stream)) && (readableFinished || isReadable(stream) === !1))\n runOnNextTick(onclose);\n else if (rState && stream.req && stream.aborted)\n runOnNextTick(onclose);\n const cleanup = () => {\n if (callback = nop, stream.removeListener(\"aborted\", onclose), stream.removeListener(\"complete\", onfinish), stream.removeListener(\"abort\", onclose), stream.removeListener(\"request\", onrequest), stream.req)\n stream.req.removeListener(\"finish\", onfinish);\n stream.removeListener(\"end\", onlegacyfinish), stream.removeListener(\"close\", onlegacyfinish), stream.removeListener(\"finish\", onfinish), stream.removeListener(\"end\", onend), stream.removeListener(\"error\", onerror), stream.removeListener(\"close\", onclose);\n };\n if (options.signal && !closed) {\n const abort = () => {\n const endCallback = callback;\n cleanup(), endCallback.@call(stream, new AbortError2(void 0, {\n cause: options.signal.reason\n }));\n };\n if (options.signal.aborted)\n runOnNextTick(abort);\n else {\n const originalCallback = callback;\n callback = once((...args) => {\n options.signal.removeEventListener(\"abort\", abort), originalCallback.@apply(stream, args);\n }), options.signal.addEventListener(\"abort\", abort);\n }\n }\n return cleanup;\n }\n function finished(stream, opts) {\n return new Promise2((resolve, reject) => {\n eos(stream, opts, (err) => {\n if (err)\n reject(err);\n else\n resolve();\n });\n });\n }\n module.exports = eos, module.exports.finished = finished;\n }\n}), require_operators = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/operators.js\"(exports, module) {\n var {\n codes: { ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE2, ERR_MISSING_ARGS, ERR_OUT_OF_RANGE },\n AbortError: AbortError2\n } = require_errors(), { validateAbortSignal, validateInteger, validateObject } = require_validators(), kWeakHandler = require_primordials().Symbol(\"kWeak\"), { finished } = require_end_of_stream(), {\n ArrayPrototypePush,\n MathFloor,\n Number: Number2,\n NumberIsNaN,\n Promise: Promise2,\n PromiseReject,\n PromisePrototypeCatch,\n Symbol: Symbol2\n } = require_primordials(), kEmpty = Symbol2(\"kEmpty\"), kEof = Symbol2(\"kEof\");\n function map(fn, options) {\n if (typeof fn !== \"function\")\n throw new ERR_INVALID_ARG_TYPE2(\"fn\", [\"Function\", \"AsyncFunction\"], fn);\n if (options != null)\n validateObject(options, \"options\");\n if ((options === null || options === void 0 \? void 0 : options.signal) != null)\n validateAbortSignal(options.signal, \"options.signal\");\n let concurrency = 1;\n if ((options === null || options === void 0 \? void 0 : options.concurrency) != null)\n concurrency = MathFloor(options.concurrency);\n return validateInteger(concurrency, \"concurrency\", 1), async function* map2() {\n var _options$signal, _options$signal2;\n const ac = new AbortController, stream = this, queue = [], signal = ac.signal, signalOpt = {\n signal\n }, abort = () => ac.abort();\n if (options !== null && options !== void 0 && (_options$signal = options.signal) !== null && _options$signal !== void 0 && _options$signal.aborted)\n abort();\n options === null || options === void 0 || (_options$signal2 = options.signal) === null || _options$signal2 === void 0 || _options$signal2.addEventListener(\"abort\", abort);\n let next, resume, done = !1;\n function onDone() {\n done = !0;\n }\n async function pump() {\n try {\n for await (let val of stream) {\n var _val;\n if (done)\n return;\n if (signal.aborted)\n throw new AbortError2;\n try {\n val = fn(val, signalOpt);\n } catch (err) {\n val = PromiseReject(err);\n }\n if (val === kEmpty)\n continue;\n if (typeof ((_val = val) === null || _val === void 0 \? void 0 : _val.catch) === \"function\")\n val.catch(onDone);\n if (queue.push(val), next)\n next(), next = null;\n if (!done && queue.length && queue.length >= concurrency)\n await new Promise2((resolve) => {\n resume = resolve;\n });\n }\n queue.push(kEof);\n } catch (err) {\n const val = PromiseReject(err);\n PromisePrototypeCatch(val, onDone), queue.push(val);\n } finally {\n var _options$signal3;\n if (done = !0, next)\n next(), next = null;\n options === null || options === void 0 || (_options$signal3 = options.signal) === null || _options$signal3 === void 0 || _options$signal3.removeEventListener(\"abort\", abort);\n }\n }\n pump();\n try {\n while (!0) {\n while (queue.length > 0) {\n const val = await queue[0];\n if (val === kEof)\n return;\n if (signal.aborted)\n throw new AbortError2;\n if (val !== kEmpty)\n yield val;\n if (queue.shift(), resume)\n resume(), resume = null;\n }\n await new Promise2((resolve) => {\n next = resolve;\n });\n }\n } finally {\n if (ac.abort(), done = !0, resume)\n resume(), resume = null;\n }\n }.@call(this);\n }\n function asIndexedPairs(options = void 0) {\n if (options != null)\n validateObject(options, \"options\");\n if ((options === null || options === void 0 \? void 0 : options.signal) != null)\n validateAbortSignal(options.signal, \"options.signal\");\n return async function* asIndexedPairs2() {\n let index = 0;\n for await (let val of this) {\n var _options$signal4;\n if (options !== null && options !== void 0 && (_options$signal4 = options.signal) !== null && _options$signal4 !== void 0 && _options$signal4.aborted)\n throw new AbortError2({\n cause: options.signal.reason\n });\n yield [index++, val];\n }\n }.@call(this);\n }\n async function some(fn, options = void 0) {\n for await (let unused of filter.@call(this, fn, options))\n return !0;\n return !1;\n }\n async function every(fn, options = void 0) {\n if (typeof fn !== \"function\")\n throw new ERR_INVALID_ARG_TYPE2(\"fn\", [\"Function\", \"AsyncFunction\"], fn);\n return !await some.@call(this, async (...args) => {\n return !await fn(...args);\n }, options);\n }\n async function find(fn, options) {\n for await (let result of filter.@call(this, fn, options))\n return result;\n return;\n }\n async function forEach(fn, options) {\n if (typeof fn !== \"function\")\n throw new ERR_INVALID_ARG_TYPE2(\"fn\", [\"Function\", \"AsyncFunction\"], fn);\n async function forEachFn(value, options2) {\n return await fn(value, options2), kEmpty;\n }\n for await (let unused of map.@call(this, forEachFn, options))\n ;\n }\n function filter(fn, options) {\n if (typeof fn !== \"function\")\n throw new ERR_INVALID_ARG_TYPE2(\"fn\", [\"Function\", \"AsyncFunction\"], fn);\n async function filterFn(value, options2) {\n if (await fn(value, options2))\n return value;\n return kEmpty;\n }\n return map.@call(this, filterFn, options);\n }\n var ReduceAwareErrMissingArgs = class extends ERR_MISSING_ARGS {\n constructor() {\n super(\"reduce\");\n this.message = \"Reduce of an empty stream requires an initial value\";\n }\n };\n async function reduce(reducer, initialValue, options) {\n var _options$signal5;\n if (typeof reducer !== \"function\")\n throw new ERR_INVALID_ARG_TYPE2(\"reducer\", [\"Function\", \"AsyncFunction\"], reducer);\n if (options != null)\n validateObject(options, \"options\");\n if ((options === null || options === void 0 \? void 0 : options.signal) != null)\n validateAbortSignal(options.signal, \"options.signal\");\n let hasInitialValue = arguments.length > 1;\n if (options !== null && options !== void 0 && (_options$signal5 = options.signal) !== null && _options$signal5 !== void 0 && _options$signal5.aborted) {\n const err = new AbortError2(void 0, {\n cause: options.signal.reason\n });\n throw this.once(\"error\", () => {\n }), await finished(this.destroy(err)), err;\n }\n const ac = new AbortController, signal = ac.signal;\n if (options !== null && options !== void 0 && options.signal) {\n const opts = {\n once: !0,\n [kWeakHandler]: this\n };\n options.signal.addEventListener(\"abort\", () => ac.abort(), opts);\n }\n let gotAnyItemFromStream = !1;\n try {\n for await (let value of this) {\n var _options$signal6;\n if (gotAnyItemFromStream = !0, options !== null && options !== void 0 && (_options$signal6 = options.signal) !== null && _options$signal6 !== void 0 && _options$signal6.aborted)\n throw new AbortError2;\n if (!hasInitialValue)\n initialValue = value, hasInitialValue = !0;\n else\n initialValue = await reducer(initialValue, value, {\n signal\n });\n }\n if (!gotAnyItemFromStream && !hasInitialValue)\n throw new ReduceAwareErrMissingArgs;\n } finally {\n ac.abort();\n }\n return initialValue;\n }\n async function toArray(options) {\n if (options != null)\n validateObject(options, \"options\");\n if ((options === null || options === void 0 \? void 0 : options.signal) != null)\n validateAbortSignal(options.signal, \"options.signal\");\n const result = [];\n for await (let val of this) {\n var _options$signal7;\n if (options !== null && options !== void 0 && (_options$signal7 = options.signal) !== null && _options$signal7 !== void 0 && _options$signal7.aborted)\n throw new AbortError2(void 0, {\n cause: options.signal.reason\n });\n ArrayPrototypePush(result, val);\n }\n return result;\n }\n function flatMap(fn, options) {\n const values = map.@call(this, fn, options);\n return async function* flatMap2() {\n for await (let val of values)\n yield* val;\n }.@call(this);\n }\n function toIntegerOrInfinity(number) {\n if (number = Number2(number), NumberIsNaN(number))\n return 0;\n if (number < 0)\n throw new ERR_OUT_OF_RANGE(\"number\", \">= 0\", number);\n return number;\n }\n function drop(number, options = void 0) {\n if (options != null)\n validateObject(options, \"options\");\n if ((options === null || options === void 0 \? void 0 : options.signal) != null)\n validateAbortSignal(options.signal, \"options.signal\");\n return number = toIntegerOrInfinity(number), async function* drop2() {\n var _options$signal8;\n if (options !== null && options !== void 0 && (_options$signal8 = options.signal) !== null && _options$signal8 !== void 0 && _options$signal8.aborted)\n throw new AbortError2;\n for await (let val of this) {\n var _options$signal9;\n if (options !== null && options !== void 0 && (_options$signal9 = options.signal) !== null && _options$signal9 !== void 0 && _options$signal9.aborted)\n throw new AbortError2;\n if (number-- <= 0)\n yield val;\n }\n }.@call(this);\n }\n function take(number, options = void 0) {\n if (options != null)\n validateObject(options, \"options\");\n if ((options === null || options === void 0 \? void 0 : options.signal) != null)\n validateAbortSignal(options.signal, \"options.signal\");\n return number = toIntegerOrInfinity(number), async function* take2() {\n var _options$signal10;\n if (options !== null && options !== void 0 && (_options$signal10 = options.signal) !== null && _options$signal10 !== void 0 && _options$signal10.aborted)\n throw new AbortError2;\n for await (let val of this) {\n var _options$signal11;\n if (options !== null && options !== void 0 && (_options$signal11 = options.signal) !== null && _options$signal11 !== void 0 && _options$signal11.aborted)\n throw new AbortError2;\n if (number-- > 0)\n yield val;\n else\n return;\n }\n }.@call(this);\n }\n module.exports.streamReturningOperators = {\n asIndexedPairs,\n drop,\n filter,\n flatMap,\n map,\n take\n }, module.exports.promiseReturningOperators = {\n every,\n forEach,\n reduce,\n toArray,\n some,\n find\n };\n }\n}), require_destroy = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/destroy.js\"(exports, module) {\n var {\n aggregateTwoErrors,\n codes: { ERR_MULTIPLE_CALLBACK },\n AbortError: AbortError2\n } = require_errors(), { Symbol: Symbol2 } = require_primordials(), { kDestroyed, isDestroyed, isFinished, isServerRequest } = require_utils(), kDestroy = \"#kDestroy\", kConstruct = \"#kConstruct\";\n function checkError(err, w, r) {\n if (err) {\n if (err.stack, w && !w.errored)\n w.errored = err;\n if (r && !r.errored)\n r.errored = err;\n }\n }\n function destroy2(err, cb) {\n const r = this._readableState, w = this._writableState, s = w || r;\n if (w && w.destroyed || r && r.destroyed) {\n if (typeof cb === \"function\")\n cb();\n return this;\n }\n if (checkError(err, w, r), w)\n w.destroyed = !0;\n if (r)\n r.destroyed = !0;\n if (!s.constructed)\n this.once(kDestroy, (er) => {\n _destroy(this, aggregateTwoErrors(er, err), cb);\n });\n else\n _destroy(this, err, cb);\n return this;\n }\n function _destroy(self, err, cb) {\n let called = !1;\n function onDestroy(err2) {\n if (called)\n return;\n called = !0;\n const { _readableState: r, _writableState: w } = self;\n if (checkError(err2, w, r), w)\n w.closed = !0;\n if (r)\n r.closed = !0;\n if (typeof cb === \"function\")\n cb(err2);\n if (err2)\n runOnNextTick(emitErrorCloseNT, self, err2);\n else\n runOnNextTick(emitCloseNT, self);\n }\n try {\n self._destroy(err || null, onDestroy);\n } catch (err2) {\n onDestroy(err2);\n }\n }\n function emitErrorCloseNT(self, err) {\n emitErrorNT(self, err), emitCloseNT(self);\n }\n function emitCloseNT(self) {\n const { _readableState: r, _writableState: w } = self;\n if (w)\n w.closeEmitted = !0;\n if (r)\n r.closeEmitted = !0;\n if (w && w.emitClose || r && r.emitClose)\n self.emit(\"close\");\n }\n function emitErrorNT(self, err) {\n const r = self\?._readableState, w = self\?._writableState;\n if (w\?.errorEmitted || r\?.errorEmitted)\n return;\n if (w)\n w.errorEmitted = !0;\n if (r)\n r.errorEmitted = !0;\n self\?.emit\?.(\"error\", err);\n }\n function undestroy() {\n const r = this._readableState, w = this._writableState;\n if (r)\n r.constructed = !0, r.closed = !1, r.closeEmitted = !1, r.destroyed = !1, r.errored = null, r.errorEmitted = !1, r.reading = !1, r.ended = r.readable === !1, r.endEmitted = r.readable === !1;\n if (w)\n w.constructed = !0, w.destroyed = !1, w.closed = !1, w.closeEmitted = !1, w.errored = null, w.errorEmitted = !1, w.finalCalled = !1, w.prefinished = !1, w.ended = w.writable === !1, w.ending = w.writable === !1, w.finished = w.writable === !1;\n }\n function errorOrDestroy2(stream, err, sync) {\n const r = stream\?._readableState, w = stream\?._writableState;\n if (w && w.destroyed || r && r.destroyed)\n return this;\n if (r && r.autoDestroy || w && w.autoDestroy)\n stream.destroy(err);\n else if (err) {\n if (Error.captureStackTrace(err), w && !w.errored)\n w.errored = err;\n if (r && !r.errored)\n r.errored = err;\n if (sync)\n runOnNextTick(emitErrorNT, stream, err);\n else\n emitErrorNT(stream, err);\n }\n }\n function construct(stream, cb) {\n if (typeof stream._construct !== \"function\")\n return;\n const { _readableState: r, _writableState: w } = stream;\n if (r)\n r.constructed = !1;\n if (w)\n w.constructed = !1;\n if (stream.once(kConstruct, cb), stream.listenerCount(kConstruct) > 1)\n return;\n runOnNextTick(constructNT, stream);\n }\n function constructNT(stream) {\n let called = !1;\n function onConstruct(err) {\n if (called) {\n errorOrDestroy2(stream, err !== null && err !== void 0 \? err : new ERR_MULTIPLE_CALLBACK);\n return;\n }\n called = !0;\n const { _readableState: r, _writableState: w } = stream, s = w || r;\n if (r)\n r.constructed = !0;\n if (w)\n w.constructed = !0;\n if (s.destroyed)\n stream.emit(kDestroy, err);\n else if (err)\n errorOrDestroy2(stream, err, !0);\n else\n runOnNextTick(emitConstructNT, stream);\n }\n try {\n stream._construct(onConstruct);\n } catch (err) {\n onConstruct(err);\n }\n }\n function emitConstructNT(stream) {\n stream.emit(kConstruct);\n }\n function isRequest(stream) {\n return stream && stream.setHeader && typeof stream.abort === \"function\";\n }\n function emitCloseLegacy(stream) {\n stream.emit(\"close\");\n }\n function emitErrorCloseLegacy(stream, err) {\n stream.emit(\"error\", err), runOnNextTick(emitCloseLegacy, stream);\n }\n function destroyer(stream, err) {\n if (!stream || isDestroyed(stream))\n return;\n if (!err && !isFinished(stream))\n err = new AbortError2;\n if (isServerRequest(stream))\n stream.socket = null, stream.destroy(err);\n else if (isRequest(stream))\n stream.abort();\n else if (isRequest(stream.req))\n stream.req.abort();\n else if (typeof stream.destroy === \"function\")\n stream.destroy(err);\n else if (typeof stream.close === \"function\")\n stream.close();\n else if (err)\n runOnNextTick(emitErrorCloseLegacy, stream);\n else\n runOnNextTick(emitCloseLegacy, stream);\n if (!stream.destroyed)\n stream[kDestroyed] = !0;\n }\n module.exports = {\n construct,\n destroyer,\n destroy: destroy2,\n undestroy,\n errorOrDestroy: errorOrDestroy2\n };\n }\n}), require_legacy = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/legacy.js\"(exports, module) {\n var { ArrayIsArray: ArrayIsArray2, ObjectSetPrototypeOf } = require_primordials();\n function Stream(options) {\n if (!(this instanceof Stream))\n return new Stream(options);\n EE.@call(this, options);\n }\n Stream.prototype = {}, ObjectSetPrototypeOf(Stream.prototype, EE.prototype), ObjectSetPrototypeOf(Stream, EE), Stream.prototype.pipe = function(dest, options) {\n const source = this;\n function ondata(chunk) {\n if (dest.writable && dest.write(chunk) === !1 && source.pause)\n source.pause();\n }\n source.on(\"data\", ondata);\n function ondrain() {\n if (source.readable && source.resume)\n source.resume();\n }\n if (dest.on(\"drain\", ondrain), !dest._isStdio && (!options || options.end !== !1))\n source.on(\"end\", onend), source.on(\"close\", onclose);\n let didOnEnd = !1;\n function onend() {\n if (didOnEnd)\n return;\n didOnEnd = !0, dest.end();\n }\n function onclose() {\n if (didOnEnd)\n return;\n if (didOnEnd = !0, typeof dest.destroy === \"function\")\n dest.destroy();\n }\n function onerror(er) {\n if (cleanup(), EE.listenerCount(this, \"error\") === 0)\n this.emit(\"error\", er);\n }\n prependListener(source, \"error\", onerror), prependListener(dest, \"error\", onerror);\n function cleanup() {\n source.removeListener(\"data\", ondata), dest.removeListener(\"drain\", ondrain), source.removeListener(\"end\", onend), source.removeListener(\"close\", onclose), source.removeListener(\"error\", onerror), dest.removeListener(\"error\", onerror), source.removeListener(\"end\", cleanup), source.removeListener(\"close\", cleanup), dest.removeListener(\"close\", cleanup);\n }\n return source.on(\"end\", cleanup), source.on(\"close\", cleanup), dest.on(\"close\", cleanup), dest.emit(\"pipe\", source), dest;\n };\n function prependListener(emitter, event, fn) {\n if (typeof emitter.prependListener === \"function\")\n return emitter.prependListener(event, fn);\n if (!emitter._events || !emitter._events[event])\n emitter.on(event, fn);\n else if (ArrayIsArray2(emitter._events[event]))\n emitter._events[event].unshift(fn);\n else\n emitter._events[event] = [fn, emitter._events[event]];\n }\n module.exports = {\n Stream,\n prependListener\n };\n }\n}), require_add_abort_signal = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/add-abort-signal.js\"(exports, module) {\n var { AbortError: AbortError2, codes } = require_errors(), eos = require_end_of_stream(), { ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE2 } = codes, validateAbortSignal = (signal, name) => {\n if (typeof signal !== \"object\" || !(\"aborted\" in signal))\n throw new ERR_INVALID_ARG_TYPE2(name, \"AbortSignal\", signal);\n };\n function isNodeStream(obj) {\n return !!(obj && typeof obj.pipe === \"function\");\n }\n module.exports.addAbortSignal = function addAbortSignal(signal, stream) {\n if (validateAbortSignal(signal, \"signal\"), !isNodeStream(stream))\n throw new ERR_INVALID_ARG_TYPE2(\"stream\", \"stream.Stream\", stream);\n return module.exports.addAbortSignalNoValidate(signal, stream);\n }, module.exports.addAbortSignalNoValidate = function(signal, stream) {\n if (typeof signal !== \"object\" || !(\"aborted\" in signal))\n return stream;\n const onAbort = () => {\n stream.destroy(new AbortError2(void 0, {\n cause: signal.reason\n }));\n };\n if (signal.aborted)\n onAbort();\n else\n signal.addEventListener(\"abort\", onAbort), eos(stream, () => signal.removeEventListener(\"abort\", onAbort));\n return stream;\n };\n }\n}), require_state = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/state.js\"(exports, module) {\n var { MathFloor, NumberIsInteger } = require_primordials(), { ERR_INVALID_ARG_VALUE: ERR_INVALID_ARG_VALUE2 } = require_errors().codes;\n function highWaterMarkFrom(options, isDuplex, duplexKey) {\n return options.highWaterMark != null \? options.highWaterMark : isDuplex \? options[duplexKey] : null;\n }\n function getDefaultHighWaterMark(objectMode) {\n return objectMode \? 16 : 16384;\n }\n function getHighWaterMark(state, options, duplexKey, isDuplex) {\n const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);\n if (hwm != null) {\n if (!NumberIsInteger(hwm) || hwm < 0) {\n const name = isDuplex \? `options.${duplexKey}` : \"options.highWaterMark\";\n throw new ERR_INVALID_ARG_VALUE2(name, hwm);\n }\n return MathFloor(hwm);\n }\n return getDefaultHighWaterMark(state.objectMode);\n }\n module.exports = {\n getHighWaterMark,\n getDefaultHighWaterMark\n };\n }\n}), require_from = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/from.js\"(exports, module) {\n var { PromisePrototypeThen, SymbolAsyncIterator, SymbolIterator } = require_primordials(), { ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE2, ERR_STREAM_NULL_VALUES } = require_errors().codes;\n function from(Readable, iterable, opts) {\n let iterator;\n if (typeof iterable === \"string\" || iterable instanceof @Buffer)\n return new Readable({\n objectMode: !0,\n ...opts,\n read() {\n this.push(iterable), this.push(null);\n }\n });\n let isAsync;\n if (iterable && iterable[SymbolAsyncIterator])\n isAsync = !0, iterator = iterable[SymbolAsyncIterator]();\n else if (iterable && iterable[SymbolIterator])\n isAsync = !1, iterator = iterable[SymbolIterator]();\n else\n throw new ERR_INVALID_ARG_TYPE2(\"iterable\", [\"Iterable\"], iterable);\n const readable = new Readable({\n objectMode: !0,\n highWaterMark: 1,\n ...opts\n });\n let reading = !1;\n readable._read = function() {\n if (!reading)\n reading = !0, next();\n }, readable._destroy = function(error, cb) {\n PromisePrototypeThen(close(error), () => runOnNextTick(cb, error), (e) => runOnNextTick(cb, e || error));\n };\n async function close(error) {\n const hadError = error !== void 0 && error !== null, hasThrow = typeof iterator.throw === \"function\";\n if (hadError && hasThrow) {\n const { value, done } = await iterator.throw(error);\n if (await value, done)\n return;\n }\n if (typeof iterator.return === \"function\") {\n const { value } = await iterator.return();\n await value;\n }\n }\n async function next() {\n for (;; ) {\n try {\n const { value, done } = isAsync \? await iterator.next() : iterator.next();\n if (done)\n readable.push(null);\n else {\n const res = value && typeof value.then === \"function\" \? await value : value;\n if (res === null)\n throw reading = !1, new ERR_STREAM_NULL_VALUES;\n else if (readable.push(res))\n continue;\n else\n reading = !1;\n }\n } catch (err) {\n readable.destroy(err);\n }\n break;\n }\n }\n return readable;\n }\n module.exports = from;\n }\n}), _ReadableFromWeb, _ReadableFromWebForUndici, require_readable = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/readable.js\"(exports, module) {\n var {\n ArrayPrototypeIndexOf,\n NumberIsInteger,\n NumberIsNaN,\n NumberParseInt,\n ObjectDefineProperties,\n ObjectKeys,\n ObjectSetPrototypeOf,\n Promise: Promise2,\n SafeSet,\n SymbolAsyncIterator,\n Symbol: Symbol2\n } = require_primordials(), ReadableState = @lazy(\"bun:stream\").ReadableState, { Stream, prependListener } = require_legacy();\n function Readable(options) {\n if (!(this instanceof Readable))\n return new Readable(options);\n const isDuplex = this instanceof require_duplex();\n if (this._readableState = new ReadableState(options, this, isDuplex), options) {\n const { read, destroy: destroy2, construct, signal } = options;\n if (typeof read === \"function\")\n this._read = read;\n if (typeof destroy2 === \"function\")\n this._destroy = destroy2;\n if (typeof construct === \"function\")\n this._construct = construct;\n if (signal && !isDuplex)\n addAbortSignal(signal, this);\n }\n Stream.@call(this, options), destroyImpl.construct(this, () => {\n if (this._readableState.needReadable)\n maybeReadMore(this, this._readableState);\n });\n }\n Readable.prototype = {}, ObjectSetPrototypeOf(Readable.prototype, Stream.prototype), ObjectSetPrototypeOf(Readable, Stream), Readable.prototype.on = function(ev, fn) {\n const res = Stream.prototype.on.@call(this, ev, fn), state = this._readableState;\n if (ev === \"data\") {\n if (state.readableListening = this.listenerCount(\"readable\") > 0, state.flowing !== !1)\n this.resume();\n } else if (ev === \"readable\") {\n if (!state.endEmitted && !state.readableListening) {\n if (state.readableListening = state.needReadable = !0, state.flowing = !1, state.emittedReadable = !1, state.length)\n emitReadable(this, state);\n else if (!state.reading)\n runOnNextTick(nReadingNextTick, this);\n } else if (state.endEmitted)\n ;\n }\n return res;\n };\n\n class ReadableFromWeb extends Readable {\n #reader;\n #closed;\n #pendingChunks;\n #stream;\n constructor(options, stream) {\n const { objectMode, highWaterMark, encoding, signal } = options;\n super({\n objectMode,\n highWaterMark,\n encoding,\n signal\n });\n this.#pendingChunks = [], this.#reader = @undefined, this.#stream = stream, this.#closed = !1;\n }\n #drainPending() {\n var pendingChunks = this.#pendingChunks, pendingChunksI = 0, pendingChunksCount = pendingChunks.length;\n for (;pendingChunksI < pendingChunksCount; pendingChunksI++) {\n const chunk = pendingChunks[pendingChunksI];\n if (pendingChunks[pendingChunksI] = @undefined, !this.push(chunk, @undefined))\n return this.#pendingChunks = pendingChunks.slice(pendingChunksI + 1), !0;\n }\n if (pendingChunksCount > 0)\n this.#pendingChunks = [];\n return !1;\n }\n #handleDone(reader) {\n reader.releaseLock(), this.#reader = @undefined, this.#closed = !0, this.push(null);\n return;\n }\n async _read() {\n var stream = this.#stream, reader = this.#reader;\n if (stream)\n reader = this.#reader = stream.getReader(), this.#stream = @undefined;\n else if (this.#drainPending())\n return;\n var deferredError;\n try {\n do {\n var done = !1, value;\n const firstResult = reader.readMany();\n if (@isPromise(firstResult)) {\n if ({ done, value } = await firstResult, this.#closed) {\n this.#pendingChunks.push(...value);\n return;\n }\n } else\n ({ done, value } = firstResult);\n if (done) {\n this.#handleDone(reader);\n return;\n }\n if (!this.push(value[0])) {\n this.#pendingChunks = value.slice(1);\n return;\n }\n for (let i = 1, count = value.length;i < count; i++)\n if (!this.push(value[i])) {\n this.#pendingChunks = value.slice(i + 1);\n return;\n }\n } while (!this.#closed);\n } catch (e) {\n deferredError = e;\n } finally {\n if (deferredError)\n throw deferredError;\n }\n }\n _destroy(error, callback) {\n if (!this.#closed) {\n var reader = this.#reader;\n if (reader)\n this.#reader = @undefined, reader.cancel(error).finally(() => {\n this.#closed = !0, callback(error);\n });\n return;\n }\n try {\n callback(error);\n } catch (error2) {\n globalThis.reportError(error2);\n }\n }\n }\n _ReadableFromWebForUndici = ReadableFromWeb;\n function newStreamReadableFromReadableStream(readableStream, options = {}) {\n if (!isReadableStream(readableStream))\n throw new ERR_INVALID_ARG_TYPE2(\"readableStream\", \"ReadableStream\", readableStream);\n validateObject(options, \"options\");\n const {\n highWaterMark,\n encoding,\n objectMode = !1,\n signal\n } = options;\n if (encoding !== @undefined && !@Buffer.isEncoding(encoding))\n throw new ERR_INVALID_ARG_VALUE(encoding, \"options.encoding\");\n return validateBoolean(objectMode, \"options.objectMode\"), getNativeReadableStream(Readable, readableStream, options) || new ReadableFromWeb({\n highWaterMark,\n encoding,\n objectMode,\n signal\n }, readableStream);\n }\n module.exports = Readable, _ReadableFromWeb = newStreamReadableFromReadableStream;\n var { addAbortSignal } = require_add_abort_signal(), eos = require_end_of_stream();\n const { maybeReadMore: _maybeReadMore, resume, emitReadable: _emitReadable, onEofChunk } = @lazy(\"bun:stream\");\n function maybeReadMore(stream, state) {\n process.nextTick(_maybeReadMore, stream, state);\n }\n function emitReadable(stream, state) {\n _emitReadable(stream, state);\n }\n var destroyImpl = require_destroy(), {\n aggregateTwoErrors,\n codes: {\n ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE2,\n ERR_METHOD_NOT_IMPLEMENTED,\n ERR_OUT_OF_RANGE,\n ERR_STREAM_PUSH_AFTER_EOF,\n ERR_STREAM_UNSHIFT_AFTER_END_EVENT\n }\n } = require_errors(), { validateObject } = require_validators(), from = require_from(), nop = () => {\n }, { errorOrDestroy: errorOrDestroy2 } = destroyImpl;\n Readable.prototype.destroy = destroyImpl.destroy, Readable.prototype._undestroy = destroyImpl.undestroy, Readable.prototype._destroy = function(err, cb) {\n cb(err);\n }, Readable.prototype[EE.captureRejectionSymbol] = function(err) {\n this.destroy(err);\n }, Readable.prototype.push = function(chunk, encoding) {\n return readableAddChunk(this, chunk, encoding, !1);\n }, Readable.prototype.unshift = function(chunk, encoding) {\n return readableAddChunk(this, chunk, encoding, !0);\n };\n function readableAddChunk(stream, chunk, encoding, addToFront) {\n const state = stream._readableState;\n let err;\n if (!state.objectMode) {\n if (typeof chunk === \"string\") {\n if (encoding = encoding || state.defaultEncoding, state.encoding !== encoding)\n if (addToFront && state.encoding)\n chunk = @Buffer.from(chunk, encoding).toString(state.encoding);\n else\n chunk = @Buffer.from(chunk, encoding), encoding = \"\";\n } else if (chunk instanceof @Buffer)\n encoding = \"\";\n else if (Stream._isUint8Array(chunk)) {\n if (addToFront || !state.decoder)\n chunk = Stream._uint8ArrayToBuffer(chunk);\n encoding = \"\";\n } else if (chunk != null)\n err = new ERR_INVALID_ARG_TYPE2(\"chunk\", [\"string\", \"Buffer\", \"Uint8Array\"], chunk);\n }\n if (err)\n errorOrDestroy2(stream, err);\n else if (chunk === null)\n state.reading = !1, onEofChunk(stream, state);\n else if (state.objectMode || chunk && chunk.length > 0)\n if (addToFront)\n if (state.endEmitted)\n errorOrDestroy2(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT);\n else if (state.destroyed || state.errored)\n return !1;\n else\n addChunk(stream, state, chunk, !0);\n else if (state.ended)\n errorOrDestroy2(stream, new ERR_STREAM_PUSH_AFTER_EOF);\n else if (state.destroyed || state.errored)\n return !1;\n else if (state.reading = !1, state.decoder && !encoding)\n if (chunk = state.decoder.write(chunk), state.objectMode || chunk.length !== 0)\n addChunk(stream, state, chunk, !1);\n else\n maybeReadMore(stream, state);\n else\n addChunk(stream, state, chunk, !1);\n else if (!addToFront)\n state.reading = !1, maybeReadMore(stream, state);\n return !state.ended && (state.length < state.highWaterMark || state.length === 0);\n }\n function addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync && stream.listenerCount(\"data\") > 0) {\n if (state.multiAwaitDrain)\n state.awaitDrainWriters.clear();\n else\n state.awaitDrainWriters = null;\n state.dataEmitted = !0, stream.emit(\"data\", chunk);\n } else {\n if (state.length += state.objectMode \? 1 : chunk.length, addToFront)\n state.buffer.unshift(chunk);\n else\n state.buffer.push(chunk);\n if (state.needReadable)\n emitReadable(stream, state);\n }\n maybeReadMore(stream, state);\n }\n Readable.prototype.isPaused = function() {\n const state = this._readableState;\n return state.paused === !0 || state.flowing === !1;\n }, Readable.prototype.setEncoding = function(enc) {\n const decoder = new StringDecoder(enc);\n this._readableState.decoder = decoder, this._readableState.encoding = this._readableState.decoder.encoding;\n const buffer = this._readableState.buffer;\n let content = \"\";\n for (let i = buffer.length;i > 0; i--)\n content += decoder.write(buffer.shift());\n if (content !== \"\")\n buffer.push(content);\n return this._readableState.length = content.length, this;\n };\n var MAX_HWM = 1073741824;\n function computeNewHighWaterMark(n) {\n if (n > MAX_HWM)\n throw new ERR_OUT_OF_RANGE(\"size\", \"<= 1GiB\", n);\n else\n n--, n |= n >>> 1, n |= n >>> 2, n |= n >>> 4, n |= n >>> 8, n |= n >>> 16, n++;\n return n;\n }\n function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended)\n return 0;\n if (state.objectMode)\n return 1;\n if (NumberIsNaN(n)) {\n if (state.flowing && state.length)\n return state.buffer.first().length;\n return state.length;\n }\n if (n <= state.length)\n return n;\n return state.ended \? state.length : 0;\n }\n Readable.prototype.read = function(n) {\n if (!NumberIsInteger(n))\n n = NumberParseInt(n, 10);\n const state = this._readableState, nOrig = n;\n if (n > state.highWaterMark)\n state.highWaterMark = computeNewHighWaterMark(n);\n if (n !== 0)\n state.emittedReadable = !1;\n if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 \? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {\n if (state.length === 0 && state.ended)\n endReadable(this);\n else\n emitReadable(this, state);\n return null;\n }\n if (n = howMuchToRead(n, state), n === 0 && state.ended) {\n if (state.length === 0)\n endReadable(this);\n return null;\n }\n let doRead = state.needReadable;\n if (state.length === 0 || state.length - n < state.highWaterMark)\n doRead = !0;\n if (state.ended || state.reading || state.destroyed || state.errored || !state.constructed)\n doRead = !1;\n else if (doRead) {\n if (state.reading = !0, state.sync = !0, state.length === 0)\n state.needReadable = !0;\n try {\n var result = this._read(state.highWaterMark);\n if (@isPromise(result)) {\n const peeked = Bun.peek(result);\n if (peeked !== result)\n result = peeked;\n }\n if (@isPromise(result) && result\?.then && @isCallable(result.then))\n result.then(nop, function(err) {\n errorOrDestroy2(this, err);\n });\n } catch (err) {\n errorOrDestroy2(this, err);\n }\n if (state.sync = !1, !state.reading)\n n = howMuchToRead(nOrig, state);\n }\n let ret;\n if (n > 0)\n ret = fromList(n, state);\n else\n ret = null;\n if (ret === null)\n state.needReadable = state.length <= state.highWaterMark, n = 0;\n else if (state.length -= n, state.multiAwaitDrain)\n state.awaitDrainWriters.clear();\n else\n state.awaitDrainWriters = null;\n if (state.length === 0) {\n if (!state.ended)\n state.needReadable = !0;\n if (nOrig !== n && state.ended)\n endReadable(this);\n }\n if (ret !== null && !state.errorEmitted && !state.closeEmitted)\n state.dataEmitted = !0, this.emit(\"data\", ret);\n return ret;\n }, Readable.prototype._read = function(n) {\n throw new ERR_METHOD_NOT_IMPLEMENTED(\"_read()\");\n }, Readable.prototype.pipe = function(dest, pipeOpts) {\n const src = this, state = this._readableState;\n if (state.pipes.length === 1) {\n if (!state.multiAwaitDrain)\n state.multiAwaitDrain = !0, state.awaitDrainWriters = new SafeSet(state.awaitDrainWriters \? [state.awaitDrainWriters] : []);\n }\n state.pipes.push(dest);\n const endFn = (!pipeOpts || pipeOpts.end !== !1) && dest !== process.stdout && dest !== process.stderr \? onend : unpipe;\n if (state.endEmitted)\n runOnNextTick(endFn);\n else\n src.once(\"end\", endFn);\n dest.on(\"unpipe\", onunpipe);\n function onunpipe(readable, unpipeInfo) {\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === !1)\n unpipeInfo.hasUnpiped = !0, cleanup();\n }\n }\n function onend() {\n dest.end();\n }\n let ondrain, cleanedUp = !1;\n function cleanup() {\n if (dest.removeListener(\"close\", onclose), dest.removeListener(\"finish\", onfinish), ondrain)\n dest.removeListener(\"drain\", ondrain);\n if (dest.removeListener(\"error\", onerror), dest.removeListener(\"unpipe\", onunpipe), src.removeListener(\"end\", onend), src.removeListener(\"end\", unpipe), src.removeListener(\"data\", ondata), cleanedUp = !0, ondrain && state.awaitDrainWriters && (!dest._writableState || dest._writableState.needDrain))\n ondrain();\n }\n function pause() {\n if (!cleanedUp) {\n if (state.pipes.length === 1 && state.pipes[0] === dest)\n state.awaitDrainWriters = dest, state.multiAwaitDrain = !1;\n else if (state.pipes.length > 1 && state.pipes.includes(dest))\n state.awaitDrainWriters.add(dest);\n src.pause();\n }\n if (!ondrain)\n ondrain = pipeOnDrain(src, dest), dest.on(\"drain\", ondrain);\n }\n src.on(\"data\", ondata);\n function ondata(chunk) {\n if (dest.write(chunk) === !1)\n pause();\n }\n function onerror(er) {\n if (unpipe(), dest.removeListener(\"error\", onerror), dest.listenerCount(\"error\") === 0) {\n const s = dest._writableState || dest._readableState;\n if (s && !s.errorEmitted)\n errorOrDestroy2(dest, er);\n else\n dest.emit(\"error\", er);\n }\n }\n prependListener(dest, \"error\", onerror);\n function onclose() {\n dest.removeListener(\"finish\", onfinish), unpipe();\n }\n dest.once(\"close\", onclose);\n function onfinish() {\n dest.removeListener(\"close\", onclose), unpipe();\n }\n dest.once(\"finish\", onfinish);\n function unpipe() {\n src.unpipe(dest);\n }\n if (dest.emit(\"pipe\", src), dest.writableNeedDrain === !0) {\n if (state.flowing)\n pause();\n } else if (!state.flowing)\n src.resume();\n return dest;\n };\n function pipeOnDrain(src, dest) {\n return function pipeOnDrainFunctionResult() {\n const state = src._readableState;\n if (state.awaitDrainWriters === dest)\n state.awaitDrainWriters = null;\n else if (state.multiAwaitDrain)\n state.awaitDrainWriters.delete(dest);\n if ((!state.awaitDrainWriters || state.awaitDrainWriters.size === 0) && src.listenerCount(\"data\"))\n src.resume();\n };\n }\n Readable.prototype.unpipe = function(dest) {\n const state = this._readableState, unpipeInfo = {\n hasUnpiped: !1\n };\n if (state.pipes.length === 0)\n return this;\n if (!dest) {\n const dests = state.pipes;\n state.pipes = [], this.pause();\n for (let i = 0;i < dests.length; i++)\n dests[i].emit(\"unpipe\", this, {\n hasUnpiped: !1\n });\n return this;\n }\n const index = ArrayPrototypeIndexOf(state.pipes, dest);\n if (index === -1)\n return this;\n if (state.pipes.splice(index, 1), state.pipes.length === 0)\n this.pause();\n return dest.emit(\"unpipe\", this, unpipeInfo), this;\n }, Readable.prototype.addListener = Readable.prototype.on, Readable.prototype.removeListener = function(ev, fn) {\n const res = Stream.prototype.removeListener.@call(this, ev, fn);\n if (ev === \"readable\")\n runOnNextTick(updateReadableListening, this);\n return res;\n }, Readable.prototype.off = Readable.prototype.removeListener, Readable.prototype.removeAllListeners = function(ev) {\n const res = Stream.prototype.removeAllListeners.@apply(this, arguments);\n if (ev === \"readable\" || ev === void 0)\n runOnNextTick(updateReadableListening, this);\n return res;\n };\n function updateReadableListening(self) {\n const state = self._readableState;\n if (state.readableListening = self.listenerCount(\"readable\") > 0, state.resumeScheduled && state.paused === !1)\n state.flowing = !0;\n else if (self.listenerCount(\"data\") > 0)\n self.resume();\n else if (!state.readableListening)\n state.flowing = null;\n }\n function nReadingNextTick(self) {\n self.read(0);\n }\n Readable.prototype.resume = function() {\n const state = this._readableState;\n if (!state.flowing)\n state.flowing = !state.readableListening, resume(this, state);\n return state.paused = !1, this;\n }, Readable.prototype.pause = function() {\n if (this._readableState.flowing !== !1)\n this._readableState.flowing = !1, this.emit(\"pause\");\n return this._readableState.paused = !0, this;\n }, Readable.prototype.wrap = function(stream) {\n let paused = !1;\n stream.on(\"data\", (chunk) => {\n if (!this.push(chunk) && stream.pause)\n paused = !0, stream.pause();\n }), stream.on(\"end\", () => {\n this.push(null);\n }), stream.on(\"error\", (err) => {\n errorOrDestroy2(this, err);\n }), stream.on(\"close\", () => {\n this.destroy();\n }), stream.on(\"destroy\", () => {\n this.destroy();\n }), this._read = () => {\n if (paused && stream.resume)\n paused = !1, stream.resume();\n };\n const streamKeys = ObjectKeys(stream);\n for (let j = 1;j < streamKeys.length; j++) {\n const i = streamKeys[j];\n if (this[i] === void 0 && typeof stream[i] === \"function\")\n this[i] = stream[i].bind(stream);\n }\n return this;\n }, Readable.prototype[SymbolAsyncIterator] = function() {\n return streamToAsyncIterator(this);\n }, Readable.prototype.iterator = function(options) {\n if (options !== void 0)\n validateObject(options, \"options\");\n return streamToAsyncIterator(this, options);\n };\n function streamToAsyncIterator(stream, options) {\n if (typeof stream.read !== \"function\")\n stream = Readable.wrap(stream, {\n objectMode: !0\n });\n const iter = createAsyncIterator(stream, options);\n return iter.stream = stream, iter;\n }\n async function* createAsyncIterator(stream, options) {\n let callback = nop;\n function next(resolve) {\n if (this === stream)\n callback(), callback = nop;\n else\n callback = resolve;\n }\n stream.on(\"readable\", next);\n let error;\n const cleanup = eos(stream, {\n writable: !1\n }, (err) => {\n error = err \? aggregateTwoErrors(error, err) : null, callback(), callback = nop;\n });\n try {\n while (!0) {\n const chunk = stream.destroyed \? null : stream.read();\n if (chunk !== null)\n yield chunk;\n else if (error)\n throw error;\n else if (error === null)\n return;\n else\n await new Promise2(next);\n }\n } catch (err) {\n throw error = aggregateTwoErrors(error, err), error;\n } finally {\n if ((error || (options === null || options === void 0 \? void 0 : options.destroyOnReturn) !== !1) && (error === void 0 || stream._readableState.autoDestroy))\n destroyImpl.destroyer(stream, null);\n else\n stream.off(\"readable\", next), cleanup();\n }\n }\n ObjectDefineProperties(Readable.prototype, {\n readable: {\n get() {\n const r = this._readableState;\n return !!r && r.readable !== !1 && !r.destroyed && !r.errorEmitted && !r.endEmitted;\n },\n set(val) {\n if (this._readableState)\n this._readableState.readable = !!val;\n }\n },\n readableDidRead: {\n enumerable: !1,\n get: function() {\n return this._readableState.dataEmitted;\n }\n },\n readableAborted: {\n enumerable: !1,\n get: function() {\n return !!(this._readableState.readable !== !1 && (this._readableState.destroyed || this._readableState.errored) && !this._readableState.endEmitted);\n }\n },\n readableHighWaterMark: {\n enumerable: !1,\n get: function() {\n return this._readableState.highWaterMark;\n }\n },\n readableBuffer: {\n enumerable: !1,\n get: function() {\n return this._readableState && this._readableState.buffer;\n }\n },\n readableFlowing: {\n enumerable: !1,\n get: function() {\n return this._readableState.flowing;\n },\n set: function(state) {\n if (this._readableState)\n this._readableState.flowing = state;\n }\n },\n readableLength: {\n enumerable: !1,\n get() {\n return this._readableState.length;\n }\n },\n readableObjectMode: {\n enumerable: !1,\n get() {\n return this._readableState \? this._readableState.objectMode : !1;\n }\n },\n readableEncoding: {\n enumerable: !1,\n get() {\n return this._readableState \? this._readableState.encoding : null;\n }\n },\n errored: {\n enumerable: !1,\n get() {\n return this._readableState \? this._readableState.errored : null;\n }\n },\n closed: {\n get() {\n return this._readableState \? this._readableState.closed : !1;\n }\n },\n destroyed: {\n enumerable: !1,\n get() {\n return this._readableState \? this._readableState.destroyed : !1;\n },\n set(value) {\n if (!this._readableState)\n return;\n this._readableState.destroyed = value;\n }\n },\n readableEnded: {\n enumerable: !1,\n get() {\n return this._readableState \? this._readableState.endEmitted : !1;\n }\n }\n }), Readable._fromList = fromList;\n function fromList(n, state) {\n if (state.length === 0)\n return null;\n let ret;\n if (state.objectMode)\n ret = state.buffer.shift();\n else if (!n || n >= state.length) {\n if (state.decoder)\n ret = state.buffer.join(\"\");\n else if (state.buffer.length === 1)\n ret = state.buffer.first();\n else\n ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else\n ret = state.buffer.consume(n, state.decoder);\n return ret;\n }\n function endReadable(stream) {\n const state = stream._readableState;\n if (!state.endEmitted)\n state.ended = !0, runOnNextTick(endReadableNT, state, stream);\n }\n function endReadableNT(state, stream) {\n if (!state.errored && !state.closeEmitted && !state.endEmitted && state.length === 0) {\n if (state.endEmitted = !0, stream.emit(\"end\"), stream.writable && stream.allowHalfOpen === !1)\n runOnNextTick(endWritableNT, stream);\n else if (state.autoDestroy) {\n const wState = stream._writableState;\n if (!wState || wState.autoDestroy && (wState.finished || wState.writable === !1))\n stream.destroy();\n }\n }\n }\n function endWritableNT(stream) {\n if (stream.writable && !stream.writableEnded && !stream.destroyed)\n stream.end();\n }\n Readable.from = function(iterable, opts) {\n return from(Readable, iterable, opts);\n };\n var webStreamsAdapters = {\n newStreamReadableFromReadableStream,\n newReadableStreamFromStreamReadable(streamReadable, options = {}) {\n if (typeof streamReadable\?._readableState !== \"object\")\n throw new ERR_INVALID_ARG_TYPE2(\"streamReadable\", \"stream.Readable\", streamReadable);\n var { isDestroyed, isReadable } = require_utils();\n if (isDestroyed(streamReadable) || !isReadable(streamReadable)) {\n const readable = new @ReadableStream;\n return readable.cancel(), readable;\n }\n const { readableObjectMode: objectMode, readableHighWaterMark: highWaterMark } = streamReadable, strategy = ((strategy2) => {\n if (strategy2)\n return strategy2;\n if (objectMode)\n return new CountQueuingStrategy({ highWaterMark });\n return { highWaterMark };\n })(options\?.strategy);\n let controller;\n function onData(chunk) {\n if (controller.enqueue(chunk), controller.desiredSize <= 0)\n streamReadable.pause();\n }\n streamReadable.pause();\n const cleanup = eos(streamReadable, (error) => {\n if (error\?.code === \"ERR_STREAM_PREMATURE_CLOSE\")\n error = new AbortError(@undefined, { cause: error });\n if (cleanup(), streamReadable.on(\"error\", () => {\n }), error)\n return controller.error(error);\n controller.close();\n });\n return streamReadable.on(\"data\", onData), new @ReadableStream({\n start(c) {\n controller = c;\n },\n pull() {\n streamReadable.resume();\n },\n cancel(reason) {\n destroy(streamReadable, reason);\n }\n }, strategy);\n }\n };\n Readable.fromWeb = function(readableStream, options) {\n return webStreamsAdapters.newStreamReadableFromReadableStream(readableStream, options);\n }, Readable.toWeb = function(streamReadable, options) {\n return webStreamsAdapters.newReadableStreamFromStreamReadable(streamReadable, options);\n }, Readable.wrap = function(src, options) {\n var _ref, _src$readableObjectMo;\n return new Readable({\n objectMode: (_ref = (_src$readableObjectMo = src.readableObjectMode) !== null && _src$readableObjectMo !== void 0 \? _src$readableObjectMo : src.objectMode) !== null && _ref !== void 0 \? _ref : !0,\n ...options,\n destroy(err, callback) {\n destroyImpl.destroyer(src, err), callback(err);\n }\n }).wrap(src);\n };\n }\n}), require_writable = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/writable.js\"(exports, module) {\n var {\n ArrayPrototypeSlice,\n Error: Error2,\n FunctionPrototypeSymbolHasInstance,\n ObjectDefineProperty,\n ObjectDefineProperties,\n ObjectSetPrototypeOf,\n StringPrototypeToLowerCase,\n Symbol: Symbol2,\n SymbolHasInstance\n } = require_primordials(), Stream = require_legacy().Stream, destroyImpl = require_destroy(), { addAbortSignal } = require_add_abort_signal(), { getHighWaterMark, getDefaultHighWaterMark } = require_state(), {\n ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE2,\n ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK,\n ERR_STREAM_CANNOT_PIPE,\n ERR_STREAM_DESTROYED,\n ERR_STREAM_ALREADY_FINISHED,\n ERR_STREAM_NULL_VALUES,\n ERR_STREAM_WRITE_AFTER_END,\n ERR_UNKNOWN_ENCODING\n } = require_errors().codes, { errorOrDestroy: errorOrDestroy2 } = destroyImpl;\n function Writable(options = {}) {\n const isDuplex = this instanceof require_duplex();\n if (!isDuplex && !FunctionPrototypeSymbolHasInstance(Writable, this))\n return new Writable(options);\n if (this._writableState = new WritableState(options, this, isDuplex), options) {\n if (typeof options.write === \"function\")\n this._write = options.write;\n if (typeof options.writev === \"function\")\n this._writev = options.writev;\n if (typeof options.destroy === \"function\")\n this._destroy = options.destroy;\n if (typeof options.final === \"function\")\n this._final = options.final;\n if (typeof options.construct === \"function\")\n this._construct = options.construct;\n if (options.signal)\n addAbortSignal(options.signal, this);\n }\n Stream.@call(this, options), destroyImpl.construct(this, () => {\n const state = this._writableState;\n if (!state.writing)\n clearBuffer(this, state);\n finishMaybe(this, state);\n });\n }\n Writable.prototype = {}, ObjectSetPrototypeOf(Writable.prototype, Stream.prototype), ObjectSetPrototypeOf(Writable, Stream), module.exports = Writable;\n function nop() {\n }\n var kOnFinished = Symbol2(\"kOnFinished\");\n function WritableState(options, stream, isDuplex) {\n if (typeof isDuplex !== \"boolean\")\n isDuplex = stream instanceof require_duplex();\n if (this.objectMode = !!(options && options.objectMode), isDuplex)\n this.objectMode = this.objectMode || !!(options && options.writableObjectMode);\n this.highWaterMark = options \? getHighWaterMark(this, options, \"writableHighWaterMark\", isDuplex) : getDefaultHighWaterMark(!1), this.finalCalled = !1, this.needDrain = !1, this.ending = !1, this.ended = !1, this.finished = !1, this.destroyed = !1;\n const noDecode = !!(options && options.decodeStrings === !1);\n this.decodeStrings = !noDecode, this.defaultEncoding = options && options.defaultEncoding || \"utf8\", this.length = 0, this.writing = !1, this.corked = 0, this.sync = !0, this.bufferProcessing = !1, this.onwrite = onwrite.bind(void 0, stream), this.writecb = null, this.writelen = 0, this.afterWriteTickInfo = null, resetBuffer(this), this.pendingcb = 0, this.constructed = !0, this.prefinished = !1, this.errorEmitted = !1, this.emitClose = !options || options.emitClose !== !1, this.autoDestroy = !options || options.autoDestroy !== !1, this.errored = null, this.closed = !1, this.closeEmitted = !1, this[kOnFinished] = [];\n }\n WritableState.prototype = {};\n function resetBuffer(state) {\n state.buffered = [], state.bufferedIndex = 0, state.allBuffers = !0, state.allNoop = !0;\n }\n WritableState.prototype.getBuffer = function getBuffer() {\n return ArrayPrototypeSlice(this.buffered, this.bufferedIndex);\n }, ObjectDefineProperty(WritableState.prototype, \"bufferedRequestCount\", {\n get() {\n return this.buffered.length - this.bufferedIndex;\n }\n }), ObjectDefineProperty(Writable, SymbolHasInstance, {\n value: function(object) {\n if (FunctionPrototypeSymbolHasInstance(this, object))\n return !0;\n if (this !== Writable)\n return !1;\n return object && object._writableState instanceof WritableState;\n }\n }), Writable.prototype.pipe = function() {\n errorOrDestroy2(this, new ERR_STREAM_CANNOT_PIPE);\n };\n function _write(stream, chunk, encoding, cb) {\n const state = stream._writableState;\n if (typeof encoding === \"function\")\n cb = encoding, encoding = state.defaultEncoding;\n else {\n if (!encoding)\n encoding = state.defaultEncoding;\n else if (encoding !== \"buffer\" && !@Buffer.isEncoding(encoding))\n throw new ERR_UNKNOWN_ENCODING(encoding);\n if (typeof cb !== \"function\")\n cb = nop;\n }\n if (chunk === null)\n throw new ERR_STREAM_NULL_VALUES;\n else if (!state.objectMode)\n if (typeof chunk === \"string\") {\n if (state.decodeStrings !== !1)\n chunk = @Buffer.from(chunk, encoding), encoding = \"buffer\";\n } else if (chunk instanceof @Buffer)\n encoding = \"buffer\";\n else if (Stream._isUint8Array(chunk))\n chunk = Stream._uint8ArrayToBuffer(chunk), encoding = \"buffer\";\n else\n throw new ERR_INVALID_ARG_TYPE2(\"chunk\", [\"string\", \"Buffer\", \"Uint8Array\"], chunk);\n let err;\n if (state.ending)\n err = new ERR_STREAM_WRITE_AFTER_END;\n else if (state.destroyed)\n err = new ERR_STREAM_DESTROYED(\"write\");\n if (err)\n return runOnNextTick(cb, err), errorOrDestroy2(stream, err, !0), err;\n return state.pendingcb++, writeOrBuffer(stream, state, chunk, encoding, cb);\n }\n Writable.prototype.write = function(chunk, encoding, cb) {\n return _write(this, chunk, encoding, cb) === !0;\n }, Writable.prototype.cork = function() {\n this._writableState.corked++;\n }, Writable.prototype.uncork = function() {\n const state = this._writableState;\n if (state.corked) {\n if (state.corked--, !state.writing)\n clearBuffer(this, state);\n }\n }, Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n if (typeof encoding === \"string\")\n encoding = StringPrototypeToLowerCase(encoding);\n if (!@Buffer.isEncoding(encoding))\n throw new ERR_UNKNOWN_ENCODING(encoding);\n return this._writableState.defaultEncoding = encoding, this;\n };\n function writeOrBuffer(stream, state, chunk, encoding, callback) {\n const len = state.objectMode \? 1 : chunk.length;\n state.length += len;\n const ret = state.length < state.highWaterMark;\n if (!ret)\n state.needDrain = !0;\n if (state.writing || state.corked || state.errored || !state.constructed) {\n if (state.buffered.push({\n chunk,\n encoding,\n callback\n }), state.allBuffers && encoding !== \"buffer\")\n state.allBuffers = !1;\n if (state.allNoop && callback !== nop)\n state.allNoop = !1;\n } else\n state.writelen = len, state.writecb = callback, state.writing = !0, state.sync = !0, stream._write(chunk, encoding, state.onwrite), state.sync = !1;\n return ret && !state.errored && !state.destroyed;\n }\n function doWrite(stream, state, writev, len, chunk, encoding, cb) {\n if (state.writelen = len, state.writecb = cb, state.writing = !0, state.sync = !0, state.destroyed)\n state.onwrite(new ERR_STREAM_DESTROYED(\"write\"));\n else if (writev)\n stream._writev(chunk, state.onwrite);\n else\n stream._write(chunk, encoding, state.onwrite);\n state.sync = !1;\n }\n function onwriteError(stream, state, er, cb) {\n --state.pendingcb, cb(er), errorBuffer(state), errorOrDestroy2(stream, er);\n }\n function onwrite(stream, er) {\n const state = stream._writableState, sync = state.sync, cb = state.writecb;\n if (typeof cb !== \"function\") {\n errorOrDestroy2(stream, new ERR_MULTIPLE_CALLBACK);\n return;\n }\n if (state.writing = !1, state.writecb = null, state.length -= state.writelen, state.writelen = 0, er) {\n if (Error.captureStackTrace(er), !state.errored)\n state.errored = er;\n if (stream._readableState && !stream._readableState.errored)\n stream._readableState.errored = er;\n if (sync)\n runOnNextTick(onwriteError, stream, state, er, cb);\n else\n onwriteError(stream, state, er, cb);\n } else {\n if (state.buffered.length > state.bufferedIndex)\n clearBuffer(stream, state);\n if (sync)\n if (state.afterWriteTickInfo !== null && state.afterWriteTickInfo.cb === cb)\n state.afterWriteTickInfo.count++;\n else\n state.afterWriteTickInfo = {\n count: 1,\n cb,\n stream,\n state\n }, runOnNextTick(afterWriteTick, state.afterWriteTickInfo);\n else\n afterWrite(stream, state, 1, cb);\n }\n }\n function afterWriteTick({ stream, state, count, cb }) {\n return state.afterWriteTickInfo = null, afterWrite(stream, state, count, cb);\n }\n function afterWrite(stream, state, count, cb) {\n if (!state.ending && !stream.destroyed && state.length === 0 && state.needDrain)\n state.needDrain = !1, stream.emit(\"drain\");\n while (count-- > 0)\n state.pendingcb--, cb();\n if (state.destroyed)\n errorBuffer(state);\n finishMaybe(stream, state);\n }\n function errorBuffer(state) {\n if (state.writing)\n return;\n for (let n = state.bufferedIndex;n < state.buffered.length; ++n) {\n var _state$errored;\n const { chunk, callback } = state.buffered[n], len = state.objectMode \? 1 : chunk.length;\n state.length -= len, callback((_state$errored = state.errored) !== null && _state$errored !== void 0 \? _state$errored : new ERR_STREAM_DESTROYED(\"write\"));\n }\n const onfinishCallbacks = state[kOnFinished].splice(0);\n for (let i = 0;i < onfinishCallbacks.length; i++) {\n var _state$errored2;\n onfinishCallbacks[i]((_state$errored2 = state.errored) !== null && _state$errored2 !== void 0 \? _state$errored2 : new ERR_STREAM_DESTROYED(\"end\"));\n }\n resetBuffer(state);\n }\n function clearBuffer(stream, state) {\n if (state.corked || state.bufferProcessing || state.destroyed || !state.constructed)\n return;\n const { buffered, bufferedIndex, objectMode } = state, bufferedLength = buffered.length - bufferedIndex;\n if (!bufferedLength)\n return;\n let i = bufferedIndex;\n if (state.bufferProcessing = !0, bufferedLength > 1 && stream._writev) {\n state.pendingcb -= bufferedLength - 1;\n const callback = state.allNoop \? nop : (err) => {\n for (let n = i;n < buffered.length; ++n)\n buffered[n].callback(err);\n }, chunks = state.allNoop && i === 0 \? buffered : ArrayPrototypeSlice(buffered, i);\n chunks.allBuffers = state.allBuffers, doWrite(stream, state, !0, state.length, chunks, \"\", callback), resetBuffer(state);\n } else {\n do {\n const { chunk, encoding, callback } = buffered[i];\n buffered[i++] = null;\n const len = objectMode \? 1 : chunk.length;\n doWrite(stream, state, !1, len, chunk, encoding, callback);\n } while (i < buffered.length && !state.writing);\n if (i === buffered.length)\n resetBuffer(state);\n else if (i > 256)\n buffered.splice(0, i), state.bufferedIndex = 0;\n else\n state.bufferedIndex = i;\n }\n state.bufferProcessing = !1;\n }\n Writable.prototype._write = function(chunk, encoding, cb) {\n if (this._writev)\n this._writev([\n {\n chunk,\n encoding\n }\n ], cb);\n else\n throw new ERR_METHOD_NOT_IMPLEMENTED(\"_write()\");\n }, Writable.prototype._writev = null, Writable.prototype.end = function(chunk, encoding, cb, native = !1) {\n const state = this._writableState;\n if (typeof chunk === \"function\")\n cb = chunk, chunk = null, encoding = null;\n else if (typeof encoding === \"function\")\n cb = encoding, encoding = null;\n let err;\n if (chunk !== null && chunk !== void 0) {\n let ret;\n if (!native)\n ret = _write(this, chunk, encoding);\n else\n ret = this.write(chunk, encoding);\n if (ret instanceof Error2)\n err = ret;\n }\n if (state.corked)\n state.corked = 1, this.uncork();\n if (err)\n this.emit(\"error\", err);\n else if (!state.errored && !state.ending)\n state.ending = !0, finishMaybe(this, state, !0), state.ended = !0;\n else if (state.finished)\n err = new ERR_STREAM_ALREADY_FINISHED(\"end\");\n else if (state.destroyed)\n err = new ERR_STREAM_DESTROYED(\"end\");\n if (typeof cb === \"function\")\n if (err || state.finished)\n runOnNextTick(cb, err);\n else\n state[kOnFinished].push(cb);\n return this;\n };\n function needFinish(state, tag) {\n var needFinish2 = state.ending && !state.destroyed && state.constructed && state.length === 0 && !state.errored && state.buffered.length === 0 && !state.finished && !state.writing && !state.errorEmitted && !state.closeEmitted;\n return needFinish2;\n }\n function callFinal(stream, state) {\n let called = !1;\n function onFinish(err) {\n if (called) {\n errorOrDestroy2(stream, err !== null && err !== void 0 \? err : ERR_MULTIPLE_CALLBACK());\n return;\n }\n if (called = !0, state.pendingcb--, err) {\n const onfinishCallbacks = state[kOnFinished].splice(0);\n for (let i = 0;i < onfinishCallbacks.length; i++)\n onfinishCallbacks[i](err);\n errorOrDestroy2(stream, err, state.sync);\n } else if (needFinish(state))\n state.prefinished = !0, stream.emit(\"prefinish\"), state.pendingcb++, runOnNextTick(finish, stream, state);\n }\n state.sync = !0, state.pendingcb++;\n try {\n stream._final(onFinish);\n } catch (err) {\n onFinish(err);\n }\n state.sync = !1;\n }\n function prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled)\n if (typeof stream._final === \"function\" && !state.destroyed)\n state.finalCalled = !0, callFinal(stream, state);\n else\n state.prefinished = !0, stream.emit(\"prefinish\");\n }\n function finishMaybe(stream, state, sync) {\n if (!needFinish(state, stream.__id))\n return;\n if (prefinish(stream, state), state.pendingcb === 0) {\n if (sync)\n state.pendingcb++, runOnNextTick((stream2, state2) => {\n if (needFinish(state2))\n finish(stream2, state2);\n else\n state2.pendingcb--;\n }, stream, state);\n else if (needFinish(state))\n state.pendingcb++, finish(stream, state);\n }\n }\n function finish(stream, state) {\n state.pendingcb--, state.finished = !0;\n const onfinishCallbacks = state[kOnFinished].splice(0);\n for (let i = 0;i < onfinishCallbacks.length; i++)\n onfinishCallbacks[i]();\n if (stream.emit(\"finish\"), state.autoDestroy) {\n const rState = stream._readableState;\n if (!rState || rState.autoDestroy && (rState.endEmitted || rState.readable === !1))\n stream.destroy();\n }\n }\n ObjectDefineProperties(Writable.prototype, {\n closed: {\n get() {\n return this._writableState \? this._writableState.closed : !1;\n }\n },\n destroyed: {\n get() {\n return this._writableState \? this._writableState.destroyed : !1;\n },\n set(value) {\n if (this._writableState)\n this._writableState.destroyed = value;\n }\n },\n writable: {\n get() {\n const w = this._writableState;\n return !!w && w.writable !== !1 && !w.destroyed && !w.errored && !w.ending && !w.ended;\n },\n set(val) {\n if (this._writableState)\n this._writableState.writable = !!val;\n }\n },\n writableFinished: {\n get() {\n return this._writableState \? this._writableState.finished : !1;\n }\n },\n writableObjectMode: {\n get() {\n return this._writableState \? this._writableState.objectMode : !1;\n }\n },\n writableBuffer: {\n get() {\n return this._writableState && this._writableState.getBuffer();\n }\n },\n writableEnded: {\n get() {\n return this._writableState \? this._writableState.ending : !1;\n }\n },\n writableNeedDrain: {\n get() {\n const wState = this._writableState;\n if (!wState)\n return !1;\n return !wState.destroyed && !wState.ending && wState.needDrain;\n }\n },\n writableHighWaterMark: {\n get() {\n return this._writableState && this._writableState.highWaterMark;\n }\n },\n writableCorked: {\n get() {\n return this._writableState \? this._writableState.corked : 0;\n }\n },\n writableLength: {\n get() {\n return this._writableState && this._writableState.length;\n }\n },\n errored: {\n enumerable: !1,\n get() {\n return this._writableState \? this._writableState.errored : null;\n }\n },\n writableAborted: {\n enumerable: !1,\n get: function() {\n return !!(this._writableState.writable !== !1 && (this._writableState.destroyed || this._writableState.errored) && !this._writableState.finished);\n }\n }\n });\n var destroy2 = destroyImpl.destroy;\n Writable.prototype.destroy = function(err, cb) {\n const state = this._writableState;\n if (!state.destroyed && (state.bufferedIndex < state.buffered.length || state[kOnFinished].length))\n runOnNextTick(errorBuffer, state);\n return destroy2.@call(this, err, cb), this;\n }, Writable.prototype._undestroy = destroyImpl.undestroy, Writable.prototype._destroy = function(err, cb) {\n cb(err);\n }, Writable.prototype[EE.captureRejectionSymbol] = function(err) {\n this.destroy(err);\n };\n var webStreamsAdapters;\n function lazyWebStreams() {\n if (webStreamsAdapters === void 0)\n webStreamsAdapters = {};\n return webStreamsAdapters;\n }\n Writable.fromWeb = function(writableStream, options) {\n return lazyWebStreams().newStreamWritableFromWritableStream(writableStream, options);\n }, Writable.toWeb = function(streamWritable) {\n return lazyWebStreams().newWritableStreamFromStreamWritable(streamWritable);\n };\n }\n}), require_duplexify = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/duplexify.js\"(exports, module) {\n var {\n isReadable,\n isWritable,\n isIterable,\n isNodeStream,\n isReadableNodeStream,\n isWritableNodeStream,\n isDuplexNodeStream\n } = require_utils(), eos = require_end_of_stream(), {\n AbortError: AbortError2,\n codes: { ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE2, ERR_INVALID_RETURN_VALUE }\n } = require_errors(), { destroyer } = require_destroy(), Duplex = require_duplex(), Readable = require_readable(), { createDeferredPromise } = require_util(), from = require_from(), isBlob = typeof Blob !== \"undefined\" \? function isBlob2(b) {\n return b instanceof Blob;\n } : function isBlob2(b) {\n return !1;\n }, { FunctionPrototypeCall } = require_primordials();\n\n class Duplexify extends Duplex {\n constructor(options) {\n super(options);\n if ((options === null || options === @undefined \? @undefined : options.readable) === !1)\n this._readableState.readable = !1, this._readableState.ended = !0, this._readableState.endEmitted = !0;\n if ((options === null || options === @undefined \? @undefined : options.writable) === !1)\n this._writableState.writable = !1, this._writableState.ending = !0, this._writableState.ended = !0, this._writableState.finished = !0;\n }\n }\n module.exports = function duplexify(body, name) {\n if (isDuplexNodeStream(body))\n return body;\n if (isReadableNodeStream(body))\n return _duplexify({\n readable: body\n });\n if (isWritableNodeStream(body))\n return _duplexify({\n writable: body\n });\n if (isNodeStream(body))\n return _duplexify({\n writable: !1,\n readable: !1\n });\n if (typeof body === \"function\") {\n const { value, write, final, destroy: destroy2 } = fromAsyncGen(body);\n if (isIterable(value))\n return from(Duplexify, value, {\n objectMode: !0,\n write,\n final,\n destroy: destroy2\n });\n const then2 = value === null || value === void 0 \? void 0 : value.then;\n if (typeof then2 === \"function\") {\n let d;\n const promise = FunctionPrototypeCall(then2, value, (val) => {\n if (val != null)\n throw new ERR_INVALID_RETURN_VALUE(\"nully\", \"body\", val);\n }, (err) => {\n destroyer(d, err);\n });\n return d = new Duplexify({\n objectMode: !0,\n readable: !1,\n write,\n final(cb) {\n final(async () => {\n try {\n await promise, runOnNextTick(cb, null);\n } catch (err) {\n runOnNextTick(cb, err);\n }\n });\n },\n destroy: destroy2\n });\n }\n throw new ERR_INVALID_RETURN_VALUE(\"Iterable, AsyncIterable or AsyncFunction\", name, value);\n }\n if (isBlob(body))\n return duplexify(body.arrayBuffer());\n if (isIterable(body))\n return from(Duplexify, body, {\n objectMode: !0,\n writable: !1\n });\n if (typeof (body === null || body === void 0 \? void 0 : body.writable) === \"object\" || typeof (body === null || body === void 0 \? void 0 : body.readable) === \"object\") {\n const readable = body !== null && body !== void 0 && body.readable \? isReadableNodeStream(body === null || body === void 0 \? void 0 : body.readable) \? body === null || body === void 0 \? void 0 : body.readable : duplexify(body.readable) : void 0, writable = body !== null && body !== void 0 && body.writable \? isWritableNodeStream(body === null || body === void 0 \? void 0 : body.writable) \? body === null || body === void 0 \? void 0 : body.writable : duplexify(body.writable) : void 0;\n return _duplexify({\n readable,\n writable\n });\n }\n const then = body === null || body === void 0 \? void 0 : body.then;\n if (typeof then === \"function\") {\n let d;\n return FunctionPrototypeCall(then, body, (val) => {\n if (val != null)\n d.push(val);\n d.push(null);\n }, (err) => {\n destroyer(d, err);\n }), d = new Duplexify({\n objectMode: !0,\n writable: !1,\n read() {\n }\n });\n }\n throw new ERR_INVALID_ARG_TYPE2(name, [\n \"Blob\",\n \"ReadableStream\",\n \"WritableStream\",\n \"Stream\",\n \"Iterable\",\n \"AsyncIterable\",\n \"Function\",\n \"{ readable, writable } pair\",\n \"Promise\"\n ], body);\n };\n function fromAsyncGen(fn) {\n let { promise, resolve } = createDeferredPromise();\n const ac = new AbortController, signal = ac.signal;\n return {\n value: fn(async function* () {\n while (!0) {\n const _promise = promise;\n promise = null;\n const { chunk, done, cb } = await _promise;\n if (runOnNextTick(cb), done)\n return;\n if (signal.aborted)\n throw new AbortError2(void 0, {\n cause: signal.reason\n });\n ({ promise, resolve } = createDeferredPromise()), yield chunk;\n }\n }(), {\n signal\n }),\n write(chunk, encoding, cb) {\n const _resolve = resolve;\n resolve = null, _resolve({\n chunk,\n done: !1,\n cb\n });\n },\n final(cb) {\n const _resolve = resolve;\n resolve = null, _resolve({\n done: !0,\n cb\n });\n },\n destroy(err, cb) {\n ac.abort(), cb(err);\n }\n };\n }\n function _duplexify(pair) {\n const r = pair.readable && typeof pair.readable.read !== \"function\" \? Readable.wrap(pair.readable) : pair.readable, w = pair.writable;\n let readable = !!isReadable(r), writable = !!isWritable(w), ondrain, onfinish, onreadable, onclose, d;\n function onfinished(err) {\n const cb = onclose;\n if (onclose = null, cb)\n cb(err);\n else if (err)\n d.destroy(err);\n else if (!readable && !writable)\n d.destroy();\n }\n if (d = new Duplexify({\n readableObjectMode: !!(r !== null && r !== void 0 && r.readableObjectMode),\n writableObjectMode: !!(w !== null && w !== void 0 && w.writableObjectMode),\n readable,\n writable\n }), writable)\n eos(w, (err) => {\n if (writable = !1, err)\n destroyer(r, err);\n onfinished(err);\n }), d._write = function(chunk, encoding, callback) {\n if (w.write(chunk, encoding))\n callback();\n else\n ondrain = callback;\n }, d._final = function(callback) {\n w.end(), onfinish = callback;\n }, w.on(\"drain\", function() {\n if (ondrain) {\n const cb = ondrain;\n ondrain = null, cb();\n }\n }), w.on(\"finish\", function() {\n if (onfinish) {\n const cb = onfinish;\n onfinish = null, cb();\n }\n });\n if (readable)\n eos(r, (err) => {\n if (readable = !1, err)\n destroyer(r, err);\n onfinished(err);\n }), r.on(\"readable\", function() {\n if (onreadable) {\n const cb = onreadable;\n onreadable = null, cb();\n }\n }), r.on(\"end\", function() {\n d.push(null);\n }), d._read = function() {\n while (!0) {\n const buf = r.read();\n if (buf === null) {\n onreadable = d._read;\n return;\n }\n if (!d.push(buf))\n return;\n }\n };\n return d._destroy = function(err, callback) {\n if (!err && onclose !== null)\n err = new AbortError2;\n if (onreadable = null, ondrain = null, onfinish = null, onclose === null)\n callback(err);\n else\n onclose = callback, destroyer(w, err), destroyer(r, err);\n }, d;\n }\n }\n}), require_duplex = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/duplex.js\"(exports, module) {\n var { ObjectDefineProperties, ObjectGetOwnPropertyDescriptor, ObjectKeys, ObjectSetPrototypeOf } = require_primordials(), Readable = require_readable();\n function Duplex(options) {\n if (!(this instanceof Duplex))\n return new Duplex(options);\n if (Readable.@call(this, options), Writable.@call(this, options), options) {\n if (this.allowHalfOpen = options.allowHalfOpen !== !1, options.readable === !1)\n this._readableState.readable = !1, this._readableState.ended = !0, this._readableState.endEmitted = !0;\n if (options.writable === !1)\n this._writableState.writable = !1, this._writableState.ending = !0, this._writableState.ended = !0, this._writableState.finished = !0;\n } else\n this.allowHalfOpen = !0;\n }\n Duplex.prototype = {}, module.exports = Duplex, ObjectSetPrototypeOf(Duplex.prototype, Readable.prototype), ObjectSetPrototypeOf(Duplex, Readable);\n for (var method in Writable.prototype)\n if (!Duplex.prototype[method])\n Duplex.prototype[method] = Writable.prototype[method];\n ObjectDefineProperties(Duplex.prototype, {\n writable: ObjectGetOwnPropertyDescriptor(Writable.prototype, \"writable\"),\n writableHighWaterMark: ObjectGetOwnPropertyDescriptor(Writable.prototype, \"writableHighWaterMark\"),\n writableObjectMode: ObjectGetOwnPropertyDescriptor(Writable.prototype, \"writableObjectMode\"),\n writableBuffer: ObjectGetOwnPropertyDescriptor(Writable.prototype, \"writableBuffer\"),\n writableLength: ObjectGetOwnPropertyDescriptor(Writable.prototype, \"writableLength\"),\n writableFinished: ObjectGetOwnPropertyDescriptor(Writable.prototype, \"writableFinished\"),\n writableCorked: ObjectGetOwnPropertyDescriptor(Writable.prototype, \"writableCorked\"),\n writableEnded: ObjectGetOwnPropertyDescriptor(Writable.prototype, \"writableEnded\"),\n writableNeedDrain: ObjectGetOwnPropertyDescriptor(Writable.prototype, \"writableNeedDrain\"),\n destroyed: {\n get() {\n if (this._readableState === void 0 || this._writableState === void 0)\n return !1;\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set(value) {\n if (this._readableState && this._writableState)\n this._readableState.destroyed = value, this._writableState.destroyed = value;\n }\n }\n });\n var webStreamsAdapters;\n function lazyWebStreams() {\n if (webStreamsAdapters === void 0)\n webStreamsAdapters = {};\n return webStreamsAdapters;\n }\n Duplex.fromWeb = function(pair, options) {\n return lazyWebStreams().newStreamDuplexFromReadableWritablePair(pair, options);\n }, Duplex.toWeb = function(duplex) {\n return lazyWebStreams().newReadableWritablePairFromDuplex(duplex);\n };\n var duplexify;\n Duplex.from = function(body) {\n if (!duplexify)\n duplexify = require_duplexify();\n return duplexify(body, \"body\");\n };\n }\n}), require_transform = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/transform.js\"(exports, module) {\n var { ObjectSetPrototypeOf, Symbol: Symbol2 } = require_primordials(), { ERR_METHOD_NOT_IMPLEMENTED } = require_errors().codes, Duplex = require_duplex();\n function Transform(options) {\n if (!(this instanceof Transform))\n return new Transform(options);\n if (Duplex.@call(this, options), this._readableState.sync = !1, this[kCallback] = null, options) {\n if (typeof options.transform === \"function\")\n this._transform = options.transform;\n if (typeof options.flush === \"function\")\n this._flush = options.flush;\n }\n this.on(\"prefinish\", prefinish.bind(this));\n }\n Transform.prototype = {}, ObjectSetPrototypeOf(Transform.prototype, Duplex.prototype), ObjectSetPrototypeOf(Transform, Duplex), module.exports = Transform;\n var kCallback = Symbol2(\"kCallback\");\n function final(cb) {\n if (typeof this._flush === \"function\" && !this.destroyed)\n this._flush((er, data) => {\n if (er) {\n if (cb)\n cb(er);\n else\n this.destroy(er);\n return;\n }\n if (data != null)\n this.push(data);\n if (this.push(null), cb)\n cb();\n });\n else if (this.push(null), cb)\n cb();\n }\n function prefinish() {\n if (this._final !== final)\n final.@call(this);\n }\n Transform.prototype._final = final, Transform.prototype._transform = function(chunk, encoding, callback) {\n throw new ERR_METHOD_NOT_IMPLEMENTED(\"_transform()\");\n }, Transform.prototype._write = function(chunk, encoding, callback) {\n const rState = this._readableState, wState = this._writableState, length = rState.length;\n this._transform(chunk, encoding, (err, val) => {\n if (err) {\n callback(err);\n return;\n }\n if (val != null)\n this.push(val);\n if (wState.ended || length === rState.length || rState.length < rState.highWaterMark || rState.highWaterMark === 0 || rState.length === 0)\n callback();\n else\n this[kCallback] = callback;\n });\n }, Transform.prototype._read = function() {\n if (this[kCallback]) {\n const callback = this[kCallback];\n this[kCallback] = null, callback();\n }\n };\n }\n}), require_passthrough = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/passthrough.js\"(exports, module) {\n var { ObjectSetPrototypeOf } = require_primordials(), Transform = require_transform();\n function PassThrough(options) {\n if (!(this instanceof PassThrough))\n return new PassThrough(options);\n Transform.@call(this, options);\n }\n PassThrough.prototype = {}, ObjectSetPrototypeOf(PassThrough.prototype, Transform.prototype), ObjectSetPrototypeOf(PassThrough, Transform), PassThrough.prototype._transform = function(chunk, encoding, cb) {\n cb(null, chunk);\n }, module.exports = PassThrough;\n }\n}), require_pipeline = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/pipeline.js\"(exports, module) {\n var { ArrayIsArray: ArrayIsArray2, Promise: Promise2, SymbolAsyncIterator } = require_primordials(), eos = require_end_of_stream(), { once } = require_util(), destroyImpl = require_destroy(), Duplex = require_duplex(), {\n aggregateTwoErrors,\n codes: { ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE2, ERR_INVALID_RETURN_VALUE, ERR_MISSING_ARGS, ERR_STREAM_DESTROYED },\n AbortError: AbortError2\n } = require_errors(), { validateFunction, validateAbortSignal } = require_validators(), { isIterable, isReadable, isReadableNodeStream, isNodeStream } = require_utils(), PassThrough, Readable;\n function destroyer(stream, reading, writing) {\n let finished = !1;\n stream.on(\"close\", () => {\n finished = !0;\n });\n const cleanup = eos(stream, {\n readable: reading,\n writable: writing\n }, (err) => {\n finished = !err;\n });\n return {\n destroy: (err) => {\n if (finished)\n return;\n finished = !0, destroyImpl.destroyer(stream, err || new ERR_STREAM_DESTROYED(\"pipe\"));\n },\n cleanup\n };\n }\n function popCallback(streams) {\n return validateFunction(streams[streams.length - 1], \"streams[stream.length - 1]\"), streams.pop();\n }\n function makeAsyncIterable(val) {\n if (isIterable(val))\n return val;\n else if (isReadableNodeStream(val))\n return fromReadable(val);\n throw new ERR_INVALID_ARG_TYPE2(\"val\", [\"Readable\", \"Iterable\", \"AsyncIterable\"], val);\n }\n async function* fromReadable(val) {\n if (!Readable)\n Readable = require_readable();\n yield* Readable.prototype[SymbolAsyncIterator].@call(val);\n }\n async function pump(iterable, writable, finish, { end }) {\n let error, onresolve = null;\n const resume = (err) => {\n if (err)\n error = err;\n if (onresolve) {\n const callback = onresolve;\n onresolve = null, callback();\n }\n }, wait = () => new Promise2((resolve, reject) => {\n if (error)\n reject(error);\n else\n onresolve = () => {\n if (error)\n reject(error);\n else\n resolve();\n };\n });\n writable.on(\"drain\", resume);\n const cleanup = eos(writable, {\n readable: !1\n }, resume);\n try {\n if (writable.writableNeedDrain)\n await wait();\n for await (let chunk of iterable)\n if (!writable.write(chunk))\n await wait();\n if (end)\n writable.end();\n await wait(), finish();\n } catch (err) {\n finish(error !== err \? aggregateTwoErrors(error, err) : err);\n } finally {\n cleanup(), writable.off(\"drain\", resume);\n }\n }\n function pipeline(...streams) {\n return pipelineImpl(streams, once(popCallback(streams)));\n }\n function pipelineImpl(streams, callback, opts) {\n if (streams.length === 1 && ArrayIsArray2(streams[0]))\n streams = streams[0];\n if (streams.length < 2)\n throw new ERR_MISSING_ARGS(\"streams\");\n const ac = new AbortController, signal = ac.signal, outerSignal = opts === null || opts === void 0 \? void 0 : opts.signal, lastStreamCleanup = [];\n validateAbortSignal(outerSignal, \"options.signal\");\n function abort() {\n finishImpl(new AbortError2);\n }\n outerSignal === null || outerSignal === void 0 || outerSignal.addEventListener(\"abort\", abort);\n let error, value;\n const destroys = [];\n let finishCount = 0;\n function finish(err) {\n finishImpl(err, --finishCount === 0);\n }\n function finishImpl(err, final) {\n if (err && (!error || error.code === \"ERR_STREAM_PREMATURE_CLOSE\"))\n error = err;\n if (!error && !final)\n return;\n while (destroys.length)\n destroys.shift()(error);\n if (outerSignal === null || outerSignal === void 0 || outerSignal.removeEventListener(\"abort\", abort), ac.abort(), final) {\n if (!error)\n lastStreamCleanup.forEach((fn) => fn());\n runOnNextTick(callback, error, value);\n }\n }\n let ret;\n for (let i = 0;i < streams.length; i++) {\n const stream = streams[i], reading = i < streams.length - 1, writing = i > 0, end = reading || (opts === null || opts === void 0 \? void 0 : opts.end) !== !1, isLastStream = i === streams.length - 1;\n if (isNodeStream(stream)) {\n let onError = function(err) {\n if (err && err.name !== \"AbortError\" && err.code !== \"ERR_STREAM_PREMATURE_CLOSE\")\n finish(err);\n };\n if (end) {\n const { destroy: destroy2, cleanup } = destroyer(stream, reading, writing);\n if (destroys.push(destroy2), isReadable(stream) && isLastStream)\n lastStreamCleanup.push(cleanup);\n }\n if (stream.on(\"error\", onError), isReadable(stream) && isLastStream)\n lastStreamCleanup.push(() => {\n stream.removeListener(\"error\", onError);\n });\n }\n if (i === 0)\n if (typeof stream === \"function\") {\n if (ret = stream({\n signal\n }), !isIterable(ret))\n throw new ERR_INVALID_RETURN_VALUE(\"Iterable, AsyncIterable or Stream\", \"source\", ret);\n } else if (isIterable(stream) || isReadableNodeStream(stream))\n ret = stream;\n else\n ret = Duplex.from(stream);\n else if (typeof stream === \"function\")\n if (ret = makeAsyncIterable(ret), ret = stream(ret, {\n signal\n }), reading) {\n if (!isIterable(ret, !0))\n throw new ERR_INVALID_RETURN_VALUE(\"AsyncIterable\", `transform[${i - 1}]`, ret);\n } else {\n var _ret;\n if (!PassThrough)\n PassThrough = require_passthrough();\n const pt = new PassThrough({\n objectMode: !0\n }), then = (_ret = ret) === null || _ret === void 0 \? void 0 : _ret.then;\n if (typeof then === \"function\")\n finishCount++, then.@call(ret, (val) => {\n if (value = val, val != null)\n pt.write(val);\n if (end)\n pt.end();\n runOnNextTick(finish);\n }, (err) => {\n pt.destroy(err), runOnNextTick(finish, err);\n });\n else if (isIterable(ret, !0))\n finishCount++, pump(ret, pt, finish, {\n end\n });\n else\n throw new ERR_INVALID_RETURN_VALUE(\"AsyncIterable or Promise\", \"destination\", ret);\n ret = pt;\n const { destroy: destroy2, cleanup } = destroyer(ret, !1, !0);\n if (destroys.push(destroy2), isLastStream)\n lastStreamCleanup.push(cleanup);\n }\n else if (isNodeStream(stream)) {\n if (isReadableNodeStream(ret)) {\n finishCount += 2;\n const cleanup = pipe(ret, stream, finish, {\n end\n });\n if (isReadable(stream) && isLastStream)\n lastStreamCleanup.push(cleanup);\n } else if (isIterable(ret))\n finishCount++, pump(ret, stream, finish, {\n end\n });\n else\n throw new ERR_INVALID_ARG_TYPE2(\"val\", [\"Readable\", \"Iterable\", \"AsyncIterable\"], ret);\n ret = stream;\n } else\n ret = Duplex.from(stream);\n }\n if (signal !== null && signal !== void 0 && signal.aborted || outerSignal !== null && outerSignal !== void 0 && outerSignal.aborted)\n runOnNextTick(abort);\n return ret;\n }\n function pipe(src, dst, finish, { end }) {\n if (src.pipe(dst, {\n end\n }), end)\n src.once(\"end\", () => dst.end());\n else\n finish();\n return eos(src, {\n readable: !0,\n writable: !1\n }, (err) => {\n const rState = src._readableState;\n if (err && err.code === \"ERR_STREAM_PREMATURE_CLOSE\" && rState && rState.ended && !rState.errored && !rState.errorEmitted)\n src.once(\"end\", finish).once(\"error\", finish);\n else\n finish(err);\n }), eos(dst, {\n readable: !1,\n writable: !0\n }, finish);\n }\n module.exports = {\n pipelineImpl,\n pipeline\n };\n }\n}), require_compose = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/compose.js\"(exports, module) {\n var { pipeline } = require_pipeline(), Duplex = require_duplex(), { destroyer } = require_destroy(), { isNodeStream, isReadable, isWritable } = require_utils(), {\n AbortError: AbortError2,\n codes: { ERR_INVALID_ARG_VALUE: ERR_INVALID_ARG_VALUE2, ERR_MISSING_ARGS }\n } = require_errors();\n module.exports = function compose(...streams) {\n if (streams.length === 0)\n throw new ERR_MISSING_ARGS(\"streams\");\n if (streams.length === 1)\n return Duplex.from(streams[0]);\n const orgStreams = [...streams];\n if (typeof streams[0] === \"function\")\n streams[0] = Duplex.from(streams[0]);\n if (typeof streams[streams.length - 1] === \"function\") {\n const idx = streams.length - 1;\n streams[idx] = Duplex.from(streams[idx]);\n }\n for (let n = 0;n < streams.length; ++n) {\n if (!isNodeStream(streams[n]))\n continue;\n if (n < streams.length - 1 && !isReadable(streams[n]))\n throw new ERR_INVALID_ARG_VALUE2(`streams[${n}]`, orgStreams[n], \"must be readable\");\n if (n > 0 && !isWritable(streams[n]))\n throw new ERR_INVALID_ARG_VALUE2(`streams[${n}]`, orgStreams[n], \"must be writable\");\n }\n let ondrain, onfinish, onreadable, onclose, d;\n function onfinished(err) {\n const cb = onclose;\n if (onclose = null, cb)\n cb(err);\n else if (err)\n d.destroy(err);\n else if (!readable && !writable)\n d.destroy();\n }\n const head = streams[0], tail = pipeline(streams, onfinished), writable = !!isWritable(head), readable = !!isReadable(tail);\n if (d = new Duplex({\n writableObjectMode: !!(head !== null && head !== void 0 && head.writableObjectMode),\n readableObjectMode: !!(tail !== null && tail !== void 0 && tail.writableObjectMode),\n writable,\n readable\n }), writable)\n d._write = function(chunk, encoding, callback) {\n if (head.write(chunk, encoding))\n callback();\n else\n ondrain = callback;\n }, d._final = function(callback) {\n head.end(), onfinish = callback;\n }, head.on(\"drain\", function() {\n if (ondrain) {\n const cb = ondrain;\n ondrain = null, cb();\n }\n }), tail.on(\"finish\", function() {\n if (onfinish) {\n const cb = onfinish;\n onfinish = null, cb();\n }\n });\n if (readable)\n tail.on(\"readable\", function() {\n if (onreadable) {\n const cb = onreadable;\n onreadable = null, cb();\n }\n }), tail.on(\"end\", function() {\n d.push(null);\n }), d._read = function() {\n while (!0) {\n const buf = tail.read();\n if (buf === null) {\n onreadable = d._read;\n return;\n }\n if (!d.push(buf))\n return;\n }\n };\n return d._destroy = function(err, callback) {\n if (!err && onclose !== null)\n err = new AbortError2;\n if (onreadable = null, ondrain = null, onfinish = null, onclose === null)\n callback(err);\n else\n onclose = callback, destroyer(tail, err);\n }, d;\n };\n }\n}), require_promises = __commonJS({\n \"node_modules/readable-stream/lib/stream/promises.js\"(exports, module) {\n var { ArrayPrototypePop, Promise: Promise2 } = require_primordials(), { isIterable, isNodeStream } = require_utils(), { pipelineImpl: pl } = require_pipeline(), { finished } = require_end_of_stream();\n function pipeline(...streams) {\n return new Promise2((resolve, reject) => {\n let signal, end;\n const lastArg = streams[streams.length - 1];\n if (lastArg && typeof lastArg === \"object\" && !isNodeStream(lastArg) && !isIterable(lastArg)) {\n const options = ArrayPrototypePop(streams);\n signal = options.signal, end = options.end;\n }\n pl(streams, (err, value) => {\n if (err)\n reject(err);\n else\n resolve(value);\n }, {\n signal,\n end\n });\n });\n }\n module.exports = {\n finished,\n pipeline\n };\n }\n}), require_stream = __commonJS({\n \"node_modules/readable-stream/lib/stream.js\"(exports, module) {\n var { ObjectDefineProperty, ObjectKeys, ReflectApply } = require_primordials(), {\n promisify: { custom: customPromisify }\n } = require_util(), { streamReturningOperators, promiseReturningOperators } = require_operators(), {\n codes: { ERR_ILLEGAL_CONSTRUCTOR }\n } = require_errors(), compose = require_compose(), { pipeline } = require_pipeline(), { destroyer } = require_destroy(), eos = require_end_of_stream(), promises = require_promises(), utils = require_utils(), Stream = module.exports = require_legacy().Stream;\n Stream.isDisturbed = utils.isDisturbed, Stream.isErrored = utils.isErrored, Stream.isWritable = utils.isWritable, Stream.isReadable = utils.isReadable, Stream.Readable = require_readable();\n for (let key of ObjectKeys(streamReturningOperators)) {\n let fn = function(...args) {\n if (new.target)\n throw ERR_ILLEGAL_CONSTRUCTOR();\n return Stream.Readable.from(ReflectApply(op, this, args));\n };\n const op = streamReturningOperators[key];\n ObjectDefineProperty(fn, \"name\", {\n value: op.name\n }), ObjectDefineProperty(fn, \"length\", {\n value: op.length\n }), ObjectDefineProperty(Stream.Readable.prototype, key, {\n value: fn,\n enumerable: !1,\n configurable: !0,\n writable: !0\n });\n }\n for (let key of ObjectKeys(promiseReturningOperators)) {\n let fn = function(...args) {\n if (new.target)\n throw ERR_ILLEGAL_CONSTRUCTOR();\n return ReflectApply(op, this, args);\n };\n const op = promiseReturningOperators[key];\n ObjectDefineProperty(fn, \"name\", {\n value: op.name\n }), ObjectDefineProperty(fn, \"length\", {\n value: op.length\n }), ObjectDefineProperty(Stream.Readable.prototype, key, {\n value: fn,\n enumerable: !1,\n configurable: !0,\n writable: !0\n });\n }\n Stream.Writable = require_writable(), Stream.Duplex = require_duplex(), Stream.Transform = require_transform(), Stream.PassThrough = require_passthrough(), Stream.pipeline = pipeline;\n var { addAbortSignal } = require_add_abort_signal();\n Stream.addAbortSignal = addAbortSignal, Stream.finished = eos, Stream.destroy = destroyer, Stream.compose = compose, ObjectDefineProperty(Stream, \"promises\", {\n configurable: !0,\n enumerable: !0,\n get() {\n return promises;\n }\n }), ObjectDefineProperty(pipeline, customPromisify, {\n enumerable: !0,\n get() {\n return promises.pipeline;\n }\n }), ObjectDefineProperty(eos, customPromisify, {\n enumerable: !0,\n get() {\n return promises.finished;\n }\n }), Stream.Stream = Stream, Stream._isUint8Array = function isUint8Array(value) {\n return value instanceof @Uint8Array;\n }, Stream._uint8ArrayToBuffer = function _uint8ArrayToBuffer(chunk) {\n return new @Buffer(chunk.buffer, chunk.byteOffset, chunk.byteLength);\n };\n }\n}), nativeReadableStreamPrototypes = {\n 0: @undefined,\n 1: @undefined,\n 2: @undefined,\n 3: @undefined,\n 4: @undefined,\n 5: @undefined\n}, Writable = require_writable(), _pathOrFdOrSink = Symbol(\"pathOrFdOrSink\"), _fileSink = Symbol(\"fileSink\"), _native = Symbol(\"native\");\nNativeWritable.prototype = Object.create(Writable.prototype);\nvar WritablePrototypeWrite = Writable.prototype.write;\nNativeWritable.prototype.write = function NativeWritablePrototypeWrite(chunk, encoding, cb, native) {\n if (!(native \?\? this[_native]))\n return this[_native] = !1, WritablePrototypeWrite.@call(this, chunk, encoding, cb);\n var fileSink = this[_fileSink] \?\? NativeWritable_lazyConstruct(this), result = fileSink.write(chunk);\n if (@isPromise(result))\n return result.then(() => {\n this.emit(\"drain\"), fileSink.flush(!0);\n }), !1;\n if (fileSink.flush(!0), typeof encoding === \"function\")\n cb = encoding;\n if (cb)\n cb(null, chunk.byteLength);\n return !0;\n};\nvar WritablePrototypeEnd = Writable.prototype.end;\nNativeWritable.prototype.end = function end(chunk, encoding, cb, native) {\n return WritablePrototypeEnd.@call(this, chunk, encoding, cb, native \?\? this[_native]);\n};\nNativeWritable.prototype.ref = function ref() {\n var sink = this[_fileSink];\n if (!sink)\n this.NativeWritable_lazyConstruct();\n sink.ref();\n};\nNativeWritable.prototype.unref = function unref() {\n this[_fileSink]\?.unref();\n};\nvar exports = require_stream(), promises = require_promises();\nexports._getNativeReadableStreamPrototype = getNativeReadableStreamPrototype;\nexports.NativeWritable = NativeWritable;\nObject.defineProperty(exports, \"promises\", {\n configurable: !0,\n enumerable: !0,\n get() {\n return promises;\n }\n});\nexports[Symbol.for(\"::bunternal::\")] = { _ReadableFromWeb, _ReadableFromWebForUndici };\nexports.eos = require_end_of_stream();\nexports.EventEmitter = EE;\nreturn exports})\n"); -// - -// -static constexpr ASCIILiteral NodeStreamPromisesCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/stream.promises.ts\nreturn (@getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39)).promises})\n"); -// - -// -static constexpr ASCIILiteral NodeStreamWebCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/stream.web.ts\nvar $;\n$ = {\n ReadableStream: @ReadableStream,\n ReadableStreamDefaultReader: @ReadableStreamDefaultReader,\n ReadableStreamBYOBReader: @ReadableStreamBYOBReader,\n ReadableStreamBYOBRequest: @ReadableStreamBYOBRequest,\n ReadableByteStreamController: @ReadableByteStreamController,\n ReadableStreamDefaultController: @ReadableStreamDefaultController,\n TransformStream: @TransformStream,\n TransformStreamDefaultController: @TransformStreamDefaultController,\n WritableStream: @WritableStream,\n WritableStreamDefaultWriter: @WritableStreamDefaultWriter,\n WritableStreamDefaultController: @WritableStreamDefaultController,\n ByteLengthQueuingStrategy,\n CountQueuingStrategy,\n TextEncoderStream: @undefined,\n TextDecoderStream: @undefined,\n CompressionStream: @undefined,\n DecompressionStream: @undefined\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeTimersCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/timers.ts\nvar $;\n$ = {\n setTimeout,\n clearTimeout,\n setInterval,\n setImmediate,\n clearInterval,\n clearImmediate\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeTimersPromisesCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/timers.promises.ts\nvar validateObject = function(object, name) {\n if (object === null || typeof object !== \"object\")\n throw new ERR_INVALID_ARG_TYPE(name, \"Object\", object);\n}, validateBoolean = function(value, name) {\n if (typeof value !== \"boolean\")\n throw new ERR_INVALID_ARG_TYPE(name, \"boolean\", value);\n}, validateAbortSignal = function(signal, name) {\n if (typeof signal !== \"undefined\" && (signal === null || typeof signal !== \"object\" || !(\"aborted\" in signal)))\n throw new ERR_INVALID_ARG_TYPE(name, \"AbortSignal\", signal);\n}, asyncIterator = function({ next: nextFunction, return: returnFunction }) {\n const result = {};\n if (typeof nextFunction === \"function\")\n result.next = nextFunction;\n if (typeof returnFunction === \"function\")\n result.return = returnFunction;\n return result[symbolAsyncIterator] = function() {\n return this;\n }, result;\n}, setTimeoutPromise = function(after = 1, value, options = {}) {\n const arguments_ = [].concat(value \?\? []);\n try {\n validateObject(options, \"options\");\n } catch (error) {\n return @Promise.reject(error);\n }\n const { signal, ref: reference = !0 } = options;\n try {\n validateAbortSignal(signal, \"options.signal\");\n } catch (error) {\n return @Promise.reject(error);\n }\n try {\n validateBoolean(reference, \"options.ref\");\n } catch (error) {\n return @Promise.reject(error);\n }\n if (signal\?.aborted)\n return @Promise.reject(new AbortError);\n let onCancel;\n const returnValue = new @Promise((resolve, reject) => {\n const timeout = setTimeout(() => resolve(value), after, ...arguments_);\n if (!reference)\n timeout\?.unref\?.();\n if (signal)\n onCancel = () => {\n clearTimeout(timeout), reject(new AbortError);\n }, signal.addEventListener(\"abort\", onCancel);\n });\n if (typeof onCancel !== \"undefined\")\n returnValue.finally(() => signal.removeEventListener(\"abort\", onCancel));\n return returnValue;\n}, setImmediatePromise = function(value, options = {}) {\n try {\n validateObject(options, \"options\");\n } catch (error) {\n return @Promise.reject(error);\n }\n const { signal, ref: reference = !0 } = options;\n try {\n validateAbortSignal(signal, \"options.signal\");\n } catch (error) {\n return @Promise.reject(error);\n }\n try {\n validateBoolean(reference, \"options.ref\");\n } catch (error) {\n return @Promise.reject(error);\n }\n if (signal\?.aborted)\n return @Promise.reject(new AbortError);\n let onCancel;\n const returnValue = new @Promise((resolve, reject) => {\n const immediate = setImmediate(() => resolve(value));\n if (!reference)\n immediate\?.unref\?.();\n if (signal)\n onCancel = () => {\n clearImmediate(immediate), reject(new AbortError);\n }, signal.addEventListener(\"abort\", onCancel);\n });\n if (typeof onCancel !== \"undefined\")\n returnValue.finally(() => signal.removeEventListener(\"abort\", onCancel));\n return returnValue;\n}, setIntervalPromise = function(after = 1, value, options = {}) {\n try {\n validateObject(options, \"options\");\n } catch (error) {\n return asyncIterator({\n next: function() {\n return @Promise.reject(error);\n }\n });\n }\n const { signal, ref: reference = !0 } = options;\n try {\n validateAbortSignal(signal, \"options.signal\");\n } catch (error) {\n return asyncIterator({\n next: function() {\n return @Promise.reject(error);\n }\n });\n }\n try {\n validateBoolean(reference, \"options.ref\");\n } catch (error) {\n return asyncIterator({\n next: function() {\n return @Promise.reject(error);\n }\n });\n }\n if (signal\?.aborted)\n return asyncIterator({\n next: function() {\n return @Promise.reject(new AbortError);\n }\n });\n let onCancel, interval;\n try {\n let notYielded = 0, callback;\n if (interval = setInterval(() => {\n if (notYielded++, callback)\n callback(), callback = @undefined;\n }, after), !reference)\n interval\?.unref\?.();\n if (signal)\n onCancel = () => {\n if (clearInterval(interval), callback)\n callback(), callback = @undefined;\n }, signal.addEventListener(\"abort\", onCancel);\n return asyncIterator({\n next: function() {\n return new @Promise((resolve, reject) => {\n if (!signal\?.aborted)\n if (notYielded === 0)\n callback = resolve;\n else\n resolve();\n else if (notYielded === 0)\n reject(new AbortError);\n else\n resolve();\n }).then(() => {\n if (notYielded > 0)\n return notYielded = notYielded - 1, { done: !1, value };\n return { done: !0 };\n });\n },\n return: function() {\n return clearInterval(interval), signal\?.removeEventListener(\"abort\", onCancel), @Promise.resolve({});\n }\n });\n } catch (error) {\n return asyncIterator({\n next: function() {\n clearInterval(interval), signal\?.removeEventListener(\"abort\", onCancel);\n }\n });\n }\n}, $, symbolAsyncIterator = Symbol.asyncIterator;\n\nclass ERR_INVALID_ARG_TYPE extends Error {\n constructor(name, expected, actual) {\n super(`${name} must be ${expected}, ${typeof actual} given`);\n this.code = \"ERR_INVALID_ARG_TYPE\";\n }\n}\n\nclass AbortError extends Error {\n constructor() {\n super(\"The operation was aborted\");\n this.code = \"ABORT_ERR\";\n }\n}\n$ = {\n setTimeout: setTimeoutPromise,\n setImmediate: setImmediatePromise,\n setInterval: setIntervalPromise,\n scheduler: {\n wait: (delay, options) => setTimeoutPromise(delay, @undefined, options),\n yield: setImmediatePromise\n }\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeTLSCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/tls.ts\nvar parseCertString = function() {\n throwNotImplemented(\"Not implemented\");\n}, isValidTLSArray = function(obj) {\n if (typeof obj === \"string\" || isTypedArray(obj) || obj instanceof @ArrayBuffer || obj instanceof Blob)\n return !0;\n if (@Array.isArray(obj)) {\n for (var i = 0;i < obj.length; i++)\n if (typeof obj !== \"string\" && !isTypedArray(obj) && !(obj instanceof @ArrayBuffer) && !(obj instanceof Blob))\n return !1;\n return !0;\n }\n}, unfqdn = function(host) {\n return RegExpPrototypeSymbolReplace.@call(/[.]$/, host, \"\");\n}, toLowerCase = function(c) {\n return StringFromCharCode.@call(32 + StringPrototypeCharCodeAt.@call(c, 0));\n}, splitHost = function(host) {\n return StringPrototypeSplit.@call(RegExpPrototypeSymbolReplace.@call(/[A-Z]/g, unfqdn(host), toLowerCase), \".\");\n}, check = function(hostParts, pattern, wildcards) {\n if (!pattern)\n return !1;\n const patternParts = splitHost(pattern);\n if (hostParts.length !== patternParts.length)\n return !1;\n if (ArrayPrototypeIncludes.@call(patternParts, \"\"))\n return !1;\n const isBad = (s) => RegExpPrototypeExec.@call(/[^\\u0021-\\u007F]/u, s) !== null;\n if (ArrayPrototypeSome.@call(patternParts, isBad))\n return !1;\n for (let i = hostParts.length - 1;i > 0; i -= 1)\n if (hostParts[i] !== patternParts[i])\n return !1;\n const hostSubdomain = hostParts[0], patternSubdomain = patternParts[0], patternSubdomainParts = StringPrototypeSplit.@call(patternSubdomain, \"*\");\n if (patternSubdomainParts.length === 1 || StringPrototypeIncludes.@call(patternSubdomain, \"xn--\"))\n return hostSubdomain === patternSubdomain;\n if (!wildcards)\n return !1;\n if (patternSubdomainParts.length > 2)\n return !1;\n if (patternParts.length <= 2)\n return !1;\n const { 0: prefix, 1: suffix } = patternSubdomainParts;\n if (prefix.length + suffix.length > hostSubdomain.length)\n return !1;\n if (!StringPrototypeStartsWith.@call(hostSubdomain, prefix))\n return !1;\n if (!StringPrototypeEndsWith.@call(hostSubdomain, suffix))\n return !1;\n return !0;\n}, splitEscapedAltNames = function(altNames) {\n const result = [];\n let currentToken = \"\", offset = 0;\n while (offset !== altNames.length) {\n const nextSep = StringPrototypeIndexOf.@call(altNames, \", \", offset), nextQuote = StringPrototypeIndexOf.@call(altNames, '\"', offset);\n if (nextQuote !== -1 && (nextSep === -1 || nextQuote < nextSep)) {\n currentToken += StringPrototypeSubstring.@call(altNames, offset, nextQuote);\n const match = RegExpPrototypeExec.@call(jsonStringPattern, StringPrototypeSubstring.@call(altNames, nextQuote));\n if (!match) {\n let error = new SyntaxError(\"ERR_TLS_CERT_ALTNAME_FORMAT: Invalid subject alternative name string\");\n throw error.name = ERR_TLS_CERT_ALTNAME_FORMAT, error;\n }\n currentToken += JSON.parse(match[0]), offset = nextQuote + match[0].length;\n } else if (nextSep !== -1)\n currentToken += StringPrototypeSubstring.@call(altNames, offset, nextSep), ArrayPrototypePush.@call(result, currentToken), currentToken = \"\", offset = nextSep + 2;\n else\n currentToken += StringPrototypeSubstring.@call(altNames, offset), offset = altNames.length;\n }\n return ArrayPrototypePush.@call(result, currentToken), result;\n}, checkServerIdentity = function(hostname, cert) {\n const { subject, subjectaltname: altNames } = cert, dnsNames = [], ips = [];\n if (hostname = \"\" + hostname, altNames) {\n const splitAltNames = StringPrototypeIncludes.@call(altNames, '\"') \? splitEscapedAltNames(altNames) : StringPrototypeSplit.@call(altNames, \", \");\n ArrayPrototypeForEach.@call(splitAltNames, (name) => {\n if (StringPrototypeStartsWith.@call(name, \"DNS:\"))\n ArrayPrototypePush.@call(dnsNames, StringPrototypeSlice.@call(name, 4));\n else if (StringPrototypeStartsWith.@call(name, \"IP Address:\"))\n ArrayPrototypePush.@call(ips, canonicalizeIP(StringPrototypeSlice.@call(name, 11)));\n });\n }\n let valid = !1, reason = \"Unknown reason\";\n if (hostname = unfqdn(hostname), net.isIP(hostname)) {\n if (valid = ArrayPrototypeIncludes.@call(ips, canonicalizeIP(hostname)), !valid)\n reason = `IP: ${hostname} is not in the cert's list: ` + ArrayPrototypeJoin.@call(ips, \", \");\n } else if (dnsNames.length > 0 || subject\?.CN) {\n const hostParts = splitHost(hostname), wildcard = (pattern) => check(hostParts, pattern, !0);\n if (dnsNames.length > 0) {\n if (valid = ArrayPrototypeSome.@call(dnsNames, wildcard), !valid)\n reason = `Host: ${hostname}. is not in the cert's altnames: ${altNames}`;\n } else {\n const cn = subject.CN;\n if (@Array.isArray(cn))\n valid = ArrayPrototypeSome.@call(cn, wildcard);\n else if (cn)\n valid = wildcard(cn);\n if (!valid)\n reason = `Host: ${hostname}. is not cert's CN: ${cn}`;\n }\n } else\n reason = \"Cert does not contain a DNS name\";\n if (!valid) {\n let error = new Error(`ERR_TLS_CERT_ALTNAME_INVALID: Hostname/IP does not match certificate's altnames: ${reason}`);\n return error.name = \"ERR_TLS_CERT_ALTNAME_INVALID\", error.reason = reason, error.host = hostname, error.cert = cert, error;\n }\n}, SecureContext = function(options) {\n return new InternalSecureContext(options);\n}, createSecureContext = function(options) {\n return new SecureContext(options);\n}, translatePeerCertificate = function(c) {\n if (!c)\n return null;\n if (c.issuerCertificate != null && c.issuerCertificate !== c)\n c.issuerCertificate = translatePeerCertificate(c.issuerCertificate);\n if (c.infoAccess != null) {\n const info = c.infoAccess;\n c.infoAccess = { __proto__: null }, RegExpPrototypeSymbolReplace.@call(/([^\\n:]*):([^\\n]*)(\?:\\n|$)/g, info, (all, key, val) => {\n if (val.charCodeAt(0) === 34)\n val = JSONParse(val);\n if (key in c.infoAccess)\n ArrayPrototypePush.@call(c.infoAccess[key], val);\n else\n c.infoAccess[key] = [val];\n });\n }\n return c;\n}, createServer = function(options, connectionListener) {\n return new Server(options, connectionListener);\n}, getCiphers = function() {\n return DEFAULT_CIPHERS.split(\":\");\n}, convertProtocols = function(protocols) {\n const lens = new @Array(protocols.length), buff = @Buffer.allocUnsafe(ArrayPrototypeReduce.@call(protocols, (p, c, i) => {\n const len = @Buffer.byteLength(c);\n if (len > 255)\n @throwRangeError(\"The byte length of the protocol at index \" + `${i} exceeds the maximum length.`, \"<= 255\", len, !0);\n return lens[i] = len, p + 1 + len;\n }, 0));\n let offset = 0;\n for (let i = 0, c = protocols.length;i < c; i++)\n buff[offset++] = lens[i], buff.write(protocols[i], offset), offset += lens[i];\n return buff;\n}, convertALPNProtocols = function(protocols, out) {\n if (@Array.isArray(protocols))\n out.ALPNProtocols = convertProtocols(protocols);\n else if (isTypedArray(protocols))\n out.ALPNProtocols = @Buffer.from(protocols);\n else if (isArrayBufferView(protocols))\n out.ALPNProtocols = @Buffer.from(protocols.buffer.slice(protocols.byteOffset, protocols.byteOffset + protocols.byteLength));\n else if (@Buffer.isBuffer(protocols))\n out.ALPNProtocols = protocols;\n}, $, { isArrayBufferView, isTypedArray } = @requireNativeModule(\"util/types\"), net = @getInternalField(@internalModuleRegistry, 27) || @createInternalModuleById(27), { Server: NetServer, [Symbol.for(\"::bunternal::\")]: InternalTCPSocket } = net, bunSocketInternal = Symbol.for(\"::bunnetsocketinternal::\"), { rootCertificates, canonicalizeIP } = @lazy(\"internal/tls\"), SymbolReplace = Symbol.replace, RegExpPrototypeSymbolReplace = @RegExp.prototype[SymbolReplace], RegExpPrototypeExec = @RegExp.prototype.exec, StringPrototypeStartsWith = @String.prototype.startsWith, StringPrototypeSlice = @String.prototype.slice, StringPrototypeIncludes = @String.prototype.includes, StringPrototypeSplit = @String.prototype.split, StringPrototypeIndexOf = @String.prototype.indexOf, StringPrototypeSubstring = @String.prototype.substring, StringPrototypeEndsWith = @String.prototype.endsWith, StringFromCharCode = @String.fromCharCode, StringPrototypeCharCodeAt = @String.prototype.charCodeAt, ArrayPrototypeIncludes = @Array.prototype.includes, ArrayPrototypeJoin = @Array.prototype.join, ArrayPrototypeForEach = @Array.prototype.forEach, ArrayPrototypePush = @Array.prototype.push, ArrayPrototypeSome = @Array.prototype.some, ArrayPrototypeReduce = @Array.prototype.reduce, jsonStringPattern = /^\"(\?:[^\"\\\\\\u0000-\\u001f]|\\\\(\?:[\"\\\\/bfnrt]|u[0-9a-fA-F]{4}))*\"/, InternalSecureContext = class SecureContext2 {\n context;\n constructor(options) {\n const context = {};\n if (options) {\n let key = options.key;\n if (key) {\n if (!isValidTLSArray(key))\n @throwTypeError(\"key argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");\n this.key = key;\n }\n let cert = options.cert;\n if (cert) {\n if (!isValidTLSArray(cert))\n @throwTypeError(\"cert argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");\n this.cert = cert;\n }\n let ca = options.ca;\n if (ca) {\n if (!isValidTLSArray(ca))\n @throwTypeError(\"ca argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");\n this.ca = ca;\n }\n let passphrase = options.passphrase;\n if (passphrase && typeof passphrase !== \"string\")\n @throwTypeError(\"passphrase argument must be an string\");\n this.passphrase = passphrase;\n let servername = options.servername;\n if (servername && typeof servername !== \"string\")\n @throwTypeError(\"servername argument must be an string\");\n this.servername = servername;\n let secureOptions = options.secureOptions || 0;\n if (secureOptions && typeof secureOptions !== \"number\")\n @throwTypeError(\"secureOptions argument must be an number\");\n this.secureOptions = secureOptions;\n }\n this.context = context;\n }\n}, buntls = Symbol.for(\"::buntls::\"), SocketClass, TLSSocket = function(InternalTLSSocket) {\n SocketClass = InternalTLSSocket, Object.defineProperty(SocketClass.prototype, Symbol.toStringTag, {\n value: \"TLSSocket\",\n enumerable: !1\n });\n function Socket(options) {\n return new InternalTLSSocket(options);\n }\n return Socket.prototype = InternalTLSSocket.prototype, Object.defineProperty(Socket, Symbol.hasInstance, {\n value(instance) {\n return instance instanceof InternalTLSSocket;\n }\n });\n}(class TLSSocket2 extends InternalTCPSocket {\n #secureContext;\n ALPNProtocols;\n #socket;\n #checkServerIdentity;\n #session;\n constructor(socket, options) {\n super(socket instanceof InternalTCPSocket \? options : options || socket);\n if (options = options || socket || {}, typeof options === \"object\") {\n const { ALPNProtocols } = options;\n if (ALPNProtocols)\n convertALPNProtocols(ALPNProtocols, this);\n if (socket instanceof InternalTCPSocket)\n this.#socket = socket;\n }\n this.#secureContext = options.secureContext || createSecureContext(options), this.authorized = !1, this.secureConnecting = !0, this._secureEstablished = !1, this._securePending = !0, this.#checkServerIdentity = options.checkServerIdentity || checkServerIdentity, this.#session = options.session || null;\n }\n _secureEstablished = !1;\n _securePending = !0;\n _newSessionPending;\n _controlReleased;\n secureConnecting = !1;\n _SNICallback;\n servername;\n authorized = !1;\n authorizationError;\n #renegotiationDisabled = !1;\n encrypted = !0;\n _start() {\n this.connect();\n }\n getSession() {\n return this[bunSocketInternal]\?.getSession();\n }\n getEphemeralKeyInfo() {\n return this[bunSocketInternal]\?.getEphemeralKeyInfo();\n }\n getCipher() {\n return this[bunSocketInternal]\?.getCipher();\n }\n getSharedSigalgs() {\n return this[bunSocketInternal]\?.getSharedSigalgs();\n }\n getProtocol() {\n return this[bunSocketInternal]\?.getTLSVersion();\n }\n getFinished() {\n return this[bunSocketInternal]\?.getTLSFinishedMessage() || @undefined;\n }\n getPeerFinished() {\n return this[bunSocketInternal]\?.getTLSPeerFinishedMessage() || @undefined;\n }\n isSessionReused() {\n return !!this.#session;\n }\n renegotiate() {\n if (this.#renegotiationDisabled) {\n const error = new Error(\"ERR_TLS_RENEGOTIATION_DISABLED: TLS session renegotiation disabled for this socket\");\n throw error.name = \"ERR_TLS_RENEGOTIATION_DISABLED\", error;\n }\n throw Error(\"Not implented in Bun yet\");\n }\n disableRenegotiation() {\n this.#renegotiationDisabled = !0;\n }\n getTLSTicket() {\n return this[bunSocketInternal]\?.getTLSTicket();\n }\n exportKeyingMaterial(length, label, context) {\n if (context)\n return this[bunSocketInternal]\?.exportKeyingMaterial(length, label, context);\n return this[bunSocketInternal]\?.exportKeyingMaterial(length, label);\n }\n setMaxSendFragment(size) {\n return this[bunSocketInternal]\?.setMaxSendFragment(size) || !1;\n }\n enableTrace() {\n }\n setServername(name) {\n if (this.isServer) {\n let error = new Error(\"ERR_TLS_SNI_FROM_SERVER: Cannot issue SNI from a TLS server-side socket\");\n throw error.name = \"ERR_TLS_SNI_FROM_SERVER\", error;\n }\n this.servername = name, this[bunSocketInternal]\?.setServername(name);\n }\n setSession(session) {\n if (this.#session = session, typeof session === \"string\")\n session = @Buffer.from(session, \"latin1\");\n return this[bunSocketInternal]\?.setSession(session);\n }\n getPeerCertificate(abbreviated) {\n const cert = arguments.length < 1 \? this[bunSocketInternal]\?.getPeerCertificate() : this[bunSocketInternal]\?.getPeerCertificate(abbreviated);\n if (cert)\n return translatePeerCertificate(cert);\n }\n getCertificate() {\n const cert = this[bunSocketInternal]\?.getCertificate();\n if (cert)\n return translatePeerCertificate(cert);\n }\n getPeerX509Certificate() {\n throw Error(\"Not implented in Bun yet\");\n }\n getX509Certificate() {\n throw Error(\"Not implented in Bun yet\");\n }\n get alpnProtocol() {\n return this[bunSocketInternal]\?.alpnProtocol;\n }\n [buntls](port, host) {\n return {\n socket: this.#socket,\n ALPNProtocols: this.ALPNProtocols,\n serverName: this.servername || host || \"localhost\",\n checkServerIdentity: this.#checkServerIdentity,\n session: this.#session,\n ...this.#secureContext\n };\n }\n});\n\nclass Server extends NetServer {\n key;\n cert;\n ca;\n passphrase;\n secureOptions;\n _rejectUnauthorized;\n _requestCert;\n servername;\n ALPNProtocols;\n constructor(options, secureConnectionListener) {\n super(options, secureConnectionListener);\n this.setSecureContext(options);\n }\n setSecureContext(options) {\n if (options instanceof InternalSecureContext)\n options = options.context;\n if (options) {\n const { ALPNProtocols } = options;\n if (ALPNProtocols)\n convertALPNProtocols(ALPNProtocols, this);\n let key = options.key;\n if (key) {\n if (!isValidTLSArray(key))\n @throwTypeError(\"key argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");\n this.key = key;\n }\n let cert = options.cert;\n if (cert) {\n if (!isValidTLSArray(cert))\n @throwTypeError(\"cert argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");\n this.cert = cert;\n }\n let ca = options.ca;\n if (ca) {\n if (!isValidTLSArray(ca))\n @throwTypeError(\"ca argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");\n this.ca = ca;\n }\n let passphrase = options.passphrase;\n if (passphrase && typeof passphrase !== \"string\")\n @throwTypeError(\"passphrase argument must be an string\");\n this.passphrase = passphrase;\n let servername = options.servername;\n if (servername && typeof servername !== \"string\")\n @throwTypeError(\"servername argument must be an string\");\n this.servername = servername;\n let secureOptions = options.secureOptions || 0;\n if (secureOptions && typeof secureOptions !== \"number\")\n @throwTypeError(\"secureOptions argument must be an number\");\n this.secureOptions = secureOptions;\n const requestCert = options.requestCert || !1;\n if (requestCert)\n this._requestCert = requestCert;\n else\n this._requestCert = @undefined;\n const rejectUnauthorized = options.rejectUnauthorized || !1;\n if (rejectUnauthorized)\n this._rejectUnauthorized = rejectUnauthorized;\n else\n this._rejectUnauthorized = @undefined;\n }\n }\n getTicketKeys() {\n throw Error(\"Not implented in Bun yet\");\n }\n setTicketKeys() {\n throw Error(\"Not implented in Bun yet\");\n }\n [buntls](port, host, isClient) {\n return [\n {\n serverName: this.servername || host || \"localhost\",\n key: this.key,\n cert: this.cert,\n ca: this.ca,\n passphrase: this.passphrase,\n secureOptions: this.secureOptions,\n rejectUnauthorized: isClient \? !1 : this._rejectUnauthorized,\n requestCert: isClient \? !1 : this._requestCert,\n ALPNProtocols: this.ALPNProtocols\n },\n SocketClass\n ];\n }\n}\nvar CLIENT_RENEG_LIMIT = 3, CLIENT_RENEG_WINDOW = 600, DEFAULT_ECDH_CURVE = \"auto\", DEFAULT_CIPHERS = \"DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256\", DEFAULT_MIN_VERSION = \"TLSv1.2\", DEFAULT_MAX_VERSION = \"TLSv1.3\", createConnection = (port, host, connectListener) => {\n if (typeof port === \"object\") {\n port.checkServerIdentity;\n const { ALPNProtocols } = port;\n if (ALPNProtocols)\n convertALPNProtocols(ALPNProtocols, port);\n return new TLSSocket(port).connect(port, host, connectListener);\n }\n return new TLSSocket().connect(port, host, connectListener);\n}, connect = createConnection;\n$ = {\n CLIENT_RENEG_LIMIT,\n CLIENT_RENEG_WINDOW,\n connect,\n convertALPNProtocols,\n createConnection,\n createSecureContext,\n createServer,\n DEFAULT_CIPHERS,\n DEFAULT_ECDH_CURVE,\n DEFAULT_MAX_VERSION,\n DEFAULT_MIN_VERSION,\n getCiphers,\n parseCertString,\n SecureContext,\n Server,\n TLSSocket,\n checkServerIdentity,\n rootCertificates\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeTraceEventsCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/trace_events.ts\nvar ERR_INVALID_ARG_TYPE = function(name, type, value) {\n const err = @makeTypeError(`The \"${name}\" argument must be of type ${type}. Received ${value}`);\n return err.code = \"ERR_INVALID_ARG_TYPE\", err;\n}, createTracing = function(opts) {\n if (typeof opts !== \"object\" || opts == null)\n throw new ERR_INVALID_ARG_TYPE(\"options\", \"Object\", opts);\n return new Tracing(opts);\n}, getEnabledCategories = function() {\n return \"\";\n}, $;\n\nclass Tracing {\n enabled = !1;\n categories = \"\";\n}\n$ = {\n createTracing,\n getEnabledCategories\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeTtyCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/tty.ts\nvar ReadStream = function(fd) {\n if (!(this instanceof ReadStream))\n return new ReadStream(fd);\n if (fd >> 0 !== fd || fd < 0)\n @throwRangeError(\"fd must be a positive integer\");\n const stream = (@getInternalField(@internalModuleRegistry, 21) || @createInternalModuleById(21)).ReadStream.@call(this, \"\", {\n fd\n });\n return Object.setPrototypeOf(stream, ReadStream.prototype), stream.isRaw = !1, stream.isTTY = !0, stream;\n}, warnOnDeactivatedColors = function(env) {\n if (warned)\n return;\n let name = \"\";\n if (env.NODE_DISABLE_COLORS !== @undefined)\n name = \"NODE_DISABLE_COLORS\";\n if (env.NO_COLOR !== @undefined) {\n if (name !== \"\")\n name += \"' and '\";\n name += \"NO_COLOR\";\n }\n if (name !== \"\")\n process.emitWarning(`The '${name}' env is ignored due to the 'FORCE_COLOR' env being set.`, \"Warning\"), warned = !0;\n}, WriteStream = function(fd) {\n if (!(this instanceof WriteStream))\n return new WriteStream(fd);\n if (fd >> 0 !== fd || fd < 0)\n @throwRangeError(\"fd must be a positive integer\");\n const stream = (@getInternalField(@internalModuleRegistry, 21) || @createInternalModuleById(21)).WriteStream.@call(this, \"\", {\n fd\n });\n if (stream.columns = @undefined, stream.rows = @undefined, stream.isTTY = isatty(stream.fd), stream.isTTY) {\n const windowSizeArray = [0, 0];\n if (_getWindowSize(fd, windowSizeArray) === !0)\n stream.columns = windowSizeArray[0], stream.rows = windowSizeArray[1];\n }\n return stream;\n}, { ttySetMode, isatty, getWindowSize: _getWindowSize } = @lazy(\"tty\"), NumberIsInteger = Number.isInteger;\nObject.defineProperty(ReadStream, \"prototype\", {\n get() {\n const Prototype = Object.create((@getInternalField(@internalModuleRegistry, 21) || @createInternalModuleById(21)).ReadStream.prototype);\n return Prototype.setRawMode = function(flag) {\n const mode = flag \? 1 : 0, err = ttySetMode(this.fd, mode);\n if (err)\n return this.emit(\"error\", new Error(\"setRawMode failed with errno: \" + err)), this;\n return this.isRaw = flag, this;\n }, Object.defineProperty(ReadStream, \"prototype\", { value: Prototype }), Prototype;\n },\n enumerable: !0,\n configurable: !0\n});\nvar COLORS_2 = 1, COLORS_16 = 4, COLORS_256 = 8, COLORS_16m = 24, TERM_ENVS = {\n eterm: COLORS_16,\n cons25: COLORS_16,\n console: COLORS_16,\n cygwin: COLORS_16,\n dtterm: COLORS_16,\n gnome: COLORS_16,\n hurd: COLORS_16,\n jfbterm: COLORS_16,\n konsole: COLORS_16,\n kterm: COLORS_16,\n mlterm: COLORS_16,\n mosh: COLORS_16m,\n putty: COLORS_16,\n st: COLORS_16,\n \"rxvt-unicode-24bit\": COLORS_16m,\n terminator: COLORS_16m\n}, TERM_ENVS_REG_EXP = [/ansi/, /color/, /linux/, /^con[0-9]*x[0-9]/, /^rxvt/, /^screen/, /^xterm/, /^vt100/], warned = !1;\nObject.defineProperty(WriteStream, \"prototype\", {\n get() {\n const Real = (@getInternalField(@internalModuleRegistry, 21) || @createInternalModuleById(21)).WriteStream.prototype;\n Object.defineProperty(WriteStream, \"prototype\", { value: Real }), WriteStream.prototype._refreshSize = function() {\n const oldCols = this.columns, oldRows = this.rows, windowSizeArray = [0, 0];\n if (_getWindowSize(this.fd, windowSizeArray) === !0) {\n if (oldCols !== windowSizeArray[0] || oldRows !== windowSizeArray[1])\n this.columns = windowSizeArray[0], this.rows = windowSizeArray[1], this.emit(\"resize\");\n }\n };\n var readline = @undefined;\n return WriteStream.prototype.clearLine = function(dir, cb) {\n return (readline \?\?= @getInternalField(@internalModuleRegistry, 35) || @createInternalModuleById(35)).clearLine(this, dir, cb);\n }, WriteStream.prototype.clearScreenDown = function(cb) {\n return (readline \?\?= @getInternalField(@internalModuleRegistry, 35) || @createInternalModuleById(35)).clearScreenDown(this, cb);\n }, WriteStream.prototype.cursorTo = function(x, y, cb) {\n return (readline \?\?= @getInternalField(@internalModuleRegistry, 35) || @createInternalModuleById(35)).cursorTo(this, x, y, cb);\n }, WriteStream.prototype.getColorDepth = function(env = process.env) {\n if (env.FORCE_COLOR !== @undefined)\n switch (env.FORCE_COLOR) {\n case \"\":\n case \"1\":\n case \"true\":\n return warnOnDeactivatedColors(env), COLORS_16;\n case \"2\":\n return warnOnDeactivatedColors(env), COLORS_256;\n case \"3\":\n return warnOnDeactivatedColors(env), COLORS_16m;\n default:\n return COLORS_2;\n }\n if (env.NODE_DISABLE_COLORS !== @undefined || env.NO_COLOR !== @undefined || env.TERM === \"dumb\")\n return COLORS_2;\n if (env.TMUX)\n return COLORS_256;\n if (env.CI) {\n if ([\"APPVEYOR\", \"BUILDKITE\", \"CIRCLECI\", \"DRONE\", \"GITHUB_ACTIONS\", \"GITLAB_CI\", \"TRAVIS\"].some((sign) => (sign in env)) || env.CI_NAME === \"codeship\")\n return COLORS_256;\n return COLORS_2;\n }\n if (\"TEAMCITY_VERSION\" in env)\n return /^(9\\.(0*[1-9]\\d*)\\.|\\d{2,}\\.)/.test(env.TEAMCITY_VERSION) \? COLORS_16 : COLORS_2;\n switch (env.TERM_PROGRAM) {\n case \"iTerm.app\":\n if (!env.TERM_PROGRAM_VERSION || /^[0-2]\\./.test(env.TERM_PROGRAM_VERSION))\n return COLORS_256;\n return COLORS_16m;\n case \"HyperTerm\":\n case \"MacTerm\":\n return COLORS_16m;\n case \"Apple_Terminal\":\n return COLORS_256;\n }\n if (env.COLORTERM === \"truecolor\" || env.COLORTERM === \"24bit\")\n return COLORS_16m;\n if (env.TERM) {\n if (/^xterm-256/.test(env.TERM) !== null)\n return COLORS_256;\n const termEnv = env.TERM.toLowerCase();\n if (TERM_ENVS[termEnv])\n return TERM_ENVS[termEnv];\n if (TERM_ENVS_REG_EXP.some((term) => term.test(termEnv)))\n return COLORS_16;\n }\n if (env.COLORTERM)\n return COLORS_16;\n return COLORS_2;\n }, WriteStream.prototype.getWindowSize = function() {\n return [this.columns, this.rows];\n }, WriteStream.prototype.hasColors = function(count, env) {\n if (env === @undefined && (count === @undefined || typeof count === \"object\" && count !== null))\n env = count, count = 16;\n else\n validateInteger(count, \"count\", 2);\n return count <= 2 ** this.getColorDepth(env);\n }, WriteStream.prototype.moveCursor = function(dx, dy, cb) {\n return (readline \?\?= @getInternalField(@internalModuleRegistry, 35) || @createInternalModuleById(35)).moveCursor(this, dx, dy, cb);\n }, Real;\n },\n enumerable: !0,\n configurable: !0\n});\nvar validateInteger = (value, name, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER) => {\n if (typeof value !== \"number\")\n throw new ERR_INVALID_ARG_TYPE(name, \"number\", value);\n if (!NumberIsInteger(value))\n throw new ERR_OUT_OF_RANGE(name, \"an integer\", value);\n if (value < min || value > max)\n throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);\n};\nreturn { ReadStream, WriteStream, isatty }})\n"); -// - -// -static constexpr ASCIILiteral NodeUrlCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/url.ts\nvar Url = function() {\n this.protocol = null, this.slashes = null, this.auth = null, this.host = null, this.port = null, this.hostname = null, this.hash = null, this.search = null, this.query = null, this.pathname = null, this.path = null, this.href = null;\n}, urlParse = function(url, parseQueryString, slashesDenoteHost) {\n if (url && typeof url === \"object\" && url instanceof Url)\n return url;\n var u = new Url;\n return u.parse(url, parseQueryString, slashesDenoteHost), u;\n}, urlFormat = function(obj) {\n if (typeof obj === \"string\")\n obj = urlParse(obj);\n if (!(obj instanceof Url))\n return Url.prototype.format.@call(obj);\n return obj.format();\n}, urlResolve = function(source, relative) {\n return urlParse(source, !1, !0).resolve(relative);\n}, urlResolveObject = function(source, relative) {\n if (!source)\n return relative;\n return urlParse(source, !1, !0).resolveObject(relative);\n}, urlToHttpOptions = function(url) {\n const options = {\n protocol: url.protocol,\n hostname: typeof url.hostname === \"string\" && url.hostname.startsWith(\"[\") \? url.hostname.slice(1, -1) : url.hostname,\n hash: url.hash,\n search: url.search,\n pathname: url.pathname,\n path: `${url.pathname || \"\"}${url.search || \"\"}`,\n href: url.href\n };\n if (url.port !== \"\")\n options.port = Number(url.port);\n if (url.username || url.password)\n options.auth = `${decodeURIComponent(url.username)}:${decodeURIComponent(url.password)}`;\n return options;\n}, $, { URL, URLSearchParams } = globalThis;\nUrl.prototype = {};\nvar protocolPattern = /^([a-z0-9.+-]+:)/i, portPattern = /:[0-9]*$/, simplePathPattern = /^(\\/\\/\?(\?!\\/)[^\?\\s]*)(\\\?[^\\s]*)\?$/, delims = [\"<\", \">\", '\"', \"`\", \" \", \"\\r\", \"\\n\", \"\\t\"], unwise = [\"{\", \"}\", \"|\", \"\\\\\", \"^\", \"`\"].concat(delims), autoEscape = [\"'\"].concat(unwise), nonHostChars = [\"%\", \"/\", \"\?\", \";\", \"#\"].concat(autoEscape), hostEndingChars = [\"/\", \"\?\", \"#\"], hostnameMaxLen = 255, hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, unsafeProtocol = {\n javascript: !0,\n \"javascript:\": !0\n}, hostlessProtocol = {\n javascript: !0,\n \"javascript:\": !0\n}, slashedProtocol = {\n http: !0,\n https: !0,\n ftp: !0,\n gopher: !0,\n file: !0,\n \"http:\": !0,\n \"https:\": !0,\n \"ftp:\": !0,\n \"gopher:\": !0,\n \"file:\": !0\n};\nUrl.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {\n if (typeof url !== \"string\")\n @throwTypeError(\"Parameter 'url' must be a string, not \" + typeof url);\n var queryIndex = url.indexOf(\"\?\"), splitter = queryIndex !== -1 && queryIndex < url.indexOf(\"#\") \? \"\?\" : \"#\", uSplit = url.split(splitter), slashRegex = /\\\\/g;\n uSplit[0] = uSplit[0].replace(slashRegex, \"/\"), url = uSplit.join(splitter);\n var rest = url;\n if (rest = rest.trim(), !slashesDenoteHost && url.split(\"#\").length === 1) {\n var simplePath = simplePathPattern.exec(rest);\n if (simplePath) {\n if (this.path = rest, this.href = rest, this.pathname = simplePath[1], simplePath[2])\n if (this.search = simplePath[2], parseQueryString)\n this.query = new URLSearchParams(this.search.substr(1)).toJSON();\n else\n this.query = this.search.substr(1);\n else if (parseQueryString)\n this.search = \"\", this.query = {};\n return this;\n }\n }\n var proto = protocolPattern.exec(rest);\n if (proto) {\n proto = proto[0];\n var lowerProto = proto.toLowerCase();\n this.protocol = lowerProto, rest = rest.substr(proto.length);\n }\n if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@/]+@[^@/]+/)) {\n var slashes = rest.substr(0, 2) === \"//\";\n if (slashes && !(proto && hostlessProtocol[proto]))\n rest = rest.substr(2), this.slashes = !0;\n }\n if (!hostlessProtocol[proto] && (slashes || proto && !slashedProtocol[proto])) {\n var hostEnd = -1;\n for (var i = 0;i < hostEndingChars.length; i++) {\n var hec = rest.indexOf(hostEndingChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n var auth, atSign;\n if (hostEnd === -1)\n atSign = rest.lastIndexOf(\"@\");\n else\n atSign = rest.lastIndexOf(\"@\", hostEnd);\n if (atSign !== -1)\n auth = rest.slice(0, atSign), rest = rest.slice(atSign + 1), this.auth = decodeURIComponent(auth);\n hostEnd = -1;\n for (var i = 0;i < nonHostChars.length; i++) {\n var hec = rest.indexOf(nonHostChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n if (hostEnd === -1)\n hostEnd = rest.length;\n this.host = rest.slice(0, hostEnd), rest = rest.slice(hostEnd), this.parseHost(), this.hostname = this.hostname || \"\";\n var ipv6Hostname = this.hostname[0] === \"[\" && this.hostname[this.hostname.length - 1] === \"]\";\n if (!ipv6Hostname) {\n var hostparts = this.hostname.split(/\\./);\n for (var i = 0, l = hostparts.length;i < l; i++) {\n var part = hostparts[i];\n if (!part)\n continue;\n if (!part.match(hostnamePartPattern)) {\n var newpart = \"\";\n for (var j = 0, k = part.length;j < k; j++)\n if (part.charCodeAt(j) > 127)\n newpart += \"x\";\n else\n newpart += part[j];\n if (!newpart.match(hostnamePartPattern)) {\n var validParts = hostparts.slice(0, i), notHost = hostparts.slice(i + 1), bit = part.match(hostnamePartStart);\n if (bit)\n validParts.push(bit[1]), notHost.unshift(bit[2]);\n if (notHost.length)\n rest = \"/\" + notHost.join(\".\") + rest;\n this.hostname = validParts.join(\".\");\n break;\n }\n }\n }\n }\n if (this.hostname.length > hostnameMaxLen)\n this.hostname = \"\";\n else\n this.hostname = this.hostname.toLowerCase();\n if (!ipv6Hostname)\n this.hostname = new URL(\"http://\" + this.hostname).hostname;\n var p = this.port \? \":\" + this.port : \"\", h = this.hostname || \"\";\n if (this.host = h + p, this.href += this.host, ipv6Hostname) {\n if (this.hostname = this.hostname.substr(1, this.hostname.length - 2), rest[0] !== \"/\")\n rest = \"/\" + rest;\n }\n }\n if (!unsafeProtocol[lowerProto])\n for (var i = 0, l = autoEscape.length;i < l; i++) {\n var ae = autoEscape[i];\n if (rest.indexOf(ae) === -1)\n continue;\n var esc = encodeURIComponent(ae);\n if (esc === ae)\n esc = escape(ae);\n rest = rest.split(ae).join(esc);\n }\n var hash = rest.indexOf(\"#\");\n if (hash !== -1)\n this.hash = rest.substr(hash), rest = rest.slice(0, hash);\n var qm = rest.indexOf(\"\?\");\n if (qm !== -1) {\n if (this.search = rest.substr(qm), this.query = rest.substr(qm + 1), parseQueryString) {\n const query = this.query;\n this.query = new URLSearchParams(query).toJSON();\n }\n rest = rest.slice(0, qm);\n } else if (parseQueryString)\n this.search = \"\", this.query = {};\n if (rest)\n this.pathname = rest;\n if (slashedProtocol[lowerProto] && this.hostname && !this.pathname)\n this.pathname = \"/\";\n if (this.pathname || this.search) {\n var p = this.pathname || \"\", s = this.search || \"\";\n this.path = p + s;\n }\n return this.href = this.format(), this;\n};\nUrl.prototype.format = function() {\n var auth = this.auth || \"\";\n if (auth)\n auth = encodeURIComponent(auth), auth = auth.replace(/%3A/i, \":\"), auth += \"@\";\n var protocol = this.protocol || \"\", pathname = this.pathname || \"\", hash = this.hash || \"\", host = !1, query = \"\";\n if (this.host)\n host = auth + this.host;\n else if (this.hostname) {\n if (host = auth + (this.hostname.indexOf(\":\") === -1 \? this.hostname : \"[\" + this.hostname + \"]\"), this.port)\n host += \":\" + this.port;\n }\n if (this.query && typeof this.query === \"object\" && Object.keys(this.query).length)\n query = new URLSearchParams(this.query).toString();\n var search = this.search || query && \"\?\" + query || \"\";\n if (protocol && protocol.substr(-1) !== \":\")\n protocol += \":\";\n if (this.slashes || (!protocol || slashedProtocol[protocol]) && host !== !1) {\n if (host = \"//\" + (host || \"\"), pathname && pathname.charAt(0) !== \"/\")\n pathname = \"/\" + pathname;\n } else if (!host)\n host = \"\";\n if (hash && hash.charAt(0) !== \"#\")\n hash = \"#\" + hash;\n if (search && search.charAt(0) !== \"\?\")\n search = \"\?\" + search;\n return pathname = pathname.replace(/[\?#]/g, function(match) {\n return encodeURIComponent(match);\n }), search = search.replace(\"#\", \"%23\"), protocol + host + pathname + search + hash;\n};\nUrl.prototype.resolve = function(relative) {\n return this.resolveObject(urlParse(relative, !1, !0)).format();\n};\nUrl.prototype.resolveObject = function(relative) {\n if (typeof relative === \"string\") {\n var rel = new Url;\n rel.parse(relative, !1, !0), relative = rel;\n }\n var result = new Url, tkeys = Object.keys(this);\n for (var tk = 0;tk < tkeys.length; tk++) {\n var tkey = tkeys[tk];\n result[tkey] = this[tkey];\n }\n if (result.hash = relative.hash, relative.href === \"\")\n return result.href = result.format(), result;\n if (relative.slashes && !relative.protocol) {\n var rkeys = Object.keys(relative);\n for (var rk = 0;rk < rkeys.length; rk++) {\n var rkey = rkeys[rk];\n if (rkey !== \"protocol\")\n result[rkey] = relative[rkey];\n }\n if (slashedProtocol[result.protocol] && result.hostname && !result.pathname)\n result.pathname = \"/\", result.path = result.pathname;\n return result.href = result.format(), result;\n }\n if (relative.protocol && relative.protocol !== result.protocol) {\n if (!slashedProtocol[relative.protocol]) {\n var keys = Object.keys(relative);\n for (var v = 0;v < keys.length; v++) {\n var k = keys[v];\n result[k] = relative[k];\n }\n return result.href = result.format(), result;\n }\n if (result.protocol = relative.protocol, !relative.host && !hostlessProtocol[relative.protocol]) {\n var relPath = (relative.pathname || \"\").split(\"/\");\n while (relPath.length && !(relative.host = relPath.shift()))\n ;\n if (!relative.host)\n relative.host = \"\";\n if (!relative.hostname)\n relative.hostname = \"\";\n if (relPath[0] !== \"\")\n relPath.unshift(\"\");\n if (relPath.length < 2)\n relPath.unshift(\"\");\n result.pathname = relPath.join(\"/\");\n } else\n result.pathname = relative.pathname;\n if (result.search = relative.search, result.query = relative.query, result.host = relative.host || \"\", result.auth = relative.auth, result.hostname = relative.hostname || relative.host, result.port = relative.port, result.pathname || result.search) {\n var p = result.pathname || \"\", s = result.search || \"\";\n result.path = p + s;\n }\n return result.slashes = result.slashes || relative.slashes, result.href = result.format(), result;\n }\n var isSourceAbs = result.pathname && result.pathname.charAt(0) === \"/\", isRelAbs = relative.host || relative.pathname && relative.pathname.charAt(0) === \"/\", mustEndAbs = isRelAbs || isSourceAbs || result.host && relative.pathname, removeAllDots = mustEndAbs, srcPath = result.pathname && result.pathname.split(\"/\") || [], relPath = relative.pathname && relative.pathname.split(\"/\") || [], psychotic = result.protocol && !slashedProtocol[result.protocol];\n if (psychotic) {\n if (result.hostname = \"\", result.port = null, result.host)\n if (srcPath[0] === \"\")\n srcPath[0] = result.host;\n else\n srcPath.unshift(result.host);\n if (result.host = \"\", relative.protocol) {\n if (relative.hostname = null, relative.port = null, relative.host)\n if (relPath[0] === \"\")\n relPath[0] = relative.host;\n else\n relPath.unshift(relative.host);\n relative.host = null;\n }\n mustEndAbs = mustEndAbs && (relPath[0] === \"\" || srcPath[0] === \"\");\n }\n if (isRelAbs)\n result.host = relative.host || relative.host === \"\" \? relative.host : result.host, result.hostname = relative.hostname || relative.hostname === \"\" \? relative.hostname : result.hostname, result.search = relative.search, result.query = relative.query, srcPath = relPath;\n else if (relPath.length) {\n if (!srcPath)\n srcPath = [];\n srcPath.pop(), srcPath = srcPath.concat(relPath), result.search = relative.search, result.query = relative.query;\n } else if (relative.search != null) {\n if (psychotic) {\n result.host = srcPath.shift(), result.hostname = result.host;\n var authInHost = result.host && result.host.indexOf(\"@\") > 0 \? result.host.split(\"@\") : !1;\n if (authInHost)\n result.auth = authInHost.shift(), result.hostname = authInHost.shift(), result.host = result.hostname;\n }\n if (result.search = relative.search, result.query = relative.query, result.pathname !== null || result.search !== null)\n result.path = (result.pathname \? result.pathname : \"\") + (result.search \? result.search : \"\");\n return result.href = result.format(), result;\n }\n if (!srcPath.length) {\n if (result.pathname = null, result.search)\n result.path = \"/\" + result.search;\n else\n result.path = null;\n return result.href = result.format(), result;\n }\n var last = srcPath.slice(-1)[0], hasTrailingSlash = (result.host || relative.host || srcPath.length > 1) && (last === \".\" || last === \"..\") || last === \"\", up = 0;\n for (var i = srcPath.length;i >= 0; i--)\n if (last = srcPath[i], last === \".\")\n srcPath.splice(i, 1);\n else if (last === \"..\")\n srcPath.splice(i, 1), up++;\n else if (up)\n srcPath.splice(i, 1), up--;\n if (!mustEndAbs && !removeAllDots)\n for (;up--; up)\n srcPath.unshift(\"..\");\n if (mustEndAbs && srcPath[0] !== \"\" && (!srcPath[0] || srcPath[0].charAt(0) !== \"/\"))\n srcPath.unshift(\"\");\n if (hasTrailingSlash && srcPath.join(\"/\").substr(-1) !== \"/\")\n srcPath.push(\"\");\n var isAbsolute = srcPath[0] === \"\" || srcPath[0] && srcPath[0].charAt(0) === \"/\";\n if (psychotic) {\n result.hostname = isAbsolute \? \"\" : srcPath.length \? srcPath.shift() : \"\", result.host = result.hostname;\n var authInHost = result.host && result.host.indexOf(\"@\") > 0 \? result.host.split(\"@\") : !1;\n if (authInHost)\n result.auth = authInHost.shift(), result.hostname = authInHost.shift(), result.host = result.hostname;\n }\n if (mustEndAbs = mustEndAbs || result.host && srcPath.length, mustEndAbs && !isAbsolute)\n srcPath.unshift(\"\");\n if (srcPath.length > 0)\n result.pathname = srcPath.join(\"/\");\n else\n result.pathname = null, result.path = null;\n if (result.pathname !== null || result.search !== null)\n result.path = (result.pathname \? result.pathname : \"\") + (result.search \? result.search : \"\");\n return result.auth = relative.auth || result.auth, result.slashes = result.slashes || relative.slashes, result.href = result.format(), result;\n};\nUrl.prototype.parseHost = function() {\n var host = this.host, port = portPattern.exec(host);\n if (port) {\n if (port = port[0], port !== \":\")\n this.port = port.substr(1);\n host = host.substr(0, host.length - port.length);\n }\n if (host)\n this.hostname = host;\n};\nvar pathToFileURL = @lazy(\"pathToFileURL\"), fileURLToPath = @lazy(\"fileURLToPath\");\n$ = {\n parse: urlParse,\n resolve: urlResolve,\n resolveObject: urlResolveObject,\n format: urlFormat,\n Url,\n URLSearchParams,\n URL,\n pathToFileURL,\n fileURLToPath,\n urlToHttpOptions\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeUtilCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/util.ts\nvar isBuffer = function(value) {\n return @Buffer.isBuffer(value);\n}, isFunction = function(value) {\n return typeof value === \"function\";\n}, deprecate = function(fn, msg, code) {\n if (process.noDeprecation === !0)\n return fn;\n var warned = !1;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n var err = new Error(msg);\n if (code)\n err.code = code;\n throw err;\n } else if (process.traceDeprecation)\n console.trace(msg);\n else\n console.error(msg);\n warned = !0;\n }\n return fn.@apply(this, arguments);\n }\n return deprecated;\n}, debuglog = function(set) {\n if (set = set.toUpperCase(), !debugs[set])\n if (debugEnvRegex.test(set)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = format.@apply(cjs_exports, arguments);\n console.error(\"%s %d: %s\", set, pid, msg);\n };\n } else\n debugs[set] = function() {\n };\n return debugs[set];\n}, isBoolean = function(arg) {\n return typeof arg === \"boolean\";\n}, isNull = function(arg) {\n return arg === null;\n}, isNullOrUndefined = function(arg) {\n return arg == null;\n}, isNumber = function(arg) {\n return typeof arg === \"number\";\n}, isString = function(arg) {\n return typeof arg === \"string\";\n}, isSymbol = function(arg) {\n return typeof arg === \"symbol\";\n}, isUndefined = function(arg) {\n return arg === void 0;\n}, isObject = function(arg) {\n return typeof arg === \"object\" && arg !== null;\n}, isPrimitive = function(arg) {\n return arg === null || typeof arg === \"boolean\" || typeof arg === \"number\" || typeof arg === \"string\" || typeof arg === \"symbol\" || typeof arg === \"undefined\";\n}, pad = function(n) {\n return n < 10 \? \"0\" + n.toString(10) : n.toString(10);\n}, timestamp = function() {\n var d = new Date, time = [pad(d.getHours()), pad(d.getMinutes()), pad(d.getSeconds())].join(\":\");\n return [d.getDate(), months[d.getMonth()], time].join(\" \");\n}, callbackifyOnRejected = function(reason, cb) {\n if (!reason) {\n var newReason = new Error(\"Promise was rejected with a falsy value\");\n newReason.reason = reason, newReason.code = \"ERR_FALSY_VALUE_REJECTION\", reason = newReason;\n }\n return cb(reason);\n}, callbackify = function(original) {\n if (typeof original !== \"function\")\n @throwTypeError('The \"original\" argument must be of type Function');\n function callbackified() {\n var args = @Array.prototype.slice.@call(arguments), maybeCb = args.pop();\n if (typeof maybeCb !== \"function\")\n @throwTypeError(\"The last argument must be of type Function\");\n var self = this, cb = function() {\n return maybeCb.@apply(self, arguments);\n };\n original.@apply(this, args).then(function(ret) {\n process.nextTick(cb, null, ret);\n }, function(rej) {\n process.nextTick(callbackifyOnRejected, rej, cb);\n });\n }\n return Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original)), Object.defineProperties(callbackified, getOwnPropertyDescriptors(original)), callbackified;\n}, $, types = @requireNativeModule(\"util/types\"), utl = @getInternalField(@internalModuleRegistry, 7) || @createInternalModuleById(7), cjs_exports = {}, deepEquals = Bun.deepEquals, isDeepStrictEqual = (a, b) => deepEquals(a, b, !0), getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors, inspect = utl.inspect, formatWithOptions = utl.formatWithOptions, format = utl.format, stripVTControlCharacters = utl.stripVTControlCharacters, debugs = {}, debugEnvRegex = /^$/;\nif (process.env.NODE_DEBUG)\n debugEnv = process.env.NODE_DEBUG, debugEnv = debugEnv.replace(/[|\\\\{}()[\\]^$+\?.]/g, \"\\\\$&\").replace(/\\*/g, \".*\").replace(/,/g, \"$|^\").toUpperCase(), debugEnvRegex = new @RegExp(\"^\" + debugEnv + \"$\", \"i\");\nvar debugEnv, isRegExp = types.isRegExp, isDate = types.isDate, isError = types.isNativeError, months = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], log = function log2() {\n console.log(\"%s - %s\", timestamp(), format.@apply(cjs_exports, arguments));\n}, inherits = function inherits2(ctor, superCtor) {\n ctor.super_ = superCtor, ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: !1,\n writable: !0,\n configurable: !0\n }\n });\n}, _extend = function(origin, add) {\n if (!add || !isObject(add))\n return origin;\n var keys = Object.keys(add), i = keys.length;\n while (i--)\n origin[keys[i]] = add[keys[i]];\n return origin;\n}, kCustomPromisifiedSymbol = Symbol.for(\"util.promisify.custom\"), promisify = function promisify2(original) {\n if (typeof original !== \"function\")\n @throwTypeError('The \"original\" argument must be of type Function');\n if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {\n var fn = original[kCustomPromisifiedSymbol];\n if (typeof fn !== \"function\")\n @throwTypeError('The \"util.promisify.custom\" argument must be of type Function');\n return Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn,\n enumerable: !1,\n writable: !1,\n configurable: !0\n }), fn;\n }\n function fn() {\n var promiseResolve, promiseReject, promise = new @Promise(function(resolve, reject) {\n promiseResolve = resolve, promiseReject = reject;\n }), args = [];\n for (var i = 0;i < arguments.length; i++)\n args.push(arguments[i]);\n args.push(function(err, value) {\n if (err)\n promiseReject(err);\n else\n promiseResolve(value);\n });\n try {\n original.@apply(this, args);\n } catch (err) {\n promiseReject(err);\n }\n return promise;\n }\n if (Object.setPrototypeOf(fn, Object.getPrototypeOf(original)), kCustomPromisifiedSymbol)\n Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn,\n enumerable: !1,\n writable: !1,\n configurable: !0\n });\n return Object.defineProperties(fn, getOwnPropertyDescriptors(original));\n};\npromisify.custom = kCustomPromisifiedSymbol;\nvar toUSVString = (input) => {\n return (input + \"\").toWellFormed();\n};\n$ = Object.assign(cjs_exports, {\n format,\n formatWithOptions,\n stripVTControlCharacters,\n deprecate,\n debuglog,\n _extend,\n inspect,\n types,\n isArray: @isArray,\n isBoolean,\n isNull,\n isNullOrUndefined,\n isNumber,\n isString,\n isSymbol,\n isUndefined,\n isRegExp,\n isObject,\n isDate,\n isFunction,\n isError,\n isPrimitive,\n isBuffer,\n log,\n inherits,\n toUSVString,\n promisify,\n callbackify,\n isDeepStrictEqual,\n TextDecoder,\n TextEncoder\n});\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeV8Code = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/v8.ts\nvar notimpl = function(message) {\n throwNotImplemented(\"node:v8 \" + message);\n}, cachedDataVersionTag = function() {\n notimpl(\"cachedDataVersionTag\");\n}, getHeapSnapshot = function() {\n notimpl(\"getHeapSnapshot\");\n}, getHeapStatistics = function() {\n const stats = jsc.heapStats();\n return {\n total_heap_size: stats.heapCapacity,\n total_heap_size_executable: 0,\n total_physical_size: stats.heapSize,\n total_available_size: @Infinity,\n used_heap_size: stats.heapSize,\n heap_size_limit: @Infinity,\n malloced_memory: stats.heapSize,\n peak_malloced_memory: @Infinity,\n does_zap_garbage: 0,\n number_of_native_contexts: @Infinity,\n number_of_detached_contexts: @Infinity,\n total_global_handles_size: @Infinity,\n used_global_handles_size: @Infinity,\n external_memory: @Infinity\n };\n}, getHeapSpaceStatistics = function() {\n notimpl(\"getHeapSpaceStatistics\");\n}, getHeapCodeStatistics = function() {\n notimpl(\"getHeapCodeStatistics\");\n}, setFlagsFromString = function() {\n notimpl(\"setFlagsFromString\");\n}, deserialize = function(value) {\n return jsc.deserialize(value);\n}, takeCoverage = function() {\n notimpl(\"takeCoverage\");\n}, stopCoverage = function() {\n notimpl(\"stopCoverage\");\n}, serialize = function(arg1) {\n return jsc.serialize(arg1, { binaryType: \"nodebuffer\" });\n}, writeHeapSnapshot = function() {\n notimpl(\"writeHeapSnapshot\");\n}, setHeapSnapshotNearHeapLimit = function() {\n notimpl(\"setHeapSnapshotNearHeapLimit\");\n}, $, { hideFromStack, throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6), jsc = @requireNativeModule(\"bun:jsc\");\n\nclass Deserializer {\n constructor() {\n notimpl(\"Deserializer\");\n }\n}\n\nclass Serializer {\n constructor() {\n notimpl(\"Serializer\");\n }\n}\n\nclass DefaultDeserializer extends Deserializer {\n constructor() {\n super(...arguments);\n }\n}\n\nclass DefaultSerializer extends Serializer {\n constructor() {\n super(...arguments);\n }\n}\n\nclass GCProfiler {\n constructor() {\n notimpl(\"GCProfiler\");\n }\n}\nvar promiseHooks = {\n createHook: () => {\n notimpl(\"createHook\");\n },\n onInit: () => {\n notimpl(\"onInit\");\n },\n onBefore: () => {\n notimpl(\"onBefore\");\n },\n onAfter: () => {\n notimpl(\"onAfter\");\n },\n onSettled: () => {\n notimpl(\"onSettled\");\n }\n}, startupSnapshot = {\n addDeserializeCallback: () => notimpl(\"addDeserializeCallback\"),\n addSerializeCallback: () => notimpl(\"addSerializeCallback\"),\n setDeserializeMainFunction: () => notimpl(\"setDeserializeMainFunction\"),\n isBuildingSnapshot: () => notimpl(\"isBuildingSnapshot\")\n};\n$ = {\n cachedDataVersionTag,\n getHeapSnapshot,\n getHeapStatistics,\n getHeapSpaceStatistics,\n getHeapCodeStatistics,\n setFlagsFromString,\n deserialize,\n takeCoverage,\n stopCoverage,\n serialize,\n writeHeapSnapshot,\n setHeapSnapshotNearHeapLimit,\n promiseHooks,\n startupSnapshot,\n Deserializer,\n Serializer\n};\nhideFromStack(notimpl, cachedDataVersionTag, getHeapSnapshot, getHeapStatistics, getHeapSpaceStatistics, getHeapCodeStatistics, setFlagsFromString, deserialize, takeCoverage, stopCoverage, serialize, writeHeapSnapshot, setHeapSnapshotNearHeapLimit, Deserializer, Serializer, DefaultDeserializer, DefaultSerializer, GCProfiler);\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeVMCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/vm.ts\nvar runInContext = function(code, context, options) {\n return new Script(code, options).runInContext(context);\n}, compileFunction = function() {\n throwNotImplemented(\"node:vm compileFunction\");\n}, measureMemory = function() {\n throwNotImplemented(\"node:vm measureMemory\");\n}, $, { throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6), vm = @lazy(\"vm\"), { createContext, isContext, Script, runInNewContext, runInThisContext } = vm;\n\nclass Module {\n constructor() {\n throwNotImplemented(\"node:vm Module\");\n }\n}\n\nclass SourceTextModule {\n constructor() {\n throwNotImplemented(\"node:vm Module\");\n }\n}\n\nclass SyntheticModule {\n constructor() {\n throwNotImplemented(\"node:vm Module\");\n }\n}\n$ = {\n createContext,\n runInContext,\n runInNewContext,\n runInThisContext,\n isContext,\n compileFunction,\n measureMemory,\n Script,\n Module,\n SourceTextModule,\n SyntheticModule\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeWasiCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/wasi.ts\nvar nodeFsConstants = @processBindingConstants.fs, __getOwnPropNames = Object.getOwnPropertyNames, __commonJS = (cb, mod) => function __require2() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n}, require_types = __commonJS({\n \"node_modules/wasi-js/dist/types.js\"(exports) {\n Object.defineProperty(exports, \"__esModule\", { value: !0 }), exports.WASIKillError = exports.WASIExitError = exports.WASIError = void 0;\n var WASIError = class extends Error {\n constructor(errno) {\n super();\n this.errno = errno, Object.setPrototypeOf(this, WASIError.prototype);\n }\n };\n exports.WASIError = WASIError;\n var WASIExitError = class extends Error {\n constructor(code) {\n super(`WASI Exit error: ${code}`);\n this.code = code, Object.setPrototypeOf(this, WASIExitError.prototype);\n }\n };\n exports.WASIExitError = WASIExitError;\n var WASIKillError = class extends Error {\n constructor(signal) {\n super(`WASI Kill signal: ${signal}`);\n this.signal = signal, Object.setPrototypeOf(this, WASIKillError.prototype);\n }\n };\n exports.WASIKillError = WASIKillError;\n }\n}), require_constants = __commonJS({\n \"node_modules/wasi-js/dist/constants.js\"(exports) {\n Object.defineProperty(exports, \"__esModule\", { value: !0 }), exports.WASI_ENOMSG = exports.WASI_ENOMEM = exports.WASI_ENOLINK = exports.WASI_ENOLCK = exports.WASI_ENOEXEC = exports.WASI_ENOENT = exports.WASI_ENODEV = exports.WASI_ENOBUFS = exports.WASI_ENFILE = exports.WASI_ENETUNREACH = exports.WASI_ENETRESET = exports.WASI_ENETDOWN = exports.WASI_ENAMETOOLONG = exports.WASI_EMULTIHOP = exports.WASI_EMSGSIZE = exports.WASI_EMLINK = exports.WASI_EMFILE = exports.WASI_ELOOP = exports.WASI_EISDIR = exports.WASI_EISCONN = exports.WASI_EIO = exports.WASI_EINVAL = exports.WASI_EINTR = exports.WASI_EINPROGRESS = exports.WASI_EILSEQ = exports.WASI_EIDRM = exports.WASI_EHOSTUNREACH = exports.WASI_EFBIG = exports.WASI_EFAULT = exports.WASI_EEXIST = exports.WASI_EDQUOT = exports.WASI_EDOM = exports.WASI_EDESTADDRREQ = exports.WASI_EDEADLK = exports.WASI_ECONNRESET = exports.WASI_ECONNREFUSED = exports.WASI_ECONNABORTED = exports.WASI_ECHILD = exports.WASI_ECANCELED = exports.WASI_EBUSY = exports.WASI_EBADMSG = exports.WASI_EBADF = exports.WASI_EALREADY = exports.WASI_EAGAIN = exports.WASI_EAFNOSUPPORT = exports.WASI_EADDRNOTAVAIL = exports.WASI_EADDRINUSE = exports.WASI_EACCES = exports.WASI_E2BIG = exports.WASI_ESUCCESS = void 0, exports.WASI_SIGVTALRM = exports.WASI_SIGUSR2 = exports.WASI_SIGUSR1 = exports.WASI_SIGURG = exports.WASI_SIGTTOU = exports.WASI_SIGTTIN = exports.WASI_SIGTSTP = exports.WASI_SIGTRAP = exports.WASI_SIGTERM = exports.WASI_SIGSTOP = exports.WASI_SIGSEGV = exports.WASI_SIGQUIT = exports.WASI_SIGPIPE = exports.WASI_SIGKILL = exports.WASI_SIGINT = exports.WASI_SIGILL = exports.WASI_SIGHUP = exports.WASI_SIGFPE = exports.WASI_SIGCONT = exports.WASI_SIGCHLD = exports.WASI_SIGBUS = exports.WASI_SIGALRM = exports.WASI_SIGABRT = exports.WASI_ENOTCAPABLE = exports.WASI_EXDEV = exports.WASI_ETXTBSY = exports.WASI_ETIMEDOUT = exports.WASI_ESTALE = exports.WASI_ESRCH = exports.WASI_ESPIPE = exports.WASI_EROFS = exports.WASI_ERANGE = exports.WASI_EPROTOTYPE = exports.WASI_EPROTONOSUPPORT = exports.WASI_EPROTO = exports.WASI_EPIPE = exports.WASI_EPERM = exports.WASI_EOWNERDEAD = exports.WASI_EOVERFLOW = exports.WASI_ENXIO = exports.WASI_ENOTTY = exports.WASI_ENOTSUP = exports.WASI_ENOTSOCK = exports.WASI_ENOTRECOVERABLE = exports.WASI_ENOTEMPTY = exports.WASI_ENOTDIR = exports.WASI_ENOTCONN = exports.WASI_ENOSYS = exports.WASI_ENOSPC = exports.WASI_ENOPROTOOPT = void 0, exports.RIGHTS_REGULAR_FILE_BASE = exports.RIGHTS_CHARACTER_DEVICE_INHERITING = exports.RIGHTS_CHARACTER_DEVICE_BASE = exports.RIGHTS_BLOCK_DEVICE_INHERITING = exports.RIGHTS_BLOCK_DEVICE_BASE = exports.RIGHTS_ALL = exports.WASI_RIGHT_SOCK_SHUTDOWN = exports.WASI_RIGHT_POLL_FD_READWRITE = exports.WASI_RIGHT_PATH_UNLINK_FILE = exports.WASI_RIGHT_PATH_REMOVE_DIRECTORY = exports.WASI_RIGHT_PATH_SYMLINK = exports.WASI_RIGHT_FD_FILESTAT_SET_TIMES = exports.WASI_RIGHT_FD_FILESTAT_SET_SIZE = exports.WASI_RIGHT_FD_FILESTAT_GET = exports.WASI_RIGHT_PATH_FILESTAT_SET_TIMES = exports.WASI_RIGHT_PATH_FILESTAT_SET_SIZE = exports.WASI_RIGHT_PATH_FILESTAT_GET = exports.WASI_RIGHT_PATH_RENAME_TARGET = exports.WASI_RIGHT_PATH_RENAME_SOURCE = exports.WASI_RIGHT_PATH_READLINK = exports.WASI_RIGHT_FD_READDIR = exports.WASI_RIGHT_PATH_OPEN = exports.WASI_RIGHT_PATH_LINK_TARGET = exports.WASI_RIGHT_PATH_LINK_SOURCE = exports.WASI_RIGHT_PATH_CREATE_FILE = exports.WASI_RIGHT_PATH_CREATE_DIRECTORY = exports.WASI_RIGHT_FD_ALLOCATE = exports.WASI_RIGHT_FD_ADVISE = exports.WASI_RIGHT_FD_WRITE = exports.WASI_RIGHT_FD_TELL = exports.WASI_RIGHT_FD_SYNC = exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS = exports.WASI_RIGHT_FD_SEEK = exports.WASI_RIGHT_FD_READ = exports.WASI_RIGHT_FD_DATASYNC = exports.WASI_FDFLAG_SYNC = exports.WASI_FDFLAG_RSYNC = exports.WASI_FDFLAG_NONBLOCK = exports.WASI_FDFLAG_DSYNC = exports.WASI_FDFLAG_APPEND = exports.WASI_FILETYPE_SYMBOLIC_LINK = exports.WASI_FILETYPE_SOCKET_STREAM = exports.WASI_FILETYPE_SOCKET_DGRAM = exports.WASI_FILETYPE_REGULAR_FILE = exports.WASI_FILETYPE_DIRECTORY = exports.WASI_FILETYPE_CHARACTER_DEVICE = exports.WASI_FILETYPE_BLOCK_DEVICE = exports.WASI_FILETYPE_UNKNOWN = exports.WASI_SIGXFSZ = exports.WASI_SIGXCPU = void 0, exports.SIGNAL_MAP = exports.ERROR_MAP = exports.WASI_WHENCE_END = exports.WASI_WHENCE_CUR = exports.WASI_WHENCE_SET = exports.WASI_STDERR_FILENO = exports.WASI_STDOUT_FILENO = exports.WASI_STDIN_FILENO = exports.WASI_DIRCOOKIE_START = exports.WASI_PREOPENTYPE_DIR = exports.WASI_O_TRUNC = exports.WASI_O_EXCL = exports.WASI_O_DIRECTORY = exports.WASI_O_CREAT = exports.WASI_FILESTAT_SET_MTIM_NOW = exports.WASI_FILESTAT_SET_MTIM = exports.WASI_FILESTAT_SET_ATIM_NOW = exports.WASI_FILESTAT_SET_ATIM = exports.WASI_EVENTTYPE_FD_WRITE = exports.WASI_EVENTTYPE_FD_READ = exports.WASI_EVENTTYPE_CLOCK = exports.WASI_CLOCK_THREAD_CPUTIME_ID = exports.WASI_CLOCK_PROCESS_CPUTIME_ID = exports.WASI_CLOCK_MONOTONIC = exports.WASI_CLOCK_REALTIME = exports.RIGHTS_TTY_INHERITING = exports.RIGHTS_TTY_BASE = exports.RIGHTS_SOCKET_INHERITING = exports.RIGHTS_SOCKET_BASE = exports.RIGHTS_DIRECTORY_INHERITING = exports.RIGHTS_DIRECTORY_BASE = exports.RIGHTS_REGULAR_FILE_INHERITING = void 0, exports.WASI_ESUCCESS = 0, exports.WASI_E2BIG = 1, exports.WASI_EACCES = 2, exports.WASI_EADDRINUSE = 3, exports.WASI_EADDRNOTAVAIL = 4, exports.WASI_EAFNOSUPPORT = 5, exports.WASI_EAGAIN = 6, exports.WASI_EALREADY = 7, exports.WASI_EBADF = 8, exports.WASI_EBADMSG = 9, exports.WASI_EBUSY = 10, exports.WASI_ECANCELED = 11, exports.WASI_ECHILD = 12, exports.WASI_ECONNABORTED = 13, exports.WASI_ECONNREFUSED = 14, exports.WASI_ECONNRESET = 15, exports.WASI_EDEADLK = 16, exports.WASI_EDESTADDRREQ = 17, exports.WASI_EDOM = 18, exports.WASI_EDQUOT = 19, exports.WASI_EEXIST = 20, exports.WASI_EFAULT = 21, exports.WASI_EFBIG = 22, exports.WASI_EHOSTUNREACH = 23, exports.WASI_EIDRM = 24, exports.WASI_EILSEQ = 25, exports.WASI_EINPROGRESS = 26, exports.WASI_EINTR = 27, exports.WASI_EINVAL = 28, exports.WASI_EIO = 29, exports.WASI_EISCONN = 30, exports.WASI_EISDIR = 31, exports.WASI_ELOOP = 32, exports.WASI_EMFILE = 33, exports.WASI_EMLINK = 34, exports.WASI_EMSGSIZE = 35, exports.WASI_EMULTIHOP = 36, exports.WASI_ENAMETOOLONG = 37, exports.WASI_ENETDOWN = 38, exports.WASI_ENETRESET = 39, exports.WASI_ENETUNREACH = 40, exports.WASI_ENFILE = 41, exports.WASI_ENOBUFS = 42, exports.WASI_ENODEV = 43, exports.WASI_ENOENT = 44, exports.WASI_ENOEXEC = 45, exports.WASI_ENOLCK = 46, exports.WASI_ENOLINK = 47, exports.WASI_ENOMEM = 48, exports.WASI_ENOMSG = 49, exports.WASI_ENOPROTOOPT = 50, exports.WASI_ENOSPC = 51, exports.WASI_ENOSYS = 52, exports.WASI_ENOTCONN = 53, exports.WASI_ENOTDIR = 54, exports.WASI_ENOTEMPTY = 55, exports.WASI_ENOTRECOVERABLE = 56, exports.WASI_ENOTSOCK = 57, exports.WASI_ENOTSUP = 58, exports.WASI_ENOTTY = 59, exports.WASI_ENXIO = 60, exports.WASI_EOVERFLOW = 61, exports.WASI_EOWNERDEAD = 62, exports.WASI_EPERM = 63, exports.WASI_EPIPE = 64, exports.WASI_EPROTO = 65, exports.WASI_EPROTONOSUPPORT = 66, exports.WASI_EPROTOTYPE = 67, exports.WASI_ERANGE = 68, exports.WASI_EROFS = 69, exports.WASI_ESPIPE = 70, exports.WASI_ESRCH = 71, exports.WASI_ESTALE = 72, exports.WASI_ETIMEDOUT = 73, exports.WASI_ETXTBSY = 74, exports.WASI_EXDEV = 75, exports.WASI_ENOTCAPABLE = 76, exports.WASI_SIGABRT = 0, exports.WASI_SIGALRM = 1, exports.WASI_SIGBUS = 2, exports.WASI_SIGCHLD = 3, exports.WASI_SIGCONT = 4, exports.WASI_SIGFPE = 5, exports.WASI_SIGHUP = 6, exports.WASI_SIGILL = 7, exports.WASI_SIGINT = 8, exports.WASI_SIGKILL = 9, exports.WASI_SIGPIPE = 10, exports.WASI_SIGQUIT = 11, exports.WASI_SIGSEGV = 12, exports.WASI_SIGSTOP = 13, exports.WASI_SIGTERM = 14, exports.WASI_SIGTRAP = 15, exports.WASI_SIGTSTP = 16, exports.WASI_SIGTTIN = 17, exports.WASI_SIGTTOU = 18, exports.WASI_SIGURG = 19, exports.WASI_SIGUSR1 = 20, exports.WASI_SIGUSR2 = 21, exports.WASI_SIGVTALRM = 22, exports.WASI_SIGXCPU = 23, exports.WASI_SIGXFSZ = 24, exports.WASI_FILETYPE_UNKNOWN = 0, exports.WASI_FILETYPE_BLOCK_DEVICE = 1, exports.WASI_FILETYPE_CHARACTER_DEVICE = 2, exports.WASI_FILETYPE_DIRECTORY = 3, exports.WASI_FILETYPE_REGULAR_FILE = 4, exports.WASI_FILETYPE_SOCKET_DGRAM = 5, exports.WASI_FILETYPE_SOCKET_STREAM = 6, exports.WASI_FILETYPE_SYMBOLIC_LINK = 7, exports.WASI_FDFLAG_APPEND = 1, exports.WASI_FDFLAG_DSYNC = 2, exports.WASI_FDFLAG_NONBLOCK = 4, exports.WASI_FDFLAG_RSYNC = 8, exports.WASI_FDFLAG_SYNC = 16, exports.WASI_RIGHT_FD_DATASYNC = BigInt(1), exports.WASI_RIGHT_FD_READ = BigInt(2), exports.WASI_RIGHT_FD_SEEK = BigInt(4), exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS = BigInt(8), exports.WASI_RIGHT_FD_SYNC = BigInt(16), exports.WASI_RIGHT_FD_TELL = BigInt(32), exports.WASI_RIGHT_FD_WRITE = BigInt(64), exports.WASI_RIGHT_FD_ADVISE = BigInt(128), exports.WASI_RIGHT_FD_ALLOCATE = BigInt(256), exports.WASI_RIGHT_PATH_CREATE_DIRECTORY = BigInt(512), exports.WASI_RIGHT_PATH_CREATE_FILE = BigInt(1024), exports.WASI_RIGHT_PATH_LINK_SOURCE = BigInt(2048), exports.WASI_RIGHT_PATH_LINK_TARGET = BigInt(4096), exports.WASI_RIGHT_PATH_OPEN = BigInt(8192), exports.WASI_RIGHT_FD_READDIR = BigInt(16384), exports.WASI_RIGHT_PATH_READLINK = BigInt(32768), exports.WASI_RIGHT_PATH_RENAME_SOURCE = BigInt(65536), exports.WASI_RIGHT_PATH_RENAME_TARGET = BigInt(131072), exports.WASI_RIGHT_PATH_FILESTAT_GET = BigInt(262144), exports.WASI_RIGHT_PATH_FILESTAT_SET_SIZE = BigInt(524288), exports.WASI_RIGHT_PATH_FILESTAT_SET_TIMES = BigInt(1048576), exports.WASI_RIGHT_FD_FILESTAT_GET = BigInt(2097152), exports.WASI_RIGHT_FD_FILESTAT_SET_SIZE = BigInt(4194304), exports.WASI_RIGHT_FD_FILESTAT_SET_TIMES = BigInt(8388608), exports.WASI_RIGHT_PATH_SYMLINK = BigInt(16777216), exports.WASI_RIGHT_PATH_REMOVE_DIRECTORY = BigInt(33554432), exports.WASI_RIGHT_PATH_UNLINK_FILE = BigInt(67108864), exports.WASI_RIGHT_POLL_FD_READWRITE = BigInt(134217728), exports.WASI_RIGHT_SOCK_SHUTDOWN = BigInt(268435456), exports.RIGHTS_ALL = exports.WASI_RIGHT_FD_DATASYNC | exports.WASI_RIGHT_FD_READ | exports.WASI_RIGHT_FD_SEEK | exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS | exports.WASI_RIGHT_FD_SYNC | exports.WASI_RIGHT_FD_TELL | exports.WASI_RIGHT_FD_WRITE | exports.WASI_RIGHT_FD_ADVISE | exports.WASI_RIGHT_FD_ALLOCATE | exports.WASI_RIGHT_PATH_CREATE_DIRECTORY | exports.WASI_RIGHT_PATH_CREATE_FILE | exports.WASI_RIGHT_PATH_LINK_SOURCE | exports.WASI_RIGHT_PATH_LINK_TARGET | exports.WASI_RIGHT_PATH_OPEN | exports.WASI_RIGHT_FD_READDIR | exports.WASI_RIGHT_PATH_READLINK | exports.WASI_RIGHT_PATH_RENAME_SOURCE | exports.WASI_RIGHT_PATH_RENAME_TARGET | exports.WASI_RIGHT_PATH_FILESTAT_GET | exports.WASI_RIGHT_PATH_FILESTAT_SET_SIZE | exports.WASI_RIGHT_PATH_FILESTAT_SET_TIMES | exports.WASI_RIGHT_FD_FILESTAT_GET | exports.WASI_RIGHT_FD_FILESTAT_SET_TIMES | exports.WASI_RIGHT_FD_FILESTAT_SET_SIZE | exports.WASI_RIGHT_PATH_SYMLINK | exports.WASI_RIGHT_PATH_UNLINK_FILE | exports.WASI_RIGHT_PATH_REMOVE_DIRECTORY | exports.WASI_RIGHT_POLL_FD_READWRITE | exports.WASI_RIGHT_SOCK_SHUTDOWN, exports.RIGHTS_BLOCK_DEVICE_BASE = exports.RIGHTS_ALL, exports.RIGHTS_BLOCK_DEVICE_INHERITING = exports.RIGHTS_ALL, exports.RIGHTS_CHARACTER_DEVICE_BASE = exports.RIGHTS_ALL, exports.RIGHTS_CHARACTER_DEVICE_INHERITING = exports.RIGHTS_ALL, exports.RIGHTS_REGULAR_FILE_BASE = exports.WASI_RIGHT_FD_DATASYNC | exports.WASI_RIGHT_FD_READ | exports.WASI_RIGHT_FD_SEEK | exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS | exports.WASI_RIGHT_FD_SYNC | exports.WASI_RIGHT_FD_TELL | exports.WASI_RIGHT_FD_WRITE | exports.WASI_RIGHT_FD_ADVISE | exports.WASI_RIGHT_FD_ALLOCATE | exports.WASI_RIGHT_FD_FILESTAT_GET | exports.WASI_RIGHT_FD_FILESTAT_SET_SIZE | exports.WASI_RIGHT_FD_FILESTAT_SET_TIMES | exports.WASI_RIGHT_POLL_FD_READWRITE, exports.RIGHTS_REGULAR_FILE_INHERITING = BigInt(0), exports.RIGHTS_DIRECTORY_BASE = exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS | exports.WASI_RIGHT_FD_SYNC | exports.WASI_RIGHT_FD_ADVISE | exports.WASI_RIGHT_PATH_CREATE_DIRECTORY | exports.WASI_RIGHT_PATH_CREATE_FILE | exports.WASI_RIGHT_PATH_LINK_SOURCE | exports.WASI_RIGHT_PATH_LINK_TARGET | exports.WASI_RIGHT_PATH_OPEN | exports.WASI_RIGHT_FD_READDIR | exports.WASI_RIGHT_PATH_READLINK | exports.WASI_RIGHT_PATH_RENAME_SOURCE | exports.WASI_RIGHT_PATH_RENAME_TARGET | exports.WASI_RIGHT_PATH_FILESTAT_GET | exports.WASI_RIGHT_PATH_FILESTAT_SET_SIZE | exports.WASI_RIGHT_PATH_FILESTAT_SET_TIMES | exports.WASI_RIGHT_FD_FILESTAT_GET | exports.WASI_RIGHT_FD_FILESTAT_SET_TIMES | exports.WASI_RIGHT_PATH_SYMLINK | exports.WASI_RIGHT_PATH_UNLINK_FILE | exports.WASI_RIGHT_PATH_REMOVE_DIRECTORY | exports.WASI_RIGHT_POLL_FD_READWRITE, exports.RIGHTS_DIRECTORY_INHERITING = exports.RIGHTS_DIRECTORY_BASE | exports.RIGHTS_REGULAR_FILE_BASE, exports.RIGHTS_SOCKET_BASE = exports.WASI_RIGHT_FD_READ | exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS | exports.WASI_RIGHT_FD_WRITE | exports.WASI_RIGHT_FD_FILESTAT_GET | exports.WASI_RIGHT_POLL_FD_READWRITE | exports.WASI_RIGHT_SOCK_SHUTDOWN, exports.RIGHTS_SOCKET_INHERITING = exports.RIGHTS_ALL, exports.RIGHTS_TTY_BASE = exports.WASI_RIGHT_FD_READ | exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS | exports.WASI_RIGHT_FD_WRITE | exports.WASI_RIGHT_FD_FILESTAT_GET | exports.WASI_RIGHT_POLL_FD_READWRITE, exports.RIGHTS_TTY_INHERITING = BigInt(0), exports.WASI_CLOCK_REALTIME = 0, exports.WASI_CLOCK_MONOTONIC = 1, exports.WASI_CLOCK_PROCESS_CPUTIME_ID = 2, exports.WASI_CLOCK_THREAD_CPUTIME_ID = 3, exports.WASI_EVENTTYPE_CLOCK = 0, exports.WASI_EVENTTYPE_FD_READ = 1, exports.WASI_EVENTTYPE_FD_WRITE = 2, exports.WASI_FILESTAT_SET_ATIM = 1 << 0, exports.WASI_FILESTAT_SET_ATIM_NOW = 1 << 1, exports.WASI_FILESTAT_SET_MTIM = 1 << 2, exports.WASI_FILESTAT_SET_MTIM_NOW = 1 << 3, exports.WASI_O_CREAT = 1 << 0, exports.WASI_O_DIRECTORY = 1 << 1, exports.WASI_O_EXCL = 1 << 2, exports.WASI_O_TRUNC = 1 << 3, exports.WASI_PREOPENTYPE_DIR = 0, exports.WASI_DIRCOOKIE_START = 0, exports.WASI_STDIN_FILENO = 0, exports.WASI_STDOUT_FILENO = 1, exports.WASI_STDERR_FILENO = 2, exports.WASI_WHENCE_SET = 0, exports.WASI_WHENCE_CUR = 1, exports.WASI_WHENCE_END = 2, exports.ERROR_MAP = {\n E2BIG: exports.WASI_E2BIG,\n EACCES: exports.WASI_EACCES,\n EADDRINUSE: exports.WASI_EADDRINUSE,\n EADDRNOTAVAIL: exports.WASI_EADDRNOTAVAIL,\n EAFNOSUPPORT: exports.WASI_EAFNOSUPPORT,\n EALREADY: exports.WASI_EALREADY,\n EAGAIN: exports.WASI_EAGAIN,\n EBADF: exports.WASI_EBADF,\n EBADMSG: exports.WASI_EBADMSG,\n EBUSY: exports.WASI_EBUSY,\n ECANCELED: exports.WASI_ECANCELED,\n ECHILD: exports.WASI_ECHILD,\n ECONNABORTED: exports.WASI_ECONNABORTED,\n ECONNREFUSED: exports.WASI_ECONNREFUSED,\n ECONNRESET: exports.WASI_ECONNRESET,\n EDEADLOCK: exports.WASI_EDEADLK,\n EDESTADDRREQ: exports.WASI_EDESTADDRREQ,\n EDOM: exports.WASI_EDOM,\n EDQUOT: exports.WASI_EDQUOT,\n EEXIST: exports.WASI_EEXIST,\n EFAULT: exports.WASI_EFAULT,\n EFBIG: exports.WASI_EFBIG,\n EHOSTDOWN: exports.WASI_EHOSTUNREACH,\n EHOSTUNREACH: exports.WASI_EHOSTUNREACH,\n EIDRM: exports.WASI_EIDRM,\n EILSEQ: exports.WASI_EILSEQ,\n EINPROGRESS: exports.WASI_EINPROGRESS,\n EINTR: exports.WASI_EINTR,\n EINVAL: exports.WASI_EINVAL,\n EIO: exports.WASI_EIO,\n EISCONN: exports.WASI_EISCONN,\n EISDIR: exports.WASI_EISDIR,\n ELOOP: exports.WASI_ELOOP,\n EMFILE: exports.WASI_EMFILE,\n EMLINK: exports.WASI_EMLINK,\n EMSGSIZE: exports.WASI_EMSGSIZE,\n EMULTIHOP: exports.WASI_EMULTIHOP,\n ENAMETOOLONG: exports.WASI_ENAMETOOLONG,\n ENETDOWN: exports.WASI_ENETDOWN,\n ENETRESET: exports.WASI_ENETRESET,\n ENETUNREACH: exports.WASI_ENETUNREACH,\n ENFILE: exports.WASI_ENFILE,\n ENOBUFS: exports.WASI_ENOBUFS,\n ENODEV: exports.WASI_ENODEV,\n ENOENT: exports.WASI_ENOENT,\n ENOEXEC: exports.WASI_ENOEXEC,\n ENOLCK: exports.WASI_ENOLCK,\n ENOLINK: exports.WASI_ENOLINK,\n ENOMEM: exports.WASI_ENOMEM,\n ENOMSG: exports.WASI_ENOMSG,\n ENOPROTOOPT: exports.WASI_ENOPROTOOPT,\n ENOSPC: exports.WASI_ENOSPC,\n ENOSYS: exports.WASI_ENOSYS,\n ENOTCONN: exports.WASI_ENOTCONN,\n ENOTDIR: exports.WASI_ENOTDIR,\n ENOTEMPTY: exports.WASI_ENOTEMPTY,\n ENOTRECOVERABLE: exports.WASI_ENOTRECOVERABLE,\n ENOTSOCK: exports.WASI_ENOTSOCK,\n ENOTTY: exports.WASI_ENOTTY,\n ENXIO: exports.WASI_ENXIO,\n EOVERFLOW: exports.WASI_EOVERFLOW,\n EOWNERDEAD: exports.WASI_EOWNERDEAD,\n EPERM: exports.WASI_EPERM,\n EPIPE: exports.WASI_EPIPE,\n EPROTO: exports.WASI_EPROTO,\n EPROTONOSUPPORT: exports.WASI_EPROTONOSUPPORT,\n EPROTOTYPE: exports.WASI_EPROTOTYPE,\n ERANGE: exports.WASI_ERANGE,\n EROFS: exports.WASI_EROFS,\n ESPIPE: exports.WASI_ESPIPE,\n ESRCH: exports.WASI_ESRCH,\n ESTALE: exports.WASI_ESTALE,\n ETIMEDOUT: exports.WASI_ETIMEDOUT,\n ETXTBSY: exports.WASI_ETXTBSY,\n EXDEV: exports.WASI_EXDEV\n }, exports.SIGNAL_MAP = {\n [exports.WASI_SIGHUP]: \"SIGHUP\",\n [exports.WASI_SIGINT]: \"SIGINT\",\n [exports.WASI_SIGQUIT]: \"SIGQUIT\",\n [exports.WASI_SIGILL]: \"SIGILL\",\n [exports.WASI_SIGTRAP]: \"SIGTRAP\",\n [exports.WASI_SIGABRT]: \"SIGABRT\",\n [exports.WASI_SIGBUS]: \"SIGBUS\",\n [exports.WASI_SIGFPE]: \"SIGFPE\",\n [exports.WASI_SIGKILL]: \"SIGKILL\",\n [exports.WASI_SIGUSR1]: \"SIGUSR1\",\n [exports.WASI_SIGSEGV]: \"SIGSEGV\",\n [exports.WASI_SIGUSR2]: \"SIGUSR2\",\n [exports.WASI_SIGPIPE]: \"SIGPIPE\",\n [exports.WASI_SIGALRM]: \"SIGALRM\",\n [exports.WASI_SIGTERM]: \"SIGTERM\",\n [exports.WASI_SIGCHLD]: \"SIGCHLD\",\n [exports.WASI_SIGCONT]: \"SIGCONT\",\n [exports.WASI_SIGSTOP]: \"SIGSTOP\",\n [exports.WASI_SIGTSTP]: \"SIGTSTP\",\n [exports.WASI_SIGTTIN]: \"SIGTTIN\",\n [exports.WASI_SIGTTOU]: \"SIGTTOU\",\n [exports.WASI_SIGURG]: \"SIGURG\",\n [exports.WASI_SIGXCPU]: \"SIGXCPU\",\n [exports.WASI_SIGXFSZ]: \"SIGXFSZ\",\n [exports.WASI_SIGVTALRM]: \"SIGVTALRM\"\n };\n }\n}), require_wasi = __commonJS({\n \"node_modules/wasi-js/dist/wasi.js\"(exports) {\n var __importDefault = exports && exports.__importDefault || function(mod) {\n return mod && mod.__esModule \? mod : { default: mod };\n };\n let fs;\n Object.defineProperty(exports, \"__esModule\", { value: !0 }), exports.SOCKET_DEFAULT_RIGHTS = void 0;\n var log = () => {\n }, logOpen = () => {\n }, SC_OPEN_MAX = 32768, types_1 = require_types(), constants_1 = require_constants(), STDIN_DEFAULT_RIGHTS = constants_1.WASI_RIGHT_FD_DATASYNC | constants_1.WASI_RIGHT_FD_READ | constants_1.WASI_RIGHT_FD_SYNC | constants_1.WASI_RIGHT_FD_ADVISE | constants_1.WASI_RIGHT_FD_FILESTAT_GET | constants_1.WASI_RIGHT_POLL_FD_READWRITE, STDOUT_DEFAULT_RIGHTS = constants_1.WASI_RIGHT_FD_DATASYNC | constants_1.WASI_RIGHT_FD_WRITE | constants_1.WASI_RIGHT_FD_SYNC | constants_1.WASI_RIGHT_FD_ADVISE | constants_1.WASI_RIGHT_FD_FILESTAT_GET | constants_1.WASI_RIGHT_POLL_FD_READWRITE, STDERR_DEFAULT_RIGHTS = STDOUT_DEFAULT_RIGHTS;\n exports.SOCKET_DEFAULT_RIGHTS = constants_1.WASI_RIGHT_FD_DATASYNC | constants_1.WASI_RIGHT_FD_READ | constants_1.WASI_RIGHT_FD_WRITE | constants_1.WASI_RIGHT_FD_ADVISE | constants_1.WASI_RIGHT_FD_FILESTAT_GET | constants_1.WASI_RIGHT_POLL_FD_READWRITE | constants_1.WASI_RIGHT_FD_FDSTAT_SET_FLAGS;\n var msToNs = (ms) => {\n const msInt = Math.trunc(ms), decimal = BigInt(Math.round((ms - msInt) * 1e6));\n return BigInt(msInt) * BigInt(1e6) + decimal;\n }, nsToMs = (ns) => {\n if (typeof ns === \"number\")\n ns = Math.trunc(ns);\n const nsInt = BigInt(ns);\n return Number(nsInt / BigInt(1e6));\n }, wrap = (f) => (...args) => {\n try {\n return f(...args);\n } catch (err) {\n let e = err;\n while (e.prev != null)\n e = e.prev;\n if (e\?.code && typeof e\?.code === \"string\")\n return constants_1.ERROR_MAP[e.code] || constants_1.WASI_EINVAL;\n if (e instanceof types_1.WASIError)\n return e.errno;\n throw e;\n }\n }, stat = (wasi, fd) => {\n const entry = wasi.FD_MAP.get(fd);\n if (!entry)\n throw new types_1.WASIError(constants_1.WASI_EBADF);\n if (entry.filetype === void 0) {\n const stats = wasi.fstatSync(entry.real), { filetype, rightsBase, rightsInheriting } = translateFileAttributes(wasi, fd, stats);\n if (entry.filetype = filetype, !entry.rights)\n entry.rights = {\n base: rightsBase,\n inheriting: rightsInheriting\n };\n }\n return entry;\n }, translateFileAttributes = (wasi, fd, stats) => {\n switch (!0) {\n case stats.isBlockDevice():\n return {\n filetype: constants_1.WASI_FILETYPE_BLOCK_DEVICE,\n rightsBase: constants_1.RIGHTS_BLOCK_DEVICE_BASE,\n rightsInheriting: constants_1.RIGHTS_BLOCK_DEVICE_INHERITING\n };\n case stats.isCharacterDevice(): {\n const filetype = constants_1.WASI_FILETYPE_CHARACTER_DEVICE;\n if (fd !== void 0 && wasi.bindings.isTTY(fd))\n return {\n filetype,\n rightsBase: constants_1.RIGHTS_TTY_BASE,\n rightsInheriting: constants_1.RIGHTS_TTY_INHERITING\n };\n return {\n filetype,\n rightsBase: constants_1.RIGHTS_CHARACTER_DEVICE_BASE,\n rightsInheriting: constants_1.RIGHTS_CHARACTER_DEVICE_INHERITING\n };\n }\n case stats.isDirectory():\n return {\n filetype: constants_1.WASI_FILETYPE_DIRECTORY,\n rightsBase: constants_1.RIGHTS_DIRECTORY_BASE,\n rightsInheriting: constants_1.RIGHTS_DIRECTORY_INHERITING\n };\n case stats.isFIFO():\n return {\n filetype: constants_1.WASI_FILETYPE_SOCKET_STREAM,\n rightsBase: constants_1.RIGHTS_SOCKET_BASE,\n rightsInheriting: constants_1.RIGHTS_SOCKET_INHERITING\n };\n case stats.isFile():\n return {\n filetype: constants_1.WASI_FILETYPE_REGULAR_FILE,\n rightsBase: constants_1.RIGHTS_REGULAR_FILE_BASE,\n rightsInheriting: constants_1.RIGHTS_REGULAR_FILE_INHERITING\n };\n case stats.isSocket():\n return {\n filetype: constants_1.WASI_FILETYPE_SOCKET_STREAM,\n rightsBase: constants_1.RIGHTS_SOCKET_BASE,\n rightsInheriting: constants_1.RIGHTS_SOCKET_INHERITING\n };\n case stats.isSymbolicLink():\n return {\n filetype: constants_1.WASI_FILETYPE_SYMBOLIC_LINK,\n rightsBase: BigInt(0),\n rightsInheriting: BigInt(0)\n };\n default:\n return {\n filetype: constants_1.WASI_FILETYPE_UNKNOWN,\n rightsBase: BigInt(0),\n rightsInheriting: BigInt(0)\n };\n }\n }, warnedAboutSleep = !1, defaultConfig;\n function getDefaults() {\n if (defaultConfig)\n return defaultConfig;\n const defaultBindings = {\n hrtime: () => process.hrtime.bigint(),\n exit: (code) => {\n process.exit(code);\n },\n kill: (signal) => {\n process.kill(process.pid, signal);\n },\n randomFillSync: (array) => crypto.getRandomValues(array),\n isTTY: (fd) => (@getInternalField(@internalModuleRegistry, 46) || @createInternalModuleById(46)).isatty(fd),\n fs: Bun.fs(),\n path: @getInternalField(@internalModuleRegistry, 30) || @createInternalModuleById(30)\n };\n return defaultConfig = {\n args: [],\n env: {},\n preopens: {},\n bindings: defaultBindings,\n sleep: (ms) => {\n Bun.sleepSync(ms);\n }\n };\n }\n var WASI = class WASI2 {\n constructor(wasiConfig = {}) {\n const defaultConfig2 = getDefaults();\n this.lastStdin = 0, this.sleep = wasiConfig.sleep || defaultConfig2.sleep, this.getStdin = wasiConfig.getStdin, this.sendStdout = wasiConfig.sendStdout, this.sendStderr = wasiConfig.sendStderr;\n let preopens = wasiConfig.preopens \?\? defaultConfig2.preopens;\n this.env = wasiConfig.env \?\? defaultConfig2.env;\n const args = wasiConfig.args \?\? defaultConfig2.args;\n this.memory = void 0, this.view = void 0, this.bindings = wasiConfig.bindings || defaultConfig2.bindings;\n const bindings2 = this.bindings;\n fs = bindings2.fs, this.FD_MAP = new Map([\n [\n constants_1.WASI_STDIN_FILENO,\n {\n real: 0,\n filetype: constants_1.WASI_FILETYPE_CHARACTER_DEVICE,\n rights: {\n base: STDIN_DEFAULT_RIGHTS,\n inheriting: BigInt(0)\n },\n path: \"/dev/stdin\"\n }\n ],\n [\n constants_1.WASI_STDOUT_FILENO,\n {\n real: 1,\n filetype: constants_1.WASI_FILETYPE_CHARACTER_DEVICE,\n rights: {\n base: STDOUT_DEFAULT_RIGHTS,\n inheriting: BigInt(0)\n },\n path: \"/dev/stdout\"\n }\n ],\n [\n constants_1.WASI_STDERR_FILENO,\n {\n real: 2,\n filetype: constants_1.WASI_FILETYPE_CHARACTER_DEVICE,\n rights: {\n base: STDERR_DEFAULT_RIGHTS,\n inheriting: BigInt(0)\n },\n path: \"/dev/stderr\"\n }\n ]\n ]);\n const path = bindings2.path;\n for (let [k, v] of Object.entries(preopens)) {\n const real = fs.openSync(v, nodeFsConstants.O_RDONLY), newfd = this.getUnusedFileDescriptor();\n this.FD_MAP.set(newfd, {\n real,\n filetype: constants_1.WASI_FILETYPE_DIRECTORY,\n rights: {\n base: constants_1.RIGHTS_DIRECTORY_BASE,\n inheriting: constants_1.RIGHTS_DIRECTORY_INHERITING\n },\n fakePath: k,\n path: v\n });\n }\n const getiovs = (iovs, iovsLen) => {\n this.refreshMemory();\n const { view, memory } = this, { buffer } = memory, { byteLength } = buffer;\n if (iovsLen === 1) {\n const ptr = iovs, buf = view.getUint32(ptr, !0);\n let bufLen = view.getUint32(ptr + 4, !0);\n if (bufLen > byteLength - buf)\n console.log({\n buf,\n bufLen,\n total_memory: byteLength\n }), log(\"getiovs: warning -- truncating buffer to fit in memory\"), bufLen = Math.min(bufLen, Math.max(0, byteLength - buf));\n try {\n return [new @Uint8Array(buffer, buf, bufLen)];\n } catch (err) {\n throw console.warn(\"WASI.getiovs -- invalid buffer\", err), new types_1.WASIError(constants_1.WASI_EINVAL);\n }\n }\n const buffers = [];\n buffers.length = iovsLen;\n for (let i = 0, ptr = iovs;i < iovsLen; i++, ptr += 8) {\n const buf = view.getUint32(ptr, !0);\n let bufLen = view.getUint32(ptr + 4, !0);\n if (bufLen > byteLength - buf)\n console.log({\n buf,\n bufLen,\n total_memory: byteLength\n }), log(\"getiovs: warning -- truncating buffer to fit in memory\"), bufLen = Math.min(bufLen, Math.max(0, byteLength - buf));\n try {\n buffers[i] = new @Uint8Array(buffer, buf, bufLen);\n } catch (err) {\n throw console.warn(\"WASI.getiovs -- invalid buffer\", err), new types_1.WASIError(constants_1.WASI_EINVAL);\n }\n }\n return buffers;\n }, CHECK_FD = (fd, rights) => {\n const stats = stat(this, fd);\n if (rights !== BigInt(0) && (stats.rights.base & rights) === BigInt(0))\n throw new types_1.WASIError(constants_1.WASI_EPERM);\n return stats;\n }, CPUTIME_START = Bun.nanoseconds(), timeOrigin = Math.trunc(performance.timeOrigin * 1e6), now = (clockId) => {\n switch (clockId) {\n case constants_1.WASI_CLOCK_MONOTONIC:\n return Bun.nanoseconds();\n case constants_1.WASI_CLOCK_REALTIME:\n return Bun.nanoseconds() + timeOrigin;\n case constants_1.WASI_CLOCK_PROCESS_CPUTIME_ID:\n case constants_1.WASI_CLOCK_THREAD_CPUTIME_ID:\n return Bun.nanoseconds() - CPUTIME_START;\n default:\n return null;\n }\n };\n if (this.wasiImport = {\n args_get: (argv, argvBuf) => {\n this.refreshMemory();\n let coffset = argv, offset = argvBuf;\n return args.forEach((a) => {\n this.view.setUint32(coffset, offset, !0), coffset += 4, offset += @Buffer.from(this.memory.buffer).write(`${a}\\0`, offset);\n }), constants_1.WASI_ESUCCESS;\n },\n args_sizes_get: (argc, argvBufSize) => {\n this.refreshMemory(), this.view.setUint32(argc, args.length, !0);\n const size = args.reduce((acc, a) => acc + @Buffer.byteLength(a) + 1, 0);\n return this.view.setUint32(argvBufSize, size, !0), constants_1.WASI_ESUCCESS;\n },\n environ_get: (environ, environBuf) => {\n this.refreshMemory();\n let coffset = environ, offset = environBuf;\n return Object.entries(this.env).forEach(([key, value]) => {\n this.view.setUint32(coffset, offset, !0), coffset += 4, offset += @Buffer.from(this.memory.buffer).write(`${key}=${value}\\0`, offset);\n }), constants_1.WASI_ESUCCESS;\n },\n environ_sizes_get: (environCount, environBufSize) => {\n this.refreshMemory();\n const envProcessed = Object.entries(this.env).map(([key, value]) => `${key}=${value}\\0`), size = envProcessed.reduce((acc, e) => acc + @Buffer.byteLength(e), 0);\n return this.view.setUint32(environCount, envProcessed.length, !0), this.view.setUint32(environBufSize, size, !0), constants_1.WASI_ESUCCESS;\n },\n clock_res_get: (clockId, resolution) => {\n let res;\n switch (clockId) {\n case constants_1.WASI_CLOCK_MONOTONIC:\n case constants_1.WASI_CLOCK_PROCESS_CPUTIME_ID:\n case constants_1.WASI_CLOCK_THREAD_CPUTIME_ID: {\n res = BigInt(1);\n break;\n }\n case constants_1.WASI_CLOCK_REALTIME: {\n res = BigInt(1000);\n break;\n }\n }\n if (!res)\n throw Error(\"invalid clockId\");\n return this.view.setBigUint64(resolution, res), constants_1.WASI_ESUCCESS;\n },\n clock_time_get: (clockId, _precision, time) => {\n this.refreshMemory();\n const n = now(clockId);\n if (n === null)\n return constants_1.WASI_EINVAL;\n return this.view.setBigUint64(time, BigInt(n), !0), constants_1.WASI_ESUCCESS;\n },\n fd_advise: wrap((fd, _offset, _len, _advice) => {\n return CHECK_FD(fd, constants_1.WASI_RIGHT_FD_ADVISE), constants_1.WASI_ENOSYS;\n }),\n fd_allocate: wrap((fd, _offset, _len) => {\n return CHECK_FD(fd, constants_1.WASI_RIGHT_FD_ALLOCATE), constants_1.WASI_ENOSYS;\n }),\n fd_close: wrap((fd) => {\n const stats = CHECK_FD(fd, BigInt(0));\n return fs.closeSync(stats.real), this.FD_MAP.delete(fd), constants_1.WASI_ESUCCESS;\n }),\n fd_datasync: wrap((fd) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_DATASYNC);\n return fs.fdatasyncSync(stats.real), constants_1.WASI_ESUCCESS;\n }),\n fd_fdstat_get: wrap((fd, bufPtr) => {\n const stats = CHECK_FD(fd, BigInt(0));\n if (this.refreshMemory(), stats.filetype == null)\n throw Error(\"stats.filetype must be set\");\n return this.view.setUint8(bufPtr, stats.filetype), this.view.setUint16(bufPtr + 2, 0, !0), this.view.setUint16(bufPtr + 4, 0, !0), this.view.setBigUint64(bufPtr + 8, BigInt(stats.rights.base), !0), this.view.setBigUint64(bufPtr + 8 + 8, BigInt(stats.rights.inheriting), !0), constants_1.WASI_ESUCCESS;\n }),\n fd_fdstat_set_flags: wrap((fd, flags) => {\n if (CHECK_FD(fd, constants_1.WASI_RIGHT_FD_FDSTAT_SET_FLAGS), this.wasiImport.sock_fcntlSetFlags(fd, flags) == 0)\n return constants_1.WASI_ESUCCESS;\n return constants_1.WASI_ENOSYS;\n }),\n fd_fdstat_set_rights: wrap((fd, fsRightsBase, fsRightsInheriting) => {\n const stats = CHECK_FD(fd, BigInt(0));\n if ((stats.rights.base | fsRightsBase) > stats.rights.base)\n return constants_1.WASI_EPERM;\n if ((stats.rights.inheriting | fsRightsInheriting) > stats.rights.inheriting)\n return constants_1.WASI_EPERM;\n return stats.rights.base = fsRightsBase, stats.rights.inheriting = fsRightsInheriting, constants_1.WASI_ESUCCESS;\n }),\n fd_filestat_get: wrap((fd, bufPtr) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_FILESTAT_GET), rstats = this.fstatSync(stats.real);\n if (this.refreshMemory(), this.view.setBigUint64(bufPtr, BigInt(rstats.dev), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, BigInt(rstats.ino), !0), bufPtr += 8, stats.filetype == null)\n throw Error(\"stats.filetype must be set\");\n return this.view.setUint8(bufPtr, stats.filetype), bufPtr += 8, this.view.setBigUint64(bufPtr, BigInt(rstats.nlink), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, BigInt(rstats.size), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, msToNs(rstats.atimeMs), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, msToNs(rstats.mtimeMs), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, msToNs(rstats.ctimeMs), !0), constants_1.WASI_ESUCCESS;\n }),\n fd_filestat_set_size: wrap((fd, stSize) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_FILESTAT_SET_SIZE);\n return fs.ftruncateSync(stats.real, Number(stSize)), constants_1.WASI_ESUCCESS;\n }),\n fd_filestat_set_times: wrap((fd, stAtim, stMtim, fstflags) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_FILESTAT_SET_TIMES), rstats = this.fstatSync(stats.real);\n let { atime: atim, mtime: mtim } = rstats;\n const n = nsToMs(now(constants_1.WASI_CLOCK_REALTIME)), atimflags = constants_1.WASI_FILESTAT_SET_ATIM | constants_1.WASI_FILESTAT_SET_ATIM_NOW;\n if ((fstflags & atimflags) === atimflags)\n return constants_1.WASI_EINVAL;\n const mtimflags = constants_1.WASI_FILESTAT_SET_MTIM | constants_1.WASI_FILESTAT_SET_MTIM_NOW;\n if ((fstflags & mtimflags) === mtimflags)\n return constants_1.WASI_EINVAL;\n if ((fstflags & constants_1.WASI_FILESTAT_SET_ATIM) === constants_1.WASI_FILESTAT_SET_ATIM)\n atim = nsToMs(stAtim);\n else if ((fstflags & constants_1.WASI_FILESTAT_SET_ATIM_NOW) === constants_1.WASI_FILESTAT_SET_ATIM_NOW)\n atim = n;\n if ((fstflags & constants_1.WASI_FILESTAT_SET_MTIM) === constants_1.WASI_FILESTAT_SET_MTIM)\n mtim = nsToMs(stMtim);\n else if ((fstflags & constants_1.WASI_FILESTAT_SET_MTIM_NOW) === constants_1.WASI_FILESTAT_SET_MTIM_NOW)\n mtim = n;\n return fs.futimesSync(stats.real, new Date(atim), new Date(mtim)), constants_1.WASI_ESUCCESS;\n }),\n fd_prestat_get: wrap((fd, bufPtr) => {\n const stats = CHECK_FD(fd, BigInt(0));\n return this.refreshMemory(), this.view.setUint8(bufPtr, constants_1.WASI_PREOPENTYPE_DIR), this.view.setUint32(bufPtr + 4, @Buffer.byteLength(stats.fakePath \?\? stats.path \?\? \"\"), !0), constants_1.WASI_ESUCCESS;\n }),\n fd_prestat_dir_name: wrap((fd, pathPtr, pathLen) => {\n const stats = CHECK_FD(fd, BigInt(0));\n return this.refreshMemory(), @Buffer.from(this.memory.buffer).write(stats.fakePath \?\? stats.path \?\? \"\", pathPtr, pathLen, \"utf8\"), constants_1.WASI_ESUCCESS;\n }),\n fd_pwrite: wrap((fd, iovs, iovsLen, offset, nwritten) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_WRITE | constants_1.WASI_RIGHT_FD_SEEK);\n let written = 0;\n return getiovs(iovs, iovsLen).forEach((iov) => {\n let w = 0;\n while (w < iov.byteLength)\n w += fs.writeSync(stats.real, iov, w, iov.byteLength - w, Number(offset) + written + w);\n written += w;\n }), this.view.setUint32(nwritten, written, !0), constants_1.WASI_ESUCCESS;\n }),\n fd_write: wrap((fd, iovs, iovsLen, nwritten) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_WRITE), IS_STDOUT = fd == constants_1.WASI_STDOUT_FILENO, IS_STDERR = fd == constants_1.WASI_STDERR_FILENO;\n let written = 0;\n return getiovs(iovs, iovsLen).forEach((iov) => {\n if (iov.byteLength == 0)\n return;\n if (IS_STDOUT && this.sendStdout != null)\n this.sendStdout(iov), written += iov.byteLength;\n else if (IS_STDERR && this.sendStderr != null)\n this.sendStderr(iov), written += iov.byteLength;\n else {\n let w = 0;\n while (w < iov.byteLength) {\n const i = fs.writeSync(stats.real, iov, w, iov.byteLength - w, stats.offset \? Number(stats.offset) : null);\n if (stats.offset)\n stats.offset += BigInt(i);\n w += i;\n }\n written += w;\n }\n }), this.view.setUint32(nwritten, written, !0), constants_1.WASI_ESUCCESS;\n }),\n fd_pread: wrap((fd, iovs, iovsLen, offset, nread) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_READ | constants_1.WASI_RIGHT_FD_SEEK);\n let read = 0;\n outer:\n for (let iov of getiovs(iovs, iovsLen)) {\n let r = 0;\n while (r < iov.byteLength) {\n const length = iov.byteLength - r, rr = fs.readSync(stats.real, iov, r, iov.byteLength - r, Number(offset) + read + r);\n if (r += rr, read += rr, rr === 0 || rr < length)\n break outer;\n }\n read += r;\n }\n return this.view.setUint32(nread, read, !0), constants_1.WASI_ESUCCESS;\n }),\n fd_read: wrap((fd, iovs, iovsLen, nread) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_READ), IS_STDIN = fd == constants_1.WASI_STDIN_FILENO;\n let read = 0;\n outer:\n for (let iov of getiovs(iovs, iovsLen)) {\n let r = 0;\n while (r < iov.byteLength) {\n let length = iov.byteLength - r, position = IS_STDIN || stats.offset === void 0 \? null : Number(stats.offset), rr = 0;\n if (IS_STDIN)\n if (this.getStdin != null) {\n if (this.stdinBuffer == null)\n this.stdinBuffer = this.getStdin();\n if (this.stdinBuffer != null) {\n if (rr = this.stdinBuffer.copy(iov), rr == this.stdinBuffer.length)\n this.stdinBuffer = void 0;\n else\n this.stdinBuffer = this.stdinBuffer.slice(rr);\n if (rr > 0)\n this.lastStdin = (new Date()).valueOf();\n }\n } else {\n if (this.sleep == null && !warnedAboutSleep)\n warnedAboutSleep = !0, console.log(\"(cpu waiting for stdin: please define a way to sleep!) \");\n try {\n rr = fs.readSync(stats.real, iov, r, length, position);\n } catch (_err) {\n }\n if (rr == 0)\n this.shortPause();\n else\n this.lastStdin = (new Date()).valueOf();\n }\n else\n rr = fs.readSync(stats.real, iov, r, length, position);\n if (stats.filetype == constants_1.WASI_FILETYPE_REGULAR_FILE)\n stats.offset = (stats.offset \? stats.offset : BigInt(0)) + BigInt(rr);\n if (r += rr, read += rr, rr === 0 || rr < length)\n break outer;\n }\n }\n return this.view.setUint32(nread, read, !0), constants_1.WASI_ESUCCESS;\n }),\n fd_readdir: wrap((fd, bufPtr, bufLen, cookie, bufusedPtr) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_READDIR);\n this.refreshMemory();\n const entries = fs.readdirSync(stats.path, { withFileTypes: !0 }), startPtr = bufPtr;\n for (let i = Number(cookie);i < entries.length; i += 1) {\n const entry = entries[i];\n let nameLength = @Buffer.byteLength(entry.name);\n if (bufPtr - startPtr > bufLen)\n break;\n if (this.view.setBigUint64(bufPtr, BigInt(i + 1), !0), bufPtr += 8, bufPtr - startPtr > bufLen)\n break;\n const rstats = fs.lstatSync(path.resolve(stats.path, entry.name));\n if (this.view.setBigUint64(bufPtr, BigInt(rstats.ino), !0), bufPtr += 8, bufPtr - startPtr > bufLen)\n break;\n if (this.view.setUint32(bufPtr, nameLength, !0), bufPtr += 4, bufPtr - startPtr > bufLen)\n break;\n let filetype;\n switch (!0) {\n case rstats.isBlockDevice():\n filetype = constants_1.WASI_FILETYPE_BLOCK_DEVICE;\n break;\n case rstats.isCharacterDevice():\n filetype = constants_1.WASI_FILETYPE_CHARACTER_DEVICE;\n break;\n case rstats.isDirectory():\n filetype = constants_1.WASI_FILETYPE_DIRECTORY;\n break;\n case rstats.isFIFO():\n filetype = constants_1.WASI_FILETYPE_SOCKET_STREAM;\n break;\n case rstats.isFile():\n filetype = constants_1.WASI_FILETYPE_REGULAR_FILE;\n break;\n case rstats.isSocket():\n filetype = constants_1.WASI_FILETYPE_SOCKET_STREAM;\n break;\n case rstats.isSymbolicLink():\n filetype = constants_1.WASI_FILETYPE_SYMBOLIC_LINK;\n break;\n default:\n filetype = constants_1.WASI_FILETYPE_UNKNOWN;\n break;\n }\n if (this.view.setUint8(bufPtr, filetype), bufPtr += 1, bufPtr += 3, bufPtr + nameLength >= startPtr + bufLen)\n break;\n @Buffer.from(this.memory.buffer).write(entry.name, bufPtr), bufPtr += nameLength;\n }\n const bufused = bufPtr - startPtr;\n return this.view.setUint32(bufusedPtr, Math.min(bufused, bufLen), !0), constants_1.WASI_ESUCCESS;\n }),\n fd_renumber: wrap((from, to) => {\n return CHECK_FD(from, BigInt(0)), CHECK_FD(to, BigInt(0)), fs.closeSync(this.FD_MAP.get(from).real), this.FD_MAP.set(from, this.FD_MAP.get(to)), this.FD_MAP.delete(to), constants_1.WASI_ESUCCESS;\n }),\n fd_seek: wrap((fd, offset, whence, newOffsetPtr) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_SEEK);\n switch (this.refreshMemory(), whence) {\n case constants_1.WASI_WHENCE_CUR:\n stats.offset = (stats.offset \? stats.offset : BigInt(0)) + BigInt(offset);\n break;\n case constants_1.WASI_WHENCE_END:\n const { size } = this.fstatSync(stats.real);\n stats.offset = BigInt(size) + BigInt(offset);\n break;\n case constants_1.WASI_WHENCE_SET:\n stats.offset = BigInt(offset);\n break;\n }\n if (stats.offset == null)\n throw Error(\"stats.offset must be defined\");\n return this.view.setBigUint64(newOffsetPtr, stats.offset, !0), constants_1.WASI_ESUCCESS;\n }),\n fd_tell: wrap((fd, offsetPtr) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_TELL);\n if (this.refreshMemory(), !stats.offset)\n stats.offset = BigInt(0);\n return this.view.setBigUint64(offsetPtr, stats.offset, !0), constants_1.WASI_ESUCCESS;\n }),\n fd_sync: wrap((fd) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_SYNC);\n return fs.fsyncSync(stats.real), constants_1.WASI_ESUCCESS;\n }),\n path_create_directory: wrap((fd, pathPtr, pathLen) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_CREATE_DIRECTORY);\n if (!stats.path)\n return constants_1.WASI_EINVAL;\n this.refreshMemory();\n const p = @Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n return fs.mkdirSync(path.resolve(stats.path, p)), constants_1.WASI_ESUCCESS;\n }),\n path_filestat_get: wrap((fd, flags, pathPtr, pathLen, bufPtr) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_FILESTAT_GET);\n if (!stats.path)\n return constants_1.WASI_EINVAL;\n this.refreshMemory();\n const p = @Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n let rstats;\n if (flags)\n rstats = fs.statSync(path.resolve(stats.path, p));\n else\n rstats = fs.lstatSync(path.resolve(stats.path, p));\n return this.view.setBigUint64(bufPtr, BigInt(rstats.dev), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, BigInt(rstats.ino), !0), bufPtr += 8, this.view.setUint8(bufPtr, translateFileAttributes(this, void 0, rstats).filetype), bufPtr += 8, this.view.setBigUint64(bufPtr, BigInt(rstats.nlink), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, BigInt(rstats.size), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, BigInt(rstats.atime.getTime() * 1e6), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, BigInt(rstats.mtime.getTime() * 1e6), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, BigInt(rstats.ctime.getTime() * 1e6), !0), constants_1.WASI_ESUCCESS;\n }),\n path_filestat_set_times: wrap((fd, _dirflags, pathPtr, pathLen, stAtim, stMtim, fstflags) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_FILESTAT_SET_TIMES);\n if (!stats.path)\n return constants_1.WASI_EINVAL;\n this.refreshMemory();\n const rstats = this.fstatSync(stats.real);\n let { atime: atim, mtime: mtim } = rstats;\n const n = nsToMs(now(constants_1.WASI_CLOCK_REALTIME)), atimflags = constants_1.WASI_FILESTAT_SET_ATIM | constants_1.WASI_FILESTAT_SET_ATIM_NOW;\n if ((fstflags & atimflags) === atimflags)\n return constants_1.WASI_EINVAL;\n const mtimflags = constants_1.WASI_FILESTAT_SET_MTIM | constants_1.WASI_FILESTAT_SET_MTIM_NOW;\n if ((fstflags & mtimflags) === mtimflags)\n return constants_1.WASI_EINVAL;\n if ((fstflags & constants_1.WASI_FILESTAT_SET_ATIM) === constants_1.WASI_FILESTAT_SET_ATIM)\n atim = nsToMs(stAtim);\n else if ((fstflags & constants_1.WASI_FILESTAT_SET_ATIM_NOW) === constants_1.WASI_FILESTAT_SET_ATIM_NOW)\n atim = n;\n if ((fstflags & constants_1.WASI_FILESTAT_SET_MTIM) === constants_1.WASI_FILESTAT_SET_MTIM)\n mtim = nsToMs(stMtim);\n else if ((fstflags & constants_1.WASI_FILESTAT_SET_MTIM_NOW) === constants_1.WASI_FILESTAT_SET_MTIM_NOW)\n mtim = n;\n const p = @Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n return fs.utimesSync(path.resolve(stats.path, p), new Date(atim), new Date(mtim)), constants_1.WASI_ESUCCESS;\n }),\n path_link: wrap((oldFd, _oldFlags, oldPath, oldPathLen, newFd, newPath, newPathLen) => {\n const ostats = CHECK_FD(oldFd, constants_1.WASI_RIGHT_PATH_LINK_SOURCE), nstats = CHECK_FD(newFd, constants_1.WASI_RIGHT_PATH_LINK_TARGET);\n if (!ostats.path || !nstats.path)\n return constants_1.WASI_EINVAL;\n this.refreshMemory();\n const op = @Buffer.from(this.memory.buffer, oldPath, oldPathLen).toString(), np = @Buffer.from(this.memory.buffer, newPath, newPathLen).toString();\n return fs.linkSync(path.resolve(ostats.path, op), path.resolve(nstats.path, np)), constants_1.WASI_ESUCCESS;\n }),\n path_open: wrap((dirfd, _dirflags, pathPtr, pathLen, oflags, fsRightsBase, fsRightsInheriting, fsFlags, fdPtr) => {\n try {\n const stats = CHECK_FD(dirfd, constants_1.WASI_RIGHT_PATH_OPEN);\n fsRightsBase = BigInt(fsRightsBase), fsRightsInheriting = BigInt(fsRightsInheriting);\n const read = (fsRightsBase & (constants_1.WASI_RIGHT_FD_READ | constants_1.WASI_RIGHT_FD_READDIR)) !== BigInt(0), write = (fsRightsBase & (constants_1.WASI_RIGHT_FD_DATASYNC | constants_1.WASI_RIGHT_FD_WRITE | constants_1.WASI_RIGHT_FD_ALLOCATE | constants_1.WASI_RIGHT_FD_FILESTAT_SET_SIZE)) !== BigInt(0);\n let noflags;\n if (write && read)\n noflags = nodeFsConstants.O_RDWR;\n else if (read)\n noflags = nodeFsConstants.O_RDONLY;\n else if (write)\n noflags = nodeFsConstants.O_WRONLY;\n let neededBase = fsRightsBase | constants_1.WASI_RIGHT_PATH_OPEN, neededInheriting = fsRightsBase | fsRightsInheriting;\n if ((oflags & constants_1.WASI_O_CREAT) !== 0)\n noflags |= nodeFsConstants.O_CREAT, neededBase |= constants_1.WASI_RIGHT_PATH_CREATE_FILE;\n if ((oflags & constants_1.WASI_O_DIRECTORY) !== 0)\n noflags |= nodeFsConstants.O_DIRECTORY;\n if ((oflags & constants_1.WASI_O_EXCL) !== 0)\n noflags |= nodeFsConstants.O_EXCL;\n if ((oflags & constants_1.WASI_O_TRUNC) !== 0)\n noflags |= nodeFsConstants.O_TRUNC, neededBase |= constants_1.WASI_RIGHT_PATH_FILESTAT_SET_SIZE;\n if ((fsFlags & constants_1.WASI_FDFLAG_APPEND) !== 0)\n noflags |= nodeFsConstants.O_APPEND;\n if ((fsFlags & constants_1.WASI_FDFLAG_DSYNC) !== 0) {\n if (nodeFsConstants.O_DSYNC)\n noflags |= nodeFsConstants.O_DSYNC;\n else\n noflags |= nodeFsConstants.O_SYNC;\n neededInheriting |= constants_1.WASI_RIGHT_FD_DATASYNC;\n }\n if ((fsFlags & constants_1.WASI_FDFLAG_NONBLOCK) !== 0)\n noflags |= nodeFsConstants.O_NONBLOCK;\n if ((fsFlags & constants_1.WASI_FDFLAG_RSYNC) !== 0) {\n if (nodeFsConstants.O_RSYNC)\n noflags |= nodeFsConstants.O_RSYNC;\n else\n noflags |= nodeFsConstants.O_SYNC;\n neededInheriting |= constants_1.WASI_RIGHT_FD_SYNC;\n }\n if ((fsFlags & constants_1.WASI_FDFLAG_SYNC) !== 0)\n noflags |= nodeFsConstants.O_SYNC, neededInheriting |= constants_1.WASI_RIGHT_FD_SYNC;\n if (write && (noflags & (nodeFsConstants.O_APPEND | nodeFsConstants.O_TRUNC)) === 0)\n neededInheriting |= constants_1.WASI_RIGHT_FD_SEEK;\n this.refreshMemory();\n const p = @Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n if (p == \"dev/tty\")\n return this.view.setUint32(fdPtr, constants_1.WASI_STDIN_FILENO, !0), constants_1.WASI_ESUCCESS;\n if (logOpen(\"path_open\", p), p.startsWith(\"proc/\"))\n throw new types_1.WASIError(constants_1.WASI_EBADF);\n const fullUnresolved = path.resolve(p);\n let full;\n try {\n full = fs.realpathSync(fullUnresolved);\n } catch (e) {\n if (e\?.code === \"ENOENT\")\n full = fullUnresolved;\n else\n throw e;\n }\n let isDirectory;\n if (write)\n try {\n isDirectory = fs.statSync(full).isDirectory();\n } catch (_err) {\n }\n let realfd;\n if (!write && isDirectory)\n realfd = fs.openSync(full, nodeFsConstants.O_RDONLY);\n else\n realfd = fs.openSync(full, noflags);\n const newfd = this.getUnusedFileDescriptor();\n this.FD_MAP.set(newfd, {\n real: realfd,\n filetype: void 0,\n rights: {\n base: neededBase,\n inheriting: neededInheriting\n },\n path: full\n }), stat(this, newfd), this.view.setUint32(fdPtr, newfd, !0);\n } catch (e) {\n console.error(e);\n }\n return constants_1.WASI_ESUCCESS;\n }),\n path_readlink: wrap((fd, pathPtr, pathLen, buf, bufLen, bufused) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_READLINK);\n if (!stats.path)\n return constants_1.WASI_EINVAL;\n this.refreshMemory();\n const p = @Buffer.from(this.memory.buffer, pathPtr, pathLen).toString(), full = path.resolve(stats.path, p), r = fs.readlinkSync(full), used = @Buffer.from(this.memory.buffer).write(r, buf, bufLen);\n return this.view.setUint32(bufused, used, !0), constants_1.WASI_ESUCCESS;\n }),\n path_remove_directory: wrap((fd, pathPtr, pathLen) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_REMOVE_DIRECTORY);\n if (!stats.path)\n return constants_1.WASI_EINVAL;\n this.refreshMemory();\n const p = @Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n return fs.rmdirSync(path.resolve(stats.path, p)), constants_1.WASI_ESUCCESS;\n }),\n path_rename: wrap((oldFd, oldPath, oldPathLen, newFd, newPath, newPathLen) => {\n const ostats = CHECK_FD(oldFd, constants_1.WASI_RIGHT_PATH_RENAME_SOURCE), nstats = CHECK_FD(newFd, constants_1.WASI_RIGHT_PATH_RENAME_TARGET);\n if (!ostats.path || !nstats.path)\n return constants_1.WASI_EINVAL;\n this.refreshMemory();\n const op = @Buffer.from(this.memory.buffer, oldPath, oldPathLen).toString(), np = @Buffer.from(this.memory.buffer, newPath, newPathLen).toString();\n return fs.renameSync(path.resolve(ostats.path, op), path.resolve(nstats.path, np)), constants_1.WASI_ESUCCESS;\n }),\n path_symlink: wrap((oldPath, oldPathLen, fd, newPath, newPathLen) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_SYMLINK);\n if (!stats.path)\n return constants_1.WASI_EINVAL;\n this.refreshMemory();\n const op = @Buffer.from(this.memory.buffer, oldPath, oldPathLen).toString(), np = @Buffer.from(this.memory.buffer, newPath, newPathLen).toString();\n return fs.symlinkSync(op, path.resolve(stats.path, np)), constants_1.WASI_ESUCCESS;\n }),\n path_unlink_file: wrap((fd, pathPtr, pathLen) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_UNLINK_FILE);\n if (!stats.path)\n return constants_1.WASI_EINVAL;\n this.refreshMemory();\n const p = @Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n return fs.unlinkSync(path.resolve(stats.path, p)), constants_1.WASI_ESUCCESS;\n }),\n poll_oneoff: (sin, sout, nsubscriptions, neventsPtr) => {\n let nevents = 0, name = \"\", waitTimeNs = BigInt(0), fd = -1, fd_type = \"read\", fd_timeout_ms = 0;\n const startNs = BigInt(bindings2.hrtime());\n this.refreshMemory();\n let last_sin = sin;\n for (let i = 0;i < nsubscriptions; i += 1) {\n const userdata = this.view.getBigUint64(sin, !0);\n sin += 8;\n const type = this.view.getUint8(sin);\n if (sin += 1, sin += 7, log.enabled) {\n if (type == constants_1.WASI_EVENTTYPE_CLOCK)\n name = \"poll_oneoff (type=WASI_EVENTTYPE_CLOCK): \";\n else if (type == constants_1.WASI_EVENTTYPE_FD_READ)\n name = \"poll_oneoff (type=WASI_EVENTTYPE_FD_READ): \";\n else\n name = \"poll_oneoff (type=WASI_EVENTTYPE_FD_WRITE): \";\n log(name);\n }\n switch (type) {\n case constants_1.WASI_EVENTTYPE_CLOCK: {\n const clockid = this.view.getUint32(sin, !0);\n sin += 4, sin += 4;\n const timeout = this.view.getBigUint64(sin, !0);\n sin += 8, sin += 8;\n const subclockflags = this.view.getUint16(sin, !0);\n sin += 2, sin += 6;\n const absolute = subclockflags === 1;\n if (log.enabled)\n log(name, { clockid, timeout, absolute });\n if (!absolute)\n fd_timeout_ms = timeout / BigInt(1e6);\n let e = constants_1.WASI_ESUCCESS;\n const t = now(clockid);\n if (t == null)\n e = constants_1.WASI_EINVAL;\n else {\n const tNS = BigInt(t), waitNs = (absolute \? timeout : tNS + timeout) - tNS;\n if (waitNs > waitTimeNs)\n waitTimeNs = waitNs;\n }\n this.view.setBigUint64(sout, userdata, !0), sout += 8, this.view.setUint16(sout, e, !0), sout += 2, this.view.setUint8(sout, constants_1.WASI_EVENTTYPE_CLOCK), sout += 1, sout += 5, nevents += 1;\n break;\n }\n case constants_1.WASI_EVENTTYPE_FD_READ:\n case constants_1.WASI_EVENTTYPE_FD_WRITE: {\n if (fd = this.view.getUint32(sin, !0), fd_type = type == constants_1.WASI_EVENTTYPE_FD_READ \? \"read\" : \"write\", sin += 4, log(name, \"fd =\", fd), sin += 28, this.view.setBigUint64(sout, userdata, !0), sout += 8, this.view.setUint16(sout, constants_1.WASI_ENOSYS, !0), sout += 2, this.view.setUint8(sout, type), sout += 1, sout += 5, nevents += 1, fd == constants_1.WASI_STDIN_FILENO && constants_1.WASI_EVENTTYPE_FD_READ == type)\n this.shortPause();\n break;\n }\n default:\n return constants_1.WASI_EINVAL;\n }\n if (sin - last_sin != 48)\n console.warn(\"*** BUG in wasi-js in poll_oneoff \", {\n i,\n sin,\n last_sin,\n diff: sin - last_sin\n });\n last_sin = sin;\n }\n if (this.view.setUint32(neventsPtr, nevents, !0), nevents == 2 && fd >= 0) {\n const r = this.wasiImport.sock_pollSocket(fd, fd_type, fd_timeout_ms);\n if (r != constants_1.WASI_ENOSYS)\n return r;\n }\n if (waitTimeNs > 0) {\n if (waitTimeNs -= Bun.nanoseconds() - timeOrigin, waitTimeNs >= 1e6) {\n if (this.sleep == null && !warnedAboutSleep)\n warnedAboutSleep = !0, console.log(\"(100% cpu burning waiting for stdin: please define a way to sleep!) \");\n if (this.sleep != null) {\n const ms = nsToMs(waitTimeNs);\n this.sleep(ms);\n } else {\n const end = BigInt(bindings2.hrtime()) + waitTimeNs;\n while (BigInt(bindings2.hrtime()) < end)\n ;\n }\n }\n }\n return constants_1.WASI_ESUCCESS;\n },\n proc_exit: (rval) => {\n return bindings2.exit(rval), constants_1.WASI_ESUCCESS;\n },\n proc_raise: (sig) => {\n if (!(sig in constants_1.SIGNAL_MAP))\n return constants_1.WASI_EINVAL;\n return bindings2.kill(constants_1.SIGNAL_MAP[sig]), constants_1.WASI_ESUCCESS;\n },\n random_get: (bufPtr, bufLen) => {\n return this.refreshMemory(), crypto.getRandomValues(this.memory.buffer, bufPtr, bufLen), bufLen;\n },\n sched_yield() {\n return constants_1.WASI_ESUCCESS;\n },\n sock_recv() {\n return constants_1.WASI_ENOSYS;\n },\n sock_send() {\n return constants_1.WASI_ENOSYS;\n },\n sock_shutdown() {\n return constants_1.WASI_ENOSYS;\n },\n sock_fcntlSetFlags(_fd, _flags) {\n return constants_1.WASI_ENOSYS;\n },\n sock_pollSocket(_fd, _eventtype, _timeout_ms) {\n return constants_1.WASI_ENOSYS;\n }\n }, log.enabled)\n Object.keys(this.wasiImport).forEach((key) => {\n const prevImport = this.wasiImport[key];\n this.wasiImport[key] = function(...args2) {\n log(key, args2);\n try {\n let result = prevImport(...args2);\n return log(\"result\", result), result;\n } catch (e) {\n throw log(\"error: \", e), e;\n }\n };\n });\n }\n getState() {\n return { env: this.env, FD_MAP: this.FD_MAP, bindings };\n }\n setState(state) {\n this.env = state.env, this.FD_MAP = state.FD_MAP, bindings = state.bindings;\n }\n fstatSync(real_fd) {\n if (real_fd <= 2)\n try {\n return fs.fstatSync(real_fd);\n } catch (_) {\n const now = new Date;\n return {\n dev: 0,\n mode: 8592,\n nlink: 1,\n uid: 0,\n gid: 0,\n rdev: 0,\n blksize: 65536,\n ino: 0,\n size: 0,\n blocks: 0,\n atimeMs: now.valueOf(),\n mtimeMs: now.valueOf(),\n ctimeMs: now.valueOf(),\n birthtimeMs: 0,\n atime: new Date,\n mtime: new Date,\n ctime: new Date,\n birthtime: new Date(0)\n };\n }\n return fs.fstatSync(real_fd);\n }\n shortPause() {\n if (this.sleep == null)\n return;\n if ((new Date()).valueOf() - this.lastStdin > 2000)\n this.sleep(50);\n }\n getUnusedFileDescriptor(start = 3) {\n let fd = start;\n while (this.FD_MAP.has(fd))\n fd += 1;\n if (fd > SC_OPEN_MAX)\n throw Error(\"no available file descriptors\");\n return fd;\n }\n refreshMemory() {\n if (!this.view || this.view.buffer.byteLength === 0)\n this.view = new DataView(this.memory.buffer);\n }\n setMemory(memory) {\n this.memory = memory;\n }\n start(instance, memory) {\n const exports2 = instance.exports;\n if (exports2 === null || typeof exports2 !== \"object\")\n throw new Error(`instance.exports must be an Object. Received ${exports2}.`);\n if (memory == null) {\n if (memory = exports2.memory, !(memory instanceof WebAssembly.Memory))\n throw new Error(`instance.exports.memory must be a WebAssembly.Memory. Recceived ${memory}.`);\n }\n if (this.setMemory(memory), exports2._start)\n exports2._start();\n }\n getImports(module2) {\n let namespace = null;\n const imports = WebAssembly.Module.imports(module2);\n for (let imp of imports) {\n if (imp.kind !== \"function\")\n continue;\n if (!imp.module.startsWith(\"wasi_\"))\n continue;\n namespace = imp.module;\n break;\n }\n switch (namespace) {\n case \"wasi_unstable\":\n return {\n wasi_unstable: this.wasiImport\n };\n case \"wasi_snapshot_preview1\":\n return {\n wasi_snapshot_preview1: this.wasiImport\n };\n default:\n throw new Error(\"No WASI namespace found. Only wasi_unstable and wasi_snapshot_preview1 are supported.\\n\\nList of imports:\\n\\n\" + imports.map(({ name, kind, module }) => `${module}:${name} (${kind})`).join(\"\\n\") + \"\\n\");\n }\n }\n initWasiFdInfo() {\n if (this.env.WASI_FD_INFO != null) {\n const fdInfo = JSON.parse(this.env.WASI_FD_INFO);\n for (let wasi_fd in fdInfo) {\n console.log(wasi_fd);\n const fd = parseInt(wasi_fd);\n if (this.FD_MAP.has(fd))\n continue;\n const real = fdInfo[wasi_fd];\n try {\n this.fstatSync(real);\n } catch (_err) {\n console.log(\"discarding \", { wasi_fd, real });\n continue;\n }\n const file = {\n real,\n filetype: constants_1.WASI_FILETYPE_SOCKET_STREAM,\n rights: {\n base: STDIN_DEFAULT_RIGHTS,\n inheriting: BigInt(0)\n }\n };\n this.FD_MAP.set(fd, file);\n }\n console.log(\"after initWasiFdInfo: \", this.FD_MAP), console.log(\"fdInfo = \", fdInfo);\n } else\n console.log(\"no WASI_FD_INFO\");\n }\n };\n exports.default = WASI;\n }\n});\nreturn { WASI: require_wasi().default }})\n"); -// - -// -static constexpr ASCIILiteral NodeWorkerThreadsCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/worker_threads.ts\nvar emitWarning = function(type, message) {\n if (emittedWarnings.has(type))\n return;\n emittedWarnings.add(type), console.warn(\"[bun] Warning:\", message);\n}, injectFakeEmitter = function(Class) {\n function messageEventHandler(event) {\n return event.data;\n }\n function errorEventHandler(event) {\n return event.error;\n }\n const wrappedListener = Symbol(\"wrappedListener\");\n function wrapped(run, listener) {\n const callback = function(event) {\n return listener(run(event));\n };\n return listener[wrappedListener] = callback, callback;\n }\n function functionForEventType(event, listener) {\n switch (event) {\n case \"error\":\n case \"messageerror\":\n return wrapped(errorEventHandler, listener);\n default:\n return wrapped(messageEventHandler, listener);\n }\n }\n Class.prototype.on = function(event, listener) {\n return this.addEventListener(event, functionForEventType(event, listener)), this;\n }, Class.prototype.off = function(event, listener) {\n if (listener)\n this.removeEventListener(event, listener[wrappedListener] || listener);\n else\n this.removeEventListener(event);\n return this;\n }, Class.prototype.once = function(event, listener) {\n return this.addEventListener(event, functionForEventType(event, listener), { once: !0 }), this;\n };\n function EventClass(eventName) {\n if (eventName === \"error\" || eventName === \"messageerror\")\n return ErrorEvent;\n return MessageEvent;\n }\n Class.prototype.emit = function(event, ...args) {\n return this.dispatchEvent(new (EventClass(event))(event, ...args)), this;\n }, Class.prototype.prependListener = Class.prototype.on, Class.prototype.prependOnceListener = Class.prototype.once;\n}, receiveMessageOnPort = function(port) {\n let res = _receiveMessageOnPort(port);\n if (!res)\n return @undefined;\n return {\n message: res\n };\n}, fakeParentPort = function() {\n const fake = Object.create(MessagePort.prototype);\n return Object.defineProperty(fake, \"onmessage\", {\n get() {\n return self.onmessage;\n },\n set(value) {\n self.onmessage = value;\n }\n }), Object.defineProperty(fake, \"onmessageerror\", {\n get() {\n return self.onmessageerror;\n },\n set(value) {\n }\n }), Object.defineProperty(fake, \"postMessage\", {\n value(...args) {\n return self.postMessage(...args);\n }\n }), Object.defineProperty(fake, \"close\", {\n value() {\n return process.exit(0);\n }\n }), Object.defineProperty(fake, \"start\", {\n value() {\n }\n }), Object.defineProperty(fake, \"unref\", {\n value() {\n }\n }), Object.defineProperty(fake, \"ref\", {\n value() {\n }\n }), Object.defineProperty(fake, \"hasRef\", {\n value() {\n return !1;\n }\n }), Object.defineProperty(fake, \"setEncoding\", {\n value() {\n }\n }), Object.defineProperty(fake, \"addEventListener\", {\n value: self.addEventListener.bind(self)\n }), Object.defineProperty(fake, \"removeEventListener\", {\n value: self.removeEventListener.bind(self)\n }), fake;\n}, getEnvironmentData = function() {\n return process.env;\n}, setEnvironmentData = function(env) {\n process.env = env;\n}, markAsUntransferable = function() {\n throwNotImplemented(\"worker_threads.markAsUntransferable\");\n}, moveMessagePortToContext = function() {\n throwNotImplemented(\"worker_threads.moveMessagePortToContext\");\n}, $, EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20), { throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6), { MessageChannel, BroadcastChannel, Worker: WebWorker } = globalThis, SHARE_ENV = Symbol(\"nodejs.worker_threads.SHARE_ENV\"), isMainThread = Bun.isMainThread, [_workerData, _threadId, _receiveMessageOnPort] = @lazy(\"worker_threads\"), emittedWarnings = new Set, _MessagePort = globalThis.MessagePort;\ninjectFakeEmitter(_MessagePort);\nvar MessagePort = _MessagePort, resourceLimits = {}, workerData = _workerData, threadId = _threadId, parentPort = isMainThread \? null : fakeParentPort(), unsupportedOptions = [\n \"eval\",\n \"argv\",\n \"execArgv\",\n \"stdin\",\n \"stdout\",\n \"stderr\",\n \"trackedUnmanagedFds\",\n \"resourceLimits\"\n];\n\nclass Worker extends EventEmitter {\n #worker;\n #performance;\n #onExitPromise = @undefined;\n constructor(filename, options = {}) {\n super();\n for (let key of unsupportedOptions)\n if (key in options)\n emitWarning(\"option.\" + key, `worker_threads.Worker option \"${key}\" is not implemented.`);\n this.#worker = new WebWorker(filename, options), this.#worker.addEventListener(\"close\", this.#onClose.bind(this)), this.#worker.addEventListener(\"error\", this.#onError.bind(this)), this.#worker.addEventListener(\"message\", this.#onMessage.bind(this)), this.#worker.addEventListener(\"messageerror\", this.#onMessageError.bind(this)), this.#worker.addEventListener(\"open\", this.#onOpen.bind(this));\n }\n get threadId() {\n return this.#worker.threadId;\n }\n ref() {\n this.#worker.ref();\n }\n unref() {\n this.#worker.unref();\n }\n get stdin() {\n return null;\n }\n get stdout() {\n return null;\n }\n get stderr() {\n return null;\n }\n get performance() {\n return this.#performance \?\?= {\n eventLoopUtilization() {\n return emitWarning(\"performance\", \"worker_threads.Worker.performance is not implemented.\"), {\n idle: 0,\n active: 0,\n utilization: 0\n };\n }\n };\n }\n terminate() {\n const onExitPromise = this.#onExitPromise;\n if (onExitPromise)\n return @isPromise(onExitPromise) \? onExitPromise : @Promise.resolve(onExitPromise);\n const { resolve, promise } = @Promise.withResolvers();\n return this.#worker.addEventListener(\"close\", (event) => {\n resolve(event.code);\n }, { once: !0 }), this.#worker.terminate(), this.#onExitPromise = promise;\n }\n postMessage(...args) {\n return this.#worker.postMessage(...args);\n }\n #onClose(e) {\n this.#onExitPromise = e.code, this.emit(\"exit\", e.code);\n }\n #onError(error) {\n this.emit(\"error\", error);\n }\n #onMessage(event) {\n this.emit(\"message\", event.data);\n }\n #onMessageError(event) {\n this.emit(\"messageerror\", event.error \?\? event.data \?\? event);\n }\n #onOpen() {\n this.emit(\"online\");\n }\n async getHeapSnapshot() {\n throwNotImplemented(\"worker_threads.Worker.getHeapSnapshot\");\n }\n}\n$ = {\n Worker,\n workerData,\n parentPort,\n resourceLimits,\n isMainThread,\n MessageChannel,\n BroadcastChannel,\n MessagePort,\n getEnvironmentData,\n setEnvironmentData,\n getHeapSnapshot() {\n return {};\n },\n markAsUntransferable,\n moveMessagePortToContext,\n receiveMessageOnPort,\n SHARE_ENV,\n threadId\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeZlibCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/zlib.ts\nvar assert = @getInternalField(@internalModuleRegistry, 8) || @createInternalModuleById(8), BufferModule = @requireNativeModule(\"buffer\"), StreamModule = @getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39), Util = @getInternalField(@internalModuleRegistry, 48) || @createInternalModuleById(48), __getOwnPropNames = Object.getOwnPropertyNames, __commonJS = (cb, mod) => function __require() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n}, require_zstream = __commonJS({\n \"node_modules/pako/lib/zlib/zstream.js\"(exports, module2) {\n function ZStream() {\n this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = \"\", this.state = null, this.data_type = 2, this.adler = 0;\n }\n module2.exports = ZStream;\n }\n}), require_common = __commonJS({\n \"node_modules/pako/lib/utils/common.js\"(exports) {\n var TYPED_OK = typeof @Uint8Array !== \"undefined\" && typeof Uint16Array !== \"undefined\" && typeof Int32Array !== \"undefined\";\n function _has(obj, key) {\n return Object.prototype.hasOwnProperty.@call(obj, key);\n }\n exports.assign = function(obj) {\n var sources = @Array.prototype.slice.@call(arguments, 1);\n while (sources.length) {\n var source = sources.shift();\n if (!source)\n continue;\n if (typeof source !== \"object\")\n @throwTypeError(source + \"must be non-object\");\n for (var p in source)\n if (_has(source, p))\n obj[p] = source[p];\n }\n return obj;\n }, exports.shrinkBuf = function(buf, size) {\n if (buf.length === size)\n return buf;\n if (buf.subarray)\n return buf.subarray(0, size);\n return buf.length = size, buf;\n };\n var fnTyped = {\n arraySet: function(dest, src, src_offs, len, dest_offs) {\n if (src.subarray && dest.subarray) {\n dest.set(src.subarray(src_offs, src_offs + len), dest_offs);\n return;\n }\n for (var i = 0;i < len; i++)\n dest[dest_offs + i] = src[src_offs + i];\n },\n flattenChunks: function(chunks) {\n var i, l, len, pos, chunk, result;\n len = 0;\n for (i = 0, l = chunks.length;i < l; i++)\n len += chunks[i].length;\n result = new @Uint8Array(len), pos = 0;\n for (i = 0, l = chunks.length;i < l; i++)\n chunk = chunks[i], result.set(chunk, pos), pos += chunk.length;\n return result;\n }\n }, fnUntyped = {\n arraySet: function(dest, src, src_offs, len, dest_offs) {\n for (var i = 0;i < len; i++)\n dest[dest_offs + i] = src[src_offs + i];\n },\n flattenChunks: function(chunks) {\n return [].concat.@apply([], chunks);\n }\n };\n exports.setTyped = function(on) {\n if (on)\n exports.Buf8 = @Uint8Array, exports.Buf16 = Uint16Array, exports.Buf32 = Int32Array, exports.assign(exports, fnTyped);\n else\n exports.Buf8 = @Array, exports.Buf16 = @Array, exports.Buf32 = @Array, exports.assign(exports, fnUntyped);\n }, exports.setTyped(TYPED_OK);\n }\n}), require_trees = __commonJS({\n \"node_modules/pako/lib/zlib/trees.js\"(exports) {\n var utils = require_common(), Z_FIXED = 4, Z_BINARY = 0, Z_TEXT = 1, Z_UNKNOWN = 2;\n function zero(buf) {\n var len = buf.length;\n while (--len >= 0)\n buf[len] = 0;\n }\n var STORED_BLOCK = 0, STATIC_TREES = 1, DYN_TREES = 2, MIN_MATCH = 3, MAX_MATCH = 258, LENGTH_CODES = 29, LITERALS = 256, L_CODES = LITERALS + 1 + LENGTH_CODES, D_CODES = 30, BL_CODES = 19, HEAP_SIZE = 2 * L_CODES + 1, MAX_BITS = 15, Buf_size = 16, MAX_BL_BITS = 7, END_BLOCK = 256, REP_3_6 = 16, REPZ_3_10 = 17, REPZ_11_138 = 18, extra_lbits = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0], extra_dbits = [\n 0,\n 0,\n 0,\n 0,\n 1,\n 1,\n 2,\n 2,\n 3,\n 3,\n 4,\n 4,\n 5,\n 5,\n 6,\n 6,\n 7,\n 7,\n 8,\n 8,\n 9,\n 9,\n 10,\n 10,\n 11,\n 11,\n 12,\n 12,\n 13,\n 13\n ], extra_blbits = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7], bl_order = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], DIST_CODE_LEN = 512, static_ltree = new @Array((L_CODES + 2) * 2);\n zero(static_ltree);\n var static_dtree = new @Array(D_CODES * 2);\n zero(static_dtree);\n var _dist_code = new @Array(DIST_CODE_LEN);\n zero(_dist_code);\n var _length_code = new @Array(MAX_MATCH - MIN_MATCH + 1);\n zero(_length_code);\n var base_length = new @Array(LENGTH_CODES);\n zero(base_length);\n var base_dist = new @Array(D_CODES);\n zero(base_dist);\n function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {\n this.static_tree = static_tree, this.extra_bits = extra_bits, this.extra_base = extra_base, this.elems = elems, this.max_length = max_length, this.has_stree = static_tree && static_tree.length;\n }\n var static_l_desc, static_d_desc, static_bl_desc;\n function TreeDesc(dyn_tree, stat_desc) {\n this.dyn_tree = dyn_tree, this.max_code = 0, this.stat_desc = stat_desc;\n }\n function d_code(dist) {\n return dist < 256 \? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];\n }\n function put_short(s, w) {\n s.pending_buf[s.pending++] = w & 255, s.pending_buf[s.pending++] = w >>> 8 & 255;\n }\n function send_bits(s, value, length) {\n if (s.bi_valid > Buf_size - length)\n s.bi_buf |= value << s.bi_valid & 65535, put_short(s, s.bi_buf), s.bi_buf = value >> Buf_size - s.bi_valid, s.bi_valid += length - Buf_size;\n else\n s.bi_buf |= value << s.bi_valid & 65535, s.bi_valid += length;\n }\n function send_code(s, c, tree) {\n send_bits(s, tree[c * 2], tree[c * 2 + 1]);\n }\n function bi_reverse(code, len) {\n var res = 0;\n do\n res |= code & 1, code >>>= 1, res <<= 1;\n while (--len > 0);\n return res >>> 1;\n }\n function bi_flush(s) {\n if (s.bi_valid === 16)\n put_short(s, s.bi_buf), s.bi_buf = 0, s.bi_valid = 0;\n else if (s.bi_valid >= 8)\n s.pending_buf[s.pending++] = s.bi_buf & 255, s.bi_buf >>= 8, s.bi_valid -= 8;\n }\n function gen_bitlen(s, desc) {\n var { dyn_tree: tree, max_code } = desc, stree = desc.stat_desc.static_tree, has_stree = desc.stat_desc.has_stree, extra = desc.stat_desc.extra_bits, base = desc.stat_desc.extra_base, max_length = desc.stat_desc.max_length, h, n, m, bits, xbits, f, overflow = 0;\n for (bits = 0;bits <= MAX_BITS; bits++)\n s.bl_count[bits] = 0;\n tree[s.heap[s.heap_max] * 2 + 1] = 0;\n for (h = s.heap_max + 1;h < HEAP_SIZE; h++) {\n if (n = s.heap[h], bits = tree[tree[n * 2 + 1] * 2 + 1] + 1, bits > max_length)\n bits = max_length, overflow++;\n if (tree[n * 2 + 1] = bits, n > max_code)\n continue;\n if (s.bl_count[bits]++, xbits = 0, n >= base)\n xbits = extra[n - base];\n if (f = tree[n * 2], s.opt_len += f * (bits + xbits), has_stree)\n s.static_len += f * (stree[n * 2 + 1] + xbits);\n }\n if (overflow === 0)\n return;\n do {\n bits = max_length - 1;\n while (s.bl_count[bits] === 0)\n bits--;\n s.bl_count[bits]--, s.bl_count[bits + 1] += 2, s.bl_count[max_length]--, overflow -= 2;\n } while (overflow > 0);\n for (bits = max_length;bits !== 0; bits--) {\n n = s.bl_count[bits];\n while (n !== 0) {\n if (m = s.heap[--h], m > max_code)\n continue;\n if (tree[m * 2 + 1] !== bits)\n s.opt_len += (bits - tree[m * 2 + 1]) * tree[m * 2], tree[m * 2 + 1] = bits;\n n--;\n }\n }\n }\n function gen_codes(tree, max_code, bl_count) {\n var next_code = new @Array(MAX_BITS + 1), code = 0, bits, n;\n for (bits = 1;bits <= MAX_BITS; bits++)\n next_code[bits] = code = code + bl_count[bits - 1] << 1;\n for (n = 0;n <= max_code; n++) {\n var len = tree[n * 2 + 1];\n if (len === 0)\n continue;\n tree[n * 2] = bi_reverse(next_code[len]++, len);\n }\n }\n function tr_static_init() {\n var n, bits, length, code, dist, bl_count = new @Array(MAX_BITS + 1);\n length = 0;\n for (code = 0;code < LENGTH_CODES - 1; code++) {\n base_length[code] = length;\n for (n = 0;n < 1 << extra_lbits[code]; n++)\n _length_code[length++] = code;\n }\n _length_code[length - 1] = code, dist = 0;\n for (code = 0;code < 16; code++) {\n base_dist[code] = dist;\n for (n = 0;n < 1 << extra_dbits[code]; n++)\n _dist_code[dist++] = code;\n }\n dist >>= 7;\n for (;code < D_CODES; code++) {\n base_dist[code] = dist << 7;\n for (n = 0;n < 1 << extra_dbits[code] - 7; n++)\n _dist_code[256 + dist++] = code;\n }\n for (bits = 0;bits <= MAX_BITS; bits++)\n bl_count[bits] = 0;\n n = 0;\n while (n <= 143)\n static_ltree[n * 2 + 1] = 8, n++, bl_count[8]++;\n while (n <= 255)\n static_ltree[n * 2 + 1] = 9, n++, bl_count[9]++;\n while (n <= 279)\n static_ltree[n * 2 + 1] = 7, n++, bl_count[7]++;\n while (n <= 287)\n static_ltree[n * 2 + 1] = 8, n++, bl_count[8]++;\n gen_codes(static_ltree, L_CODES + 1, bl_count);\n for (n = 0;n < D_CODES; n++)\n static_dtree[n * 2 + 1] = 5, static_dtree[n * 2] = bi_reverse(n, 5);\n static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS), static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS), static_bl_desc = new StaticTreeDesc(new @Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS);\n }\n function init_block(s) {\n var n;\n for (n = 0;n < L_CODES; n++)\n s.dyn_ltree[n * 2] = 0;\n for (n = 0;n < D_CODES; n++)\n s.dyn_dtree[n * 2] = 0;\n for (n = 0;n < BL_CODES; n++)\n s.bl_tree[n * 2] = 0;\n s.dyn_ltree[END_BLOCK * 2] = 1, s.opt_len = s.static_len = 0, s.last_lit = s.matches = 0;\n }\n function bi_windup(s) {\n if (s.bi_valid > 8)\n put_short(s, s.bi_buf);\n else if (s.bi_valid > 0)\n s.pending_buf[s.pending++] = s.bi_buf;\n s.bi_buf = 0, s.bi_valid = 0;\n }\n function copy_block(s, buf, len, header) {\n if (bi_windup(s), header)\n put_short(s, len), put_short(s, ~len);\n utils.arraySet(s.pending_buf, s.window, buf, len, s.pending), s.pending += len;\n }\n function smaller(tree, n, m, depth) {\n var _n2 = n * 2, _m2 = m * 2;\n return tree[_n2] < tree[_m2] || tree[_n2] === tree[_m2] && depth[n] <= depth[m];\n }\n function pqdownheap(s, tree, k) {\n var v = s.heap[k], j = k << 1;\n while (j <= s.heap_len) {\n if (j < s.heap_len && smaller(tree, s.heap[j + 1], s.heap[j], s.depth))\n j++;\n if (smaller(tree, v, s.heap[j], s.depth))\n break;\n s.heap[k] = s.heap[j], k = j, j <<= 1;\n }\n s.heap[k] = v;\n }\n function compress_block(s, ltree, dtree) {\n var dist, lc, lx = 0, code, extra;\n if (s.last_lit !== 0)\n do\n if (dist = s.pending_buf[s.d_buf + lx * 2] << 8 | s.pending_buf[s.d_buf + lx * 2 + 1], lc = s.pending_buf[s.l_buf + lx], lx++, dist === 0)\n send_code(s, lc, ltree);\n else {\n if (code = _length_code[lc], send_code(s, code + LITERALS + 1, ltree), extra = extra_lbits[code], extra !== 0)\n lc -= base_length[code], send_bits(s, lc, extra);\n if (dist--, code = d_code(dist), send_code(s, code, dtree), extra = extra_dbits[code], extra !== 0)\n dist -= base_dist[code], send_bits(s, dist, extra);\n }\n while (lx < s.last_lit);\n send_code(s, END_BLOCK, ltree);\n }\n function build_tree(s, desc) {\n var tree = desc.dyn_tree, stree = desc.stat_desc.static_tree, has_stree = desc.stat_desc.has_stree, elems = desc.stat_desc.elems, n, m, max_code = -1, node;\n s.heap_len = 0, s.heap_max = HEAP_SIZE;\n for (n = 0;n < elems; n++)\n if (tree[n * 2] !== 0)\n s.heap[++s.heap_len] = max_code = n, s.depth[n] = 0;\n else\n tree[n * 2 + 1] = 0;\n while (s.heap_len < 2)\n if (node = s.heap[++s.heap_len] = max_code < 2 \? ++max_code : 0, tree[node * 2] = 1, s.depth[node] = 0, s.opt_len--, has_stree)\n s.static_len -= stree[node * 2 + 1];\n desc.max_code = max_code;\n for (n = s.heap_len >> 1;n >= 1; n--)\n pqdownheap(s, tree, n);\n node = elems;\n do\n n = s.heap[1], s.heap[1] = s.heap[s.heap_len--], pqdownheap(s, tree, 1), m = s.heap[1], s.heap[--s.heap_max] = n, s.heap[--s.heap_max] = m, tree[node * 2] = tree[n * 2] + tree[m * 2], s.depth[node] = (s.depth[n] >= s.depth[m] \? s.depth[n] : s.depth[m]) + 1, tree[n * 2 + 1] = tree[m * 2 + 1] = node, s.heap[1] = node++, pqdownheap(s, tree, 1);\n while (s.heap_len >= 2);\n s.heap[--s.heap_max] = s.heap[1], gen_bitlen(s, desc), gen_codes(tree, max_code, s.bl_count);\n }\n function scan_tree(s, tree, max_code) {\n var n, prevlen = -1, curlen, nextlen = tree[1], count = 0, max_count = 7, min_count = 4;\n if (nextlen === 0)\n max_count = 138, min_count = 3;\n tree[(max_code + 1) * 2 + 1] = 65535;\n for (n = 0;n <= max_code; n++) {\n if (curlen = nextlen, nextlen = tree[(n + 1) * 2 + 1], ++count < max_count && curlen === nextlen)\n continue;\n else if (count < min_count)\n s.bl_tree[curlen * 2] += count;\n else if (curlen !== 0) {\n if (curlen !== prevlen)\n s.bl_tree[curlen * 2]++;\n s.bl_tree[REP_3_6 * 2]++;\n } else if (count <= 10)\n s.bl_tree[REPZ_3_10 * 2]++;\n else\n s.bl_tree[REPZ_11_138 * 2]++;\n if (count = 0, prevlen = curlen, nextlen === 0)\n max_count = 138, min_count = 3;\n else if (curlen === nextlen)\n max_count = 6, min_count = 3;\n else\n max_count = 7, min_count = 4;\n }\n }\n function send_tree(s, tree, max_code) {\n var n, prevlen = -1, curlen, nextlen = tree[1], count = 0, max_count = 7, min_count = 4;\n if (nextlen === 0)\n max_count = 138, min_count = 3;\n for (n = 0;n <= max_code; n++) {\n if (curlen = nextlen, nextlen = tree[(n + 1) * 2 + 1], ++count < max_count && curlen === nextlen)\n continue;\n else if (count < min_count)\n do\n send_code(s, curlen, s.bl_tree);\n while (--count !== 0);\n else if (curlen !== 0) {\n if (curlen !== prevlen)\n send_code(s, curlen, s.bl_tree), count--;\n send_code(s, REP_3_6, s.bl_tree), send_bits(s, count - 3, 2);\n } else if (count <= 10)\n send_code(s, REPZ_3_10, s.bl_tree), send_bits(s, count - 3, 3);\n else\n send_code(s, REPZ_11_138, s.bl_tree), send_bits(s, count - 11, 7);\n if (count = 0, prevlen = curlen, nextlen === 0)\n max_count = 138, min_count = 3;\n else if (curlen === nextlen)\n max_count = 6, min_count = 3;\n else\n max_count = 7, min_count = 4;\n }\n }\n function build_bl_tree(s) {\n var max_blindex;\n scan_tree(s, s.dyn_ltree, s.l_desc.max_code), scan_tree(s, s.dyn_dtree, s.d_desc.max_code), build_tree(s, s.bl_desc);\n for (max_blindex = BL_CODES - 1;max_blindex >= 3; max_blindex--)\n if (s.bl_tree[bl_order[max_blindex] * 2 + 1] !== 0)\n break;\n return s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4, max_blindex;\n }\n function send_all_trees(s, lcodes, dcodes, blcodes) {\n var rank;\n send_bits(s, lcodes - 257, 5), send_bits(s, dcodes - 1, 5), send_bits(s, blcodes - 4, 4);\n for (rank = 0;rank < blcodes; rank++)\n send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1], 3);\n send_tree(s, s.dyn_ltree, lcodes - 1), send_tree(s, s.dyn_dtree, dcodes - 1);\n }\n function detect_data_type(s) {\n var black_mask = 4093624447, n;\n for (n = 0;n <= 31; n++, black_mask >>>= 1)\n if (black_mask & 1 && s.dyn_ltree[n * 2] !== 0)\n return Z_BINARY;\n if (s.dyn_ltree[18] !== 0 || s.dyn_ltree[20] !== 0 || s.dyn_ltree[26] !== 0)\n return Z_TEXT;\n for (n = 32;n < LITERALS; n++)\n if (s.dyn_ltree[n * 2] !== 0)\n return Z_TEXT;\n return Z_BINARY;\n }\n var static_init_done = !1;\n function _tr_init(s) {\n if (!static_init_done)\n tr_static_init(), static_init_done = !0;\n s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc), s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc), s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc), s.bi_buf = 0, s.bi_valid = 0, init_block(s);\n }\n function _tr_stored_block(s, buf, stored_len, last) {\n send_bits(s, (STORED_BLOCK << 1) + (last \? 1 : 0), 3), copy_block(s, buf, stored_len, !0);\n }\n function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3), send_code(s, END_BLOCK, static_ltree), bi_flush(s);\n }\n function _tr_flush_block(s, buf, stored_len, last) {\n var opt_lenb, static_lenb, max_blindex = 0;\n if (s.level > 0) {\n if (s.strm.data_type === Z_UNKNOWN)\n s.strm.data_type = detect_data_type(s);\n if (build_tree(s, s.l_desc), build_tree(s, s.d_desc), max_blindex = build_bl_tree(s), opt_lenb = s.opt_len + 3 + 7 >>> 3, static_lenb = s.static_len + 3 + 7 >>> 3, static_lenb <= opt_lenb)\n opt_lenb = static_lenb;\n } else\n opt_lenb = static_lenb = stored_len + 5;\n if (stored_len + 4 <= opt_lenb && buf !== -1)\n _tr_stored_block(s, buf, stored_len, last);\n else if (s.strategy === Z_FIXED || static_lenb === opt_lenb)\n send_bits(s, (STATIC_TREES << 1) + (last \? 1 : 0), 3), compress_block(s, static_ltree, static_dtree);\n else\n send_bits(s, (DYN_TREES << 1) + (last \? 1 : 0), 3), send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1), compress_block(s, s.dyn_ltree, s.dyn_dtree);\n if (init_block(s), last)\n bi_windup(s);\n }\n function _tr_tally(s, dist, lc) {\n if (s.pending_buf[s.d_buf + s.last_lit * 2] = dist >>> 8 & 255, s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 255, s.pending_buf[s.l_buf + s.last_lit] = lc & 255, s.last_lit++, dist === 0)\n s.dyn_ltree[lc * 2]++;\n else\n s.matches++, dist--, s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]++, s.dyn_dtree[d_code(dist) * 2]++;\n return s.last_lit === s.lit_bufsize - 1;\n }\n exports._tr_init = _tr_init, exports._tr_stored_block = _tr_stored_block, exports._tr_flush_block = _tr_flush_block, exports._tr_tally = _tr_tally, exports._tr_align = _tr_align;\n }\n}), require_adler32 = __commonJS({\n \"node_modules/pako/lib/zlib/adler32.js\"(exports, module2) {\n function adler32(adler, buf, len, pos) {\n var s1 = adler & 65535 | 0, s2 = adler >>> 16 & 65535 | 0, n = 0;\n while (len !== 0) {\n n = len > 2000 \? 2000 : len, len -= n;\n do\n s1 = s1 + buf[pos++] | 0, s2 = s2 + s1 | 0;\n while (--n);\n s1 %= 65521, s2 %= 65521;\n }\n return s1 | s2 << 16 | 0;\n }\n module2.exports = adler32;\n }\n}), require_crc32 = __commonJS({\n \"node_modules/pako/lib/zlib/crc32.js\"(exports, module2) {\n function makeTable() {\n var c, table = [];\n for (var n = 0;n < 256; n++) {\n c = n;\n for (var k = 0;k < 8; k++)\n c = c & 1 \? 3988292384 ^ c >>> 1 : c >>> 1;\n table[n] = c;\n }\n return table;\n }\n var crcTable = makeTable();\n function crc32(crc, buf, len, pos) {\n var t = crcTable, end = pos + len;\n crc ^= -1;\n for (var i = pos;i < end; i++)\n crc = crc >>> 8 ^ t[(crc ^ buf[i]) & 255];\n return crc ^ -1;\n }\n module2.exports = crc32;\n }\n}), require_messages = __commonJS({\n \"node_modules/pako/lib/zlib/messages.js\"(exports, module2) {\n module2.exports = {\n 2: \"need dictionary\",\n 1: \"stream end\",\n 0: \"\",\n \"-1\": \"file error\",\n \"-2\": \"stream error\",\n \"-3\": \"data error\",\n \"-4\": \"insufficient memory\",\n \"-5\": \"buffer error\",\n \"-6\": \"incompatible version\"\n };\n }\n}), require_deflate = __commonJS({\n \"node_modules/pako/lib/zlib/deflate.js\"(exports) {\n var utils = require_common(), trees = require_trees(), adler32 = require_adler32(), crc32 = require_crc32(), msg = require_messages(), Z_NO_FLUSH = 0, Z_PARTIAL_FLUSH = 1, Z_FULL_FLUSH = 3, Z_FINISH = 4, Z_BLOCK = 5, Z_OK = 0, Z_STREAM_END = 1, Z_STREAM_ERROR = -2, Z_DATA_ERROR = -3, Z_BUF_ERROR = -5, Z_DEFAULT_COMPRESSION = -1, Z_FILTERED = 1, Z_HUFFMAN_ONLY = 2, Z_RLE = 3, Z_FIXED = 4, Z_DEFAULT_STRATEGY = 0, Z_UNKNOWN = 2, Z_DEFLATED = 8, MAX_MEM_LEVEL = 9, MAX_WBITS = 15, DEF_MEM_LEVEL = 8, LENGTH_CODES = 29, LITERALS = 256, L_CODES = LITERALS + 1 + LENGTH_CODES, D_CODES = 30, BL_CODES = 19, HEAP_SIZE = 2 * L_CODES + 1, MAX_BITS = 15, MIN_MATCH = 3, MAX_MATCH = 258, MIN_LOOKAHEAD = MAX_MATCH + MIN_MATCH + 1, PRESET_DICT = 32, INIT_STATE = 42, EXTRA_STATE = 69, NAME_STATE = 73, COMMENT_STATE = 91, HCRC_STATE = 103, BUSY_STATE = 113, FINISH_STATE = 666, BS_NEED_MORE = 1, BS_BLOCK_DONE = 2, BS_FINISH_STARTED = 3, BS_FINISH_DONE = 4, OS_CODE = 3;\n function err(strm, errorCode) {\n return strm.msg = msg[errorCode], errorCode;\n }\n function rank(f) {\n return (f << 1) - (f > 4 \? 9 : 0);\n }\n function zero(buf) {\n var len = buf.length;\n while (--len >= 0)\n buf[len] = 0;\n }\n function flush_pending(strm) {\n var s = strm.state, len = s.pending;\n if (len > strm.avail_out)\n len = strm.avail_out;\n if (len === 0)\n return;\n if (utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out), strm.next_out += len, s.pending_out += len, strm.total_out += len, strm.avail_out -= len, s.pending -= len, s.pending === 0)\n s.pending_out = 0;\n }\n function flush_block_only(s, last) {\n trees._tr_flush_block(s, s.block_start >= 0 \? s.block_start : -1, s.strstart - s.block_start, last), s.block_start = s.strstart, flush_pending(s.strm);\n }\n function put_byte(s, b) {\n s.pending_buf[s.pending++] = b;\n }\n function putShortMSB(s, b) {\n s.pending_buf[s.pending++] = b >>> 8 & 255, s.pending_buf[s.pending++] = b & 255;\n }\n function read_buf(strm, buf, start, size) {\n var len = strm.avail_in;\n if (len > size)\n len = size;\n if (len === 0)\n return 0;\n if (strm.avail_in -= len, utils.arraySet(buf, strm.input, strm.next_in, len, start), strm.state.wrap === 1)\n strm.adler = adler32(strm.adler, buf, len, start);\n else if (strm.state.wrap === 2)\n strm.adler = crc32(strm.adler, buf, len, start);\n return strm.next_in += len, strm.total_in += len, len;\n }\n function longest_match(s, cur_match) {\n var { max_chain_length: chain_length, strstart: scan } = s, match, len, best_len = s.prev_length, nice_match = s.nice_match, limit = s.strstart > s.w_size - MIN_LOOKAHEAD \? s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0, _win = s.window, wmask = s.w_mask, prev = s.prev, strend = s.strstart + MAX_MATCH, scan_end1 = _win[scan + best_len - 1], scan_end = _win[scan + best_len];\n if (s.prev_length >= s.good_match)\n chain_length >>= 2;\n if (nice_match > s.lookahead)\n nice_match = s.lookahead;\n do {\n if (match = cur_match, _win[match + best_len] !== scan_end || _win[match + best_len - 1] !== scan_end1 || _win[match] !== _win[scan] || _win[++match] !== _win[scan + 1])\n continue;\n scan += 2, match++;\n do\n ;\n while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && scan < strend);\n if (len = MAX_MATCH - (strend - scan), scan = strend - MAX_MATCH, len > best_len) {\n if (s.match_start = cur_match, best_len = len, len >= nice_match)\n break;\n scan_end1 = _win[scan + best_len - 1], scan_end = _win[scan + best_len];\n }\n } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);\n if (best_len <= s.lookahead)\n return best_len;\n return s.lookahead;\n }\n function fill_window(s) {\n var _w_size = s.w_size, p, n, m, more, str;\n do {\n if (more = s.window_size - s.lookahead - s.strstart, s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {\n utils.arraySet(s.window, s.window, _w_size, _w_size, 0), s.match_start -= _w_size, s.strstart -= _w_size, s.block_start -= _w_size, n = s.hash_size, p = n;\n do\n m = s.head[--p], s.head[p] = m >= _w_size \? m - _w_size : 0;\n while (--n);\n n = _w_size, p = n;\n do\n m = s.prev[--p], s.prev[p] = m >= _w_size \? m - _w_size : 0;\n while (--n);\n more += _w_size;\n }\n if (s.strm.avail_in === 0)\n break;\n if (n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more), s.lookahead += n, s.lookahead + s.insert >= MIN_MATCH) {\n str = s.strstart - s.insert, s.ins_h = s.window[str], s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + 1]) & s.hash_mask;\n while (s.insert)\n if (s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask, s.prev[str & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = str, str++, s.insert--, s.lookahead + s.insert < MIN_MATCH)\n break;\n }\n } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);\n }\n function deflate_stored(s, flush) {\n var max_block_size = 65535;\n if (max_block_size > s.pending_buf_size - 5)\n max_block_size = s.pending_buf_size - 5;\n for (;; ) {\n if (s.lookahead <= 1) {\n if (fill_window(s), s.lookahead === 0 && flush === Z_NO_FLUSH)\n return BS_NEED_MORE;\n if (s.lookahead === 0)\n break;\n }\n s.strstart += s.lookahead, s.lookahead = 0;\n var max_start = s.block_start + max_block_size;\n if (s.strstart === 0 || s.strstart >= max_start) {\n if (s.lookahead = s.strstart - max_start, s.strstart = max_start, flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n if (s.strstart - s.block_start >= s.w_size - MIN_LOOKAHEAD) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n }\n if (s.insert = 0, flush === Z_FINISH) {\n if (flush_block_only(s, !0), s.strm.avail_out === 0)\n return BS_FINISH_STARTED;\n return BS_FINISH_DONE;\n }\n if (s.strstart > s.block_start) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n return BS_NEED_MORE;\n }\n function deflate_fast(s, flush) {\n var hash_head, bflush;\n for (;; ) {\n if (s.lookahead < MIN_LOOKAHEAD) {\n if (fill_window(s), s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH)\n return BS_NEED_MORE;\n if (s.lookahead === 0)\n break;\n }\n if (hash_head = 0, s.lookahead >= MIN_MATCH)\n s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask, hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = s.strstart;\n if (hash_head !== 0 && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD)\n s.match_length = longest_match(s, hash_head);\n if (s.match_length >= MIN_MATCH)\n if (bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH), s.lookahead -= s.match_length, s.match_length <= s.max_lazy_match && s.lookahead >= MIN_MATCH) {\n s.match_length--;\n do\n s.strstart++, s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask, hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = s.strstart;\n while (--s.match_length !== 0);\n s.strstart++;\n } else\n s.strstart += s.match_length, s.match_length = 0, s.ins_h = s.window[s.strstart], s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + 1]) & s.hash_mask;\n else\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]), s.lookahead--, s.strstart++;\n if (bflush) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n }\n if (s.insert = s.strstart < MIN_MATCH - 1 \? s.strstart : MIN_MATCH - 1, flush === Z_FINISH) {\n if (flush_block_only(s, !0), s.strm.avail_out === 0)\n return BS_FINISH_STARTED;\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n return BS_BLOCK_DONE;\n }\n function deflate_slow(s, flush) {\n var hash_head, bflush, max_insert;\n for (;; ) {\n if (s.lookahead < MIN_LOOKAHEAD) {\n if (fill_window(s), s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH)\n return BS_NEED_MORE;\n if (s.lookahead === 0)\n break;\n }\n if (hash_head = 0, s.lookahead >= MIN_MATCH)\n s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask, hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = s.strstart;\n if (s.prev_length = s.match_length, s.prev_match = s.match_start, s.match_length = MIN_MATCH - 1, hash_head !== 0 && s.prev_length < s.max_lazy_match && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD) {\n if (s.match_length = longest_match(s, hash_head), s.match_length <= 5 && (s.strategy === Z_FILTERED || s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096))\n s.match_length = MIN_MATCH - 1;\n }\n if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {\n max_insert = s.strstart + s.lookahead - MIN_MATCH, bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH), s.lookahead -= s.prev_length - 1, s.prev_length -= 2;\n do\n if (++s.strstart <= max_insert)\n s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask, hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = s.strstart;\n while (--s.prev_length !== 0);\n if (s.match_available = 0, s.match_length = MIN_MATCH - 1, s.strstart++, bflush) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n } else if (s.match_available) {\n if (bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]), bflush)\n flush_block_only(s, !1);\n if (s.strstart++, s.lookahead--, s.strm.avail_out === 0)\n return BS_NEED_MORE;\n } else\n s.match_available = 1, s.strstart++, s.lookahead--;\n }\n if (s.match_available)\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]), s.match_available = 0;\n if (s.insert = s.strstart < MIN_MATCH - 1 \? s.strstart : MIN_MATCH - 1, flush === Z_FINISH) {\n if (flush_block_only(s, !0), s.strm.avail_out === 0)\n return BS_FINISH_STARTED;\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n return BS_BLOCK_DONE;\n }\n function deflate_rle(s, flush) {\n var bflush, prev, scan, strend, _win = s.window;\n for (;; ) {\n if (s.lookahead <= MAX_MATCH) {\n if (fill_window(s), s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH)\n return BS_NEED_MORE;\n if (s.lookahead === 0)\n break;\n }\n if (s.match_length = 0, s.lookahead >= MIN_MATCH && s.strstart > 0) {\n if (scan = s.strstart - 1, prev = _win[scan], prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {\n strend = s.strstart + MAX_MATCH;\n do\n ;\n while (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && scan < strend);\n if (s.match_length = MAX_MATCH - (strend - scan), s.match_length > s.lookahead)\n s.match_length = s.lookahead;\n }\n }\n if (s.match_length >= MIN_MATCH)\n bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH), s.lookahead -= s.match_length, s.strstart += s.match_length, s.match_length = 0;\n else\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]), s.lookahead--, s.strstart++;\n if (bflush) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n }\n if (s.insert = 0, flush === Z_FINISH) {\n if (flush_block_only(s, !0), s.strm.avail_out === 0)\n return BS_FINISH_STARTED;\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n return BS_BLOCK_DONE;\n }\n function deflate_huff(s, flush) {\n var bflush;\n for (;; ) {\n if (s.lookahead === 0) {\n if (fill_window(s), s.lookahead === 0) {\n if (flush === Z_NO_FLUSH)\n return BS_NEED_MORE;\n break;\n }\n }\n if (s.match_length = 0, bflush = trees._tr_tally(s, 0, s.window[s.strstart]), s.lookahead--, s.strstart++, bflush) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n }\n if (s.insert = 0, flush === Z_FINISH) {\n if (flush_block_only(s, !0), s.strm.avail_out === 0)\n return BS_FINISH_STARTED;\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n return BS_BLOCK_DONE;\n }\n function Config(good_length, max_lazy, nice_length, max_chain, func) {\n this.good_length = good_length, this.max_lazy = max_lazy, this.nice_length = nice_length, this.max_chain = max_chain, this.func = func;\n }\n var configuration_table = [\n new Config(0, 0, 0, 0, deflate_stored),\n new Config(4, 4, 8, 4, deflate_fast),\n new Config(4, 5, 16, 8, deflate_fast),\n new Config(4, 6, 32, 32, deflate_fast),\n new Config(4, 4, 16, 16, deflate_slow),\n new Config(8, 16, 32, 32, deflate_slow),\n new Config(8, 16, 128, 128, deflate_slow),\n new Config(8, 32, 128, 256, deflate_slow),\n new Config(32, 128, 258, 1024, deflate_slow),\n new Config(32, 258, 258, 4096, deflate_slow)\n ];\n function lm_init(s) {\n s.window_size = 2 * s.w_size, zero(s.head), s.max_lazy_match = configuration_table[s.level].max_lazy, s.good_match = configuration_table[s.level].good_length, s.nice_match = configuration_table[s.level].nice_length, s.max_chain_length = configuration_table[s.level].max_chain, s.strstart = 0, s.block_start = 0, s.lookahead = 0, s.insert = 0, s.match_length = s.prev_length = MIN_MATCH - 1, s.match_available = 0, s.ins_h = 0;\n }\n function DeflateState() {\n this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = Z_DEFLATED, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2), this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2), this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2), zero(this.dyn_ltree), zero(this.dyn_dtree), zero(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new utils.Buf16(MAX_BITS + 1), this.heap = new utils.Buf16(2 * L_CODES + 1), zero(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new utils.Buf16(2 * L_CODES + 1), zero(this.depth), this.l_buf = 0, this.lit_bufsize = 0, this.last_lit = 0, this.d_buf = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0;\n }\n function deflateResetKeep(strm) {\n var s;\n if (!strm || !strm.state)\n return err(strm, Z_STREAM_ERROR);\n if (strm.total_in = strm.total_out = 0, strm.data_type = Z_UNKNOWN, s = strm.state, s.pending = 0, s.pending_out = 0, s.wrap < 0)\n s.wrap = -s.wrap;\n return s.status = s.wrap \? INIT_STATE : BUSY_STATE, strm.adler = s.wrap === 2 \? 0 : 1, s.last_flush = Z_NO_FLUSH, trees._tr_init(s), Z_OK;\n }\n function deflateReset(strm) {\n var ret = deflateResetKeep(strm);\n if (ret === Z_OK)\n lm_init(strm.state);\n return ret;\n }\n function deflateSetHeader(strm, head) {\n if (!strm || !strm.state)\n return Z_STREAM_ERROR;\n if (strm.state.wrap !== 2)\n return Z_STREAM_ERROR;\n return strm.state.gzhead = head, Z_OK;\n }\n function deflateInit2(strm, level, method, windowBits, memLevel, strategy) {\n if (!strm)\n return Z_STREAM_ERROR;\n var wrap = 1;\n if (level === Z_DEFAULT_COMPRESSION)\n level = 6;\n if (windowBits < 0)\n wrap = 0, windowBits = -windowBits;\n else if (windowBits > 15)\n wrap = 2, windowBits -= 16;\n if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED)\n return err(strm, Z_STREAM_ERROR);\n if (windowBits === 8)\n windowBits = 9;\n var s = new DeflateState;\n return strm.state = s, s.strm = strm, s.wrap = wrap, s.gzhead = null, s.w_bits = windowBits, s.w_size = 1 << s.w_bits, s.w_mask = s.w_size - 1, s.hash_bits = memLevel + 7, s.hash_size = 1 << s.hash_bits, s.hash_mask = s.hash_size - 1, s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH), s.window = new utils.Buf8(s.w_size * 2), s.head = new utils.Buf16(s.hash_size), s.prev = new utils.Buf16(s.w_size), s.lit_bufsize = 1 << memLevel + 6, s.pending_buf_size = s.lit_bufsize * 4, s.pending_buf = new utils.Buf8(s.pending_buf_size), s.d_buf = 1 * s.lit_bufsize, s.l_buf = 3 * s.lit_bufsize, s.level = level, s.strategy = strategy, s.method = method, deflateReset(strm);\n }\n function deflateInit(strm, level) {\n return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);\n }\n function deflate(strm, flush) {\n var old_flush, s, beg, val;\n if (!strm || !strm.state || flush > Z_BLOCK || flush < 0)\n return strm \? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;\n if (s = strm.state, !strm.output || !strm.input && strm.avail_in !== 0 || s.status === FINISH_STATE && flush !== Z_FINISH)\n return err(strm, strm.avail_out === 0 \? Z_BUF_ERROR : Z_STREAM_ERROR);\n if (s.strm = strm, old_flush = s.last_flush, s.last_flush = flush, s.status === INIT_STATE)\n if (s.wrap === 2)\n if (strm.adler = 0, put_byte(s, 31), put_byte(s, 139), put_byte(s, 8), !s.gzhead)\n put_byte(s, 0), put_byte(s, 0), put_byte(s, 0), put_byte(s, 0), put_byte(s, 0), put_byte(s, s.level === 9 \? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 \? 4 : 0), put_byte(s, OS_CODE), s.status = BUSY_STATE;\n else {\n if (put_byte(s, (s.gzhead.text \? 1 : 0) + (s.gzhead.hcrc \? 2 : 0) + (!s.gzhead.extra \? 0 : 4) + (!s.gzhead.name \? 0 : 8) + (!s.gzhead.comment \? 0 : 16)), put_byte(s, s.gzhead.time & 255), put_byte(s, s.gzhead.time >> 8 & 255), put_byte(s, s.gzhead.time >> 16 & 255), put_byte(s, s.gzhead.time >> 24 & 255), put_byte(s, s.level === 9 \? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 \? 4 : 0), put_byte(s, s.gzhead.os & 255), s.gzhead.extra && s.gzhead.extra.length)\n put_byte(s, s.gzhead.extra.length & 255), put_byte(s, s.gzhead.extra.length >> 8 & 255);\n if (s.gzhead.hcrc)\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);\n s.gzindex = 0, s.status = EXTRA_STATE;\n }\n else {\n var header = Z_DEFLATED + (s.w_bits - 8 << 4) << 8, level_flags = -1;\n if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2)\n level_flags = 0;\n else if (s.level < 6)\n level_flags = 1;\n else if (s.level === 6)\n level_flags = 2;\n else\n level_flags = 3;\n if (header |= level_flags << 6, s.strstart !== 0)\n header |= PRESET_DICT;\n if (header += 31 - header % 31, s.status = BUSY_STATE, putShortMSB(s, header), s.strstart !== 0)\n putShortMSB(s, strm.adler >>> 16), putShortMSB(s, strm.adler & 65535);\n strm.adler = 1;\n }\n if (s.status === EXTRA_STATE)\n if (s.gzhead.extra) {\n beg = s.pending;\n while (s.gzindex < (s.gzhead.extra.length & 65535)) {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg)\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n if (flush_pending(strm), beg = s.pending, s.pending === s.pending_buf_size)\n break;\n }\n put_byte(s, s.gzhead.extra[s.gzindex] & 255), s.gzindex++;\n }\n if (s.gzhead.hcrc && s.pending > beg)\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n if (s.gzindex === s.gzhead.extra.length)\n s.gzindex = 0, s.status = NAME_STATE;\n } else\n s.status = NAME_STATE;\n if (s.status === NAME_STATE)\n if (s.gzhead.name) {\n beg = s.pending;\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg)\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n if (flush_pending(strm), beg = s.pending, s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n if (s.gzindex < s.gzhead.name.length)\n val = s.gzhead.name.charCodeAt(s.gzindex++) & 255;\n else\n val = 0;\n put_byte(s, val);\n } while (val !== 0);\n if (s.gzhead.hcrc && s.pending > beg)\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n if (val === 0)\n s.gzindex = 0, s.status = COMMENT_STATE;\n } else\n s.status = COMMENT_STATE;\n if (s.status === COMMENT_STATE)\n if (s.gzhead.comment) {\n beg = s.pending;\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg)\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n if (flush_pending(strm), beg = s.pending, s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n if (s.gzindex < s.gzhead.comment.length)\n val = s.gzhead.comment.charCodeAt(s.gzindex++) & 255;\n else\n val = 0;\n put_byte(s, val);\n } while (val !== 0);\n if (s.gzhead.hcrc && s.pending > beg)\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n if (val === 0)\n s.status = HCRC_STATE;\n } else\n s.status = HCRC_STATE;\n if (s.status === HCRC_STATE)\n if (s.gzhead.hcrc) {\n if (s.pending + 2 > s.pending_buf_size)\n flush_pending(strm);\n if (s.pending + 2 <= s.pending_buf_size)\n put_byte(s, strm.adler & 255), put_byte(s, strm.adler >> 8 & 255), strm.adler = 0, s.status = BUSY_STATE;\n } else\n s.status = BUSY_STATE;\n if (s.pending !== 0) {\n if (flush_pending(strm), strm.avail_out === 0)\n return s.last_flush = -1, Z_OK;\n } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && flush !== Z_FINISH)\n return err(strm, Z_BUF_ERROR);\n if (s.status === FINISH_STATE && strm.avail_in !== 0)\n return err(strm, Z_BUF_ERROR);\n if (strm.avail_in !== 0 || s.lookahead !== 0 || flush !== Z_NO_FLUSH && s.status !== FINISH_STATE) {\n var bstate = s.strategy === Z_HUFFMAN_ONLY \? deflate_huff(s, flush) : s.strategy === Z_RLE \? deflate_rle(s, flush) : configuration_table[s.level].func(s, flush);\n if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE)\n s.status = FINISH_STATE;\n if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {\n if (strm.avail_out === 0)\n s.last_flush = -1;\n return Z_OK;\n }\n if (bstate === BS_BLOCK_DONE) {\n if (flush === Z_PARTIAL_FLUSH)\n trees._tr_align(s);\n else if (flush !== Z_BLOCK) {\n if (trees._tr_stored_block(s, 0, 0, !1), flush === Z_FULL_FLUSH) {\n if (zero(s.head), s.lookahead === 0)\n s.strstart = 0, s.block_start = 0, s.insert = 0;\n }\n }\n if (flush_pending(strm), strm.avail_out === 0)\n return s.last_flush = -1, Z_OK;\n }\n }\n if (flush !== Z_FINISH)\n return Z_OK;\n if (s.wrap <= 0)\n return Z_STREAM_END;\n if (s.wrap === 2)\n put_byte(s, strm.adler & 255), put_byte(s, strm.adler >> 8 & 255), put_byte(s, strm.adler >> 16 & 255), put_byte(s, strm.adler >> 24 & 255), put_byte(s, strm.total_in & 255), put_byte(s, strm.total_in >> 8 & 255), put_byte(s, strm.total_in >> 16 & 255), put_byte(s, strm.total_in >> 24 & 255);\n else\n putShortMSB(s, strm.adler >>> 16), putShortMSB(s, strm.adler & 65535);\n if (flush_pending(strm), s.wrap > 0)\n s.wrap = -s.wrap;\n return s.pending !== 0 \? Z_OK : Z_STREAM_END;\n }\n function deflateEnd(strm) {\n var status;\n if (!strm || !strm.state)\n return Z_STREAM_ERROR;\n if (status = strm.state.status, status !== INIT_STATE && status !== EXTRA_STATE && status !== NAME_STATE && status !== COMMENT_STATE && status !== HCRC_STATE && status !== BUSY_STATE && status !== FINISH_STATE)\n return err(strm, Z_STREAM_ERROR);\n return strm.state = null, status === BUSY_STATE \? err(strm, Z_DATA_ERROR) : Z_OK;\n }\n function deflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length, s, str, n, wrap, avail, next, input, tmpDict;\n if (!strm || !strm.state)\n return Z_STREAM_ERROR;\n if (s = strm.state, wrap = s.wrap, wrap === 2 || wrap === 1 && s.status !== INIT_STATE || s.lookahead)\n return Z_STREAM_ERROR;\n if (wrap === 1)\n strm.adler = adler32(strm.adler, dictionary, dictLength, 0);\n if (s.wrap = 0, dictLength >= s.w_size) {\n if (wrap === 0)\n zero(s.head), s.strstart = 0, s.block_start = 0, s.insert = 0;\n tmpDict = new utils.Buf8(s.w_size), utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0), dictionary = tmpDict, dictLength = s.w_size;\n }\n avail = strm.avail_in, next = strm.next_in, input = strm.input, strm.avail_in = dictLength, strm.next_in = 0, strm.input = dictionary, fill_window(s);\n while (s.lookahead >= MIN_MATCH) {\n str = s.strstart, n = s.lookahead - (MIN_MATCH - 1);\n do\n s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask, s.prev[str & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = str, str++;\n while (--n);\n s.strstart = str, s.lookahead = MIN_MATCH - 1, fill_window(s);\n }\n return s.strstart += s.lookahead, s.block_start = s.strstart, s.insert = s.lookahead, s.lookahead = 0, s.match_length = s.prev_length = MIN_MATCH - 1, s.match_available = 0, strm.next_in = next, strm.input = input, strm.avail_in = avail, s.wrap = wrap, Z_OK;\n }\n exports.deflateInit = deflateInit, exports.deflateInit2 = deflateInit2, exports.deflateReset = deflateReset, exports.deflateResetKeep = deflateResetKeep, exports.deflateSetHeader = deflateSetHeader, exports.deflate = deflate, exports.deflateEnd = deflateEnd, exports.deflateSetDictionary = deflateSetDictionary, exports.deflateInfo = \"pako deflate (from Nodeca project)\";\n }\n}), require_inffast = __commonJS({\n \"node_modules/pako/lib/zlib/inffast.js\"(exports, module2) {\n var BAD = 30, TYPE = 12;\n module2.exports = function inflate_fast(strm, start) {\n var state, _in, last, _out, beg, end, dmax, wsize, whave, wnext, s_window, hold, bits, lcode, dcode, lmask, dmask, here, op, len, dist, from, from_source, input, output;\n state = strm.state, _in = strm.next_in, input = strm.input, last = _in + (strm.avail_in - 5), _out = strm.next_out, output = strm.output, beg = _out - (start - strm.avail_out), end = _out + (strm.avail_out - 257), dmax = state.dmax, wsize = state.wsize, whave = state.whave, wnext = state.wnext, s_window = state.window, hold = state.hold, bits = state.bits, lcode = state.lencode, dcode = state.distcode, lmask = (1 << state.lenbits) - 1, dmask = (1 << state.distbits) - 1;\n top:\n do {\n if (bits < 15)\n hold += input[_in++] << bits, bits += 8, hold += input[_in++] << bits, bits += 8;\n here = lcode[hold & lmask];\n dolen:\n for (;; ) {\n if (op = here >>> 24, hold >>>= op, bits -= op, op = here >>> 16 & 255, op === 0)\n output[_out++] = here & 65535;\n else if (op & 16) {\n if (len = here & 65535, op &= 15, op) {\n if (bits < op)\n hold += input[_in++] << bits, bits += 8;\n len += hold & (1 << op) - 1, hold >>>= op, bits -= op;\n }\n if (bits < 15)\n hold += input[_in++] << bits, bits += 8, hold += input[_in++] << bits, bits += 8;\n here = dcode[hold & dmask];\n dodist:\n for (;; ) {\n if (op = here >>> 24, hold >>>= op, bits -= op, op = here >>> 16 & 255, op & 16) {\n if (dist = here & 65535, op &= 15, bits < op) {\n if (hold += input[_in++] << bits, bits += 8, bits < op)\n hold += input[_in++] << bits, bits += 8;\n }\n if (dist += hold & (1 << op) - 1, dist > dmax) {\n strm.msg = \"invalid distance too far back\", state.mode = BAD;\n break top;\n }\n if (hold >>>= op, bits -= op, op = _out - beg, dist > op) {\n if (op = dist - op, op > whave) {\n if (state.sane) {\n strm.msg = \"invalid distance too far back\", state.mode = BAD;\n break top;\n }\n }\n if (from = 0, from_source = s_window, wnext === 0) {\n if (from += wsize - op, op < len) {\n len -= op;\n do\n output[_out++] = s_window[from++];\n while (--op);\n from = _out - dist, from_source = output;\n }\n } else if (wnext < op) {\n if (from += wsize + wnext - op, op -= wnext, op < len) {\n len -= op;\n do\n output[_out++] = s_window[from++];\n while (--op);\n if (from = 0, wnext < len) {\n op = wnext, len -= op;\n do\n output[_out++] = s_window[from++];\n while (--op);\n from = _out - dist, from_source = output;\n }\n }\n } else if (from += wnext - op, op < len) {\n len -= op;\n do\n output[_out++] = s_window[from++];\n while (--op);\n from = _out - dist, from_source = output;\n }\n while (len > 2)\n output[_out++] = from_source[from++], output[_out++] = from_source[from++], output[_out++] = from_source[from++], len -= 3;\n if (len) {\n if (output[_out++] = from_source[from++], len > 1)\n output[_out++] = from_source[from++];\n }\n } else {\n from = _out - dist;\n do\n output[_out++] = output[from++], output[_out++] = output[from++], output[_out++] = output[from++], len -= 3;\n while (len > 2);\n if (len) {\n if (output[_out++] = output[from++], len > 1)\n output[_out++] = output[from++];\n }\n }\n } else if ((op & 64) === 0) {\n here = dcode[(here & 65535) + (hold & (1 << op) - 1)];\n continue dodist;\n } else {\n strm.msg = \"invalid distance code\", state.mode = BAD;\n break top;\n }\n break;\n }\n } else if ((op & 64) === 0) {\n here = lcode[(here & 65535) + (hold & (1 << op) - 1)];\n continue dolen;\n } else if (op & 32) {\n state.mode = TYPE;\n break top;\n } else {\n strm.msg = \"invalid literal/length code\", state.mode = BAD;\n break top;\n }\n break;\n }\n } while (_in < last && _out < end);\n len = bits >> 3, _in -= len, bits -= len << 3, hold &= (1 << bits) - 1, strm.next_in = _in, strm.next_out = _out, strm.avail_in = _in < last \? 5 + (last - _in) : 5 - (_in - last), strm.avail_out = _out < end \? 257 + (end - _out) : 257 - (_out - end), state.hold = hold, state.bits = bits;\n return;\n };\n }\n}), require_inftrees = __commonJS({\n \"node_modules/pako/lib/zlib/inftrees.js\"(exports, module2) {\n var utils = require_common(), MAXBITS = 15, ENOUGH_LENS = 852, ENOUGH_DISTS = 592, CODES = 0, LENS = 1, DISTS = 2, lbase = [\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 13,\n 15,\n 17,\n 19,\n 23,\n 27,\n 31,\n 35,\n 43,\n 51,\n 59,\n 67,\n 83,\n 99,\n 115,\n 131,\n 163,\n 195,\n 227,\n 258,\n 0,\n 0\n ], lext = [\n 16,\n 16,\n 16,\n 16,\n 16,\n 16,\n 16,\n 16,\n 17,\n 17,\n 17,\n 17,\n 18,\n 18,\n 18,\n 18,\n 19,\n 19,\n 19,\n 19,\n 20,\n 20,\n 20,\n 20,\n 21,\n 21,\n 21,\n 21,\n 16,\n 72,\n 78\n ], dbase = [\n 1,\n 2,\n 3,\n 4,\n 5,\n 7,\n 9,\n 13,\n 17,\n 25,\n 33,\n 49,\n 65,\n 97,\n 129,\n 193,\n 257,\n 385,\n 513,\n 769,\n 1025,\n 1537,\n 2049,\n 3073,\n 4097,\n 6145,\n 8193,\n 12289,\n 16385,\n 24577,\n 0,\n 0\n ], dext = [\n 16,\n 16,\n 16,\n 16,\n 17,\n 17,\n 18,\n 18,\n 19,\n 19,\n 20,\n 20,\n 21,\n 21,\n 22,\n 22,\n 23,\n 23,\n 24,\n 24,\n 25,\n 25,\n 26,\n 26,\n 27,\n 27,\n 28,\n 28,\n 29,\n 29,\n 64,\n 64\n ];\n module2.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) {\n var bits = opts.bits, len = 0, sym = 0, min = 0, max = 0, root = 0, curr = 0, drop = 0, left = 0, used = 0, huff = 0, incr, fill, low, mask, next, base = null, base_index = 0, end, count = new utils.Buf16(MAXBITS + 1), offs = new utils.Buf16(MAXBITS + 1), extra = null, extra_index = 0, here_bits, here_op, here_val;\n for (len = 0;len <= MAXBITS; len++)\n count[len] = 0;\n for (sym = 0;sym < codes; sym++)\n count[lens[lens_index + sym]]++;\n root = bits;\n for (max = MAXBITS;max >= 1; max--)\n if (count[max] !== 0)\n break;\n if (root > max)\n root = max;\n if (max === 0)\n return table[table_index++] = 1 << 24 | 64 << 16 | 0, table[table_index++] = 1 << 24 | 64 << 16 | 0, opts.bits = 1, 0;\n for (min = 1;min < max; min++)\n if (count[min] !== 0)\n break;\n if (root < min)\n root = min;\n left = 1;\n for (len = 1;len <= MAXBITS; len++)\n if (left <<= 1, left -= count[len], left < 0)\n return -1;\n if (left > 0 && (type === CODES || max !== 1))\n return -1;\n offs[1] = 0;\n for (len = 1;len < MAXBITS; len++)\n offs[len + 1] = offs[len] + count[len];\n for (sym = 0;sym < codes; sym++)\n if (lens[lens_index + sym] !== 0)\n work[offs[lens[lens_index + sym]]++] = sym;\n if (type === CODES)\n base = extra = work, end = 19;\n else if (type === LENS)\n base = lbase, base_index -= 257, extra = lext, extra_index -= 257, end = 256;\n else\n base = dbase, extra = dext, end = -1;\n if (huff = 0, sym = 0, len = min, next = table_index, curr = root, drop = 0, low = -1, used = 1 << root, mask = used - 1, type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS)\n return 1;\n for (;; ) {\n if (here_bits = len - drop, work[sym] < end)\n here_op = 0, here_val = work[sym];\n else if (work[sym] > end)\n here_op = extra[extra_index + work[sym]], here_val = base[base_index + work[sym]];\n else\n here_op = 96, here_val = 0;\n incr = 1 << len - drop, fill = 1 << curr, min = fill;\n do\n fill -= incr, table[next + (huff >> drop) + fill] = here_bits << 24 | here_op << 16 | here_val | 0;\n while (fill !== 0);\n incr = 1 << len - 1;\n while (huff & incr)\n incr >>= 1;\n if (incr !== 0)\n huff &= incr - 1, huff += incr;\n else\n huff = 0;\n if (sym++, --count[len] === 0) {\n if (len === max)\n break;\n len = lens[lens_index + work[sym]];\n }\n if (len > root && (huff & mask) !== low) {\n if (drop === 0)\n drop = root;\n next += min, curr = len - drop, left = 1 << curr;\n while (curr + drop < max) {\n if (left -= count[curr + drop], left <= 0)\n break;\n curr++, left <<= 1;\n }\n if (used += 1 << curr, type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS)\n return 1;\n low = huff & mask, table[low] = root << 24 | curr << 16 | next - table_index | 0;\n }\n }\n if (huff !== 0)\n table[next + huff] = len - drop << 24 | 64 << 16 | 0;\n return opts.bits = root, 0;\n };\n }\n}), require_inflate = __commonJS({\n \"node_modules/pako/lib/zlib/inflate.js\"(exports) {\n var utils = require_common(), adler32 = require_adler32(), crc32 = require_crc32(), inflate_fast = require_inffast(), inflate_table = require_inftrees(), CODES = 0, LENS = 1, DISTS = 2, Z_FINISH = 4, Z_BLOCK = 5, Z_TREES = 6, Z_OK = 0, Z_STREAM_END = 1, Z_NEED_DICT = 2, Z_STREAM_ERROR = -2, Z_DATA_ERROR = -3, Z_MEM_ERROR = -4, Z_BUF_ERROR = -5, Z_DEFLATED = 8, HEAD = 1, FLAGS = 2, TIME = 3, OS = 4, EXLEN = 5, EXTRA = 6, NAME = 7, COMMENT = 8, HCRC = 9, DICTID = 10, DICT = 11, TYPE = 12, TYPEDO = 13, STORED = 14, COPY_ = 15, COPY = 16, TABLE = 17, LENLENS = 18, CODELENS = 19, LEN_ = 20, LEN = 21, LENEXT = 22, DIST = 23, DISTEXT = 24, MATCH = 25, LIT = 26, CHECK = 27, LENGTH = 28, DONE = 29, BAD = 30, MEM = 31, SYNC = 32, ENOUGH_LENS = 852, ENOUGH_DISTS = 592, MAX_WBITS = 15, DEF_WBITS = MAX_WBITS;\n function zswap32(q) {\n return (q >>> 24 & 255) + (q >>> 8 & 65280) + ((q & 65280) << 8) + ((q & 255) << 24);\n }\n function InflateState() {\n this.mode = 0, this.last = !1, this.wrap = 0, this.havedict = !1, this.flags = 0, this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0, this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0, this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null, this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0, this.ndist = 0, this.have = 0, this.next = null, this.lens = new utils.Buf16(320), this.work = new utils.Buf16(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0;\n }\n function inflateResetKeep(strm) {\n var state;\n if (!strm || !strm.state)\n return Z_STREAM_ERROR;\n if (state = strm.state, strm.total_in = strm.total_out = state.total = 0, strm.msg = \"\", state.wrap)\n strm.adler = state.wrap & 1;\n return state.mode = HEAD, state.last = 0, state.havedict = 0, state.dmax = 32768, state.head = null, state.hold = 0, state.bits = 0, state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS), state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS), state.sane = 1, state.back = -1, Z_OK;\n }\n function inflateReset(strm) {\n var state;\n if (!strm || !strm.state)\n return Z_STREAM_ERROR;\n return state = strm.state, state.wsize = 0, state.whave = 0, state.wnext = 0, inflateResetKeep(strm);\n }\n function inflateReset2(strm, windowBits) {\n var wrap, state;\n if (!strm || !strm.state)\n return Z_STREAM_ERROR;\n if (state = strm.state, windowBits < 0)\n wrap = 0, windowBits = -windowBits;\n else if (wrap = (windowBits >> 4) + 1, windowBits < 48)\n windowBits &= 15;\n if (windowBits && (windowBits < 8 || windowBits > 15))\n return Z_STREAM_ERROR;\n if (state.window !== null && state.wbits !== windowBits)\n state.window = null;\n return state.wrap = wrap, state.wbits = windowBits, inflateReset(strm);\n }\n function inflateInit2(strm, windowBits) {\n var ret, state;\n if (!strm)\n return Z_STREAM_ERROR;\n if (state = new InflateState, strm.state = state, state.window = null, ret = inflateReset2(strm, windowBits), ret !== Z_OK)\n strm.state = null;\n return ret;\n }\n function inflateInit(strm) {\n return inflateInit2(strm, DEF_WBITS);\n }\n var virgin = !0, lenfix, distfix;\n function fixedtables(state) {\n if (virgin) {\n var sym;\n lenfix = new utils.Buf32(512), distfix = new utils.Buf32(32), sym = 0;\n while (sym < 144)\n state.lens[sym++] = 8;\n while (sym < 256)\n state.lens[sym++] = 9;\n while (sym < 280)\n state.lens[sym++] = 7;\n while (sym < 288)\n state.lens[sym++] = 8;\n inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, {\n bits: 9\n }), sym = 0;\n while (sym < 32)\n state.lens[sym++] = 5;\n inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, {\n bits: 5\n }), virgin = !1;\n }\n state.lencode = lenfix, state.lenbits = 9, state.distcode = distfix, state.distbits = 5;\n }\n function updatewindow(strm, src, end, copy) {\n var dist, state = strm.state;\n if (state.window === null)\n state.wsize = 1 << state.wbits, state.wnext = 0, state.whave = 0, state.window = new utils.Buf8(state.wsize);\n if (copy >= state.wsize)\n utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0), state.wnext = 0, state.whave = state.wsize;\n else {\n if (dist = state.wsize - state.wnext, dist > copy)\n dist = copy;\n if (utils.arraySet(state.window, src, end - copy, dist, state.wnext), copy -= dist, copy)\n utils.arraySet(state.window, src, end - copy, copy, 0), state.wnext = copy, state.whave = state.wsize;\n else {\n if (state.wnext += dist, state.wnext === state.wsize)\n state.wnext = 0;\n if (state.whave < state.wsize)\n state.whave += dist;\n }\n }\n return 0;\n }\n function inflate(strm, flush) {\n var state, input, output, next, put, have, left, hold, bits, _in, _out, copy, from, from_source, here = 0, here_bits, here_op, here_val, last_bits, last_op, last_val, len, ret, hbuf = new utils.Buf8(4), opts, n, order = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];\n if (!strm || !strm.state || !strm.output || !strm.input && strm.avail_in !== 0)\n return Z_STREAM_ERROR;\n if (state = strm.state, state.mode === TYPE)\n state.mode = TYPEDO;\n put = strm.next_out, output = strm.output, left = strm.avail_out, next = strm.next_in, input = strm.input, have = strm.avail_in, hold = state.hold, bits = state.bits, _in = have, _out = left, ret = Z_OK;\n inf_leave:\n for (;; )\n switch (state.mode) {\n case HEAD:\n if (state.wrap === 0) {\n state.mode = TYPEDO;\n break;\n }\n while (bits < 16) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (state.wrap & 2 && hold === 35615) {\n state.check = 0, hbuf[0] = hold & 255, hbuf[1] = hold >>> 8 & 255, state.check = crc32(state.check, hbuf, 2, 0), hold = 0, bits = 0, state.mode = FLAGS;\n break;\n }\n if (state.flags = 0, state.head)\n state.head.done = !1;\n if (!(state.wrap & 1) || (((hold & 255) << 8) + (hold >> 8)) % 31) {\n strm.msg = \"incorrect header check\", state.mode = BAD;\n break;\n }\n if ((hold & 15) !== Z_DEFLATED) {\n strm.msg = \"unknown compression method\", state.mode = BAD;\n break;\n }\n if (hold >>>= 4, bits -= 4, len = (hold & 15) + 8, state.wbits === 0)\n state.wbits = len;\n else if (len > state.wbits) {\n strm.msg = \"invalid window size\", state.mode = BAD;\n break;\n }\n state.dmax = 1 << len, strm.adler = state.check = 1, state.mode = hold & 512 \? DICTID : TYPE, hold = 0, bits = 0;\n break;\n case FLAGS:\n while (bits < 16) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (state.flags = hold, (state.flags & 255) !== Z_DEFLATED) {\n strm.msg = \"unknown compression method\", state.mode = BAD;\n break;\n }\n if (state.flags & 57344) {\n strm.msg = \"unknown header flags set\", state.mode = BAD;\n break;\n }\n if (state.head)\n state.head.text = hold >> 8 & 1;\n if (state.flags & 512)\n hbuf[0] = hold & 255, hbuf[1] = hold >>> 8 & 255, state.check = crc32(state.check, hbuf, 2, 0);\n hold = 0, bits = 0, state.mode = TIME;\n case TIME:\n while (bits < 32) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (state.head)\n state.head.time = hold;\n if (state.flags & 512)\n hbuf[0] = hold & 255, hbuf[1] = hold >>> 8 & 255, hbuf[2] = hold >>> 16 & 255, hbuf[3] = hold >>> 24 & 255, state.check = crc32(state.check, hbuf, 4, 0);\n hold = 0, bits = 0, state.mode = OS;\n case OS:\n while (bits < 16) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (state.head)\n state.head.xflags = hold & 255, state.head.os = hold >> 8;\n if (state.flags & 512)\n hbuf[0] = hold & 255, hbuf[1] = hold >>> 8 & 255, state.check = crc32(state.check, hbuf, 2, 0);\n hold = 0, bits = 0, state.mode = EXLEN;\n case EXLEN:\n if (state.flags & 1024) {\n while (bits < 16) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (state.length = hold, state.head)\n state.head.extra_len = hold;\n if (state.flags & 512)\n hbuf[0] = hold & 255, hbuf[1] = hold >>> 8 & 255, state.check = crc32(state.check, hbuf, 2, 0);\n hold = 0, bits = 0;\n } else if (state.head)\n state.head.extra = null;\n state.mode = EXTRA;\n case EXTRA:\n if (state.flags & 1024) {\n if (copy = state.length, copy > have)\n copy = have;\n if (copy) {\n if (state.head) {\n if (len = state.head.extra_len - state.length, !state.head.extra)\n state.head.extra = new @Array(state.head.extra_len);\n utils.arraySet(state.head.extra, input, next, copy, len);\n }\n if (state.flags & 512)\n state.check = crc32(state.check, input, copy, next);\n have -= copy, next += copy, state.length -= copy;\n }\n if (state.length)\n break inf_leave;\n }\n state.length = 0, state.mode = NAME;\n case NAME:\n if (state.flags & 2048) {\n if (have === 0)\n break inf_leave;\n copy = 0;\n do\n if (len = input[next + copy++], state.head && len && state.length < 65536)\n state.head.name += @String.fromCharCode(len);\n while (len && copy < have);\n if (state.flags & 512)\n state.check = crc32(state.check, input, copy, next);\n if (have -= copy, next += copy, len)\n break inf_leave;\n } else if (state.head)\n state.head.name = null;\n state.length = 0, state.mode = COMMENT;\n case COMMENT:\n if (state.flags & 4096) {\n if (have === 0)\n break inf_leave;\n copy = 0;\n do\n if (len = input[next + copy++], state.head && len && state.length < 65536)\n state.head.comment += @String.fromCharCode(len);\n while (len && copy < have);\n if (state.flags & 512)\n state.check = crc32(state.check, input, copy, next);\n if (have -= copy, next += copy, len)\n break inf_leave;\n } else if (state.head)\n state.head.comment = null;\n state.mode = HCRC;\n case HCRC:\n if (state.flags & 512) {\n while (bits < 16) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (hold !== (state.check & 65535)) {\n strm.msg = \"header crc mismatch\", state.mode = BAD;\n break;\n }\n hold = 0, bits = 0;\n }\n if (state.head)\n state.head.hcrc = state.flags >> 9 & 1, state.head.done = !0;\n strm.adler = state.check = 0, state.mode = TYPE;\n break;\n case DICTID:\n while (bits < 32) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n strm.adler = state.check = zswap32(hold), hold = 0, bits = 0, state.mode = DICT;\n case DICT:\n if (state.havedict === 0)\n return strm.next_out = put, strm.avail_out = left, strm.next_in = next, strm.avail_in = have, state.hold = hold, state.bits = bits, Z_NEED_DICT;\n strm.adler = state.check = 1, state.mode = TYPE;\n case TYPE:\n if (flush === Z_BLOCK || flush === Z_TREES)\n break inf_leave;\n case TYPEDO:\n if (state.last) {\n hold >>>= bits & 7, bits -= bits & 7, state.mode = CHECK;\n break;\n }\n while (bits < 3) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n switch (state.last = hold & 1, hold >>>= 1, bits -= 1, hold & 3) {\n case 0:\n state.mode = STORED;\n break;\n case 1:\n if (fixedtables(state), state.mode = LEN_, flush === Z_TREES) {\n hold >>>= 2, bits -= 2;\n break inf_leave;\n }\n break;\n case 2:\n state.mode = TABLE;\n break;\n case 3:\n strm.msg = \"invalid block type\", state.mode = BAD;\n }\n hold >>>= 2, bits -= 2;\n break;\n case STORED:\n hold >>>= bits & 7, bits -= bits & 7;\n while (bits < 32) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if ((hold & 65535) !== (hold >>> 16 ^ 65535)) {\n strm.msg = \"invalid stored block lengths\", state.mode = BAD;\n break;\n }\n if (state.length = hold & 65535, hold = 0, bits = 0, state.mode = COPY_, flush === Z_TREES)\n break inf_leave;\n case COPY_:\n state.mode = COPY;\n case COPY:\n if (copy = state.length, copy) {\n if (copy > have)\n copy = have;\n if (copy > left)\n copy = left;\n if (copy === 0)\n break inf_leave;\n utils.arraySet(output, input, next, copy, put), have -= copy, next += copy, left -= copy, put += copy, state.length -= copy;\n break;\n }\n state.mode = TYPE;\n break;\n case TABLE:\n while (bits < 14) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (state.nlen = (hold & 31) + 257, hold >>>= 5, bits -= 5, state.ndist = (hold & 31) + 1, hold >>>= 5, bits -= 5, state.ncode = (hold & 15) + 4, hold >>>= 4, bits -= 4, state.nlen > 286 || state.ndist > 30) {\n strm.msg = \"too many length or distance symbols\", state.mode = BAD;\n break;\n }\n state.have = 0, state.mode = LENLENS;\n case LENLENS:\n while (state.have < state.ncode) {\n while (bits < 3) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n state.lens[order[state.have++]] = hold & 7, hold >>>= 3, bits -= 3;\n }\n while (state.have < 19)\n state.lens[order[state.have++]] = 0;\n if (state.lencode = state.lendyn, state.lenbits = 7, opts = { bits: state.lenbits }, ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts), state.lenbits = opts.bits, ret) {\n strm.msg = \"invalid code lengths set\", state.mode = BAD;\n break;\n }\n state.have = 0, state.mode = CODELENS;\n case CODELENS:\n while (state.have < state.nlen + state.ndist) {\n for (;; ) {\n if (here = state.lencode[hold & (1 << state.lenbits) - 1], here_bits = here >>> 24, here_op = here >>> 16 & 255, here_val = here & 65535, here_bits <= bits)\n break;\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (here_val < 16)\n hold >>>= here_bits, bits -= here_bits, state.lens[state.have++] = here_val;\n else {\n if (here_val === 16) {\n n = here_bits + 2;\n while (bits < n) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (hold >>>= here_bits, bits -= here_bits, state.have === 0) {\n strm.msg = \"invalid bit length repeat\", state.mode = BAD;\n break;\n }\n len = state.lens[state.have - 1], copy = 3 + (hold & 3), hold >>>= 2, bits -= 2;\n } else if (here_val === 17) {\n n = here_bits + 3;\n while (bits < n) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n hold >>>= here_bits, bits -= here_bits, len = 0, copy = 3 + (hold & 7), hold >>>= 3, bits -= 3;\n } else {\n n = here_bits + 7;\n while (bits < n) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n hold >>>= here_bits, bits -= here_bits, len = 0, copy = 11 + (hold & 127), hold >>>= 7, bits -= 7;\n }\n if (state.have + copy > state.nlen + state.ndist) {\n strm.msg = \"invalid bit length repeat\", state.mode = BAD;\n break;\n }\n while (copy--)\n state.lens[state.have++] = len;\n }\n }\n if (state.mode === BAD)\n break;\n if (state.lens[256] === 0) {\n strm.msg = \"invalid code -- missing end-of-block\", state.mode = BAD;\n break;\n }\n if (state.lenbits = 9, opts = { bits: state.lenbits }, ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts), state.lenbits = opts.bits, ret) {\n strm.msg = \"invalid literal/lengths set\", state.mode = BAD;\n break;\n }\n if (state.distbits = 6, state.distcode = state.distdyn, opts = { bits: state.distbits }, ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts), state.distbits = opts.bits, ret) {\n strm.msg = \"invalid distances set\", state.mode = BAD;\n break;\n }\n if (state.mode = LEN_, flush === Z_TREES)\n break inf_leave;\n case LEN_:\n state.mode = LEN;\n case LEN:\n if (have >= 6 && left >= 258) {\n if (strm.next_out = put, strm.avail_out = left, strm.next_in = next, strm.avail_in = have, state.hold = hold, state.bits = bits, inflate_fast(strm, _out), put = strm.next_out, output = strm.output, left = strm.avail_out, next = strm.next_in, input = strm.input, have = strm.avail_in, hold = state.hold, bits = state.bits, state.mode === TYPE)\n state.back = -1;\n break;\n }\n state.back = 0;\n for (;; ) {\n if (here = state.lencode[hold & (1 << state.lenbits) - 1], here_bits = here >>> 24, here_op = here >>> 16 & 255, here_val = here & 65535, here_bits <= bits)\n break;\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (here_op && (here_op & 240) === 0) {\n last_bits = here_bits, last_op = here_op, last_val = here_val;\n for (;; ) {\n if (here = state.lencode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)], here_bits = here >>> 24, here_op = here >>> 16 & 255, here_val = here & 65535, last_bits + here_bits <= bits)\n break;\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n hold >>>= last_bits, bits -= last_bits, state.back += last_bits;\n }\n if (hold >>>= here_bits, bits -= here_bits, state.back += here_bits, state.length = here_val, here_op === 0) {\n state.mode = LIT;\n break;\n }\n if (here_op & 32) {\n state.back = -1, state.mode = TYPE;\n break;\n }\n if (here_op & 64) {\n strm.msg = \"invalid literal/length code\", state.mode = BAD;\n break;\n }\n state.extra = here_op & 15, state.mode = LENEXT;\n case LENEXT:\n if (state.extra) {\n n = state.extra;\n while (bits < n) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n state.length += hold & (1 << state.extra) - 1, hold >>>= state.extra, bits -= state.extra, state.back += state.extra;\n }\n state.was = state.length, state.mode = DIST;\n case DIST:\n for (;; ) {\n if (here = state.distcode[hold & (1 << state.distbits) - 1], here_bits = here >>> 24, here_op = here >>> 16 & 255, here_val = here & 65535, here_bits <= bits)\n break;\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if ((here_op & 240) === 0) {\n last_bits = here_bits, last_op = here_op, last_val = here_val;\n for (;; ) {\n if (here = state.distcode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)], here_bits = here >>> 24, here_op = here >>> 16 & 255, here_val = here & 65535, last_bits + here_bits <= bits)\n break;\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n hold >>>= last_bits, bits -= last_bits, state.back += last_bits;\n }\n if (hold >>>= here_bits, bits -= here_bits, state.back += here_bits, here_op & 64) {\n strm.msg = \"invalid distance code\", state.mode = BAD;\n break;\n }\n state.offset = here_val, state.extra = here_op & 15, state.mode = DISTEXT;\n case DISTEXT:\n if (state.extra) {\n n = state.extra;\n while (bits < n) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n state.offset += hold & (1 << state.extra) - 1, hold >>>= state.extra, bits -= state.extra, state.back += state.extra;\n }\n if (state.offset > state.dmax) {\n strm.msg = \"invalid distance too far back\", state.mode = BAD;\n break;\n }\n state.mode = MATCH;\n case MATCH:\n if (left === 0)\n break inf_leave;\n if (copy = _out - left, state.offset > copy) {\n if (copy = state.offset - copy, copy > state.whave) {\n if (state.sane) {\n strm.msg = \"invalid distance too far back\", state.mode = BAD;\n break;\n }\n }\n if (copy > state.wnext)\n copy -= state.wnext, from = state.wsize - copy;\n else\n from = state.wnext - copy;\n if (copy > state.length)\n copy = state.length;\n from_source = state.window;\n } else\n from_source = output, from = put - state.offset, copy = state.length;\n if (copy > left)\n copy = left;\n left -= copy, state.length -= copy;\n do\n output[put++] = from_source[from++];\n while (--copy);\n if (state.length === 0)\n state.mode = LEN;\n break;\n case LIT:\n if (left === 0)\n break inf_leave;\n output[put++] = state.length, left--, state.mode = LEN;\n break;\n case CHECK:\n if (state.wrap) {\n while (bits < 32) {\n if (have === 0)\n break inf_leave;\n have--, hold |= input[next++] << bits, bits += 8;\n }\n if (_out -= left, strm.total_out += _out, state.total += _out, _out)\n strm.adler = state.check = state.flags \? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out);\n if (_out = left, (state.flags \? hold : zswap32(hold)) !== state.check) {\n strm.msg = \"incorrect data check\", state.mode = BAD;\n break;\n }\n hold = 0, bits = 0;\n }\n state.mode = LENGTH;\n case LENGTH:\n if (state.wrap && state.flags) {\n while (bits < 32) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (hold !== (state.total & 4294967295)) {\n strm.msg = \"incorrect length check\", state.mode = BAD;\n break;\n }\n hold = 0, bits = 0;\n }\n state.mode = DONE;\n case DONE:\n ret = Z_STREAM_END;\n break inf_leave;\n case BAD:\n ret = Z_DATA_ERROR;\n break inf_leave;\n case MEM:\n return Z_MEM_ERROR;\n case SYNC:\n default:\n return Z_STREAM_ERROR;\n }\n if (strm.next_out = put, strm.avail_out = left, strm.next_in = next, strm.avail_in = have, state.hold = hold, state.bits = bits, state.wsize || _out !== strm.avail_out && state.mode < BAD && (state.mode < CHECK || flush !== Z_FINISH)) {\n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out))\n return state.mode = MEM, Z_MEM_ERROR;\n }\n if (_in -= strm.avail_in, _out -= strm.avail_out, strm.total_in += _in, strm.total_out += _out, state.total += _out, state.wrap && _out)\n strm.adler = state.check = state.flags \? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out);\n if (strm.data_type = state.bits + (state.last \? 64 : 0) + (state.mode === TYPE \? 128 : 0) + (state.mode === LEN_ || state.mode === COPY_ \? 256 : 0), (_in === 0 && _out === 0 || flush === Z_FINISH) && ret === Z_OK)\n ret = Z_BUF_ERROR;\n return ret;\n }\n function inflateEnd(strm) {\n if (!strm || !strm.state)\n return Z_STREAM_ERROR;\n var state = strm.state;\n if (state.window)\n state.window = null;\n return strm.state = null, Z_OK;\n }\n function inflateGetHeader(strm, head) {\n var state;\n if (!strm || !strm.state)\n return Z_STREAM_ERROR;\n if (state = strm.state, (state.wrap & 2) === 0)\n return Z_STREAM_ERROR;\n return state.head = head, head.done = !1, Z_OK;\n }\n function inflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length, state, dictid, ret;\n if (!strm || !strm.state)\n return Z_STREAM_ERROR;\n if (state = strm.state, state.wrap !== 0 && state.mode !== DICT)\n return Z_STREAM_ERROR;\n if (state.mode === DICT) {\n if (dictid = 1, dictid = adler32(dictid, dictionary, dictLength, 0), dictid !== state.check)\n return Z_DATA_ERROR;\n }\n if (ret = updatewindow(strm, dictionary, dictLength, dictLength), ret)\n return state.mode = MEM, Z_MEM_ERROR;\n return state.havedict = 1, Z_OK;\n }\n exports.inflateReset = inflateReset, exports.inflateReset2 = inflateReset2, exports.inflateResetKeep = inflateResetKeep, exports.inflateInit = inflateInit, exports.inflateInit2 = inflateInit2, exports.inflate = inflate, exports.inflateEnd = inflateEnd, exports.inflateGetHeader = inflateGetHeader, exports.inflateSetDictionary = inflateSetDictionary, exports.inflateInfo = \"pako inflate (from Nodeca project)\";\n }\n}), require_constants = __commonJS({\n \"node_modules/pako/lib/zlib/constants.js\"(exports, module2) {\n module2.exports = {\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_TREES: 6,\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n Z_BUF_ERROR: -5,\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n Z_BINARY: 0,\n Z_TEXT: 1,\n Z_UNKNOWN: 2,\n Z_DEFLATED: 8\n };\n }\n}), require_binding = __commonJS({\n \"node_modules/browserify-zlib/lib/binding.js\"(exports) {\n var Zstream = require_zstream(), zlib_deflate = require_deflate(), zlib_inflate = require_inflate(), constants = require_constants();\n for (key in constants)\n exports[key] = constants[key];\n var key;\n exports.NONE = 0, exports.DEFLATE = 1, exports.INFLATE = 2, exports.GZIP = 3, exports.GUNZIP = 4, exports.DEFLATERAW = 5, exports.INFLATERAW = 6, exports.UNZIP = 7;\n var GZIP_HEADER_ID1 = 31, GZIP_HEADER_ID2 = 139;\n function Zlib(mode) {\n if (typeof mode !== \"number\" || mode < exports.DEFLATE || mode > exports.UNZIP)\n @throwTypeError(\"Bad argument\");\n this.dictionary = null, this.err = 0, this.flush = 0, this.init_done = !1, this.level = 0, this.memLevel = 0, this.mode = mode, this.strategy = 0, this.windowBits = 0, this.write_in_progress = !1, this.pending_close = !1, this.gzip_id_bytes_read = 0;\n }\n Zlib.prototype = {}, Zlib.prototype.close = function() {\n if (this.write_in_progress) {\n this.pending_close = !0;\n return;\n }\n if (this.pending_close = !1, assert(this.init_done, \"close before init\"), assert(this.mode <= exports.UNZIP), this.mode === exports.DEFLATE || this.mode === exports.GZIP || this.mode === exports.DEFLATERAW)\n zlib_deflate.deflateEnd(this.strm);\n else if (this.mode === exports.INFLATE || this.mode === exports.GUNZIP || this.mode === exports.INFLATERAW || this.mode === exports.UNZIP)\n zlib_inflate.inflateEnd(this.strm);\n this.mode = exports.NONE, this.dictionary = null;\n }, Zlib.prototype.write = function(flush, input, in_off, in_len, out, out_off, out_len) {\n return this._write(!0, flush, input, in_off, in_len, out, out_off, out_len);\n }, Zlib.prototype.writeSync = function(flush, input, in_off, in_len, out, out_off, out_len) {\n return this._write(!1, flush, input, in_off, in_len, out, out_off, out_len);\n }, Zlib.prototype._write = function(async, flush, input, in_off, in_len, out, out_off, out_len) {\n if (assert.equal(arguments.length, 8), assert(this.init_done, \"write before init\"), assert(this.mode !== exports.NONE, \"already finalized\"), assert.equal(!1, this.write_in_progress, \"write already in progress\"), assert.equal(!1, this.pending_close, \"close is pending\"), this.write_in_progress = !0, assert.equal(!1, flush === void 0, \"must provide flush value\"), this.write_in_progress = !0, flush !== exports.Z_NO_FLUSH && flush !== exports.Z_PARTIAL_FLUSH && flush !== exports.Z_SYNC_FLUSH && flush !== exports.Z_FULL_FLUSH && flush !== exports.Z_FINISH && flush !== exports.Z_BLOCK)\n throw new Error(\"Invalid flush value\");\n if (input == null)\n input = @Buffer.alloc(0), in_len = 0, in_off = 0;\n if (this.strm.avail_in = in_len, this.strm.input = input, this.strm.next_in = in_off, this.strm.avail_out = out_len, this.strm.output = out, this.strm.next_out = out_off, this.flush = flush, !async) {\n if (this._process(), this._checkError())\n return this._afterSync();\n return;\n }\n var self = this;\n return process.nextTick(function() {\n self._process(), self._after();\n }), this;\n }, Zlib.prototype._afterSync = function() {\n var avail_out = this.strm.avail_out, avail_in = this.strm.avail_in;\n return this.write_in_progress = !1, [avail_in, avail_out];\n }, Zlib.prototype._process = function() {\n var next_expected_header_byte = null;\n switch (this.mode) {\n case exports.DEFLATE:\n case exports.GZIP:\n case exports.DEFLATERAW:\n this.err = zlib_deflate.deflate(this.strm, this.flush);\n break;\n case exports.UNZIP:\n if (this.strm.avail_in > 0)\n next_expected_header_byte = this.strm.next_in;\n switch (this.gzip_id_bytes_read) {\n case 0:\n if (next_expected_header_byte === null)\n break;\n if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID1) {\n if (this.gzip_id_bytes_read = 1, next_expected_header_byte++, this.strm.avail_in === 1)\n break;\n } else {\n this.mode = exports.INFLATE;\n break;\n }\n case 1:\n if (next_expected_header_byte === null)\n break;\n if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID2)\n this.gzip_id_bytes_read = 2, this.mode = exports.GUNZIP;\n else\n this.mode = exports.INFLATE;\n break;\n default:\n throw new Error(\"invalid number of gzip magic number bytes read\");\n }\n case exports.INFLATE:\n case exports.GUNZIP:\n case exports.INFLATERAW:\n if (this.err = zlib_inflate.inflate(this.strm, this.flush), this.err === exports.Z_NEED_DICT && this.dictionary) {\n if (this.err = zlib_inflate.inflateSetDictionary(this.strm, this.dictionary), this.err === exports.Z_OK)\n this.err = zlib_inflate.inflate(this.strm, this.flush);\n else if (this.err === exports.Z_DATA_ERROR)\n this.err = exports.Z_NEED_DICT;\n }\n while (this.strm.avail_in > 0 && this.mode === exports.GUNZIP && this.err === exports.Z_STREAM_END && this.strm.next_in[0] !== 0)\n this.reset(), this.err = zlib_inflate.inflate(this.strm, this.flush);\n break;\n default:\n throw new Error(\"Unknown mode \" + this.mode);\n }\n }, Zlib.prototype._checkError = function() {\n switch (this.err) {\n case exports.Z_OK:\n case exports.Z_BUF_ERROR:\n if (this.strm.avail_out !== 0 && this.flush === exports.Z_FINISH)\n return this._error(\"unexpected end of file\"), !1;\n break;\n case exports.Z_STREAM_END:\n break;\n case exports.Z_NEED_DICT:\n if (this.dictionary == null)\n this._error(\"Missing dictionary\");\n else\n this._error(\"Bad dictionary\");\n return !1;\n default:\n return this._error(\"Zlib error\"), !1;\n }\n return !0;\n }, Zlib.prototype._after = function() {\n if (!this._checkError())\n return;\n var avail_out = this.strm.avail_out, avail_in = this.strm.avail_in;\n if (this.write_in_progress = !1, this.callback(avail_in, avail_out), this.pending_close)\n this.close();\n }, Zlib.prototype._error = function(message) {\n if (this.strm.msg)\n message = this.strm.msg;\n if (this.onerror(message, this.err), this.write_in_progress = !1, this.pending_close)\n this.close();\n }, Zlib.prototype.init = function(windowBits, level, memLevel, strategy, dictionary) {\n assert(arguments.length === 4 || arguments.length === 5, \"init(windowBits, level, memLevel, strategy, [dictionary])\"), assert(windowBits >= 8 && windowBits <= 15, \"invalid windowBits\"), assert(level >= -1 && level <= 9, \"invalid compression level\"), assert(memLevel >= 1 && memLevel <= 9, \"invalid memlevel\"), assert(strategy === exports.Z_FILTERED || strategy === exports.Z_HUFFMAN_ONLY || strategy === exports.Z_RLE || strategy === exports.Z_FIXED || strategy === exports.Z_DEFAULT_STRATEGY, \"invalid strategy\"), this._init(level, windowBits, memLevel, strategy, dictionary), this._setDictionary();\n }, Zlib.prototype.params = function() {\n throw new Error(\"deflateParams Not supported\");\n }, Zlib.prototype.reset = function() {\n this._reset(), this._setDictionary();\n }, Zlib.prototype._init = function(level, windowBits, memLevel, strategy, dictionary) {\n if (this.level = level, this.windowBits = windowBits, this.memLevel = memLevel, this.strategy = strategy, this.flush = exports.Z_NO_FLUSH, this.err = exports.Z_OK, this.mode === exports.GZIP || this.mode === exports.GUNZIP)\n this.windowBits += 16;\n if (this.mode === exports.UNZIP)\n this.windowBits += 32;\n if (this.mode === exports.DEFLATERAW || this.mode === exports.INFLATERAW)\n this.windowBits = -1 * this.windowBits;\n switch (this.strm = new Zstream, this.mode) {\n case exports.DEFLATE:\n case exports.GZIP:\n case exports.DEFLATERAW:\n this.err = zlib_deflate.deflateInit2(this.strm, this.level, exports.Z_DEFLATED, this.windowBits, this.memLevel, this.strategy);\n break;\n case exports.INFLATE:\n case exports.GUNZIP:\n case exports.INFLATERAW:\n case exports.UNZIP:\n this.err = zlib_inflate.inflateInit2(this.strm, this.windowBits);\n break;\n default:\n throw new Error(\"Unknown mode \" + this.mode);\n }\n if (this.err !== exports.Z_OK)\n this._error(\"Init error\");\n this.dictionary = dictionary, this.write_in_progress = !1, this.init_done = !0;\n }, Zlib.prototype._setDictionary = function() {\n if (this.dictionary == null)\n return;\n switch (this.err = exports.Z_OK, this.mode) {\n case exports.DEFLATE:\n case exports.DEFLATERAW:\n this.err = zlib_deflate.deflateSetDictionary(this.strm, this.dictionary);\n break;\n default:\n break;\n }\n if (this.err !== exports.Z_OK)\n this._error(\"Failed to set dictionary\");\n }, Zlib.prototype._reset = function() {\n switch (this.err = exports.Z_OK, this.mode) {\n case exports.DEFLATE:\n case exports.DEFLATERAW:\n case exports.GZIP:\n this.err = zlib_deflate.deflateReset(this.strm);\n break;\n case exports.INFLATE:\n case exports.INFLATERAW:\n case exports.GUNZIP:\n this.err = zlib_inflate.inflateReset(this.strm);\n break;\n default:\n break;\n }\n if (this.err !== exports.Z_OK)\n this._error(\"Failed to reset stream\");\n }, exports.Zlib = Zlib;\n }\n}), require_lib = __commonJS({\n \"node_modules/browserify-zlib/lib/index.js\"(exports) {\n var Buffer2 = BufferModule.Buffer, Transform = StreamModule.Transform, binding = require_binding(), util = Util, kMaxLength = BufferModule.kMaxLength, kRangeErrorMessage = \"Cannot create final Buffer. It would be larger than 0x\" + kMaxLength.toString(16) + \" bytes\";\n binding.Z_MIN_WINDOWBITS = 8, binding.Z_MAX_WINDOWBITS = 15, binding.Z_DEFAULT_WINDOWBITS = 15, binding.Z_MIN_CHUNK = 64, binding.Z_MAX_CHUNK = @Infinity, binding.Z_DEFAULT_CHUNK = 16384, binding.Z_MIN_MEMLEVEL = 1, binding.Z_MAX_MEMLEVEL = 9, binding.Z_DEFAULT_MEMLEVEL = 8, binding.Z_MIN_LEVEL = -1, binding.Z_MAX_LEVEL = 9, binding.Z_DEFAULT_LEVEL = binding.Z_DEFAULT_COMPRESSION;\n var bkeys = Object.keys(binding);\n for (bk = 0;bk < bkeys.length; bk++)\n if (bkey = bkeys[bk], bkey.match(/^Z/))\n Object.defineProperty(exports, bkey, {\n enumerable: !0,\n value: binding[bkey],\n writable: !1\n });\n var bkey, bk, codes = {\n Z_OK: binding.Z_OK,\n Z_STREAM_END: binding.Z_STREAM_END,\n Z_NEED_DICT: binding.Z_NEED_DICT,\n Z_ERRNO: binding.Z_ERRNO,\n Z_STREAM_ERROR: binding.Z_STREAM_ERROR,\n Z_DATA_ERROR: binding.Z_DATA_ERROR,\n Z_MEM_ERROR: binding.Z_MEM_ERROR,\n Z_BUF_ERROR: binding.Z_BUF_ERROR,\n Z_VERSION_ERROR: binding.Z_VERSION_ERROR\n }, ckeys = Object.keys(codes);\n for (ck = 0;ck < ckeys.length; ck++)\n ckey = ckeys[ck], codes[codes[ckey]] = ckey;\n var ckey, ck;\n Object.defineProperty(exports, \"codes\", {\n enumerable: !0,\n value: Object.freeze(codes),\n writable: !1\n }), exports.constants = require_constants(), exports.Deflate = Deflate, exports.Inflate = Inflate, exports.Gzip = Gzip, exports.Gunzip = Gunzip, exports.DeflateRaw = DeflateRaw, exports.InflateRaw = InflateRaw, exports.Unzip = Unzip, exports.createDeflate = function(o) {\n return new Deflate(o);\n }, exports.createInflate = function(o) {\n return new Inflate(o);\n }, exports.createDeflateRaw = function(o) {\n return new DeflateRaw(o);\n }, exports.createInflateRaw = function(o) {\n return new InflateRaw(o);\n }, exports.createGzip = function(o) {\n return new Gzip(o);\n }, exports.createGunzip = function(o) {\n return new Gunzip(o);\n }, exports.createUnzip = function(o) {\n return new Unzip(o);\n }, exports.deflate = function(buffer, opts, callback) {\n if (typeof opts === \"function\")\n callback = opts, opts = {};\n return zlibBuffer(new Deflate(opts), buffer, callback);\n }, exports.deflateSync = function(buffer, opts) {\n return zlibBufferSync(new Deflate(opts), buffer);\n }, exports.gzip = function(buffer, opts, callback) {\n if (typeof opts === \"function\")\n callback = opts, opts = {};\n return zlibBuffer(new Gzip(opts), buffer, callback);\n }, exports.gzipSync = function(buffer, opts) {\n return zlibBufferSync(new Gzip(opts), buffer);\n }, exports.deflateRaw = function(buffer, opts, callback) {\n if (typeof opts === \"function\")\n callback = opts, opts = {};\n return zlibBuffer(new DeflateRaw(opts), buffer, callback);\n }, exports.deflateRawSync = function(buffer, opts) {\n return zlibBufferSync(new DeflateRaw(opts), buffer);\n }, exports.unzip = function(buffer, opts, callback) {\n if (typeof opts === \"function\")\n callback = opts, opts = {};\n return zlibBuffer(new Unzip(opts), buffer, callback);\n }, exports.unzipSync = function(buffer, opts) {\n return zlibBufferSync(new Unzip(opts), buffer);\n }, exports.inflate = function(buffer, opts, callback) {\n if (typeof opts === \"function\")\n callback = opts, opts = {};\n return zlibBuffer(new Inflate(opts), buffer, callback);\n }, exports.inflateSync = function(buffer, opts) {\n return zlibBufferSync(new Inflate(opts), buffer);\n }, exports.gunzip = function(buffer, opts, callback) {\n if (typeof opts === \"function\")\n callback = opts, opts = {};\n return zlibBuffer(new Gunzip(opts), buffer, callback);\n }, exports.gunzipSync = function(buffer, opts) {\n return zlibBufferSync(new Gunzip(opts), buffer);\n }, exports.inflateRaw = function(buffer, opts, callback) {\n if (typeof opts === \"function\")\n callback = opts, opts = {};\n return zlibBuffer(new InflateRaw(opts), buffer, callback);\n }, exports.inflateRawSync = function(buffer, opts) {\n return zlibBufferSync(new InflateRaw(opts), buffer);\n }, exports.brotliCompress = function(buffer, opts, callback) {\n throw new Error(\"zlib.brotliCompress is not implemented\");\n };\n function zlibBuffer(engine, buffer, callback) {\n var buffers = [], nread = 0;\n engine.on(\"error\", onError), engine.on(\"end\", onEnd), engine.end(buffer), flow();\n function flow() {\n var chunk;\n while ((chunk = engine.read()) !== null)\n buffers.push(chunk), nread += chunk.length;\n engine.once(\"readable\", flow);\n }\n function onError(err) {\n engine.removeListener(\"end\", onEnd), engine.removeListener(\"readable\", flow), callback(err);\n }\n function onEnd() {\n var buf, err = null;\n if (nread >= kMaxLength)\n err = new RangeError(kRangeErrorMessage);\n else\n buf = Buffer2.concat(buffers, nread);\n buffers = [], engine.close(), callback(err, buf);\n }\n }\n function zlibBufferSync(engine, buffer) {\n if (typeof buffer === \"string\")\n buffer = Buffer2.from(buffer);\n if (!Buffer2.isBuffer(buffer))\n @throwTypeError(\"Not a string or buffer\");\n var flushFlag = engine._finishFlushFlag;\n return engine._processChunk(buffer, flushFlag);\n }\n function Deflate(opts) {\n if (!(this instanceof Deflate))\n return new Deflate(opts);\n Zlib.@call(this, opts, binding.DEFLATE);\n }\n function Inflate(opts) {\n if (!(this instanceof Inflate))\n return new Inflate(opts);\n Zlib.@call(this, opts, binding.INFLATE);\n }\n function Gzip(opts) {\n if (!(this instanceof Gzip))\n return new Gzip(opts);\n Zlib.@call(this, opts, binding.GZIP);\n }\n function Gunzip(opts) {\n if (!(this instanceof Gunzip))\n return new Gunzip(opts);\n Zlib.@call(this, opts, binding.GUNZIP);\n }\n function DeflateRaw(opts) {\n if (!(this instanceof DeflateRaw))\n return new DeflateRaw(opts);\n Zlib.@call(this, opts, binding.DEFLATERAW);\n }\n function InflateRaw(opts) {\n if (!(this instanceof InflateRaw))\n return new InflateRaw(opts);\n Zlib.@call(this, opts, binding.INFLATERAW);\n }\n function Unzip(opts) {\n if (!(this instanceof Unzip))\n return new Unzip(opts);\n Zlib.@call(this, opts, binding.UNZIP);\n }\n function isValidFlushFlag(flag) {\n return flag === binding.Z_NO_FLUSH || flag === binding.Z_PARTIAL_FLUSH || flag === binding.Z_SYNC_FLUSH || flag === binding.Z_FULL_FLUSH || flag === binding.Z_FINISH || flag === binding.Z_BLOCK;\n }\n function Zlib(opts, mode) {\n var _this = this;\n if (this._opts = opts = opts || {}, this._chunkSize = opts.chunkSize || exports.Z_DEFAULT_CHUNK, Transform.@call(this, opts), opts.flush && !isValidFlushFlag(opts.flush))\n throw new Error(\"Invalid flush flag: \" + opts.flush);\n if (opts.finishFlush && !isValidFlushFlag(opts.finishFlush))\n throw new Error(\"Invalid flush flag: \" + opts.finishFlush);\n if (this._flushFlag = opts.flush || binding.Z_NO_FLUSH, this._finishFlushFlag = typeof opts.finishFlush !== \"undefined\" \? opts.finishFlush : binding.Z_FINISH, opts.chunkSize) {\n if (opts.chunkSize < exports.Z_MIN_CHUNK || opts.chunkSize > exports.Z_MAX_CHUNK)\n throw new Error(\"Invalid chunk size: \" + opts.chunkSize);\n }\n if (opts.windowBits) {\n if (opts.windowBits < exports.Z_MIN_WINDOWBITS || opts.windowBits > exports.Z_MAX_WINDOWBITS)\n throw new Error(\"Invalid windowBits: \" + opts.windowBits);\n }\n if (opts.level) {\n if (opts.level < exports.Z_MIN_LEVEL || opts.level > exports.Z_MAX_LEVEL)\n throw new Error(\"Invalid compression level: \" + opts.level);\n }\n if (opts.memLevel) {\n if (opts.memLevel < exports.Z_MIN_MEMLEVEL || opts.memLevel > exports.Z_MAX_MEMLEVEL)\n throw new Error(\"Invalid memLevel: \" + opts.memLevel);\n }\n if (opts.strategy) {\n if (opts.strategy != exports.Z_FILTERED && opts.strategy != exports.Z_HUFFMAN_ONLY && opts.strategy != exports.Z_RLE && opts.strategy != exports.Z_FIXED && opts.strategy != exports.Z_DEFAULT_STRATEGY)\n throw new Error(\"Invalid strategy: \" + opts.strategy);\n }\n if (opts.dictionary) {\n if (!Buffer2.isBuffer(opts.dictionary))\n throw new Error(\"Invalid dictionary: it should be a Buffer instance\");\n }\n this._handle = new binding.Zlib(mode);\n var self = this;\n this._hadError = !1, this._handle.onerror = function(message, errno) {\n _close(self), self._hadError = !0;\n var error = new Error(message);\n error.errno = errno, error.code = exports.codes[errno], self.emit(\"error\", error);\n };\n var level = exports.Z_DEFAULT_COMPRESSION;\n if (typeof opts.level === \"number\")\n level = opts.level;\n var strategy = exports.Z_DEFAULT_STRATEGY;\n if (typeof opts.strategy === \"number\")\n strategy = opts.strategy;\n this._handle.init(opts.windowBits || exports.Z_DEFAULT_WINDOWBITS, level, opts.memLevel || exports.Z_DEFAULT_MEMLEVEL, strategy, opts.dictionary), this._buffer = Buffer2.allocUnsafe(this._chunkSize), this._offset = 0, this._level = level, this._strategy = strategy, this.once(\"end\", this.close), Object.defineProperty(this, \"_closed\", {\n get: function() {\n return !_this._handle;\n },\n configurable: !0,\n enumerable: !0\n });\n }\n util.inherits(Zlib, Transform), Zlib.prototype.params = function(level, strategy, callback) {\n if (level < exports.Z_MIN_LEVEL || level > exports.Z_MAX_LEVEL)\n @throwRangeError(\"Invalid compression level: \" + level);\n if (strategy != exports.Z_FILTERED && strategy != exports.Z_HUFFMAN_ONLY && strategy != exports.Z_RLE && strategy != exports.Z_FIXED && strategy != exports.Z_DEFAULT_STRATEGY)\n @throwTypeError(\"Invalid strategy: \" + strategy);\n if (this._level !== level || this._strategy !== strategy) {\n var self = this;\n this.flush(binding.Z_SYNC_FLUSH, function() {\n if (assert(self._handle, \"zlib binding closed\"), self._handle.params(level, strategy), !self._hadError) {\n if (self._level = level, self._strategy = strategy, callback)\n callback();\n }\n });\n } else\n process.nextTick(callback);\n }, Zlib.prototype.reset = function() {\n return assert(this._handle, \"zlib binding closed\"), this._handle.reset();\n }, Zlib.prototype._flush = function(callback) {\n this._transform(Buffer2.alloc(0), \"\", callback);\n }, Zlib.prototype.flush = function(kind, callback) {\n var _this2 = this, ws = this._writableState;\n if (typeof kind === \"function\" || kind === void 0 && !callback)\n callback = kind, kind = binding.Z_FULL_FLUSH;\n if (ws.ended) {\n if (callback)\n process.nextTick(callback);\n } else if (ws.ending) {\n if (callback)\n this.once(\"end\", callback);\n } else if (ws.needDrain) {\n if (callback)\n this.once(\"drain\", function() {\n return _this2.flush(kind, callback);\n });\n } else\n this._flushFlag = kind, this.write(Buffer2.alloc(0), \"\", callback);\n }, Zlib.prototype.close = function(callback) {\n _close(this, callback), process.nextTick(emitCloseNT, this);\n };\n function _close(engine, callback) {\n if (callback)\n process.nextTick(callback);\n if (!engine._handle)\n return;\n engine._handle.close(), engine._handle = null;\n }\n function emitCloseNT(self) {\n self.emit(\"close\");\n }\n Zlib.prototype._transform = function(chunk, encoding, cb) {\n var flushFlag, ws = this._writableState, ending = ws.ending || ws.ended, last = ending && (!chunk || ws.length === chunk.length);\n if (chunk !== null && !Buffer2.isBuffer(chunk))\n return cb(new Error(\"invalid input\"));\n if (!this._handle)\n return cb(new Error(\"zlib binding closed\"));\n if (last)\n flushFlag = this._finishFlushFlag;\n else if (flushFlag = this._flushFlag, chunk.length >= ws.length)\n this._flushFlag = this._opts.flush || binding.Z_NO_FLUSH;\n this._processChunk(chunk, flushFlag, cb);\n }, Zlib.prototype._processChunk = function(chunk, flushFlag, cb) {\n var availInBefore = chunk && chunk.length, availOutBefore = this._chunkSize - this._offset, inOff = 0, self = this, async = typeof cb === \"function\";\n if (!async) {\n var buffers = [], nread = 0, error;\n this.on(\"error\", function(er) {\n error = er;\n }), assert(this._handle, \"zlib binding closed\");\n do\n var res = this._handle.writeSync(flushFlag, chunk, inOff, availInBefore, this._buffer, this._offset, availOutBefore);\n while (!this._hadError && callback(res[0], res[1]));\n if (this._hadError)\n throw error;\n if (nread >= kMaxLength)\n _close(this), @throwRangeError(kRangeErrorMessage);\n var buf = Buffer2.concat(buffers, nread);\n return _close(this), buf;\n }\n assert(this._handle, \"zlib binding closed\");\n var req = this._handle.write(flushFlag, chunk, inOff, availInBefore, this._buffer, this._offset, availOutBefore);\n req.buffer = chunk, req.callback = callback;\n function callback(availInAfter, availOutAfter) {\n if (this)\n this.buffer = null, this.callback = null;\n if (self._hadError)\n return;\n var have = availOutBefore - availOutAfter;\n if (assert(have >= 0, \"have should not go down\"), have > 0) {\n var out = self._buffer.slice(self._offset, self._offset + have);\n if (self._offset += have, async)\n self.push(out);\n else\n buffers.push(out), nread += out.length;\n }\n if (availOutAfter === 0 || self._offset >= self._chunkSize)\n availOutBefore = self._chunkSize, self._offset = 0, self._buffer = Buffer2.allocUnsafe(self._chunkSize);\n if (availOutAfter === 0) {\n if (inOff += availInBefore - availInAfter, availInBefore = availInAfter, !async)\n return !0;\n var newReq = self._handle.write(flushFlag, chunk, inOff, availInBefore, self._buffer, self._offset, self._chunkSize);\n newReq.callback = callback, newReq.buffer = chunk;\n return;\n }\n if (!async)\n return !1;\n cb();\n }\n }, util.inherits(Deflate, Zlib), util.inherits(Inflate, Zlib), util.inherits(Gzip, Zlib), util.inherits(Gunzip, Zlib), util.inherits(DeflateRaw, Zlib), util.inherits(InflateRaw, Zlib), util.inherits(Unzip, Zlib);\n }\n});\nreturn require_lib()})\n"); -// - -// -static constexpr ASCIILiteral ThirdpartyDepdCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/thirdparty/depd.ts\nvar wrapfunction = function(fn, message) {\n if (typeof fn !== \"function\")\n @throwTypeError(\"argument fn must be a function\");\n return fn;\n}, wrapproperty = function(obj, prop, message) {\n if (!obj || typeof obj !== \"object\" && typeof obj !== \"function\")\n @throwTypeError(\"argument obj must be object\");\n var descriptor = Object.getOwnPropertyDescriptor(obj, prop);\n if (!descriptor)\n @throwTypeError(\"must call property on owner object\");\n if (!descriptor.configurable)\n @throwTypeError(\"property must be configurable\");\n}, $;\n$ = function depd(namespace) {\n if (!namespace)\n @throwTypeError(\"argument namespace is required\");\n function deprecate(message) {\n }\n return deprecate._file = void 0, deprecate._ignored = !0, deprecate._namespace = namespace, deprecate._traced = !1, deprecate._warned = Object.create(null), deprecate.function = wrapfunction, deprecate.property = wrapproperty, deprecate;\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral ThirdpartyDetectLibcCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/thirdparty/detect-libc.ts\nvar family = function() {\n return @Promise.resolve(familySync());\n}, familySync = function() {\n return null;\n}, version = function() {\n return @Promise.resolve(versionSync());\n}, versionSync = function() {\n return null;\n}, isNonGlibcLinuxSync = function() {\n return !1;\n}, isNonGlibcLinux = function() {\n return @Promise.resolve(isNonGlibcLinuxSync());\n}, $, GLIBC = \"glibc\", MUSL = \"musl\";\n$ = {\n GLIBC,\n MUSL,\n family,\n familySync,\n isNonGlibcLinux,\n isNonGlibcLinuxSync,\n version,\n versionSync\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral ThirdpartyDetectLibcLinuxCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/thirdparty/detect-libc.linux.ts\nvar family = function() {\n return @Promise.resolve(familySync());\n}, familySync = function() {\n return GLIBC;\n}, version = function() {\n return @Promise.resolve(versionSync());\n}, versionSync = function() {\n return \"2.29\";\n}, isNonGlibcLinuxSync = function() {\n return !1;\n}, isNonGlibcLinux = function() {\n return @Promise.resolve(isNonGlibcLinuxSync());\n}, $, GLIBC = \"glibc\", MUSL = \"musl\";\n$ = {\n GLIBC,\n MUSL,\n family,\n familySync,\n isNonGlibcLinux,\n isNonGlibcLinuxSync,\n version,\n versionSync\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral ThirdpartyIsomorphicFetchCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/thirdparty/isomorphic-fetch.ts\nvar bunFetch = Bun.fetch, fetch = (...args) => bunFetch(...args);\nfetch.default = fetch;\nfetch.fetch = fetch;\nreturn fetch})\n"); -// - -// -static constexpr ASCIILiteral ThirdpartyNodeFetchCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/thirdparty/node-fetch.ts\nasync function fetch(url, init) {\n let body = init\?.body;\n if (body) {\n const chunks = [];\n if (body instanceof Readable) {\n for await (let chunk of body)\n chunks.push(chunk);\n init = { ...init, body: new Blob(chunks) };\n }\n }\n const response = await nativeFetch(url, init);\n return Object.setPrototypeOf(response, Response.prototype), response;\n}\nvar blobFrom = function(path, options) {\n return @Promise.resolve(Bun.file(path, options));\n}, blobFromSync = function(path, options) {\n return Bun.file(path, options);\n}, isRedirect = function(code) {\n return code === 301 || code === 302 || code === 303 || code === 307 || code === 308;\n}, $, { Headers, Request, Response: WebResponse, Blob, File = Blob, FormData } = globalThis, nativeFetch = Bun.fetch, { Readable } = @getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39);\n\nclass Response extends WebResponse {\n constructor() {\n super(...arguments);\n }\n _body;\n get body() {\n return this._body \?\? (this._body = Readable.fromWeb(super.body));\n }\n}\n\nclass AbortError extends DOMException {\n constructor(message) {\n super(message, \"AbortError\");\n }\n}\n\nclass FetchBaseError extends Error {\n type;\n constructor(message, type) {\n super(message);\n this.type = type;\n }\n}\n\nclass FetchError extends FetchBaseError {\n constructor(message, type, systemError) {\n super(message, type);\n this.code = systemError\?.code;\n }\n}\nvar fileFrom = blobFrom, fileFromSync = blobFromSync;\n$ = Object.assign(fetch, {\n AbortError,\n Blob,\n FetchBaseError,\n FetchError,\n File,\n FormData,\n Headers,\n Request,\n Response,\n blobFrom,\n blobFromSync,\n fileFrom,\n fileFromSync,\n isRedirect,\n fetch,\n default: fetch\n});\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral ThirdpartyUndiciCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/thirdparty/undici.ts\nvar notImplemented = function() {\n throw new Error(\"Not implemented in bun\");\n};\nasync function request(url, options = {\n method: \"GET\",\n signal: null,\n headers: null,\n query: null,\n reset: !1,\n throwOnError: !1,\n body: null\n}) {\n let {\n method = \"GET\",\n headers: inputHeaders,\n query,\n signal,\n reset = !1,\n throwOnError = !1,\n body: inputBody,\n maxRedirections\n } = options;\n if (typeof url === \"string\") {\n if (query)\n url = new URL(url);\n } else if (typeof url === \"object\" && url !== null) {\n if (!(url instanceof URL))\n throw new Error(\"not implemented\");\n } else\n @throwTypeError(\"url must be a string, URL, or UrlObject\");\n if (typeof url === \"string\" && query)\n url = new URL(url);\n if (typeof url === \"object\" && url !== null && query) {\n if (query)\n url.search = new URLSearchParams(query).toString();\n }\n if (method = method && typeof method === \"string\" \? method.toUpperCase() : null, inputBody && (method === \"GET\" || method === \"HEAD\"))\n throw new Error(\"Body not allowed for GET or HEAD requests\");\n if (inputBody && inputBody.read && inputBody instanceof Readable) {\n let data = \"\";\n inputBody.setEncoding(\"utf8\");\n for await (let chunk of stream)\n data += chunk;\n inputBody = (new TextEncoder()).encode(data);\n }\n if (maxRedirections !== @undefined && Number.isNaN(maxRedirections))\n throw new Error(\"maxRedirections must be a number if defined\");\n if (signal && !(signal instanceof @AbortSignal))\n throw new Error(\"signal must be an instance of AbortSignal\");\n let resp;\n const {\n status: statusCode,\n headers,\n trailers\n } = resp = await fetch(url, {\n signal,\n mode: \"cors\",\n method,\n headers: inputHeaders || kEmptyObject,\n body: inputBody,\n redirect: maxRedirections === \"undefined\" || maxRedirections > 0 \? \"follow\" : \"manual\",\n keepalive: !reset\n });\n if (throwOnError && statusCode >= 400 && statusCode < 600)\n throw new Error(`Request failed with status code ${statusCode}`);\n const body = resp.body \? new BodyReadable(resp) : null;\n return { statusCode, headers: headers.toJSON(), body, trailers, opaque: kEmptyObject, context: kEmptyObject };\n}\nvar stream = function() {\n throw new Error(\"Not implemented in bun\");\n}, pipeline = function() {\n throw new Error(\"Not implemented in bun\");\n}, connect = function() {\n throw new Error(\"Not implemented in bun\");\n}, upgrade = function() {\n throw new Error(\"Not implemented in bun\");\n}, mockErrors = function() {\n throw new Error(\"Not implemented in bun\");\n}, Undici = function() {\n throw new Error(\"Not implemented in bun\");\n}, $, EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20), StreamModule = @getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39), { Readable } = StreamModule, { _ReadableFromWebForUndici: ReadableFromWeb } = StreamModule[Symbol.for(\"::bunternal::\")], ObjectCreate = Object.create, kEmptyObject = ObjectCreate(null), fetch = Bun.fetch, Response = globalThis.Response, Headers = globalThis.Headers, Request = globalThis.Request, URLSearchParams = globalThis.URLSearchParams, URL = globalThis.URL;\n\nclass File extends Blob {\n constructor() {\n super(...arguments);\n }\n}\n\nclass FileReader extends EventTarget {\n constructor() {\n throw new Error(\"Not implemented yet!\");\n }\n}\nvar FormData = globalThis.FormData;\n\nclass BodyReadable extends ReadableFromWeb {\n #response;\n #bodyUsed;\n constructor(response, options = {}) {\n var { body } = response;\n if (!body)\n throw new Error(\"Response body is null\");\n super(options, body);\n this.#response = response, this.#bodyUsed = response.bodyUsed;\n }\n get bodyUsed() {\n return this.#bodyUsed;\n }\n #consume() {\n if (this.#bodyUsed)\n @throwTypeError(\"unusable\");\n this.#bodyUsed = !0;\n }\n async arrayBuffer() {\n return this.#consume(), await this.#response.arrayBuffer();\n }\n async blob() {\n return this.#consume(), await this.#response.blob();\n }\n async formData() {\n return this.#consume(), await this.#response.formData();\n }\n async json() {\n return this.#consume(), await this.#response.json();\n }\n async text() {\n return this.#consume(), await this.#response.text();\n }\n}\n\nclass MockClient {\n constructor() {\n throw new Error(\"Not implemented in bun\");\n }\n}\n\nclass MockPool {\n constructor() {\n throw new Error(\"Not implemented in bun\");\n }\n}\n\nclass MockAgent {\n constructor() {\n throw new Error(\"Not implemented in bun\");\n }\n}\n\nclass Dispatcher extends EventEmitter {\n constructor() {\n super(...arguments);\n }\n}\n\nclass Agent extends Dispatcher {\n constructor() {\n super(...arguments);\n }\n}\n\nclass Pool extends Dispatcher {\n constructor() {\n super(...arguments);\n }\n request() {\n throw new Error(\"Not implemented in bun\");\n }\n}\n\nclass BalancedPool extends Dispatcher {\n constructor() {\n super(...arguments);\n }\n}\n\nclass Client extends Dispatcher {\n constructor() {\n super(...arguments);\n }\n request() {\n throw new Error(\"Not implemented in bun\");\n }\n}\nUndici.Dispatcher = Dispatcher;\nUndici.Pool = Pool;\nUndici.BalancedPool = BalancedPool;\nUndici.Client = Client;\nUndici.Agent = Agent;\nUndici.buildConnector = Undici.errors = Undici.setGlobalDispatcher = Undici.getGlobalDispatcher = Undici.request = Undici.stream = Undici.pipeline = Undici.connect = Undici.upgrade = Undici.MockClient = Undici.MockPool = Undici.MockAgent = Undici.mockErrors = notImplemented;\nUndici.fetch = fetch;\n$ = {\n fetch,\n Response,\n Headers,\n Request,\n URLSearchParams,\n URL,\n File,\n FileReader,\n FormData,\n request,\n stream,\n pipeline,\n connect,\n upgrade,\n MockClient,\n MockPool,\n MockAgent,\n mockErrors,\n Dispatcher,\n Pool,\n BalancedPool,\n Client,\n Agent,\n Undici\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral ThirdpartyVercelFetchCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/thirdparty/vercel_fetch.ts\nvar $;\n$ = (wrapper = Bun.fetch) => {\n async function vercelFetch(url, opts = {}) {\n if (opts.body && typeof opts.body === \"object\" && (!(\"buffer\" in opts.body) || typeof opts.body.buffer !== \"object\" || !(opts.body.buffer instanceof @ArrayBuffer))) {\n if (opts.body = JSON.stringify(opts.body), !opts.headers)\n opts.headers = new Headers;\n opts.headers.set(\"Content-Type\", \"application/json\");\n }\n try {\n return await wrapper(url, opts);\n } catch (err) {\n if (typeof err === \"string\")\n err = new Error(err);\n throw err.url = url, err.opts = opts, err;\n }\n }\n return vercelFetch.default = vercelFetch, vercelFetch;\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral ThirdpartyWSCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/thirdparty/ws.ts\nvar emitWarning = function(type, message) {\n if (emittedWarnings.has(type))\n return;\n emittedWarnings.add(type), console.warn(\"[bun] Warning:\", message);\n}, subprotocolParse = function(header) {\n const protocols = new Set;\n let start = -1, end = -1, i = 0;\n for (i;i < header.length; i++) {\n const code = header.charCodeAt(i);\n if (end === -1 && wsTokenChars[code] === 1) {\n if (start === -1)\n start = i;\n } else if (i !== 0 && (code === 32 || code === 9)) {\n if (end === -1 && start !== -1)\n end = i;\n } else if (code === 44) {\n if (start === -1)\n throw new SyntaxError(`Unexpected character at index ${i}`);\n if (end === -1)\n end = i;\n const protocol2 = header.slice(start, end);\n if (protocols.has(protocol2))\n throw new SyntaxError(`The \"${protocol2}\" subprotocol is duplicated`);\n protocols.add(protocol2), start = end = -1;\n } else\n throw new SyntaxError(`Unexpected character at index ${i}`);\n }\n if (start === -1 || end !== -1)\n throw new SyntaxError(\"Unexpected end of input\");\n const protocol = header.slice(start, i);\n if (protocols.has(protocol))\n throw new SyntaxError(`The \"${protocol}\" subprotocol is duplicated`);\n return protocols.add(protocol), protocols;\n}, wsEmitClose = function(server) {\n server._state = CLOSED, server.emit(\"close\");\n}, abortHandshake = function(response, code, message, headers) {\n message = message || http.STATUS_CODES[code], headers = {\n Connection: \"close\",\n \"Content-Type\": \"text/html\",\n \"Content-Length\": @Buffer.byteLength(message),\n ...headers\n }, response.writeHead(code, headers), response.write(message), response.end();\n}, abortHandshakeOrEmitwsClientError = function(server, req, response, socket, code, message) {\n if (server.listenerCount(\"wsClientError\")) {\n const err = new Error(message);\n Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError), server.emit(\"wsClientError\", err, socket, req);\n } else\n abortHandshake(response, code, message);\n}, $, EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20), http = @getInternalField(@internalModuleRegistry, 23) || @createInternalModuleById(23), kBunInternals = Symbol.for(\"::bunternal::\"), readyStates = [\"CONNECTING\", \"OPEN\", \"CLOSING\", \"CLOSED\"], encoder = new TextEncoder, eventIds = {\n open: 1,\n close: 2,\n message: 3,\n error: 4,\n ping: 5,\n pong: 6\n}, emittedWarnings = new Set;\n\nclass BunWebSocket extends EventEmitter {\n static CONNECTING = 0;\n static OPEN = 1;\n static CLOSING = 2;\n static CLOSED = 3;\n #ws;\n #paused = !1;\n #fragments = !1;\n #binaryType = \"nodebuffer\";\n #eventId = 0;\n constructor(url, protocols, options) {\n super();\n let ws = this.#ws = new WebSocket(url, protocols);\n ws.binaryType = \"nodebuffer\";\n }\n on(event, listener) {\n if (event === \"unexpected-response\" || event === \"upgrade\" || event === \"redirect\")\n emitWarning(event, \"ws.WebSocket '\" + event + \"' event is not implemented in bun\");\n const mask = 1 << eventIds[event];\n if (mask && (this.#eventId & mask) !== mask) {\n if (this.#eventId |= mask, event === \"open\")\n this.#ws.addEventListener(\"open\", () => {\n this.emit(\"open\");\n });\n else if (event === \"close\")\n this.#ws.addEventListener(\"close\", ({ code, reason, wasClean }) => {\n this.emit(\"close\", code, reason, wasClean);\n });\n else if (event === \"message\")\n this.#ws.addEventListener(\"message\", ({ data }) => {\n const isBinary = typeof data !== \"string\";\n if (isBinary)\n this.emit(\"message\", this.#fragments \? [data] : data, isBinary);\n else {\n let encoded = encoder.encode(data);\n if (this.#binaryType !== \"arraybuffer\")\n encoded = @Buffer.from(encoded.buffer, encoded.byteOffset, encoded.byteLength);\n this.emit(\"message\", this.#fragments \? [encoded] : encoded, isBinary);\n }\n });\n else if (event === \"error\")\n this.#ws.addEventListener(\"error\", (err) => {\n this.emit(\"error\", err);\n });\n else if (event === \"ping\")\n this.#ws.addEventListener(\"ping\", ({ data }) => {\n this.emit(\"ping\", data);\n });\n else if (event === \"pong\")\n this.#ws.addEventListener(\"pong\", ({ data }) => {\n this.emit(\"pong\", data);\n });\n }\n return super.on(event, listener);\n }\n send(data, opts, cb) {\n try {\n this.#ws.send(data, opts\?.compress);\n } catch (error) {\n typeof cb === \"function\" && cb(error);\n return;\n }\n typeof cb === \"function\" && cb();\n }\n close(code, reason) {\n this.#ws.close(code, reason);\n }\n terminate() {\n this.#ws.terminate();\n }\n get url() {\n return this.#ws.url;\n }\n get readyState() {\n return this.#ws.readyState;\n }\n get binaryType() {\n return this.#binaryType;\n }\n set binaryType(value) {\n if (value === \"nodebuffer\" || value === \"arraybuffer\")\n this.#ws.binaryType = this.#binaryType = value, this.#fragments = !1;\n else if (value === \"fragments\")\n this.#ws.binaryType = \"nodebuffer\", this.#binaryType = \"fragments\", this.#fragments = !0;\n else\n throw new Error(`Invalid binaryType: ${value}`);\n }\n get protocol() {\n return this.#ws.protocol;\n }\n get extensions() {\n return this.#ws.extensions;\n }\n addEventListener(type, listener, options) {\n this.#ws.addEventListener(type, listener, options);\n }\n removeEventListener(type, listener) {\n this.#ws.removeEventListener(type, listener);\n }\n get onopen() {\n return this.#ws.onopen;\n }\n set onopen(value) {\n this.#ws.onopen = value;\n }\n get onerror() {\n return this.#ws.onerror;\n }\n set onerror(value) {\n this.#ws.onerror = value;\n }\n get onclose() {\n return this.#ws.onclose;\n }\n set onclose(value) {\n this.#ws.onclose = value;\n }\n get onmessage() {\n return this.#ws.onmessage;\n }\n set onmessage(value) {\n this.#ws.onmessage = value;\n }\n get bufferedAmount() {\n return this.#ws.bufferedAmount;\n }\n get isPaused() {\n return this.#paused;\n }\n ping(data, mask, cb) {\n if (typeof data === \"function\")\n cb = data, data = mask = @undefined;\n else if (typeof mask === \"function\")\n cb = mask, mask = @undefined;\n if (typeof data === \"number\")\n data = data.toString();\n try {\n this.#ws.ping(data);\n } catch (error) {\n typeof cb === \"function\" && cb(error);\n return;\n }\n typeof cb === \"function\" && cb();\n }\n pong(data, mask, cb) {\n if (typeof data === \"function\")\n cb = data, data = mask = @undefined;\n else if (typeof mask === \"function\")\n cb = mask, mask = @undefined;\n if (typeof data === \"number\")\n data = data.toString();\n try {\n this.#ws.pong(data);\n } catch (error) {\n typeof cb === \"function\" && cb(error);\n return;\n }\n typeof cb === \"function\" && cb();\n }\n pause() {\n switch (this.readyState) {\n case WebSocket.CONNECTING:\n case WebSocket.CLOSED:\n return;\n }\n this.#paused = !0, emitWarning(\"pause()\", \"ws.WebSocket.pause() is not implemented in bun\");\n }\n resume() {\n switch (this.readyState) {\n case WebSocket.CONNECTING:\n case WebSocket.CLOSED:\n return;\n }\n this.#paused = !1, emitWarning(\"resume()\", \"ws.WebSocket.resume() is not implemented in bun\");\n }\n}\nObject.defineProperty(BunWebSocket, \"name\", { value: \"WebSocket\" });\nvar wsKeyRegex = /^[+/0-9A-Za-z]{22}==$/, wsTokenChars = [\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 1,\n 1,\n 1,\n 1,\n 1,\n 0,\n 0,\n 1,\n 1,\n 0,\n 1,\n 1,\n 0,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 0,\n 0,\n 0,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 0,\n 1,\n 0,\n 1,\n 0\n], RUNNING = 0, CLOSING = 1, CLOSED = 2;\n\nclass BunWebSocketMocked extends EventEmitter {\n #ws;\n #state;\n #enquedMessages = [];\n #url;\n #protocol;\n #extensions;\n #bufferedAmount = 0;\n #binaryType = \"arraybuffer\";\n #onclose;\n #onerror;\n #onmessage;\n #onopen;\n constructor(url, protocol, extensions, binaryType) {\n super();\n if (this.#ws = null, this.#state = 0, this.#url = url, this.#bufferedAmount = 0, binaryType = binaryType || \"arraybuffer\", binaryType !== \"nodebuffer\" && binaryType !== \"blob\" && binaryType !== \"arraybuffer\")\n @throwTypeError(\"binaryType must be either 'blob', 'arraybuffer' or 'nodebuffer'\");\n this.#binaryType = binaryType, this.#protocol = protocol, this.#extensions = extensions;\n const message = this.#message.bind(this), open = this.#open.bind(this), close = this.#close.bind(this), drain = this.#drain.bind(this);\n this[kBunInternals] = {\n message,\n open,\n close,\n drain\n };\n }\n #message(ws, message) {\n this.#ws = ws;\n let isBinary = !1;\n if (typeof message === \"string\")\n if (this.#binaryType === \"arraybuffer\")\n message = encoder.encode(message).buffer;\n else if (this.#binaryType === \"blob\")\n message = new Blob([message], { type: \"text/plain\" });\n else\n message = @Buffer.from(message);\n else if (isBinary = !0, this.#binaryType !== \"nodebuffer\") {\n if (this.#binaryType === \"arraybuffer\")\n message = new @Uint8Array(message);\n else if (this.#binaryType === \"blob\")\n message = new Blob([message]);\n }\n this.emit(\"message\", message, isBinary);\n }\n #open(ws) {\n this.#ws = ws, this.#state = 1, this.emit(\"open\", this), this.#drain(ws);\n }\n #close(ws, code, reason) {\n this.#state = 3, this.#ws = null, this.emit(\"close\", code, reason);\n }\n #drain(ws) {\n const chunk = this.#enquedMessages[0];\n if (chunk) {\n const [data, compress, cb] = chunk;\n if (ws.send(data, compress) == -1)\n return;\n typeof cb === \"function\" && cb(), this.#bufferedAmount -= chunk.length, this.#enquedMessages.shift();\n }\n }\n send(data, opts, cb) {\n if (this.#state === 1) {\n const compress = opts\?.compress;\n if (this.#ws.send(data, compress) == -1) {\n this.#enquedMessages.push([data, compress, cb]), this.#bufferedAmount += data.length;\n return;\n }\n typeof cb === \"function\" && cb();\n } else if (this.#state === 0)\n this.#enquedMessages.push([data, opts\?.compress, cb]), this.#bufferedAmount += data.length;\n }\n close(code, reason) {\n if (this.#state === 1)\n this.#state = 2, this.#ws.close(code, reason);\n }\n get binaryType() {\n return this.#binaryType;\n }\n set binaryType(type) {\n if (type !== \"nodebuffer\" && type !== \"blob\" && type !== \"arraybuffer\")\n @throwTypeError(\"binaryType must be either 'blob', 'arraybuffer' or 'nodebuffer'\");\n this.#binaryType = type;\n }\n get readyState() {\n return this.#state;\n }\n get url() {\n return this.#url;\n }\n get protocol() {\n return this.#protocol;\n }\n get extensions() {\n return this.#extensions;\n }\n get bufferedAmount() {\n return this.#bufferedAmount \?\? 0;\n }\n setSocket(socket, head, options) {\n throw new Error(\"Not implemented\");\n }\n set onclose(cb) {\n if (this.#onclose)\n this.removeListener(\"close\", this.#onclose);\n this.on(\"close\", cb), this.#onclose = cb;\n }\n set onerror(cb) {\n if (this.#onerror)\n this.removeListener(\"error\", this.#onerror);\n this.on(\"error\", cb), this.#onerror = cb;\n }\n set onmessage(cb) {\n if (this.#onmessage)\n this.removeListener(\"message\", this.#onmessage);\n this.on(\"message\", cb), this.#onmessage = cb;\n }\n set onopen(cb) {\n if (this.#onopen)\n this.removeListener(\"open\", this.#onopen);\n this.on(\"open\", cb), this.#onopen = cb;\n }\n get onclose() {\n return this.#onclose;\n }\n get onerror() {\n return this.#onerror;\n }\n get onmessage() {\n return this.#onmessage;\n }\n get onopen() {\n return this.#onopen;\n }\n addEventListener(type, listener, options) {\n if (type === \"message\") {\n const l = (data) => listener({ data });\n l.listener = listener, this.on(type, l);\n return;\n }\n this.on(type, listener);\n }\n removeEventListener(type, listener) {\n this.off(type, listener);\n }\n}\n\nclass WebSocketServer extends EventEmitter {\n _server;\n options;\n clients;\n _shouldEmitClose;\n _state;\n _removeListeners;\n constructor(options, callback) {\n super();\n if (options = {\n maxPayload: 104857600,\n skipUTF8Validation: !1,\n perMessageDeflate: !1,\n handleProtocols: null,\n clientTracking: !0,\n verifyClient: null,\n noServer: !1,\n backlog: null,\n server: null,\n host: null,\n path: null,\n port: null,\n ...options\n }, options.port == null && !options.server && !options.noServer || options.port != null && (options.server || options.noServer) || options.server && options.noServer)\n @throwTypeError('One and only one of the \"port\", \"server\", or \"noServer\" options must be specified');\n if (options.port != null)\n this._server = http.createServer((req, res) => {\n const body = http.STATUS_CODES[426];\n res.writeHead(426, {\n \"Content-Length\": body.length,\n \"Content-Type\": \"text/plain\"\n }), res.end(body);\n }), this._server.listen(options.port, options.host, options.backlog, callback);\n else if (options.server)\n this._server = options.server;\n if (this._server) {\n const emitConnection = this.emit.bind(this, \"connection\"), emitListening = this.emit.bind(this, \"listening\"), emitError = this.emit.bind(this, \"error\"), doUpgrade = (req, socket, head) => {\n this.handleUpgrade(req, socket, head, emitConnection);\n };\n this._server.on(\"listening\", emitListening), this._server.on(\"error\", emitError), this._server.on(\"upgrade\", doUpgrade), this._removeListeners = () => {\n this._server.removeListener(\"upgrade\", doUpgrade), this._server.removeListener(\"listening\", emitListening), this._server.removeListener(\"error\", emitError);\n };\n }\n if (options.perMessageDeflate === !0)\n options.perMessageDeflate = {};\n if (options.clientTracking)\n this.clients = new Set, this._shouldEmitClose = !1;\n this.options = options, this._state = RUNNING;\n }\n address() {\n if (this.options.noServer)\n throw new Error('The server is operating in \"noServer\" mode');\n if (!this._server)\n return null;\n return this._server.address();\n }\n close(cb) {\n if (this._state === CLOSED) {\n if (cb)\n this.once(\"close\", () => {\n cb(new Error(\"The server is not running\"));\n });\n process.nextTick((server) => {\n server._state = CLOSED, server.emit(\"close\");\n }, this);\n return;\n }\n if (cb)\n this.once(\"close\", cb);\n if (this._state === CLOSING)\n return;\n if (this._state = CLOSING, this.options.noServer || this.options.server) {\n if (this._server)\n this._removeListeners(), this._removeListeners = this._server = null;\n if (this.clients)\n if (!this.clients.size)\n process.nextTick((server) => {\n server._state = CLOSED, server.emit(\"close\");\n }, this);\n else\n this._shouldEmitClose = !0;\n else\n process.nextTick((server) => {\n server._state = CLOSED, server.emit(\"close\");\n }, this);\n } else {\n const server = this._server;\n this._removeListeners(), this._removeListeners = this._server = null, server.close(() => {\n this._state = CLOSED, this.emit(\"close\");\n });\n }\n }\n shouldHandle(req) {\n if (this.options.path) {\n const index = req.url.indexOf(\"\?\");\n if ((index !== -1 \? req.url.slice(0, index) : req.url) !== this.options.path)\n return !1;\n }\n return !0;\n }\n completeUpgrade(extensions, key, protocols, request, socket, head, cb) {\n const [server, response, req] = socket[kBunInternals];\n if (this._state > RUNNING)\n return abortHandshake(response, 503);\n let protocol = \"\";\n if (protocols.size)\n protocol = this.options.handleProtocols \? this.options.handleProtocols(protocols, request) : protocols.values().next().value;\n const ws = new BunWebSocketMocked(request.url, protocol, extensions, \"nodebuffer\"), headers = [\"HTTP/1.1 101 Switching Protocols\", \"Upgrade: websocket\", \"Connection: Upgrade\"];\n if (this.emit(\"headers\", headers, request), server.upgrade(req, {\n data: ws[kBunInternals]\n })) {\n if (response._reply(@undefined), this.clients)\n this.clients.add(ws), ws.on(\"close\", () => {\n if (this.clients.delete(ws), this._shouldEmitClose && !this.clients.size)\n process.nextTick(wsEmitClose, this);\n });\n cb(ws, request);\n } else\n abortHandshake(response, 500);\n }\n handleUpgrade(req, socket, head, cb) {\n const [_, response] = socket[kBunInternals], key = req.headers[\"sec-websocket-key\"], version = +req.headers[\"sec-websocket-version\"];\n if (req.method !== \"GET\") {\n abortHandshakeOrEmitwsClientError(this, req, response, socket, 405, \"Invalid HTTP method\");\n return;\n }\n if (req.headers.upgrade.toLowerCase() !== \"websocket\") {\n abortHandshakeOrEmitwsClientError(this, req, response, socket, 400, \"Invalid Upgrade header\");\n return;\n }\n if (!key || !wsKeyRegex.test(key)) {\n abortHandshakeOrEmitwsClientError(this, req, response, socket, 400, \"Missing or invalid Sec-WebSocket-Key header\");\n return;\n }\n if (version !== 8 && version !== 13) {\n abortHandshakeOrEmitwsClientError(this, req, response, socket, 400, \"Missing or invalid Sec-WebSocket-Version header\");\n return;\n }\n if (!this.shouldHandle(req)) {\n abortHandshake(response, 400);\n return;\n }\n const secWebSocketProtocol = req.headers[\"sec-websocket-protocol\"];\n let protocols = new Set;\n if (secWebSocketProtocol !== @undefined)\n try {\n protocols = subprotocolParse(secWebSocketProtocol);\n } catch (err) {\n abortHandshakeOrEmitwsClientError(this, req, response, socket, 400, \"Invalid Sec-WebSocket-Protocol header\");\n return;\n }\n const extensions = {};\n if (this.options.verifyClient) {\n const info = {\n origin: req.headers[`${version === 8 \? \"sec-websocket-origin\" : \"origin\"}`],\n secure: !!(req.socket.authorized || req.socket.encrypted),\n req\n };\n if (this.options.verifyClient.length === 2) {\n this.options.verifyClient(info, (verified, code, message, headers) => {\n if (!verified)\n return abortHandshake(response, code || 401, message, headers);\n this.completeUpgrade(extensions, key, protocols, req, socket, head, cb);\n });\n return;\n }\n if (!this.options.verifyClient(info))\n return abortHandshake(response, 401);\n }\n this.completeUpgrade(extensions, key, protocols, req, socket, head, cb);\n }\n}\nObject.defineProperty(BunWebSocket, \"CONNECTING\", {\n enumerable: !0,\n value: readyStates.indexOf(\"CONNECTING\")\n});\nObject.defineProperty(BunWebSocket.prototype, \"CONNECTING\", {\n enumerable: !0,\n value: readyStates.indexOf(\"CONNECTING\")\n});\nObject.defineProperty(BunWebSocket, \"OPEN\", {\n enumerable: !0,\n value: readyStates.indexOf(\"OPEN\")\n});\nObject.defineProperty(BunWebSocket.prototype, \"OPEN\", {\n enumerable: !0,\n value: readyStates.indexOf(\"OPEN\")\n});\nObject.defineProperty(BunWebSocket, \"CLOSING\", {\n enumerable: !0,\n value: readyStates.indexOf(\"CLOSING\")\n});\nObject.defineProperty(BunWebSocket.prototype, \"CLOSING\", {\n enumerable: !0,\n value: readyStates.indexOf(\"CLOSING\")\n});\nObject.defineProperty(BunWebSocket, \"CLOSED\", {\n enumerable: !0,\n value: readyStates.indexOf(\"CLOSED\")\n});\nObject.defineProperty(BunWebSocket.prototype, \"CLOSED\", {\n enumerable: !0,\n value: readyStates.indexOf(\"CLOSED\")\n});\n\nclass Sender {\n constructor() {\n throw new Error(\"Not supported yet in Bun\");\n }\n}\n\nclass Receiver {\n constructor() {\n throw new Error(\"Not supported yet in Bun\");\n }\n}\nvar createWebSocketStream = (ws) => {\n throw new Error(\"Not supported yet in Bun\");\n};\n$ = Object.assign(BunWebSocket, {\n createWebSocketStream,\n Receiver,\n Sender,\n WebSocket: BunWebSocket,\n Server: WebSocketServer,\n WebSocketServer\n});\nreturn $})\n"); -// - - #elif _WIN32 - // -static constexpr ASCIILiteral BunFFICode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/bun/ffi.ts\nvar FFIBuilder = function(params, returnType, functionToCall, name) {\n const hasReturnType = typeof FFIType[returnType] === \"number\" && FFIType[returnType] !== FFIType.void;\n var paramNames = new @Array(params.length), args = new @Array(params.length);\n for (let i = 0;i < params.length; i++) {\n paramNames[i] = `p${i}`;\n const wrapper = ffiWrappers[FFIType[params[i]]];\n if (wrapper)\n args[i] = `(val=>${wrapper})(p${i})`;\n else\n @throwTypeError(`Unsupported type ${params[i]}. Must be one of: ${Object.keys(FFIType).sort().join(\", \")}`);\n }\n var code = `functionToCall(${args.join(\", \")})`;\n if (hasReturnType)\n if (FFIType[returnType] === FFIType.cstring)\n code = `return new __GlobalBunCString(${code})`;\n else\n code = `return ${code}`;\n var func = new Function(\"functionToCall\", ...paramNames, code);\n Object.defineProperty(func, \"name\", {\n value: name\n });\n var wrap;\n switch (paramNames.length) {\n case 0:\n wrap = () => func(functionToCall);\n break;\n case 1:\n wrap = (arg1) => func(functionToCall, arg1);\n break;\n case 2:\n wrap = (arg1, arg2) => func(functionToCall, arg1, arg2);\n break;\n case 3:\n wrap = (arg1, arg2, arg3) => func(functionToCall, arg1, arg2, arg3);\n break;\n case 4:\n wrap = (arg1, arg2, arg3, arg4) => func(functionToCall, arg1, arg2, arg3, arg4);\n break;\n case 5:\n wrap = (arg1, arg2, arg3, arg4, arg5) => func(functionToCall, arg1, arg2, arg3, arg4, arg5);\n break;\n case 6:\n wrap = (arg1, arg2, arg3, arg4, arg5, arg6) => func(functionToCall, arg1, arg2, arg3, arg4, arg5, arg6);\n break;\n case 7:\n wrap = (arg1, arg2, arg3, arg4, arg5, arg6, arg7) => func(functionToCall, arg1, arg2, arg3, arg4, arg5, arg6, arg7);\n break;\n case 8:\n wrap = (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) => func(functionToCall, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);\n break;\n case 9:\n wrap = (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) => func(functionToCall, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);\n break;\n default: {\n wrap = (...args2) => func(functionToCall, ...args2);\n break;\n }\n }\n return wrap.native = functionToCall, wrap.ptr = functionToCall.ptr, wrap;\n}, dlopen = function(path, options) {\n const result = nativeDLOpen(path, options);\n if (result instanceof Error)\n throw result;\n for (let key in result.symbols) {\n var symbol = result.symbols[key];\n if (options[key]\?.args\?.length || FFIType[options[key]\?.returns] === FFIType.cstring)\n result.symbols[key] = FFIBuilder(options[key].args \?\? [], options[key].returns \?\? FFIType.void, symbol, path.includes(\"/\") \? `${key} (${path.split(\"/\").pop()})` : `${key} (${path})`);\n else\n result.symbols[key].native = result.symbols[key];\n }\n return result.close = result.close.bind(result), result;\n}, linkSymbols = function(options) {\n const result = nativeLinkSymbols(options);\n for (let key in result.symbols) {\n var symbol = result.symbols[key];\n if (options[key]\?.args\?.length || FFIType[options[key]\?.returns] === FFIType.cstring)\n result.symbols[key] = FFIBuilder(options[key].args \?\? [], options[key].returns \?\? FFIType.void, symbol, key);\n else\n result.symbols[key].native = result.symbols[key];\n }\n return result;\n}, onCloseCFunction = function(close) {\n close();\n}, CFunction = function(options) {\n const identifier = `CFunction${cFunctionI++}`;\n var result = linkSymbols({\n [identifier]: options\n }), hasClosed = !1, close = result.close.bind(result);\n return result.symbols[identifier].close = () => {\n if (hasClosed || !close)\n return;\n hasClosed = !0, close(), close = @undefined;\n }, cFunctionRegistry ||= new FinalizationRegistry(onCloseCFunction), cFunctionRegistry.register(result.symbols[identifier], result.symbols[identifier].close), result.symbols[identifier];\n}, $, FFIType = {\n \"0\": 0,\n \"1\": 1,\n \"2\": 2,\n \"3\": 3,\n \"4\": 4,\n \"5\": 5,\n \"6\": 6,\n \"7\": 7,\n \"8\": 8,\n \"9\": 9,\n \"10\": 10,\n \"11\": 11,\n \"12\": 12,\n \"13\": 13,\n \"14\": 14,\n \"15\": 15,\n \"16\": 16,\n \"17\": 17,\n bool: 11,\n c_int: 5,\n c_uint: 6,\n char: 0,\n \"char*\": 12,\n double: 9,\n f32: 10,\n f64: 9,\n float: 10,\n i16: 3,\n i32: 5,\n i64: 7,\n i8: 1,\n int: 5,\n int16_t: 3,\n int32_t: 5,\n int64_t: 7,\n int8_t: 1,\n isize: 7,\n u16: 4,\n u32: 6,\n u64: 8,\n u8: 2,\n uint16_t: 4,\n uint32_t: 6,\n uint64_t: 8,\n uint8_t: 2,\n usize: 8,\n \"void*\": 12,\n ptr: 12,\n pointer: 12,\n void: 13,\n cstring: 14,\n i64_fast: 15,\n u64_fast: 16,\n function: 17,\n callback: 17,\n fn: 17\n};\nvar ffi = globalThis.Bun.FFI, ptr = (arg1, arg2) => typeof arg2 === \"undefined\" \? ffi.ptr(arg1) : ffi.ptr(arg1, arg2), toBuffer = ffi.toBuffer, toArrayBuffer = ffi.toArrayBuffer, viewSource = ffi.viewSource, BunCString = ffi.CString, nativeLinkSymbols = ffi.linkSymbols, nativeDLOpen = ffi.dlopen, nativeCallback = ffi.callback, closeCallback = ffi.closeCallback;\ndelete ffi.callback;\ndelete ffi.closeCallback;\n\nclass JSCallback {\n constructor(cb, options) {\n const { ctx, ptr: ptr2 } = nativeCallback(options, cb);\n this.#ctx = ctx, this.ptr = ptr2, this.#threadsafe = !!options\?.threadsafe;\n }\n ptr;\n #ctx;\n #threadsafe;\n get threadsafe() {\n return this.#threadsafe;\n }\n [Symbol.toPrimitive]() {\n const { ptr: ptr2 } = this;\n return typeof ptr2 === \"number\" \? ptr2 : 0;\n }\n close() {\n const ctx = this.#ctx;\n if (this.ptr = null, this.#ctx = null, ctx)\n closeCallback(ctx);\n }\n}\n\nclass CString extends @String {\n constructor(ptr2, byteOffset, byteLength) {\n super(ptr2 \? typeof byteLength === \"number\" && Number.isSafeInteger(byteLength) \? BunCString(ptr2, byteOffset || 0, byteLength) : BunCString(ptr2) : \"\");\n if (this.ptr = typeof ptr2 === \"number\" \? ptr2 : 0, typeof byteOffset !== \"undefined\")\n this.byteOffset = byteOffset;\n if (typeof byteLength !== \"undefined\")\n this.byteLength = byteLength;\n }\n ptr;\n byteOffset;\n byteLength;\n #cachedArrayBuffer;\n get arrayBuffer() {\n if (this.#cachedArrayBuffer)\n return this.#cachedArrayBuffer;\n if (!this.ptr)\n return this.#cachedArrayBuffer = new @ArrayBuffer(0);\n return this.#cachedArrayBuffer = toArrayBuffer(this.ptr, this.byteOffset, this.byteLength);\n }\n}\nObject.defineProperty(globalThis, \"__GlobalBunCString\", {\n value: CString,\n enumerable: !1,\n configurable: !1\n});\nvar ffiWrappers = new @Array(18), char = \"val|0\";\nffiWrappers.fill(char);\nffiWrappers[FFIType.uint8_t] = \"val<0\?0:val>=255\?255:val|0\";\nffiWrappers[FFIType.int16_t] = \"val<=-32768\?-32768:val>=32768\?32768:val|0\";\nffiWrappers[FFIType.uint16_t] = \"val<=0\?0:val>=65536\?65536:val|0\";\nffiWrappers[FFIType.int32_t] = \"val|0\";\nffiWrappers[FFIType.uint32_t] = \"val<=0\?0:val>=0xffffffff\?0xffffffff:+val||0\";\nffiWrappers[FFIType.i64_fast] = `{\n if (typeof val === \"bigint\") {\n if (val <= BigInt(Number.MAX_SAFE_INTEGER) && val >= BigInt(-Number.MAX_SAFE_INTEGER)) {\n return Number(val).valueOf() || 0;\n }\n\n return val;\n }\n\n return !val \? 0 : +val || 0;\n}`;\nffiWrappers[FFIType.i64_fast] = `{\n if (typeof val === \"bigint\") {\n if (val <= BigInt(Number.MAX_SAFE_INTEGER) && val >= BigInt(-Number.MAX_SAFE_INTEGER)) {\n return Number(val).valueOf() || 0;\n }\n\n return val;\n }\n\n return !val \? 0 : +val || 0;\n}`;\nffiWrappers[FFIType.u64_fast] = `{\n if (typeof val === \"bigint\") {\n if (val <= BigInt(Number.MAX_SAFE_INTEGER) && val >= 0) {\n return Number(val).valueOf() || 0;\n }\n\n return val;\n }\n\n return !val \? 0 : +val || 0;\n}`;\nffiWrappers[FFIType.int64_t] = `{\n if (typeof val === \"bigint\") {\n return val;\n }\n\n if (typeof val === \"number\") {\n return BigInt(val || 0);\n }\n\n return BigInt(+val || 0);\n}`;\nffiWrappers[FFIType.uint64_t] = `{\n if (typeof val === \"bigint\") {\n return val;\n }\n\n if (typeof val === \"number\") {\n return val <= 0 \? BigInt(0) : BigInt(val || 0);\n }\n\n return BigInt(+val || 0);\n}`;\nffiWrappers[FFIType.u64_fast] = `{\n if (typeof val === \"bigint\") {\n if (val <= BigInt(Number.MAX_SAFE_INTEGER) && val >= BigInt(0)) return Number(val);\n return val;\n }\n\n return typeof val === \"number\" \? (val <= 0 \? 0 : +val || 0) : +val || 0;\n}`;\nffiWrappers[FFIType.uint16_t] = `{\n const ret = (typeof val === \"bigint\" \? Number(val) : val) | 0;\n return ret <= 0 \? 0 : ret > 0xffff \? 0xffff : ret;\n}`;\nffiWrappers[FFIType.double] = `{\n if (typeof val === \"bigint\") {\n if (val.valueOf() < BigInt(Number.MAX_VALUE)) {\n return Math.abs(Number(val).valueOf()) + 0.00000000000001 - 0.00000000000001;\n }\n }\n\n if (!val) {\n return 0 + 0.00000000000001 - 0.00000000000001;\n }\n\n return val + 0.00000000000001 - 0.00000000000001;\n}`;\nffiWrappers[FFIType.float] = ffiWrappers[10] = `{\n return Math.fround(val);\n}`;\nffiWrappers[FFIType.bool] = `{\n return !!val;\n}`;\nObject.defineProperty(globalThis, \"__GlobalBunFFIPtrFunctionForWrapper\", {\n value: ptr,\n enumerable: !1,\n configurable: !0\n});\nffiWrappers[FFIType.cstring] = ffiWrappers[FFIType.pointer] = `{\n if (typeof val === \"number\") return val;\n if (!val) {\n return null;\n }\n\n if (ArrayBuffer.isView(val) || val instanceof ArrayBuffer) {\n return __GlobalBunFFIPtrFunctionForWrapper(val);\n }\n\n if (typeof val === \"string\") {\n throw new TypeError(\"To convert a string to a pointer, encode it as a buffer\");\n }\n\n throw new TypeError(\\`Unable to convert \\${ val } to a pointer\\`);\n}`;\nffiWrappers[FFIType.function] = `{\n if (typeof val === \"number\") {\n return val;\n }\n\n if (typeof val === \"bigint\") {\n return Number(val);\n }\n\n var ptr = val && val.ptr;\n\n if (!ptr) {\n throw new TypeError(\"Expected function to be a JSCallback or a number\");\n }\n\n return ptr;\n}`;\nvar native = {\n dlopen: nativeDLOpen,\n callback: () => {\n throw new Error(\"Deprecated. Use new JSCallback(options, fn) instead\");\n }\n}, cFunctionI = 0, cFunctionRegistry, read = ffi.read;\n$ = {\n CFunction,\n CString,\n FFIType,\n JSCallback,\n dlopen,\n linkSymbols,\n native,\n ptr,\n read,\n suffix: \"dll\",\n toArrayBuffer,\n toBuffer,\n viewSource\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral BunSqliteCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/bun/sqlite.ts\nvar $, defineProperties = Object.defineProperties, toStringTag = Symbol.toStringTag, isArray = @Array.isArray, isTypedArray = @ArrayBuffer.isView, constants = {\n SQLITE_OPEN_READONLY: 1,\n SQLITE_OPEN_READWRITE: 2,\n SQLITE_OPEN_CREATE: 4,\n SQLITE_OPEN_DELETEONCLOSE: 8,\n SQLITE_OPEN_EXCLUSIVE: 16,\n SQLITE_OPEN_AUTOPROXY: 32,\n SQLITE_OPEN_URI: 64,\n SQLITE_OPEN_MEMORY: 128,\n SQLITE_OPEN_MAIN_DB: 256,\n SQLITE_OPEN_TEMP_DB: 512,\n SQLITE_OPEN_TRANSIENT_DB: 1024,\n SQLITE_OPEN_MAIN_JOURNAL: 2048,\n SQLITE_OPEN_TEMP_JOURNAL: 4096,\n SQLITE_OPEN_SUBJOURNAL: 8192,\n SQLITE_OPEN_SUPER_JOURNAL: 16384,\n SQLITE_OPEN_NOMUTEX: 32768,\n SQLITE_OPEN_FULLMUTEX: 65536,\n SQLITE_OPEN_SHAREDCACHE: 131072,\n SQLITE_OPEN_PRIVATECACHE: 262144,\n SQLITE_OPEN_WAL: 524288,\n SQLITE_OPEN_NOFOLLOW: 16777216,\n SQLITE_OPEN_EXRESCODE: 33554432,\n SQLITE_PREPARE_PERSISTENT: 1,\n SQLITE_PREPARE_NORMALIZE: 2,\n SQLITE_PREPARE_NO_VTAB: 4\n}, SQL, controllers;\n\nclass Statement {\n constructor(raw) {\n switch (this.#raw = raw, raw.paramsCount) {\n case 0: {\n this.get = this.#getNoArgs, this.all = this.#allNoArgs, this.values = this.#valuesNoArgs, this.run = this.#runNoArgs;\n break;\n }\n default: {\n this.get = this.#get, this.all = this.#all, this.values = this.#values, this.run = this.#run;\n break;\n }\n }\n }\n #raw;\n get;\n all;\n values;\n run;\n isFinalized = !1;\n toJSON() {\n return {\n sql: this.native.toString(),\n isFinalized: this.isFinalized,\n paramsCount: this.paramsCount,\n columnNames: this.columnNames\n };\n }\n get [toStringTag]() {\n return `\"${this.native.toString()}\"`;\n }\n toString() {\n return this.native.toString();\n }\n get native() {\n return this.#raw;\n }\n #getNoArgs() {\n return this.#raw.get();\n }\n #allNoArgs() {\n return this.#raw.all();\n }\n #valuesNoArgs() {\n return this.#raw.values();\n }\n #runNoArgs() {\n this.#raw.run();\n }\n #get(...args) {\n if (args.length === 0)\n return this.#getNoArgs();\n var arg0 = args[0];\n return !isArray(arg0) && (!arg0 || typeof arg0 !== \"object\" || isTypedArray(arg0)) \? this.#raw.get(args) : this.#raw.get(...args);\n }\n #all(...args) {\n if (args.length === 0)\n return this.#allNoArgs();\n var arg0 = args[0];\n return !isArray(arg0) && (!arg0 || typeof arg0 !== \"object\" || isTypedArray(arg0)) \? this.#raw.all(args) : this.#raw.all(...args);\n }\n #values(...args) {\n if (args.length === 0)\n return this.#valuesNoArgs();\n var arg0 = args[0];\n return !isArray(arg0) && (!arg0 || typeof arg0 !== \"object\" || isTypedArray(arg0)) \? this.#raw.values(args) : this.#raw.values(...args);\n }\n #run(...args) {\n if (args.length === 0)\n return this.#runNoArgs();\n var arg0 = args[0];\n !isArray(arg0) && (!arg0 || typeof arg0 !== \"object\" || isTypedArray(arg0)) \? this.#raw.run(args) : this.#raw.run(...args);\n }\n get columnNames() {\n return this.#raw.columns;\n }\n get paramsCount() {\n return this.#raw.paramsCount;\n }\n finalize(...args) {\n return this.isFinalized = !0, this.#raw.finalize(...args);\n }\n}\nvar cachedCount = Symbol.for(\"Bun.Database.cache.count\");\n\nclass Database {\n constructor(filenameGiven, options) {\n if (typeof filenameGiven === \"undefined\")\n ;\n else if (typeof filenameGiven !== \"string\") {\n if (isTypedArray(filenameGiven)) {\n this.#handle = Database.#deserialize(filenameGiven, typeof options === \"object\" && options \? !!options.readonly : ((options | 0) & constants.SQLITE_OPEN_READONLY) != 0), this.filename = \":memory:\";\n return;\n }\n @throwTypeError(`Expected 'filename' to be a string, got '${typeof filenameGiven}'`);\n }\n var filename = typeof filenameGiven === \"string\" \? filenameGiven.trim() : \":memory:\", flags = constants.SQLITE_OPEN_READWRITE | constants.SQLITE_OPEN_CREATE;\n if (typeof options === \"object\" && options) {\n if (flags = 0, options.readonly)\n flags = constants.SQLITE_OPEN_READONLY;\n if (\"readOnly\" in options)\n @throwTypeError('Misspelled option \"readOnly\" should be \"readonly\"');\n if (options.create)\n flags = constants.SQLITE_OPEN_READWRITE | constants.SQLITE_OPEN_CREATE;\n if (options.readwrite)\n flags |= constants.SQLITE_OPEN_READWRITE;\n } else if (typeof options === \"number\")\n flags = options;\n const anonymous = filename === \"\" || filename === \":memory:\";\n if (anonymous && (flags & constants.SQLITE_OPEN_READONLY) !== 0)\n throw new Error(\"Cannot open an anonymous database in read-only mode.\");\n if (!SQL)\n SQL = @lazy(\"sqlite\");\n this.#handle = SQL.open(anonymous \? \":memory:\" : filename, flags), this.filename = filename;\n }\n #handle;\n #cachedQueriesKeys = [];\n #cachedQueriesLengths = [];\n #cachedQueriesValues = [];\n filename;\n get handle() {\n return this.#handle;\n }\n get inTransaction() {\n return SQL.isInTransaction(this.#handle);\n }\n static open(filename, options) {\n return new Database(filename, options);\n }\n loadExtension(name, entryPoint) {\n return SQL.loadExtension(this.#handle, name, entryPoint);\n }\n serialize(optionalName) {\n return SQL.serialize(this.#handle, optionalName || \"main\");\n }\n static #deserialize(serialized, isReadOnly = !1) {\n if (!SQL)\n SQL = @lazy(\"sqlite\");\n return SQL.deserialize(serialized, isReadOnly);\n }\n static deserialize(serialized, isReadOnly = !1) {\n return new Database(serialized, isReadOnly \? constants.SQLITE_OPEN_READONLY : 0);\n }\n static setCustomSQLite(path) {\n if (!SQL)\n SQL = @lazy(\"sqlite\");\n return SQL.setCustomSQLite(path);\n }\n close() {\n return this.clearQueryCache(), SQL.close(this.#handle);\n }\n clearQueryCache() {\n for (let item of this.#cachedQueriesValues)\n item.finalize();\n this.#cachedQueriesKeys.length = 0, this.#cachedQueriesValues.length = 0, this.#cachedQueriesLengths.length = 0;\n }\n run(query, ...params) {\n if (params.length === 0) {\n SQL.run(this.#handle, query);\n return;\n }\n var arg0 = params[0];\n return !isArray(arg0) && (!arg0 || typeof arg0 !== \"object\" || isTypedArray(arg0)) \? SQL.run(this.#handle, query, params) : SQL.run(this.#handle, query, ...params);\n }\n prepare(query, params, flags) {\n return new Statement(SQL.prepare(this.#handle, query, params, flags || 0));\n }\n static MAX_QUERY_CACHE_SIZE = 20;\n get [cachedCount]() {\n return this.#cachedQueriesKeys.length;\n }\n query(query) {\n if (typeof query !== \"string\")\n @throwTypeError(`Expected 'query' to be a string, got '${typeof query}'`);\n if (query.length === 0)\n throw new Error(\"SQL query cannot be empty.\");\n const willCache = this.#cachedQueriesKeys.length < Database.MAX_QUERY_CACHE_SIZE;\n var index = this.#cachedQueriesLengths.indexOf(query.length);\n while (index !== -1) {\n if (this.#cachedQueriesKeys[index] !== query) {\n index = this.#cachedQueriesLengths.indexOf(query.length, index + 1);\n continue;\n }\n var stmt = this.#cachedQueriesValues[index];\n if (stmt.isFinalized)\n return this.#cachedQueriesValues[index] = this.prepare(query, @undefined, willCache \? constants.SQLITE_PREPARE_PERSISTENT : 0);\n return stmt;\n }\n var stmt = this.prepare(query, @undefined, willCache \? constants.SQLITE_PREPARE_PERSISTENT : 0);\n if (willCache)\n this.#cachedQueriesKeys.push(query), this.#cachedQueriesLengths.push(query.length), this.#cachedQueriesValues.push(stmt);\n return stmt;\n }\n transaction(fn, self) {\n if (typeof fn !== \"function\")\n @throwTypeError(\"Expected first argument to be a function\");\n const db = this, controller = getController(db, self), properties = {\n default: { value: wrapTransaction(fn, db, controller.default) },\n deferred: { value: wrapTransaction(fn, db, controller.deferred) },\n immediate: {\n value: wrapTransaction(fn, db, controller.immediate)\n },\n exclusive: {\n value: wrapTransaction(fn, db, controller.exclusive)\n },\n database: { value: this, enumerable: !0 }\n };\n return defineProperties(properties.default.value, properties), defineProperties(properties.deferred.value, properties), defineProperties(properties.immediate.value, properties), defineProperties(properties.exclusive.value, properties), properties.default.value;\n }\n}\nDatabase.prototype.exec = Database.prototype.run;\nvar getController = (db, self) => {\n let controller = (controllers ||= new WeakMap).get(db);\n if (!controller) {\n const shared = {\n commit: db.prepare(\"COMMIT\", @undefined, 0),\n rollback: db.prepare(\"ROLLBACK\", @undefined, 0),\n savepoint: db.prepare(\"SAVEPOINT `\\t_bs3.\\t`\", @undefined, 0),\n release: db.prepare(\"RELEASE `\\t_bs3.\\t`\", @undefined, 0),\n rollbackTo: db.prepare(\"ROLLBACK TO `\\t_bs3.\\t`\", @undefined, 0)\n };\n controllers.set(db, controller = {\n default: Object.assign({ begin: db.prepare(\"BEGIN\", @undefined, 0) }, shared),\n deferred: Object.assign({ begin: db.prepare(\"BEGIN DEFERRED\", @undefined, 0) }, shared),\n immediate: Object.assign({ begin: db.prepare(\"BEGIN IMMEDIATE\", @undefined, 0) }, shared),\n exclusive: Object.assign({ begin: db.prepare(\"BEGIN EXCLUSIVE\", @undefined, 0) }, shared)\n });\n }\n return controller;\n}, wrapTransaction = (fn, db, { begin, commit, rollback, savepoint, release, rollbackTo }) => function transaction(...args) {\n let before, after, undo;\n if (db.inTransaction)\n before = savepoint, after = release, undo = rollbackTo;\n else\n before = begin, after = commit, undo = rollback;\n try {\n before.run();\n const result = fn.@apply(this, args);\n return after.run(), result;\n } catch (ex) {\n if (db.inTransaction) {\n if (undo.run(), undo !== rollback)\n after.run();\n }\n throw ex;\n }\n};\n$ = {\n __esModule: !0,\n Database,\n Statement,\n constants,\n default: Database\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral InternalDebuggerCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/internal/debugger.ts\nvar versionInfo = function() {\n return {\n \"Protocol-Version\": \"1.3\",\n Browser: \"Bun\",\n \"User-Agent\": navigator.userAgent,\n \"WebKit-Version\": process.versions.webkit,\n \"Bun-Version\": Bun.version,\n \"Bun-Revision\": Bun.revision\n };\n}, webSocketWriter = function(ws) {\n return {\n write: (message) => !!ws.sendText(message),\n close: () => ws.close()\n };\n}, socketWriter = function(socket) {\n return {\n write: (message) => !!socket.write(message),\n close: () => socket.end()\n };\n}, bufferedWriter = function(writer) {\n let draining = !1, pendingMessages = [];\n return {\n write: (message) => {\n if (draining || !writer.write(message))\n pendingMessages.push(message);\n return !0;\n },\n drain: () => {\n draining = !0;\n try {\n for (let i = 0;i < pendingMessages.length; i++)\n if (!writer.write(pendingMessages[i])) {\n pendingMessages = pendingMessages.slice(i);\n return;\n }\n } finally {\n draining = !1;\n }\n },\n close: () => {\n writer.close(), pendingMessages.length = 0;\n }\n };\n}, parseUrl = function(url) {\n try {\n if (!url)\n return new URL(randomId(), `ws://${defaultHostname}:${defaultPort}/`);\n else if (url.startsWith(\"/\"))\n return new URL(url, `ws://${defaultHostname}:${defaultPort}/`);\n else if (/^[a-z+]+:\\/\\//i.test(url))\n return new URL(url);\n else if (/^\\d+$/.test(url))\n return new URL(randomId(), `ws://${defaultHostname}:${url}/`);\n else if (!url.includes(\"/\") && url.includes(\":\"))\n return new URL(randomId(), `ws://${url}/`);\n else if (!url.includes(\":\")) {\n const [hostname, pathname] = url.split(\"/\", 2);\n return new URL(`ws://${hostname}:${defaultPort}/${pathname}`);\n } else\n return new URL(randomId(), `ws://${url}`);\n } catch {\n @throwTypeError(`Invalid hostname or URL: '${url}'`);\n }\n}, randomId = function() {\n return Math.random().toString(36).slice(2);\n}, dim = function(string) {\n if (enableANSIColors)\n return `\\x1B[2m${string}\\x1B[22m`;\n return string;\n}, link = function(url) {\n if (enableANSIColors)\n return `\\x1B[1m\\x1B]8;;${url}\\x1B\\\\${url}\\x1B]8;;\\x1B\\\\\\x1B[22m`;\n return url;\n}, reset = function() {\n if (enableANSIColors)\n return \"\\x1B[49m\";\n return \"\";\n}, notify = function(unix) {\n Bun.connect({\n unix,\n socket: {\n open: (socket) => {\n socket.end(\"1\");\n },\n data: () => {\n }\n }\n }).finally(() => {\n });\n}, exit = function(...args) {\n console.error(...args), process.exit(1);\n}, $;\n$ = function(executionContextId, url, createBackend, send, close) {\n let debug;\n try {\n debug = new Debugger(executionContextId, url, createBackend, send, close);\n } catch (error) {\n exit(\"Failed to start inspector:\\n\", error);\n }\n const { protocol, href, host, pathname } = debug.url;\n if (!protocol.includes(\"unix\")) {\n if (console.log(dim(\"--------------------- Bun Inspector ---------------------\"), reset()), console.log(`Listening:\\n ${dim(href)}`), protocol.includes(\"ws\"))\n console.log(`Inspect in browser:\\n ${link(`https://debug.bun.sh/#${host}${pathname}`)}`);\n console.log(dim(\"--------------------- Bun Inspector ---------------------\"), reset());\n }\n const unix = process.env.BUN_INSPECT_NOTIFY;\n if (unix) {\n const { protocol: protocol2, pathname: pathname2 } = parseUrl(unix);\n if (protocol2 === \"unix:\")\n notify(pathname2);\n }\n};\n\nclass Debugger {\n #url;\n #createBackend;\n constructor(executionContextId, url, createBackend, send, close) {\n this.#url = parseUrl(url), this.#createBackend = (refEventLoop, receive) => {\n const backend = createBackend(executionContextId, refEventLoop, receive);\n return {\n write: (message) => {\n return send.@call(backend, message), !0;\n },\n close: () => close.@call(backend)\n };\n }, this.#listen();\n }\n get url() {\n return this.#url;\n }\n #listen() {\n const { protocol, hostname, port, pathname } = this.#url;\n if (protocol === \"ws:\" || protocol === \"ws+tcp:\") {\n const server = Bun.serve({\n hostname,\n port,\n fetch: this.#fetch.bind(this),\n websocket: this.#websocket\n });\n this.#url.hostname = server.hostname, this.#url.port = `${server.port}`;\n return;\n }\n if (protocol === \"ws+unix:\") {\n Bun.serve({\n unix: pathname,\n fetch: this.#fetch.bind(this),\n websocket: this.#websocket\n });\n return;\n }\n @throwTypeError(`Unsupported protocol: '${protocol}' (expected 'ws:', 'ws+unix:', or 'unix:')`);\n }\n get #websocket() {\n return {\n idleTimeout: 0,\n closeOnBackpressureLimit: !1,\n open: (ws) => this.#open(ws, webSocketWriter(ws)),\n message: (ws, message) => {\n if (typeof message === \"string\")\n this.#message(ws, message);\n else\n this.#error(ws, new Error(`Unexpected binary message: ${message.toString()}`));\n },\n drain: (ws) => this.#drain(ws),\n close: (ws) => this.#close(ws)\n };\n }\n #fetch(request, server) {\n const { method, url, headers } = request, { pathname } = new URL(url);\n if (method !== \"GET\")\n return new Response(null, {\n status: 405\n });\n switch (pathname) {\n case \"/json/version\":\n return Response.json(versionInfo());\n case \"/json\":\n case \"/json/list\":\n }\n if (!this.#url.protocol.includes(\"unix\") && this.#url.pathname !== pathname)\n return new Response(null, {\n status: 404\n });\n const data = {\n refEventLoop: headers.get(\"Ref-Event-Loop\") === \"0\"\n };\n if (!server.upgrade(request, { data }))\n return new Response(null, {\n status: 426,\n headers: {\n Upgrade: \"websocket\"\n }\n });\n }\n get #socket() {\n return {\n open: (socket) => this.#open(socket, socketWriter(socket)),\n data: (socket, message) => this.#message(socket, message.toString()),\n drain: (socket) => this.#drain(socket),\n close: (socket) => this.#close(socket),\n error: (socket, error) => this.#error(socket, error),\n connectError: (_, error) => exit(\"Failed to start inspector:\\n\", error)\n };\n }\n #open(connection, writer) {\n const { data } = connection, { refEventLoop } = data, client = bufferedWriter(writer), backend = this.#createBackend(refEventLoop, (...messages) => {\n for (let message of messages)\n client.write(message);\n });\n data.client = client, data.backend = backend;\n }\n #message(connection, message) {\n const { data } = connection, { backend } = data;\n backend\?.write(message);\n }\n #drain(connection) {\n const { data } = connection, { client } = data;\n client\?.drain\?.();\n }\n #close(connection) {\n const { data } = connection, { backend } = data;\n backend\?.close();\n }\n #error(connection, error) {\n const { data } = connection, { backend } = data;\n console.error(error), backend\?.close();\n }\n}\nvar defaultHostname = \"localhost\", defaultPort = 6499, { enableANSIColors } = Bun;\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral InternalFSCpSyncCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/internal/fs/cp-sync.ts\nvar areIdentical = function(srcStat, destStat) {\n return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;\n}, isSrcSubdir = function(src, dest) {\n const srcArr = normalizePathToArray(src), destArr = normalizePathToArray(dest);\n return ArrayPrototypeEvery.@call(srcArr, (cur, i) => destArr[i] === cur);\n}, cpSyncFn = function(src, dest, opts) {\n const { srcStat, destStat, skipped } = checkPathsSync(src, dest, opts);\n if (skipped)\n return;\n return checkParentPathsSync(src, srcStat, dest), checkParentDir(destStat, src, dest, opts);\n}, checkPathsSync = function(src, dest, opts) {\n if (opts.filter) {\n const shouldCopy = opts.filter(src, dest);\n if (isPromise(shouldCopy))\n throw new Error(\"Expected a boolean from the filter function, but got a promise. Use `fs.promises.cp` instead.\");\n if (!shouldCopy)\n return { __proto__: null, skipped: !0 };\n }\n const { srcStat, destStat } = getStatsSync(src, dest, opts);\n if (destStat) {\n if (areIdentical(srcStat, destStat))\n throw new Error(\"src and dest cannot be the same\");\n if (srcStat.isDirectory() && !destStat.isDirectory())\n throw new Error(`cannot overwrite directory ${src} with non-directory ${dest}`);\n if (!srcStat.isDirectory() && destStat.isDirectory())\n throw new Error(`cannot overwrite non-directory ${src} with directory ${dest}`);\n }\n if (srcStat.isDirectory() && isSrcSubdir(src, dest))\n throw new Error(`cannot copy ${src} to a subdirectory of self ${dest}`);\n return { __proto__: null, srcStat, destStat, skipped: !1 };\n}, getStatsSync = function(src, dest, opts) {\n let destStat;\n const statFunc = opts.dereference \? (file) => statSync(file, { bigint: !0 }) : (file) => lstatSync(file, { bigint: !0 }), srcStat = statFunc(src);\n try {\n destStat = statFunc(dest);\n } catch (err) {\n if (err.code === \"ENOENT\")\n return { srcStat, destStat: null };\n throw err;\n }\n return { srcStat, destStat };\n}, checkParentPathsSync = function(src, srcStat, dest) {\n const srcParent = resolve(dirname(src)), destParent = resolve(dirname(dest));\n if (destParent === srcParent || destParent === parse(destParent).root)\n return;\n let destStat;\n try {\n destStat = statSync(destParent, { bigint: !0 });\n } catch (err) {\n if (err.code === \"ENOENT\")\n return;\n throw err;\n }\n if (areIdentical(srcStat, destStat))\n throw new Error(`cannot copy ${src} to a subdirectory of self ${dest}`);\n return checkParentPathsSync(src, srcStat, destParent);\n}, checkParentDir = function(destStat, src, dest, opts) {\n const destParent = dirname(dest);\n if (!existsSync(destParent))\n mkdirSync(destParent, { recursive: !0 });\n return getStats(destStat, src, dest, opts);\n}, getStats = function(destStat, src, dest, opts) {\n const srcStat = (opts.dereference \? statSync : lstatSync)(src);\n if (srcStat.isDirectory() && opts.recursive)\n return onDir(srcStat, destStat, src, dest, opts);\n else if (srcStat.isDirectory())\n throw new Error(`${src} is a directory (not copied)`);\n else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice())\n return onFile(srcStat, destStat, src, dest, opts);\n else if (srcStat.isSymbolicLink())\n return onLink(destStat, src, dest, opts);\n else if (srcStat.isSocket())\n throw new Error(`cannot copy a socket file: ${dest}`);\n else if (srcStat.isFIFO())\n throw new Error(`cannot copy a FIFO pipe: ${dest}`);\n throw new Error(`cannot copy an unknown file type: ${dest}`);\n}, onFile = function(srcStat, destStat, src, dest, opts) {\n if (!destStat)\n return copyFile(srcStat, src, dest, opts);\n return mayCopyFile(srcStat, src, dest, opts);\n}, mayCopyFile = function(srcStat, src, dest, opts) {\n if (opts.force)\n return unlinkSync(dest), copyFile(srcStat, src, dest, opts);\n else if (opts.errorOnExist)\n throw new Error(`${dest} already exists`);\n}, copyFile = function(srcStat, src, dest, opts) {\n if (copyFileSync(src, dest, opts.mode), opts.preserveTimestamps)\n handleTimestamps(srcStat.mode, src, dest);\n return setDestMode(dest, srcStat.mode);\n}, handleTimestamps = function(srcMode, src, dest) {\n if (fileIsNotWritable(srcMode))\n makeFileWritable(dest, srcMode);\n return setDestTimestamps(src, dest);\n}, fileIsNotWritable = function(srcMode) {\n return (srcMode & 128) === 0;\n}, makeFileWritable = function(dest, srcMode) {\n return setDestMode(dest, srcMode | 128);\n}, setDestMode = function(dest, srcMode) {\n return chmodSync(dest, srcMode);\n}, setDestTimestamps = function(src, dest) {\n const updatedSrcStat = statSync(src);\n return utimesSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime);\n}, onDir = function(srcStat, destStat, src, dest, opts) {\n if (!destStat)\n return mkDirAndCopy(srcStat.mode, src, dest, opts);\n return copyDir(src, dest, opts);\n}, mkDirAndCopy = function(srcMode, src, dest, opts) {\n return mkdirSync(dest), copyDir(src, dest, opts), setDestMode(dest, srcMode);\n}, copyDir = function(src, dest, opts) {\n for (let dirent of readdirSync(src, { withFileTypes: !0 })) {\n const { name } = dirent, srcItem = join(src, name), destItem = join(dest, name), { destStat, skipped } = checkPathsSync(srcItem, destItem, opts);\n if (!skipped)\n getStats(destStat, srcItem, destItem, opts);\n }\n}, onLink = function(destStat, src, dest, opts) {\n let resolvedSrc = readlinkSync(src);\n if (!opts.verbatimSymlinks && !isAbsolute(resolvedSrc))\n resolvedSrc = resolve(dirname(src), resolvedSrc);\n if (!destStat)\n return symlinkSync(resolvedSrc, dest);\n let resolvedDest;\n try {\n resolvedDest = readlinkSync(dest);\n } catch (err) {\n if (err.code === \"EINVAL\" || err.code === \"UNKNOWN\")\n return symlinkSync(resolvedSrc, dest);\n throw err;\n }\n if (!isAbsolute(resolvedDest))\n resolvedDest = resolve(dirname(dest), resolvedDest);\n if (isSrcSubdir(resolvedSrc, resolvedDest))\n throw new Error(`cannot copy ${resolvedSrc} to a subdirectory of self ${resolvedDest}`);\n if (statSync(dest).isDirectory() && isSrcSubdir(resolvedDest, resolvedSrc))\n throw new Error(`cannot overwrite ${resolvedDest} with ${resolvedSrc}`);\n return copyLink(resolvedSrc, dest);\n}, copyLink = function(resolvedSrc, dest) {\n return unlinkSync(dest), symlinkSync(resolvedSrc, dest);\n}, ArrayPrototypeEvery = @Array.prototype.every, ArrayPrototypeFilter = @Array.prototype.filter, StringPrototypeSplit = @String.prototype.split, normalizePathToArray = (path) => ArrayPrototypeFilter.@call(StringPrototypeSplit.@call(resolve(path), sep), Boolean), {\n chmodSync,\n copyFileSync,\n existsSync,\n lstatSync,\n mkdirSync,\n readdirSync,\n readlinkSync,\n statSync,\n symlinkSync,\n unlinkSync,\n utimesSync\n} = @getInternalField(@internalModuleRegistry, 21) || @createInternalModuleById(21), { dirname, isAbsolute, join, parse, resolve, sep } = @getInternalField(@internalModuleRegistry, 30) || @createInternalModuleById(30), { isPromise } = @requireNativeModule(\"util/types\");\nreturn cpSyncFn})\n"); -// - -// -static constexpr ASCIILiteral InternalFSCpCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/internal/fs/cp.ts\nasync function cpFn(src, dest, opts) {\n const stats = await checkPaths(src, dest, opts), { srcStat, destStat, skipped } = stats;\n if (skipped)\n return;\n return await checkParentPaths(src, srcStat, dest), checkParentDir(destStat, src, dest, opts);\n}\nasync function checkPaths(src, dest, opts) {\n if (opts.filter && !await opts.filter(src, dest))\n return { __proto__: null, skipped: !0 };\n const { 0: srcStat, 1: destStat } = await getStats(src, dest, opts);\n if (destStat) {\n if (areIdentical(srcStat, destStat))\n throw new Error(\"Source and destination must not be the same.\");\n if (srcStat.isDirectory() && !destStat.isDirectory())\n throw new Error(`cannot overwrite directory ${src} with non-directory ${dest}`);\n if (!srcStat.isDirectory() && destStat.isDirectory())\n throw new Error(`cannot overwrite non-directory ${src} with directory ${dest}`);\n }\n if (srcStat.isDirectory() && isSrcSubdir(src, dest))\n throw new Error(`cannot copy ${src} to a subdirectory of self ${dest}`);\n return { __proto__: null, srcStat, destStat, skipped: !1 };\n}\nvar areIdentical = function(srcStat, destStat) {\n return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;\n}, getStats = function(src, dest, opts) {\n const statFunc = opts.dereference \? (file) => stat(file, { bigint: !0 }) : (file) => lstat(file, { bigint: !0 });\n return SafePromiseAll([\n statFunc(src),\n PromisePrototypeThen.@call(statFunc(dest), @undefined, (err) => {\n if (err.code === \"ENOENT\")\n return null;\n throw err;\n })\n ]);\n};\nasync function checkParentDir(destStat, src, dest, opts) {\n const destParent = dirname(dest);\n if (await pathExists(destParent))\n return getStatsForCopy(destStat, src, dest, opts);\n return await mkdir(destParent, { recursive: !0 }), getStatsForCopy(destStat, src, dest, opts);\n}\nvar pathExists = function(dest) {\n return PromisePrototypeThen(stat(dest), () => !0, (err) => err.code === \"ENOENT\" \? !1 : PromiseReject(err));\n};\nasync function checkParentPaths(src, srcStat, dest) {\n const srcParent = resolve(dirname(src)), destParent = resolve(dirname(dest));\n if (destParent === srcParent || destParent === parse(destParent).root)\n return;\n let destStat;\n try {\n destStat = await stat(destParent, { bigint: !0 });\n } catch (err) {\n if (err.code === \"ENOENT\")\n return;\n throw err;\n }\n if (areIdentical(srcStat, destStat))\n throw new Error(`cannot copy ${src} to a subdirectory of self ${dest}`);\n return checkParentPaths(src, srcStat, destParent);\n}\nvar isSrcSubdir = function(src, dest) {\n const srcArr = normalizePathToArray(src), destArr = normalizePathToArray(dest);\n return ArrayPrototypeEvery.@call(srcArr, (cur, i) => destArr[i] === cur);\n};\nasync function getStatsForCopy(destStat, src, dest, opts) {\n const srcStat = await (opts.dereference \? stat : lstat)(src);\n if (srcStat.isDirectory() && opts.recursive)\n return onDir(srcStat, destStat, src, dest, opts);\n else if (srcStat.isDirectory())\n throw new Error(`${src} is a directory (not copied)`);\n else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice())\n return onFile(srcStat, destStat, src, dest, opts);\n else if (srcStat.isSymbolicLink())\n return onLink(destStat, src, dest, opts);\n else if (srcStat.isSocket())\n throw new Error(`cannot copy a socket file: ${dest}`);\n else if (srcStat.isFIFO())\n throw new Error(`cannot copy a FIFO pipe: ${dest}`);\n throw new Error(`cannot copy an unknown file type: ${dest}`);\n}\nvar onFile = function(srcStat, destStat, src, dest, opts) {\n if (!destStat)\n return _copyFile(srcStat, src, dest, opts);\n return mayCopyFile(srcStat, src, dest, opts);\n};\nasync function mayCopyFile(srcStat, src, dest, opts) {\n if (opts.force)\n return await unlink(dest), _copyFile(srcStat, src, dest, opts);\n else if (opts.errorOnExist)\n throw new Error(`${dest} already exists`);\n}\nasync function _copyFile(srcStat, src, dest, opts) {\n if (await copyFile(src, dest, opts.mode), opts.preserveTimestamps)\n return handleTimestampsAndMode(srcStat.mode, src, dest);\n return setDestMode(dest, srcStat.mode);\n}\nasync function handleTimestampsAndMode(srcMode, src, dest) {\n if (fileIsNotWritable(srcMode))\n return await makeFileWritable(dest, srcMode), setDestTimestampsAndMode(srcMode, src, dest);\n return setDestTimestampsAndMode(srcMode, src, dest);\n}\nvar fileIsNotWritable = function(srcMode) {\n return (srcMode & 128) === 0;\n}, makeFileWritable = function(dest, srcMode) {\n return setDestMode(dest, srcMode | 128);\n};\nasync function setDestTimestampsAndMode(srcMode, src, dest) {\n return await setDestTimestamps(src, dest), setDestMode(dest, srcMode);\n}\nvar setDestMode = function(dest, srcMode) {\n return chmod(dest, srcMode);\n};\nasync function setDestTimestamps(src, dest) {\n const updatedSrcStat = await stat(src);\n return utimes(dest, updatedSrcStat.atime, updatedSrcStat.mtime);\n}\nvar onDir = function(srcStat, destStat, src, dest, opts) {\n if (!destStat)\n return mkDirAndCopy(srcStat.mode, src, dest, opts);\n return copyDir(src, dest, opts);\n};\nasync function mkDirAndCopy(srcMode, src, dest, opts) {\n return await mkdir(dest), await copyDir(src, dest, opts), setDestMode(dest, srcMode);\n}\nasync function copyDir(src, dest, opts) {\n const dir = await opendir(src);\n for await (let { name } of dir) {\n const srcItem = join(src, name), destItem = join(dest, name), { destStat, skipped } = await checkPaths(srcItem, destItem, opts);\n if (!skipped)\n await getStatsForCopy(destStat, srcItem, destItem, opts);\n }\n}\nasync function onLink(destStat, src, dest, opts) {\n let resolvedSrc = await readlink(src);\n if (!opts.verbatimSymlinks && !isAbsolute(resolvedSrc))\n resolvedSrc = resolve(dirname(src), resolvedSrc);\n if (!destStat)\n return symlink(resolvedSrc, dest);\n let resolvedDest;\n try {\n resolvedDest = await readlink(dest);\n } catch (err) {\n if (err.code === \"EINVAL\" || err.code === \"UNKNOWN\")\n return symlink(resolvedSrc, dest);\n throw err;\n }\n if (!isAbsolute(resolvedDest))\n resolvedDest = resolve(dirname(dest), resolvedDest);\n if (isSrcSubdir(resolvedSrc, resolvedDest))\n throw new Error(`cannot copy ${resolvedSrc} to a subdirectory of self ${resolvedDest}`);\n if ((await stat(src)).isDirectory() && isSrcSubdir(resolvedDest, resolvedSrc))\n throw new Error(`cannot overwrite ${resolvedDest} with ${resolvedSrc}`);\n return copyLink(resolvedSrc, dest);\n}\nasync function copyLink(resolvedSrc, dest) {\n return await unlink(dest), symlink(resolvedSrc, dest);\n}\nvar { chmod, copyFile, lstat, mkdir, opendir, readlink, stat, symlink, unlink, utimes } = @getInternalField(@internalModuleRegistry, 22) || @createInternalModuleById(22), { dirname, isAbsolute, join, parse, resolve, sep } = @getInternalField(@internalModuleRegistry, 30) || @createInternalModuleById(30), SafePromiseAll = @Promise.all, PromisePrototypeThen = @Promise.prototype.then, PromiseReject = @Promise.reject, ArrayPrototypeFilter = @Array.prototype.filter, StringPrototypeSplit = @String.prototype.split, ArrayPrototypeEvery = @Array.prototype.every, normalizePathToArray = (path) => ArrayPrototypeFilter.@call(StringPrototypeSplit(resolve(path), sep), Boolean);\nreturn cpFn})\n"); -// - -// -static constexpr ASCIILiteral InternalPrimordialsCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/internal/primordials.ts\nvar getGetter = function(cls, getter) {\n return FunctionPrototypeCall.bind(cls.prototype.__lookupGetter__(getter));\n}, uncurryThis = function(func) {\n return FunctionPrototypeCall.bind(func);\n}, ErrorCaptureStackTrace = function(targetObject) {\n const stack = new Error().stack;\n targetObject.stack = stack.replace(/.*\\n.*/, \"$1\");\n}, $, createSafeIterator = (factory, next) => {\n\n class SafeIterator {\n constructor(iterable) {\n this._iterator = factory(iterable);\n }\n next() {\n return next(this._iterator);\n }\n [Symbol.iterator]() {\n return this;\n }\n }\n return Object.setPrototypeOf(SafeIterator.prototype, null), Object.freeze(SafeIterator.prototype), Object.freeze(SafeIterator), SafeIterator;\n}, FunctionPrototypeCall = @getByIdDirect(Function.prototype, \"call\"), copyProps = (src, dest) => {\n ArrayPrototypeForEach(Reflect.ownKeys(src), (key) => {\n if (!Reflect.getOwnPropertyDescriptor(dest, key))\n Reflect.defineProperty(dest, key, Reflect.getOwnPropertyDescriptor(src, key));\n });\n}, makeSafe = (unsafe, safe) => {\n if (Symbol.iterator in unsafe.prototype) {\n const dummy = new unsafe;\n let next;\n ArrayPrototypeForEach(Reflect.ownKeys(unsafe.prototype), (key) => {\n if (!Reflect.getOwnPropertyDescriptor(safe.prototype, key)) {\n const desc = Reflect.getOwnPropertyDescriptor(unsafe.prototype, key);\n if (typeof desc.value === \"function\" && desc.value.length === 0 && (Symbol.iterator in (desc.value.@call(dummy) || {}))) {\n const createIterator = uncurryThis(desc.value);\n next \?\?= uncurryThis(createIterator(dummy).next);\n const SafeIterator = createSafeIterator(createIterator, next);\n desc.value = function() {\n return new SafeIterator(this);\n };\n }\n Reflect.defineProperty(safe.prototype, key, desc);\n }\n });\n } else\n copyProps(unsafe.prototype, safe.prototype);\n return copyProps(unsafe, safe), Object.setPrototypeOf(safe.prototype, null), Object.freeze(safe.prototype), Object.freeze(safe), safe;\n}, StringIterator = uncurryThis(@String.prototype[Symbol.iterator]), StringIteratorPrototype = Reflect.getPrototypeOf(StringIterator(\"\")), ArrayPrototypeForEach = uncurryThis(@Array.prototype.forEach), arrayProtoPush = @Array.prototype.push;\n$ = {\n makeSafe,\n Array: @Array,\n ArrayFrom: @Array.from,\n ArrayIsArray: @Array.isArray,\n ArrayPrototypeFlat: uncurryThis(@Array.prototype.flat),\n ArrayPrototypeFilter: uncurryThis(@Array.prototype.filter),\n ArrayPrototypeForEach,\n ArrayPrototypeIncludes: uncurryThis(@Array.prototype.includes),\n ArrayPrototypeIndexOf: uncurryThis(@Array.prototype.indexOf),\n ArrayPrototypeJoin: uncurryThis(@Array.prototype.join),\n ArrayPrototypeMap: uncurryThis(@Array.prototype.map),\n ArrayPrototypePop: uncurryThis(@Array.prototype.pop),\n ArrayPrototypePush: uncurryThis(arrayProtoPush),\n ArrayPrototypePushApply: (a, b) => arrayProtoPush.@apply(a, b),\n ArrayPrototypeSlice: uncurryThis(@Array.prototype.slice),\n ArrayPrototypeSort: uncurryThis(@Array.prototype.sort),\n ArrayPrototypeSplice: uncurryThis(@Array.prototype.splice),\n ArrayPrototypeUnshift: uncurryThis(@Array.prototype.unshift),\n BigIntPrototypeValueOf: uncurryThis(BigInt.prototype.valueOf),\n BooleanPrototypeValueOf: uncurryThis(Boolean.prototype.valueOf),\n DatePrototypeGetTime: uncurryThis(Date.prototype.getTime),\n DatePrototypeToISOString: uncurryThis(Date.prototype.toISOString),\n DatePrototypeToString: uncurryThis(Date.prototype.toString),\n ErrorCaptureStackTrace,\n ErrorPrototypeToString: uncurryThis(Error.prototype.toString),\n FunctionPrototypeToString: uncurryThis(Function.prototype.toString),\n JSONStringify: JSON.stringify,\n MapPrototypeGetSize: getGetter(Map, \"size\"),\n MapPrototypeEntries: uncurryThis(Map.prototype.entries),\n MapPrototypeValues: uncurryThis(Map.prototype.values),\n MapPrototypeKeys: uncurryThis(Map.prototype.keys),\n MathFloor: Math.floor,\n MathMax: Math.max,\n MathMin: Math.min,\n MathRound: Math.round,\n MathSqrt: Math.sqrt,\n MathTrunc: Math.trunc,\n Number,\n NumberIsFinite: Number.isFinite,\n NumberIsNaN: Number.isNaN,\n NumberParseFloat: Number.parseFloat,\n NumberParseInt: Number.parseInt,\n NumberPrototypeToString: uncurryThis(Number.prototype.toString),\n NumberPrototypeValueOf: uncurryThis(Number.prototype.valueOf),\n Object,\n ObjectAssign: Object.assign,\n ObjectCreate: Object.create,\n ObjectDefineProperty: Object.defineProperty,\n ObjectEntries: Object.entries,\n ObjectGetOwnPropertyDescriptor: Object.getOwnPropertyDescriptor,\n ObjectGetOwnPropertyDescriptors: Object.getOwnPropertyDescriptors,\n ObjectGetOwnPropertyNames: Object.getOwnPropertyNames,\n ObjectGetOwnPropertySymbols: Object.getOwnPropertySymbols,\n ObjectGetPrototypeOf: Object.getPrototypeOf,\n ObjectIs: Object.is,\n ObjectKeys: Object.keys,\n ObjectPrototypeHasOwnProperty: uncurryThis(Object.prototype.hasOwnProperty),\n ObjectPrototypePropertyIsEnumerable: uncurryThis(Object.prototype.propertyIsEnumerable),\n ObjectPrototypeToString: uncurryThis(Object.prototype.toString),\n ObjectSeal: Object.seal,\n ObjectSetPrototypeOf: Object.setPrototypeOf,\n ReflectApply: @getByIdDirect(Reflect, \"apply\"),\n ReflectOwnKeys: Reflect.ownKeys,\n RegExp: @RegExp,\n RegExpPrototypeExec: uncurryThis(@RegExp.prototype.exec),\n RegExpPrototypeSymbolReplace: uncurryThis(@RegExp.prototype[Symbol.replace]),\n RegExpPrototypeSymbolSplit: uncurryThis(@RegExp.prototype[Symbol.split]),\n RegExpPrototypeTest: uncurryThis(@RegExp.prototype.test),\n RegExpPrototypeToString: uncurryThis(@RegExp.prototype.toString),\n SafeStringIterator: createSafeIterator(StringIterator, uncurryThis(StringIteratorPrototype.next)),\n SafeMap: makeSafe(Map, class SafeMap extends Map {\n constructor(i) {\n super(i);\n }\n }),\n SafeSet: makeSafe(Set, class SafeSet extends Set {\n constructor(i) {\n super(i);\n }\n }),\n SetPrototypeGetSize: getGetter(Set, \"size\"),\n SetPrototypeEntries: uncurryThis(Set.prototype.entries),\n SetPrototypeValues: uncurryThis(Set.prototype.values),\n String: @String,\n StringPrototypeCharCodeAt: uncurryThis(@String.prototype.charCodeAt),\n StringPrototypeCodePointAt: uncurryThis(@String.prototype.codePointAt),\n StringPrototypeEndsWith: uncurryThis(@String.prototype.endsWith),\n StringPrototypeIncludes: uncurryThis(@String.prototype.includes),\n StringPrototypeIndexOf: uncurryThis(@String.prototype.indexOf),\n StringPrototypeLastIndexOf: uncurryThis(@String.prototype.lastIndexOf),\n StringPrototypeMatch: uncurryThis(@String.prototype.match),\n StringPrototypeNormalize: uncurryThis(@String.prototype.normalize),\n StringPrototypePadEnd: uncurryThis(@String.prototype.padEnd),\n StringPrototypePadStart: uncurryThis(@String.prototype.padStart),\n StringPrototypeRepeat: uncurryThis(@String.prototype.repeat),\n StringPrototypeReplace: uncurryThis(@String.prototype.replace),\n StringPrototypeReplaceAll: uncurryThis(@String.prototype.replaceAll),\n StringPrototypeSlice: uncurryThis(@String.prototype.slice),\n StringPrototypeSplit: uncurryThis(@String.prototype.split),\n StringPrototypeStartsWith: uncurryThis(@String.prototype.startsWith),\n StringPrototypeToLowerCase: uncurryThis(@String.prototype.toLowerCase),\n StringPrototypeTrim: uncurryThis(@String.prototype.trim),\n StringPrototypeValueOf: uncurryThis(@String.prototype.valueOf),\n SymbolPrototypeToString: uncurryThis(Symbol.prototype.toString),\n SymbolPrototypeValueOf: uncurryThis(Symbol.prototype.valueOf),\n FunctionPrototypeToString: uncurryThis(Function.prototype.toString),\n FunctionPrototypeBind: uncurryThis(Function.prototype.bind),\n SymbolIterator: Symbol.iterator,\n SymbolFor: Symbol.for,\n SymbolToStringTag: Symbol.toStringTag,\n TypedArrayPrototypeGetLength: getGetter(@Uint8Array, \"length\"),\n TypedArrayPrototypeGetSymbolToStringTag: getGetter(@Uint8Array, Symbol.toStringTag),\n Uint8ClampedArray,\n Uint8Array: @Uint8Array,\n Uint16Array,\n Uint32Array,\n Int8Array,\n Int16Array,\n Int32Array,\n Float32Array,\n Float64Array,\n BigUint64Array,\n BigInt64Array,\n uncurryThis\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral InternalSharedCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/internal/shared.ts\nvar throwNotImplemented = function(feature, issue) {\n throw hideFromStack(throwNotImplemented), new NotImplementedError(feature, issue);\n}, hideFromStack = function(...fns) {\n for (let fn of fns)\n Object.defineProperty(fn, \"name\", {\n value: \"::bunternal::\"\n });\n}, $;\n\nclass NotImplementedError extends Error {\n code;\n constructor(feature, issue) {\n super(feature + \" is not yet implemented in Bun.\" + (issue \? \" Track the status & thumbs up the issue: https://github.com/oven-sh/bun/issues/\" + issue : \"\"));\n this.name = \"NotImplementedError\", this.code = \"ERR_NOT_IMPLEMENTED\", hideFromStack(NotImplementedError);\n }\n}\n$ = {\n NotImplementedError,\n throwNotImplemented,\n hideFromStack\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral InternalUtilInspectCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/internal/util/inspect.ts\nvar vmSafeInstanceof = function(val, ctor) {\n if (val instanceof ctor)\n return !0;\n while (val) {\n if (typeof val !== \"object\")\n return !1;\n if (ctor.name === internalGetConstructorName(val))\n return !0;\n val = ObjectGetPrototypeOf(val);\n }\n return !1;\n}, checkBox = function(ctor) {\n return (val) => {\n if (!vmSafeInstanceof(val, ctor))\n return !1;\n try {\n ctor.prototype.valueOf.@call(val);\n } catch {\n return !1;\n }\n return !0;\n };\n}, assert = function(p, message) {\n if (!p)\n throw new AssertionError(message);\n}, getUserOptions = function(ctx, isCrossContext) {\n const ret = {\n stylize: ctx.stylize,\n showHidden: ctx.showHidden,\n depth: ctx.depth,\n colors: ctx.colors,\n customInspect: ctx.customInspect,\n showProxy: ctx.showProxy,\n maxArrayLength: ctx.maxArrayLength,\n maxStringLength: ctx.maxStringLength,\n breakLength: ctx.breakLength,\n compact: ctx.compact,\n sorted: ctx.sorted,\n getters: ctx.getters,\n numericSeparator: ctx.numericSeparator,\n ...ctx.userOptions\n };\n if (isCrossContext) {\n ObjectSetPrototypeOf(ret, null);\n for (let key of ObjectKeys(ret))\n if ((typeof ret[key] === \"object\" || typeof ret[key] === \"function\") && ret[key] !== null)\n delete ret[key];\n ret.stylize = ObjectSetPrototypeOf((value, flavour) => {\n let stylized;\n try {\n stylized = `${ctx.stylize(value, flavour)}`;\n } catch {\n }\n if (typeof stylized !== \"string\")\n return value;\n return stylized;\n }, null);\n }\n return ret;\n}, inspect = function(value, opts) {\n const ctx = {\n budget: {},\n indentationLvl: 0,\n seen: [],\n currentDepth: 0,\n stylize: stylizeNoColor,\n showHidden: inspectDefaultOptions.showHidden,\n depth: inspectDefaultOptions.depth,\n colors: inspectDefaultOptions.colors,\n customInspect: inspectDefaultOptions.customInspect,\n showProxy: inspectDefaultOptions.showProxy,\n maxArrayLength: inspectDefaultOptions.maxArrayLength,\n maxStringLength: inspectDefaultOptions.maxStringLength,\n breakLength: inspectDefaultOptions.breakLength,\n compact: inspectDefaultOptions.compact,\n sorted: inspectDefaultOptions.sorted,\n getters: inspectDefaultOptions.getters,\n numericSeparator: inspectDefaultOptions.numericSeparator\n };\n if (arguments.length > 1) {\n if (arguments.length > 2) {\n if (arguments[2] !== @undefined)\n ctx.depth = arguments[2];\n if (arguments.length > 3 && arguments[3] !== @undefined)\n ctx.colors = arguments[3];\n }\n if (typeof opts === \"boolean\")\n ctx.showHidden = opts;\n else if (opts) {\n const optKeys = ObjectKeys(opts);\n for (let i = 0;i < optKeys.length; ++i) {\n const key = optKeys[i];\n if (ObjectPrototypeHasOwnProperty(inspectDefaultOptions, key) || key === \"stylize\")\n ctx[key] = opts[key];\n else if (ctx.userOptions === @undefined)\n ctx.userOptions = opts;\n }\n }\n }\n if (ctx.colors)\n ctx.stylize = stylizeWithColor;\n if (ctx.maxArrayLength === null)\n ctx.maxArrayLength = @Infinity;\n if (ctx.maxStringLength === null)\n ctx.maxStringLength = @Infinity;\n return formatValue(ctx, value, 0);\n}, defineColorAlias = function(target, alias) {\n ObjectDefineProperty(inspect.colors, alias, {\n __proto__: null,\n get() {\n return this[target];\n },\n set(value) {\n this[target] = value;\n },\n configurable: !0,\n enumerable: !1\n });\n}, addQuotes = function(str, quotes) {\n if (quotes === -1)\n return `\"${str}\"`;\n if (quotes === -2)\n return `\\`${str}\\``;\n return `'${str}'`;\n}, escapeFn = function(str) {\n const charCode = StringPrototypeCharCodeAt(str);\n return meta.length > charCode \? meta[charCode] : `\\\\u${NumberPrototypeToString(charCode, 16)}`;\n}, strEscape = function(str) {\n let escapeTest = strEscapeSequencesRegExp, escapeReplace = strEscapeSequencesReplacer, singleQuote = 39;\n if (StringPrototypeIncludes(str, \"'\")) {\n if (!StringPrototypeIncludes(str, '\"'))\n singleQuote = -1;\n else if (!StringPrototypeIncludes(str, \"`\") && !StringPrototypeIncludes(str, \"${\"))\n singleQuote = -2;\n if (singleQuote !== 39)\n escapeTest = strEscapeSequencesRegExpSingle, escapeReplace = strEscapeSequencesReplacerSingle;\n }\n if (str.length < 5000 && RegExpPrototypeExec(escapeTest, str) === null)\n return addQuotes(str, singleQuote);\n if (str.length > 100)\n return str = RegExpPrototypeSymbolReplace(escapeReplace, str, escapeFn), addQuotes(str, singleQuote);\n let result = \"\", last = 0;\n for (let i = 0;i < str.length; i++) {\n const point = StringPrototypeCharCodeAt(str, i);\n if (point === singleQuote || point === 92 || point < 32 || point > 126 && point < 160) {\n if (last === i)\n result += meta[point];\n else\n result += `${StringPrototypeSlice(str, last, i)}${meta[point]}`;\n last = i + 1;\n } else if (point >= 55296 && point <= 57343) {\n if (point <= 56319 && i + 1 < str.length) {\n const point2 = StringPrototypeCharCodeAt(str, i + 1);\n if (point2 >= 56320 && point2 <= 57343) {\n i++;\n continue;\n }\n }\n result += `${StringPrototypeSlice(str, last, i)}\\\\u${NumberPrototypeToString(point, 16)}`, last = i + 1;\n }\n }\n if (last !== str.length)\n result += StringPrototypeSlice(str, last);\n return addQuotes(result, singleQuote);\n}, stylizeWithColor = function(str, styleType) {\n const style = inspect.styles[styleType];\n if (style !== @undefined) {\n const color = inspect.colors[style];\n if (color !== @undefined)\n return `\\x1B[${color[0]}m${str}\\x1B[${color[1]}m`;\n }\n return str;\n}, stylizeNoColor = function(str) {\n return str;\n}, getEmptyFormatArray = function() {\n return [];\n}, isInstanceof = function(object, proto) {\n try {\n return object instanceof proto;\n } catch {\n return !1;\n }\n}, getConstructorName = function(obj, ctx, recurseTimes, protoProps) {\n let firstProto;\n const tmp = obj;\n while (obj || isUndetectableObject(obj)) {\n const descriptor = ObjectGetOwnPropertyDescriptor(obj, \"constructor\");\n if (descriptor !== @undefined && typeof descriptor.value === \"function\" && descriptor.value.name !== \"\" && isInstanceof(tmp, descriptor.value)) {\n if (protoProps !== @undefined && (firstProto !== obj || !builtInObjects.has(descriptor.value.name)))\n addPrototypeProperties(ctx, tmp, firstProto || tmp, recurseTimes, protoProps);\n return String(descriptor.value.name);\n }\n if (obj = ObjectGetPrototypeOf(obj), firstProto === @undefined)\n firstProto = obj;\n }\n if (firstProto === null)\n return null;\n const res = internalGetConstructorName(tmp);\n if (recurseTimes > ctx.depth && ctx.depth !== null)\n return `${res} `;\n const protoConstr = getConstructorName(firstProto, ctx, recurseTimes + 1, protoProps);\n if (protoConstr === null)\n return `${res} <${inspect(firstProto, {\n ...ctx,\n customInspect: !1,\n depth: -1\n })}>`;\n return `${res} <${protoConstr}>`;\n}, addPrototypeProperties = function(ctx, main, obj, recurseTimes, output) {\n let depth = 0, keys, keySet;\n do {\n if (depth !== 0 || main === obj) {\n if (obj = ObjectGetPrototypeOf(obj), obj === null)\n return;\n const descriptor = ObjectGetOwnPropertyDescriptor(obj, \"constructor\");\n if (descriptor !== @undefined && typeof descriptor.value === \"function\" && builtInObjects.has(descriptor.value.name))\n return;\n }\n if (depth === 0)\n keySet = new SafeSet;\n else\n ArrayPrototypeForEach(keys, (key) => keySet.add(key));\n keys = ReflectOwnKeys(obj), ArrayPrototypePush(ctx.seen, main);\n for (let key of keys) {\n if (key === \"constructor\" || ObjectPrototypeHasOwnProperty(main, key) || depth !== 0 && keySet.has(key))\n continue;\n const desc = ObjectGetOwnPropertyDescriptor(obj, key);\n if (typeof desc.value === \"function\")\n continue;\n const value = formatProperty(ctx, obj, recurseTimes, key, kObjectType, desc, main);\n if (ctx.colors)\n ArrayPrototypePush(output, `\\x1B[2m${value}\\x1B[22m`);\n else\n ArrayPrototypePush(output, value);\n }\n ArrayPrototypePop(ctx.seen);\n } while (++depth !== 3);\n}, getPrefix = function(constructor, tag, fallback, size = \"\") {\n if (constructor === null) {\n if (tag !== \"\" && fallback !== tag)\n return `[${fallback}${size}: null prototype] [${tag}] `;\n return `[${fallback}${size}: null prototype] `;\n }\n if (tag !== \"\" && constructor !== tag)\n return `${constructor}${size} [${tag}] `;\n return `${constructor}${size} `;\n}, getKeys = function(value, showHidden) {\n let keys;\n const symbols = ObjectGetOwnPropertySymbols(value);\n if (showHidden) {\n if (keys = ObjectGetOwnPropertyNames(value), symbols.length !== 0)\n ArrayPrototypePushApply(keys, symbols);\n } else {\n try {\n keys = ObjectKeys(value);\n } catch (err) {\n assert(isNativeError(err) && err.name === \"ReferenceError\" && isModuleNamespaceObject(value)), keys = ObjectGetOwnPropertyNames(value);\n }\n if (symbols.length !== 0)\n ArrayPrototypePushApply(keys, ArrayPrototypeFilter(symbols, (key) => ObjectPrototypePropertyIsEnumerable(value, key)));\n }\n return keys;\n}, getCtxStyle = function(value, constructor, tag) {\n let fallback = \"\";\n if (constructor === null) {\n if (fallback = internalGetConstructorName(value), fallback === tag)\n fallback = \"Object\";\n }\n return getPrefix(constructor, tag, fallback);\n}, formatProxy = function(ctx, proxy, recurseTimes) {\n if (recurseTimes > ctx.depth && ctx.depth !== null)\n return ctx.stylize(\"Proxy [Array]\", \"special\");\n recurseTimes += 1, ctx.indentationLvl += 2;\n const res = [formatValue(ctx, proxy[0], recurseTimes), formatValue(ctx, proxy[1], recurseTimes)];\n return ctx.indentationLvl -= 2, reduceToSingleString(ctx, res, \"\", [\"Proxy [\", \"]\"], kArrayExtrasType, recurseTimes);\n}, formatValue = function(ctx, value, recurseTimes, typedArray) {\n if (typeof value !== \"object\" && typeof value !== \"function\" && !isUndetectableObject(value))\n return formatPrimitive(ctx.stylize, value, ctx);\n if (value === null)\n return ctx.stylize(\"null\", \"null\");\n const context = value, proxy = getProxyDetails(value, !!ctx.showProxy);\n if (proxy !== @undefined) {\n if (proxy === null || proxy[0] === null)\n return ctx.stylize(\"\", \"special\");\n if (ctx.showProxy)\n return formatProxy(ctx, proxy, recurseTimes);\n value = proxy;\n }\n if (ctx.customInspect) {\n const maybeCustom = value[customInspectSymbol];\n if (typeof maybeCustom === \"function\" && maybeCustom !== inspect && !(value.constructor && value.constructor.prototype === value)) {\n const depth = ctx.depth === null \? null : ctx.depth - recurseTimes, isCrossContext = proxy !== @undefined || !(context instanceof Object), ret = maybeCustom.@call(context, depth, getUserOptions(ctx, isCrossContext), inspect);\n if (ret !== context) {\n if (typeof ret !== \"string\")\n return formatValue(ctx, ret, recurseTimes);\n return StringPrototypeReplaceAll(ret, \"\\n\", `\\n${StringPrototypeRepeat(\" \", ctx.indentationLvl)}`);\n }\n }\n }\n if (ctx.seen.includes(value)) {\n let index = 1;\n if (ctx.circular === @undefined)\n ctx.circular = new SafeMap, ctx.circular.set(value, index);\n else if (index = ctx.circular.get(value), index === @undefined)\n index = ctx.circular.size + 1, ctx.circular.set(value, index);\n return ctx.stylize(`[Circular *${index}]`, \"special\");\n }\n return formatRaw(ctx, value, recurseTimes, typedArray);\n}, formatRaw = function(ctx, value, recurseTimes, typedArray) {\n let keys, protoProps;\n if (ctx.showHidden && (recurseTimes <= ctx.depth || ctx.depth === null))\n protoProps = [];\n const constructor = getConstructorName(value, ctx, recurseTimes, protoProps);\n if (protoProps !== @undefined && protoProps.length === 0)\n protoProps = @undefined;\n let tag = value[SymbolToStringTag];\n if (typeof tag !== \"string\" || tag !== \"\" && (ctx.showHidden \? ObjectPrototypeHasOwnProperty : ObjectPrototypePropertyIsEnumerable)(value, SymbolToStringTag))\n tag = \"\";\n let base = \"\", formatter = getEmptyFormatArray, braces, noIterator = !0, i = 0;\n const filter = ctx.showHidden \? 0 : 2;\n let extrasType = kObjectType;\n if ((SymbolIterator in value) || constructor === null)\n if (noIterator = !1, ArrayIsArray(value)) {\n const prefix = constructor !== \"Array\" || tag !== \"\" \? getPrefix(constructor, tag, \"Array\", `(${value.length})`) : \"\";\n if (keys = getOwnNonIndexProperties(value, filter), braces = [`${prefix}[`, \"]\"], value.length === 0 && keys.length === 0 && protoProps === @undefined)\n return `${braces[0]}]`;\n extrasType = kArrayExtrasType, formatter = formatArray;\n } else if (isSet(value)) {\n const size = SetPrototypeGetSize(value), prefix = getPrefix(constructor, tag, \"Set\", `(${size})`);\n if (keys = getKeys(value, ctx.showHidden), formatter = constructor !== null \? FunctionPrototypeBind(formatSet, null, value) : FunctionPrototypeBind(formatSet, null, SetPrototypeValues(value)), size === 0 && keys.length === 0 && protoProps === @undefined)\n return `${prefix}{}`;\n braces = [`${prefix}{`, \"}\"];\n } else if (isMap(value)) {\n const size = MapPrototypeGetSize(value), prefix = getPrefix(constructor, tag, \"Map\", `(${size})`);\n if (keys = getKeys(value, ctx.showHidden), formatter = constructor !== null \? FunctionPrototypeBind(formatMap, null, value) : FunctionPrototypeBind(formatMap, null, MapPrototypeEntries(value)), size === 0 && keys.length === 0 && protoProps === @undefined)\n return `${prefix}{}`;\n braces = [`${prefix}{`, \"}\"];\n } else if (isTypedArray(value)) {\n keys = getOwnNonIndexProperties(value, filter);\n let bound = value, fallback = \"\";\n if (constructor === null)\n fallback = TypedArrayPrototypeGetSymbolToStringTag(value), bound = new primordials[fallback](value);\n const size = TypedArrayPrototypeGetLength(value);\n if (braces = [`${getPrefix(constructor, tag, fallback, `(${size})`)}[`, \"]\"], value.length === 0 && keys.length === 0 && !ctx.showHidden)\n return `${braces[0]}]`;\n formatter = FunctionPrototypeBind(formatTypedArray, null, bound, size), extrasType = kArrayExtrasType;\n } else if (isMapIterator(value))\n keys = getKeys(value, ctx.showHidden), braces = getIteratorBraces(\"Map\", tag), formatter = FunctionPrototypeBind(formatIterator, null, braces);\n else if (isSetIterator(value))\n keys = getKeys(value, ctx.showHidden), braces = getIteratorBraces(\"Set\", tag), formatter = FunctionPrototypeBind(formatIterator, null, braces);\n else\n noIterator = !0;\n if (noIterator)\n if (keys = getKeys(value, ctx.showHidden), braces = [\"{\", \"}\"], constructor === \"Object\") {\n if (isArgumentsObject(value))\n braces[0] = \"[Arguments] {\";\n else if (tag !== \"\")\n braces[0] = `${getPrefix(constructor, tag, \"Object\")}{`;\n if (keys.length === 0 && protoProps === @undefined)\n return `${braces[0]}}`;\n } else if (typeof value === \"function\") {\n if (base = getFunctionBase(value, constructor, tag), keys.length === 0 && protoProps === @undefined)\n return ctx.stylize(base, \"special\");\n } else if (isRegExp(value)) {\n base = RegExpPrototypeToString(constructor !== null \? value : new RegExp(value));\n const prefix = getPrefix(constructor, tag, \"RegExp\");\n if (prefix !== \"RegExp \")\n base = `${prefix}${base}`;\n if (keys.length === 0 && protoProps === @undefined || recurseTimes > ctx.depth && ctx.depth !== null)\n return ctx.stylize(base, \"regexp\");\n } else if (isDate(value)) {\n base = NumberIsNaN(DatePrototypeGetTime(value)) \? DatePrototypeToString(value) : DatePrototypeToISOString(value);\n const prefix = getPrefix(constructor, tag, \"Date\");\n if (prefix !== \"Date \")\n base = `${prefix}${base}`;\n if (keys.length === 0 && protoProps === @undefined)\n return ctx.stylize(base, \"date\");\n } else if (value instanceof Error) {\n if (base = formatError(value, constructor, tag, ctx, keys), keys.length === 0 && protoProps === @undefined)\n return base;\n } else if (isAnyArrayBuffer(value)) {\n const arrayType = isArrayBuffer(value) \? \"ArrayBuffer\" : \"SharedArrayBuffer\", prefix = getPrefix(constructor, tag, arrayType);\n if (typedArray === @undefined)\n formatter = formatArrayBuffer;\n else if (keys.length === 0 && protoProps === @undefined)\n return prefix + `{ byteLength: ${formatNumber(ctx.stylize, value.byteLength, !1)} }`;\n braces[0] = `${prefix}{`, ArrayPrototypeUnshift(keys, \"byteLength\");\n } else if (isDataView(value))\n braces[0] = `${getPrefix(constructor, tag, \"DataView\")}{`, ArrayPrototypeUnshift(keys, \"byteLength\", \"byteOffset\", \"buffer\");\n else if (isPromise(value))\n braces[0] = `${getPrefix(constructor, tag, \"Promise\")}{`, formatter = formatPromise;\n else if (isWeakSet(value))\n braces[0] = `${getPrefix(constructor, tag, \"WeakSet\")}{`, formatter = ctx.showHidden \? formatWeakSet : formatWeakCollection;\n else if (isWeakMap(value))\n braces[0] = `${getPrefix(constructor, tag, \"WeakMap\")}{`, formatter = ctx.showHidden \? formatWeakMap : formatWeakCollection;\n else if (isModuleNamespaceObject(value))\n braces[0] = `${getPrefix(constructor, tag, \"Module\")}{`, formatter = formatNamespaceObject.bind(null, keys);\n else if (isBoxedPrimitive(value)) {\n if (base = getBoxedBase(value, ctx, keys, constructor, tag), keys.length === 0 && protoProps === @undefined)\n return base;\n } else {\n if (keys.length === 0 && protoProps === @undefined) {\n if (isExternal(value))\n return ctx.stylize(\"[External: 0]\", \"special\");\n return `${getCtxStyle(value, constructor, tag)}{}`;\n }\n braces[0] = `${getCtxStyle(value, constructor, tag)}{`;\n }\n if (recurseTimes > ctx.depth && ctx.depth !== null) {\n let constructorName = StringPrototypeSlice(getCtxStyle(value, constructor, tag), 0, -1);\n if (constructor !== null)\n constructorName = `[${constructorName}]`;\n return ctx.stylize(constructorName, \"special\");\n }\n recurseTimes += 1, ctx.seen.push(value), ctx.currentDepth = recurseTimes;\n let output;\n const indentationLvl = ctx.indentationLvl;\n try {\n if (ctx.currentDepth > 1000)\n @throwRangeError(ERROR_STACK_OVERFLOW_MSG);\n output = formatter(ctx, value, recurseTimes);\n for (i = 0;i < keys.length; i++)\n ArrayPrototypePush(output, formatProperty(ctx, value, recurseTimes, keys[i], extrasType));\n if (protoProps !== @undefined)\n ArrayPrototypePushApply(output, protoProps);\n } catch (err) {\n if (err instanceof RangeError && err.message === ERROR_STACK_OVERFLOW_MSG) {\n const constructorName = StringPrototypeSlice(getCtxStyle(value, constructor, tag), 0, -1);\n return ctx.seen.pop(), ctx.indentationLvl = indentationLvl, ctx.stylize(`[${constructorName}: Inspection interrupted prematurely. Maximum call stack size exceeded.]`, \"special\");\n }\n throw new AssertionError(\"handleMaxCallStackSize assertion failed: \" + String(err), !0);\n }\n if (ctx.circular !== @undefined) {\n const index = ctx.circular.get(value);\n if (index !== @undefined)\n if (ctx.seenRefs \?\?= new Set, !ctx.seenRefs.has(index)) {\n ctx.seenRefs.add(index);\n const reference = ctx.stylize(``, \"special\");\n if (ctx.compact !== !0)\n base = base === \"\" \? reference : `${reference} ${base}`;\n else\n braces[0] = `${reference} ${braces[0]}`;\n } else {\n //! this is a non-standard behavior compared to Node's implementation\n return ctx.stylize(`[Circular *${index}]`, \"special\");\n }\n }\n if (ctx.seen.pop(), ctx.sorted) {\n const comparator = ctx.sorted === !0 \? @undefined : ctx.sorted;\n if (extrasType === kObjectType)\n ArrayPrototypeSort(output, comparator);\n else if (keys.length > 1) {\n const sorted = ArrayPrototypeSort(ArrayPrototypeSlice(output, output.length - keys.length), comparator);\n ArrayPrototypeUnshift(sorted, output, output.length - keys.length, keys.length), ReflectApply(ArrayPrototypeSplice, null, sorted);\n }\n }\n const res = reduceToSingleString(ctx, output, base, braces, extrasType, recurseTimes, value), newLength = (ctx.budget[ctx.indentationLvl] || 0) + res.length;\n if (ctx.budget[ctx.indentationLvl] = newLength, newLength > 134217728)\n ctx.depth = -1;\n return res;\n}, getIteratorBraces = function(type, tag) {\n if (tag !== `${type} Iterator`) {\n if (tag !== \"\")\n tag += \"] [\";\n tag += `${type} Iterator`;\n }\n return [`[${tag}] {`, \"}\"];\n}, getBoxedBase = function(value, ctx, keys, constructor, tag) {\n let fn, type;\n if (isNumberObject(value))\n fn = NumberPrototypeValueOf, type = \"Number\";\n else if (isStringObject(value))\n fn = StringPrototypeValueOf, type = \"String\", keys.splice(0, value.length);\n else if (isBooleanObject(value))\n fn = BooleanPrototypeValueOf, type = \"Boolean\";\n else if (isBigIntObject(value))\n fn = BigIntPrototypeValueOf, type = \"BigInt\";\n else\n fn = SymbolPrototypeValueOf, type = \"Symbol\";\n let base = `[${type}`;\n if (type !== constructor)\n if (constructor === null)\n base += \" (null prototype)\";\n else\n base += ` (${constructor})`;\n if (base += `: ${formatPrimitive(stylizeNoColor, fn(value), ctx)}]`, tag !== \"\" && tag !== constructor)\n base += ` [${tag}]`;\n if (keys.length !== 0 || ctx.stylize === stylizeNoColor)\n return base;\n return ctx.stylize(base, StringPrototypeToLowerCase(type));\n}, getClassBase = function(value, constructor, tag) {\n let base = `class ${ObjectPrototypeHasOwnProperty(value, \"name\") && value.name || \"(anonymous)\"}`;\n if (constructor !== \"Function\" && constructor !== null)\n base += ` [${constructor}]`;\n if (tag !== \"\" && constructor !== tag)\n base += ` [${tag}]`;\n if (constructor !== null) {\n const superName = ObjectGetPrototypeOf(value).name;\n if (superName)\n base += ` extends ${superName}`;\n } else\n base += \" extends [null prototype]\";\n return `[${base}]`;\n}, getFunctionBase = function(value, constructor, tag) {\n const stringified = FunctionPrototypeToString(value);\n if (StringPrototypeStartsWith(stringified, \"class\") && StringPrototypeEndsWith(stringified, \"}\")) {\n const slice = StringPrototypeSlice(stringified, 5, -1), bracketIndex = StringPrototypeIndexOf(slice, \"{\");\n if (bracketIndex !== -1 && (!StringPrototypeIncludes(StringPrototypeSlice(slice, 0, bracketIndex), \"(\") || RegExpPrototypeExec(classRegExp, RegExpPrototypeSymbolReplace(stripCommentsRegExp, slice)) !== null))\n return getClassBase(value, constructor, tag);\n }\n let type = \"Function\";\n if (isGeneratorFunction(value))\n type = `Generator${type}`;\n if (isAsyncFunction(value))\n type = `Async${type}`;\n let base = `[${type}`;\n if (constructor === null)\n base += \" (null prototype)\";\n if (value.name === \"\")\n base += \" (anonymous)\";\n else\n base += `: ${value.name}`;\n if (base += \"]\", constructor !== type && constructor !== null)\n base += ` ${constructor}`;\n if (tag !== \"\" && constructor !== tag)\n base += ` [${tag}]`;\n return base;\n}, identicalSequenceRange = function(a, b) {\n for (let i = 0;i < a.length - 3; i++) {\n const pos = b.indexOf(a[i]);\n if (pos !== -1) {\n const rest = b.length - pos;\n if (rest > 3) {\n let len = 1;\n const maxLen = MathMin(a.length - i, rest);\n while (maxLen > len && a[i + len] === b[pos + len])\n len++;\n if (len > 3)\n return { len, offset: i };\n }\n }\n }\n return { len: 0, offset: 0 };\n}, getStackString = function(error) {\n return error.stack \? String(error.stack) : ErrorPrototypeToString(error);\n}, getStackFrames = function(ctx, err, stack) {\n const frames = StringPrototypeSplit(stack, \"\\n\");\n let cause;\n try {\n ({ cause } = err);\n } catch {\n }\n if (cause != null && cause instanceof Error) {\n const causeStack = getStackString(cause), causeStackStart = StringPrototypeIndexOf(causeStack, \"\\n at\");\n if (causeStackStart !== -1) {\n const causeFrames = StringPrototypeSplit(StringPrototypeSlice(causeStack, causeStackStart + 1), \"\\n\"), { len, offset } = identicalSequenceRange(frames, causeFrames);\n if (len > 0) {\n const skipped = len - 2, msg = ` ... ${skipped} lines matching cause stack trace ...`;\n frames.splice(offset + 1, skipped, ctx.stylize(msg, \"undefined\"));\n }\n }\n }\n return frames;\n}, improveStack = function(stack, constructor, name, tag) {\n let len = name.length;\n if (constructor === null || StringPrototypeEndsWith(name, \"Error\") && StringPrototypeStartsWith(stack, name) && (stack.length === len || stack[len] === \":\" || stack[len] === \"\\n\")) {\n let fallback = \"Error\";\n if (constructor === null) {\n const start = RegExpPrototypeExec(/^([A-Z][a-z_ A-Z0-9[\\]()-]+)(\?::|\\n {4}at)/, stack) || RegExpPrototypeExec(/^([a-z_A-Z0-9-]*Error)$/, stack);\n fallback = start && start[1] || \"\", len = fallback.length, fallback = fallback || \"Error\";\n }\n const prefix = StringPrototypeSlice(getPrefix(constructor, tag, fallback), 0, -1);\n if (name !== prefix)\n if (StringPrototypeIncludes(prefix, name))\n if (len === 0)\n stack = `${prefix}: ${stack}`;\n else\n stack = `${prefix}${StringPrototypeSlice(stack, len)}`;\n else\n stack = `${prefix} [${name}]${StringPrototypeSlice(stack, len)}`;\n }\n return stack;\n}, removeDuplicateErrorKeys = function(ctx, keys, err, stack) {\n if (!ctx.showHidden && keys.length !== 0)\n for (let name of [\"name\", \"message\", \"stack\"]) {\n const index = ArrayPrototypeIndexOf(keys, name);\n if (index !== -1 && StringPrototypeIncludes(stack, err[name]))\n ArrayPrototypeSplice(keys, index, 1);\n }\n}, markNodeModules = function(ctx, line) {\n let tempLine = \"\", nodeModule, pos = 0;\n while ((nodeModule = nodeModulesRegExp.exec(line)) !== null)\n tempLine += StringPrototypeSlice(line, pos, nodeModule.index + 14), tempLine += ctx.stylize(nodeModule[1], \"module\"), pos = nodeModule.index + nodeModule[0].length;\n if (pos !== 0)\n line = tempLine + StringPrototypeSlice(line, pos);\n return line;\n}, markCwd = function(ctx, line, workingDirectory) {\n let cwdStartPos = StringPrototypeIndexOf(line, workingDirectory), tempLine = \"\", cwdLength = workingDirectory.length;\n if (cwdStartPos !== -1) {\n if (StringPrototypeSlice(line, cwdStartPos - 7, cwdStartPos) === \"file://\")\n cwdLength += 7, cwdStartPos -= 7;\n const start = line[cwdStartPos - 1] === \"(\" \? cwdStartPos - 1 : cwdStartPos, end = start !== cwdStartPos && StringPrototypeEndsWith(line, \")\") \? -1 : line.length, workingDirectoryEndPos = cwdStartPos + cwdLength + 1, cwdSlice = StringPrototypeSlice(line, start, workingDirectoryEndPos);\n if (tempLine += StringPrototypeSlice(line, 0, start), tempLine += ctx.stylize(cwdSlice, \"undefined\"), tempLine += StringPrototypeSlice(line, workingDirectoryEndPos, end), end === -1)\n tempLine += ctx.stylize(\")\", \"undefined\");\n } else\n tempLine += line;\n return tempLine;\n}, safeGetCWD = function() {\n let workingDirectory;\n try {\n workingDirectory = process.cwd();\n } catch {\n return;\n }\n return workingDirectory;\n}, formatError = function(err, constructor, tag, ctx, keys) {\n const name = err.name != null \? String(err.name) : \"Error\";\n let stack = getStackString(err);\n //! temp fix for Bun losing the error name from inherited errors + extraneous \": \" with no message\n if (stack = stack.replace(/^Error: /, `${name}${err.message \? \": \" : \"\"}`), removeDuplicateErrorKeys(ctx, keys, err, stack), (\"cause\" in err) && (keys.length === 0 || !ArrayPrototypeIncludes(keys, \"cause\")))\n ArrayPrototypePush(keys, \"cause\");\n if (ArrayIsArray(err.errors) && (keys.length === 0 || !ArrayPrototypeIncludes(keys, \"errors\")))\n ArrayPrototypePush(keys, \"errors\");\n stack = improveStack(stack, constructor, name, tag);\n let pos = err.message && StringPrototypeIndexOf(stack, err.message) || -1;\n if (pos !== -1)\n pos += err.message.length;\n const stackStart = StringPrototypeIndexOf(stack, \"\\n at\", pos);\n if (stackStart === -1)\n stack = `[${stack}]`;\n else {\n let newStack = StringPrototypeSlice(stack, 0, stackStart);\n const stackFramePart = StringPrototypeSlice(stack, stackStart + 1), lines = getStackFrames(ctx, err, stackFramePart);\n if (ctx.colors) {\n const workingDirectory = safeGetCWD();\n let esmWorkingDirectory;\n for (let line of lines) {\n const core = RegExpPrototypeExec(coreModuleRegExp, line);\n if (core !== null && (StringPrototypeStartsWith(core[1], \"internal/\") || ArrayPrototypeIncludes(@requireNativeModule(\"module\").builtinModules, core[1])))\n newStack += `\\n${ctx.stylize(line, \"undefined\")}`;\n else {\n if (newStack += \"\\n\", line = markNodeModules(ctx, line), workingDirectory !== @undefined) {\n let newLine = markCwd(ctx, line, workingDirectory);\n if (newLine === line)\n esmWorkingDirectory \?\?= pathToFileURL(workingDirectory), newLine = markCwd(ctx, line, esmWorkingDirectory);\n line = newLine;\n }\n newStack += line;\n }\n }\n } else\n newStack += `\\n${ArrayPrototypeJoin(lines, \"\\n\")}`;\n stack = newStack;\n }\n if (ctx.indentationLvl !== 0) {\n const indentation = StringPrototypeRepeat(\" \", ctx.indentationLvl);\n stack = StringPrototypeReplaceAll(stack, \"\\n\", `\\n${indentation}`);\n }\n return stack;\n}, groupArrayElements = function(ctx, output, value) {\n let totalLength = 0, maxLength = 0, i = 0, outputLength = output.length;\n if (ctx.maxArrayLength < output.length)\n outputLength--;\n const separatorSpace = 2, dataLen = new Array(outputLength);\n for (;i < outputLength; i++) {\n const len = getStringWidth(output[i], ctx.colors);\n if (dataLen[i] = len, totalLength += len + separatorSpace, maxLength < len)\n maxLength = len;\n }\n const actualMax = maxLength + separatorSpace;\n if (actualMax * 3 + ctx.indentationLvl < ctx.breakLength && (totalLength / actualMax > 5 || maxLength <= 6)) {\n const averageBias = MathSqrt(actualMax - totalLength / output.length), biasedMax = MathMax(actualMax - 3 - averageBias, 1), columns = MathMin(MathRound(MathSqrt(2.5 * biasedMax * outputLength) / biasedMax), MathFloor((ctx.breakLength - ctx.indentationLvl) / actualMax), ctx.compact * 4, 15);\n if (columns <= 1)\n return output;\n const tmp = [], maxLineLength = [];\n for (let i2 = 0;i2 < columns; i2++) {\n let lineMaxLength = 0;\n for (let j = i2;j < output.length; j += columns)\n if (dataLen[j] > lineMaxLength)\n lineMaxLength = dataLen[j];\n lineMaxLength += separatorSpace, maxLineLength[i2] = lineMaxLength;\n }\n let order = StringPrototypePadStart;\n if (value !== @undefined) {\n for (let i2 = 0;i2 < output.length; i2++)\n if (typeof value[i2] !== \"number\" && typeof value[i2] !== \"bigint\") {\n order = StringPrototypePadEnd;\n break;\n }\n }\n for (let i2 = 0;i2 < outputLength; i2 += columns) {\n const max = MathMin(i2 + columns, outputLength);\n let str = \"\", j = i2;\n for (;j < max - 1; j++) {\n const padding = maxLineLength[j - i2] + output[j].length - dataLen[j];\n str += order(`${output[j]}, `, padding, \" \");\n }\n if (order === StringPrototypePadStart) {\n const padding = maxLineLength[j - i2] + output[j].length - dataLen[j] - separatorSpace;\n str += StringPrototypePadStart(output[j], padding, \" \");\n } else\n str += output[j];\n ArrayPrototypePush(tmp, str);\n }\n if (ctx.maxArrayLength < output.length)\n ArrayPrototypePush(tmp, output[outputLength]);\n output = tmp;\n }\n return output;\n}, addNumericSeparator = function(integerString) {\n let result = \"\", i = integerString.length;\n const start = StringPrototypeStartsWith(integerString, \"-\") \? 1 : 0;\n for (;i >= start + 4; i -= 3)\n result = `_${StringPrototypeSlice(integerString, i - 3, i)}${result}`;\n return i === integerString.length \? integerString : `${StringPrototypeSlice(integerString, 0, i)}${result}`;\n}, addNumericSeparatorEnd = function(integerString) {\n let result = \"\", i = 0;\n for (;i < integerString.length - 3; i += 3)\n result += `${StringPrototypeSlice(integerString, i, i + 3)}_`;\n return i === 0 \? integerString : `${result}${StringPrototypeSlice(integerString, i)}`;\n}, formatNumber = function(fn, number, numericSeparator) {\n if (!numericSeparator) {\n if (ObjectIs(number, -0))\n return fn(\"-0\", \"number\");\n return fn(`${number}`, \"number\");\n }\n const integer = MathTrunc(number), string = String(integer);\n if (integer === number) {\n if (!NumberIsFinite(number) || StringPrototypeIncludes(string, \"e\"))\n return fn(string, \"number\");\n return fn(`${addNumericSeparator(string)}`, \"number\");\n }\n if (NumberIsNaN(number))\n return fn(string, \"number\");\n return fn(`${addNumericSeparator(string)}.${addNumericSeparatorEnd(StringPrototypeSlice(String(number), string.length + 1))}`, \"number\");\n}, formatBigInt = function(fn, bigint, numericSeparator) {\n const string = String(bigint);\n if (!numericSeparator)\n return fn(`${string}n`, \"bigint\");\n return fn(`${addNumericSeparator(string)}n`, \"bigint\");\n}, formatPrimitive = function(fn, value, ctx) {\n if (typeof value === \"string\") {\n let trailer = \"\";\n if (value.length > ctx.maxStringLength) {\n const remaining = value.length - ctx.maxStringLength;\n value = StringPrototypeSlice(value, 0, ctx.maxStringLength), trailer = `... ${remaining} more character${remaining > 1 \? \"s\" : \"\"}`;\n }\n if (ctx.compact !== !0 && value.length > kMinLineLength && value.length > ctx.breakLength - ctx.indentationLvl - 4)\n return ArrayPrototypeJoin(ArrayPrototypeMap(extractedSplitNewLines(value), (line) => fn(strEscape(line), \"string\")), ` +\\n${StringPrototypeRepeat(\" \", ctx.indentationLvl + 2)}`) + trailer;\n return fn(strEscape(value), \"string\") + trailer;\n }\n if (typeof value === \"number\")\n return formatNumber(fn, value, ctx.numericSeparator);\n if (typeof value === \"bigint\")\n return formatBigInt(fn, value, ctx.numericSeparator);\n if (typeof value === \"boolean\")\n return fn(`${value}`, \"boolean\");\n if (typeof value === \"undefined\")\n return fn(\"undefined\", \"undefined\");\n return fn(SymbolPrototypeToString(value), \"symbol\");\n}, formatNamespaceObject = function(keys, ctx, value, recurseTimes) {\n const output = new Array(keys.length);\n for (let i = 0;i < keys.length; i++)\n try {\n output[i] = formatProperty(ctx, value, recurseTimes, keys[i], kObjectType);\n } catch (err) {\n assert(isNativeError(err) && err.name === \"ReferenceError\");\n const tmp = { [keys[i]]: \"\" };\n output[i] = formatProperty(ctx, tmp, recurseTimes, keys[i], kObjectType);\n const pos = StringPrototypeLastIndexOf(output[i], \" \");\n output[i] = StringPrototypeSlice(output[i], 0, pos + 1) + ctx.stylize(\"\", \"special\");\n }\n return keys.length = 0, output;\n}, formatSpecialArray = function(ctx, value, recurseTimes, maxLength, output, i) {\n const keys = ObjectKeys(value);\n let index = i;\n for (;i < keys.length && output.length < maxLength; i++) {\n const key = keys[i], tmp = +key;\n if (tmp > 4294967294)\n break;\n if (`${index}` !== key) {\n if (RegExpPrototypeExec(numberRegExp, key) === null)\n break;\n const emptyItems = tmp - index, ending = emptyItems > 1 \? \"s\" : \"\", message = `<${emptyItems} empty item${ending}>`;\n if (ArrayPrototypePush(output, ctx.stylize(message, \"undefined\")), index = tmp, output.length === maxLength)\n break;\n }\n ArrayPrototypePush(output, formatProperty(ctx, value, recurseTimes, key, kArrayType)), index++;\n }\n const remaining = value.length - index;\n if (output.length !== maxLength) {\n if (remaining > 0) {\n const ending = remaining > 1 \? \"s\" : \"\", message = `<${remaining} empty item${ending}>`;\n ArrayPrototypePush(output, ctx.stylize(message, \"undefined\"));\n }\n } else if (remaining > 0)\n ArrayPrototypePush(output, remainingText(remaining));\n return output;\n}, hexSlice = function(buf, start = 0, end) {\n return ArrayPrototypeJoin(ArrayPrototypeMap(buf.slice(start, end), (x) => (\"00\" + x.toString(16)).slice(-2)), \"\");\n}, formatArrayBuffer = function(ctx, value) {\n let buffer;\n try {\n buffer = new Uint8Array(value);\n } catch {\n return [ctx.stylize(\"(detached)\", \"special\")];\n }\n let str = StringPrototypeTrim(RegExpPrototypeSymbolReplace(/(.{2})/g, hexSlice(buffer, 0, MathMin(ctx.maxArrayLength, buffer.length)), \"$1 \"));\n const remaining = buffer.length - ctx.maxArrayLength;\n if (remaining > 0)\n str += ` ... ${remaining} more byte${remaining > 1 \? \"s\" : \"\"}`;\n return [`${ctx.stylize(\"[Uint8Contents]\", \"special\")}: <${str}>`];\n}, formatArray = function(ctx, value, recurseTimes) {\n const valLen = value.length, len = MathMin(MathMax(0, ctx.maxArrayLength), valLen), remaining = valLen - len, output = [];\n for (let i = 0;i < len; i++) {\n if (!ObjectPrototypeHasOwnProperty(value, i))\n return formatSpecialArray(ctx, value, recurseTimes, len, output, i);\n ArrayPrototypePush(output, formatProperty(ctx, value, recurseTimes, i, kArrayType));\n }\n if (remaining > 0)\n ArrayPrototypePush(output, remainingText(remaining));\n return output;\n}, formatTypedArray = function(value, length, ctx, ignored, recurseTimes) {\n const maxLength = MathMin(MathMax(0, ctx.maxArrayLength), length), remaining = value.length - maxLength, output = new Array(maxLength), elementFormatter = value.length > 0 && typeof value[0] === \"number\" \? formatNumber : formatBigInt;\n for (let i = 0;i < maxLength; ++i)\n output[i] = elementFormatter(ctx.stylize, value[i], ctx.numericSeparator);\n if (remaining > 0)\n output[maxLength] = remainingText(remaining);\n if (ctx.showHidden) {\n ctx.indentationLvl += 2;\n for (let key of [\"BYTES_PER_ELEMENT\", \"length\", \"byteLength\", \"byteOffset\", \"buffer\"]) {\n const str = formatValue(ctx, value[key], recurseTimes, !0);\n ArrayPrototypePush(output, `[${key}]: ${str}`);\n }\n ctx.indentationLvl -= 2;\n }\n return output;\n}, formatSet = function(value, ctx, ignored, recurseTimes) {\n const length = value.size, maxLength = MathMin(MathMax(0, ctx.maxArrayLength), length), remaining = length - maxLength, output = [];\n ctx.indentationLvl += 2;\n let i = 0;\n for (let v of value) {\n if (i >= maxLength)\n break;\n ArrayPrototypePush(output, formatValue(ctx, v, recurseTimes)), i++;\n }\n if (remaining > 0)\n ArrayPrototypePush(output, remainingText(remaining));\n return ctx.indentationLvl -= 2, output;\n}, formatMap = function(value, ctx, ignored, recurseTimes) {\n const length = value.size, maxLength = MathMin(MathMax(0, ctx.maxArrayLength), length), remaining = length - maxLength, output = [];\n ctx.indentationLvl += 2;\n let i = 0;\n for (let { 0: k, 1: v } of value) {\n if (i >= maxLength)\n break;\n ArrayPrototypePush(output, `${formatValue(ctx, k, recurseTimes)} => ${formatValue(ctx, v, recurseTimes)}`), i++;\n }\n if (remaining > 0)\n ArrayPrototypePush(output, remainingText(remaining));\n return ctx.indentationLvl -= 2, output;\n}, formatSetIterInner = function(ctx, recurseTimes, entries, state) {\n const maxArrayLength = MathMax(ctx.maxArrayLength, 0), maxLength = MathMin(maxArrayLength, entries.length), output = new Array(maxLength);\n ctx.indentationLvl += 2;\n for (let i = 0;i < maxLength; i++)\n output[i] = formatValue(ctx, entries[i], recurseTimes);\n if (ctx.indentationLvl -= 2, state === kWeak && !ctx.sorted)\n ArrayPrototypeSort(output);\n const remaining = entries.length - maxLength;\n if (remaining > 0)\n ArrayPrototypePush(output, remainingText(remaining));\n return output;\n}, formatMapIterInner = function(ctx, recurseTimes, entries, state) {\n const maxArrayLength = MathMax(ctx.maxArrayLength, 0), len = entries.length / 2, remaining = len - maxArrayLength, maxLength = MathMin(maxArrayLength, len), output = new Array(maxLength);\n let i = 0;\n if (ctx.indentationLvl += 2, state === kWeak) {\n for (;i < maxLength; i++) {\n const pos = i * 2;\n output[i] = `${formatValue(ctx, entries[pos], recurseTimes)} => ${formatValue(ctx, entries[pos + 1], recurseTimes)}`;\n }\n if (!ctx.sorted)\n ArrayPrototypeSort(output);\n } else\n for (;i < maxLength; i++) {\n const pos = i * 2, res = [formatValue(ctx, entries[pos], recurseTimes), formatValue(ctx, entries[pos + 1], recurseTimes)];\n output[i] = reduceToSingleString(ctx, res, \"\", [\"[\", \"]\"], kArrayExtrasType, recurseTimes);\n }\n if (ctx.indentationLvl -= 2, remaining > 0)\n ArrayPrototypePush(output, remainingText(remaining));\n return output;\n}, formatWeakCollection = function(ctx) {\n return [ctx.stylize(\"\", \"special\")];\n}, formatWeakSet = function(ctx, value, recurseTimes) {\n const entries = previewEntries(value);\n return formatSetIterInner(ctx, recurseTimes, entries, kWeak);\n}, formatWeakMap = function(ctx, value, recurseTimes) {\n const entries = previewEntries(value);\n return formatMapIterInner(ctx, recurseTimes, entries, kWeak);\n}, formatIterator = function(braces, ctx, value, recurseTimes) {\n const { 0: entries, 1: isKeyValue } = previewEntries(value, !0);\n if (isKeyValue)\n return braces[0] = RegExpPrototypeSymbolReplace(/ Iterator] {$/, braces[0], \" Entries] {\"), formatMapIterInner(ctx, recurseTimes, entries, kMapEntries);\n return formatSetIterInner(ctx, recurseTimes, entries, kIterator);\n}, formatPromise = function(ctx, value, recurseTimes) {\n let output;\n const { 0: state, 1: result } = getPromiseDetails(value);\n if (state === kPending)\n output = [ctx.stylize(\"\", \"special\")];\n else {\n ctx.indentationLvl += 2;\n const str = formatValue(ctx, result, recurseTimes);\n ctx.indentationLvl -= 2, output = [state === kRejected \? `${ctx.stylize(\"\", \"special\")} ${str}` : str];\n }\n return output;\n}, formatProperty = function(ctx, value, recurseTimes, key, type, desc, original = value) {\n let name, str, extra = \" \";\n if (desc ||= ObjectGetOwnPropertyDescriptor(value, key) || { value: value[key], enumerable: !0 }, desc.value !== @undefined) {\n const diff = ctx.compact !== !0 || type !== kObjectType \? 2 : 3;\n if (ctx.indentationLvl += diff, str = formatValue(ctx, desc.value, recurseTimes), diff === 3 && ctx.breakLength < getStringWidth(str, ctx.colors))\n extra = `\\n${StringPrototypeRepeat(\" \", ctx.indentationLvl)}`;\n ctx.indentationLvl -= diff;\n } else if (desc.get !== @undefined) {\n const label = desc.set !== @undefined \? \"Getter/Setter\" : \"Getter\", s = ctx.stylize;\n if (ctx.getters && (ctx.getters === !0 || ctx.getters === \"get\" && desc.set === @undefined || ctx.getters === \"set\" && desc.set !== @undefined))\n try {\n const tmp = desc.get.@call(original);\n if (ctx.indentationLvl += 2, tmp === null)\n str = `${s(`[${label}:`, \"special\")} ${s(\"null\", \"null\")}${s(\"]\", \"special\")}`;\n else if (typeof tmp === \"object\")\n str = `${s(`[${label}]`, \"special\")} ${formatValue(ctx, tmp, recurseTimes)}`;\n else {\n const primitive = formatPrimitive(s, tmp, ctx);\n str = `${s(`[${label}:`, \"special\")} ${primitive}${s(\"]\", \"special\")}`;\n }\n ctx.indentationLvl -= 2;\n } catch (err) {\n const message = ``;\n str = `${s(`[${label}:`, \"special\")} ${message}${s(\"]\", \"special\")}`;\n }\n else\n str = ctx.stylize(`[${label}]`, \"special\");\n } else if (desc.set !== @undefined)\n str = ctx.stylize(\"[Setter]\", \"special\");\n else\n str = ctx.stylize(\"undefined\", \"undefined\");\n if (type === kArrayType)\n return str;\n if (typeof key === \"symbol\") {\n const tmp = RegExpPrototypeSymbolReplace(strEscapeSequencesReplacer, SymbolPrototypeToString(key), escapeFn);\n name = `[${ctx.stylize(tmp, \"symbol\")}]`;\n } else if (key === \"__proto__\")\n name = \"['__proto__']\";\n else if (desc.enumerable === !1)\n name = `[${RegExpPrototypeSymbolReplace(strEscapeSequencesReplacer, key, escapeFn)}]`;\n else if (RegExpPrototypeExec(keyStrRegExp, key) !== null)\n name = ctx.stylize(key, \"name\");\n else\n name = ctx.stylize(strEscape(key), \"string\");\n return `${name}:${extra}${str}`;\n}, isBelowBreakLength = function(ctx, output, start, base) {\n let totalLength = output.length + start;\n if (totalLength + output.length > ctx.breakLength)\n return !1;\n for (let i = 0;i < output.length; i++) {\n if (ctx.colors)\n totalLength += StringPrototypeReplaceAll(output[i], /\\u001B\\[\\d\\d\?m/g, \"\").length;\n else\n totalLength += output[i].length;\n if (totalLength > ctx.breakLength)\n return !1;\n }\n return base === \"\" || !StringPrototypeIncludes(base, \"\\n\");\n}, reduceToSingleString = function(ctx, output, base, braces, extrasType, recurseTimes, value) {\n if (ctx.compact !== !0) {\n if (typeof ctx.compact === \"number\" && ctx.compact >= 1) {\n const entries = output.length;\n if (extrasType === kArrayExtrasType && entries > 6)\n output = groupArrayElements(ctx, output, value);\n if (ctx.currentDepth - recurseTimes < ctx.compact && entries === output.length) {\n const start = output.length + ctx.indentationLvl + braces[0].length + base.length + 10;\n if (isBelowBreakLength(ctx, output, start, base)) {\n const joinedOutput = ArrayPrototypeJoin(output, \", \");\n if (!StringPrototypeIncludes(joinedOutput, \"\\n\"))\n return `${base \? `${base} ` : \"\"}${braces[0]} ${joinedOutput}` + ` ${braces[1]}`;\n }\n }\n }\n const indentation2 = `\\n${StringPrototypeRepeat(\" \", ctx.indentationLvl)}`;\n return `${base \? `${base} ` : \"\"}${braces[0]}${indentation2} ` + `${ArrayPrototypeJoin(output, `,${indentation2} `)}${indentation2}${braces[1]}`;\n }\n if (isBelowBreakLength(ctx, output, 0, base))\n return `${braces[0]}${base \? ` ${base}` : \"\"} ${ArrayPrototypeJoin(output, \", \")} ` + braces[1];\n const indentation = StringPrototypeRepeat(\" \", ctx.indentationLvl), ln = base === \"\" && braces[0].length === 1 \? \" \" : `${base \? ` ${base}` : \"\"}\\n${indentation} `;\n return `${braces[0]}${ln}${ArrayPrototypeJoin(output, `,\\n${indentation} `)} ${braces[1]}`;\n}, hasBuiltInToString = function(value) {\n const proxyTarget = getProxyDetails(value, !1);\n if (proxyTarget !== @undefined) {\n if (proxyTarget === null)\n return !0;\n value = proxyTarget;\n }\n if (typeof value.toString !== \"function\")\n return !0;\n if (ObjectPrototypeHasOwnProperty(value, \"toString\"))\n return !1;\n let pointer = value;\n do\n pointer = ObjectGetPrototypeOf(pointer);\n while (!ObjectPrototypeHasOwnProperty(pointer, \"toString\"));\n const descriptor = ObjectGetOwnPropertyDescriptor(pointer, \"constructor\");\n return descriptor !== @undefined && typeof descriptor.value === \"function\" && builtInObjects.has(descriptor.value.name);\n}, tryStringify = function(arg) {\n try {\n return JSONStringify(arg);\n } catch (err) {\n if (!CIRCULAR_ERROR_MESSAGE)\n try {\n const a = {};\n a.a = a, JSONStringify(a);\n } catch (circularError) {\n CIRCULAR_ERROR_MESSAGE = firstErrorLine(circularError);\n }\n if (err.name === \"TypeError\" && firstErrorLine(err) === CIRCULAR_ERROR_MESSAGE)\n return \"[Circular]\";\n throw err;\n }\n}, format = function(...args) {\n return formatWithOptionsInternal(@undefined, args);\n}, formatWithOptions = function(inspectOptions, ...args) {\n return validateObject(inspectOptions, \"inspectOptions\", { allowArray: !0 }), formatWithOptionsInternal(inspectOptions, args);\n}, formatNumberNoColor = function(number, options) {\n return formatNumber(stylizeNoColor, number, options\?.numericSeparator \?\? inspectDefaultOptions.numericSeparator);\n}, formatBigIntNoColor = function(bigint, options) {\n return formatBigInt(stylizeNoColor, bigint, options\?.numericSeparator \?\? inspectDefaultOptions.numericSeparator);\n}, formatWithOptionsInternal = function(inspectOptions, args) {\n const first = args[0];\n let a = 0, str = \"\", join = \"\";\n if (typeof first === \"string\") {\n if (args.length === 1)\n return first;\n let tempStr, lastPos = 0;\n for (let i = 0;i < first.length - 1; i++)\n if (StringPrototypeCharCodeAt(first, i) === 37) {\n const nextChar = StringPrototypeCharCodeAt(first, ++i);\n if (a + 1 !== args.length) {\n switch (nextChar) {\n case 115: {\n const tempArg = args[++a];\n if (typeof tempArg === \"number\")\n tempStr = formatNumberNoColor(tempArg, inspectOptions);\n else if (typeof tempArg === \"bigint\")\n tempStr = formatBigIntNoColor(tempArg, inspectOptions);\n else if (typeof tempArg !== \"object\" || tempArg === null || !hasBuiltInToString(tempArg))\n tempStr = String(tempArg);\n else\n tempStr = inspect(tempArg, {\n ...inspectOptions,\n compact: 3,\n colors: !1,\n depth: 0\n });\n break;\n }\n case 106:\n tempStr = tryStringify(args[++a]);\n break;\n case 100: {\n const tempNum = args[++a];\n if (typeof tempNum === \"bigint\")\n tempStr = formatBigIntNoColor(tempNum, inspectOptions);\n else if (typeof tempNum === \"symbol\")\n tempStr = \"NaN\";\n else\n tempStr = formatNumberNoColor(Number(tempNum), inspectOptions);\n break;\n }\n case 79:\n tempStr = inspect(args[++a], inspectOptions);\n break;\n case 111:\n tempStr = inspect(args[++a], {\n ...inspectOptions,\n showHidden: !0,\n showProxy: !0,\n depth: 4\n });\n break;\n case 105: {\n const tempInteger = args[++a];\n if (typeof tempInteger === \"bigint\")\n tempStr = formatBigIntNoColor(tempInteger, inspectOptions);\n else if (typeof tempInteger === \"symbol\")\n tempStr = \"NaN\";\n else\n tempStr = formatNumberNoColor(NumberParseInt(tempInteger), inspectOptions);\n break;\n }\n case 102: {\n const tempFloat = args[++a];\n if (typeof tempFloat === \"symbol\")\n tempStr = \"NaN\";\n else\n tempStr = formatNumberNoColor(NumberParseFloat(tempFloat), inspectOptions);\n break;\n }\n case 99:\n a += 1, tempStr = \"\";\n break;\n case 37:\n str += StringPrototypeSlice(first, lastPos, i), lastPos = i + 1;\n continue;\n default:\n continue;\n }\n if (lastPos !== i - 1)\n str += StringPrototypeSlice(first, lastPos, i - 1);\n str += tempStr, lastPos = i + 1;\n } else if (nextChar === 37)\n str += StringPrototypeSlice(first, lastPos, i), lastPos = i + 1;\n }\n if (lastPos !== 0) {\n if (a++, join = \" \", lastPos < first.length)\n str += StringPrototypeSlice(first, lastPos);\n }\n }\n while (a < args.length) {\n const value = args[a];\n str += join, str += typeof value !== \"string\" \? inspect(value, inspectOptions) : value, join = \" \", a++;\n }\n return str;\n}, isZeroWidthCodePoint = function(code) {\n return code <= 31 || code >= 127 && code <= 159 || code >= 768 && code <= 879 || code >= 8203 && code <= 8207 || code >= 8400 && code <= 8447 || code >= 65024 && code <= 65039 || code >= 65056 && code <= 65071 || code >= 917760 && code <= 917999;\n}, stripVTControlCharacters = function(str) {\n if (typeof str !== \"string\")\n throw new codes.ERR_INVALID_ARG_TYPE(\"str\", \"string\", str);\n return RegExpPrototypeSymbolReplace(ansi, str, \"\");\n}, getOwnNonIndexProperties = function(a, filter = 2) {\n const desc = ObjectGetOwnPropertyDescriptors(a), ret = [];\n for (let [k, v] of ObjectEntries(desc))\n if (!RegExpPrototypeTest(/^(0|[1-9][0-9]*)$/, k) || NumberParseInt(k, 10) >= 4294967295)\n if (filter === 2 && !v.enumerable)\n continue;\n else\n ArrayPrototypePush(ret, k);\n for (let s of ObjectGetOwnPropertySymbols(a)) {\n const v = ObjectGetOwnPropertyDescriptor(a, s);\n if (filter === 2 && !v.enumerable)\n continue;\n ArrayPrototypePush(ret, s);\n }\n return ret;\n}, getPromiseDetails = function(promise) {\n const state = @getPromiseInternalField(promise, @promiseFieldFlags) & @promiseStateMask;\n if (state !== @promiseStatePending)\n return [\n state === @promiseStateRejected \? kRejected : kFulfilled,\n @getPromiseInternalField(promise, @promiseFieldReactionsOrResult)\n ];\n return [kPending, @undefined];\n}, getProxyDetails = function(proxy, withHandler = !0) {\n if (!@isProxyObject(proxy))\n return @undefined;\n const handler = @getProxyInternalField(proxy, @proxyFieldHandler), target = handler === null \? null : @getProxyInternalField(proxy, @proxyFieldTarget);\n if (withHandler)\n return [target, handler];\n else\n return target;\n}, previewEntries = function(val, isIterator = !1) {\n if (isIterator) {\n const iteratedObject = @getInternalField(val, 1), kind = @getInternalField(val, 2), isEntries = kind === 2;\n if (@isMap(iteratedObject))\n if (isEntries)\n return [ArrayPrototypeFlat(ArrayFrom(iteratedObject)), !0];\n else if (kind === 1)\n return [ArrayFrom(MapPrototypeValues(iteratedObject)), !1];\n else\n return [ArrayFrom(MapPrototypeKeys(iteratedObject)), !1];\n else if (@isSet(iteratedObject))\n if (isEntries)\n return [ArrayPrototypeFlat(ArrayFrom(SetPrototypeEntries(iteratedObject))), !0];\n else\n return [ArrayFrom(iteratedObject), !1];\n else\n throw new Error(\"previewEntries(): Invalid iterator received\");\n }\n if (isWeakMap(val))\n return [];\n if (isWeakSet(val))\n return [];\n else\n throw new Error(\"previewEntries(): Invalid object received\");\n}, internalGetConstructorName = function(val) {\n if (!val || typeof val !== \"object\")\n throw new Error(\"Invalid object\");\n if (val.constructor\?.name)\n return val.constructor.name;\n const str = ObjectPrototypeToString(val), m = StringPrototypeMatch(str, /^\\[object ([^\\]]+)\\]/);\n return m \? m[1] : \"Object\";\n}, $, { pathToFileURL } = @getInternalField(@internalModuleRegistry, 47) || @createInternalModuleById(47), primordials = @getInternalField(@internalModuleRegistry, 5) || @createInternalModuleById(5), {\n Array,\n ArrayFrom,\n ArrayIsArray,\n ArrayPrototypeFilter,\n ArrayPrototypeFlat,\n ArrayPrototypeForEach,\n ArrayPrototypeIncludes,\n ArrayPrototypeIndexOf,\n ArrayPrototypeJoin,\n ArrayPrototypeMap,\n ArrayPrototypePop,\n ArrayPrototypePush,\n ArrayPrototypePushApply,\n ArrayPrototypeSlice,\n ArrayPrototypeSplice,\n ArrayPrototypeSort,\n ArrayPrototypeUnshift,\n BigIntPrototypeValueOf,\n BooleanPrototypeValueOf,\n DatePrototypeGetTime,\n DatePrototypeToISOString,\n DatePrototypeToString,\n ErrorCaptureStackTrace,\n ErrorPrototypeToString,\n FunctionPrototypeBind,\n FunctionPrototypeToString,\n JSONStringify,\n MapPrototypeGetSize,\n MapPrototypeEntries,\n MapPrototypeValues,\n MapPrototypeKeys,\n MathFloor,\n MathMax,\n MathMin,\n MathRound,\n MathSqrt,\n MathTrunc,\n Number,\n NumberIsFinite,\n NumberIsNaN,\n NumberParseFloat,\n NumberParseInt,\n NumberPrototypeToString,\n NumberPrototypeValueOf,\n Object,\n ObjectAssign,\n ObjectDefineProperty,\n ObjectEntries,\n ObjectGetOwnPropertyDescriptor,\n ObjectGetOwnPropertyDescriptors,\n ObjectGetOwnPropertyNames,\n ObjectGetOwnPropertySymbols,\n ObjectGetPrototypeOf,\n ObjectIs,\n ObjectKeys,\n ObjectPrototypeHasOwnProperty,\n ObjectPrototypePropertyIsEnumerable,\n ObjectPrototypeToString,\n ObjectSeal,\n ObjectSetPrototypeOf,\n ReflectApply,\n ReflectOwnKeys,\n RegExp,\n RegExpPrototypeExec,\n RegExpPrototypeSymbolReplace,\n RegExpPrototypeSymbolSplit,\n RegExpPrototypeTest,\n RegExpPrototypeToString,\n SafeStringIterator,\n SafeMap,\n SafeSet,\n SetPrototypeEntries,\n SetPrototypeGetSize,\n SetPrototypeValues,\n String,\n StringPrototypeCharCodeAt,\n StringPrototypeCodePointAt,\n StringPrototypeIncludes,\n StringPrototypeIndexOf,\n StringPrototypeLastIndexOf,\n StringPrototypeMatch,\n StringPrototypeNormalize,\n StringPrototypePadEnd,\n StringPrototypePadStart,\n StringPrototypeRepeat,\n StringPrototypeReplaceAll,\n StringPrototypeSlice,\n StringPrototypeSplit,\n StringPrototypeEndsWith,\n StringPrototypeStartsWith,\n StringPrototypeToLowerCase,\n StringPrototypeTrim,\n StringPrototypeValueOf,\n SymbolPrototypeToString,\n SymbolPrototypeValueOf,\n SymbolIterator,\n SymbolToStringTag,\n TypedArrayPrototypeGetLength,\n TypedArrayPrototypeGetSymbolToStringTag,\n Uint8Array\n} = primordials, customInspectSymbol = Symbol.for(\"nodejs.util.inspect.custom\"), kPending = Symbol(\"kPending\"), kFulfilled = Symbol(\"kFulfilled\"), kRejected = Symbol(\"kRejected\");\nvar isAsyncFunction = (v) => typeof v === \"function\" && StringPrototypeStartsWith(FunctionPrototypeToString(v), \"async\"), isGeneratorFunction = (v) => typeof v === \"function\" && StringPrototypeMatch(FunctionPrototypeToString(v), /^(async\\s+)\?function *\\*/), isBigIntObject = checkBox(BigInt), isSymbolObject = checkBox(Symbol), {\n isAnyArrayBuffer,\n isArrayBuffer,\n isArgumentsObject,\n isBoxedPrimitive: _native_isBoxedPrimitive,\n isDataView,\n isExternal,\n isMap,\n isMapIterator,\n isModuleNamespaceObject,\n isNativeError,\n isPromise,\n isSet,\n isSetIterator,\n isWeakMap,\n isWeakSet,\n isRegExp,\n isDate,\n isTypedArray,\n isStringObject,\n isNumberObject,\n isBooleanObject\n} = @requireNativeModule(\"util/types\");\n//! The native versions of the commented out functions are currently buggy, so we use the polyfills above for now.\n//! temp workaround to apply is{BigInt,Symbol}Object fix\nvar isBoxedPrimitive = (val) => isBigIntObject(val) || isSymbolObject(val) || _native_isBoxedPrimitive(val);\n\nclass AssertionError extends Error {\n constructor(message, isForced = !1) {\n super(message);\n this.name = \"AssertionError\", this.code = \"ERR_ASSERTION\", this.operator = \"==\", this.generatedMessage = !isForced, this.actual = isForced && @undefined, this.expected = !isForced || @undefined;\n }\n}\nvar codes = {};\n{\n const kTypes = [\n \"string\",\n \"function\",\n \"number\",\n \"object\",\n \"Function\",\n \"Object\",\n \"boolean\",\n \"bigint\",\n \"symbol\"\n ], classRegExp = /^([A-Z][a-z0-9]*)+$/, messages = new SafeMap;\n messages.set(\"ERR_INVALID_ARG_TYPE\", (name, expected, actual) => {\n if (assert(typeof name === \"string\", \"'name' must be a string\"), !ArrayIsArray(expected))\n expected = [expected];\n let msg = \"The \";\n if (StringPrototypeEndsWith(name, \" argument\"))\n msg += `${name} `;\n else\n msg += `\"${name}\" ${StringPrototypeIncludes(name, \".\") \? \"property\" : \"argument\"} `;\n msg += \"must be \";\n const types = [], instances = [], other = [];\n for (let value of expected)\n if (assert(typeof value === \"string\", \"All expected entries have to be of type string\"), ArrayPrototypeIncludes(kTypes, value))\n ArrayPrototypePush(types, StringPrototypeToLowerCase(value));\n else if (RegExpPrototypeTest(classRegExp, value))\n ArrayPrototypePush(instances, value);\n else\n assert(value !== \"object\", 'The value \"object\" should be written as \"Object\"'), ArrayPrototypePush(other, value);\n if (instances.length > 0) {\n const pos = ArrayPrototypeIndexOf(types, \"object\");\n if (pos !== -1)\n ArrayPrototypeSplice(types, pos, 1), ArrayPrototypePush(instances, \"Object\");\n }\n if (types.length > 0) {\n if (types.length > 2)\n msg += `one of type ${ArrayPrototypeJoin(types, \", \")}, or ${ArrayPrototypePop(types)}`;\n else if (types.length === 2)\n msg += `one of type ${types[0]} or ${types[1]}`;\n else\n msg += `of type ${types[0]}`;\n if (instances.length > 0 || other.length > 0)\n msg += \" or \";\n }\n if (instances.length > 0) {\n if (instances.length > 2)\n msg += `an instance of ${ArrayPrototypeJoin(instances, \", \")}, or ${ArrayPrototypePop(instances)}`;\n else\n msg += `an instance of ${instances[0]}` + (instances.length === 2 \? ` or ${instances[1]}` : \"\");\n if (other.length > 0)\n msg += \" or \";\n }\n if (other.length > 0)\n if (other.length > 2) {\n const last = ArrayPrototypePop(other);\n msg += `one of ${ArrayPrototypeJoin(other, \", \")}, or ${last}`;\n } else if (other.length === 2)\n msg += `one of ${other[0]} or ${other[1]}`;\n else {\n if (StringPrototypeToLowerCase(other[0]) !== other[0])\n msg += \"an \";\n msg += `${other[0]}`;\n }\n if (actual == null)\n msg += `. Received ${actual}`;\n else if (typeof actual === \"function\" && actual.name)\n msg += `. Received function ${actual.name}`;\n else if (typeof actual === \"object\")\n if (actual.constructor && actual.constructor.name)\n msg += `. Received an instance of ${actual.constructor.name}`;\n else\n msg += `. Received ${inspect(actual, { depth: -1 })}`;\n else {\n let inspected = inspect(actual, { colors: !1 });\n if (inspected.length > 25)\n inspected = `${StringPrototypeSlice(inspected, 0, 25)}...`;\n msg += `. Received type ${typeof actual} (${inspected})`;\n }\n return msg;\n }), codes[\"ERR_INVALID_ARG_TYPE\"] = function NodeError(...args) {\n const limit = Error.stackTraceLimit;\n Error.stackTraceLimit = 0;\n const error = @makeTypeError();\n Error.stackTraceLimit = limit;\n const msg = messages.get(\"ERR_INVALID_ARG_TYPE\");\n assert(typeof msg === \"function\"), assert(msg.length <= args.length, `Code: ERR_INVALID_ARG_TYPE; The provided arguments length (${args.length}) does not match the required ones (${msg.length}).`);\n const message = ReflectApply(msg, error, args);\n ObjectDefineProperty(error, \"message\", { value: message, enumerable: !1, writable: !0, configurable: !0 }), ObjectDefineProperty(error, \"toString\", {\n value() {\n return `${this.name} [ERR_INVALID_ARG_TYPE]: ${this.message}`;\n },\n enumerable: !1,\n writable: !0,\n configurable: !0\n });\n let err = error;\n const userStackTraceLimit = Error.stackTraceLimit;\n return Error.stackTraceLimit = @Infinity, ErrorCaptureStackTrace(err), Error.stackTraceLimit = userStackTraceLimit, err.name = `${TypeError.name} [ERR_INVALID_ARG_TYPE]`, err.stack, delete err.name, error.code = \"ERR_INVALID_ARG_TYPE\", error;\n };\n}\nvar validateObject = (value, name, allowArray = !1) => {\n if (value === null || !allowArray && ArrayIsArray(value) || typeof value !== \"object\" && typeof value !== \"function\")\n throw new codes.ERR_INVALID_ARG_TYPE(name, \"Object\", value);\n}, builtInObjects = new SafeSet(ArrayPrototypeFilter(ObjectGetOwnPropertyNames(globalThis), (e) => RegExpPrototypeExec(/^[A-Z][a-zA-Z0-9]+$/, e) !== null)), isUndetectableObject = (v) => typeof v === \"undefined\" && v !== @undefined, ERROR_STACK_OVERFLOW_MSG = \"Maximum call stack size exceeded.\", inspectDefaultOptions = ObjectSeal({\n showHidden: !1,\n depth: 2,\n colors: !1,\n customInspect: !0,\n showProxy: !1,\n maxArrayLength: 100,\n maxStringLength: 1e4,\n breakLength: 80,\n compact: 3,\n sorted: !1,\n getters: !1,\n numericSeparator: !1\n}), inspectReplDefaults = ObjectSeal({\n ...inspectDefaultOptions,\n colors: Bun.enableANSIColors,\n showProxy: !0\n}), kObjectType = 0, kArrayType = 1, kArrayExtrasType = 2, strEscapeSequencesRegExp, strEscapeSequencesReplacer, strEscapeSequencesRegExpSingle, strEscapeSequencesReplacerSingle, extractedSplitNewLines;\ntry {\n strEscapeSequencesRegExp = new RegExp(\"[\\\\x00-\\\\x1f\\\\x27\\\\x5c\\\\x7f-\\\\x9f]|[\\\\ud800-\\\\udbff](\?![\\\\udc00-\\\\udfff])|(\? RegExpPrototypeSymbolSplit(extractedNewLineRe, value);\n} catch {\n strEscapeSequencesRegExp = /[\\x00-\\x1f\\x27\\x5c\\x7f-\\x9f]/, strEscapeSequencesReplacer = /[\\x00-\\x1f\\x27\\x5c\\x7f-\\x9f]/g, strEscapeSequencesRegExpSingle = /[\\x00-\\x1f\\x5c\\x7f-\\x9f]/, strEscapeSequencesReplacerSingle = /[\\x00-\\x1f\\x5c\\x7f-\\x9f]/g, extractedSplitNewLines = (value) => {\n const lines = RegExpPrototypeSymbolSplit(/\\n/, value), last = ArrayPrototypePop(lines), nlLines = ArrayPrototypeMap(lines, (line) => line + \"\\n\");\n if (last !== \"\")\n nlLines.push(last);\n return nlLines;\n };\n}\nvar keyStrRegExp = /^[a-zA-Z_][a-zA-Z_0-9]*$/, numberRegExp = /^(0|[1-9][0-9]*)$/, coreModuleRegExp = /^ {4}at (\?:[^/\\\\(]+ \\(|)node:(.+):\\d+:\\d+\\)\?$/, nodeModulesRegExp = /[/\\\\]node_modules[/\\\\](.+\?)(\?=[/\\\\])/g, classRegExp = /^(\\s+[^(]*\?)\\s*{/, stripCommentsRegExp = /(\\/\\/.*\?\\n)|(\\/\\*(.|\\n)*\?\\*\\/)/g, kMinLineLength = 16, kWeak = 0, kIterator = 1, kMapEntries = 2, meta = [\n \"\\\\x00\",\n \"\\\\x01\",\n \"\\\\x02\",\n \"\\\\x03\",\n \"\\\\x04\",\n \"\\\\x05\",\n \"\\\\x06\",\n \"\\\\x07\",\n \"\\\\b\",\n \"\\\\t\",\n \"\\\\n\",\n \"\\\\x0B\",\n \"\\\\f\",\n \"\\\\r\",\n \"\\\\x0E\",\n \"\\\\x0F\",\n \"\\\\x10\",\n \"\\\\x11\",\n \"\\\\x12\",\n \"\\\\x13\",\n \"\\\\x14\",\n \"\\\\x15\",\n \"\\\\x16\",\n \"\\\\x17\",\n \"\\\\x18\",\n \"\\\\x19\",\n \"\\\\x1A\",\n \"\\\\x1B\",\n \"\\\\x1C\",\n \"\\\\x1D\",\n \"\\\\x1E\",\n \"\\\\x1F\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\\\\'\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\\\\\\\\\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\\\\x7F\",\n \"\\\\x80\",\n \"\\\\x81\",\n \"\\\\x82\",\n \"\\\\x83\",\n \"\\\\x84\",\n \"\\\\x85\",\n \"\\\\x86\",\n \"\\\\x87\",\n \"\\\\x88\",\n \"\\\\x89\",\n \"\\\\x8A\",\n \"\\\\x8B\",\n \"\\\\x8C\",\n \"\\\\x8D\",\n \"\\\\x8E\",\n \"\\\\x8F\",\n \"\\\\x90\",\n \"\\\\x91\",\n \"\\\\x92\",\n \"\\\\x93\",\n \"\\\\x94\",\n \"\\\\x95\",\n \"\\\\x96\",\n \"\\\\x97\",\n \"\\\\x98\",\n \"\\\\x99\",\n \"\\\\x9A\",\n \"\\\\x9B\",\n \"\\\\x9C\",\n \"\\\\x9D\",\n \"\\\\x9E\",\n \"\\\\x9F\"\n], getStringWidth;\ninspect.custom = customInspectSymbol;\nObjectDefineProperty(inspect, \"defaultOptions\", {\n __proto__: null,\n get() {\n return inspectDefaultOptions;\n },\n set(options) {\n return validateObject(options, \"options\"), ObjectAssign(inspectDefaultOptions, options);\n }\n});\nObjectDefineProperty(inspect, \"replDefaults\", {\n __proto__: null,\n get() {\n return inspectReplDefaults;\n },\n set(options) {\n return validateObject(options, \"options\"), ObjectAssign(inspectReplDefaults, options);\n }\n});\nvar defaultFG = 39, defaultBG = 49;\ninspect.colors = {\n __proto__: null,\n reset: [0, 0],\n bold: [1, 22],\n dim: [2, 22],\n italic: [3, 23],\n underline: [4, 24],\n blink: [5, 25],\n inverse: [7, 27],\n hidden: [8, 28],\n strikethrough: [9, 29],\n doubleunderline: [21, 24],\n black: [30, defaultFG],\n red: [31, defaultFG],\n green: [32, defaultFG],\n yellow: [33, defaultFG],\n blue: [34, defaultFG],\n magenta: [35, defaultFG],\n cyan: [36, defaultFG],\n white: [37, defaultFG],\n bgBlack: [40, defaultBG],\n bgRed: [41, defaultBG],\n bgGreen: [42, defaultBG],\n bgYellow: [43, defaultBG],\n bgBlue: [44, defaultBG],\n bgMagenta: [45, defaultBG],\n bgCyan: [46, defaultBG],\n bgWhite: [47, defaultBG],\n framed: [51, 54],\n overlined: [53, 55],\n gray: [90, defaultFG],\n redBright: [91, defaultFG],\n greenBright: [92, defaultFG],\n yellowBright: [93, defaultFG],\n blueBright: [94, defaultFG],\n magentaBright: [95, defaultFG],\n cyanBright: [96, defaultFG],\n whiteBright: [97, defaultFG],\n bgGray: [100, defaultBG],\n bgRedBright: [101, defaultBG],\n bgGreenBright: [102, defaultBG],\n bgYellowBright: [103, defaultBG],\n bgBlueBright: [104, defaultBG],\n bgMagentaBright: [105, defaultBG],\n bgCyanBright: [106, defaultBG],\n bgWhiteBright: [107, defaultBG]\n};\ndefineColorAlias(\"gray\", \"grey\");\ndefineColorAlias(\"gray\", \"blackBright\");\ndefineColorAlias(\"bgGray\", \"bgGrey\");\ndefineColorAlias(\"bgGray\", \"bgBlackBright\");\ndefineColorAlias(\"dim\", \"faint\");\ndefineColorAlias(\"strikethrough\", \"crossedout\");\ndefineColorAlias(\"strikethrough\", \"strikeThrough\");\ndefineColorAlias(\"strikethrough\", \"crossedOut\");\ndefineColorAlias(\"hidden\", \"conceal\");\ndefineColorAlias(\"inverse\", \"swapColors\");\ndefineColorAlias(\"inverse\", \"swapcolors\");\ndefineColorAlias(\"doubleunderline\", \"doubleUnderline\");\ninspect.styles = {\n __proto__: null,\n special: \"cyan\",\n number: \"yellow\",\n bigint: \"yellow\",\n boolean: \"yellow\",\n undefined: \"grey\",\n null: \"bold\",\n string: \"green\",\n symbol: \"green\",\n date: \"magenta\",\n regexp: \"red\",\n module: \"underline\"\n};\nvar remainingText = (remaining) => `... ${remaining} more item${remaining > 1 \? \"s\" : \"\"}`, firstErrorLine = (error) => StringPrototypeSplit(error.message, \"\\n\", 1)[0], CIRCULAR_ERROR_MESSAGE;\n{\n getStringWidth = function getStringWidth(str, removeControlChars = !0) {\n let width = 0;\n if (removeControlChars)\n str = stripVTControlCharacters(str);\n str = StringPrototypeNormalize(str, \"NFC\");\n for (let char of new SafeStringIterator(str)) {\n const code = StringPrototypeCodePointAt(char, 0);\n if (isFullWidthCodePoint(code))\n width += 2;\n else if (!isZeroWidthCodePoint(code))\n width++;\n }\n return width;\n };\n const isFullWidthCodePoint = (code) => {\n return code >= 4352 && (code <= 4447 || code === 9001 || code === 9002 || code >= 11904 && code <= 12871 && code !== 12351 || code >= 12880 && code <= 19903 || code >= 19968 && code <= 42182 || code >= 43360 && code <= 43388 || code >= 44032 && code <= 55203 || code >= 63744 && code <= 64255 || code >= 65040 && code <= 65049 || code >= 65072 && code <= 65131 || code >= 65281 && code <= 65376 || code >= 65504 && code <= 65510 || code >= 110592 && code <= 110593 || code >= 127488 && code <= 127569 || code >= 127744 && code <= 128591 || code >= 131072 && code <= 262141);\n };\n}\nvar ansiPattern = \"[\\\\u001B\\\\u009B][[\\\\]()#;\?]*(\?:(\?:(\?:(\?:;[-a-zA-Z\\\\d\\\\/#&.:=\?%@~_]+)*|[a-zA-Z\\\\d]+(\?:;[-a-zA-Z\\\\d\\\\/#&.:=\?%@~_]*)*)\?\\\\u0007)|(\?:(\?:\\\\d{1,4}(\?:;\\\\d{0,4})*)\?[\\\\dA-PR-TZcf-ntqry=><~]))\", ansi = new RegExp(ansiPattern, \"g\");\n$ = {\n inspect,\n format,\n formatWithOptions,\n stripVTControlCharacters\n};\n//! non-standard properties, should these be kept\? (not currently exposed)\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeAssertCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/assert.ts\nvar CallTracker = function() {\n throw new Error(\"CallTracker is not supported yet\");\n}, util = @getInternalField(@internalModuleRegistry, 48) || @createInternalModuleById(48), isDeepEqual = Bun.deepEquals, __commonJS = (cb, mod) => function() {\n return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n}, require_errors = __commonJS({\n \"assert/build/internal/errors.js\"(exports, module2) {\n function _typeof(obj) {\n return typeof Symbol == \"function\" && typeof Symbol.iterator == \"symbol\" \? _typeof = function(obj2) {\n return typeof obj2;\n } : _typeof = function(obj2) {\n return obj2 && typeof Symbol == \"function\" && obj2.constructor === Symbol && obj2 !== Symbol.prototype \? \"symbol\" : typeof obj2;\n }, _typeof(obj);\n }\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor))\n @throwTypeError(\"Cannot call a class as a function\");\n }\n function _possibleConstructorReturn(self, call) {\n return call && (_typeof(call) === \"object\" || typeof call == \"function\") \? call : _assertThisInitialized(self);\n }\n function _assertThisInitialized(self) {\n if (self === void 0)\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n return self;\n }\n function _getPrototypeOf(o) {\n return _getPrototypeOf = Object.setPrototypeOf \? Object.getPrototypeOf : function(o2) {\n return o2.__proto__ || Object.getPrototypeOf(o2);\n }, _getPrototypeOf(o);\n }\n function _inherits(subClass, superClass) {\n if (typeof superClass != \"function\" && superClass !== null)\n @throwTypeError(\"Super expression must either be null or a function\");\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: { value: subClass, writable: !0, configurable: !0 }\n }), superClass && _setPrototypeOf(subClass, superClass);\n }\n function _setPrototypeOf(o, p) {\n return _setPrototypeOf = Object.setPrototypeOf || function(o2, p2) {\n return o2.__proto__ = p2, o2;\n }, _setPrototypeOf(o, p);\n }\n var codes = {}, assert, util2;\n function createErrorType(code, message, Base) {\n Base || (Base = Error);\n function getMessage(arg1, arg2, arg3) {\n return typeof message == \"string\" \? message : message(arg1, arg2, arg3);\n }\n var NodeError = function(_Base) {\n _inherits(NodeError2, _Base);\n function NodeError2(arg1, arg2, arg3) {\n var _this;\n return _classCallCheck(this, NodeError2), _this = _possibleConstructorReturn(this, _getPrototypeOf(NodeError2).@call(this, getMessage(arg1, arg2, arg3))), _this.code = code, _this;\n }\n return NodeError2;\n }(Base);\n codes[code] = NodeError;\n }\n function oneOf(expected, thing) {\n if (@Array.isArray(expected)) {\n var len = expected.length;\n return expected = expected.map(function(i) {\n return @String(i);\n }), len > 2 \? \"one of \".concat(thing, \" \").concat(expected.slice(0, len - 1).join(\", \"), \", or \") + expected[len - 1] : len === 2 \? \"one of \".concat(thing, \" \").concat(expected[0], \" or \").concat(expected[1]) : \"of \".concat(thing, \" \").concat(expected[0]);\n } else\n return \"of \".concat(thing, \" \").concat(@String(expected));\n }\n function startsWith(str, search, pos) {\n return str.substr(!pos || pos < 0 \? 0 : +pos, search.length) === search;\n }\n function endsWith(str, search, this_len) {\n return (this_len === void 0 || this_len > str.length) && (this_len = str.length), str.substring(this_len - search.length, this_len) === search;\n }\n function includes(str, search, start) {\n return typeof start != \"number\" && (start = 0), start + search.length > str.length \? !1 : str.indexOf(search, start) !== -1;\n }\n createErrorType(\"ERR_AMBIGUOUS_ARGUMENT\", 'The \"%s\" argument is ambiguous. %s', TypeError), createErrorType(\"ERR_INVALID_ARG_TYPE\", function(name, expected, actual) {\n assert === void 0 && (assert = require_assert()), assert(typeof name == \"string\", \"'name' must be a string\");\n var determiner;\n typeof expected == \"string\" && startsWith(expected, \"not \") \? (determiner = \"must not be\", expected = expected.replace(/^not /, \"\")) : determiner = \"must be\";\n var msg;\n if (endsWith(name, \" argument\"))\n msg = \"The \".concat(name, \" \").concat(determiner, \" \").concat(oneOf(expected, \"type\"));\n else {\n var type = includes(name, \".\") \? \"property\" : \"argument\";\n msg = 'The \"'.concat(name, '\" ').concat(type, \" \").concat(determiner, \" \").concat(oneOf(expected, \"type\"));\n }\n return msg += \". Received type \".concat(_typeof(actual)), msg;\n }, TypeError), createErrorType(\"ERR_INVALID_ARG_VALUE\", function(name, value) {\n var reason = arguments.length > 2 && arguments[2] !== void 0 \? arguments[2] : \"is invalid\", inspected = util2.inspect(value);\n return inspected.length > 128 && (inspected = \"\".concat(inspected.slice(0, 128), \"...\")), \"The argument '\".concat(name, \"' \").concat(reason, \". Received \").concat(inspected);\n }, TypeError, RangeError), createErrorType(\"ERR_INVALID_RETURN_VALUE\", function(input, name, value) {\n var type;\n return value && value.constructor && value.constructor.name \? type = \"instance of \".concat(value.constructor.name) : type = \"type \".concat(_typeof(value)), \"Expected \".concat(input, ' to be returned from the \"').concat(name, '\"') + \" function but got \".concat(type, \".\");\n }, TypeError), createErrorType(\"ERR_MISSING_ARGS\", function() {\n for (var _len = arguments.length, args = new @Array(_len), _key = 0;_key < _len; _key++)\n args[_key] = arguments[_key];\n assert === void 0 && (assert = require_assert()), assert(args.length > 0, \"At least one arg needs to be specified\");\n var msg = \"The \", len = args.length;\n switch (args = args.map(function(a) {\n return '\"'.concat(a, '\"');\n }), len) {\n case 1:\n msg += \"\".concat(args[0], \" argument\");\n break;\n case 2:\n msg += \"\".concat(args[0], \" and \").concat(args[1], \" arguments\");\n break;\n default:\n msg += args.slice(0, len - 1).join(\", \"), msg += \", and \".concat(args[len - 1], \" arguments\");\n break;\n }\n return \"\".concat(msg, \" must be specified\");\n }, TypeError), module2.exports.codes = codes;\n }\n}), require_assertion_error = __commonJS({\n \"assert/build/internal/assert/assertion_error.js\"(exports, module2) {\n function _objectSpread(target) {\n for (var i = 1;i < arguments.length; i++) {\n var source = arguments[i] != null \? arguments[i] : {}, ownKeys = Object.keys(source);\n typeof Object.getOwnPropertySymbols == \"function\" && (ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }))), ownKeys.forEach(function(key) {\n _defineProperty(target, key, source[key]);\n });\n }\n return target;\n }\n function _defineProperty(obj, key, value) {\n return (key in obj) \? Object.defineProperty(obj, key, {\n value,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : obj[key] = value, obj;\n }\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor))\n @throwTypeError(\"Cannot call a class as a function\");\n }\n function _defineProperties(target, props) {\n for (var i = 0;i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, (\"value\" in descriptor) && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n function _createClass(Constructor, protoProps, staticProps) {\n return protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), Constructor;\n }\n function _possibleConstructorReturn(self, call) {\n return call && (_typeof(call) === \"object\" || typeof call == \"function\") \? call : _assertThisInitialized(self);\n }\n function _assertThisInitialized(self) {\n if (self === void 0)\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n return self;\n }\n function _inherits(subClass, superClass) {\n if (typeof superClass != \"function\" && superClass !== null)\n @throwTypeError(\"Super expression must either be null or a function\");\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: { value: subClass, writable: !0, configurable: !0 }\n }), superClass && _setPrototypeOf(subClass, superClass);\n }\n function _wrapNativeSuper(Class) {\n var _cache = typeof Map == \"function\" \? new Map : void 0;\n return _wrapNativeSuper = function(Class2) {\n if (Class2 === null || !_isNativeFunction(Class2))\n return Class2;\n if (typeof Class2 != \"function\")\n @throwTypeError(\"Super expression must either be null or a function\");\n if (typeof _cache != \"undefined\") {\n if (_cache.has(Class2))\n return _cache.get(Class2);\n _cache.set(Class2, Wrapper);\n }\n function Wrapper() {\n return _construct(Class2, arguments, _getPrototypeOf(this).constructor);\n }\n return Wrapper.prototype = Object.create(Class2.prototype, {\n constructor: {\n value: Wrapper,\n enumerable: !1,\n writable: !0,\n configurable: !0\n }\n }), _setPrototypeOf(Wrapper, Class2);\n }, _wrapNativeSuper(Class);\n }\n function isNativeReflectConstruct() {\n if (typeof Reflect == \"undefined\" || !Reflect.construct || Reflect.construct.sham)\n return !1;\n if (typeof Proxy == \"function\")\n return !0;\n try {\n return Date.prototype.toString.@call(Reflect.construct(Date, [], function() {\n })), !0;\n } catch {\n return !1;\n }\n }\n function _construct(Parent, args, Class) {\n return isNativeReflectConstruct() \? _construct = Reflect.construct : _construct = function(Parent2, args2, Class2) {\n var a = [null];\n a.push.@apply(a, args2);\n var Constructor = Function.bind.@apply(Parent2, a), instance = new Constructor;\n return Class2 && _setPrototypeOf(instance, Class2.prototype), instance;\n }, _construct.@apply(null, arguments);\n }\n function _isNativeFunction(fn) {\n return Function.toString.@call(fn).indexOf(\"[native code]\") !== -1;\n }\n function _setPrototypeOf(o, p) {\n return _setPrototypeOf = Object.setPrototypeOf || function(o2, p2) {\n return o2.__proto__ = p2, o2;\n }, _setPrototypeOf(o, p);\n }\n function _getPrototypeOf(o) {\n return _getPrototypeOf = Object.setPrototypeOf \? Object.getPrototypeOf : function(o2) {\n return o2.__proto__ || Object.getPrototypeOf(o2);\n }, _getPrototypeOf(o);\n }\n function _typeof(obj) {\n return typeof Symbol == \"function\" && typeof Symbol.iterator == \"symbol\" \? _typeof = function(obj2) {\n return typeof obj2;\n } : _typeof = function(obj2) {\n return obj2 && typeof Symbol == \"function\" && obj2.constructor === Symbol && obj2 !== Symbol.prototype \? \"symbol\" : typeof obj2;\n }, _typeof(obj);\n }\n var inspect = util.inspect, _require2 = require_errors(), ERR_INVALID_ARG_TYPE = _require2.codes.ERR_INVALID_ARG_TYPE;\n function endsWith(str, search, this_len) {\n return (this_len === void 0 || this_len > str.length) && (this_len = str.length), str.substring(this_len - search.length, this_len) === search;\n }\n function repeat(str, count) {\n if (count = Math.floor(count), str.length == 0 || count == 0)\n return \"\";\n var maxCount = str.length * count;\n for (count = Math.floor(Math.log(count) / Math.log(2));count; )\n str += str, count--;\n return str += str.substring(0, maxCount - str.length), str;\n }\n var blue = \"\", green = \"\", red = \"\", white = \"\", kReadableOperator = {\n deepStrictEqual: \"Expected values to be strictly deep-equal:\",\n strictEqual: \"Expected values to be strictly equal:\",\n strictEqualObject: 'Expected \"actual\" to be reference-equal to \"expected\":',\n deepEqual: \"Expected values to be loosely deep-equal:\",\n equal: \"Expected values to be loosely equal:\",\n notDeepStrictEqual: 'Expected \"actual\" not to be strictly deep-equal to:',\n notStrictEqual: 'Expected \"actual\" to be strictly unequal to:',\n notStrictEqualObject: 'Expected \"actual\" not to be reference-equal to \"expected\":',\n notDeepEqual: 'Expected \"actual\" not to be loosely deep-equal to:',\n notEqual: 'Expected \"actual\" to be loosely unequal to:',\n notIdentical: \"Values identical but not reference-equal:\"\n }, kMaxShortLength = 10;\n function copyError(source) {\n var keys = Object.keys(source), target = Object.create(Object.getPrototypeOf(source));\n return keys.forEach(function(key) {\n target[key] = source[key];\n }), Object.defineProperty(target, \"message\", {\n value: source.message\n }), target;\n }\n function inspectValue(val) {\n return inspect(val, {\n compact: !1,\n customInspect: !1,\n depth: 1000,\n maxArrayLength: Infinity,\n showHidden: !1,\n breakLength: Infinity,\n showProxy: !1,\n sorted: !0,\n getters: !0\n });\n }\n function createErrDiff(actual, expected, operator) {\n var other = \"\", res = \"\", lastPos = 0, end = \"\", skipped = !1, actualInspected = inspectValue(actual), actualLines = actualInspected.split(`\n`), expectedLines = inspectValue(expected).split(`\n`), i = 0, indicator = \"\";\n if (operator === \"strictEqual\" && _typeof(actual) === \"object\" && _typeof(expected) === \"object\" && actual !== null && expected !== null && (operator = \"strictEqualObject\"), actualLines.length === 1 && expectedLines.length === 1 && actualLines[0] !== expectedLines[0]) {\n var inputLength = actualLines[0].length + expectedLines[0].length;\n if (inputLength <= kMaxShortLength) {\n if ((_typeof(actual) !== \"object\" || actual === null) && (_typeof(expected) !== \"object\" || expected === null) && (actual !== 0 || expected !== 0))\n return \"\".concat(kReadableOperator[operator], `\n\n`) + \"\".concat(actualLines[0], \" !== \").concat(expectedLines[0], `\n`);\n } else if (operator !== \"strictEqualObject\") {\n var maxLength = process.stderr && process.stderr.isTTY \? process.stderr.columns : 80;\n if (inputLength < maxLength) {\n for (;actualLines[0][i] === expectedLines[0][i]; )\n i++;\n i > 2 && (indicator = `\n `.concat(repeat(\" \", i), \"^\"), i = 0);\n }\n }\n }\n for (var a = actualLines[actualLines.length - 1], b = expectedLines[expectedLines.length - 1];a === b && (i++ < 2 \? end = `\n `.concat(a).concat(end) : other = a, actualLines.pop(), expectedLines.pop(), !(actualLines.length === 0 || expectedLines.length === 0)); )\n a = actualLines[actualLines.length - 1], b = expectedLines[expectedLines.length - 1];\n var maxLines = Math.max(actualLines.length, expectedLines.length);\n if (maxLines === 0) {\n var _actualLines = actualInspected.split(`\n`);\n if (_actualLines.length > 30)\n for (_actualLines[26] = \"\".concat(blue, \"...\").concat(white);_actualLines.length > 27; )\n _actualLines.pop();\n return \"\".concat(kReadableOperator.notIdentical, `\n\n`).concat(_actualLines.join(`\n`), `\n`);\n }\n i > 3 && (end = `\n`.concat(blue, \"...\").concat(white).concat(end), skipped = !0), other !== \"\" && (end = `\n `.concat(other).concat(end), other = \"\");\n var printedLines = 0, msg = kReadableOperator[operator] + `\n`.concat(green, \"+ actual\").concat(white, \" \").concat(red, \"- expected\").concat(white), skippedMsg = \" \".concat(blue, \"...\").concat(white, \" Lines skipped\");\n for (i = 0;i < maxLines; i++) {\n var cur = i - lastPos;\n if (actualLines.length < i + 1)\n cur > 1 && i > 2 && (cur > 4 \? (res += `\n`.concat(blue, \"...\").concat(white), skipped = !0) : cur > 3 && (res += `\n `.concat(expectedLines[i - 2]), printedLines++), res += `\n `.concat(expectedLines[i - 1]), printedLines++), lastPos = i, other += `\n`.concat(red, \"-\").concat(white, \" \").concat(expectedLines[i]), printedLines++;\n else if (expectedLines.length < i + 1)\n cur > 1 && i > 2 && (cur > 4 \? (res += `\n`.concat(blue, \"...\").concat(white), skipped = !0) : cur > 3 && (res += `\n `.concat(actualLines[i - 2]), printedLines++), res += `\n `.concat(actualLines[i - 1]), printedLines++), lastPos = i, res += `\n`.concat(green, \"+\").concat(white, \" \").concat(actualLines[i]), printedLines++;\n else {\n var expectedLine = expectedLines[i], actualLine = actualLines[i], divergingLines = actualLine !== expectedLine && (!endsWith(actualLine, \",\") || actualLine.slice(0, -1) !== expectedLine);\n divergingLines && endsWith(expectedLine, \",\") && expectedLine.slice(0, -1) === actualLine && (divergingLines = !1, actualLine += \",\"), divergingLines \? (cur > 1 && i > 2 && (cur > 4 \? (res += `\n`.concat(blue, \"...\").concat(white), skipped = !0) : cur > 3 && (res += `\n `.concat(actualLines[i - 2]), printedLines++), res += `\n `.concat(actualLines[i - 1]), printedLines++), lastPos = i, res += `\n`.concat(green, \"+\").concat(white, \" \").concat(actualLine), other += `\n`.concat(red, \"-\").concat(white, \" \").concat(expectedLine), printedLines += 2) : (res += other, other = \"\", (cur === 1 || i === 0) && (res += `\n `.concat(actualLine), printedLines++));\n }\n if (printedLines > 20 && i < maxLines - 2)\n return \"\".concat(msg).concat(skippedMsg, `\n`).concat(res, `\n`).concat(blue, \"...\").concat(white).concat(other, `\n`) + \"\".concat(blue, \"...\").concat(white);\n }\n return \"\".concat(msg).concat(skipped \? skippedMsg : \"\", `\n`).concat(res).concat(other).concat(end).concat(indicator);\n }\n var AssertionError = function(_Error) {\n function AssertionError2(options) {\n var _this;\n if (_classCallCheck(this, AssertionError2), _typeof(options) !== \"object\" || options === null)\n throw new ERR_INVALID_ARG_TYPE(\"options\", \"Object\", options);\n var { message, operator, stackStartFn, actual, expected } = options, limit = Error.stackTraceLimit;\n if (Error.stackTraceLimit = 0, message != null)\n _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).@call(this, @String(message)));\n else if (process.stderr && process.stderr.isTTY && (process.stderr && process.stderr.getColorDepth && process.stderr.getColorDepth() !== 1 \? (blue = \"\", green = \"\", white = \"\", red = \"\") : (blue = \"\", green = \"\", white = \"\", red = \"\")), _typeof(actual) === \"object\" && actual !== null && _typeof(expected) === \"object\" && expected !== null && (\"stack\" in actual) && actual instanceof Error && (\"stack\" in expected) && expected instanceof Error && (actual = copyError(actual), expected = copyError(expected)), operator === \"deepStrictEqual\" || operator === \"strictEqual\")\n _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).@call(this, createErrDiff(actual, expected, operator)));\n else if (operator === \"notDeepStrictEqual\" || operator === \"notStrictEqual\") {\n var base = kReadableOperator[operator], res = inspectValue(actual).split(`\n`);\n if (operator === \"notStrictEqual\" && _typeof(actual) === \"object\" && actual !== null && (base = kReadableOperator.notStrictEqualObject), res.length > 30)\n for (res[26] = \"\".concat(blue, \"...\").concat(white);res.length > 27; )\n res.pop();\n res.length === 1 \? _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).@call(this, \"\".concat(base, \" \").concat(res[0]))) : _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).@call(this, \"\".concat(base, `\n\n`).concat(res.join(`\n`), `\n`)));\n } else {\n var _res = inspectValue(actual), other = \"\", knownOperators = kReadableOperator[operator];\n operator === \"notDeepEqual\" || operator === \"notEqual\" \? (_res = \"\".concat(kReadableOperator[operator], `\n\n`).concat(_res), _res.length > 1024 && (_res = \"\".concat(_res.slice(0, 1021), \"...\"))) : (other = \"\".concat(inspectValue(expected)), _res.length > 512 && (_res = \"\".concat(_res.slice(0, 509), \"...\")), other.length > 512 && (other = \"\".concat(other.slice(0, 509), \"...\")), operator === \"deepEqual\" || operator === \"equal\" \? _res = \"\".concat(knownOperators, `\n\n`).concat(_res, `\n\nshould equal\n\n`) : other = \" \".concat(operator, \" \").concat(other)), _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).@call(this, \"\".concat(_res).concat(other)));\n }\n return Error.stackTraceLimit = limit, _this.generatedMessage = !message, Object.defineProperty(_assertThisInitialized(_this), \"name\", {\n value: \"AssertionError [ERR_ASSERTION]\",\n enumerable: !1,\n writable: !0,\n configurable: !0\n }), _this.code = \"ERR_ASSERTION\", _this.actual = actual, _this.expected = expected, _this.operator = operator, Error.captureStackTrace && Error.captureStackTrace(_assertThisInitialized(_this), stackStartFn), _this.stack, _this.name = \"AssertionError\", _possibleConstructorReturn(_this);\n }\n return AssertionError2.prototype = {}, _inherits(AssertionError2, _Error), _createClass(AssertionError2, [\n {\n key: \"toString\",\n value: function() {\n return \"\".concat(this.name, \" [\").concat(this.code, \"]: \").concat(this.message);\n }\n },\n {\n key: inspect.custom,\n value: function(recurseTimes, ctx) {\n return inspect(this, _objectSpread({}, ctx, {\n customInspect: !1,\n depth: 0\n }));\n }\n }\n ]), AssertionError2;\n }(_wrapNativeSuper(Error));\n module2.exports = AssertionError;\n }\n}), require_assert = __commonJS({\n \"assert/build/assert.js\"(exports, module2) {\n function _typeof(obj) {\n return typeof Symbol == \"function\" && typeof Symbol.iterator == \"symbol\" \? _typeof = function(obj2) {\n return typeof obj2;\n } : _typeof = function(obj2) {\n return obj2 && typeof Symbol == \"function\" && obj2.constructor === Symbol && obj2 !== Symbol.prototype \? \"symbol\" : typeof obj2;\n }, _typeof(obj);\n }\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor))\n @throwTypeError(\"Cannot call a class as a function\");\n }\n var _require = require_errors(), _require$codes = _require.codes, ERR_AMBIGUOUS_ARGUMENT = _require$codes.ERR_AMBIGUOUS_ARGUMENT, ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_VALUE = _require$codes.ERR_INVALID_ARG_VALUE, ERR_INVALID_RETURN_VALUE = _require$codes.ERR_INVALID_RETURN_VALUE, ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, AssertionError = require_assertion_error(), _require2 = util, inspect = _require2.inspect, _require$types = util.types, isPromise = _require$types.isPromise, isRegExp = _require$types.isRegExp, objectAssign = Object.assign, objectIs = Object.is, errorCache = new Map, warned = !1, assert = module2.exports = ok, NO_EXCEPTION_SENTINEL = {};\n function innerFail(obj) {\n throw obj.message instanceof Error \? obj.message : new AssertionError(obj);\n }\n function fail(actual, expected, message, operator, stackStartFn) {\n var argsLen = arguments.length, internalMessage;\n if (argsLen === 0)\n internalMessage = \"Failed\";\n else if (argsLen === 1)\n message = actual, actual = void 0;\n else {\n if (warned === !1) {\n warned = !0;\n var warn = process.emitWarning \? process.emitWarning : console.warn.bind(console);\n warn(\"assert.fail() with more than one argument is deprecated. Please use assert.strictEqual() instead or only pass a message.\", \"DeprecationWarning\", \"DEP0094\");\n }\n argsLen === 2 && (operator = \"!=\");\n }\n if (message instanceof Error)\n throw message;\n var errArgs = {\n actual,\n expected,\n operator: operator === void 0 \? \"fail\" : operator,\n stackStartFn: stackStartFn || fail\n };\n message !== void 0 && (errArgs.message = message);\n var err = new AssertionError(errArgs);\n throw internalMessage && (err.message = internalMessage, err.generatedMessage = !0), err;\n }\n assert.fail = fail, assert.AssertionError = AssertionError;\n function innerOk(fn, argLen, value, message) {\n if (!value) {\n var generatedMessage = !1;\n if (argLen === 0)\n generatedMessage = !0, message = \"No value argument passed to `assert.ok()`\";\n else if (message instanceof Error)\n throw message;\n var err = new AssertionError({\n actual: value,\n expected: !0,\n message,\n operator: \"==\",\n stackStartFn: fn\n });\n throw err.generatedMessage = generatedMessage, err;\n }\n }\n function ok() {\n for (var _len = arguments.length, args = new @Array(_len), _key = 0;_key < _len; _key++)\n args[_key] = arguments[_key];\n innerOk.@apply(void 0, [ok, args.length].concat(args));\n }\n assert.ok = ok, assert.equal = function equal(actual, expected, message) {\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n actual != expected && innerFail({\n actual,\n expected,\n message,\n operator: \"==\",\n stackStartFn: equal\n });\n }, assert.notEqual = function notEqual(actual, expected, message) {\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n actual == expected && innerFail({\n actual,\n expected,\n message,\n operator: \"!=\",\n stackStartFn: notEqual\n });\n }, assert.deepEqual = function deepEqual(actual, expected, message) {\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n isDeepEqual(actual, expected, !1) || innerFail({\n actual,\n expected,\n message,\n operator: \"deepEqual\",\n stackStartFn: deepEqual\n });\n }, assert.notDeepEqual = function notDeepEqual(actual, expected, message) {\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n isDeepEqual(actual, expected, !1) && innerFail({\n actual,\n expected,\n message,\n operator: \"notDeepEqual\",\n stackStartFn: notDeepEqual\n });\n }, assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n isDeepEqual(actual, expected, !0) || innerFail({\n actual,\n expected,\n message,\n operator: \"deepStrictEqual\",\n stackStartFn: deepStrictEqual\n });\n }, assert.notDeepStrictEqual = notDeepStrictEqual;\n function notDeepStrictEqual(actual, expected, message) {\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n isDeepEqual(actual, expected, !0) && innerFail({\n actual,\n expected,\n message,\n operator: \"notDeepStrictEqual\",\n stackStartFn: notDeepStrictEqual\n });\n }\n assert.strictEqual = function strictEqual(actual, expected, message) {\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n objectIs(actual, expected) || innerFail({\n actual,\n expected,\n message,\n operator: \"strictEqual\",\n stackStartFn: strictEqual\n });\n }, assert.notStrictEqual = function notStrictEqual(actual, expected, message) {\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n objectIs(actual, expected) && innerFail({\n actual,\n expected,\n message,\n operator: \"notStrictEqual\",\n stackStartFn: notStrictEqual\n });\n }, assert.match = function match(actual, expected, message) {\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n if (!isRegExp(expected))\n throw new ERR_INVALID_ARG_TYPE(\"expected\", \"RegExp\", expected);\n expected.test(actual) || innerFail({\n actual,\n expected,\n message,\n operator: \"match\",\n stackStartFn: match\n });\n };\n var Comparison = function Comparison2(obj, keys, actual) {\n var _this = this;\n _classCallCheck(this, Comparison2), keys.forEach(function(key) {\n (key in obj) && (actual !== void 0 && typeof actual[key] == \"string\" && isRegExp(obj[key]) && obj[key].test(actual[key]) \? _this[key] = actual[key] : _this[key] = obj[key]);\n });\n };\n function compareExceptionKey(actual, expected, key, message, keys, fn) {\n if (!(key in actual) || !isDeepEqual(actual[key], expected[key], !0)) {\n if (!message) {\n var a = new Comparison(actual, keys), b = new Comparison(expected, keys, actual), err = new AssertionError({\n actual: a,\n expected: b,\n operator: \"deepStrictEqual\",\n stackStartFn: fn\n });\n throw err.actual = actual, err.expected = expected, err.operator = fn.name, err;\n }\n innerFail({\n actual,\n expected,\n message,\n operator: fn.name,\n stackStartFn: fn\n });\n }\n }\n function expectedException(actual, expected, msg, fn) {\n if (typeof expected != \"function\") {\n if (isRegExp(expected))\n return expected.test(actual);\n if (arguments.length === 2)\n throw new ERR_INVALID_ARG_TYPE(\"expected\", [\"Function\", \"RegExp\"], expected);\n if (_typeof(actual) !== \"object\" || actual === null) {\n var err = new AssertionError({\n actual,\n expected,\n message: msg,\n operator: \"deepStrictEqual\",\n stackStartFn: fn\n });\n throw err.operator = fn.name, err;\n }\n var keys = Object.keys(expected);\n if (expected instanceof Error)\n keys.push(\"name\", \"message\");\n else if (keys.length === 0)\n throw new ERR_INVALID_ARG_VALUE(\"error\", expected, \"may not be an empty object\");\n return keys.forEach(function(key) {\n return typeof actual[key] == \"string\" && isRegExp(expected[key]) && expected[key].test(actual[key]) || compareExceptionKey(actual, expected, key, msg, keys, fn);\n }), !0;\n }\n return expected.prototype !== void 0 && actual instanceof expected \? !0 : Error.isPrototypeOf(expected) \? !1 : expected.@call({}, actual) === !0;\n }\n function getActual(fn) {\n if (typeof fn != \"function\")\n throw new ERR_INVALID_ARG_TYPE(\"fn\", \"Function\", fn);\n try {\n fn();\n } catch (e) {\n return e;\n }\n return NO_EXCEPTION_SENTINEL;\n }\n function checkIsPromise(obj) {\n return isPromise(obj) || obj !== null && _typeof(obj) === \"object\" && typeof obj.then == \"function\" && typeof obj.catch == \"function\";\n }\n function waitForActual(promiseFn) {\n return @Promise.resolve().then(function() {\n var resultPromise;\n if (typeof promiseFn == \"function\") {\n if (resultPromise = promiseFn(), !checkIsPromise(resultPromise))\n throw new ERR_INVALID_RETURN_VALUE(\"instance of Promise\", \"promiseFn\", resultPromise);\n } else if (checkIsPromise(promiseFn))\n resultPromise = promiseFn;\n else\n throw new ERR_INVALID_ARG_TYPE(\"promiseFn\", [\"Function\", \"Promise\"], promiseFn);\n return @Promise.resolve().then(function() {\n return resultPromise;\n }).then(function() {\n return NO_EXCEPTION_SENTINEL;\n }).catch(function(e) {\n return e;\n });\n });\n }\n function expectsError(stackStartFn, actual, error, message) {\n if (typeof error == \"string\") {\n if (arguments.length === 4)\n throw new ERR_INVALID_ARG_TYPE(\"error\", [\"Object\", \"Error\", \"Function\", \"RegExp\"], error);\n if (_typeof(actual) === \"object\" && actual !== null) {\n if (actual.message === error)\n throw new ERR_AMBIGUOUS_ARGUMENT(\"error/message\", 'The error message \"'.concat(actual.message, '\" is identical to the message.'));\n } else if (actual === error)\n throw new ERR_AMBIGUOUS_ARGUMENT(\"error/message\", 'The error \"'.concat(actual, '\" is identical to the message.'));\n message = error, error = void 0;\n } else if (error != null && _typeof(error) !== \"object\" && typeof error != \"function\")\n throw new ERR_INVALID_ARG_TYPE(\"error\", [\"Object\", \"Error\", \"Function\", \"RegExp\"], error);\n if (actual === NO_EXCEPTION_SENTINEL) {\n var details = \"\";\n error && error.name && (details += \" (\".concat(error.name, \")\")), details += message \? \": \".concat(message) : \".\";\n var fnType = stackStartFn.name === \"rejects\" \? \"rejection\" : \"exception\";\n innerFail({\n actual: void 0,\n expected: error,\n operator: stackStartFn.name,\n message: \"Missing expected \".concat(fnType).concat(details),\n stackStartFn\n });\n }\n if (error && !expectedException(actual, error, message, stackStartFn))\n throw actual;\n }\n function expectsNoError(stackStartFn, actual, error, message) {\n if (actual !== NO_EXCEPTION_SENTINEL) {\n if (typeof error == \"string\" && (message = error, error = void 0), !error || expectedException(actual, error)) {\n var details = message \? \": \".concat(message) : \".\", fnType = stackStartFn.name === \"doesNotReject\" \? \"rejection\" : \"exception\";\n innerFail({\n actual,\n expected: error,\n operator: stackStartFn.name,\n message: \"Got unwanted \".concat(fnType).concat(details, `\n`) + 'Actual message: \"'.concat(actual && actual.message, '\"'),\n stackStartFn\n });\n }\n throw actual;\n }\n }\n assert.throws = function throws(promiseFn) {\n for (var _len2 = arguments.length, args = new @Array(_len2 > 1 \? _len2 - 1 : 0), _key2 = 1;_key2 < _len2; _key2++)\n args[_key2 - 1] = arguments[_key2];\n expectsError.@apply(void 0, [throws, getActual(promiseFn)].concat(args));\n }, assert.rejects = function rejects(promiseFn) {\n for (var _len3 = arguments.length, args = new @Array(_len3 > 1 \? _len3 - 1 : 0), _key3 = 1;_key3 < _len3; _key3++)\n args[_key3 - 1] = arguments[_key3];\n return waitForActual(promiseFn).then(function(result) {\n return expectsError.@apply(void 0, [rejects, result].concat(args));\n });\n }, assert.doesNotThrow = function doesNotThrow(fn) {\n for (var _len4 = arguments.length, args = new @Array(_len4 > 1 \? _len4 - 1 : 0), _key4 = 1;_key4 < _len4; _key4++)\n args[_key4 - 1] = arguments[_key4];\n expectsNoError.@apply(void 0, [doesNotThrow, getActual(fn)].concat(args));\n }, assert.doesNotReject = function doesNotReject(fn) {\n for (var _len5 = arguments.length, args = new @Array(_len5 > 1 \? _len5 - 1 : 0), _key5 = 1;_key5 < _len5; _key5++)\n args[_key5 - 1] = arguments[_key5];\n return waitForActual(fn).then(function(result) {\n return expectsNoError.@apply(void 0, [doesNotReject, result].concat(args));\n });\n }, assert.ifError = function ifError(err) {\n if (err != null) {\n var message = \"ifError got unwanted exception: \";\n _typeof(err) === \"object\" && typeof err.message == \"string\" \? err.message.length === 0 && err.constructor \? message += err.constructor.name : message += err.message : message += inspect(err);\n var newErr = new AssertionError({\n actual: err,\n expected: null,\n operator: \"ifError\",\n message,\n stackStartFn: ifError\n }), origStack = err.stack;\n if (typeof origStack == \"string\") {\n var tmp2 = origStack.split(`\n`);\n tmp2.shift();\n for (var tmp1 = newErr.stack.split(`\n`), i = 0;i < tmp2.length; i++) {\n var pos = tmp1.indexOf(tmp2[i]);\n if (pos !== -1) {\n tmp1 = tmp1.slice(0, pos);\n break;\n }\n }\n newErr.stack = \"\".concat(tmp1.join(`\n`), `\n`).concat(tmp2.join(`\n`));\n }\n throw newErr;\n }\n };\n function strict() {\n for (var _len6 = arguments.length, args = new @Array(_len6), _key6 = 0;_key6 < _len6; _key6++)\n args[_key6] = arguments[_key6];\n innerOk.@apply(void 0, [strict, args.length].concat(args));\n }\n assert.strict = objectAssign(strict, assert, {\n equal: assert.strictEqual,\n deepEqual: assert.deepStrictEqual,\n notEqual: assert.notStrictEqual,\n notDeepEqual: assert.notDeepStrictEqual\n }), assert.strict.strict = assert.strict;\n }\n}), assert_module = require_assert();\nassert_module.CallTracker = CallTracker;\nreturn assert_module})\n"); -// - -// -static constexpr ASCIILiteral NodeAssertStrictCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/assert.strict.ts\nreturn (@getInternalField(@internalModuleRegistry, 8) || @createInternalModuleById(8)).strict})\n"); -// - -// -static constexpr ASCIILiteral NodeAsyncHooksCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/async_hooks.ts\nvar get = function() {\n return @getInternalField(@asyncContext, 0);\n}, set = function(contextValue) {\n return @putInternalField(@asyncContext, 0, contextValue);\n}, createWarning = function(message) {\n let warned = !1;\n var wrapped = function() {\n if (warned)\n return;\n if (new Error().stack.includes(\"zx/build/core.js\"))\n return;\n warned = !0, console.warn(\"[bun] Warning:\", message);\n };\n return wrapped;\n}, createHook = function(callbacks) {\n return {\n enable: createHookNotImpl,\n disable: createHookNotImpl\n };\n}, executionAsyncId = function() {\n return executionAsyncIdNotImpl(), 0;\n}, triggerAsyncId = function() {\n return 0;\n}, executionAsyncResource = function() {\n return executionAsyncResourceWarning(), process.stdin;\n}, $, { cleanupLater, setAsyncHooksEnabled } = @lazy(\"async_hooks\");\n\nclass AsyncLocalStorage {\n #disableCalled = !1;\n constructor() {\n setAsyncHooksEnabled(!0);\n }\n static bind(fn, ...args) {\n return this.snapshot().bind(null, fn, ...args);\n }\n static snapshot() {\n var context = get();\n return (fn, ...args) => {\n var prev = get();\n set(context);\n try {\n return fn(...args);\n } catch (error) {\n throw error;\n } finally {\n set(prev);\n }\n };\n }\n enterWith(store) {\n cleanupLater();\n var context = get();\n if (!context) {\n set([this, store]);\n return;\n }\n var { length } = context;\n for (var i = 0;i < length; i += 2)\n if (context[i] === this) {\n const clone = context.slice();\n clone[i + 1] = store, set(clone);\n return;\n }\n set(context.concat(this, store));\n }\n exit(cb, ...args) {\n return this.run(@undefined, cb, ...args);\n }\n run(store_value, callback, ...args) {\n var context = get(), hasPrevious = !1, previous_value, i = 0, contextWasAlreadyInit = !context;\n if (contextWasAlreadyInit)\n set(context = [this, store_value]);\n else {\n if (context = context.slice(), i = context.indexOf(this), i > -1)\n hasPrevious = !0, previous_value = context[i + 1], context[i + 1] = store_value;\n else\n i = context.length, context.push(this, store_value);\n set(context);\n }\n try {\n return callback(...args);\n } catch (e) {\n throw e;\n } finally {\n if (!this.#disableCalled) {\n var context2 = get();\n if (context2 === context && contextWasAlreadyInit)\n set(@undefined);\n else if (context2 = context2.slice(), hasPrevious)\n context2[i + 1] = previous_value, set(context2);\n else\n context2.splice(i, 2), set(context2.length \? context2 : @undefined);\n }\n }\n }\n disable() {\n if (!this.#disableCalled) {\n var context = get();\n if (context) {\n var { length } = context;\n for (var i = 0;i < length; i += 2)\n if (context[i] === this) {\n context.splice(i, 2), set(context.length \? context : @undefined);\n break;\n }\n }\n this.#disableCalled = !0;\n }\n }\n getStore() {\n var context = get();\n if (!context)\n return;\n var { length } = context;\n for (var i = 0;i < length; i += 2)\n if (context[i] === this)\n return context[i + 1];\n }\n}\n\nclass AsyncResource {\n type;\n #snapshot;\n constructor(type, options) {\n if (typeof type !== \"string\")\n @throwTypeError('The \"type\" argument must be of type string. Received type ' + typeof type);\n setAsyncHooksEnabled(!0), this.type = type, this.#snapshot = get();\n }\n emitBefore() {\n return !0;\n }\n emitAfter() {\n return !0;\n }\n asyncId() {\n return 0;\n }\n triggerAsyncId() {\n return 0;\n }\n emitDestroy() {\n }\n runInAsyncScope(fn, thisArg, ...args) {\n var prev = get();\n set(this.#snapshot);\n try {\n return fn.@apply(thisArg, args);\n } catch (error) {\n throw error;\n } finally {\n set(prev);\n }\n }\n bind(fn, thisArg) {\n return this.runInAsyncScope.bind(this, fn, thisArg \?\? this);\n }\n static bind(fn, type, thisArg) {\n return type = type || fn.name, new AsyncResource(type || \"bound-anonymous-fn\").bind(fn, thisArg);\n }\n}\nvar createHookNotImpl = createWarning(\"async_hooks.createHook is not implemented in Bun. Hooks can still be created but will never be called.\"), executionAsyncIdNotImpl = createWarning(\"async_hooks.executionAsyncId/triggerAsyncId are not implemented in Bun. It will return 0 every time.\"), executionAsyncResourceWarning = createWarning(\"async_hooks.executionAsyncResource is not implemented in Bun. It returns a reference to process.stdin every time.\"), asyncWrapProviders = {\n NONE: 0,\n DIRHANDLE: 1,\n DNSCHANNEL: 2,\n ELDHISTOGRAM: 3,\n FILEHANDLE: 4,\n FILEHANDLECLOSEREQ: 5,\n FIXEDSIZEBLOBCOPY: 6,\n FSEVENTWRAP: 7,\n FSREQCALLBACK: 8,\n FSREQPROMISE: 9,\n GETADDRINFOREQWRAP: 10,\n GETNAMEINFOREQWRAP: 11,\n HEAPSNAPSHOT: 12,\n HTTP2SESSION: 13,\n HTTP2STREAM: 14,\n HTTP2PING: 15,\n HTTP2SETTINGS: 16,\n HTTPINCOMINGMESSAGE: 17,\n HTTPCLIENTREQUEST: 18,\n JSSTREAM: 19,\n JSUDPWRAP: 20,\n MESSAGEPORT: 21,\n PIPECONNECTWRAP: 22,\n PIPESERVERWRAP: 23,\n PIPEWRAP: 24,\n PROCESSWRAP: 25,\n PROMISE: 26,\n QUERYWRAP: 27,\n SHUTDOWNWRAP: 28,\n SIGNALWRAP: 29,\n STATWATCHER: 30,\n STREAMPIPE: 31,\n TCPCONNECTWRAP: 32,\n TCPSERVERWRAP: 33,\n TCPWRAP: 34,\n TTYWRAP: 35,\n UDPSENDWRAP: 36,\n UDPWRAP: 37,\n SIGINTWATCHDOG: 38,\n WORKER: 39,\n WORKERHEAPSNAPSHOT: 40,\n WRITEWRAP: 41,\n ZLIB: 42,\n CHECKPRIMEREQUEST: 43,\n PBKDF2REQUEST: 44,\n KEYPAIRGENREQUEST: 45,\n KEYGENREQUEST: 46,\n KEYEXPORTREQUEST: 47,\n CIPHERREQUEST: 48,\n DERIVEBITSREQUEST: 49,\n HASHREQUEST: 50,\n RANDOMBYTESREQUEST: 51,\n RANDOMPRIMEREQUEST: 52,\n SCRYPTREQUEST: 53,\n SIGNREQUEST: 54,\n TLSWRAP: 55,\n VERIFYREQUEST: 56,\n INSPECTORJSBINDING: 57\n};\n$ = {\n AsyncLocalStorage,\n createHook,\n executionAsyncId,\n triggerAsyncId,\n executionAsyncResource,\n asyncWrapProviders,\n AsyncResource\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeChildProcessCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/child_process.ts\nvar spawn = function(file, args, options) {\n options = normalizeSpawnArguments(file, args, options), validateTimeout(options.timeout), validateAbortSignal(options.signal, \"options.signal\");\n const killSignal2 = sanitizeKillSignal(options.killSignal), child = new ChildProcess;\n if (child.spawn(options), options.timeout > 0) {\n let timeoutId = setTimeout(() => {\n if (timeoutId) {\n try {\n child.kill(killSignal2);\n } catch (err) {\n child.emit(\"error\", err);\n }\n timeoutId = null;\n }\n });\n child.once(\"exit\", () => {\n if (timeoutId)\n clearTimeout(timeoutId), timeoutId = null;\n });\n }\n if (options.signal) {\n let onAbortListener2 = function() {\n abortChildProcess(child, killSignal2, options.signal.reason);\n };\n var onAbortListener = onAbortListener2;\n const signal = options.signal;\n if (signal.aborted)\n process.nextTick(onAbortListener2);\n else\n signal.addEventListener(\"abort\", onAbortListener2, { once: !0 }), child.once(\"exit\", () => signal.removeEventListener(\"abort\", onAbortListener2));\n }\n return child;\n}, execFile = function(file, args, options, callback) {\n ({ file, args, options, callback } = normalizeExecFileArgs(file, args, options, callback)), options = {\n encoding: \"utf8\",\n timeout: 0,\n maxBuffer: MAX_BUFFER,\n killSignal: \"SIGTERM\",\n cwd: null,\n env: null,\n shell: !1,\n ...options\n };\n const maxBuffer = options.maxBuffer;\n validateTimeout(options.timeout), validateMaxBuffer(maxBuffer), options.killSignal = sanitizeKillSignal(options.killSignal);\n const child = spawn(file, args, {\n cwd: options.cwd,\n env: options.env,\n shell: options.shell,\n signal: options.signal\n });\n let encoding;\n const _stdout = [], _stderr = [];\n if (options.encoding !== \"buffer\" && BufferIsEncoding(options.encoding))\n encoding = options.encoding;\n else\n encoding = null;\n let stdoutLen = 0, stderrLen = 0, killed = !1, exited = !1, timeoutId, encodedStdoutLen, encodedStderrLen, ex = null, cmd = file;\n function exitHandler(code, signal) {\n if (exited)\n return;\n if (exited = !0, timeoutId)\n clearTimeout(timeoutId), timeoutId = null;\n if (!callback)\n return;\n const readableEncoding = child\?.stdout\?.readableEncoding;\n let stdout, stderr;\n if (encoding || child.stdout && readableEncoding)\n stdout = ArrayPrototypeJoin.@call(_stdout, \"\");\n else\n stdout = BufferConcat(_stdout);\n if (encoding || child.stderr && readableEncoding)\n stderr = ArrayPrototypeJoin.@call(_stderr, \"\");\n else\n stderr = BufferConcat(_stderr);\n if (!ex && code === 0 && signal === null) {\n callback(null, stdout, stderr);\n return;\n }\n if (args\?.length)\n cmd += ` ${ArrayPrototypeJoin.@call(args, \" \")}`;\n if (!ex) {\n let message = `Command failed: ${cmd}`;\n if (stderr)\n message += `\\n${stderr}`;\n ex = genericNodeError(message, {\n code,\n killed: child.killed || killed,\n signal\n });\n }\n ex.cmd = cmd, callback(ex, stdout, stderr);\n }\n function errorHandler(e) {\n if (ex = e, child.stdout)\n child.stdout.destroy();\n if (child.stderr)\n child.stderr.destroy();\n exitHandler();\n }\n function kill() {\n if (child.stdout)\n child.stdout.destroy();\n if (child.stderr)\n child.stderr.destroy();\n killed = !0;\n try {\n child.kill(options.killSignal);\n } catch (e) {\n ex = e, exitHandler();\n }\n }\n if (options.timeout > 0)\n timeoutId = setTimeout(function delayedKill() {\n kill(), timeoutId = null;\n }, options.timeout);\n if (child.stdout) {\n if (encoding)\n child.stdout.setEncoding(encoding);\n child.stdout.on(\"data\", maxBuffer === @Infinity \? function onUnlimitedSizeBufferedData(chunk) {\n ArrayPrototypePush.@call(_stdout, chunk);\n } : encoding \? function onChildStdoutEncoded(chunk) {\n if (stdoutLen += chunk.length, stdoutLen * 4 > maxBuffer) {\n const encoding2 = child.stdout.readableEncoding, actualLen = @Buffer.byteLength(chunk, encoding2);\n if (encodedStdoutLen === @undefined)\n for (let i = 0;i < _stdout.length; i++)\n encodedStdoutLen += @Buffer.byteLength(_stdout[i], encoding2);\n else\n encodedStdoutLen += actualLen;\n const truncatedLen = maxBuffer - (encodedStdoutLen - actualLen);\n ArrayPrototypePush.@call(_stdout, StringPrototypeSlice.@apply(chunk, 0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stdout\"), kill();\n } else\n ArrayPrototypePush.@call(_stdout, chunk);\n } : function onChildStdoutRaw(chunk) {\n if (stdoutLen += chunk.length, stdoutLen > maxBuffer) {\n const truncatedLen = maxBuffer - (stdoutLen - chunk.length);\n ArrayPrototypePush.@call(_stdout, chunk.slice(0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stdout\"), kill();\n } else\n ArrayPrototypePush.@call(_stdout, chunk);\n });\n }\n if (child.stderr) {\n if (encoding)\n child.stderr.setEncoding(encoding);\n child.stderr.on(\"data\", maxBuffer === @Infinity \? function onUnlimitedSizeBufferedData(chunk) {\n ArrayPrototypePush.@call(_stderr, chunk);\n } : encoding \? function onChildStderrEncoded(chunk) {\n if (stderrLen += chunk.length, stderrLen * 4 > maxBuffer) {\n const encoding2 = child.stderr.readableEncoding, actualLen = @Buffer.byteLength(chunk, encoding2);\n if (encodedStderrLen === @undefined)\n for (let i = 0;i < _stderr.length; i++)\n encodedStderrLen += @Buffer.byteLength(_stderr[i], encoding2);\n else\n encodedStderrLen += actualLen;\n const truncatedLen = maxBuffer - (encodedStderrLen - actualLen);\n ArrayPrototypePush.@call(_stderr, StringPrototypeSlice.@call(chunk, 0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stderr\"), kill();\n } else\n ArrayPrototypePush.@call(_stderr, chunk);\n } : function onChildStderrRaw(chunk) {\n if (stderrLen += chunk.length, stderrLen > maxBuffer) {\n const truncatedLen = maxBuffer - (stderrLen - chunk.length);\n ArrayPrototypePush.@call(_stderr, StringPrototypeSlice.@call(chunk, 0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stderr\"), kill();\n } else\n ArrayPrototypePush.@call(_stderr, chunk);\n });\n }\n return child.addListener(\"close\", exitHandler), child.addListener(\"error\", errorHandler), child;\n}, exec = function(command, options, callback) {\n const opts = normalizeExecArgs(command, options, callback);\n return execFile(opts.file, opts.options, opts.callback);\n}, spawnSync = function(file, args, options) {\n options = {\n maxBuffer: MAX_BUFFER,\n ...normalizeSpawnArguments(file, args, options)\n };\n const { maxBuffer, encoding } = options;\n validateTimeout(options.timeout), validateMaxBuffer(maxBuffer), options.killSignal = sanitizeKillSignal(options.killSignal);\n const stdio = options.stdio || \"pipe\", bunStdio = getBunStdioFromOptions(stdio);\n var { input } = options;\n if (input)\n if (ArrayBufferIsView(input))\n bunStdio[0] = input;\n else if (typeof input === \"string\")\n bunStdio[0] = @Buffer.from(input, encoding || \"utf8\");\n else\n throw new ERR_INVALID_ARG_TYPE(\"options.stdio[0]\", [\"Buffer\", \"TypedArray\", \"DataView\", \"string\"], input);\n const { stdout, stderr, success, exitCode } = Bun.spawnSync({\n cmd: options.args,\n env: options.env || @undefined,\n cwd: options.cwd || @undefined,\n stdin: bunStdio[0],\n stdout: bunStdio[1],\n stderr: bunStdio[2]\n }), result = {\n signal: null,\n status: exitCode,\n output: [null, stdout, stderr]\n };\n if (stdout && encoding && encoding !== \"buffer\")\n result.output[1] = result.output[1]\?.toString(encoding);\n if (stderr && encoding && encoding !== \"buffer\")\n result.output[2] = result.output[2]\?.toString(encoding);\n if (result.stdout = result.output[1], result.stderr = result.output[2], !success)\n result.error = new SystemError(result.output[2], options.file, \"spawnSync\", -1, result.status), result.error.spawnargs = ArrayPrototypeSlice.@call(options.args, 1);\n return result;\n}, execFileSync = function(file, args, options) {\n ({ file, args, options } = normalizeExecFileArgs(file, args, options));\n const ret = spawnSync(file, args, options), errArgs = [options.argv0 || file];\n ArrayPrototypePush.@apply(errArgs, args);\n const err = checkExecSyncError(ret, errArgs);\n if (err)\n throw err;\n return ret.stdout;\n}, execSync = function(command, options) {\n const opts = normalizeExecArgs(command, options, null), ret = spawnSync(opts.file, opts.options), err = checkExecSyncError(ret, @undefined, command);\n if (err)\n throw err;\n return ret.stdout;\n}, stdioStringToArray = function(stdio, channel) {\n const options = [];\n switch (stdio) {\n case \"ignore\":\n case \"overlapped\":\n case \"pipe\":\n ArrayPrototypePush.@call(options, stdio, stdio, stdio);\n break;\n case \"inherit\":\n ArrayPrototypePush.@call(options, 0, 1, 2);\n break;\n default:\n throw new ERR_INVALID_ARG_VALUE(\"stdio\", stdio);\n }\n if (channel)\n ArrayPrototypePush.@call(options, channel);\n return options;\n}, fork = function(modulePath, args = [], options) {\n modulePath = getValidatedPath(modulePath, \"modulePath\");\n let execArgv;\n if (args == null)\n args = [];\n else if (typeof args === \"object\" && !ArrayIsArray(args))\n options = args, args = [];\n else\n validateArray(args, \"args\");\n if (options != null)\n validateObject(options, \"options\");\n if (options = { __proto__: null, ...options, shell: !1 }, options.execPath = options.execPath || process.execPath, validateArgumentNullCheck(options.execPath, \"options.execPath\"), args = [modulePath, ...args], typeof options.stdio === \"string\")\n options.stdio = stdioStringToArray(options.stdio, \"ipc\");\n else if (!ArrayIsArray(options.stdio))\n options.stdio = stdioStringToArray(options.silent \? \"pipe\" : \"inherit\", \"ipc\");\n else if (!ArrayPrototypeIncludes.@call(options.stdio, \"ipc\"))\n throw new ERR_CHILD_PROCESS_IPC_REQUIRED(\"options.stdio\");\n return spawn(options.execPath, args, options);\n}, convertToValidSignal = function(signal) {\n if (typeof signal === \"number\" && getSignalsToNamesMapping()[signal])\n return signal;\n if (typeof signal === \"string\") {\n const signalName = signals[StringPrototypeToUpperCase.@call(signal)];\n if (signalName)\n return signalName;\n }\n throw new ERR_UNKNOWN_SIGNAL(signal);\n}, sanitizeKillSignal = function(killSignal2) {\n if (typeof killSignal2 === \"string\" || typeof killSignal2 === \"number\")\n return convertToValidSignal(killSignal2);\n else if (killSignal2 != null)\n throw new ERR_INVALID_ARG_TYPE(\"options.killSignal\", [\"string\", \"number\"], killSignal2);\n}, getSignalsToNamesMapping = function() {\n if (signalsToNamesMapping !== @undefined)\n return signalsToNamesMapping;\n signalsToNamesMapping = ObjectCreate(null);\n for (let key in signals)\n signalsToNamesMapping[signals[key]] = key;\n return signalsToNamesMapping;\n}, normalizeExecFileArgs = function(file, args, options, callback) {\n if (ArrayIsArray(args))\n args = ArrayPrototypeSlice.@call(args);\n else if (args != null && typeof args === \"object\")\n callback = options, options = args, args = null;\n else if (typeof args === \"function\")\n callback = args, options = null, args = null;\n if (args == null)\n args = [];\n if (typeof options === \"function\")\n callback = options;\n else if (options != null)\n validateObject(options, \"options\");\n if (options == null)\n options = kEmptyObject;\n if (callback != null)\n validateFunction(callback, \"callback\");\n if (options.argv0 != null)\n validateString(options.argv0, \"options.argv0\"), validateArgumentNullCheck(options.argv0, \"options.argv0\");\n return { file, args, options, callback };\n}, normalizeExecArgs = function(command, options, callback) {\n if (validateString(command, \"command\"), validateArgumentNullCheck(command, \"command\"), typeof options === \"function\")\n callback = options, options = @undefined;\n return options = { ...options }, options.shell = typeof options.shell === \"string\" \? options.shell : !0, {\n file: command,\n options,\n callback\n };\n}, normalizeSpawnArguments = function(file, args, options) {\n if (validateString(file, \"file\"), validateArgumentNullCheck(file, \"file\"), file.length === 0)\n throw new ERR_INVALID_ARG_VALUE(\"file\", file, \"cannot be empty\");\n if (ArrayIsArray(args))\n args = ArrayPrototypeSlice.@call(args);\n else if (args == null)\n args = [];\n else if (typeof args !== \"object\")\n throw new ERR_INVALID_ARG_TYPE(\"args\", \"object\", args);\n else\n options = args, args = [];\n if (validateArgumentsNullCheck(args, \"args\"), options === @undefined)\n options = {};\n else\n validateObject(options, \"options\");\n let cwd = options.cwd;\n if (cwd != null)\n cwd = getValidatedPath(cwd, \"options.cwd\");\n var detached = !1;\n const { detached: detachedOption } = options;\n if (detachedOption != null)\n detached = !!detachedOption;\n if (options.shell != null && typeof options.shell !== \"boolean\" && typeof options.shell !== \"string\")\n throw new ERR_INVALID_ARG_TYPE(\"options.shell\", [\"boolean\", \"string\"], options.shell);\n if (options.argv0 != null)\n validateString(options.argv0, \"options.argv0\"), validateArgumentNullCheck(options.argv0, \"options.argv0\");\n if (options.shell) {\n validateArgumentNullCheck(options.shell, \"options.shell\");\n const command = ArrayPrototypeJoin.@call([file, ...args], \" \");\n if (typeof options.shell === \"string\")\n file = options.shell;\n else\n file = \"sh\";\n args = [\"-c\", command];\n }\n if (typeof options.argv0 === \"string\")\n ArrayPrototypeUnshift.@call(args, options.argv0);\n else\n ArrayPrototypeUnshift.@call(args, file);\n const envPairs = options.env || process.env;\n return { ...options, detached, file, args, cwd, envPairs };\n}, checkExecSyncError = function(ret, args, cmd) {\n let err;\n if (ret.error)\n err = ret.error, ObjectAssign(err, ret);\n else if (ret.status !== 0) {\n let msg = \"Command failed: \";\n if (msg += cmd || ArrayPrototypeJoin.@call(args, \" \"), ret.stderr && ret.stderr.length > 0)\n msg += `\\n${ret.stderr.toString()}`;\n err = genericNodeError(msg, ret);\n }\n return err;\n}, nodeToBun = function(item) {\n if (typeof item === \"number\")\n return item;\n else {\n const result = nodeToBunLookup[item];\n if (result === @undefined)\n throw new Error(`Invalid stdio option \"${item}\"`);\n return result;\n }\n}, fdToStdioName = function(fd) {\n switch (fd) {\n case 0:\n return \"stdin\";\n case 1:\n return \"stdout\";\n case 2:\n return \"stderr\";\n default:\n return null;\n }\n}, getBunStdioFromOptions = function(stdio) {\n return normalizeStdio(stdio).map((item) => nodeToBun(item));\n}, normalizeStdio = function(stdio) {\n if (typeof stdio === \"string\")\n switch (stdio) {\n case \"ignore\":\n return [\"ignore\", \"ignore\", \"ignore\"];\n case \"pipe\":\n return [\"pipe\", \"pipe\", \"pipe\"];\n case \"inherit\":\n return [\"inherit\", \"inherit\", \"inherit\"];\n default:\n throw new ERR_INVALID_OPT_VALUE(\"stdio\", stdio);\n }\n else if (ArrayIsArray(stdio)) {\n let processedStdio;\n if (stdio.length === 0)\n processedStdio = [\"pipe\", \"pipe\", \"pipe\"];\n else if (stdio.length === 1)\n processedStdio = [stdio[0], \"pipe\", \"pipe\"];\n else if (stdio.length === 2)\n processedStdio = [stdio[0], stdio[1], \"pipe\"];\n else if (stdio.length >= 3)\n processedStdio = [stdio[0], stdio[1], stdio[2]];\n return processedStdio.map((item) => !item \? \"pipe\" : item);\n } else\n throw new ERR_INVALID_OPT_VALUE(\"stdio\", stdio);\n}, flushStdio = function(subprocess) {\n const stdio = subprocess.stdio;\n if (stdio == null)\n return;\n for (let i = 0;i < stdio.length; i++) {\n const stream = stdio[i];\n if (!stream || !stream.readable)\n continue;\n stream.resume();\n }\n}, onSpawnNT = function(self) {\n self.emit(\"spawn\");\n}, abortChildProcess = function(child, killSignal2, reason) {\n if (!child)\n return;\n try {\n if (child.kill(killSignal2))\n child.emit(\"error\", new AbortError(@undefined, { cause: reason }));\n } catch (err) {\n child.emit(\"error\", err);\n }\n}, validateMaxBuffer = function(maxBuffer) {\n if (maxBuffer != null && !(typeof maxBuffer === \"number\" && maxBuffer >= 0))\n throw new ERR_OUT_OF_RANGE(\"options.maxBuffer\", \"a positive number\", maxBuffer);\n}, validateArgumentNullCheck = function(arg, propName) {\n if (typeof arg === \"string\" && StringPrototypeIncludes.@call(arg, \"\\0\"))\n throw new ERR_INVALID_ARG_VALUE(propName, arg, \"must be a string without null bytes\");\n}, validateArgumentsNullCheck = function(args, propName) {\n for (let i = 0;i < args.length; ++i)\n validateArgumentNullCheck(args[i], `${propName}[${i}]`);\n}, validateTimeout = function(timeout) {\n if (timeout != null && !(NumberIsInteger(timeout) && timeout >= 0))\n throw new ERR_OUT_OF_RANGE(\"timeout\", \"an unsigned integer\", timeout);\n};\nvar validateFunction = function(value, name) {\n if (typeof value !== \"function\")\n throw new ERR_INVALID_ARG_TYPE(name, \"Function\", value);\n}, validateString = function(value, name) {\n if (typeof value !== \"string\")\n throw new ERR_INVALID_ARG_TYPE(name, \"string\", value);\n}, nullCheck = function(path, propName, throwError = !0) {\n const pathIsString = typeof path === \"string\", pathIsUint8Array = isUint8Array(path);\n if (!pathIsString && !pathIsUint8Array || pathIsString && !StringPrototypeIncludes.@call(path, \"\\0\") || pathIsUint8Array && !Uint8ArrayPrototypeIncludes.@call(path, 0))\n return;\n const err = new ERR_INVALID_ARG_VALUE(propName, path, \"must be a string or Uint8Array without null bytes\");\n if (throwError)\n throw err;\n return err;\n}, validatePath = function(path, propName = \"path\") {\n if (typeof path !== \"string\" && !isUint8Array(path))\n throw new ERR_INVALID_ARG_TYPE(propName, [\"string\", \"Buffer\", \"URL\"], path);\n const err = nullCheck(path, propName, !1);\n if (err !== @undefined)\n throw err;\n}, getValidatedPath = function(fileURLOrPath, propName = \"path\") {\n const path = toPathIfFileURL(fileURLOrPath);\n return validatePath(path, propName), path;\n}, isUint8Array = function(value) {\n return typeof value === \"object\" && value !== null && value instanceof @Uint8Array;\n}, isURLInstance = function(fileURLOrPath) {\n return fileURLOrPath != null && fileURLOrPath.href && fileURLOrPath.origin;\n}, toPathIfFileURL = function(fileURLOrPath) {\n if (!isURLInstance(fileURLOrPath))\n return fileURLOrPath;\n return Bun.fileURLToPath(fileURLOrPath);\n}, genericNodeError = function(message, options) {\n const err = new Error(message);\n return err.code = options.code, err.killed = options.killed, err.signal = options.signal, err;\n}, ERR_OUT_OF_RANGE = function(str, range, input, replaceDefaultBoolean = !1) {\n return new RangeError(`The value of ${str} is out of range. It must be ${range}. Received ${input}`);\n}, ERR_CHILD_PROCESS_STDIO_MAXBUFFER = function(stdio) {\n return Error(`${stdio} maxBuffer length exceeded`);\n}, ERR_UNKNOWN_SIGNAL = function(name) {\n const err = @makeTypeError(`Unknown signal: ${name}`);\n return err.code = \"ERR_UNKNOWN_SIGNAL\", err;\n}, ERR_INVALID_ARG_TYPE = function(name, type, value) {\n const err = @makeTypeError(`The \"${name}\" argument must be of type ${type}. Received ${value\?.toString()}`);\n return err.code = \"ERR_INVALID_ARG_TYPE\", err;\n}, ERR_INVALID_OPT_VALUE = function(name, value) {\n return @makeTypeError(`The value \"${value}\" is invalid for option \"${name}\"`);\n}, ERR_INVALID_ARG_VALUE = function(name, value, reason) {\n return new Error(`The value \"${value}\" is invalid for argument '${name}'. Reason: ${reason}`);\n}, ERR_CHILD_PROCESS_IPC_REQUIRED = function(name) {\n const err = @makeTypeError(`Forked processes must have an IPC channel, missing value 'ipc' in ${name}`);\n return err.code = \"ERR_CHILD_PROCESS_IPC_REQUIRED\", err;\n}, $, EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20), StreamModule = @getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39), {\n constants: { signals }\n} = @getInternalField(@internalModuleRegistry, 28) || @createInternalModuleById(28), { promisify } = @getInternalField(@internalModuleRegistry, 48) || @createInternalModuleById(48), ObjectCreate = Object.create, ObjectAssign = Object.assign, ObjectDefineProperty = Object.defineProperty, BufferConcat = @Buffer.concat, BufferIsEncoding = @Buffer.isEncoding, kEmptyObject = ObjectCreate(null), ArrayPrototypePush = @Array.prototype.push, ArrayPrototypeJoin = @Array.prototype.join, ArrayPrototypeMap = @Array.prototype.map, ArrayPrototypeIncludes = @Array.prototype.includes, ArrayPrototypeSlice = @Array.prototype.slice, ArrayPrototypeUnshift = @Array.prototype.unshift, ArrayPrototypeLastIndexOf = @Array.prototype.lastIndexOf, ArrayPrototypeSplice = @Array.prototype.splice, ArrayIsArray = @Array.isArray, ArrayBufferIsView = @ArrayBuffer.isView, NumberIsInteger = Number.isInteger;\nvar StringPrototypeToUpperCase = @String.prototype.toUpperCase, StringPrototypeIncludes = @String.prototype.includes, StringPrototypeSlice = @String.prototype.slice, Uint8ArrayPrototypeIncludes = @Uint8Array.prototype.includes, MAX_BUFFER = 1048576, NativeWritable, ReadableFromWeb, customPromiseExecFunction = (orig) => {\n return (...args) => {\n let resolve, reject;\n const promise = new @Promise((res, rej) => {\n resolve = res, reject = rej;\n });\n return promise.child = orig(...args, (err, stdout, stderr) => {\n if (err !== null)\n err.stdout = stdout, err.stderr = stderr, reject(err);\n else\n resolve({ stdout, stderr });\n }), promise;\n };\n};\nObjectDefineProperty(exec, promisify.custom, {\n __proto__: null,\n enumerable: !1,\n value: customPromiseExecFunction(exec)\n});\nvar signalsToNamesMapping;\n\nclass ChildProcess extends EventEmitter {\n constructor() {\n super(...arguments);\n }\n #handle;\n #exited = !1;\n #closesNeeded = 1;\n #closesGot = 0;\n connected = !1;\n signalCode = null;\n exitCode = null;\n spawnfile;\n spawnargs;\n pid;\n channel;\n get killed() {\n if (this.#handle == null)\n return !1;\n }\n #handleOnExit(exitCode, signalCode, err) {\n if (this.#exited)\n return;\n if (signalCode)\n this.signalCode = signalCode;\n else\n this.exitCode = exitCode;\n if (this.#stdin)\n this.#stdin.destroy();\n if (this.#handle)\n this.#handle = null;\n if (exitCode < 0) {\n const err2 = new SystemError(`Spawned process exited with error code: ${exitCode}`, @undefined, \"spawn\", \"EUNKNOWN\", \"ERR_CHILD_PROCESS_UNKNOWN_ERROR\");\n if (this.spawnfile)\n err2.path = this.spawnfile;\n err2.spawnargs = ArrayPrototypeSlice.@call(this.spawnargs, 1), this.emit(\"error\", err2);\n } else\n this.emit(\"exit\", this.exitCode, this.signalCode);\n process.nextTick(flushStdio, this), this.#maybeClose(), this.#exited = !0, this.#stdioOptions = [\"destroyed\", \"destroyed\", \"destroyed\"];\n }\n #getBunSpawnIo(i, encoding) {\n NativeWritable ||= StreamModule.NativeWritable, ReadableFromWeb ||= StreamModule.Readable.fromWeb;\n const io = this.#stdioOptions[i];\n switch (i) {\n case 0:\n switch (io) {\n case \"pipe\":\n return new NativeWritable(this.#handle.stdin);\n case \"inherit\":\n return process.stdin || null;\n case \"destroyed\":\n return new ShimmedStdin;\n default:\n return null;\n }\n case 2:\n case 1:\n switch (io) {\n case \"pipe\":\n return ReadableFromWeb(this.#handle[fdToStdioName(i)], { encoding });\n case \"inherit\":\n return process[fdToStdioName(i)] || null;\n case \"destroyed\":\n return new ShimmedStdioOutStream;\n default:\n return null;\n }\n }\n }\n #stdin;\n #stdout;\n #stderr;\n #stdioObject;\n #encoding;\n #stdioOptions;\n #createStdioObject() {\n return Object.create(null, {\n 0: {\n get: () => this.stdin\n },\n 1: {\n get: () => this.stdout\n },\n 2: {\n get: () => this.stderr\n }\n });\n }\n get stdin() {\n return this.#stdin \?\?= this.#getBunSpawnIo(0, this.#encoding);\n }\n get stdout() {\n return this.#stdout \?\?= this.#getBunSpawnIo(1, this.#encoding);\n }\n get stderr() {\n return this.#stderr \?\?= this.#getBunSpawnIo(2, this.#encoding);\n }\n get stdio() {\n return this.#stdioObject \?\?= this.#createStdioObject();\n }\n spawn(options) {\n validateObject(options, \"options\"), validateString(options.file, \"options.file\");\n var file = this.spawnfile = options.file, spawnargs;\n if (options.args == null)\n spawnargs = this.spawnargs = [];\n else\n validateArray(options.args, \"options.args\"), spawnargs = this.spawnargs = options.args;\n const stdio = options.stdio || [\"pipe\", \"pipe\", \"pipe\"], bunStdio = getBunStdioFromOptions(stdio), ipc = @isArray(stdio) && stdio[3] === \"ipc\";\n var env = options.envPairs || @undefined;\n const detachedOption = options.detached;\n if (this.#encoding = options.encoding || @undefined, this.#stdioOptions = bunStdio, this.#handle = Bun.spawn({\n cmd: spawnargs,\n stdin: bunStdio[0],\n stdout: bunStdio[1],\n stderr: bunStdio[2],\n cwd: options.cwd || @undefined,\n env: env || process.env,\n detached: typeof detachedOption !== \"undefined\" \? !!detachedOption : !1,\n onExit: (handle, exitCode, signalCode, err) => {\n this.#handle = handle, this.pid = this.#handle.pid, process.nextTick((exitCode2, signalCode2, err2) => this.#handleOnExit(exitCode2, signalCode2, err2), exitCode, signalCode, err);\n },\n lazy: !0,\n ipc: ipc \? this.#emitIpcMessage.bind(this) : @undefined\n }), this.pid = this.#handle.pid, onSpawnNT(this), ipc)\n this.send = this.#send, this.disconnect = this.#disconnect;\n }\n #emitIpcMessage(message) {\n this.emit(\"message\", message);\n }\n #send(message, handle, options, callback) {\n if (typeof handle === \"function\")\n callback = handle, handle = @undefined, options = @undefined;\n else if (typeof options === \"function\")\n callback = options, options = @undefined;\n else if (options !== @undefined) {\n if (typeof options !== \"object\" || options === null)\n throw new ERR_INVALID_ARG_TYPE(\"options\", \"Object\", options);\n }\n if (!this.#handle) {\n if (callback)\n process.nextTick(callback, @makeTypeError(\"Process was closed while trying to send message\"));\n else\n this.emit(\"error\", @makeTypeError(\"Process was closed while trying to send message\"));\n return !1;\n }\n try {\n if (this.#handle.send(message), callback)\n process.nextTick(callback);\n return !0;\n } catch (error) {\n if (callback)\n process.nextTick(callback, error);\n else\n this.emit(\"error\", error);\n return !1;\n }\n }\n #disconnect() {\n if (!this.connected) {\n this.emit(\"error\", @makeTypeError(\"Process was closed while trying to send message\"));\n return;\n }\n this.connected = !1, this.#handle.disconnect();\n }\n kill(sig) {\n const signal = sig === 0 \? sig : convertToValidSignal(sig === @undefined \? \"SIGTERM\" : sig);\n if (this.#handle)\n this.#handle.kill(signal);\n return this.#maybeClose(), !0;\n }\n #maybeClose() {\n if (this.#closesGot++, this.#closesGot === this.#closesNeeded)\n this.emit(\"close\", this.exitCode, this.signalCode);\n }\n ref() {\n if (this.#handle)\n this.#handle.ref();\n }\n unref() {\n if (this.#handle)\n this.#handle.unref();\n }\n}\nvar nodeToBunLookup = {\n ignore: null,\n pipe: \"pipe\",\n overlapped: \"pipe\",\n inherit: \"inherit\"\n};\n\nclass ShimmedStdin extends EventEmitter {\n constructor() {\n super();\n }\n write() {\n return !1;\n }\n destroy() {\n }\n end() {\n }\n pipe() {\n }\n}\n\nclass ShimmedStdioOutStream extends EventEmitter {\n constructor() {\n super(...arguments);\n }\n pipe() {\n }\n}\nvar validateAbortSignal = (signal, name) => {\n if (signal !== @undefined && (signal === null || typeof signal !== \"object\" || !(\"aborted\" in signal)))\n throw new ERR_INVALID_ARG_TYPE(name, \"AbortSignal\", signal);\n};\nvar validateObject = (value, name, options = null) => {\n const allowArray = options\?.allowArray \?\? !1, allowFunction = options\?.allowFunction \?\? !1;\n if (!(options\?.nullable \?\? !1) && value === null || !allowArray && ArrayIsArray.@call(value) || typeof value !== \"object\" && (!allowFunction || typeof value !== \"function\"))\n throw new ERR_INVALID_ARG_TYPE(name, \"object\", value);\n}, validateArray = (value, name, minLength = 0) => {\n if (!ArrayIsArray(value))\n throw new ERR_INVALID_ARG_TYPE(name, \"Array\", value);\n if (value.length < minLength) {\n const reason = `must be longer than ${minLength}`;\n throw new ERR_INVALID_ARG_VALUE(name, value, reason);\n }\n}, Error = globalThis.Error, TypeError = globalThis.TypeError, RangeError = globalThis.RangeError;\n\nclass AbortError extends Error {\n code = \"ABORT_ERR\";\n name = \"AbortError\";\n constructor(message = \"The operation was aborted\", options = @undefined) {\n if (options !== @undefined && typeof options !== \"object\")\n throw new ERR_INVALID_ARG_TYPE(\"options\", \"Object\", options);\n super(message, options);\n }\n}\n\nclass SystemError extends Error {\n path;\n syscall;\n errno;\n code;\n constructor(message, path, syscall, errno, code) {\n super(message);\n this.path = path, this.syscall = syscall, this.errno = errno, this.code = code;\n }\n get name() {\n return \"SystemError\";\n }\n}\n$ = {\n ChildProcess,\n spawn,\n execFile,\n exec,\n fork,\n spawnSync,\n execFileSync,\n execSync\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeClusterCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/cluster.ts\nvar EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20), { throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6);\n\nclass Cluster extends EventEmitter {\n constructor() {\n super(...arguments);\n }\n isWorker = !1;\n isPrimary = !0;\n isMaster = !0;\n workers = {};\n settings = {};\n SCHED_NONE = 1;\n SCHED_RR = 2;\n schedulingPolicy = 2;\n Worker = function Worker() {\n throwNotImplemented(\"node:cluster Worker\", 2428);\n };\n setupPrimary() {\n throwNotImplemented(\"node:cluster\", 2428);\n }\n setupMaster() {\n throwNotImplemented(\"node:cluster\", 2428);\n }\n fork() {\n throwNotImplemented(\"node:cluster\", 2428);\n }\n disconnect() {\n throwNotImplemented(\"node:cluster\", 2428);\n }\n}\nreturn new Cluster})\n"); -// - -// -static constexpr ASCIILiteral NodeConsoleCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/console.ts\nreturn console})\n"); -// - -// -static constexpr ASCIILiteral NodeCryptoCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/crypto.ts\nvar exportIfKeyObject = function(key2) {\n if (key2 instanceof KeyObject)\n key2 = key2.export();\n else if (key2 instanceof CryptoKey)\n key2 = KeyObject.from(key2).export();\n return key2;\n}, getKeyFrom = function(key2, type) {\n if (key2 instanceof KeyObject)\n key2 = key2.export();\n else if (key2 instanceof CryptoKey)\n key2 = KeyObject.from(key2).export();\n else if (!Buffer.isBuffer(key2) && typeof key2 === \"object\") {\n if ((typeof key2.format === \"string\" || typeof key2.passphrase === \"string\") && typeof key2.key !== \"undefined\")\n key2 = type === \"public\" \? _createPublicKey(key2).export() : _createPrivateKey(key2).export();\n } else if (typeof key2 === \"string\" && type === \"public\")\n key2.indexOf(\"PRIVATE KEY-----\") !== -1 && (key2 = _createPublicKey(key2).export());\n return key2;\n}, getArrayBufferOrView = function(buffer, name, encoding) {\n if (buffer instanceof KeyObject) {\n if (buffer.type !== \"secret\") {\n const error2 = @makeTypeError(`ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE: Invalid key object type ${key.type}, expected secret`);\n throw error2.code = \"ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE\", error2;\n }\n buffer = buffer.export();\n }\n if (isAnyArrayBuffer(buffer))\n return buffer;\n if (typeof buffer === \"string\") {\n if (encoding === \"buffer\")\n encoding = \"utf8\";\n return Buffer.from(buffer, encoding);\n }\n if (!isArrayBufferView(buffer)) {\n var error = @makeTypeError(`ERR_INVALID_ARG_TYPE: The \"${name}\" argument must be of type string or an instance of ArrayBuffer, Buffer, TypedArray, or DataView. Received ` + buffer);\n throw error.code = \"ERR_INVALID_ARG_TYPE\", error;\n }\n return buffer;\n}, getCurves = function() {\n return harcoded_curves;\n}, _generateKeyPairSync = function(algorithm, options) {\n const result = generateKeyPairSync(algorithm, options);\n if (result) {\n const publicKeyEncoding = options\?.publicKeyEncoding, privateKeyEncoding = options\?.privateKeyEncoding;\n result.publicKey = publicKeyEncoding \? KeyObject.from(result.publicKey).export(publicKeyEncoding) : KeyObject.from(result.publicKey), result.privateKey = privateKeyEncoding \? KeyObject.from(result.privateKey).export(privateKeyEncoding) : KeyObject.from(result.privateKey);\n }\n return result;\n}, _createPrivateKey = function(key2) {\n if (typeof key2 === \"string\")\n return key2 = Buffer.from(key2, \"utf8\"), KeyObject.from(createPrivateKey({ key: key2, format: \"pem\" }));\n else if (isAnyArrayBuffer(key2) || isArrayBufferView(key2))\n return KeyObject.from(createPrivateKey({ key: key2, format: \"pem\" }));\n else if (typeof key2 === \"object\")\n if (key2 instanceof KeyObject || key2 instanceof CryptoKey) {\n const error2 = @makeTypeError(`ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE: Invalid key object type ${key2.type}`);\n throw error2.code = \"ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE\", error2;\n } else {\n let actual_key = key2.key;\n if (typeof actual_key === \"string\")\n actual_key = Buffer.from(actual_key, key2.encoding || \"utf8\"), key2.key = actual_key;\n else if (actual_key instanceof KeyObject || actual_key instanceof CryptoKey) {\n const error2 = @makeTypeError(`ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE: Invalid key object type ${key2.type}`);\n throw error2.code = \"ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE\", error2;\n }\n if (!isAnyArrayBuffer(actual_key) && !isArrayBufferView(actual_key) && typeof actual_key !== \"object\") {\n var error = @makeTypeError('ERR_INVALID_ARG_TYPE: The \"key\" argument must be of type string or an instance of ArrayBuffer, Buffer, TypedArray, DataView or object. Received ' + actual_key);\n throw error.code = \"ERR_INVALID_ARG_TYPE\", error;\n }\n if (!key2.format)\n key2.format = \"pem\";\n return KeyObject.from(createPrivateKey(key2));\n }\n else {\n var error = @makeTypeError('ERR_INVALID_ARG_TYPE: The \"key\" argument must be of type string or an instance of ArrayBuffer, Buffer, TypedArray, DataView or object. Received ' + key2);\n throw error.code = \"ERR_INVALID_ARG_TYPE\", error;\n }\n}, _createPublicKey = function(key2) {\n if (typeof key2 === \"string\")\n return key2 = Buffer.from(key2, \"utf8\"), KeyObject.from(createPublicKey({ key: key2, format: \"pem\" }));\n else if (isAnyArrayBuffer(key2) || isArrayBufferView(key2))\n return KeyObject.from(createPublicKey({ key: key2, format: \"pem\" }));\n else if (typeof key2 === \"object\")\n if (key2 instanceof KeyObject || key2 instanceof CryptoKey) {\n if (key2.type === \"private\")\n return KeyObject.from(createPublicKey({ key: key2[kCryptoKey] || key2, format: \"\" }));\n const error2 = @makeTypeError(`ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE: Invalid key object type ${key2.type}, expected private`);\n throw error2.code = \"ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE\", error2;\n } else {\n if (key2.passphrase) {\n let actual_key2 = key2.key;\n if (typeof actual_key2 === \"string\")\n actual_key2 = Buffer.from(actual_key2, key2.encoding || \"utf8\");\n return KeyObject.from(createPublicKey({\n key: createPrivateKey({ key: actual_key2, format: key2.format, passphrase: key2.passphrase }),\n format: \"\"\n }));\n }\n let actual_key = key2.key;\n if (typeof actual_key === \"string\")\n actual_key = Buffer.from(actual_key, key2.encoding || \"utf8\"), key2.key = actual_key;\n else if (actual_key instanceof KeyObject || actual_key instanceof CryptoKey) {\n if (actual_key.type === \"private\")\n return KeyObject.from(createPublicKey({ key: actual_key[kCryptoKey] || actual_key, format: \"\" }));\n const error2 = @makeTypeError(`ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE: Invalid key object type ${actual_key.type}, expected private`);\n throw error2.code = \"ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE\", error2;\n }\n if (!isAnyArrayBuffer(actual_key) && !isArrayBufferView(actual_key) && typeof actual_key !== \"object\") {\n var error = @makeTypeError('ERR_INVALID_ARG_TYPE: The \"key\" argument must be of type string or an instance of ArrayBuffer, Buffer, TypedArray, DataView or object. Received ' + key2);\n throw error.code = \"ERR_INVALID_ARG_TYPE\", error;\n }\n if (!key2.format)\n key2.format = \"pem\";\n return KeyObject.from(createPublicKey(key2));\n }\n else {\n var error = @makeTypeError('ERR_INVALID_ARG_TYPE: The \"key\" argument must be of type string or an instance of ArrayBuffer, Buffer, TypedArray, DataView or object. Received ' + key2);\n throw error.code = \"ERR_INVALID_ARG_TYPE\", error;\n }\n}, $, __defProp = Object.defineProperty, __getOwnPropNames = Object.getOwnPropertyNames, StreamModule = @getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39), BufferModule = @requireNativeModule(\"buffer\"), StringDecoder = @requireNativeModule(\"string_decoder\").StringDecoder, MAX_STRING_LENGTH = 536870888, Buffer = globalThis.Buffer, EMPTY_BUFFER = Buffer.alloc(0), { isAnyArrayBuffer, isArrayBufferView } = @requireNativeModule(\"util/types\"), crypto = globalThis.crypto, globalCrypto = crypto, __commonJS = (cb, mod) => function() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n}, __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: !0 });\n}, require_safe_buffer = __commonJS({\n \"node_modules/safe-buffer/index.js\"(exports, module) {\n var buffer = BufferModule, Buffer2 = buffer.Buffer;\n function copyProps(src, dst) {\n for (var key2 in src)\n dst[key2] = src[key2];\n }\n Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow \? module.exports = buffer : (copyProps(buffer, exports), exports.Buffer = SafeBuffer);\n function SafeBuffer(arg, encodingOrOffset, length) {\n return Buffer2(arg, encodingOrOffset, length);\n }\n SafeBuffer.prototype = Object.create(Buffer2.prototype), copyProps(Buffer2, SafeBuffer), SafeBuffer.from = function(arg, encodingOrOffset, length) {\n if (typeof arg == \"number\")\n @throwTypeError(\"Argument must not be a number\");\n return Buffer2(arg, encodingOrOffset, length);\n }, SafeBuffer.alloc = function(size, fill, encoding) {\n if (typeof size != \"number\")\n @throwTypeError(\"Argument must be a number\");\n var buf = Buffer2(size);\n return fill !== void 0 \? typeof encoding == \"string\" \? buf.fill(fill, encoding) : buf.fill(fill) : buf.fill(0), buf;\n }, SafeBuffer.allocUnsafe = function(size) {\n if (typeof size != \"number\")\n @throwTypeError(\"Argument must be a number\");\n return Buffer2(size);\n }, SafeBuffer.allocUnsafeSlow = function(size) {\n if (typeof size != \"number\")\n @throwTypeError(\"Argument must be a number\");\n return buffer.SlowBuffer(size);\n };\n }\n}), require_browser = __commonJS({\n \"node_modules/randombytes/browser.js\"(exports, module) {\n var MAX_BYTES = 65536, MAX_UINT32 = 4294967295;\n function oldBrowser() {\n throw new Error(`Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11`);\n }\n var Buffer2 = require_safe_buffer().Buffer, crypto2 = globalCrypto;\n crypto2 && crypto2.getRandomValues \? module.exports = randomBytes : module.exports = oldBrowser;\n function randomBytes(size, cb) {\n if (size > MAX_UINT32)\n @throwRangeError(\"requested too many random bytes\");\n var bytes = Buffer2.allocUnsafe(size);\n if (size > 0)\n if (size > MAX_BYTES)\n for (var generated = 0;generated < size; generated += MAX_BYTES)\n crypto2.getRandomValues(bytes.slice(generated, generated + MAX_BYTES));\n else\n crypto2.getRandomValues(bytes);\n return typeof cb == \"function\" \? process.nextTick(function() {\n cb(null, bytes);\n }) : bytes;\n }\n }\n}), require_inherits_browser = __commonJS({\n \"node_modules/inherits/inherits_browser.js\"(exports, module) {\n module.exports = function(ctor, superCtor) {\n superCtor && (ctor.super_ = superCtor, ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: !1,\n writable: !0,\n configurable: !0\n }\n }));\n };\n }\n}), require_hash_base = __commonJS({\n \"node_modules/hash-base/index.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer, inherits = require_inherits_browser();\n function throwIfNotStringOrBuffer(val, prefix) {\n if (!Buffer2.isBuffer(val) && typeof val != \"string\")\n @throwTypeError(prefix + \" must be a string or a buffer\");\n }\n function HashBase(blockSize) {\n StreamModule.Transform.@call(this), this._block = Buffer2.allocUnsafe(blockSize), this._blockSize = blockSize, this._blockOffset = 0, this._length = [0, 0, 0, 0], this._finalized = !1;\n }\n inherits(HashBase, StreamModule.Transform), HashBase.prototype._transform = function(chunk, encoding, callback) {\n var error = null;\n try {\n this.update(chunk, encoding);\n } catch (err) {\n error = err;\n }\n callback(error);\n }, HashBase.prototype._flush = function(callback) {\n var error = null;\n try {\n this.push(this.digest());\n } catch (err) {\n error = err;\n }\n callback(error);\n }, HashBase.prototype.update = function(data, encoding) {\n if (throwIfNotStringOrBuffer(data, \"Data\"), this._finalized)\n throw new Error(\"Digest already called\");\n Buffer2.isBuffer(data) || (data = Buffer2.from(data, encoding));\n for (var block = this._block, offset = 0;this._blockOffset + data.length - offset >= this._blockSize; ) {\n for (var i = this._blockOffset;i < this._blockSize; )\n block[i++] = data[offset++];\n this._update(), this._blockOffset = 0;\n }\n for (;offset < data.length; )\n block[this._blockOffset++] = data[offset++];\n for (var j = 0, carry = data.length * 8;carry > 0; ++j)\n this._length[j] += carry, carry = this._length[j] / 4294967296 | 0, carry > 0 && (this._length[j] -= 4294967296 * carry);\n return this;\n }, HashBase.prototype._update = function() {\n throw new Error(\"_update is not implemented\");\n }, HashBase.prototype.digest = function(encoding) {\n if (this._finalized)\n throw new Error(\"Digest already called\");\n this._finalized = !0;\n var digest = this._digest();\n encoding !== void 0 && (digest = digest.toString(encoding)), this._block.fill(0), this._blockOffset = 0;\n for (var i = 0;i < 4; ++i)\n this._length[i] = 0;\n return digest;\n }, HashBase.prototype._digest = function() {\n throw new Error(\"_digest is not implemented\");\n }, module.exports = HashBase;\n }\n}), require_md5 = __commonJS({\n \"node_modules/md5.js/index.js\"(exports, module) {\n var inherits = require_inherits_browser(), HashBase = require_hash_base(), Buffer2 = require_safe_buffer().Buffer, ARRAY16 = new @Array(16);\n function MD5() {\n HashBase.@call(this, 64), this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878;\n }\n inherits(MD5, HashBase), MD5.prototype._update = function() {\n for (var M = ARRAY16, i = 0;i < 16; ++i)\n M[i] = this._block.readInt32LE(i * 4);\n var a = this._a, b = this._b, c = this._c, d = this._d;\n a = fnF(a, b, c, d, M[0], 3614090360, 7), d = fnF(d, a, b, c, M[1], 3905402710, 12), c = fnF(c, d, a, b, M[2], 606105819, 17), b = fnF(b, c, d, a, M[3], 3250441966, 22), a = fnF(a, b, c, d, M[4], 4118548399, 7), d = fnF(d, a, b, c, M[5], 1200080426, 12), c = fnF(c, d, a, b, M[6], 2821735955, 17), b = fnF(b, c, d, a, M[7], 4249261313, 22), a = fnF(a, b, c, d, M[8], 1770035416, 7), d = fnF(d, a, b, c, M[9], 2336552879, 12), c = fnF(c, d, a, b, M[10], 4294925233, 17), b = fnF(b, c, d, a, M[11], 2304563134, 22), a = fnF(a, b, c, d, M[12], 1804603682, 7), d = fnF(d, a, b, c, M[13], 4254626195, 12), c = fnF(c, d, a, b, M[14], 2792965006, 17), b = fnF(b, c, d, a, M[15], 1236535329, 22), a = fnG(a, b, c, d, M[1], 4129170786, 5), d = fnG(d, a, b, c, M[6], 3225465664, 9), c = fnG(c, d, a, b, M[11], 643717713, 14), b = fnG(b, c, d, a, M[0], 3921069994, 20), a = fnG(a, b, c, d, M[5], 3593408605, 5), d = fnG(d, a, b, c, M[10], 38016083, 9), c = fnG(c, d, a, b, M[15], 3634488961, 14), b = fnG(b, c, d, a, M[4], 3889429448, 20), a = fnG(a, b, c, d, M[9], 568446438, 5), d = fnG(d, a, b, c, M[14], 3275163606, 9), c = fnG(c, d, a, b, M[3], 4107603335, 14), b = fnG(b, c, d, a, M[8], 1163531501, 20), a = fnG(a, b, c, d, M[13], 2850285829, 5), d = fnG(d, a, b, c, M[2], 4243563512, 9), c = fnG(c, d, a, b, M[7], 1735328473, 14), b = fnG(b, c, d, a, M[12], 2368359562, 20), a = fnH(a, b, c, d, M[5], 4294588738, 4), d = fnH(d, a, b, c, M[8], 2272392833, 11), c = fnH(c, d, a, b, M[11], 1839030562, 16), b = fnH(b, c, d, a, M[14], 4259657740, 23), a = fnH(a, b, c, d, M[1], 2763975236, 4), d = fnH(d, a, b, c, M[4], 1272893353, 11), c = fnH(c, d, a, b, M[7], 4139469664, 16), b = fnH(b, c, d, a, M[10], 3200236656, 23), a = fnH(a, b, c, d, M[13], 681279174, 4), d = fnH(d, a, b, c, M[0], 3936430074, 11), c = fnH(c, d, a, b, M[3], 3572445317, 16), b = fnH(b, c, d, a, M[6], 76029189, 23), a = fnH(a, b, c, d, M[9], 3654602809, 4), d = fnH(d, a, b, c, M[12], 3873151461, 11), c = fnH(c, d, a, b, M[15], 530742520, 16), b = fnH(b, c, d, a, M[2], 3299628645, 23), a = fnI(a, b, c, d, M[0], 4096336452, 6), d = fnI(d, a, b, c, M[7], 1126891415, 10), c = fnI(c, d, a, b, M[14], 2878612391, 15), b = fnI(b, c, d, a, M[5], 4237533241, 21), a = fnI(a, b, c, d, M[12], 1700485571, 6), d = fnI(d, a, b, c, M[3], 2399980690, 10), c = fnI(c, d, a, b, M[10], 4293915773, 15), b = fnI(b, c, d, a, M[1], 2240044497, 21), a = fnI(a, b, c, d, M[8], 1873313359, 6), d = fnI(d, a, b, c, M[15], 4264355552, 10), c = fnI(c, d, a, b, M[6], 2734768916, 15), b = fnI(b, c, d, a, M[13], 1309151649, 21), a = fnI(a, b, c, d, M[4], 4149444226, 6), d = fnI(d, a, b, c, M[11], 3174756917, 10), c = fnI(c, d, a, b, M[2], 718787259, 15), b = fnI(b, c, d, a, M[9], 3951481745, 21), this._a = this._a + a | 0, this._b = this._b + b | 0, this._c = this._c + c | 0, this._d = this._d + d | 0;\n }, MD5.prototype._digest = function() {\n this._block[this._blockOffset++] = 128, this._blockOffset > 56 && (this._block.fill(0, this._blockOffset, 64), this._update(), this._blockOffset = 0), this._block.fill(0, this._blockOffset, 56), this._block.writeUInt32LE(this._length[0], 56), this._block.writeUInt32LE(this._length[1], 60), this._update();\n var buffer = Buffer2.allocUnsafe(16);\n return buffer.writeInt32LE(this._a, 0), buffer.writeInt32LE(this._b, 4), buffer.writeInt32LE(this._c, 8), buffer.writeInt32LE(this._d, 12), buffer;\n };\n function rotl(x, n) {\n return x << n | x >>> 32 - n;\n }\n function fnF(a, b, c, d, m, k, s) {\n return rotl(a + (b & c | ~b & d) + m + k | 0, s) + b | 0;\n }\n function fnG(a, b, c, d, m, k, s) {\n return rotl(a + (b & d | c & ~d) + m + k | 0, s) + b | 0;\n }\n function fnH(a, b, c, d, m, k, s) {\n return rotl(a + (b ^ c ^ d) + m + k | 0, s) + b | 0;\n }\n function fnI(a, b, c, d, m, k, s) {\n return rotl(a + (c ^ (b | ~d)) + m + k | 0, s) + b | 0;\n }\n module.exports = MD5;\n }\n}), require_ripemd160 = __commonJS({\n \"node_modules/ripemd160/index.js\"(exports, module) {\n var Buffer2 = Buffer, inherits = require_inherits_browser(), HashBase = require_hash_base(), ARRAY16 = new @Array(16), zl = [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 7,\n 4,\n 13,\n 1,\n 10,\n 6,\n 15,\n 3,\n 12,\n 0,\n 9,\n 5,\n 2,\n 14,\n 11,\n 8,\n 3,\n 10,\n 14,\n 4,\n 9,\n 15,\n 8,\n 1,\n 2,\n 7,\n 0,\n 6,\n 13,\n 11,\n 5,\n 12,\n 1,\n 9,\n 11,\n 10,\n 0,\n 8,\n 12,\n 4,\n 13,\n 3,\n 7,\n 15,\n 14,\n 5,\n 6,\n 2,\n 4,\n 0,\n 5,\n 9,\n 7,\n 12,\n 2,\n 10,\n 14,\n 1,\n 3,\n 8,\n 11,\n 6,\n 15,\n 13\n ], zr = [\n 5,\n 14,\n 7,\n 0,\n 9,\n 2,\n 11,\n 4,\n 13,\n 6,\n 15,\n 8,\n 1,\n 10,\n 3,\n 12,\n 6,\n 11,\n 3,\n 7,\n 0,\n 13,\n 5,\n 10,\n 14,\n 15,\n 8,\n 12,\n 4,\n 9,\n 1,\n 2,\n 15,\n 5,\n 1,\n 3,\n 7,\n 14,\n 6,\n 9,\n 11,\n 8,\n 12,\n 2,\n 10,\n 0,\n 4,\n 13,\n 8,\n 6,\n 4,\n 1,\n 3,\n 11,\n 15,\n 0,\n 5,\n 12,\n 2,\n 13,\n 9,\n 7,\n 10,\n 14,\n 12,\n 15,\n 10,\n 4,\n 1,\n 5,\n 8,\n 7,\n 6,\n 2,\n 13,\n 14,\n 0,\n 3,\n 9,\n 11\n ], sl = [\n 11,\n 14,\n 15,\n 12,\n 5,\n 8,\n 7,\n 9,\n 11,\n 13,\n 14,\n 15,\n 6,\n 7,\n 9,\n 8,\n 7,\n 6,\n 8,\n 13,\n 11,\n 9,\n 7,\n 15,\n 7,\n 12,\n 15,\n 9,\n 11,\n 7,\n 13,\n 12,\n 11,\n 13,\n 6,\n 7,\n 14,\n 9,\n 13,\n 15,\n 14,\n 8,\n 13,\n 6,\n 5,\n 12,\n 7,\n 5,\n 11,\n 12,\n 14,\n 15,\n 14,\n 15,\n 9,\n 8,\n 9,\n 14,\n 5,\n 6,\n 8,\n 6,\n 5,\n 12,\n 9,\n 15,\n 5,\n 11,\n 6,\n 8,\n 13,\n 12,\n 5,\n 12,\n 13,\n 14,\n 11,\n 8,\n 5,\n 6\n ], sr = [\n 8,\n 9,\n 9,\n 11,\n 13,\n 15,\n 15,\n 5,\n 7,\n 7,\n 8,\n 11,\n 14,\n 14,\n 12,\n 6,\n 9,\n 13,\n 15,\n 7,\n 12,\n 8,\n 9,\n 11,\n 7,\n 7,\n 12,\n 7,\n 6,\n 15,\n 13,\n 11,\n 9,\n 7,\n 15,\n 11,\n 8,\n 6,\n 6,\n 14,\n 12,\n 13,\n 5,\n 14,\n 13,\n 13,\n 7,\n 5,\n 15,\n 5,\n 8,\n 11,\n 14,\n 14,\n 6,\n 14,\n 6,\n 9,\n 12,\n 9,\n 12,\n 5,\n 15,\n 8,\n 8,\n 5,\n 12,\n 9,\n 12,\n 5,\n 14,\n 6,\n 8,\n 13,\n 6,\n 5,\n 15,\n 13,\n 11,\n 11\n ], hl = [0, 1518500249, 1859775393, 2400959708, 2840853838], hr = [1352829926, 1548603684, 1836072691, 2053994217, 0];\n function RIPEMD160() {\n HashBase.@call(this, 64), this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520;\n }\n inherits(RIPEMD160, HashBase), RIPEMD160.prototype._update = function() {\n for (var words = ARRAY16, j = 0;j < 16; ++j)\n words[j] = this._block.readInt32LE(j * 4);\n for (var al = this._a | 0, bl = this._b | 0, cl = this._c | 0, dl = this._d | 0, el = this._e | 0, ar = this._a | 0, br = this._b | 0, cr = this._c | 0, dr = this._d | 0, er = this._e | 0, i = 0;i < 80; i += 1) {\n var tl, tr;\n i < 16 \? (tl = fn1(al, bl, cl, dl, el, words[zl[i]], hl[0], sl[i]), tr = fn5(ar, br, cr, dr, er, words[zr[i]], hr[0], sr[i])) : i < 32 \? (tl = fn2(al, bl, cl, dl, el, words[zl[i]], hl[1], sl[i]), tr = fn4(ar, br, cr, dr, er, words[zr[i]], hr[1], sr[i])) : i < 48 \? (tl = fn3(al, bl, cl, dl, el, words[zl[i]], hl[2], sl[i]), tr = fn3(ar, br, cr, dr, er, words[zr[i]], hr[2], sr[i])) : i < 64 \? (tl = fn4(al, bl, cl, dl, el, words[zl[i]], hl[3], sl[i]), tr = fn2(ar, br, cr, dr, er, words[zr[i]], hr[3], sr[i])) : (tl = fn5(al, bl, cl, dl, el, words[zl[i]], hl[4], sl[i]), tr = fn1(ar, br, cr, dr, er, words[zr[i]], hr[4], sr[i])), al = el, el = dl, dl = rotl(cl, 10), cl = bl, bl = tl, ar = er, er = dr, dr = rotl(cr, 10), cr = br, br = tr;\n }\n var t = this._b + cl + dr | 0;\n this._b = this._c + dl + er | 0, this._c = this._d + el + ar | 0, this._d = this._e + al + br | 0, this._e = this._a + bl + cr | 0, this._a = t;\n }, RIPEMD160.prototype._digest = function() {\n this._block[this._blockOffset++] = 128, this._blockOffset > 56 && (this._block.fill(0, this._blockOffset, 64), this._update(), this._blockOffset = 0), this._block.fill(0, this._blockOffset, 56), this._block.writeUInt32LE(this._length[0], 56), this._block.writeUInt32LE(this._length[1], 60), this._update();\n var buffer = Buffer2.alloc \? Buffer2.alloc(20) : new Buffer2(20);\n return buffer.writeInt32LE(this._a, 0), buffer.writeInt32LE(this._b, 4), buffer.writeInt32LE(this._c, 8), buffer.writeInt32LE(this._d, 12), buffer.writeInt32LE(this._e, 16), buffer;\n };\n function rotl(x, n) {\n return x << n | x >>> 32 - n;\n }\n function fn1(a, b, c, d, e, m, k, s) {\n return rotl(a + (b ^ c ^ d) + m + k | 0, s) + e | 0;\n }\n function fn2(a, b, c, d, e, m, k, s) {\n return rotl(a + (b & c | ~b & d) + m + k | 0, s) + e | 0;\n }\n function fn3(a, b, c, d, e, m, k, s) {\n return rotl(a + ((b | ~c) ^ d) + m + k | 0, s) + e | 0;\n }\n function fn4(a, b, c, d, e, m, k, s) {\n return rotl(a + (b & d | c & ~d) + m + k | 0, s) + e | 0;\n }\n function fn5(a, b, c, d, e, m, k, s) {\n return rotl(a + (b ^ (c | ~d)) + m + k | 0, s) + e | 0;\n }\n module.exports = RIPEMD160;\n }\n}), require_hash = __commonJS({\n \"node_modules/sha.js/hash.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer;\n function Hash(blockSize, finalSize) {\n this._block = Buffer2.alloc(blockSize), this._finalSize = finalSize, this._blockSize = blockSize, this._len = 0;\n }\n Hash.prototype = {}, Hash.prototype.update = function(data, enc) {\n typeof data == \"string\" && (enc = enc || \"utf8\", data = Buffer2.from(data, enc));\n for (var block = this._block, blockSize = this._blockSize, length = data.length, accum = this._len, offset = 0;offset < length; ) {\n for (var assigned = accum % blockSize, remainder = Math.min(length - offset, blockSize - assigned), i = 0;i < remainder; i++)\n block[assigned + i] = data[offset + i];\n accum += remainder, offset += remainder, accum % blockSize === 0 && this._update(block);\n }\n return this._len += length, this;\n }, Hash.prototype.digest = function(enc) {\n var rem = this._len % this._blockSize;\n this._block[rem] = 128, this._block.fill(0, rem + 1), rem >= this._finalSize && (this._update(this._block), this._block.fill(0));\n var bits = this._len * 8;\n if (bits <= 4294967295)\n this._block.writeUInt32BE(bits, this._blockSize - 4);\n else {\n var lowBits = (bits & 4294967295) >>> 0, highBits = (bits - lowBits) / 4294967296;\n this._block.writeUInt32BE(highBits, this._blockSize - 8), this._block.writeUInt32BE(lowBits, this._blockSize - 4);\n }\n this._update(this._block);\n var hash = this._hash();\n return enc \? hash.toString(enc) : hash;\n }, Hash.prototype._update = function() {\n throw new Error(\"_update must be implemented by subclass\");\n }, module.exports = Hash;\n }\n}), require_sha = __commonJS({\n \"node_modules/sha.js/sha.js\"(exports, module) {\n var inherits = require_inherits_browser(), Hash = require_hash(), Buffer2 = require_safe_buffer().Buffer, K = [1518500249, 1859775393, -1894007588, -899497514], W = new @Array(80);\n function Sha() {\n this.init(), this._w = W, Hash.@call(this, 64, 56);\n }\n inherits(Sha, Hash), Sha.prototype.init = function() {\n return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520, this;\n };\n function rotl5(num) {\n return num << 5 | num >>> 27;\n }\n function rotl30(num) {\n return num << 30 | num >>> 2;\n }\n function ft(s, b, c, d) {\n return s === 0 \? b & c | ~b & d : s === 2 \? b & c | b & d | c & d : b ^ c ^ d;\n }\n Sha.prototype._update = function(M) {\n for (var W2 = this._w, a = this._a | 0, b = this._b | 0, c = this._c | 0, d = this._d | 0, e = this._e | 0, i = 0;i < 16; ++i)\n W2[i] = M.readInt32BE(i * 4);\n for (;i < 80; ++i)\n W2[i] = W2[i - 3] ^ W2[i - 8] ^ W2[i - 14] ^ W2[i - 16];\n for (var j = 0;j < 80; ++j) {\n var s = ~~(j / 20), t = rotl5(a) + ft(s, b, c, d) + e + W2[j] + K[s] | 0;\n e = d, d = c, c = rotl30(b), b = a, a = t;\n }\n this._a = a + this._a | 0, this._b = b + this._b | 0, this._c = c + this._c | 0, this._d = d + this._d | 0, this._e = e + this._e | 0;\n }, Sha.prototype._hash = function() {\n var H = Buffer2.allocUnsafe(20);\n return H.writeInt32BE(this._a | 0, 0), H.writeInt32BE(this._b | 0, 4), H.writeInt32BE(this._c | 0, 8), H.writeInt32BE(this._d | 0, 12), H.writeInt32BE(this._e | 0, 16), H;\n }, module.exports = Sha;\n }\n}), require_sha1 = __commonJS({\n \"node_modules/sha.js/sha1.js\"(exports, module) {\n var inherits = require_inherits_browser(), Hash = require_hash(), Buffer2 = require_safe_buffer().Buffer, K = [1518500249, 1859775393, -1894007588, -899497514], W = new @Array(80);\n function Sha1() {\n this.init(), this._w = W, Hash.@call(this, 64, 56);\n }\n inherits(Sha1, Hash), Sha1.prototype.init = function() {\n return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520, this;\n };\n function rotl1(num) {\n return num << 1 | num >>> 31;\n }\n function rotl5(num) {\n return num << 5 | num >>> 27;\n }\n function rotl30(num) {\n return num << 30 | num >>> 2;\n }\n function ft(s, b, c, d) {\n return s === 0 \? b & c | ~b & d : s === 2 \? b & c | b & d | c & d : b ^ c ^ d;\n }\n Sha1.prototype._update = function(M) {\n for (var W2 = this._w, a = this._a | 0, b = this._b | 0, c = this._c | 0, d = this._d | 0, e = this._e | 0, i = 0;i < 16; ++i)\n W2[i] = M.readInt32BE(i * 4);\n for (;i < 80; ++i)\n W2[i] = rotl1(W2[i - 3] ^ W2[i - 8] ^ W2[i - 14] ^ W2[i - 16]);\n for (var j = 0;j < 80; ++j) {\n var s = ~~(j / 20), t = rotl5(a) + ft(s, b, c, d) + e + W2[j] + K[s] | 0;\n e = d, d = c, c = rotl30(b), b = a, a = t;\n }\n this._a = a + this._a | 0, this._b = b + this._b | 0, this._c = c + this._c | 0, this._d = d + this._d | 0, this._e = e + this._e | 0;\n }, Sha1.prototype._hash = function() {\n var H = Buffer2.allocUnsafe(20);\n return H.writeInt32BE(this._a | 0, 0), H.writeInt32BE(this._b | 0, 4), H.writeInt32BE(this._c | 0, 8), H.writeInt32BE(this._d | 0, 12), H.writeInt32BE(this._e | 0, 16), H;\n }, module.exports = Sha1;\n }\n}), require_sha256 = __commonJS({\n \"node_modules/sha.js/sha256.js\"(exports, module) {\n var inherits = require_inherits_browser(), Hash = require_hash(), Buffer2 = require_safe_buffer().Buffer, K = [\n 1116352408,\n 1899447441,\n 3049323471,\n 3921009573,\n 961987163,\n 1508970993,\n 2453635748,\n 2870763221,\n 3624381080,\n 310598401,\n 607225278,\n 1426881987,\n 1925078388,\n 2162078206,\n 2614888103,\n 3248222580,\n 3835390401,\n 4022224774,\n 264347078,\n 604807628,\n 770255983,\n 1249150122,\n 1555081692,\n 1996064986,\n 2554220882,\n 2821834349,\n 2952996808,\n 3210313671,\n 3336571891,\n 3584528711,\n 113926993,\n 338241895,\n 666307205,\n 773529912,\n 1294757372,\n 1396182291,\n 1695183700,\n 1986661051,\n 2177026350,\n 2456956037,\n 2730485921,\n 2820302411,\n 3259730800,\n 3345764771,\n 3516065817,\n 3600352804,\n 4094571909,\n 275423344,\n 430227734,\n 506948616,\n 659060556,\n 883997877,\n 958139571,\n 1322822218,\n 1537002063,\n 1747873779,\n 1955562222,\n 2024104815,\n 2227730452,\n 2361852424,\n 2428436474,\n 2756734187,\n 3204031479,\n 3329325298\n ], W = new @Array(64);\n function Sha256() {\n this.init(), this._w = W, Hash.@call(this, 64, 56);\n }\n inherits(Sha256, Hash), Sha256.prototype.init = function() {\n return this._a = 1779033703, this._b = 3144134277, this._c = 1013904242, this._d = 2773480762, this._e = 1359893119, this._f = 2600822924, this._g = 528734635, this._h = 1541459225, this;\n };\n function ch(x, y, z) {\n return z ^ x & (y ^ z);\n }\n function maj(x, y, z) {\n return x & y | z & (x | y);\n }\n function sigma0(x) {\n return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10);\n }\n function sigma1(x) {\n return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7);\n }\n function gamma0(x) {\n return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ x >>> 3;\n }\n function gamma1(x) {\n return (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ x >>> 10;\n }\n Sha256.prototype._update = function(M) {\n for (var W2 = this._w, a = this._a | 0, b = this._b | 0, c = this._c | 0, d = this._d | 0, e = this._e | 0, f = this._f | 0, g = this._g | 0, h = this._h | 0, i = 0;i < 16; ++i)\n W2[i] = M.readInt32BE(i * 4);\n for (;i < 64; ++i)\n W2[i] = gamma1(W2[i - 2]) + W2[i - 7] + gamma0(W2[i - 15]) + W2[i - 16] | 0;\n for (var j = 0;j < 64; ++j) {\n var T1 = h + sigma1(e) + ch(e, f, g) + K[j] + W2[j] | 0, T2 = sigma0(a) + maj(a, b, c) | 0;\n h = g, g = f, f = e, e = d + T1 | 0, d = c, c = b, b = a, a = T1 + T2 | 0;\n }\n this._a = a + this._a | 0, this._b = b + this._b | 0, this._c = c + this._c | 0, this._d = d + this._d | 0, this._e = e + this._e | 0, this._f = f + this._f | 0, this._g = g + this._g | 0, this._h = h + this._h | 0;\n }, Sha256.prototype._hash = function() {\n var H = Buffer2.allocUnsafe(32);\n return H.writeInt32BE(this._a, 0), H.writeInt32BE(this._b, 4), H.writeInt32BE(this._c, 8), H.writeInt32BE(this._d, 12), H.writeInt32BE(this._e, 16), H.writeInt32BE(this._f, 20), H.writeInt32BE(this._g, 24), H.writeInt32BE(this._h, 28), H;\n }, module.exports = Sha256;\n }\n}), require_sha224 = __commonJS({\n \"node_modules/sha.js/sha224.js\"(exports, module) {\n var inherits = require_inherits_browser(), Sha256 = require_sha256(), Hash = require_hash(), Buffer2 = require_safe_buffer().Buffer, W = new @Array(64);\n function Sha224() {\n this.init(), this._w = W, Hash.@call(this, 64, 56);\n }\n inherits(Sha224, Sha256), Sha224.prototype.init = function() {\n return this._a = 3238371032, this._b = 914150663, this._c = 812702999, this._d = 4144912697, this._e = 4290775857, this._f = 1750603025, this._g = 1694076839, this._h = 3204075428, this;\n }, Sha224.prototype._hash = function() {\n var H = Buffer2.allocUnsafe(28);\n return H.writeInt32BE(this._a, 0), H.writeInt32BE(this._b, 4), H.writeInt32BE(this._c, 8), H.writeInt32BE(this._d, 12), H.writeInt32BE(this._e, 16), H.writeInt32BE(this._f, 20), H.writeInt32BE(this._g, 24), H;\n }, module.exports = Sha224;\n }\n}), require_sha512 = __commonJS({\n \"node_modules/sha.js/sha512.js\"(exports, module) {\n var inherits = require_inherits_browser(), Hash = require_hash(), Buffer2 = require_safe_buffer().Buffer, K = [\n 1116352408,\n 3609767458,\n 1899447441,\n 602891725,\n 3049323471,\n 3964484399,\n 3921009573,\n 2173295548,\n 961987163,\n 4081628472,\n 1508970993,\n 3053834265,\n 2453635748,\n 2937671579,\n 2870763221,\n 3664609560,\n 3624381080,\n 2734883394,\n 310598401,\n 1164996542,\n 607225278,\n 1323610764,\n 1426881987,\n 3590304994,\n 1925078388,\n 4068182383,\n 2162078206,\n 991336113,\n 2614888103,\n 633803317,\n 3248222580,\n 3479774868,\n 3835390401,\n 2666613458,\n 4022224774,\n 944711139,\n 264347078,\n 2341262773,\n 604807628,\n 2007800933,\n 770255983,\n 1495990901,\n 1249150122,\n 1856431235,\n 1555081692,\n 3175218132,\n 1996064986,\n 2198950837,\n 2554220882,\n 3999719339,\n 2821834349,\n 766784016,\n 2952996808,\n 2566594879,\n 3210313671,\n 3203337956,\n 3336571891,\n 1034457026,\n 3584528711,\n 2466948901,\n 113926993,\n 3758326383,\n 338241895,\n 168717936,\n 666307205,\n 1188179964,\n 773529912,\n 1546045734,\n 1294757372,\n 1522805485,\n 1396182291,\n 2643833823,\n 1695183700,\n 2343527390,\n 1986661051,\n 1014477480,\n 2177026350,\n 1206759142,\n 2456956037,\n 344077627,\n 2730485921,\n 1290863460,\n 2820302411,\n 3158454273,\n 3259730800,\n 3505952657,\n 3345764771,\n 106217008,\n 3516065817,\n 3606008344,\n 3600352804,\n 1432725776,\n 4094571909,\n 1467031594,\n 275423344,\n 851169720,\n 430227734,\n 3100823752,\n 506948616,\n 1363258195,\n 659060556,\n 3750685593,\n 883997877,\n 3785050280,\n 958139571,\n 3318307427,\n 1322822218,\n 3812723403,\n 1537002063,\n 2003034995,\n 1747873779,\n 3602036899,\n 1955562222,\n 1575990012,\n 2024104815,\n 1125592928,\n 2227730452,\n 2716904306,\n 2361852424,\n 442776044,\n 2428436474,\n 593698344,\n 2756734187,\n 3733110249,\n 3204031479,\n 2999351573,\n 3329325298,\n 3815920427,\n 3391569614,\n 3928383900,\n 3515267271,\n 566280711,\n 3940187606,\n 3454069534,\n 4118630271,\n 4000239992,\n 116418474,\n 1914138554,\n 174292421,\n 2731055270,\n 289380356,\n 3203993006,\n 460393269,\n 320620315,\n 685471733,\n 587496836,\n 852142971,\n 1086792851,\n 1017036298,\n 365543100,\n 1126000580,\n 2618297676,\n 1288033470,\n 3409855158,\n 1501505948,\n 4234509866,\n 1607167915,\n 987167468,\n 1816402316,\n 1246189591\n ], W = new @Array(160);\n function Sha512() {\n this.init(), this._w = W, Hash.@call(this, 128, 112);\n }\n inherits(Sha512, Hash), Sha512.prototype.init = function() {\n return this._ah = 1779033703, this._bh = 3144134277, this._ch = 1013904242, this._dh = 2773480762, this._eh = 1359893119, this._fh = 2600822924, this._gh = 528734635, this._hh = 1541459225, this._al = 4089235720, this._bl = 2227873595, this._cl = 4271175723, this._dl = 1595750129, this._el = 2917565137, this._fl = 725511199, this._gl = 4215389547, this._hl = 327033209, this;\n };\n function Ch(x, y, z) {\n return z ^ x & (y ^ z);\n }\n function maj(x, y, z) {\n return x & y | z & (x | y);\n }\n function sigma0(x, xl) {\n return (x >>> 28 | xl << 4) ^ (xl >>> 2 | x << 30) ^ (xl >>> 7 | x << 25);\n }\n function sigma1(x, xl) {\n return (x >>> 14 | xl << 18) ^ (x >>> 18 | xl << 14) ^ (xl >>> 9 | x << 23);\n }\n function Gamma0(x, xl) {\n return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ x >>> 7;\n }\n function Gamma0l(x, xl) {\n return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7 | xl << 25);\n }\n function Gamma1(x, xl) {\n return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ x >>> 6;\n }\n function Gamma1l(x, xl) {\n return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6 | xl << 26);\n }\n function getCarry(a, b) {\n return a >>> 0 < b >>> 0 \? 1 : 0;\n }\n Sha512.prototype._update = function(M) {\n for (var W2 = this._w, ah = this._ah | 0, bh = this._bh | 0, ch = this._ch | 0, dh = this._dh | 0, eh = this._eh | 0, fh = this._fh | 0, gh = this._gh | 0, hh = this._hh | 0, al = this._al | 0, bl = this._bl | 0, cl = this._cl | 0, dl = this._dl | 0, el = this._el | 0, fl = this._fl | 0, gl = this._gl | 0, hl = this._hl | 0, i = 0;i < 32; i += 2)\n W2[i] = M.readInt32BE(i * 4), W2[i + 1] = M.readInt32BE(i * 4 + 4);\n for (;i < 160; i += 2) {\n var xh = W2[i - 30], xl = W2[i - 30 + 1], gamma0 = Gamma0(xh, xl), gamma0l = Gamma0l(xl, xh);\n xh = W2[i - 4], xl = W2[i - 4 + 1];\n var gamma1 = Gamma1(xh, xl), gamma1l = Gamma1l(xl, xh), Wi7h = W2[i - 14], Wi7l = W2[i - 14 + 1], Wi16h = W2[i - 32], Wi16l = W2[i - 32 + 1], Wil = gamma0l + Wi7l | 0, Wih = gamma0 + Wi7h + getCarry(Wil, gamma0l) | 0;\n Wil = Wil + gamma1l | 0, Wih = Wih + gamma1 + getCarry(Wil, gamma1l) | 0, Wil = Wil + Wi16l | 0, Wih = Wih + Wi16h + getCarry(Wil, Wi16l) | 0, W2[i] = Wih, W2[i + 1] = Wil;\n }\n for (var j = 0;j < 160; j += 2) {\n Wih = W2[j], Wil = W2[j + 1];\n var majh = maj(ah, bh, ch), majl = maj(al, bl, cl), sigma0h = sigma0(ah, al), sigma0l = sigma0(al, ah), sigma1h = sigma1(eh, el), sigma1l = sigma1(el, eh), Kih = K[j], Kil = K[j + 1], chh = Ch(eh, fh, gh), chl = Ch(el, fl, gl), t1l = hl + sigma1l | 0, t1h = hh + sigma1h + getCarry(t1l, hl) | 0;\n t1l = t1l + chl | 0, t1h = t1h + chh + getCarry(t1l, chl) | 0, t1l = t1l + Kil | 0, t1h = t1h + Kih + getCarry(t1l, Kil) | 0, t1l = t1l + Wil | 0, t1h = t1h + Wih + getCarry(t1l, Wil) | 0;\n var t2l = sigma0l + majl | 0, t2h = sigma0h + majh + getCarry(t2l, sigma0l) | 0;\n hh = gh, hl = gl, gh = fh, gl = fl, fh = eh, fl = el, el = dl + t1l | 0, eh = dh + t1h + getCarry(el, dl) | 0, dh = ch, dl = cl, ch = bh, cl = bl, bh = ah, bl = al, al = t1l + t2l | 0, ah = t1h + t2h + getCarry(al, t1l) | 0;\n }\n this._al = this._al + al | 0, this._bl = this._bl + bl | 0, this._cl = this._cl + cl | 0, this._dl = this._dl + dl | 0, this._el = this._el + el | 0, this._fl = this._fl + fl | 0, this._gl = this._gl + gl | 0, this._hl = this._hl + hl | 0, this._ah = this._ah + ah + getCarry(this._al, al) | 0, this._bh = this._bh + bh + getCarry(this._bl, bl) | 0, this._ch = this._ch + ch + getCarry(this._cl, cl) | 0, this._dh = this._dh + dh + getCarry(this._dl, dl) | 0, this._eh = this._eh + eh + getCarry(this._el, el) | 0, this._fh = this._fh + fh + getCarry(this._fl, fl) | 0, this._gh = this._gh + gh + getCarry(this._gl, gl) | 0, this._hh = this._hh + hh + getCarry(this._hl, hl) | 0;\n }, Sha512.prototype._hash = function() {\n var H = Buffer2.allocUnsafe(64);\n function writeInt64BE(h, l, offset) {\n H.writeInt32BE(h, offset), H.writeInt32BE(l, offset + 4);\n }\n return writeInt64BE(this._ah, this._al, 0), writeInt64BE(this._bh, this._bl, 8), writeInt64BE(this._ch, this._cl, 16), writeInt64BE(this._dh, this._dl, 24), writeInt64BE(this._eh, this._el, 32), writeInt64BE(this._fh, this._fl, 40), writeInt64BE(this._gh, this._gl, 48), writeInt64BE(this._hh, this._hl, 56), H;\n }, module.exports = Sha512;\n }\n}), require_sha384 = __commonJS({\n \"node_modules/sha.js/sha384.js\"(exports, module) {\n var inherits = require_inherits_browser(), SHA512 = require_sha512(), Hash = require_hash(), Buffer2 = require_safe_buffer().Buffer, W = new @Array(160);\n function Sha384() {\n this.init(), this._w = W, Hash.@call(this, 128, 112);\n }\n inherits(Sha384, SHA512), Sha384.prototype.init = function() {\n return this._ah = 3418070365, this._bh = 1654270250, this._ch = 2438529370, this._dh = 355462360, this._eh = 1731405415, this._fh = 2394180231, this._gh = 3675008525, this._hh = 1203062813, this._al = 3238371032, this._bl = 914150663, this._cl = 812702999, this._dl = 4144912697, this._el = 4290775857, this._fl = 1750603025, this._gl = 1694076839, this._hl = 3204075428, this;\n }, Sha384.prototype._hash = function() {\n var H = Buffer2.allocUnsafe(48);\n function writeInt64BE(h, l, offset) {\n H.writeInt32BE(h, offset), H.writeInt32BE(l, offset + 4);\n }\n return writeInt64BE(this._ah, this._al, 0), writeInt64BE(this._bh, this._bl, 8), writeInt64BE(this._ch, this._cl, 16), writeInt64BE(this._dh, this._dl, 24), writeInt64BE(this._eh, this._el, 32), writeInt64BE(this._fh, this._fl, 40), H;\n }, module.exports = Sha384;\n }\n}), require_sha2 = __commonJS({\n \"node_modules/sha.js/index.js\"(exports, module) {\n var exports = module.exports = function(algorithm) {\n algorithm = algorithm.toLowerCase();\n var Algorithm = exports[algorithm];\n if (!Algorithm)\n throw new Error(algorithm + \" is not supported (we accept pull requests)\");\n return new Algorithm;\n };\n exports.sha = require_sha(), exports.sha1 = require_sha1(), exports.sha224 = require_sha224(), exports.sha256 = require_sha256(), exports.sha384 = require_sha384(), exports.sha512 = require_sha512();\n }\n}), require_cipher_base = __commonJS({\n \"node_modules/cipher-base/index.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer, inherits = require_inherits_browser();\n function CipherBase(hashMode) {\n StreamModule.Transform.@call(this), this.hashMode = typeof hashMode == \"string\", this.hashMode \? this[hashMode] = this._finalOrDigest : this.final = this._finalOrDigest, this._final && (this.__final = this._final, this._final = null), this._decoder = null, this._encoding = null, this._finalized = !1;\n }\n inherits(CipherBase, StreamModule.Transform), CipherBase.prototype.update = function(data, inputEnc, outputEnc) {\n if (outputEnc === \"buffer\")\n outputEnc = @undefined;\n typeof data == \"string\" && (data = Buffer2.from(data, inputEnc));\n var outData = this._update(data);\n return this.hashMode \? this : (outputEnc && (outData = this._toString(outData, outputEnc)), outData);\n }, CipherBase.prototype.setAutoPadding = function() {\n }, CipherBase.prototype.getAuthTag = function() {\n throw new Error(\"trying to get auth tag in unsupported state\");\n }, CipherBase.prototype.setAuthTag = function() {\n throw new Error(\"trying to set auth tag in unsupported state\");\n }, CipherBase.prototype.setAAD = function() {\n throw new Error(\"trying to set aad in unsupported state\");\n }, CipherBase.prototype._transform = function(data, _, next) {\n var err;\n try {\n this.hashMode \? this._update(data) : this.push(this._update(data));\n } catch (e) {\n err = e;\n } finally {\n next(err);\n }\n }, CipherBase.prototype._flush = function(done) {\n var err;\n try {\n this.push(this.__final());\n } catch (e) {\n err = e;\n }\n done(err);\n }, CipherBase.prototype._finalOrDigest = function(outputEnc) {\n if (outputEnc === \"buffer\")\n outputEnc = @undefined;\n if (this._finalized) {\n if (!this._encoding)\n return Buffer2.alloc(0);\n return \"\";\n }\n this._finalized = !0;\n var outData = this.__final() || Buffer2.alloc(0);\n return outputEnc && (outData = this._toString(outData, outputEnc, !0)), outData;\n }, CipherBase.prototype._toString = function(value, enc, fin) {\n if (this._decoder || (this._decoder = new StringDecoder(enc), this._encoding = enc), this._encoding !== enc)\n throw new Error(\"can't switch encodings\");\n var out = this._decoder.write(value);\n return fin && (out += this._decoder.end()), out;\n }, module.exports = CipherBase;\n }\n}), require_browser2 = __commonJS({\n \"node_modules/create-hash/browser.js\"(exports, module) {\n const LazyHash = function Hash(algorithm, options) {\n this._options = options, this._hasher = new CryptoHasher(algorithm, options), this._finalized = !1;\n };\n LazyHash.prototype = Object.create(StreamModule.Transform.prototype), LazyHash.prototype.update = function update(data, encoding) {\n return this._checkFinalized(), this._hasher.update(data, encoding), this;\n }, LazyHash.prototype.digest = function update(data, encoding) {\n return this._checkFinalized(), this._finalized = !0, this._hasher.digest(data, encoding);\n }, LazyHash.prototype._checkFinalized = function _checkFinalized() {\n if (this._finalized) {\n var err = new Error(\"Digest already called\");\n throw err.code = \"ERR_CRYPTO_HASH_FINALIZED\", err;\n }\n }, LazyHash.prototype.copy = function copy() {\n const copy = Object.create(LazyHash.prototype);\n return copy._options = this._options, copy._hasher = this._hasher.copy(), copy._finalized = this._finalized, copy;\n };\n const lazyHashFullInitProto = {\n __proto__: StreamModule.Transform.prototype,\n ...LazyHash.prototype,\n _transform(data, encoding, callback) {\n this.update(data, encoding), callback && callback();\n },\n _flush(callback) {\n this.push(this.digest()), callback();\n }\n }, triggerMethods = [\n \"_events\",\n \"_eventsCount\",\n \"_final\",\n \"_maxListeners\",\n \"_maxListeners\",\n \"_read\",\n \"_undestroy\",\n \"_writableState\",\n \"_write\",\n \"_writev\",\n \"addListener\",\n \"asIndexedPairs\",\n \"closed\",\n \"compose\",\n \"constructor\",\n \"cork\",\n \"destroy\",\n \"destroyed\",\n \"drop\",\n \"emit\",\n \"end\",\n \"errored\",\n \"eventNames\",\n \"every\",\n \"filter\",\n \"find\",\n \"flatMap\",\n \"forEach\",\n \"getMaxListeners\",\n \"hasOwnProperty\",\n \"isPaused\",\n \"isPrototypeOf\",\n \"iterator\",\n \"listenerCount\",\n \"listeners\",\n \"map\",\n \"off\",\n \"on\",\n \"once\",\n \"pause\",\n \"pipe\",\n \"prependListener\",\n \"prependOnceListener\",\n \"propertyIsEnumerable\",\n \"push\",\n \"rawListeners\",\n \"read\",\n \"readable\",\n \"readableAborted\",\n \"readableBuffer\",\n \"readableDidRead\",\n \"readableEncoding\",\n \"readableEnded\",\n \"readableFlowing\",\n \"readableHighWaterMark\",\n \"readableLength\",\n \"readableObjectMode\",\n \"reduce\",\n \"removeAllListeners\",\n \"removeListener\",\n \"resume\",\n \"setDefaultEncoding\",\n \"setEncoding\",\n \"setMaxListeners\",\n \"some\",\n \"take\",\n \"toArray\",\n \"toLocaleString\",\n \"toString\",\n \"uncork\",\n \"unpipe\",\n \"unshift\",\n \"valueOf\",\n \"wrap\",\n \"writable\",\n \"writableBuffer\",\n \"writableCorked\",\n \"writableEnded\",\n \"writableFinished\",\n \"writableHighWaterMark\",\n \"writableLength\",\n \"writableNeedDrain\",\n \"writableObjectMode\",\n \"write\"\n ];\n for (let method of triggerMethods)\n Object.defineProperty(LazyHash.prototype, method, {\n get() {\n return Object.setPrototypeOf(this, lazyHashFullInitProto), StreamModule.Transform.@call(this, this._options), this[method];\n },\n enumerable: !1,\n configurable: !0\n });\n module.exports = function createHash(algorithm) {\n return new LazyHash(algorithm);\n }, module.exports.createHash = module.exports, module.exports.Hash = LazyHash;\n }\n}), require_legacy = __commonJS({\n \"node_modules/create-hmac/legacy.js\"(exports, module) {\n var inherits = require_inherits_browser(), Buffer2 = require_safe_buffer().Buffer, Base = require_cipher_base(), ZEROS = Buffer2.alloc(128), blocksize = 64;\n function Hmac(alg, key2) {\n key2 = exportIfKeyObject(key2), Base.@call(this, \"digest\"), typeof key2 == \"string\" && (key2 = Buffer2.from(key2)), this._alg = alg, this._key = key2, key2.length > blocksize \? key2 = alg(key2) : key2.length < blocksize && (key2 = Buffer2.concat([key2, ZEROS], blocksize));\n for (var ipad = this._ipad = Buffer2.allocUnsafe(blocksize), opad = this._opad = Buffer2.allocUnsafe(blocksize), i = 0;i < blocksize; i++)\n ipad[i] = key2[i] ^ 54, opad[i] = key2[i] ^ 92;\n this._hash = [ipad];\n }\n Hmac.prototype = {}, inherits(Hmac, Base), Hmac.prototype._update = function(data) {\n this._hash.push(data);\n }, Hmac.prototype._final = function() {\n var h = this._alg(Buffer2.concat(this._hash));\n return this._alg(Buffer2.concat([this._opad, h]));\n }, module.exports = Hmac;\n }\n}), require_md52 = __commonJS({\n \"node_modules/create-hash/md5.js\"(exports, module) {\n var MD5 = require_md5();\n module.exports = function(buffer) {\n return new MD5().update(buffer).digest();\n };\n }\n}), require_browser3 = __commonJS({\n \"node_modules/create-hmac/browser.js\"(exports, module) {\n var inherits = require_inherits_browser(), Legacy = require_legacy(), Base = require_cipher_base(), Buffer2 = require_safe_buffer().Buffer, md5 = require_md52(), RIPEMD160 = require_ripemd160(), sha = require_sha2(), ZEROS = Buffer2.alloc(128);\n function Hmac(alg, key2) {\n key2 = exportIfKeyObject(key2), Base.@call(this, \"digest\"), typeof key2 == \"string\" && (key2 = Buffer2.from(key2));\n var blocksize = alg === \"sha512\" || alg === \"sha384\" \? 128 : 64;\n if (this._alg = alg, this._key = key2, key2.length > blocksize) {\n var hash = alg === \"rmd160\" \? new RIPEMD160 : sha(alg);\n key2 = hash.update(key2).digest();\n } else\n key2.length < blocksize && (key2 = Buffer2.concat([key2, ZEROS], blocksize));\n for (var ipad = this._ipad = Buffer2.allocUnsafe(blocksize), opad = this._opad = Buffer2.allocUnsafe(blocksize), i = 0;i < blocksize; i++)\n ipad[i] = key2[i] ^ 54, opad[i] = key2[i] ^ 92;\n this._hash = alg === \"rmd160\" \? new RIPEMD160 : sha(alg), this._hash.update(ipad);\n }\n inherits(Hmac, Base), Hmac.prototype._update = function(data) {\n this._hash.update(data);\n }, Hmac.prototype._final = function() {\n var h = this._hash.digest(), hash = this._alg === \"rmd160\" \? new RIPEMD160 : sha(this._alg);\n return hash.update(this._opad).update(h).digest();\n }, module.exports = function(alg, key2) {\n return key2 = exportIfKeyObject(key2), alg = alg.toLowerCase(), alg === \"rmd160\" || alg === \"ripemd160\" \? new Hmac(\"rmd160\", key2) : alg === \"md5\" \? new Legacy(md5, key2) : new Hmac(alg, key2);\n };\n }\n}), require_algorithms = __commonJS({\n \"node_modules/browserify-sign/browser/algorithms.json\"(exports, module) {\n module.exports = {\n sha224WithRSAEncryption: {\n sign: \"rsa\",\n hash: \"sha224\",\n id: \"302d300d06096086480165030402040500041c\"\n },\n \"RSA-SHA224\": {\n sign: \"ecdsa/rsa\",\n hash: \"sha224\",\n id: \"302d300d06096086480165030402040500041c\"\n },\n sha256WithRSAEncryption: {\n sign: \"rsa\",\n hash: \"sha256\",\n id: \"3031300d060960864801650304020105000420\"\n },\n \"RSA-SHA256\": {\n sign: \"ecdsa/rsa\",\n hash: \"sha256\",\n id: \"3031300d060960864801650304020105000420\"\n },\n sha384WithRSAEncryption: {\n sign: \"rsa\",\n hash: \"sha384\",\n id: \"3041300d060960864801650304020205000430\"\n },\n \"RSA-SHA384\": {\n sign: \"ecdsa/rsa\",\n hash: \"sha384\",\n id: \"3041300d060960864801650304020205000430\"\n },\n sha512WithRSAEncryption: {\n sign: \"rsa\",\n hash: \"sha512\",\n id: \"3051300d060960864801650304020305000440\"\n },\n \"RSA-SHA512\": {\n sign: \"ecdsa/rsa\",\n hash: \"sha512\",\n id: \"3051300d060960864801650304020305000440\"\n },\n \"RSA-SHA1\": {\n sign: \"rsa\",\n hash: \"sha1\",\n id: \"3021300906052b0e03021a05000414\"\n },\n \"ecdsa-with-SHA1\": {\n sign: \"ecdsa\",\n hash: \"sha1\",\n id: \"\"\n },\n sha1: {\n sign: \"ecdsa/rsa\",\n hash: \"sha1\",\n id: \"\"\n },\n sha256: {\n sign: \"ecdsa/rsa\",\n hash: \"sha256\",\n id: \"\"\n },\n sha224: {\n sign: \"ecdsa/rsa\",\n hash: \"sha224\",\n id: \"\"\n },\n sha384: {\n sign: \"ecdsa/rsa\",\n hash: \"sha384\",\n id: \"\"\n },\n sha512: {\n sign: \"ecdsa/rsa\",\n hash: \"sha512\",\n id: \"\"\n },\n \"DSA-SHA\": {\n sign: \"dsa\",\n hash: \"sha1\",\n id: \"\"\n },\n \"DSA-SHA1\": {\n sign: \"dsa\",\n hash: \"sha1\",\n id: \"\"\n },\n DSA: {\n sign: \"dsa\",\n hash: \"sha1\",\n id: \"\"\n },\n \"DSA-WITH-SHA224\": {\n sign: \"dsa\",\n hash: \"sha224\",\n id: \"\"\n },\n \"DSA-SHA224\": {\n sign: \"dsa\",\n hash: \"sha224\",\n id: \"\"\n },\n \"DSA-WITH-SHA256\": {\n sign: \"dsa\",\n hash: \"sha256\",\n id: \"\"\n },\n \"DSA-SHA256\": {\n sign: \"dsa\",\n hash: \"sha256\",\n id: \"\"\n },\n \"DSA-WITH-SHA384\": {\n sign: \"dsa\",\n hash: \"sha384\",\n id: \"\"\n },\n \"DSA-SHA384\": {\n sign: \"dsa\",\n hash: \"sha384\",\n id: \"\"\n },\n \"DSA-WITH-SHA512\": {\n sign: \"dsa\",\n hash: \"sha512\",\n id: \"\"\n },\n \"DSA-SHA512\": {\n sign: \"dsa\",\n hash: \"sha512\",\n id: \"\"\n },\n \"DSA-RIPEMD160\": {\n sign: \"dsa\",\n hash: \"rmd160\",\n id: \"\"\n },\n ripemd160WithRSA: {\n sign: \"rsa\",\n hash: \"rmd160\",\n id: \"3021300906052b2403020105000414\"\n },\n \"RSA-RIPEMD160\": {\n sign: \"rsa\",\n hash: \"rmd160\",\n id: \"3021300906052b2403020105000414\"\n },\n md5WithRSAEncryption: {\n sign: \"rsa\",\n hash: \"md5\",\n id: \"3020300c06082a864886f70d020505000410\"\n },\n \"RSA-MD5\": {\n sign: \"rsa\",\n hash: \"md5\",\n id: \"3020300c06082a864886f70d020505000410\"\n }\n };\n }\n}), require_algos = __commonJS({\n \"node_modules/browserify-sign/algos.js\"(exports, module) {\n module.exports = require_algorithms();\n }\n}), require_precondition = __commonJS({\n \"node_modules/pbkdf2/lib/precondition.js\"(exports, module) {\n var MAX_ALLOC = Math.pow(2, 30) - 1;\n module.exports = function(iterations, keylen) {\n if (typeof iterations != \"number\")\n @throwTypeError(\"Iterations not a number\");\n if (iterations < 0)\n @throwTypeError(\"Bad iterations\");\n if (typeof keylen != \"number\")\n @throwTypeError(\"Key length not a number\");\n if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen)\n @throwTypeError(\"Bad key length\");\n };\n }\n}), require_default_encoding = __commonJS({\n \"node_modules/pbkdf2/lib/default-encoding.js\"(exports, module) {\n var defaultEncoding;\n global.process && global.process.browser \? defaultEncoding = \"utf-8\" : global.process && global.process.version \? (pVersionMajor = parseInt(process.version.split(\".\")[0].slice(1), 10), defaultEncoding = pVersionMajor >= 6 \? \"utf-8\" : \"binary\") : defaultEncoding = \"utf-8\";\n var pVersionMajor;\n module.exports = defaultEncoding;\n }\n}), require_to_buffer = __commonJS({\n \"node_modules/pbkdf2/lib/to-buffer.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer;\n module.exports = function(thing, encoding, name) {\n if (Buffer2.isBuffer(thing))\n return thing;\n if (typeof thing == \"string\")\n return Buffer2.from(thing, encoding);\n if (@ArrayBuffer.isView(thing))\n return Buffer2.from(thing.buffer);\n @throwTypeError(name + \" must be a string, a Buffer, a typed array or a DataView\");\n };\n }\n}), require_sync_browser = __commonJS({\n \"node_modules/pbkdf2/lib/sync-browser.js\"(exports, module) {\n var md5 = require_md52(), RIPEMD160 = require_ripemd160(), sha = require_sha2(), Buffer2 = require_safe_buffer().Buffer, checkParameters = require_precondition(), defaultEncoding = require_default_encoding(), toBuffer = require_to_buffer(), ZEROS = Buffer2.alloc(128), sizes = {\n md5: 16,\n sha1: 20,\n sha224: 28,\n sha256: 32,\n sha384: 48,\n sha512: 64,\n rmd160: 20,\n ripemd160: 20\n };\n function Hmac(alg, key2, saltLen) {\n key2 = exportIfKeyObject(key2);\n var hash = getDigest(alg), blocksize = alg === \"sha512\" || alg === \"sha384\" \? 128 : 64;\n key2.length > blocksize \? key2 = hash(key2) : key2.length < blocksize && (key2 = Buffer2.concat([key2, ZEROS], blocksize));\n for (var ipad = Buffer2.allocUnsafe(blocksize + sizes[alg]), opad = Buffer2.allocUnsafe(blocksize + sizes[alg]), i = 0;i < blocksize; i++)\n ipad[i] = key2[i] ^ 54, opad[i] = key2[i] ^ 92;\n var ipad1 = Buffer2.allocUnsafe(blocksize + saltLen + 4);\n ipad.copy(ipad1, 0, 0, blocksize), this.ipad1 = ipad1, this.ipad2 = ipad, this.opad = opad, this.alg = alg, this.blocksize = blocksize, this.hash = hash, this.size = sizes[alg];\n }\n Hmac.prototype = {}, Hmac.prototype.run = function(data, ipad) {\n data.copy(ipad, this.blocksize);\n var h = this.hash(ipad);\n return h.copy(this.opad, this.blocksize), this.hash(this.opad);\n };\n function getDigest(alg) {\n function shaFunc(data) {\n return sha(alg).update(data).digest();\n }\n function rmd160Func(data) {\n return new RIPEMD160().update(data).digest();\n }\n return alg === \"rmd160\" || alg === \"ripemd160\" \? rmd160Func : alg === \"md5\" \? md5 : shaFunc;\n }\n function pbkdf2(password, salt, iterations, keylen, digest) {\n checkParameters(iterations, keylen), password = toBuffer(password, defaultEncoding, \"Password\"), salt = toBuffer(salt, defaultEncoding, \"Salt\"), digest = digest || \"sha1\";\n var hmac = new Hmac(digest, password, salt.length), DK = Buffer2.allocUnsafe(keylen), block1 = Buffer2.allocUnsafe(salt.length + 4);\n salt.copy(block1, 0, 0, salt.length);\n for (var destPos = 0, hLen = sizes[digest], l = Math.ceil(keylen / hLen), i = 1;i <= l; i++) {\n block1.writeUInt32BE(i, salt.length);\n for (var T = hmac.run(block1, hmac.ipad1), U = T, j = 1;j < iterations; j++) {\n U = hmac.run(U, hmac.ipad2);\n for (var k = 0;k < hLen; k++)\n T[k] ^= U[k];\n }\n T.copy(DK, destPos), destPos += hLen;\n }\n return DK;\n }\n module.exports = pbkdf2;\n }\n}), require_async = __commonJS({\n \"node_modules/pbkdf2/lib/async.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer, checkParameters = require_precondition(), defaultEncoding = require_default_encoding(), sync = require_sync_browser(), toBuffer = require_to_buffer(), ZERO_BUF, subtle = globalCrypto.subtle, toBrowser = {\n sha: \"SHA-1\",\n \"sha-1\": \"SHA-1\",\n sha1: \"SHA-1\",\n sha256: \"SHA-256\",\n \"sha-256\": \"SHA-256\",\n sha384: \"SHA-384\",\n \"sha-384\": \"SHA-384\",\n \"sha-512\": \"SHA-512\",\n sha512: \"SHA-512\"\n }, checks = [];\n function checkNative(algo) {\n if (global.process && !global.process.browser || !subtle || !subtle.importKey || !subtle.deriveBits)\n return @Promise.resolve(!1);\n if (checks[algo] !== void 0)\n return checks[algo];\n ZERO_BUF = ZERO_BUF || Buffer2.alloc(8);\n var prom = browserPbkdf2(ZERO_BUF, ZERO_BUF, 10, 128, algo).then(function() {\n return !0;\n }).catch(function() {\n return !1;\n });\n return checks[algo] = prom, prom;\n }\n var nextTick;\n function getNextTick() {\n return nextTick || (global.process && global.process.nextTick \? nextTick = global.process.nextTick : global.queueMicrotask \? nextTick = global.queueMicrotask : global.setImmediate \? nextTick = global.setImmediate : nextTick = global.setTimeout, nextTick);\n }\n function browserPbkdf2(password, salt, iterations, length, algo) {\n return subtle.importKey(\"raw\", password, { name: \"PBKDF2\" }, !1, [\"deriveBits\"]).then(function(key2) {\n return subtle.deriveBits({\n name: \"PBKDF2\",\n salt,\n iterations,\n hash: {\n name: algo\n }\n }, key2, length << 3);\n }).then(function(res) {\n return Buffer2.from(res);\n });\n }\n function resolvePromise(promise, callback) {\n promise.then(function(out) {\n getNextTick()(function() {\n callback(null, out);\n });\n }, function(e) {\n getNextTick()(function() {\n callback(e);\n });\n });\n }\n module.exports = function(password, salt, iterations, keylen, digest, callback) {\n typeof digest == \"function\" && (callback = digest, digest = void 0), digest = digest || \"sha1\";\n var algo = toBrowser[digest.toLowerCase()];\n if (!algo || typeof global.Promise != \"function\") {\n getNextTick()(function() {\n var out;\n try {\n out = sync(password, salt, iterations, keylen, digest);\n } catch (e) {\n return callback(e);\n }\n callback(null, out);\n });\n return;\n }\n if (checkParameters(iterations, keylen), password = toBuffer(password, defaultEncoding, \"Password\"), salt = toBuffer(salt, defaultEncoding, \"Salt\"), typeof callback != \"function\")\n throw new Error(\"No callback provided to pbkdf2\");\n resolvePromise(checkNative(algo).then(function(resp) {\n return resp \? browserPbkdf2(password, salt, iterations, keylen, algo) : sync(password, salt, iterations, keylen, digest);\n }), callback);\n };\n }\n}), require_browser4 = __commonJS({\n \"node_modules/pbkdf2/browser.js\"(exports) {\n exports.pbkdf2 = require_async(), exports.pbkdf2Sync = require_sync_browser();\n }\n}), require_utils = __commonJS({\n \"node_modules/des.js/lib/des/utils.js\"(exports) {\n exports.readUInt32BE = function(bytes, off) {\n var res = bytes[0 + off] << 24 | bytes[1 + off] << 16 | bytes[2 + off] << 8 | bytes[3 + off];\n return res >>> 0;\n }, exports.writeUInt32BE = function(bytes, value, off) {\n bytes[0 + off] = value >>> 24, bytes[1 + off] = value >>> 16 & 255, bytes[2 + off] = value >>> 8 & 255, bytes[3 + off] = value & 255;\n }, exports.ip = function(inL, inR, out, off) {\n for (var outL = 0, outR = 0, i = 6;i >= 0; i -= 2) {\n for (var j = 0;j <= 24; j += 8)\n outL <<= 1, outL |= inR >>> j + i & 1;\n for (var j = 0;j <= 24; j += 8)\n outL <<= 1, outL |= inL >>> j + i & 1;\n }\n for (var i = 6;i >= 0; i -= 2) {\n for (var j = 1;j <= 25; j += 8)\n outR <<= 1, outR |= inR >>> j + i & 1;\n for (var j = 1;j <= 25; j += 8)\n outR <<= 1, outR |= inL >>> j + i & 1;\n }\n out[off + 0] = outL >>> 0, out[off + 1] = outR >>> 0;\n }, exports.rip = function(inL, inR, out, off) {\n for (var outL = 0, outR = 0, i = 0;i < 4; i++)\n for (var j = 24;j >= 0; j -= 8)\n outL <<= 1, outL |= inR >>> j + i & 1, outL <<= 1, outL |= inL >>> j + i & 1;\n for (var i = 4;i < 8; i++)\n for (var j = 24;j >= 0; j -= 8)\n outR <<= 1, outR |= inR >>> j + i & 1, outR <<= 1, outR |= inL >>> j + i & 1;\n out[off + 0] = outL >>> 0, out[off + 1] = outR >>> 0;\n }, exports.pc1 = function(inL, inR, out, off) {\n for (var outL = 0, outR = 0, i = 7;i >= 5; i--) {\n for (var j = 0;j <= 24; j += 8)\n outL <<= 1, outL |= inR >> j + i & 1;\n for (var j = 0;j <= 24; j += 8)\n outL <<= 1, outL |= inL >> j + i & 1;\n }\n for (var j = 0;j <= 24; j += 8)\n outL <<= 1, outL |= inR >> j + i & 1;\n for (var i = 1;i <= 3; i++) {\n for (var j = 0;j <= 24; j += 8)\n outR <<= 1, outR |= inR >> j + i & 1;\n for (var j = 0;j <= 24; j += 8)\n outR <<= 1, outR |= inL >> j + i & 1;\n }\n for (var j = 0;j <= 24; j += 8)\n outR <<= 1, outR |= inL >> j + i & 1;\n out[off + 0] = outL >>> 0, out[off + 1] = outR >>> 0;\n }, exports.r28shl = function(num, shift) {\n return num << shift & 268435455 | num >>> 28 - shift;\n };\n var pc2table = [\n 14,\n 11,\n 17,\n 4,\n 27,\n 23,\n 25,\n 0,\n 13,\n 22,\n 7,\n 18,\n 5,\n 9,\n 16,\n 24,\n 2,\n 20,\n 12,\n 21,\n 1,\n 8,\n 15,\n 26,\n 15,\n 4,\n 25,\n 19,\n 9,\n 1,\n 26,\n 16,\n 5,\n 11,\n 23,\n 8,\n 12,\n 7,\n 17,\n 0,\n 22,\n 3,\n 10,\n 14,\n 6,\n 20,\n 27,\n 24\n ];\n exports.pc2 = function(inL, inR, out, off) {\n for (var outL = 0, outR = 0, len = pc2table.length >>> 1, i = 0;i < len; i++)\n outL <<= 1, outL |= inL >>> pc2table[i] & 1;\n for (var i = len;i < pc2table.length; i++)\n outR <<= 1, outR |= inR >>> pc2table[i] & 1;\n out[off + 0] = outL >>> 0, out[off + 1] = outR >>> 0;\n }, exports.expand = function(r, out, off) {\n var outL = 0, outR = 0;\n outL = (r & 1) << 5 | r >>> 27;\n for (var i = 23;i >= 15; i -= 4)\n outL <<= 6, outL |= r >>> i & 63;\n for (var i = 11;i >= 3; i -= 4)\n outR |= r >>> i & 63, outR <<= 6;\n outR |= (r & 31) << 1 | r >>> 31, out[off + 0] = outL >>> 0, out[off + 1] = outR >>> 0;\n };\n var sTable = [\n 14,\n 0,\n 4,\n 15,\n 13,\n 7,\n 1,\n 4,\n 2,\n 14,\n 15,\n 2,\n 11,\n 13,\n 8,\n 1,\n 3,\n 10,\n 10,\n 6,\n 6,\n 12,\n 12,\n 11,\n 5,\n 9,\n 9,\n 5,\n 0,\n 3,\n 7,\n 8,\n 4,\n 15,\n 1,\n 12,\n 14,\n 8,\n 8,\n 2,\n 13,\n 4,\n 6,\n 9,\n 2,\n 1,\n 11,\n 7,\n 15,\n 5,\n 12,\n 11,\n 9,\n 3,\n 7,\n 14,\n 3,\n 10,\n 10,\n 0,\n 5,\n 6,\n 0,\n 13,\n 15,\n 3,\n 1,\n 13,\n 8,\n 4,\n 14,\n 7,\n 6,\n 15,\n 11,\n 2,\n 3,\n 8,\n 4,\n 14,\n 9,\n 12,\n 7,\n 0,\n 2,\n 1,\n 13,\n 10,\n 12,\n 6,\n 0,\n 9,\n 5,\n 11,\n 10,\n 5,\n 0,\n 13,\n 14,\n 8,\n 7,\n 10,\n 11,\n 1,\n 10,\n 3,\n 4,\n 15,\n 13,\n 4,\n 1,\n 2,\n 5,\n 11,\n 8,\n 6,\n 12,\n 7,\n 6,\n 12,\n 9,\n 0,\n 3,\n 5,\n 2,\n 14,\n 15,\n 9,\n 10,\n 13,\n 0,\n 7,\n 9,\n 0,\n 14,\n 9,\n 6,\n 3,\n 3,\n 4,\n 15,\n 6,\n 5,\n 10,\n 1,\n 2,\n 13,\n 8,\n 12,\n 5,\n 7,\n 14,\n 11,\n 12,\n 4,\n 11,\n 2,\n 15,\n 8,\n 1,\n 13,\n 1,\n 6,\n 10,\n 4,\n 13,\n 9,\n 0,\n 8,\n 6,\n 15,\n 9,\n 3,\n 8,\n 0,\n 7,\n 11,\n 4,\n 1,\n 15,\n 2,\n 14,\n 12,\n 3,\n 5,\n 11,\n 10,\n 5,\n 14,\n 2,\n 7,\n 12,\n 7,\n 13,\n 13,\n 8,\n 14,\n 11,\n 3,\n 5,\n 0,\n 6,\n 6,\n 15,\n 9,\n 0,\n 10,\n 3,\n 1,\n 4,\n 2,\n 7,\n 8,\n 2,\n 5,\n 12,\n 11,\n 1,\n 12,\n 10,\n 4,\n 14,\n 15,\n 9,\n 10,\n 3,\n 6,\n 15,\n 9,\n 0,\n 0,\n 6,\n 12,\n 10,\n 11,\n 1,\n 7,\n 13,\n 13,\n 8,\n 15,\n 9,\n 1,\n 4,\n 3,\n 5,\n 14,\n 11,\n 5,\n 12,\n 2,\n 7,\n 8,\n 2,\n 4,\n 14,\n 2,\n 14,\n 12,\n 11,\n 4,\n 2,\n 1,\n 12,\n 7,\n 4,\n 10,\n 7,\n 11,\n 13,\n 6,\n 1,\n 8,\n 5,\n 5,\n 0,\n 3,\n 15,\n 15,\n 10,\n 13,\n 3,\n 0,\n 9,\n 14,\n 8,\n 9,\n 6,\n 4,\n 11,\n 2,\n 8,\n 1,\n 12,\n 11,\n 7,\n 10,\n 1,\n 13,\n 14,\n 7,\n 2,\n 8,\n 13,\n 15,\n 6,\n 9,\n 15,\n 12,\n 0,\n 5,\n 9,\n 6,\n 10,\n 3,\n 4,\n 0,\n 5,\n 14,\n 3,\n 12,\n 10,\n 1,\n 15,\n 10,\n 4,\n 15,\n 2,\n 9,\n 7,\n 2,\n 12,\n 6,\n 9,\n 8,\n 5,\n 0,\n 6,\n 13,\n 1,\n 3,\n 13,\n 4,\n 14,\n 14,\n 0,\n 7,\n 11,\n 5,\n 3,\n 11,\n 8,\n 9,\n 4,\n 14,\n 3,\n 15,\n 2,\n 5,\n 12,\n 2,\n 9,\n 8,\n 5,\n 12,\n 15,\n 3,\n 10,\n 7,\n 11,\n 0,\n 14,\n 4,\n 1,\n 10,\n 7,\n 1,\n 6,\n 13,\n 0,\n 11,\n 8,\n 6,\n 13,\n 4,\n 13,\n 11,\n 0,\n 2,\n 11,\n 14,\n 7,\n 15,\n 4,\n 0,\n 9,\n 8,\n 1,\n 13,\n 10,\n 3,\n 14,\n 12,\n 3,\n 9,\n 5,\n 7,\n 12,\n 5,\n 2,\n 10,\n 15,\n 6,\n 8,\n 1,\n 6,\n 1,\n 6,\n 4,\n 11,\n 11,\n 13,\n 13,\n 8,\n 12,\n 1,\n 3,\n 4,\n 7,\n 10,\n 14,\n 7,\n 10,\n 9,\n 15,\n 5,\n 6,\n 0,\n 8,\n 15,\n 0,\n 14,\n 5,\n 2,\n 9,\n 3,\n 2,\n 12,\n 13,\n 1,\n 2,\n 15,\n 8,\n 13,\n 4,\n 8,\n 6,\n 10,\n 15,\n 3,\n 11,\n 7,\n 1,\n 4,\n 10,\n 12,\n 9,\n 5,\n 3,\n 6,\n 14,\n 11,\n 5,\n 0,\n 0,\n 14,\n 12,\n 9,\n 7,\n 2,\n 7,\n 2,\n 11,\n 1,\n 4,\n 14,\n 1,\n 7,\n 9,\n 4,\n 12,\n 10,\n 14,\n 8,\n 2,\n 13,\n 0,\n 15,\n 6,\n 12,\n 10,\n 9,\n 13,\n 0,\n 15,\n 3,\n 3,\n 5,\n 5,\n 6,\n 8,\n 11\n ];\n exports.substitute = function(inL, inR) {\n for (var out = 0, i = 0;i < 4; i++) {\n var b = inL >>> 18 - i * 6 & 63, sb = sTable[i * 64 + b];\n out <<= 4, out |= sb;\n }\n for (var i = 0;i < 4; i++) {\n var b = inR >>> 18 - i * 6 & 63, sb = sTable[256 + i * 64 + b];\n out <<= 4, out |= sb;\n }\n return out >>> 0;\n };\n var permuteTable = [\n 16,\n 25,\n 12,\n 11,\n 3,\n 20,\n 4,\n 15,\n 31,\n 17,\n 9,\n 6,\n 27,\n 14,\n 1,\n 22,\n 30,\n 24,\n 8,\n 18,\n 0,\n 5,\n 29,\n 23,\n 13,\n 19,\n 2,\n 26,\n 10,\n 21,\n 28,\n 7\n ];\n exports.permute = function(num) {\n for (var out = 0, i = 0;i < permuteTable.length; i++)\n out <<= 1, out |= num >>> permuteTable[i] & 1;\n return out >>> 0;\n }, exports.padSplit = function(num, size, group) {\n for (var str = num.toString(2);str.length < size; )\n str = \"0\" + str;\n for (var out = [], i = 0;i < size; i += group)\n out.push(str.slice(i, i + group));\n return out.join(\" \");\n };\n }\n}), require_minimalistic_assert = __commonJS({\n \"node_modules/minimalistic-assert/index.js\"(exports, module) {\n module.exports = assert;\n function assert(val, msg) {\n if (!val)\n throw new Error(msg || \"Assertion failed\");\n }\n assert.equal = function(l, r, msg) {\n if (l != r)\n throw new Error(msg || \"Assertion failed: \" + l + \" != \" + r);\n };\n }\n}), require_cipher = __commonJS({\n \"node_modules/des.js/lib/des/cipher.js\"(exports, module) {\n var assert = require_minimalistic_assert();\n function Cipher(options) {\n this.options = options, this.type = this.options.type, this.blockSize = 8, this._init(), this.buffer = new @Array(this.blockSize), this.bufferOff = 0;\n }\n Cipher.prototype = {}, module.exports = Cipher, Cipher.prototype._init = function() {\n }, Cipher.prototype.update = function(data) {\n return data.length === 0 \? [] : this.type === \"decrypt\" \? this._updateDecrypt(data) : this._updateEncrypt(data);\n }, Cipher.prototype._buffer = function(data, off) {\n for (var min = Math.min(this.buffer.length - this.bufferOff, data.length - off), i = 0;i < min; i++)\n this.buffer[this.bufferOff + i] = data[off + i];\n return this.bufferOff += min, min;\n }, Cipher.prototype._flushBuffer = function(out, off) {\n return this._update(this.buffer, 0, out, off), this.bufferOff = 0, this.blockSize;\n }, Cipher.prototype._updateEncrypt = function(data) {\n var inputOff = 0, outputOff = 0, count = (this.bufferOff + data.length) / this.blockSize | 0, out = new @Array(count * this.blockSize);\n this.bufferOff !== 0 && (inputOff += this._buffer(data, inputOff), this.bufferOff === this.buffer.length && (outputOff += this._flushBuffer(out, outputOff)));\n for (var max = data.length - (data.length - inputOff) % this.blockSize;inputOff < max; inputOff += this.blockSize)\n this._update(data, inputOff, out, outputOff), outputOff += this.blockSize;\n for (;inputOff < data.length; inputOff++, this.bufferOff++)\n this.buffer[this.bufferOff] = data[inputOff];\n return out;\n }, Cipher.prototype._updateDecrypt = function(data) {\n for (var inputOff = 0, outputOff = 0, count = Math.ceil((this.bufferOff + data.length) / this.blockSize) - 1, out = new @Array(count * this.blockSize);count > 0; count--)\n inputOff += this._buffer(data, inputOff), outputOff += this._flushBuffer(out, outputOff);\n return inputOff += this._buffer(data, inputOff), out;\n }, Cipher.prototype.final = function(buffer) {\n var first;\n buffer && (first = this.update(buffer));\n var last;\n return this.type === \"encrypt\" \? last = this._finalEncrypt() : last = this._finalDecrypt(), first \? first.concat(last) : last;\n }, Cipher.prototype._pad = function(buffer, off) {\n if (off === 0)\n return !1;\n for (;off < buffer.length; )\n buffer[off++] = 0;\n return !0;\n }, Cipher.prototype._finalEncrypt = function() {\n if (!this._pad(this.buffer, this.bufferOff))\n return [];\n var out = new @Array(this.blockSize);\n return this._update(this.buffer, 0, out, 0), out;\n }, Cipher.prototype._unpad = function(buffer) {\n return buffer;\n }, Cipher.prototype._finalDecrypt = function() {\n assert.equal(this.bufferOff, this.blockSize, \"Not enough data to decrypt\");\n var out = new @Array(this.blockSize);\n return this._flushBuffer(out, 0), this._unpad(out);\n };\n }\n}), require_des = __commonJS({\n \"node_modules/des.js/lib/des/des.js\"(exports, module) {\n var assert = require_minimalistic_assert(), inherits = require_inherits_browser(), utils = require_utils(), Cipher = require_cipher();\n function DESState() {\n this.tmp = new @Array(2), this.keys = null;\n }\n function DES(options) {\n Cipher.@call(this, options);\n var state = new DESState;\n this._desState = state, this.deriveKeys(state, options.key);\n }\n inherits(DES, Cipher), module.exports = DES, DES.create = function(options) {\n return new DES(options);\n };\n var shiftTable = [1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1];\n DES.prototype.deriveKeys = function(state, key2) {\n state.keys = new @Array(32), assert.equal(key2.length, this.blockSize, \"Invalid key length\");\n var kL = utils.readUInt32BE(key2, 0), kR = utils.readUInt32BE(key2, 4);\n utils.pc1(kL, kR, state.tmp, 0), kL = state.tmp[0], kR = state.tmp[1];\n for (var i = 0;i < state.keys.length; i += 2) {\n var shift = shiftTable[i >>> 1];\n kL = utils.r28shl(kL, shift), kR = utils.r28shl(kR, shift), utils.pc2(kL, kR, state.keys, i);\n }\n }, DES.prototype._update = function(inp, inOff, out, outOff) {\n var state = this._desState, l = utils.readUInt32BE(inp, inOff), r = utils.readUInt32BE(inp, inOff + 4);\n utils.ip(l, r, state.tmp, 0), l = state.tmp[0], r = state.tmp[1], this.type === \"encrypt\" \? this._encrypt(state, l, r, state.tmp, 0) : this._decrypt(state, l, r, state.tmp, 0), l = state.tmp[0], r = state.tmp[1], utils.writeUInt32BE(out, l, outOff), utils.writeUInt32BE(out, r, outOff + 4);\n }, DES.prototype._pad = function(buffer, off) {\n for (var value = buffer.length - off, i = off;i < buffer.length; i++)\n buffer[i] = value;\n return !0;\n }, DES.prototype._unpad = function(buffer) {\n for (var pad = buffer[buffer.length - 1], i = buffer.length - pad;i < buffer.length; i++)\n assert.equal(buffer[i], pad);\n return buffer.slice(0, buffer.length - pad);\n }, DES.prototype._encrypt = function(state, lStart, rStart, out, off) {\n for (var l = lStart, r = rStart, i = 0;i < state.keys.length; i += 2) {\n var keyL = state.keys[i], keyR = state.keys[i + 1];\n utils.expand(r, state.tmp, 0), keyL ^= state.tmp[0], keyR ^= state.tmp[1];\n var s = utils.substitute(keyL, keyR), f = utils.permute(s), t = r;\n r = (l ^ f) >>> 0, l = t;\n }\n utils.rip(r, l, out, off);\n }, DES.prototype._decrypt = function(state, lStart, rStart, out, off) {\n for (var l = rStart, r = lStart, i = state.keys.length - 2;i >= 0; i -= 2) {\n var keyL = state.keys[i], keyR = state.keys[i + 1];\n utils.expand(l, state.tmp, 0), keyL ^= state.tmp[0], keyR ^= state.tmp[1];\n var s = utils.substitute(keyL, keyR), f = utils.permute(s), t = l;\n l = (r ^ f) >>> 0, r = t;\n }\n utils.rip(l, r, out, off);\n };\n }\n}), require_cbc = __commonJS({\n \"node_modules/des.js/lib/des/cbc.js\"(exports) {\n var assert = require_minimalistic_assert(), inherits = require_inherits_browser(), proto = {};\n function CBCState(iv) {\n assert.equal(iv.length, 8, \"Invalid IV length\"), this.iv = new @Array(8);\n for (var i = 0;i < this.iv.length; i++)\n this.iv[i] = iv[i];\n }\n function instantiate(Base) {\n function CBC(options) {\n Base.@call(this, options), this._cbcInit();\n }\n inherits(CBC, Base);\n for (var keys = Object.keys(proto), i = 0;i < keys.length; i++) {\n var key2 = keys[i];\n CBC.prototype[key2] = proto[key2];\n }\n return CBC.create = function(options) {\n return new CBC(options);\n }, CBC;\n }\n exports.instantiate = instantiate, proto._cbcInit = function() {\n var state = new CBCState(this.options.iv);\n this._cbcState = state;\n }, proto._update = function(inp, inOff, out, outOff) {\n var state = this._cbcState, superProto = this.constructor.super_.prototype, iv = state.iv;\n if (this.type === \"encrypt\") {\n for (var i = 0;i < this.blockSize; i++)\n iv[i] ^= inp[inOff + i];\n superProto._update.@call(this, iv, 0, out, outOff);\n for (var i = 0;i < this.blockSize; i++)\n iv[i] = out[outOff + i];\n } else {\n superProto._update.@call(this, inp, inOff, out, outOff);\n for (var i = 0;i < this.blockSize; i++)\n out[outOff + i] ^= iv[i];\n for (var i = 0;i < this.blockSize; i++)\n iv[i] = inp[inOff + i];\n }\n };\n }\n}), require_ede = __commonJS({\n \"node_modules/des.js/lib/des/ede.js\"(exports, module) {\n var assert = require_minimalistic_assert(), inherits = require_inherits_browser(), Cipher = require_cipher(), DES = require_des();\n function EDEState(type, key2) {\n assert.equal(key2.length, 24, \"Invalid key length\");\n var k1 = key2.slice(0, 8), k2 = key2.slice(8, 16), k3 = key2.slice(16, 24);\n type === \"encrypt\" \? this.ciphers = [\n DES.create({ type: \"encrypt\", key: k1 }),\n DES.create({ type: \"decrypt\", key: k2 }),\n DES.create({ type: \"encrypt\", key: k3 })\n ] : this.ciphers = [\n DES.create({ type: \"decrypt\", key: k3 }),\n DES.create({ type: \"encrypt\", key: k2 }),\n DES.create({ type: \"decrypt\", key: k1 })\n ];\n }\n function EDE(options) {\n Cipher.@call(this, options);\n var state = new EDEState(this.type, this.options.key);\n this._edeState = state;\n }\n inherits(EDE, Cipher), module.exports = EDE, EDE.create = function(options) {\n return new EDE(options);\n }, EDE.prototype._update = function(inp, inOff, out, outOff) {\n var state = this._edeState;\n state.ciphers[0]._update(inp, inOff, out, outOff), state.ciphers[1]._update(out, outOff, out, outOff), state.ciphers[2]._update(out, outOff, out, outOff);\n }, EDE.prototype._pad = DES.prototype._pad, EDE.prototype._unpad = DES.prototype._unpad;\n }\n}), require_des2 = __commonJS({\n \"node_modules/des.js/lib/des.js\"(exports) {\n exports.utils = require_utils(), exports.Cipher = require_cipher(), exports.DES = require_des(), exports.CBC = require_cbc(), exports.EDE = require_ede();\n }\n}), require_browserify_des = __commonJS({\n \"node_modules/browserify-des/index.js\"(exports, module) {\n var CipherBase = require_cipher_base(), des = require_des2(), inherits = require_inherits_browser(), Buffer2 = require_safe_buffer().Buffer, modes = {\n \"des-ede3-cbc\": des.CBC.instantiate(des.EDE),\n \"des-ede3\": des.EDE,\n \"des-ede-cbc\": des.CBC.instantiate(des.EDE),\n \"des-ede\": des.EDE,\n \"des-cbc\": des.CBC.instantiate(des.DES),\n \"des-ecb\": des.DES\n };\n modes.des = modes[\"des-cbc\"], modes.des3 = modes[\"des-ede3-cbc\"], module.exports = DES, inherits(DES, CipherBase);\n function DES(opts) {\n CipherBase.@call(this);\n var modeName = opts.mode.toLowerCase(), mode = modes[modeName], type;\n opts.decrypt \? type = \"decrypt\" : type = \"encrypt\";\n var key2 = opts.key;\n Buffer2.isBuffer(key2) || (key2 = Buffer2.from(key2)), (modeName === \"des-ede\" || modeName === \"des-ede-cbc\") && (key2 = Buffer2.concat([key2, key2.slice(0, 8)]));\n var iv = opts.iv;\n Buffer2.isBuffer(iv) || (iv = Buffer2.from(iv)), this._des = mode.create({\n key: key2,\n iv,\n type\n });\n }\n DES.prototype._update = function(data) {\n return Buffer2.from(this._des.update(data));\n }, DES.prototype._final = function() {\n return Buffer2.from(this._des.final());\n };\n }\n}), require_ecb = __commonJS({\n \"node_modules/browserify-aes/modes/ecb.js\"(exports) {\n exports.encrypt = function(self2, block) {\n return self2._cipher.encryptBlock(block);\n }, exports.decrypt = function(self2, block) {\n return self2._cipher.decryptBlock(block);\n };\n }\n}), require_buffer_xor = __commonJS({\n \"node_modules/buffer-xor/index.js\"(exports, module) {\n module.exports = function(a, b) {\n for (var length = Math.min(a.length, b.length), buffer = new Buffer(length), i = 0;i < length; ++i)\n buffer[i] = a[i] ^ b[i];\n return buffer;\n };\n }\n}), require_cbc2 = __commonJS({\n \"node_modules/browserify-aes/modes/cbc.js\"(exports) {\n var xor = require_buffer_xor();\n exports.encrypt = function(self2, block) {\n var data = xor(block, self2._prev);\n return self2._prev = self2._cipher.encryptBlock(data), self2._prev;\n }, exports.decrypt = function(self2, block) {\n var pad = self2._prev;\n self2._prev = block;\n var out = self2._cipher.decryptBlock(block);\n return xor(out, pad);\n };\n }\n}), require_cfb = __commonJS({\n \"node_modules/browserify-aes/modes/cfb.js\"(exports) {\n var Buffer2 = require_safe_buffer().Buffer, xor = require_buffer_xor();\n function encryptStart(self2, data, decrypt) {\n var len = data.length, out = xor(data, self2._cache);\n return self2._cache = self2._cache.slice(len), self2._prev = Buffer2.concat([self2._prev, decrypt \? data : out]), out;\n }\n exports.encrypt = function(self2, data, decrypt) {\n for (var out = Buffer2.allocUnsafe(0), len;data.length; )\n if (self2._cache.length === 0 && (self2._cache = self2._cipher.encryptBlock(self2._prev), self2._prev = Buffer2.allocUnsafe(0)), self2._cache.length <= data.length)\n len = self2._cache.length, out = Buffer2.concat([out, encryptStart(self2, data.slice(0, len), decrypt)]), data = data.slice(len);\n else {\n out = Buffer2.concat([out, encryptStart(self2, data, decrypt)]);\n break;\n }\n return out;\n };\n }\n}), require_cfb8 = __commonJS({\n \"node_modules/browserify-aes/modes/cfb8.js\"(exports) {\n var Buffer2 = require_safe_buffer().Buffer;\n function encryptByte(self2, byteParam, decrypt) {\n var pad = self2._cipher.encryptBlock(self2._prev), out = pad[0] ^ byteParam;\n return self2._prev = Buffer2.concat([self2._prev.slice(1), Buffer2.from([decrypt \? byteParam : out])]), out;\n }\n exports.encrypt = function(self2, chunk, decrypt) {\n for (var len = chunk.length, out = Buffer2.allocUnsafe(len), i = -1;++i < len; )\n out[i] = encryptByte(self2, chunk[i], decrypt);\n return out;\n };\n }\n}), require_cfb1 = __commonJS({\n \"node_modules/browserify-aes/modes/cfb1.js\"(exports) {\n var Buffer2 = require_safe_buffer().Buffer;\n function encryptByte(self2, byteParam, decrypt) {\n for (var pad, i = -1, len = 8, out = 0, bit, value;++i < len; )\n pad = self2._cipher.encryptBlock(self2._prev), bit = byteParam & 1 << 7 - i \? 128 : 0, value = pad[0] ^ bit, out += (value & 128) >> i % 8, self2._prev = shiftIn(self2._prev, decrypt \? bit : value);\n return out;\n }\n function shiftIn(buffer, value) {\n var len = buffer.length, i = -1, out = Buffer2.allocUnsafe(buffer.length);\n for (buffer = Buffer2.concat([buffer, Buffer2.from([value])]);++i < len; )\n out[i] = buffer[i] << 1 | buffer[i + 1] >> 7;\n return out;\n }\n exports.encrypt = function(self2, chunk, decrypt) {\n for (var len = chunk.length, out = Buffer2.allocUnsafe(len), i = -1;++i < len; )\n out[i] = encryptByte(self2, chunk[i], decrypt);\n return out;\n };\n }\n}), require_ofb = __commonJS({\n \"node_modules/browserify-aes/modes/ofb.js\"(exports) {\n var xor = require_buffer_xor();\n function getBlock(self2) {\n return self2._prev = self2._cipher.encryptBlock(self2._prev), self2._prev;\n }\n exports.encrypt = function(self2, chunk) {\n for (;self2._cache.length < chunk.length; )\n self2._cache = Buffer.concat([self2._cache, getBlock(self2)]);\n var pad = self2._cache.slice(0, chunk.length);\n return self2._cache = self2._cache.slice(chunk.length), xor(chunk, pad);\n };\n }\n}), require_incr32 = __commonJS({\n \"node_modules/browserify-aes/incr32.js\"(exports, module) {\n function incr32(iv) {\n for (var len = iv.length, item;len--; )\n if (item = iv.readUInt8(len), item === 255)\n iv.writeUInt8(0, len);\n else {\n item++, iv.writeUInt8(item, len);\n break;\n }\n }\n module.exports = incr32;\n }\n}), require_ctr = __commonJS({\n \"node_modules/browserify-aes/modes/ctr.js\"(exports) {\n var xor = require_buffer_xor(), Buffer2 = require_safe_buffer().Buffer, incr32 = require_incr32();\n function getBlock(self2) {\n var out = self2._cipher.encryptBlockRaw(self2._prev);\n return incr32(self2._prev), out;\n }\n var blockSize = 16;\n exports.encrypt = function(self2, chunk) {\n var chunkNum = Math.ceil(chunk.length / blockSize), start = self2._cache.length;\n self2._cache = Buffer2.concat([self2._cache, Buffer2.allocUnsafe(chunkNum * blockSize)]);\n for (var i = 0;i < chunkNum; i++) {\n var out = getBlock(self2), offset = start + i * blockSize;\n self2._cache.writeUInt32BE(out[0], offset + 0), self2._cache.writeUInt32BE(out[1], offset + 4), self2._cache.writeUInt32BE(out[2], offset + 8), self2._cache.writeUInt32BE(out[3], offset + 12);\n }\n var pad = self2._cache.slice(0, chunk.length);\n return self2._cache = self2._cache.slice(chunk.length), xor(chunk, pad);\n };\n }\n}), require_list = __commonJS({\n \"node_modules/browserify-aes/modes/list.json\"(exports, module) {\n module.exports = {\n \"aes-128-ecb\": {\n cipher: \"AES\",\n key: 128,\n iv: 0,\n mode: \"ECB\",\n type: \"block\"\n },\n \"aes-192-ecb\": {\n cipher: \"AES\",\n key: 192,\n iv: 0,\n mode: \"ECB\",\n type: \"block\"\n },\n \"aes-256-ecb\": {\n cipher: \"AES\",\n key: 256,\n iv: 0,\n mode: \"ECB\",\n type: \"block\"\n },\n \"aes-128-cbc\": {\n cipher: \"AES\",\n key: 128,\n iv: 16,\n mode: \"CBC\",\n type: \"block\"\n },\n \"aes-192-cbc\": {\n cipher: \"AES\",\n key: 192,\n iv: 16,\n mode: \"CBC\",\n type: \"block\"\n },\n \"aes-256-cbc\": {\n cipher: \"AES\",\n key: 256,\n iv: 16,\n mode: \"CBC\",\n type: \"block\"\n },\n aes128: {\n cipher: \"AES\",\n key: 128,\n iv: 16,\n mode: \"CBC\",\n type: \"block\"\n },\n aes192: {\n cipher: \"AES\",\n key: 192,\n iv: 16,\n mode: \"CBC\",\n type: \"block\"\n },\n aes256: {\n cipher: \"AES\",\n key: 256,\n iv: 16,\n mode: \"CBC\",\n type: \"block\"\n },\n \"aes-128-cfb\": {\n cipher: \"AES\",\n key: 128,\n iv: 16,\n mode: \"CFB\",\n type: \"stream\"\n },\n \"aes-192-cfb\": {\n cipher: \"AES\",\n key: 192,\n iv: 16,\n mode: \"CFB\",\n type: \"stream\"\n },\n \"aes-256-cfb\": {\n cipher: \"AES\",\n key: 256,\n iv: 16,\n mode: \"CFB\",\n type: \"stream\"\n },\n \"aes-128-cfb8\": {\n cipher: \"AES\",\n key: 128,\n iv: 16,\n mode: \"CFB8\",\n type: \"stream\"\n },\n \"aes-192-cfb8\": {\n cipher: \"AES\",\n key: 192,\n iv: 16,\n mode: \"CFB8\",\n type: \"stream\"\n },\n \"aes-256-cfb8\": {\n cipher: \"AES\",\n key: 256,\n iv: 16,\n mode: \"CFB8\",\n type: \"stream\"\n },\n \"aes-128-cfb1\": {\n cipher: \"AES\",\n key: 128,\n iv: 16,\n mode: \"CFB1\",\n type: \"stream\"\n },\n \"aes-192-cfb1\": {\n cipher: \"AES\",\n key: 192,\n iv: 16,\n mode: \"CFB1\",\n type: \"stream\"\n },\n \"aes-256-cfb1\": {\n cipher: \"AES\",\n key: 256,\n iv: 16,\n mode: \"CFB1\",\n type: \"stream\"\n },\n \"aes-128-ofb\": {\n cipher: \"AES\",\n key: 128,\n iv: 16,\n mode: \"OFB\",\n type: \"stream\"\n },\n \"aes-192-ofb\": {\n cipher: \"AES\",\n key: 192,\n iv: 16,\n mode: \"OFB\",\n type: \"stream\"\n },\n \"aes-256-ofb\": {\n cipher: \"AES\",\n key: 256,\n iv: 16,\n mode: \"OFB\",\n type: \"stream\"\n },\n \"aes-128-ctr\": {\n cipher: \"AES\",\n key: 128,\n iv: 16,\n mode: \"CTR\",\n type: \"stream\"\n },\n \"aes-192-ctr\": {\n cipher: \"AES\",\n key: 192,\n iv: 16,\n mode: \"CTR\",\n type: \"stream\"\n },\n \"aes-256-ctr\": {\n cipher: \"AES\",\n key: 256,\n iv: 16,\n mode: \"CTR\",\n type: \"stream\"\n },\n \"aes-128-gcm\": {\n cipher: \"AES\",\n key: 128,\n iv: 12,\n mode: \"GCM\",\n type: \"auth\"\n },\n \"aes-192-gcm\": {\n cipher: \"AES\",\n key: 192,\n iv: 12,\n mode: \"GCM\",\n type: \"auth\"\n },\n \"aes-256-gcm\": {\n cipher: \"AES\",\n key: 256,\n iv: 12,\n mode: \"GCM\",\n type: \"auth\"\n }\n };\n }\n}), require_modes = __commonJS({\n \"node_modules/browserify-aes/modes/index.js\"(exports, module) {\n var modeModules = {\n ECB: require_ecb(),\n CBC: require_cbc2(),\n CFB: require_cfb(),\n CFB8: require_cfb8(),\n CFB1: require_cfb1(),\n OFB: require_ofb(),\n CTR: require_ctr(),\n GCM: require_ctr()\n }, modes = require_list();\n for (key2 in modes)\n modes[key2].module = modeModules[modes[key2].mode];\n var key2;\n module.exports = modes;\n }\n}), require_aes = __commonJS({\n \"node_modules/browserify-aes/aes.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer;\n function asUInt32Array(buf) {\n if (buf instanceof KeyObject)\n buf = buf.export();\n else if (buf instanceof CryptoKey)\n buf = KeyObject.from(buf).export();\n Buffer2.isBuffer(buf) || (buf = Buffer2.from(buf));\n for (var len = buf.length / 4 | 0, out = new @Array(len), i = 0;i < len; i++)\n out[i] = buf.readUInt32BE(i * 4);\n return out;\n }\n function scrubVec(v) {\n for (var i = 0;i < v.length; v++)\n v[i] = 0;\n }\n function cryptBlock(M, keySchedule, SUB_MIX, SBOX, nRounds) {\n for (var SUB_MIX0 = SUB_MIX[0], SUB_MIX1 = SUB_MIX[1], SUB_MIX2 = SUB_MIX[2], SUB_MIX3 = SUB_MIX[3], s0 = M[0] ^ keySchedule[0], s1 = M[1] ^ keySchedule[1], s2 = M[2] ^ keySchedule[2], s3 = M[3] ^ keySchedule[3], t0, t1, t2, t3, ksRow = 4, round = 1;round < nRounds; round++)\n t0 = SUB_MIX0[s0 >>> 24] ^ SUB_MIX1[s1 >>> 16 & 255] ^ SUB_MIX2[s2 >>> 8 & 255] ^ SUB_MIX3[s3 & 255] ^ keySchedule[ksRow++], t1 = SUB_MIX0[s1 >>> 24] ^ SUB_MIX1[s2 >>> 16 & 255] ^ SUB_MIX2[s3 >>> 8 & 255] ^ SUB_MIX3[s0 & 255] ^ keySchedule[ksRow++], t2 = SUB_MIX0[s2 >>> 24] ^ SUB_MIX1[s3 >>> 16 & 255] ^ SUB_MIX2[s0 >>> 8 & 255] ^ SUB_MIX3[s1 & 255] ^ keySchedule[ksRow++], t3 = SUB_MIX0[s3 >>> 24] ^ SUB_MIX1[s0 >>> 16 & 255] ^ SUB_MIX2[s1 >>> 8 & 255] ^ SUB_MIX3[s2 & 255] ^ keySchedule[ksRow++], s0 = t0, s1 = t1, s2 = t2, s3 = t3;\n return t0 = (SBOX[s0 >>> 24] << 24 | SBOX[s1 >>> 16 & 255] << 16 | SBOX[s2 >>> 8 & 255] << 8 | SBOX[s3 & 255]) ^ keySchedule[ksRow++], t1 = (SBOX[s1 >>> 24] << 24 | SBOX[s2 >>> 16 & 255] << 16 | SBOX[s3 >>> 8 & 255] << 8 | SBOX[s0 & 255]) ^ keySchedule[ksRow++], t2 = (SBOX[s2 >>> 24] << 24 | SBOX[s3 >>> 16 & 255] << 16 | SBOX[s0 >>> 8 & 255] << 8 | SBOX[s1 & 255]) ^ keySchedule[ksRow++], t3 = (SBOX[s3 >>> 24] << 24 | SBOX[s0 >>> 16 & 255] << 16 | SBOX[s1 >>> 8 & 255] << 8 | SBOX[s2 & 255]) ^ keySchedule[ksRow++], t0 = t0 >>> 0, t1 = t1 >>> 0, t2 = t2 >>> 0, t3 = t3 >>> 0, [t0, t1, t2, t3];\n }\n var RCON = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], G = function() {\n for (var d = new @Array(256), j = 0;j < 256; j++)\n j < 128 \? d[j] = j << 1 : d[j] = j << 1 ^ 283;\n for (var SBOX = [], INV_SBOX = [], SUB_MIX = [[], [], [], []], INV_SUB_MIX = [[], [], [], []], x = 0, xi = 0, i = 0;i < 256; ++i) {\n var sx = xi ^ xi << 1 ^ xi << 2 ^ xi << 3 ^ xi << 4;\n sx = sx >>> 8 ^ sx & 255 ^ 99, SBOX[x] = sx, INV_SBOX[sx] = x;\n var x2 = d[x], x4 = d[x2], x8 = d[x4], t = d[sx] * 257 ^ sx * 16843008;\n SUB_MIX[0][x] = t << 24 | t >>> 8, SUB_MIX[1][x] = t << 16 | t >>> 16, SUB_MIX[2][x] = t << 8 | t >>> 24, SUB_MIX[3][x] = t, t = x8 * 16843009 ^ x4 * 65537 ^ x2 * 257 ^ x * 16843008, INV_SUB_MIX[0][sx] = t << 24 | t >>> 8, INV_SUB_MIX[1][sx] = t << 16 | t >>> 16, INV_SUB_MIX[2][sx] = t << 8 | t >>> 24, INV_SUB_MIX[3][sx] = t, x === 0 \? x = xi = 1 : (x = x2 ^ d[d[d[x8 ^ x2]]], xi ^= d[d[xi]]);\n }\n return {\n SBOX,\n INV_SBOX,\n SUB_MIX,\n INV_SUB_MIX\n };\n }();\n function AES(key2) {\n this._key = asUInt32Array(key2), this._reset();\n }\n AES.prototype = {}, AES.blockSize = 16, AES.keySize = 32, AES.prototype.blockSize = AES.blockSize, AES.prototype.keySize = AES.keySize, AES.prototype._reset = function() {\n for (var keyWords = this._key, keySize = keyWords.length, nRounds = keySize + 6, ksRows = (nRounds + 1) * 4, keySchedule = [], k = 0;k < keySize; k++)\n keySchedule[k] = keyWords[k];\n for (k = keySize;k < ksRows; k++) {\n var t = keySchedule[k - 1];\n k % keySize === 0 \? (t = t << 8 | t >>> 24, t = G.SBOX[t >>> 24] << 24 | G.SBOX[t >>> 16 & 255] << 16 | G.SBOX[t >>> 8 & 255] << 8 | G.SBOX[t & 255], t ^= RCON[k / keySize | 0] << 24) : keySize > 6 && k % keySize === 4 && (t = G.SBOX[t >>> 24] << 24 | G.SBOX[t >>> 16 & 255] << 16 | G.SBOX[t >>> 8 & 255] << 8 | G.SBOX[t & 255]), keySchedule[k] = keySchedule[k - keySize] ^ t;\n }\n for (var invKeySchedule = [], ik = 0;ik < ksRows; ik++) {\n var ksR = ksRows - ik, tt = keySchedule[ksR - (ik % 4 \? 0 : 4)];\n ik < 4 || ksR <= 4 \? invKeySchedule[ik] = tt : invKeySchedule[ik] = G.INV_SUB_MIX[0][G.SBOX[tt >>> 24]] ^ G.INV_SUB_MIX[1][G.SBOX[tt >>> 16 & 255]] ^ G.INV_SUB_MIX[2][G.SBOX[tt >>> 8 & 255]] ^ G.INV_SUB_MIX[3][G.SBOX[tt & 255]];\n }\n this._nRounds = nRounds, this._keySchedule = keySchedule, this._invKeySchedule = invKeySchedule;\n }, AES.prototype.encryptBlockRaw = function(M) {\n return M = asUInt32Array(M), cryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX, this._nRounds);\n }, AES.prototype.encryptBlock = function(M) {\n var out = this.encryptBlockRaw(M), buf = Buffer2.allocUnsafe(16);\n return buf.writeUInt32BE(out[0], 0), buf.writeUInt32BE(out[1], 4), buf.writeUInt32BE(out[2], 8), buf.writeUInt32BE(out[3], 12), buf;\n }, AES.prototype.decryptBlock = function(M) {\n M = asUInt32Array(M);\n var m1 = M[1];\n M[1] = M[3], M[3] = m1;\n var out = cryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX, this._nRounds), buf = Buffer2.allocUnsafe(16);\n return buf.writeUInt32BE(out[0], 0), buf.writeUInt32BE(out[3], 4), buf.writeUInt32BE(out[2], 8), buf.writeUInt32BE(out[1], 12), buf;\n }, AES.prototype.scrub = function() {\n scrubVec(this._keySchedule), scrubVec(this._invKeySchedule), scrubVec(this._key);\n }, module.exports.AES = AES;\n }\n}), require_ghash = __commonJS({\n \"node_modules/browserify-aes/ghash.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer, ZEROES = Buffer2.alloc(16, 0);\n function toArray(buf) {\n return [buf.readUInt32BE(0), buf.readUInt32BE(4), buf.readUInt32BE(8), buf.readUInt32BE(12)];\n }\n function fromArray(out) {\n var buf = Buffer2.allocUnsafe(16);\n return buf.writeUInt32BE(out[0] >>> 0, 0), buf.writeUInt32BE(out[1] >>> 0, 4), buf.writeUInt32BE(out[2] >>> 0, 8), buf.writeUInt32BE(out[3] >>> 0, 12), buf;\n }\n function GHASH(key2) {\n this.h = key2, this.state = Buffer2.alloc(16, 0), this.cache = Buffer2.allocUnsafe(0);\n }\n GHASH.prototype = {}, GHASH.prototype.ghash = function(block) {\n for (var i = -1;++i < block.length; )\n this.state[i] ^= block[i];\n this._multiply();\n }, GHASH.prototype._multiply = function() {\n for (var Vi = toArray(this.h), Zi = [0, 0, 0, 0], j, xi, lsbVi, i = -1;++i < 128; ) {\n for (xi = (this.state[~~(i / 8)] & 1 << 7 - i % 8) !== 0, xi && (Zi[0] ^= Vi[0], Zi[1] ^= Vi[1], Zi[2] ^= Vi[2], Zi[3] ^= Vi[3]), lsbVi = (Vi[3] & 1) !== 0, j = 3;j > 0; j--)\n Vi[j] = Vi[j] >>> 1 | (Vi[j - 1] & 1) << 31;\n Vi[0] = Vi[0] >>> 1, lsbVi && (Vi[0] = Vi[0] ^ 225 << 24);\n }\n this.state = fromArray(Zi);\n }, GHASH.prototype.update = function(buf) {\n this.cache = Buffer2.concat([this.cache, buf]);\n for (var chunk;this.cache.length >= 16; )\n chunk = this.cache.slice(0, 16), this.cache = this.cache.slice(16), this.ghash(chunk);\n }, GHASH.prototype.final = function(abl, bl) {\n return this.cache.length && this.ghash(Buffer2.concat([this.cache, ZEROES], 16)), this.ghash(fromArray([0, abl, 0, bl])), this.state;\n }, module.exports = GHASH;\n }\n}), require_authCipher = __commonJS({\n \"node_modules/browserify-aes/authCipher.js\"(exports, module) {\n var aes = require_aes(), Buffer2 = require_safe_buffer().Buffer, Transform = require_cipher_base(), inherits = require_inherits_browser(), GHASH = require_ghash(), xor = require_buffer_xor(), incr32 = require_incr32();\n function xorTest(a, b) {\n var out = 0;\n a.length !== b.length && out++;\n for (var len = Math.min(a.length, b.length), i = 0;i < len; ++i)\n out += a[i] ^ b[i];\n return out;\n }\n function calcIv(self2, iv, ck) {\n if (iv.length === 12)\n return self2._finID = Buffer2.concat([iv, Buffer2.from([0, 0, 0, 1])]), Buffer2.concat([iv, Buffer2.from([0, 0, 0, 2])]);\n var ghash = new GHASH(ck), len = iv.length, toPad = len % 16;\n ghash.update(iv), toPad && (toPad = 16 - toPad, ghash.update(Buffer2.alloc(toPad, 0))), ghash.update(Buffer2.alloc(8, 0));\n var ivBits = len * 8, tail = Buffer2.alloc(8);\n tail.writeUIntBE(ivBits, 2, 6), ghash.update(tail), self2._finID = ghash.state;\n var out = Buffer2.from(self2._finID);\n return incr32(out), out;\n }\n function StreamCipher(mode, key2, iv, decrypt) {\n Transform.@call(this);\n var h = Buffer2.alloc(4, 0);\n this._cipher = new aes.AES(key2);\n var ck = this._cipher.encryptBlock(h);\n this._ghash = new GHASH(ck), iv = calcIv(this, iv, ck), this._prev = Buffer2.from(iv), this._cache = Buffer2.allocUnsafe(0), this._secCache = Buffer2.allocUnsafe(0), this._decrypt = decrypt, this._alen = 0, this._len = 0, this._mode = mode, this._authTag = null, this._called = !1;\n }\n inherits(StreamCipher, Transform), StreamCipher.prototype._update = function(chunk) {\n if (!this._called && this._alen) {\n var rump = 16 - this._alen % 16;\n rump < 16 && (rump = Buffer2.alloc(rump, 0), this._ghash.update(rump));\n }\n this._called = !0;\n var out = this._mode.encrypt(this, chunk);\n return this._decrypt \? this._ghash.update(chunk) : this._ghash.update(out), this._len += chunk.length, out;\n }, StreamCipher.prototype._final = function() {\n if (this._decrypt && !this._authTag)\n throw new Error(\"Unsupported state or unable to authenticate data\");\n var tag = xor(this._ghash.final(this._alen * 8, this._len * 8), this._cipher.encryptBlock(this._finID));\n if (this._decrypt && xorTest(tag, this._authTag))\n throw new Error(\"Unsupported state or unable to authenticate data\");\n this._authTag = tag, this._cipher.scrub();\n }, StreamCipher.prototype.getAuthTag = function() {\n if (this._decrypt || !Buffer2.isBuffer(this._authTag))\n throw new Error(\"Attempting to get auth tag in unsupported state\");\n return this._authTag;\n }, StreamCipher.prototype.setAuthTag = function(tag) {\n if (!this._decrypt)\n throw new Error(\"Attempting to set auth tag in unsupported state\");\n this._authTag = tag;\n }, StreamCipher.prototype.setAAD = function(buf) {\n if (this._called)\n throw new Error(\"Attempting to set AAD in unsupported state\");\n this._ghash.update(buf), this._alen += buf.length;\n }, module.exports = StreamCipher;\n }\n}), require_streamCipher = __commonJS({\n \"node_modules/browserify-aes/streamCipher.js\"(exports, module) {\n var aes = require_aes(), Buffer2 = require_safe_buffer().Buffer, Transform = require_cipher_base(), inherits = require_inherits_browser();\n function StreamCipher(mode, key2, iv, decrypt) {\n Transform.@call(this), this._cipher = new aes.AES(key2), this._prev = Buffer2.from(iv), this._cache = Buffer2.allocUnsafe(0), this._secCache = Buffer2.allocUnsafe(0), this._decrypt = decrypt, this._mode = mode;\n }\n inherits(StreamCipher, Transform), StreamCipher.prototype._update = function(chunk) {\n return this._mode.encrypt(this, chunk, this._decrypt);\n }, StreamCipher.prototype._final = function() {\n this._cipher.scrub();\n }, module.exports = StreamCipher;\n }\n}), require_evp_bytestokey = __commonJS({\n \"node_modules/evp_bytestokey/index.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer, MD5 = require_md5();\n function EVP_BytesToKey(password, salt, keyBits, ivLen) {\n if (Buffer2.isBuffer(password) || (password = Buffer2.from(password, \"binary\")), salt && (Buffer2.isBuffer(salt) || (salt = Buffer2.from(salt, \"binary\")), salt.length !== 8))\n @throwRangeError(\"salt should be Buffer with 8 byte length\");\n for (var keyLen = keyBits / 8, key2 = Buffer2.alloc(keyLen), iv = Buffer2.alloc(ivLen || 0), tmp = Buffer2.alloc(0);keyLen > 0 || ivLen > 0; ) {\n var hash = new MD5;\n hash.update(tmp), hash.update(password), salt && hash.update(salt), tmp = hash.digest();\n var used = 0;\n if (keyLen > 0) {\n var keyStart = key2.length - keyLen;\n used = Math.min(keyLen, tmp.length), tmp.copy(key2, keyStart, 0, used), keyLen -= used;\n }\n if (used < tmp.length && ivLen > 0) {\n var ivStart = iv.length - ivLen, length = Math.min(ivLen, tmp.length - used);\n tmp.copy(iv, ivStart, used, used + length), ivLen -= length;\n }\n }\n return tmp.fill(0), { key: key2, iv };\n }\n module.exports = EVP_BytesToKey;\n }\n}), require_encrypter = __commonJS({\n \"node_modules/browserify-aes/encrypter.js\"(exports) {\n var MODES = require_modes(), AuthCipher = require_authCipher(), Buffer2 = require_safe_buffer().Buffer, StreamCipher = require_streamCipher(), Transform = require_cipher_base(), aes = require_aes(), ebtk = require_evp_bytestokey(), inherits = require_inherits_browser();\n function Cipher(mode, key2, iv) {\n Transform.@call(this), this._cache = new Splitter, this._cipher = new aes.AES(key2), this._prev = Buffer2.from(iv), this._mode = mode, this._autopadding = !0;\n }\n inherits(Cipher, Transform), Cipher.prototype._update = function(data) {\n this._cache.add(data);\n for (var chunk, thing, out = [];chunk = this._cache.get(); )\n thing = this._mode.encrypt(this, chunk), out.push(thing);\n return Buffer2.concat(out);\n };\n var PADDING = Buffer2.alloc(16, 16);\n Cipher.prototype._final = function() {\n var chunk = this._cache.flush();\n if (this._autopadding)\n return chunk = this._mode.encrypt(this, chunk), this._cipher.scrub(), chunk;\n if (!chunk.equals(PADDING))\n throw this._cipher.scrub(), new Error(\"data not multiple of block length\");\n }, Cipher.prototype.setAutoPadding = function(setTo) {\n return this._autopadding = !!setTo, this;\n };\n function Splitter() {\n this.cache = Buffer2.allocUnsafe(0);\n }\n Splitter.prototype = {}, Splitter.prototype.add = function(data) {\n this.cache = Buffer2.concat([this.cache, data]);\n }, Splitter.prototype.get = function() {\n if (this.cache.length > 15) {\n var out = this.cache.slice(0, 16);\n return this.cache = this.cache.slice(16), out;\n }\n return null;\n }, Splitter.prototype.flush = function() {\n for (var len = 16 - this.cache.length, padBuff = Buffer2.allocUnsafe(len), i = -1;++i < len; )\n padBuff.writeUInt8(len, i);\n return Buffer2.concat([this.cache, padBuff]);\n };\n function createCipheriv(suite, password, iv) {\n var config = MODES[suite.toLowerCase()];\n if (!config)\n @throwTypeError(\"invalid suite type\");\n password = getArrayBufferOrView(password, \"password\");\n const iv_length = iv\?.length || 0, required_iv_length = config.iv || 0;\n if (iv = iv === null \? EMPTY_BUFFER : getArrayBufferOrView(iv, \"iv\"), password\?.length !== config.key / 8) {\n var error = new RangeError(\"Invalid key length\");\n throw error.code = \"ERR_CRYPTO_INVALID_KEYLEN\", error;\n }\n if (config.mode !== \"GCM\" && iv_length !== required_iv_length) {\n var error = new RangeError(\"Invalid key length\");\n throw error.code = \"ERR_CRYPTO_INVALID_KEYLEN\", error;\n }\n return config.type === \"stream\" \? new StreamCipher(config.module, password, iv) : config.type === \"auth\" \? new AuthCipher(config.module, password, iv) : new Cipher(config.module, password, iv);\n }\n function createCipher(suite, password) {\n var config = MODES[suite.toLowerCase()];\n if (!config)\n @throwTypeError(\"invalid suite type\");\n var keys = ebtk(password, !1, config.key, config.iv);\n return createCipheriv(suite, keys.key, keys.iv);\n }\n exports.createCipheriv = createCipheriv, exports.createCipher = createCipher;\n }\n}), require_decrypter = __commonJS({\n \"node_modules/browserify-aes/decrypter.js\"(exports) {\n var AuthCipher = require_authCipher(), Buffer2 = require_safe_buffer().Buffer, MODES = require_modes(), StreamCipher = require_streamCipher(), Transform = require_cipher_base(), aes = require_aes(), ebtk = require_evp_bytestokey(), inherits = require_inherits_browser();\n function Decipher(mode, key2, iv) {\n Transform.@call(this), this._cache = new Splitter, this._last = void 0, this._cipher = new aes.AES(key2), this._prev = Buffer2.from(iv), this._mode = mode, this._autopadding = !0;\n }\n inherits(Decipher, Transform), Decipher.prototype._update = function(data) {\n this._cache.add(data);\n for (var chunk, thing, out = [];chunk = this._cache.get(this._autopadding); )\n thing = this._mode.decrypt(this, chunk), out.push(thing);\n return Buffer2.concat(out);\n }, Decipher.prototype._final = function() {\n var chunk = this._cache.flush();\n if (this._autopadding)\n return unpad(this._mode.decrypt(this, chunk));\n if (chunk)\n throw new Error(\"data not multiple of block length\");\n }, Decipher.prototype.setAutoPadding = function(setTo) {\n return this._autopadding = !!setTo, this;\n };\n function Splitter() {\n this.cache = Buffer2.allocUnsafe(0);\n }\n Splitter.prototype = {}, Splitter.prototype.add = function(data) {\n this.cache = Buffer2.concat([this.cache, data]);\n }, Splitter.prototype.get = function(autoPadding) {\n var out;\n if (autoPadding) {\n if (this.cache.length > 16)\n return out = this.cache.slice(0, 16), this.cache = this.cache.slice(16), out;\n } else if (this.cache.length >= 16)\n return out = this.cache.slice(0, 16), this.cache = this.cache.slice(16), out;\n return null;\n }, Splitter.prototype.flush = function() {\n if (this.cache.length)\n return this.cache;\n };\n function unpad(last) {\n var padded = last[15];\n if (padded < 1 || padded > 16)\n throw new Error(\"unable to decrypt data\");\n for (var i = -1;++i < padded; )\n if (last[i + (16 - padded)] !== padded)\n throw new Error(\"unable to decrypt data\");\n if (padded !== 16)\n return last.slice(0, 16 - padded);\n }\n function createDecipheriv(suite, password, iv) {\n var config = MODES[suite.toLowerCase()];\n if (!config)\n @throwTypeError(\"invalid suite type\");\n password = getArrayBufferOrView(password, \"password\");\n const iv_length = iv\?.length || 0, required_iv_length = config.iv || 0;\n if (iv = iv === null \? EMPTY_BUFFER : getArrayBufferOrView(iv, \"iv\"), config.mode !== \"GCM\" && iv_length !== required_iv_length) {\n var error = new RangeError(\"Invalid key length\");\n throw error.code = \"ERR_CRYPTO_INVALID_KEYLEN\", error;\n }\n if (password.length !== config.key / 8) {\n var error = new RangeError(\"Invalid key length\");\n throw error.code = \"ERR_CRYPTO_INVALID_KEYLEN\", error;\n }\n return config.type === \"stream\" \? new StreamCipher(config.module, password, iv, !0) : config.type === \"auth\" \? new AuthCipher(config.module, password, iv, !0) : new Decipher(config.module, password, iv);\n }\n function createDecipher(suite, password) {\n var config = MODES[suite.toLowerCase()];\n if (!config)\n @throwTypeError(\"invalid suite type\");\n var keys = ebtk(password, !1, config.key, config.iv);\n return createDecipheriv(suite, keys.key, keys.iv);\n }\n exports.createDecipher = createDecipher, exports.createDecipheriv = createDecipheriv;\n }\n}), require_browser5 = __commonJS({\n \"node_modules/browserify-aes/browser.js\"(exports) {\n var ciphers = require_encrypter(), deciphers = require_decrypter(), modes = require_list();\n function getCiphers() {\n return Object.keys(modes);\n }\n exports.createCipher = exports.Cipher = ciphers.createCipher, exports.createCipheriv = exports.Cipheriv = ciphers.createCipheriv, exports.createDecipher = exports.Decipher = deciphers.createDecipher, exports.createDecipheriv = exports.Decipheriv = deciphers.createDecipheriv, exports.listCiphers = exports.getCiphers = getCiphers;\n }\n}), require_modes2 = __commonJS({\n \"node_modules/browserify-des/modes.js\"(exports) {\n exports[\"des-ecb\"] = {\n key: 8,\n iv: 0\n }, exports[\"des-cbc\"] = exports.des = {\n key: 8,\n iv: 8\n }, exports[\"des-ede3-cbc\"] = exports.des3 = {\n key: 24,\n iv: 8\n }, exports[\"des-ede3\"] = {\n key: 24,\n iv: 0\n }, exports[\"des-ede-cbc\"] = {\n key: 16,\n iv: 8\n }, exports[\"des-ede\"] = {\n key: 16,\n iv: 0\n };\n }\n}), require_browser6 = __commonJS({\n \"node_modules/browserify-cipher/browser.js\"(exports) {\n var DES = require_browserify_des(), aes = require_browser5(), aesModes = require_modes(), desModes = require_modes2(), ebtk = require_evp_bytestokey();\n function createCipher(suite, password) {\n suite = suite.toLowerCase();\n var keyLen, ivLen;\n if (aesModes[suite])\n keyLen = aesModes[suite].key, ivLen = aesModes[suite].iv;\n else if (desModes[suite])\n keyLen = desModes[suite].key * 8, ivLen = desModes[suite].iv;\n else\n @throwTypeError(\"invalid suite type\");\n var keys = ebtk(password, !1, keyLen, ivLen);\n return createCipheriv(suite, keys.key, keys.iv);\n }\n function createDecipher(suite, password) {\n suite = suite.toLowerCase();\n var keyLen, ivLen;\n if (aesModes[suite])\n keyLen = aesModes[suite].key, ivLen = aesModes[suite].iv;\n else if (desModes[suite])\n keyLen = desModes[suite].key * 8, ivLen = desModes[suite].iv;\n else\n @throwTypeError(\"invalid suite type\");\n var keys = ebtk(password, !1, keyLen, ivLen);\n return createDecipheriv(suite, keys.key, keys.iv);\n }\n function createCipheriv(suite, key2, iv) {\n if (suite = suite.toLowerCase(), aesModes[suite])\n return aes.createCipheriv(suite, key2, iv);\n if (desModes[suite])\n return new DES({ key: key2, iv, mode: suite });\n @throwTypeError(\"invalid suite type\");\n }\n function createDecipheriv(suite, key2, iv) {\n if (suite = suite.toLowerCase(), aesModes[suite])\n return aes.createDecipheriv(suite, key2, iv);\n if (desModes[suite])\n return new DES({ key: key2, iv, mode: suite, decrypt: !0 });\n @throwTypeError(\"invalid suite type\");\n }\n function getCiphers() {\n return Object.keys(desModes).concat(aes.getCiphers());\n }\n exports.createCipher = exports.Cipher = createCipher, exports.createCipheriv = exports.Cipheriv = createCipheriv, exports.createDecipher = exports.Decipher = createDecipher, exports.createDecipheriv = exports.Decipheriv = createDecipheriv, exports.listCiphers = exports.getCiphers = getCiphers;\n }\n}), require_bn = __commonJS({\n \"node_modules/diffie-hellman/node_modules/bn.js/lib/bn.js\"(exports, module) {\n (function(module2, exports2) {\n function assert(val, msg) {\n if (!val)\n throw new Error(msg || \"Assertion failed\");\n }\n function inherits(ctor, superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function() {\n };\n TempCtor.prototype = superCtor.prototype, ctor.prototype = new TempCtor, ctor.prototype.constructor = ctor;\n }\n function BN(number, base, endian) {\n if (BN.isBN(number))\n return number;\n this.negative = 0, this.words = null, this.length = 0, this.red = null, number !== null && ((base === \"le\" || base === \"be\") && (endian = base, base = 10), this._init(number || 0, base || 10, endian || \"be\"));\n }\n BN.prototype = {}, typeof module2 == \"object\" \? module2.exports = BN : exports2.BN = BN, BN.BN = BN, BN.wordSize = 26;\n var Buffer2 = Buffer;\n BN.isBN = function(num) {\n return num instanceof BN \? !0 : num !== null && typeof num == \"object\" && num.constructor.wordSize === BN.wordSize && @Array.isArray(num.words);\n }, BN.max = function(left, right) {\n return left.cmp(right) > 0 \? left : right;\n }, BN.min = function(left, right) {\n return left.cmp(right) < 0 \? left : right;\n }, BN.prototype._init = function(number, base, endian) {\n if (typeof number == \"number\")\n return this._initNumber(number, base, endian);\n if (typeof number == \"object\")\n return this._initArray(number, base, endian);\n base === \"hex\" && (base = 16), assert(base === (base | 0) && base >= 2 && base <= 36), number = number.toString().replace(/\\s+/g, \"\");\n var start = 0;\n number[0] === \"-\" && (start++, this.negative = 1), start < number.length && (base === 16 \? this._parseHex(number, start, endian) : (this._parseBase(number, base, start), endian === \"le\" && this._initArray(this.toArray(), base, endian)));\n }, BN.prototype._initNumber = function(number, base, endian) {\n number < 0 && (this.negative = 1, number = -number), number < 67108864 \? (this.words = [number & 67108863], this.length = 1) : number < 4503599627370496 \? (this.words = [number & 67108863, number / 67108864 & 67108863], this.length = 2) : (assert(number < 9007199254740992), this.words = [number & 67108863, number / 67108864 & 67108863, 1], this.length = 3), endian === \"le\" && this._initArray(this.toArray(), base, endian);\n }, BN.prototype._initArray = function(number, base, endian) {\n if (assert(typeof number.length == \"number\"), number.length <= 0)\n return this.words = [0], this.length = 1, this;\n this.length = Math.ceil(number.length / 3), this.words = new @Array(this.length);\n for (var i = 0;i < this.length; i++)\n this.words[i] = 0;\n var j, w, off = 0;\n if (endian === \"be\")\n for (i = number.length - 1, j = 0;i >= 0; i -= 3)\n w = number[i] | number[i - 1] << 8 | number[i - 2] << 16, this.words[j] |= w << off & 67108863, this.words[j + 1] = w >>> 26 - off & 67108863, off += 24, off >= 26 && (off -= 26, j++);\n else if (endian === \"le\")\n for (i = 0, j = 0;i < number.length; i += 3)\n w = number[i] | number[i + 1] << 8 | number[i + 2] << 16, this.words[j] |= w << off & 67108863, this.words[j + 1] = w >>> 26 - off & 67108863, off += 24, off >= 26 && (off -= 26, j++);\n return this.strip();\n };\n function parseHex4Bits(string, index) {\n var c = string.charCodeAt(index);\n return c >= 65 && c <= 70 \? c - 55 : c >= 97 && c <= 102 \? c - 87 : c - 48 & 15;\n }\n function parseHexByte(string, lowerBound, index) {\n var r = parseHex4Bits(string, index);\n return index - 1 >= lowerBound && (r |= parseHex4Bits(string, index - 1) << 4), r;\n }\n BN.prototype._parseHex = function(number, start, endian) {\n this.length = Math.ceil((number.length - start) / 6), this.words = new @Array(this.length);\n for (var i = 0;i < this.length; i++)\n this.words[i] = 0;\n var off = 0, j = 0, w;\n if (endian === \"be\")\n for (i = number.length - 1;i >= start; i -= 2)\n w = parseHexByte(number, start, i) << off, this.words[j] |= w & 67108863, off >= 18 \? (off -= 18, j += 1, this.words[j] |= w >>> 26) : off += 8;\n else {\n var parseLength = number.length - start;\n for (i = parseLength % 2 === 0 \? start + 1 : start;i < number.length; i += 2)\n w = parseHexByte(number, start, i) << off, this.words[j] |= w & 67108863, off >= 18 \? (off -= 18, j += 1, this.words[j] |= w >>> 26) : off += 8;\n }\n this.strip();\n };\n function parseBase(str, start, end, mul) {\n for (var r = 0, len = Math.min(str.length, end), i = start;i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n r *= mul, c >= 49 \? r += c - 49 + 10 : c >= 17 \? r += c - 17 + 10 : r += c;\n }\n return r;\n }\n BN.prototype._parseBase = function(number, base, start) {\n this.words = [0], this.length = 1;\n for (var limbLen = 0, limbPow = 1;limbPow <= 67108863; limbPow *= base)\n limbLen++;\n limbLen--, limbPow = limbPow / base | 0;\n for (var total = number.length - start, mod = total % limbLen, end = Math.min(total, total - mod) + start, word = 0, i = start;i < end; i += limbLen)\n word = parseBase(number, i, i + limbLen, base), this.imuln(limbPow), this.words[0] + word < 67108864 \? this.words[0] += word : this._iaddn(word);\n if (mod !== 0) {\n var pow = 1;\n for (word = parseBase(number, i, number.length, base), i = 0;i < mod; i++)\n pow *= base;\n this.imuln(pow), this.words[0] + word < 67108864 \? this.words[0] += word : this._iaddn(word);\n }\n this.strip();\n }, BN.prototype.copy = function(dest) {\n dest.words = new @Array(this.length);\n for (var i = 0;i < this.length; i++)\n dest.words[i] = this.words[i];\n dest.length = this.length, dest.negative = this.negative, dest.red = this.red;\n }, BN.prototype.clone = function() {\n var r = new BN(null);\n return this.copy(r), r;\n }, BN.prototype._expand = function(size) {\n for (;this.length < size; )\n this.words[this.length++] = 0;\n return this;\n }, BN.prototype.strip = function() {\n for (;this.length > 1 && this.words[this.length - 1] === 0; )\n this.length--;\n return this._normSign();\n }, BN.prototype._normSign = function() {\n return this.length === 1 && this.words[0] === 0 && (this.negative = 0), this;\n }, BN.prototype.inspect = function() {\n return (this.red \? \"\";\n };\n var zeros = [\n \"\",\n \"0\",\n \"00\",\n \"000\",\n \"0000\",\n \"00000\",\n \"000000\",\n \"0000000\",\n \"00000000\",\n \"000000000\",\n \"0000000000\",\n \"00000000000\",\n \"000000000000\",\n \"0000000000000\",\n \"00000000000000\",\n \"000000000000000\",\n \"0000000000000000\",\n \"00000000000000000\",\n \"000000000000000000\",\n \"0000000000000000000\",\n \"00000000000000000000\",\n \"000000000000000000000\",\n \"0000000000000000000000\",\n \"00000000000000000000000\",\n \"000000000000000000000000\",\n \"0000000000000000000000000\"\n ], groupSizes = [\n 0,\n 0,\n 25,\n 16,\n 12,\n 11,\n 10,\n 9,\n 8,\n 8,\n 7,\n 7,\n 7,\n 7,\n 6,\n 6,\n 6,\n 6,\n 6,\n 6,\n 6,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5\n ], groupBases = [\n 0,\n 0,\n 33554432,\n 43046721,\n 16777216,\n 48828125,\n 60466176,\n 40353607,\n 16777216,\n 43046721,\n 1e7,\n 19487171,\n 35831808,\n 62748517,\n 7529536,\n 11390625,\n 16777216,\n 24137569,\n 34012224,\n 47045881,\n 64000000,\n 4084101,\n 5153632,\n 6436343,\n 7962624,\n 9765625,\n 11881376,\n 14348907,\n 17210368,\n 20511149,\n 24300000,\n 28629151,\n 33554432,\n 39135393,\n 45435424,\n 52521875,\n 60466176\n ];\n BN.prototype.toString = function(base, padding) {\n base = base || 10, padding = padding | 0 || 1;\n var out;\n if (base === 16 || base === \"hex\") {\n out = \"\";\n for (var off = 0, carry = 0, i = 0;i < this.length; i++) {\n var w = this.words[i], word = ((w << off | carry) & 16777215).toString(16);\n carry = w >>> 24 - off & 16777215, carry !== 0 || i !== this.length - 1 \? out = zeros[6 - word.length] + word + out : out = word + out, off += 2, off >= 26 && (off -= 26, i--);\n }\n for (carry !== 0 && (out = carry.toString(16) + out);out.length % padding !== 0; )\n out = \"0\" + out;\n return this.negative !== 0 && (out = \"-\" + out), out;\n }\n if (base === (base | 0) && base >= 2 && base <= 36) {\n var groupSize = groupSizes[base], groupBase = groupBases[base];\n out = \"\";\n var c = this.clone();\n for (c.negative = 0;!c.isZero(); ) {\n var r = c.modn(groupBase).toString(base);\n c = c.idivn(groupBase), c.isZero() \? out = r + out : out = zeros[groupSize - r.length] + r + out;\n }\n for (this.isZero() && (out = \"0\" + out);out.length % padding !== 0; )\n out = \"0\" + out;\n return this.negative !== 0 && (out = \"-\" + out), out;\n }\n assert(!1, \"Base should be between 2 and 36\");\n }, BN.prototype.toNumber = function() {\n var ret = this.words[0];\n return this.length === 2 \? ret += this.words[1] * 67108864 : this.length === 3 && this.words[2] === 1 \? ret += 4503599627370496 + this.words[1] * 67108864 : this.length > 2 && assert(!1, \"Number can only safely store up to 53 bits\"), this.negative !== 0 \? -ret : ret;\n }, BN.prototype.toJSON = function() {\n return this.toString(16);\n }, BN.prototype.toBuffer = function(endian, length) {\n return assert(typeof Buffer2 < \"u\"), this.toArrayLike(Buffer2, endian, length);\n }, BN.prototype.toArray = function(endian, length) {\n return this.toArrayLike(@Array, endian, length);\n }, BN.prototype.toArrayLike = function(ArrayType, endian, length) {\n var byteLength = this.byteLength(), reqLength = length || Math.max(1, byteLength);\n assert(byteLength <= reqLength, \"byte array longer than desired length\"), assert(reqLength > 0, \"Requested array length <= 0\"), this.strip();\n var littleEndian = endian === \"le\", res = new ArrayType(reqLength), b, i, q = this.clone();\n if (littleEndian) {\n for (i = 0;!q.isZero(); i++)\n b = q.andln(255), q.iushrn(8), res[i] = b;\n for (;i < reqLength; i++)\n res[i] = 0;\n } else {\n for (i = 0;i < reqLength - byteLength; i++)\n res[i] = 0;\n for (i = 0;!q.isZero(); i++)\n b = q.andln(255), q.iushrn(8), res[reqLength - i - 1] = b;\n }\n return res;\n }, Math.clz32 \? BN.prototype._countBits = function(w) {\n return 32 - Math.clz32(w);\n } : BN.prototype._countBits = function(w) {\n var t = w, r = 0;\n return t >= 4096 && (r += 13, t >>>= 13), t >= 64 && (r += 7, t >>>= 7), t >= 8 && (r += 4, t >>>= 4), t >= 2 && (r += 2, t >>>= 2), r + t;\n }, BN.prototype._zeroBits = function(w) {\n if (w === 0)\n return 26;\n var t = w, r = 0;\n return (t & 8191) === 0 && (r += 13, t >>>= 13), (t & 127) === 0 && (r += 7, t >>>= 7), (t & 15) === 0 && (r += 4, t >>>= 4), (t & 3) === 0 && (r += 2, t >>>= 2), (t & 1) === 0 && r++, r;\n }, BN.prototype.bitLength = function() {\n var w = this.words[this.length - 1], hi = this._countBits(w);\n return (this.length - 1) * 26 + hi;\n };\n function toBitArray(num) {\n for (var w = new @Array(num.bitLength()), bit = 0;bit < w.length; bit++) {\n var off = bit / 26 | 0, wbit = bit % 26;\n w[bit] = (num.words[off] & 1 << wbit) >>> wbit;\n }\n return w;\n }\n BN.prototype.zeroBits = function() {\n if (this.isZero())\n return 0;\n for (var r = 0, i = 0;i < this.length; i++) {\n var b = this._zeroBits(this.words[i]);\n if (r += b, b !== 26)\n break;\n }\n return r;\n }, BN.prototype.byteLength = function() {\n return Math.ceil(this.bitLength() / 8);\n }, BN.prototype.toTwos = function(width) {\n return this.negative !== 0 \? this.abs().inotn(width).iaddn(1) : this.clone();\n }, BN.prototype.fromTwos = function(width) {\n return this.testn(width - 1) \? this.notn(width).iaddn(1).ineg() : this.clone();\n }, BN.prototype.isNeg = function() {\n return this.negative !== 0;\n }, BN.prototype.neg = function() {\n return this.clone().ineg();\n }, BN.prototype.ineg = function() {\n return this.isZero() || (this.negative ^= 1), this;\n }, BN.prototype.iuor = function(num) {\n for (;this.length < num.length; )\n this.words[this.length++] = 0;\n for (var i = 0;i < num.length; i++)\n this.words[i] = this.words[i] | num.words[i];\n return this.strip();\n }, BN.prototype.ior = function(num) {\n return assert((this.negative | num.negative) === 0), this.iuor(num);\n }, BN.prototype.or = function(num) {\n return this.length > num.length \? this.clone().ior(num) : num.clone().ior(this);\n }, BN.prototype.uor = function(num) {\n return this.length > num.length \? this.clone().iuor(num) : num.clone().iuor(this);\n }, BN.prototype.iuand = function(num) {\n var b;\n this.length > num.length \? b = num : b = this;\n for (var i = 0;i < b.length; i++)\n this.words[i] = this.words[i] & num.words[i];\n return this.length = b.length, this.strip();\n }, BN.prototype.iand = function(num) {\n return assert((this.negative | num.negative) === 0), this.iuand(num);\n }, BN.prototype.and = function(num) {\n return this.length > num.length \? this.clone().iand(num) : num.clone().iand(this);\n }, BN.prototype.uand = function(num) {\n return this.length > num.length \? this.clone().iuand(num) : num.clone().iuand(this);\n }, BN.prototype.iuxor = function(num) {\n var a, b;\n this.length > num.length \? (a = this, b = num) : (a = num, b = this);\n for (var i = 0;i < b.length; i++)\n this.words[i] = a.words[i] ^ b.words[i];\n if (this !== a)\n for (;i < a.length; i++)\n this.words[i] = a.words[i];\n return this.length = a.length, this.strip();\n }, BN.prototype.ixor = function(num) {\n return assert((this.negative | num.negative) === 0), this.iuxor(num);\n }, BN.prototype.xor = function(num) {\n return this.length > num.length \? this.clone().ixor(num) : num.clone().ixor(this);\n }, BN.prototype.uxor = function(num) {\n return this.length > num.length \? this.clone().iuxor(num) : num.clone().iuxor(this);\n }, BN.prototype.inotn = function(width) {\n assert(typeof width == \"number\" && width >= 0);\n var bytesNeeded = Math.ceil(width / 26) | 0, bitsLeft = width % 26;\n this._expand(bytesNeeded), bitsLeft > 0 && bytesNeeded--;\n for (var i = 0;i < bytesNeeded; i++)\n this.words[i] = ~this.words[i] & 67108863;\n return bitsLeft > 0 && (this.words[i] = ~this.words[i] & 67108863 >> 26 - bitsLeft), this.strip();\n }, BN.prototype.notn = function(width) {\n return this.clone().inotn(width);\n }, BN.prototype.setn = function(bit, val) {\n assert(typeof bit == \"number\" && bit >= 0);\n var off = bit / 26 | 0, wbit = bit % 26;\n return this._expand(off + 1), val \? this.words[off] = this.words[off] | 1 << wbit : this.words[off] = this.words[off] & ~(1 << wbit), this.strip();\n }, BN.prototype.iadd = function(num) {\n var r;\n if (this.negative !== 0 && num.negative === 0)\n return this.negative = 0, r = this.isub(num), this.negative ^= 1, this._normSign();\n if (this.negative === 0 && num.negative !== 0)\n return num.negative = 0, r = this.isub(num), num.negative = 1, r._normSign();\n var a, b;\n this.length > num.length \? (a = this, b = num) : (a = num, b = this);\n for (var carry = 0, i = 0;i < b.length; i++)\n r = (a.words[i] | 0) + (b.words[i] | 0) + carry, this.words[i] = r & 67108863, carry = r >>> 26;\n for (;carry !== 0 && i < a.length; i++)\n r = (a.words[i] | 0) + carry, this.words[i] = r & 67108863, carry = r >>> 26;\n if (this.length = a.length, carry !== 0)\n this.words[this.length] = carry, this.length++;\n else if (a !== this)\n for (;i < a.length; i++)\n this.words[i] = a.words[i];\n return this;\n }, BN.prototype.add = function(num) {\n var res;\n return num.negative !== 0 && this.negative === 0 \? (num.negative = 0, res = this.sub(num), num.negative ^= 1, res) : num.negative === 0 && this.negative !== 0 \? (this.negative = 0, res = num.sub(this), this.negative = 1, res) : this.length > num.length \? this.clone().iadd(num) : num.clone().iadd(this);\n }, BN.prototype.isub = function(num) {\n if (num.negative !== 0) {\n num.negative = 0;\n var r = this.iadd(num);\n return num.negative = 1, r._normSign();\n } else if (this.negative !== 0)\n return this.negative = 0, this.iadd(num), this.negative = 1, this._normSign();\n var cmp = this.cmp(num);\n if (cmp === 0)\n return this.negative = 0, this.length = 1, this.words[0] = 0, this;\n var a, b;\n cmp > 0 \? (a = this, b = num) : (a = num, b = this);\n for (var carry = 0, i = 0;i < b.length; i++)\n r = (a.words[i] | 0) - (b.words[i] | 0) + carry, carry = r >> 26, this.words[i] = r & 67108863;\n for (;carry !== 0 && i < a.length; i++)\n r = (a.words[i] | 0) + carry, carry = r >> 26, this.words[i] = r & 67108863;\n if (carry === 0 && i < a.length && a !== this)\n for (;i < a.length; i++)\n this.words[i] = a.words[i];\n return this.length = Math.max(this.length, i), a !== this && (this.negative = 1), this.strip();\n }, BN.prototype.sub = function(num) {\n return this.clone().isub(num);\n };\n function smallMulTo(self2, num, out) {\n out.negative = num.negative ^ self2.negative;\n var len = self2.length + num.length | 0;\n out.length = len, len = len - 1 | 0;\n var a = self2.words[0] | 0, b = num.words[0] | 0, r = a * b, lo = r & 67108863, carry = r / 67108864 | 0;\n out.words[0] = lo;\n for (var k = 1;k < len; k++) {\n for (var ncarry = carry >>> 26, rword = carry & 67108863, maxJ = Math.min(k, num.length - 1), j = Math.max(0, k - self2.length + 1);j <= maxJ; j++) {\n var i = k - j | 0;\n a = self2.words[i] | 0, b = num.words[j] | 0, r = a * b + rword, ncarry += r / 67108864 | 0, rword = r & 67108863;\n }\n out.words[k] = rword | 0, carry = ncarry | 0;\n }\n return carry !== 0 \? out.words[k] = carry | 0 : out.length--, out.strip();\n }\n var comb10MulTo = function(self2, num, out) {\n var a = self2.words, b = num.words, o = out.words, c = 0, lo, mid, hi, a0 = a[0] | 0, al0 = a0 & 8191, ah0 = a0 >>> 13, a1 = a[1] | 0, al1 = a1 & 8191, ah1 = a1 >>> 13, a2 = a[2] | 0, al2 = a2 & 8191, ah2 = a2 >>> 13, a3 = a[3] | 0, al3 = a3 & 8191, ah3 = a3 >>> 13, a4 = a[4] | 0, al4 = a4 & 8191, ah4 = a4 >>> 13, a5 = a[5] | 0, al5 = a5 & 8191, ah5 = a5 >>> 13, a6 = a[6] | 0, al6 = a6 & 8191, ah6 = a6 >>> 13, a7 = a[7] | 0, al7 = a7 & 8191, ah7 = a7 >>> 13, a8 = a[8] | 0, al8 = a8 & 8191, ah8 = a8 >>> 13, a9 = a[9] | 0, al9 = a9 & 8191, ah9 = a9 >>> 13, b0 = b[0] | 0, bl0 = b0 & 8191, bh0 = b0 >>> 13, b1 = b[1] | 0, bl1 = b1 & 8191, bh1 = b1 >>> 13, b2 = b[2] | 0, bl2 = b2 & 8191, bh2 = b2 >>> 13, b3 = b[3] | 0, bl3 = b3 & 8191, bh3 = b3 >>> 13, b4 = b[4] | 0, bl4 = b4 & 8191, bh4 = b4 >>> 13, b5 = b[5] | 0, bl5 = b5 & 8191, bh5 = b5 >>> 13, b6 = b[6] | 0, bl6 = b6 & 8191, bh6 = b6 >>> 13, b7 = b[7] | 0, bl7 = b7 & 8191, bh7 = b7 >>> 13, b8 = b[8] | 0, bl8 = b8 & 8191, bh8 = b8 >>> 13, b9 = b[9] | 0, bl9 = b9 & 8191, bh9 = b9 >>> 13;\n out.negative = self2.negative ^ num.negative, out.length = 19, lo = Math.imul(al0, bl0), mid = Math.imul(al0, bh0), mid = mid + Math.imul(ah0, bl0) | 0, hi = Math.imul(ah0, bh0);\n var w0 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w0 >>> 26) | 0, w0 &= 67108863, lo = Math.imul(al1, bl0), mid = Math.imul(al1, bh0), mid = mid + Math.imul(ah1, bl0) | 0, hi = Math.imul(ah1, bh0), lo = lo + Math.imul(al0, bl1) | 0, mid = mid + Math.imul(al0, bh1) | 0, mid = mid + Math.imul(ah0, bl1) | 0, hi = hi + Math.imul(ah0, bh1) | 0;\n var w1 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w1 >>> 26) | 0, w1 &= 67108863, lo = Math.imul(al2, bl0), mid = Math.imul(al2, bh0), mid = mid + Math.imul(ah2, bl0) | 0, hi = Math.imul(ah2, bh0), lo = lo + Math.imul(al1, bl1) | 0, mid = mid + Math.imul(al1, bh1) | 0, mid = mid + Math.imul(ah1, bl1) | 0, hi = hi + Math.imul(ah1, bh1) | 0, lo = lo + Math.imul(al0, bl2) | 0, mid = mid + Math.imul(al0, bh2) | 0, mid = mid + Math.imul(ah0, bl2) | 0, hi = hi + Math.imul(ah0, bh2) | 0;\n var w2 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w2 >>> 26) | 0, w2 &= 67108863, lo = Math.imul(al3, bl0), mid = Math.imul(al3, bh0), mid = mid + Math.imul(ah3, bl0) | 0, hi = Math.imul(ah3, bh0), lo = lo + Math.imul(al2, bl1) | 0, mid = mid + Math.imul(al2, bh1) | 0, mid = mid + Math.imul(ah2, bl1) | 0, hi = hi + Math.imul(ah2, bh1) | 0, lo = lo + Math.imul(al1, bl2) | 0, mid = mid + Math.imul(al1, bh2) | 0, mid = mid + Math.imul(ah1, bl2) | 0, hi = hi + Math.imul(ah1, bh2) | 0, lo = lo + Math.imul(al0, bl3) | 0, mid = mid + Math.imul(al0, bh3) | 0, mid = mid + Math.imul(ah0, bl3) | 0, hi = hi + Math.imul(ah0, bh3) | 0;\n var w3 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w3 >>> 26) | 0, w3 &= 67108863, lo = Math.imul(al4, bl0), mid = Math.imul(al4, bh0), mid = mid + Math.imul(ah4, bl0) | 0, hi = Math.imul(ah4, bh0), lo = lo + Math.imul(al3, bl1) | 0, mid = mid + Math.imul(al3, bh1) | 0, mid = mid + Math.imul(ah3, bl1) | 0, hi = hi + Math.imul(ah3, bh1) | 0, lo = lo + Math.imul(al2, bl2) | 0, mid = mid + Math.imul(al2, bh2) | 0, mid = mid + Math.imul(ah2, bl2) | 0, hi = hi + Math.imul(ah2, bh2) | 0, lo = lo + Math.imul(al1, bl3) | 0, mid = mid + Math.imul(al1, bh3) | 0, mid = mid + Math.imul(ah1, bl3) | 0, hi = hi + Math.imul(ah1, bh3) | 0, lo = lo + Math.imul(al0, bl4) | 0, mid = mid + Math.imul(al0, bh4) | 0, mid = mid + Math.imul(ah0, bl4) | 0, hi = hi + Math.imul(ah0, bh4) | 0;\n var w4 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w4 >>> 26) | 0, w4 &= 67108863, lo = Math.imul(al5, bl0), mid = Math.imul(al5, bh0), mid = mid + Math.imul(ah5, bl0) | 0, hi = Math.imul(ah5, bh0), lo = lo + Math.imul(al4, bl1) | 0, mid = mid + Math.imul(al4, bh1) | 0, mid = mid + Math.imul(ah4, bl1) | 0, hi = hi + Math.imul(ah4, bh1) | 0, lo = lo + Math.imul(al3, bl2) | 0, mid = mid + Math.imul(al3, bh2) | 0, mid = mid + Math.imul(ah3, bl2) | 0, hi = hi + Math.imul(ah3, bh2) | 0, lo = lo + Math.imul(al2, bl3) | 0, mid = mid + Math.imul(al2, bh3) | 0, mid = mid + Math.imul(ah2, bl3) | 0, hi = hi + Math.imul(ah2, bh3) | 0, lo = lo + Math.imul(al1, bl4) | 0, mid = mid + Math.imul(al1, bh4) | 0, mid = mid + Math.imul(ah1, bl4) | 0, hi = hi + Math.imul(ah1, bh4) | 0, lo = lo + Math.imul(al0, bl5) | 0, mid = mid + Math.imul(al0, bh5) | 0, mid = mid + Math.imul(ah0, bl5) | 0, hi = hi + Math.imul(ah0, bh5) | 0;\n var w5 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w5 >>> 26) | 0, w5 &= 67108863, lo = Math.imul(al6, bl0), mid = Math.imul(al6, bh0), mid = mid + Math.imul(ah6, bl0) | 0, hi = Math.imul(ah6, bh0), lo = lo + Math.imul(al5, bl1) | 0, mid = mid + Math.imul(al5, bh1) | 0, mid = mid + Math.imul(ah5, bl1) | 0, hi = hi + Math.imul(ah5, bh1) | 0, lo = lo + Math.imul(al4, bl2) | 0, mid = mid + Math.imul(al4, bh2) | 0, mid = mid + Math.imul(ah4, bl2) | 0, hi = hi + Math.imul(ah4, bh2) | 0, lo = lo + Math.imul(al3, bl3) | 0, mid = mid + Math.imul(al3, bh3) | 0, mid = mid + Math.imul(ah3, bl3) | 0, hi = hi + Math.imul(ah3, bh3) | 0, lo = lo + Math.imul(al2, bl4) | 0, mid = mid + Math.imul(al2, bh4) | 0, mid = mid + Math.imul(ah2, bl4) | 0, hi = hi + Math.imul(ah2, bh4) | 0, lo = lo + Math.imul(al1, bl5) | 0, mid = mid + Math.imul(al1, bh5) | 0, mid = mid + Math.imul(ah1, bl5) | 0, hi = hi + Math.imul(ah1, bh5) | 0, lo = lo + Math.imul(al0, bl6) | 0, mid = mid + Math.imul(al0, bh6) | 0, mid = mid + Math.imul(ah0, bl6) | 0, hi = hi + Math.imul(ah0, bh6) | 0;\n var w6 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w6 >>> 26) | 0, w6 &= 67108863, lo = Math.imul(al7, bl0), mid = Math.imul(al7, bh0), mid = mid + Math.imul(ah7, bl0) | 0, hi = Math.imul(ah7, bh0), lo = lo + Math.imul(al6, bl1) | 0, mid = mid + Math.imul(al6, bh1) | 0, mid = mid + Math.imul(ah6, bl1) | 0, hi = hi + Math.imul(ah6, bh1) | 0, lo = lo + Math.imul(al5, bl2) | 0, mid = mid + Math.imul(al5, bh2) | 0, mid = mid + Math.imul(ah5, bl2) | 0, hi = hi + Math.imul(ah5, bh2) | 0, lo = lo + Math.imul(al4, bl3) | 0, mid = mid + Math.imul(al4, bh3) | 0, mid = mid + Math.imul(ah4, bl3) | 0, hi = hi + Math.imul(ah4, bh3) | 0, lo = lo + Math.imul(al3, bl4) | 0, mid = mid + Math.imul(al3, bh4) | 0, mid = mid + Math.imul(ah3, bl4) | 0, hi = hi + Math.imul(ah3, bh4) | 0, lo = lo + Math.imul(al2, bl5) | 0, mid = mid + Math.imul(al2, bh5) | 0, mid = mid + Math.imul(ah2, bl5) | 0, hi = hi + Math.imul(ah2, bh5) | 0, lo = lo + Math.imul(al1, bl6) | 0, mid = mid + Math.imul(al1, bh6) | 0, mid = mid + Math.imul(ah1, bl6) | 0, hi = hi + Math.imul(ah1, bh6) | 0, lo = lo + Math.imul(al0, bl7) | 0, mid = mid + Math.imul(al0, bh7) | 0, mid = mid + Math.imul(ah0, bl7) | 0, hi = hi + Math.imul(ah0, bh7) | 0;\n var w7 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w7 >>> 26) | 0, w7 &= 67108863, lo = Math.imul(al8, bl0), mid = Math.imul(al8, bh0), mid = mid + Math.imul(ah8, bl0) | 0, hi = Math.imul(ah8, bh0), lo = lo + Math.imul(al7, bl1) | 0, mid = mid + Math.imul(al7, bh1) | 0, mid = mid + Math.imul(ah7, bl1) | 0, hi = hi + Math.imul(ah7, bh1) | 0, lo = lo + Math.imul(al6, bl2) | 0, mid = mid + Math.imul(al6, bh2) | 0, mid = mid + Math.imul(ah6, bl2) | 0, hi = hi + Math.imul(ah6, bh2) | 0, lo = lo + Math.imul(al5, bl3) | 0, mid = mid + Math.imul(al5, bh3) | 0, mid = mid + Math.imul(ah5, bl3) | 0, hi = hi + Math.imul(ah5, bh3) | 0, lo = lo + Math.imul(al4, bl4) | 0, mid = mid + Math.imul(al4, bh4) | 0, mid = mid + Math.imul(ah4, bl4) | 0, hi = hi + Math.imul(ah4, bh4) | 0, lo = lo + Math.imul(al3, bl5) | 0, mid = mid + Math.imul(al3, bh5) | 0, mid = mid + Math.imul(ah3, bl5) | 0, hi = hi + Math.imul(ah3, bh5) | 0, lo = lo + Math.imul(al2, bl6) | 0, mid = mid + Math.imul(al2, bh6) | 0, mid = mid + Math.imul(ah2, bl6) | 0, hi = hi + Math.imul(ah2, bh6) | 0, lo = lo + Math.imul(al1, bl7) | 0, mid = mid + Math.imul(al1, bh7) | 0, mid = mid + Math.imul(ah1, bl7) | 0, hi = hi + Math.imul(ah1, bh7) | 0, lo = lo + Math.imul(al0, bl8) | 0, mid = mid + Math.imul(al0, bh8) | 0, mid = mid + Math.imul(ah0, bl8) | 0, hi = hi + Math.imul(ah0, bh8) | 0;\n var w8 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w8 >>> 26) | 0, w8 &= 67108863, lo = Math.imul(al9, bl0), mid = Math.imul(al9, bh0), mid = mid + Math.imul(ah9, bl0) | 0, hi = Math.imul(ah9, bh0), lo = lo + Math.imul(al8, bl1) | 0, mid = mid + Math.imul(al8, bh1) | 0, mid = mid + Math.imul(ah8, bl1) | 0, hi = hi + Math.imul(ah8, bh1) | 0, lo = lo + Math.imul(al7, bl2) | 0, mid = mid + Math.imul(al7, bh2) | 0, mid = mid + Math.imul(ah7, bl2) | 0, hi = hi + Math.imul(ah7, bh2) | 0, lo = lo + Math.imul(al6, bl3) | 0, mid = mid + Math.imul(al6, bh3) | 0, mid = mid + Math.imul(ah6, bl3) | 0, hi = hi + Math.imul(ah6, bh3) | 0, lo = lo + Math.imul(al5, bl4) | 0, mid = mid + Math.imul(al5, bh4) | 0, mid = mid + Math.imul(ah5, bl4) | 0, hi = hi + Math.imul(ah5, bh4) | 0, lo = lo + Math.imul(al4, bl5) | 0, mid = mid + Math.imul(al4, bh5) | 0, mid = mid + Math.imul(ah4, bl5) | 0, hi = hi + Math.imul(ah4, bh5) | 0, lo = lo + Math.imul(al3, bl6) | 0, mid = mid + Math.imul(al3, bh6) | 0, mid = mid + Math.imul(ah3, bl6) | 0, hi = hi + Math.imul(ah3, bh6) | 0, lo = lo + Math.imul(al2, bl7) | 0, mid = mid + Math.imul(al2, bh7) | 0, mid = mid + Math.imul(ah2, bl7) | 0, hi = hi + Math.imul(ah2, bh7) | 0, lo = lo + Math.imul(al1, bl8) | 0, mid = mid + Math.imul(al1, bh8) | 0, mid = mid + Math.imul(ah1, bl8) | 0, hi = hi + Math.imul(ah1, bh8) | 0, lo = lo + Math.imul(al0, bl9) | 0, mid = mid + Math.imul(al0, bh9) | 0, mid = mid + Math.imul(ah0, bl9) | 0, hi = hi + Math.imul(ah0, bh9) | 0;\n var w9 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w9 >>> 26) | 0, w9 &= 67108863, lo = Math.imul(al9, bl1), mid = Math.imul(al9, bh1), mid = mid + Math.imul(ah9, bl1) | 0, hi = Math.imul(ah9, bh1), lo = lo + Math.imul(al8, bl2) | 0, mid = mid + Math.imul(al8, bh2) | 0, mid = mid + Math.imul(ah8, bl2) | 0, hi = hi + Math.imul(ah8, bh2) | 0, lo = lo + Math.imul(al7, bl3) | 0, mid = mid + Math.imul(al7, bh3) | 0, mid = mid + Math.imul(ah7, bl3) | 0, hi = hi + Math.imul(ah7, bh3) | 0, lo = lo + Math.imul(al6, bl4) | 0, mid = mid + Math.imul(al6, bh4) | 0, mid = mid + Math.imul(ah6, bl4) | 0, hi = hi + Math.imul(ah6, bh4) | 0, lo = lo + Math.imul(al5, bl5) | 0, mid = mid + Math.imul(al5, bh5) | 0, mid = mid + Math.imul(ah5, bl5) | 0, hi = hi + Math.imul(ah5, bh5) | 0, lo = lo + Math.imul(al4, bl6) | 0, mid = mid + Math.imul(al4, bh6) | 0, mid = mid + Math.imul(ah4, bl6) | 0, hi = hi + Math.imul(ah4, bh6) | 0, lo = lo + Math.imul(al3, bl7) | 0, mid = mid + Math.imul(al3, bh7) | 0, mid = mid + Math.imul(ah3, bl7) | 0, hi = hi + Math.imul(ah3, bh7) | 0, lo = lo + Math.imul(al2, bl8) | 0, mid = mid + Math.imul(al2, bh8) | 0, mid = mid + Math.imul(ah2, bl8) | 0, hi = hi + Math.imul(ah2, bh8) | 0, lo = lo + Math.imul(al1, bl9) | 0, mid = mid + Math.imul(al1, bh9) | 0, mid = mid + Math.imul(ah1, bl9) | 0, hi = hi + Math.imul(ah1, bh9) | 0;\n var w10 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w10 >>> 26) | 0, w10 &= 67108863, lo = Math.imul(al9, bl2), mid = Math.imul(al9, bh2), mid = mid + Math.imul(ah9, bl2) | 0, hi = Math.imul(ah9, bh2), lo = lo + Math.imul(al8, bl3) | 0, mid = mid + Math.imul(al8, bh3) | 0, mid = mid + Math.imul(ah8, bl3) | 0, hi = hi + Math.imul(ah8, bh3) | 0, lo = lo + Math.imul(al7, bl4) | 0, mid = mid + Math.imul(al7, bh4) | 0, mid = mid + Math.imul(ah7, bl4) | 0, hi = hi + Math.imul(ah7, bh4) | 0, lo = lo + Math.imul(al6, bl5) | 0, mid = mid + Math.imul(al6, bh5) | 0, mid = mid + Math.imul(ah6, bl5) | 0, hi = hi + Math.imul(ah6, bh5) | 0, lo = lo + Math.imul(al5, bl6) | 0, mid = mid + Math.imul(al5, bh6) | 0, mid = mid + Math.imul(ah5, bl6) | 0, hi = hi + Math.imul(ah5, bh6) | 0, lo = lo + Math.imul(al4, bl7) | 0, mid = mid + Math.imul(al4, bh7) | 0, mid = mid + Math.imul(ah4, bl7) | 0, hi = hi + Math.imul(ah4, bh7) | 0, lo = lo + Math.imul(al3, bl8) | 0, mid = mid + Math.imul(al3, bh8) | 0, mid = mid + Math.imul(ah3, bl8) | 0, hi = hi + Math.imul(ah3, bh8) | 0, lo = lo + Math.imul(al2, bl9) | 0, mid = mid + Math.imul(al2, bh9) | 0, mid = mid + Math.imul(ah2, bl9) | 0, hi = hi + Math.imul(ah2, bh9) | 0;\n var w11 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w11 >>> 26) | 0, w11 &= 67108863, lo = Math.imul(al9, bl3), mid = Math.imul(al9, bh3), mid = mid + Math.imul(ah9, bl3) | 0, hi = Math.imul(ah9, bh3), lo = lo + Math.imul(al8, bl4) | 0, mid = mid + Math.imul(al8, bh4) | 0, mid = mid + Math.imul(ah8, bl4) | 0, hi = hi + Math.imul(ah8, bh4) | 0, lo = lo + Math.imul(al7, bl5) | 0, mid = mid + Math.imul(al7, bh5) | 0, mid = mid + Math.imul(ah7, bl5) | 0, hi = hi + Math.imul(ah7, bh5) | 0, lo = lo + Math.imul(al6, bl6) | 0, mid = mid + Math.imul(al6, bh6) | 0, mid = mid + Math.imul(ah6, bl6) | 0, hi = hi + Math.imul(ah6, bh6) | 0, lo = lo + Math.imul(al5, bl7) | 0, mid = mid + Math.imul(al5, bh7) | 0, mid = mid + Math.imul(ah5, bl7) | 0, hi = hi + Math.imul(ah5, bh7) | 0, lo = lo + Math.imul(al4, bl8) | 0, mid = mid + Math.imul(al4, bh8) | 0, mid = mid + Math.imul(ah4, bl8) | 0, hi = hi + Math.imul(ah4, bh8) | 0, lo = lo + Math.imul(al3, bl9) | 0, mid = mid + Math.imul(al3, bh9) | 0, mid = mid + Math.imul(ah3, bl9) | 0, hi = hi + Math.imul(ah3, bh9) | 0;\n var w12 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w12 >>> 26) | 0, w12 &= 67108863, lo = Math.imul(al9, bl4), mid = Math.imul(al9, bh4), mid = mid + Math.imul(ah9, bl4) | 0, hi = Math.imul(ah9, bh4), lo = lo + Math.imul(al8, bl5) | 0, mid = mid + Math.imul(al8, bh5) | 0, mid = mid + Math.imul(ah8, bl5) | 0, hi = hi + Math.imul(ah8, bh5) | 0, lo = lo + Math.imul(al7, bl6) | 0, mid = mid + Math.imul(al7, bh6) | 0, mid = mid + Math.imul(ah7, bl6) | 0, hi = hi + Math.imul(ah7, bh6) | 0, lo = lo + Math.imul(al6, bl7) | 0, mid = mid + Math.imul(al6, bh7) | 0, mid = mid + Math.imul(ah6, bl7) | 0, hi = hi + Math.imul(ah6, bh7) | 0, lo = lo + Math.imul(al5, bl8) | 0, mid = mid + Math.imul(al5, bh8) | 0, mid = mid + Math.imul(ah5, bl8) | 0, hi = hi + Math.imul(ah5, bh8) | 0, lo = lo + Math.imul(al4, bl9) | 0, mid = mid + Math.imul(al4, bh9) | 0, mid = mid + Math.imul(ah4, bl9) | 0, hi = hi + Math.imul(ah4, bh9) | 0;\n var w13 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w13 >>> 26) | 0, w13 &= 67108863, lo = Math.imul(al9, bl5), mid = Math.imul(al9, bh5), mid = mid + Math.imul(ah9, bl5) | 0, hi = Math.imul(ah9, bh5), lo = lo + Math.imul(al8, bl6) | 0, mid = mid + Math.imul(al8, bh6) | 0, mid = mid + Math.imul(ah8, bl6) | 0, hi = hi + Math.imul(ah8, bh6) | 0, lo = lo + Math.imul(al7, bl7) | 0, mid = mid + Math.imul(al7, bh7) | 0, mid = mid + Math.imul(ah7, bl7) | 0, hi = hi + Math.imul(ah7, bh7) | 0, lo = lo + Math.imul(al6, bl8) | 0, mid = mid + Math.imul(al6, bh8) | 0, mid = mid + Math.imul(ah6, bl8) | 0, hi = hi + Math.imul(ah6, bh8) | 0, lo = lo + Math.imul(al5, bl9) | 0, mid = mid + Math.imul(al5, bh9) | 0, mid = mid + Math.imul(ah5, bl9) | 0, hi = hi + Math.imul(ah5, bh9) | 0;\n var w14 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w14 >>> 26) | 0, w14 &= 67108863, lo = Math.imul(al9, bl6), mid = Math.imul(al9, bh6), mid = mid + Math.imul(ah9, bl6) | 0, hi = Math.imul(ah9, bh6), lo = lo + Math.imul(al8, bl7) | 0, mid = mid + Math.imul(al8, bh7) | 0, mid = mid + Math.imul(ah8, bl7) | 0, hi = hi + Math.imul(ah8, bh7) | 0, lo = lo + Math.imul(al7, bl8) | 0, mid = mid + Math.imul(al7, bh8) | 0, mid = mid + Math.imul(ah7, bl8) | 0, hi = hi + Math.imul(ah7, bh8) | 0, lo = lo + Math.imul(al6, bl9) | 0, mid = mid + Math.imul(al6, bh9) | 0, mid = mid + Math.imul(ah6, bl9) | 0, hi = hi + Math.imul(ah6, bh9) | 0;\n var w15 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w15 >>> 26) | 0, w15 &= 67108863, lo = Math.imul(al9, bl7), mid = Math.imul(al9, bh7), mid = mid + Math.imul(ah9, bl7) | 0, hi = Math.imul(ah9, bh7), lo = lo + Math.imul(al8, bl8) | 0, mid = mid + Math.imul(al8, bh8) | 0, mid = mid + Math.imul(ah8, bl8) | 0, hi = hi + Math.imul(ah8, bh8) | 0, lo = lo + Math.imul(al7, bl9) | 0, mid = mid + Math.imul(al7, bh9) | 0, mid = mid + Math.imul(ah7, bl9) | 0, hi = hi + Math.imul(ah7, bh9) | 0;\n var w16 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w16 >>> 26) | 0, w16 &= 67108863, lo = Math.imul(al9, bl8), mid = Math.imul(al9, bh8), mid = mid + Math.imul(ah9, bl8) | 0, hi = Math.imul(ah9, bh8), lo = lo + Math.imul(al8, bl9) | 0, mid = mid + Math.imul(al8, bh9) | 0, mid = mid + Math.imul(ah8, bl9) | 0, hi = hi + Math.imul(ah8, bh9) | 0;\n var w17 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w17 >>> 26) | 0, w17 &= 67108863, lo = Math.imul(al9, bl9), mid = Math.imul(al9, bh9), mid = mid + Math.imul(ah9, bl9) | 0, hi = Math.imul(ah9, bh9);\n var w18 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n return c = (hi + (mid >>> 13) | 0) + (w18 >>> 26) | 0, w18 &= 67108863, o[0] = w0, o[1] = w1, o[2] = w2, o[3] = w3, o[4] = w4, o[5] = w5, o[6] = w6, o[7] = w7, o[8] = w8, o[9] = w9, o[10] = w10, o[11] = w11, o[12] = w12, o[13] = w13, o[14] = w14, o[15] = w15, o[16] = w16, o[17] = w17, o[18] = w18, c !== 0 && (o[19] = c, out.length++), out;\n };\n Math.imul || (comb10MulTo = smallMulTo);\n function bigMulTo(self2, num, out) {\n out.negative = num.negative ^ self2.negative, out.length = self2.length + num.length;\n for (var carry = 0, hncarry = 0, k = 0;k < out.length - 1; k++) {\n var ncarry = hncarry;\n hncarry = 0;\n for (var rword = carry & 67108863, maxJ = Math.min(k, num.length - 1), j = Math.max(0, k - self2.length + 1);j <= maxJ; j++) {\n var i = k - j, a = self2.words[i] | 0, b = num.words[j] | 0, r = a * b, lo = r & 67108863;\n ncarry = ncarry + (r / 67108864 | 0) | 0, lo = lo + rword | 0, rword = lo & 67108863, ncarry = ncarry + (lo >>> 26) | 0, hncarry += ncarry >>> 26, ncarry &= 67108863;\n }\n out.words[k] = rword, carry = ncarry, ncarry = hncarry;\n }\n return carry !== 0 \? out.words[k] = carry : out.length--, out.strip();\n }\n function jumboMulTo(self2, num, out) {\n var fftm = new FFTM;\n return fftm.mulp(self2, num, out);\n }\n BN.prototype.mulTo = function(num, out) {\n var res, len = this.length + num.length;\n return this.length === 10 && num.length === 10 \? res = comb10MulTo(this, num, out) : len < 63 \? res = smallMulTo(this, num, out) : len < 1024 \? res = bigMulTo(this, num, out) : res = jumboMulTo(this, num, out), res;\n };\n function FFTM(x, y) {\n this.x = x, this.y = y;\n }\n FFTM.prototype = {}, FFTM.prototype.makeRBT = function(N) {\n for (var t = new @Array(N), l = BN.prototype._countBits(N) - 1, i = 0;i < N; i++)\n t[i] = this.revBin(i, l, N);\n return t;\n }, FFTM.prototype.revBin = function(x, l, N) {\n if (x === 0 || x === N - 1)\n return x;\n for (var rb = 0, i = 0;i < l; i++)\n rb |= (x & 1) << l - i - 1, x >>= 1;\n return rb;\n }, FFTM.prototype.permute = function(rbt, rws, iws, rtws, itws, N) {\n for (var i = 0;i < N; i++)\n rtws[i] = rws[rbt[i]], itws[i] = iws[rbt[i]];\n }, FFTM.prototype.transform = function(rws, iws, rtws, itws, N, rbt) {\n this.permute(rbt, rws, iws, rtws, itws, N);\n for (var s = 1;s < N; s <<= 1)\n for (var l = s << 1, rtwdf = Math.cos(2 * Math.PI / l), itwdf = Math.sin(2 * Math.PI / l), p = 0;p < N; p += l)\n for (var rtwdf_ = rtwdf, itwdf_ = itwdf, j = 0;j < s; j++) {\n var re = rtws[p + j], ie = itws[p + j], ro = rtws[p + j + s], io = itws[p + j + s], rx = rtwdf_ * ro - itwdf_ * io;\n io = rtwdf_ * io + itwdf_ * ro, ro = rx, rtws[p + j] = re + ro, itws[p + j] = ie + io, rtws[p + j + s] = re - ro, itws[p + j + s] = ie - io, j !== l && (rx = rtwdf * rtwdf_ - itwdf * itwdf_, itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_, rtwdf_ = rx);\n }\n }, FFTM.prototype.guessLen13b = function(n, m) {\n var N = Math.max(m, n) | 1, odd = N & 1, i = 0;\n for (N = N / 2 | 0;N; N = N >>> 1)\n i++;\n return 1 << i + 1 + odd;\n }, FFTM.prototype.conjugate = function(rws, iws, N) {\n if (!(N <= 1))\n for (var i = 0;i < N / 2; i++) {\n var t = rws[i];\n rws[i] = rws[N - i - 1], rws[N - i - 1] = t, t = iws[i], iws[i] = -iws[N - i - 1], iws[N - i - 1] = -t;\n }\n }, FFTM.prototype.normalize13b = function(ws, N) {\n for (var carry = 0, i = 0;i < N / 2; i++) {\n var w = Math.round(ws[2 * i + 1] / N) * 8192 + Math.round(ws[2 * i] / N) + carry;\n ws[i] = w & 67108863, w < 67108864 \? carry = 0 : carry = w / 67108864 | 0;\n }\n return ws;\n }, FFTM.prototype.convert13b = function(ws, len, rws, N) {\n for (var carry = 0, i = 0;i < len; i++)\n carry = carry + (ws[i] | 0), rws[2 * i] = carry & 8191, carry = carry >>> 13, rws[2 * i + 1] = carry & 8191, carry = carry >>> 13;\n for (i = 2 * len;i < N; ++i)\n rws[i] = 0;\n assert(carry === 0), assert((carry & -8192) === 0);\n }, FFTM.prototype.stub = function(N) {\n for (var ph = new @Array(N), i = 0;i < N; i++)\n ph[i] = 0;\n return ph;\n }, FFTM.prototype.mulp = function(x, y, out) {\n var N = 2 * this.guessLen13b(x.length, y.length), rbt = this.makeRBT(N), _ = this.stub(N), rws = new @Array(N), rwst = new @Array(N), iwst = new @Array(N), nrws = new @Array(N), nrwst = new @Array(N), niwst = new @Array(N), rmws = out.words;\n rmws.length = N, this.convert13b(x.words, x.length, rws, N), this.convert13b(y.words, y.length, nrws, N), this.transform(rws, _, rwst, iwst, N, rbt), this.transform(nrws, _, nrwst, niwst, N, rbt);\n for (var i = 0;i < N; i++) {\n var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];\n iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i], rwst[i] = rx;\n }\n return this.conjugate(rwst, iwst, N), this.transform(rwst, iwst, rmws, _, N, rbt), this.conjugate(rmws, _, N), this.normalize13b(rmws, N), out.negative = x.negative ^ y.negative, out.length = x.length + y.length, out.strip();\n }, BN.prototype.mul = function(num) {\n var out = new BN(null);\n return out.words = new @Array(this.length + num.length), this.mulTo(num, out);\n }, BN.prototype.mulf = function(num) {\n var out = new BN(null);\n return out.words = new @Array(this.length + num.length), jumboMulTo(this, num, out);\n }, BN.prototype.imul = function(num) {\n return this.clone().mulTo(num, this);\n }, BN.prototype.imuln = function(num) {\n assert(typeof num == \"number\"), assert(num < 67108864);\n for (var carry = 0, i = 0;i < this.length; i++) {\n var w = (this.words[i] | 0) * num, lo = (w & 67108863) + (carry & 67108863);\n carry >>= 26, carry += w / 67108864 | 0, carry += lo >>> 26, this.words[i] = lo & 67108863;\n }\n return carry !== 0 && (this.words[i] = carry, this.length++), this;\n }, BN.prototype.muln = function(num) {\n return this.clone().imuln(num);\n }, BN.prototype.sqr = function() {\n return this.mul(this);\n }, BN.prototype.isqr = function() {\n return this.imul(this.clone());\n }, BN.prototype.pow = function(num) {\n var w = toBitArray(num);\n if (w.length === 0)\n return new BN(1);\n for (var res = this, i = 0;i < w.length && w[i] === 0; i++, res = res.sqr())\n ;\n if (++i < w.length)\n for (var q = res.sqr();i < w.length; i++, q = q.sqr())\n w[i] !== 0 && (res = res.mul(q));\n return res;\n }, BN.prototype.iushln = function(bits) {\n assert(typeof bits == \"number\" && bits >= 0);\n var r = bits % 26, s = (bits - r) / 26, carryMask = 67108863 >>> 26 - r << 26 - r, i;\n if (r !== 0) {\n var carry = 0;\n for (i = 0;i < this.length; i++) {\n var newCarry = this.words[i] & carryMask, c = (this.words[i] | 0) - newCarry << r;\n this.words[i] = c | carry, carry = newCarry >>> 26 - r;\n }\n carry && (this.words[i] = carry, this.length++);\n }\n if (s !== 0) {\n for (i = this.length - 1;i >= 0; i--)\n this.words[i + s] = this.words[i];\n for (i = 0;i < s; i++)\n this.words[i] = 0;\n this.length += s;\n }\n return this.strip();\n }, BN.prototype.ishln = function(bits) {\n return assert(this.negative === 0), this.iushln(bits);\n }, BN.prototype.iushrn = function(bits, hint, extended) {\n assert(typeof bits == \"number\" && bits >= 0);\n var h;\n hint \? h = (hint - hint % 26) / 26 : h = 0;\n var r = bits % 26, s = Math.min((bits - r) / 26, this.length), mask = 67108863 ^ 67108863 >>> r << r, maskedWords = extended;\n if (h -= s, h = Math.max(0, h), maskedWords) {\n for (var i = 0;i < s; i++)\n maskedWords.words[i] = this.words[i];\n maskedWords.length = s;\n }\n if (s !== 0)\n if (this.length > s)\n for (this.length -= s, i = 0;i < this.length; i++)\n this.words[i] = this.words[i + s];\n else\n this.words[0] = 0, this.length = 1;\n var carry = 0;\n for (i = this.length - 1;i >= 0 && (carry !== 0 || i >= h); i--) {\n var word = this.words[i] | 0;\n this.words[i] = carry << 26 - r | word >>> r, carry = word & mask;\n }\n return maskedWords && carry !== 0 && (maskedWords.words[maskedWords.length++] = carry), this.length === 0 && (this.words[0] = 0, this.length = 1), this.strip();\n }, BN.prototype.ishrn = function(bits, hint, extended) {\n return assert(this.negative === 0), this.iushrn(bits, hint, extended);\n }, BN.prototype.shln = function(bits) {\n return this.clone().ishln(bits);\n }, BN.prototype.ushln = function(bits) {\n return this.clone().iushln(bits);\n }, BN.prototype.shrn = function(bits) {\n return this.clone().ishrn(bits);\n }, BN.prototype.ushrn = function(bits) {\n return this.clone().iushrn(bits);\n }, BN.prototype.testn = function(bit) {\n assert(typeof bit == \"number\" && bit >= 0);\n var r = bit % 26, s = (bit - r) / 26, q = 1 << r;\n if (this.length <= s)\n return !1;\n var w = this.words[s];\n return !!(w & q);\n }, BN.prototype.imaskn = function(bits) {\n assert(typeof bits == \"number\" && bits >= 0);\n var r = bits % 26, s = (bits - r) / 26;\n if (assert(this.negative === 0, \"imaskn works only with positive numbers\"), this.length <= s)\n return this;\n if (r !== 0 && s++, this.length = Math.min(s, this.length), r !== 0) {\n var mask = 67108863 ^ 67108863 >>> r << r;\n this.words[this.length - 1] &= mask;\n }\n return this.strip();\n }, BN.prototype.maskn = function(bits) {\n return this.clone().imaskn(bits);\n }, BN.prototype.iaddn = function(num) {\n return assert(typeof num == \"number\"), assert(num < 67108864), num < 0 \? this.isubn(-num) : this.negative !== 0 \? this.length === 1 && (this.words[0] | 0) < num \? (this.words[0] = num - (this.words[0] | 0), this.negative = 0, this) : (this.negative = 0, this.isubn(num), this.negative = 1, this) : this._iaddn(num);\n }, BN.prototype._iaddn = function(num) {\n this.words[0] += num;\n for (var i = 0;i < this.length && this.words[i] >= 67108864; i++)\n this.words[i] -= 67108864, i === this.length - 1 \? this.words[i + 1] = 1 : this.words[i + 1]++;\n return this.length = Math.max(this.length, i + 1), this;\n }, BN.prototype.isubn = function(num) {\n if (assert(typeof num == \"number\"), assert(num < 67108864), num < 0)\n return this.iaddn(-num);\n if (this.negative !== 0)\n return this.negative = 0, this.iaddn(num), this.negative = 1, this;\n if (this.words[0] -= num, this.length === 1 && this.words[0] < 0)\n this.words[0] = -this.words[0], this.negative = 1;\n else\n for (var i = 0;i < this.length && this.words[i] < 0; i++)\n this.words[i] += 67108864, this.words[i + 1] -= 1;\n return this.strip();\n }, BN.prototype.addn = function(num) {\n return this.clone().iaddn(num);\n }, BN.prototype.subn = function(num) {\n return this.clone().isubn(num);\n }, BN.prototype.iabs = function() {\n return this.negative = 0, this;\n }, BN.prototype.abs = function() {\n return this.clone().iabs();\n }, BN.prototype._ishlnsubmul = function(num, mul, shift) {\n var len = num.length + shift, i;\n this._expand(len);\n var w, carry = 0;\n for (i = 0;i < num.length; i++) {\n w = (this.words[i + shift] | 0) + carry;\n var right = (num.words[i] | 0) * mul;\n w -= right & 67108863, carry = (w >> 26) - (right / 67108864 | 0), this.words[i + shift] = w & 67108863;\n }\n for (;i < this.length - shift; i++)\n w = (this.words[i + shift] | 0) + carry, carry = w >> 26, this.words[i + shift] = w & 67108863;\n if (carry === 0)\n return this.strip();\n for (assert(carry === -1), carry = 0, i = 0;i < this.length; i++)\n w = -(this.words[i] | 0) + carry, carry = w >> 26, this.words[i] = w & 67108863;\n return this.negative = 1, this.strip();\n }, BN.prototype._wordDiv = function(num, mode) {\n var shift = this.length - num.length, a = this.clone(), b = num, bhi = b.words[b.length - 1] | 0, bhiBits = this._countBits(bhi);\n shift = 26 - bhiBits, shift !== 0 && (b = b.ushln(shift), a.iushln(shift), bhi = b.words[b.length - 1] | 0);\n var m = a.length - b.length, q;\n if (mode !== \"mod\") {\n q = new BN(null), q.length = m + 1, q.words = new @Array(q.length);\n for (var i = 0;i < q.length; i++)\n q.words[i] = 0;\n }\n var diff = a.clone()._ishlnsubmul(b, 1, m);\n diff.negative === 0 && (a = diff, q && (q.words[m] = 1));\n for (var j = m - 1;j >= 0; j--) {\n var qj = (a.words[b.length + j] | 0) * 67108864 + (a.words[b.length + j - 1] | 0);\n for (qj = Math.min(qj / bhi | 0, 67108863), a._ishlnsubmul(b, qj, j);a.negative !== 0; )\n qj--, a.negative = 0, a._ishlnsubmul(b, 1, j), a.isZero() || (a.negative ^= 1);\n q && (q.words[j] = qj);\n }\n return q && q.strip(), a.strip(), mode !== \"div\" && shift !== 0 && a.iushrn(shift), {\n div: q || null,\n mod: a\n };\n }, BN.prototype.divmod = function(num, mode, positive) {\n if (assert(!num.isZero()), this.isZero())\n return {\n div: new BN(0),\n mod: new BN(0)\n };\n var div, mod, res;\n return this.negative !== 0 && num.negative === 0 \? (res = this.neg().divmod(num, mode), mode !== \"mod\" && (div = res.div.neg()), mode !== \"div\" && (mod = res.mod.neg(), positive && mod.negative !== 0 && mod.iadd(num)), {\n div,\n mod\n }) : this.negative === 0 && num.negative !== 0 \? (res = this.divmod(num.neg(), mode), mode !== \"mod\" && (div = res.div.neg()), {\n div,\n mod: res.mod\n }) : (this.negative & num.negative) !== 0 \? (res = this.neg().divmod(num.neg(), mode), mode !== \"div\" && (mod = res.mod.neg(), positive && mod.negative !== 0 && mod.isub(num)), {\n div: res.div,\n mod\n }) : num.length > this.length || this.cmp(num) < 0 \? {\n div: new BN(0),\n mod: this\n } : num.length === 1 \? mode === \"div\" \? {\n div: this.divn(num.words[0]),\n mod: null\n } : mode === \"mod\" \? {\n div: null,\n mod: new BN(this.modn(num.words[0]))\n } : {\n div: this.divn(num.words[0]),\n mod: new BN(this.modn(num.words[0]))\n } : this._wordDiv(num, mode);\n }, BN.prototype.div = function(num) {\n return this.divmod(num, \"div\", !1).div;\n }, BN.prototype.mod = function(num) {\n return this.divmod(num, \"mod\", !1).mod;\n }, BN.prototype.umod = function(num) {\n return this.divmod(num, \"mod\", !0).mod;\n }, BN.prototype.divRound = function(num) {\n var dm = this.divmod(num);\n if (dm.mod.isZero())\n return dm.div;\n var mod = dm.div.negative !== 0 \? dm.mod.isub(num) : dm.mod, half = num.ushrn(1), r2 = num.andln(1), cmp = mod.cmp(half);\n return cmp < 0 || r2 === 1 && cmp === 0 \? dm.div : dm.div.negative !== 0 \? dm.div.isubn(1) : dm.div.iaddn(1);\n }, BN.prototype.modn = function(num) {\n assert(num <= 67108863);\n for (var p = (1 << 26) % num, acc = 0, i = this.length - 1;i >= 0; i--)\n acc = (p * acc + (this.words[i] | 0)) % num;\n return acc;\n }, BN.prototype.idivn = function(num) {\n assert(num <= 67108863);\n for (var carry = 0, i = this.length - 1;i >= 0; i--) {\n var w = (this.words[i] | 0) + carry * 67108864;\n this.words[i] = w / num | 0, carry = w % num;\n }\n return this.strip();\n }, BN.prototype.divn = function(num) {\n return this.clone().idivn(num);\n }, BN.prototype.egcd = function(p) {\n assert(p.negative === 0), assert(!p.isZero());\n var x = this, y = p.clone();\n x.negative !== 0 \? x = x.umod(p) : x = x.clone();\n for (var A = new BN(1), B = new BN(0), C = new BN(0), D = new BN(1), g = 0;x.isEven() && y.isEven(); )\n x.iushrn(1), y.iushrn(1), ++g;\n for (var yp = y.clone(), xp = x.clone();!x.isZero(); ) {\n for (var i = 0, im = 1;(x.words[0] & im) === 0 && i < 26; ++i, im <<= 1)\n ;\n if (i > 0)\n for (x.iushrn(i);i-- > 0; )\n (A.isOdd() || B.isOdd()) && (A.iadd(yp), B.isub(xp)), A.iushrn(1), B.iushrn(1);\n for (var j = 0, jm = 1;(y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1)\n ;\n if (j > 0)\n for (y.iushrn(j);j-- > 0; )\n (C.isOdd() || D.isOdd()) && (C.iadd(yp), D.isub(xp)), C.iushrn(1), D.iushrn(1);\n x.cmp(y) >= 0 \? (x.isub(y), A.isub(C), B.isub(D)) : (y.isub(x), C.isub(A), D.isub(B));\n }\n return {\n a: C,\n b: D,\n gcd: y.iushln(g)\n };\n }, BN.prototype._invmp = function(p) {\n assert(p.negative === 0), assert(!p.isZero());\n var a = this, b = p.clone();\n a.negative !== 0 \? a = a.umod(p) : a = a.clone();\n for (var x1 = new BN(1), x2 = new BN(0), delta = b.clone();a.cmpn(1) > 0 && b.cmpn(1) > 0; ) {\n for (var i = 0, im = 1;(a.words[0] & im) === 0 && i < 26; ++i, im <<= 1)\n ;\n if (i > 0)\n for (a.iushrn(i);i-- > 0; )\n x1.isOdd() && x1.iadd(delta), x1.iushrn(1);\n for (var j = 0, jm = 1;(b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1)\n ;\n if (j > 0)\n for (b.iushrn(j);j-- > 0; )\n x2.isOdd() && x2.iadd(delta), x2.iushrn(1);\n a.cmp(b) >= 0 \? (a.isub(b), x1.isub(x2)) : (b.isub(a), x2.isub(x1));\n }\n var res;\n return a.cmpn(1) === 0 \? res = x1 : res = x2, res.cmpn(0) < 0 && res.iadd(p), res;\n }, BN.prototype.gcd = function(num) {\n if (this.isZero())\n return num.abs();\n if (num.isZero())\n return this.abs();\n var a = this.clone(), b = num.clone();\n a.negative = 0, b.negative = 0;\n for (var shift = 0;a.isEven() && b.isEven(); shift++)\n a.iushrn(1), b.iushrn(1);\n do {\n for (;a.isEven(); )\n a.iushrn(1);\n for (;b.isEven(); )\n b.iushrn(1);\n var r = a.cmp(b);\n if (r < 0) {\n var t = a;\n a = b, b = t;\n } else if (r === 0 || b.cmpn(1) === 0)\n break;\n a.isub(b);\n } while (!0);\n return b.iushln(shift);\n }, BN.prototype.invm = function(num) {\n return this.egcd(num).a.umod(num);\n }, BN.prototype.isEven = function() {\n return (this.words[0] & 1) === 0;\n }, BN.prototype.isOdd = function() {\n return (this.words[0] & 1) === 1;\n }, BN.prototype.andln = function(num) {\n return this.words[0] & num;\n }, BN.prototype.bincn = function(bit) {\n assert(typeof bit == \"number\");\n var r = bit % 26, s = (bit - r) / 26, q = 1 << r;\n if (this.length <= s)\n return this._expand(s + 1), this.words[s] |= q, this;\n for (var carry = q, i = s;carry !== 0 && i < this.length; i++) {\n var w = this.words[i] | 0;\n w += carry, carry = w >>> 26, w &= 67108863, this.words[i] = w;\n }\n return carry !== 0 && (this.words[i] = carry, this.length++), this;\n }, BN.prototype.isZero = function() {\n return this.length === 1 && this.words[0] === 0;\n }, BN.prototype.cmpn = function(num) {\n var negative = num < 0;\n if (this.negative !== 0 && !negative)\n return -1;\n if (this.negative === 0 && negative)\n return 1;\n this.strip();\n var res;\n if (this.length > 1)\n res = 1;\n else {\n negative && (num = -num), assert(num <= 67108863, \"Number is too big\");\n var w = this.words[0] | 0;\n res = w === num \? 0 : w < num \? -1 : 1;\n }\n return this.negative !== 0 \? -res | 0 : res;\n }, BN.prototype.cmp = function(num) {\n if (this.negative !== 0 && num.negative === 0)\n return -1;\n if (this.negative === 0 && num.negative !== 0)\n return 1;\n var res = this.ucmp(num);\n return this.negative !== 0 \? -res | 0 : res;\n }, BN.prototype.ucmp = function(num) {\n if (this.length > num.length)\n return 1;\n if (this.length < num.length)\n return -1;\n for (var res = 0, i = this.length - 1;i >= 0; i--) {\n var a = this.words[i] | 0, b = num.words[i] | 0;\n if (a !== b) {\n a < b \? res = -1 : a > b && (res = 1);\n break;\n }\n }\n return res;\n }, BN.prototype.gtn = function(num) {\n return this.cmpn(num) === 1;\n }, BN.prototype.gt = function(num) {\n return this.cmp(num) === 1;\n }, BN.prototype.gten = function(num) {\n return this.cmpn(num) >= 0;\n }, BN.prototype.gte = function(num) {\n return this.cmp(num) >= 0;\n }, BN.prototype.ltn = function(num) {\n return this.cmpn(num) === -1;\n }, BN.prototype.lt = function(num) {\n return this.cmp(num) === -1;\n }, BN.prototype.lten = function(num) {\n return this.cmpn(num) <= 0;\n }, BN.prototype.lte = function(num) {\n return this.cmp(num) <= 0;\n }, BN.prototype.eqn = function(num) {\n return this.cmpn(num) === 0;\n }, BN.prototype.eq = function(num) {\n return this.cmp(num) === 0;\n }, BN.red = function(num) {\n return new Red(num);\n }, BN.prototype.toRed = function(ctx) {\n return assert(!this.red, \"Already a number in reduction context\"), assert(this.negative === 0, \"red works only with positives\"), ctx.convertTo(this)._forceRed(ctx);\n }, BN.prototype.fromRed = function() {\n return assert(this.red, \"fromRed works only with numbers in reduction context\"), this.red.convertFrom(this);\n }, BN.prototype._forceRed = function(ctx) {\n return this.red = ctx, this;\n }, BN.prototype.forceRed = function(ctx) {\n return assert(!this.red, \"Already a number in reduction context\"), this._forceRed(ctx);\n }, BN.prototype.redAdd = function(num) {\n return assert(this.red, \"redAdd works only with red numbers\"), this.red.add(this, num);\n }, BN.prototype.redIAdd = function(num) {\n return assert(this.red, \"redIAdd works only with red numbers\"), this.red.iadd(this, num);\n }, BN.prototype.redSub = function(num) {\n return assert(this.red, \"redSub works only with red numbers\"), this.red.sub(this, num);\n }, BN.prototype.redISub = function(num) {\n return assert(this.red, \"redISub works only with red numbers\"), this.red.isub(this, num);\n }, BN.prototype.redShl = function(num) {\n return assert(this.red, \"redShl works only with red numbers\"), this.red.shl(this, num);\n }, BN.prototype.redMul = function(num) {\n return assert(this.red, \"redMul works only with red numbers\"), this.red._verify2(this, num), this.red.mul(this, num);\n }, BN.prototype.redIMul = function(num) {\n return assert(this.red, \"redMul works only with red numbers\"), this.red._verify2(this, num), this.red.imul(this, num);\n }, BN.prototype.redSqr = function() {\n return assert(this.red, \"redSqr works only with red numbers\"), this.red._verify1(this), this.red.sqr(this);\n }, BN.prototype.redISqr = function() {\n return assert(this.red, \"redISqr works only with red numbers\"), this.red._verify1(this), this.red.isqr(this);\n }, BN.prototype.redSqrt = function() {\n return assert(this.red, \"redSqrt works only with red numbers\"), this.red._verify1(this), this.red.sqrt(this);\n }, BN.prototype.redInvm = function() {\n return assert(this.red, \"redInvm works only with red numbers\"), this.red._verify1(this), this.red.invm(this);\n }, BN.prototype.redNeg = function() {\n return assert(this.red, \"redNeg works only with red numbers\"), this.red._verify1(this), this.red.neg(this);\n }, BN.prototype.redPow = function(num) {\n return assert(this.red && !num.red, \"redPow(normalNum)\"), this.red._verify1(this), this.red.pow(this, num);\n };\n var primes = {\n k256: null,\n p224: null,\n p192: null,\n p25519: null\n };\n function MPrime(name, p) {\n this.name = name, this.p = new BN(p, 16), this.n = this.p.bitLength(), this.k = new BN(1).iushln(this.n).isub(this.p), this.tmp = this._tmp();\n }\n MPrime.prototype = {}, MPrime.prototype._tmp = function() {\n var tmp = new BN(null);\n return tmp.words = new @Array(Math.ceil(this.n / 13)), tmp;\n }, MPrime.prototype.ireduce = function(num) {\n var r = num, rlen;\n do\n this.split(r, this.tmp), r = this.imulK(r), r = r.iadd(this.tmp), rlen = r.bitLength();\n while (rlen > this.n);\n var cmp = rlen < this.n \? -1 : r.ucmp(this.p);\n return cmp === 0 \? (r.words[0] = 0, r.length = 1) : cmp > 0 \? r.isub(this.p) : r.strip !== void 0 \? r.strip() : r._strip(), r;\n }, MPrime.prototype.split = function(input, out) {\n input.iushrn(this.n, 0, out);\n }, MPrime.prototype.imulK = function(num) {\n return num.imul(this.k);\n };\n function K256() {\n MPrime.@call(this, \"k256\", \"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f\");\n }\n inherits(K256, MPrime), K256.prototype.split = function(input, output) {\n for (var mask = 4194303, outLen = Math.min(input.length, 9), i = 0;i < outLen; i++)\n output.words[i] = input.words[i];\n if (output.length = outLen, input.length <= 9) {\n input.words[0] = 0, input.length = 1;\n return;\n }\n var prev = input.words[9];\n for (output.words[output.length++] = prev & mask, i = 10;i < input.length; i++) {\n var next = input.words[i] | 0;\n input.words[i - 10] = (next & mask) << 4 | prev >>> 22, prev = next;\n }\n prev >>>= 22, input.words[i - 10] = prev, prev === 0 && input.length > 10 \? input.length -= 10 : input.length -= 9;\n }, K256.prototype.imulK = function(num) {\n num.words[num.length] = 0, num.words[num.length + 1] = 0, num.length += 2;\n for (var lo = 0, i = 0;i < num.length; i++) {\n var w = num.words[i] | 0;\n lo += w * 977, num.words[i] = lo & 67108863, lo = w * 64 + (lo / 67108864 | 0);\n }\n return num.words[num.length - 1] === 0 && (num.length--, num.words[num.length - 1] === 0 && num.length--), num;\n };\n function P224() {\n MPrime.@call(this, \"p224\", \"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001\");\n }\n inherits(P224, MPrime);\n function P192() {\n MPrime.@call(this, \"p192\", \"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff\");\n }\n inherits(P192, MPrime);\n function P25519() {\n MPrime.@call(this, \"25519\", \"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed\");\n }\n inherits(P25519, MPrime), P25519.prototype.imulK = function(num) {\n for (var carry = 0, i = 0;i < num.length; i++) {\n var hi = (num.words[i] | 0) * 19 + carry, lo = hi & 67108863;\n hi >>>= 26, num.words[i] = lo, carry = hi;\n }\n return carry !== 0 && (num.words[num.length++] = carry), num;\n }, BN._prime = function(name) {\n if (primes[name])\n return primes[name];\n var prime2;\n if (name === \"k256\")\n prime2 = new K256;\n else if (name === \"p224\")\n prime2 = new P224;\n else if (name === \"p192\")\n prime2 = new P192;\n else if (name === \"p25519\")\n prime2 = new P25519;\n else\n throw new Error(\"Unknown prime \" + name);\n return primes[name] = prime2, prime2;\n };\n function Red(m) {\n if (typeof m == \"string\") {\n var prime = BN._prime(m);\n this.m = prime.p, this.prime = prime;\n } else\n assert(m.gtn(1), \"modulus must be greater than 1\"), this.m = m, this.prime = null;\n }\n Red.prototype = {}, Red.prototype._verify1 = function(a) {\n assert(a.negative === 0, \"red works only with positives\"), assert(a.red, \"red works only with red numbers\");\n }, Red.prototype._verify2 = function(a, b) {\n assert((a.negative | b.negative) === 0, \"red works only with positives\"), assert(a.red && a.red === b.red, \"red works only with red numbers\");\n }, Red.prototype.imod = function(a) {\n return this.prime \? this.prime.ireduce(a)._forceRed(this) : a.umod(this.m)._forceRed(this);\n }, Red.prototype.neg = function(a) {\n return a.isZero() \? a.clone() : this.m.sub(a)._forceRed(this);\n }, Red.prototype.add = function(a, b) {\n this._verify2(a, b);\n var res = a.add(b);\n return res.cmp(this.m) >= 0 && res.isub(this.m), res._forceRed(this);\n }, Red.prototype.iadd = function(a, b) {\n this._verify2(a, b);\n var res = a.iadd(b);\n return res.cmp(this.m) >= 0 && res.isub(this.m), res;\n }, Red.prototype.sub = function(a, b) {\n this._verify2(a, b);\n var res = a.sub(b);\n return res.cmpn(0) < 0 && res.iadd(this.m), res._forceRed(this);\n }, Red.prototype.isub = function(a, b) {\n this._verify2(a, b);\n var res = a.isub(b);\n return res.cmpn(0) < 0 && res.iadd(this.m), res;\n }, Red.prototype.shl = function(a, num) {\n return this._verify1(a), this.imod(a.ushln(num));\n }, Red.prototype.imul = function(a, b) {\n return this._verify2(a, b), this.imod(a.imul(b));\n }, Red.prototype.mul = function(a, b) {\n return this._verify2(a, b), this.imod(a.mul(b));\n }, Red.prototype.isqr = function(a) {\n return this.imul(a, a.clone());\n }, Red.prototype.sqr = function(a) {\n return this.mul(a, a);\n }, Red.prototype.sqrt = function(a) {\n if (a.isZero())\n return a.clone();\n var mod3 = this.m.andln(3);\n if (assert(mod3 % 2 === 1), mod3 === 3) {\n var pow = this.m.add(new BN(1)).iushrn(2);\n return this.pow(a, pow);\n }\n for (var q = this.m.subn(1), s = 0;!q.isZero() && q.andln(1) === 0; )\n s++, q.iushrn(1);\n assert(!q.isZero());\n var one = new BN(1).toRed(this), nOne = one.redNeg(), lpow = this.m.subn(1).iushrn(1), z = this.m.bitLength();\n for (z = new BN(2 * z * z).toRed(this);this.pow(z, lpow).cmp(nOne) !== 0; )\n z.redIAdd(nOne);\n for (var c = this.pow(z, q), r = this.pow(a, q.addn(1).iushrn(1)), t = this.pow(a, q), m = s;t.cmp(one) !== 0; ) {\n for (var tmp = t, i = 0;tmp.cmp(one) !== 0; i++)\n tmp = tmp.redSqr();\n assert(i < m);\n var b = this.pow(c, new BN(1).iushln(m - i - 1));\n r = r.redMul(b), c = b.redSqr(), t = t.redMul(c), m = i;\n }\n return r;\n }, Red.prototype.invm = function(a) {\n var inv = a._invmp(this.m);\n return inv.negative !== 0 \? (inv.negative = 0, this.imod(inv).redNeg()) : this.imod(inv);\n }, Red.prototype.pow = function(a, num) {\n if (num.isZero())\n return new BN(1).toRed(this);\n if (num.cmpn(1) === 0)\n return a.clone();\n var windowSize = 4, wnd = new @Array(1 << windowSize);\n wnd[0] = new BN(1).toRed(this), wnd[1] = a;\n for (var i = 2;i < wnd.length; i++)\n wnd[i] = this.mul(wnd[i - 1], a);\n var res = wnd[0], current = 0, currentLen = 0, start = num.bitLength() % 26;\n for (start === 0 && (start = 26), i = num.length - 1;i >= 0; i--) {\n for (var word = num.words[i], j = start - 1;j >= 0; j--) {\n var bit = word >> j & 1;\n if (res !== wnd[0] && (res = this.sqr(res)), bit === 0 && current === 0) {\n currentLen = 0;\n continue;\n }\n current <<= 1, current |= bit, currentLen++, !(currentLen !== windowSize && (i !== 0 || j !== 0)) && (res = this.mul(res, wnd[current]), currentLen = 0, current = 0);\n }\n start = 26;\n }\n return res;\n }, Red.prototype.convertTo = function(num) {\n var r = num.umod(this.m);\n return r === num \? r.clone() : r;\n }, Red.prototype.convertFrom = function(num) {\n var res = num.clone();\n return res.red = null, res;\n }, BN.mont = function(num) {\n return new Mont(num);\n };\n function Mont(m) {\n Red.@call(this, m), this.shift = this.m.bitLength(), this.shift % 26 !== 0 && (this.shift += 26 - this.shift % 26), this.r = new BN(1).iushln(this.shift), this.r2 = this.imod(this.r.sqr()), this.rinv = this.r._invmp(this.m), this.minv = this.rinv.mul(this.r).isubn(1).div(this.m), this.minv = this.minv.umod(this.r), this.minv = this.r.sub(this.minv);\n }\n inherits(Mont, Red), Mont.prototype.convertTo = function(num) {\n return this.imod(num.ushln(this.shift));\n }, Mont.prototype.convertFrom = function(num) {\n var r = this.imod(num.mul(this.rinv));\n return r.red = null, r;\n }, Mont.prototype.imul = function(a, b) {\n if (a.isZero() || b.isZero())\n return a.words[0] = 0, a.length = 1, a;\n var t = a.imul(b), c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), u = t.isub(c).iushrn(this.shift), res = u;\n return u.cmp(this.m) >= 0 \? res = u.isub(this.m) : u.cmpn(0) < 0 && (res = u.iadd(this.m)), res._forceRed(this);\n }, Mont.prototype.mul = function(a, b) {\n if (a.isZero() || b.isZero())\n return new BN(0)._forceRed(this);\n var t = a.mul(b), c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), u = t.isub(c).iushrn(this.shift), res = u;\n return u.cmp(this.m) >= 0 \? res = u.isub(this.m) : u.cmpn(0) < 0 && (res = u.iadd(this.m)), res._forceRed(this);\n }, Mont.prototype.invm = function(a) {\n var res = this.imod(a._invmp(this.m).mul(this.r2));\n return res._forceRed(this);\n };\n })(typeof module > \"u\" || module, exports);\n }\n}), require_bn2 = require_bn, require_brorand = __commonJS({\n \"node_modules/brorand/index.js\"(exports, module) {\n var r;\n module.exports = function(len) {\n return r || (r = new Rand(null)), r.generate(len);\n };\n function Rand(rand) {\n this.rand = rand;\n }\n Rand.prototype = {}, module.exports.Rand = Rand, Rand.prototype.generate = function(len) {\n return this._rand(len);\n }, Rand.prototype._rand = function(n) {\n var out = new Buffer(n);\n return crypto.getRandomValues(out), out;\n };\n }\n}), require_mr = __commonJS({\n \"node_modules/miller-rabin/lib/mr.js\"(exports, module) {\n var bn = require_bn2(), brorand = require_brorand();\n function MillerRabin(rand) {\n this.rand = rand || new brorand.Rand;\n }\n module.exports = MillerRabin, MillerRabin.create = function(rand) {\n return new MillerRabin(rand);\n }, MillerRabin.prototype = {}, MillerRabin.prototype._randbelow = function(n) {\n var len = n.bitLength(), min_bytes = Math.ceil(len / 8);\n do\n var a = new bn(this.rand.generate(min_bytes));\n while (a.cmp(n) >= 0);\n return a;\n }, MillerRabin.prototype._randrange = function(start, stop) {\n var size = stop.sub(start);\n return start.add(this._randbelow(size));\n }, MillerRabin.prototype.test = function(n, k, cb) {\n var len = n.bitLength(), red = bn.mont(n), rone = new bn(1).toRed(red);\n k || (k = Math.max(1, len / 48 | 0));\n for (var n1 = n.subn(1), s = 0;!n1.testn(s); s++)\n ;\n for (var d = n.shrn(s), rn1 = n1.toRed(red), prime = !0;k > 0; k--) {\n var a = this._randrange(new bn(2), n1);\n cb && cb(a);\n var x = a.toRed(red).redPow(d);\n if (!(x.cmp(rone) === 0 || x.cmp(rn1) === 0)) {\n for (var i = 1;i < s; i++) {\n if (x = x.redSqr(), x.cmp(rone) === 0)\n return !1;\n if (x.cmp(rn1) === 0)\n break;\n }\n if (i === s)\n return !1;\n }\n }\n return prime;\n }, MillerRabin.prototype.getDivisor = function(n, k) {\n var len = n.bitLength(), red = bn.mont(n), rone = new bn(1).toRed(red);\n k || (k = Math.max(1, len / 48 | 0));\n for (var n1 = n.subn(1), s = 0;!n1.testn(s); s++)\n ;\n for (var d = n.shrn(s), rn1 = n1.toRed(red);k > 0; k--) {\n var a = this._randrange(new bn(2), n1), g = n.gcd(a);\n if (g.cmpn(1) !== 0)\n return g;\n var x = a.toRed(red).redPow(d);\n if (!(x.cmp(rone) === 0 || x.cmp(rn1) === 0)) {\n for (var i = 1;i < s; i++) {\n if (x = x.redSqr(), x.cmp(rone) === 0)\n return x.fromRed().subn(1).gcd(n);\n if (x.cmp(rn1) === 0)\n break;\n }\n if (i === s)\n return x = x.redSqr(), x.fromRed().subn(1).gcd(n);\n }\n }\n return !1;\n };\n }\n}), require_generatePrime = __commonJS({\n \"node_modules/diffie-hellman/lib/generatePrime.js\"(exports, module) {\n var randomBytes = require_browser();\n module.exports = findPrime, findPrime.simpleSieve = simpleSieve, findPrime.fermatTest = fermatTest;\n var BN = require_bn(), TWENTYFOUR = new BN(24), MillerRabin = require_mr(), millerRabin = new MillerRabin, ONE = new BN(1), TWO = new BN(2), FIVE = new BN(5), SIXTEEN = new BN(16), EIGHT = new BN(8), TEN = new BN(10), THREE = new BN(3), SEVEN = new BN(7), ELEVEN = new BN(11), FOUR = new BN(4), TWELVE = new BN(12), primes = null;\n function _getPrimes() {\n if (primes !== null)\n return primes;\n var limit = 1048576, res = [];\n res[0] = 2;\n for (var i = 1, k = 3;k < limit; k += 2) {\n for (var sqrt = Math.ceil(Math.sqrt(k)), j = 0;j < i && res[j] <= sqrt && k % res[j] !== 0; j++)\n ;\n i !== j && res[j] <= sqrt || (res[i++] = k);\n }\n return primes = res, res;\n }\n function simpleSieve(p) {\n for (var primes2 = _getPrimes(), i = 0;i < primes2.length; i++)\n if (p.modn(primes2[i]) === 0)\n return p.cmpn(primes2[i]) === 0;\n return !0;\n }\n function fermatTest(p) {\n var red = BN.mont(p);\n return TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1) === 0;\n }\n function findPrime(bits, gen) {\n if (bits < 16)\n return gen === 2 || gen === 5 \? new BN([140, 123]) : new BN([140, 39]);\n gen = new BN(gen);\n for (var num, n2;; ) {\n for (num = new BN(randomBytes(Math.ceil(bits / 8)));num.bitLength() > bits; )\n num.ishrn(1);\n if (num.isEven() && num.iadd(ONE), num.testn(1) || num.iadd(TWO), gen.cmp(TWO)) {\n if (!gen.cmp(FIVE))\n for (;num.mod(TEN).cmp(THREE); )\n num.iadd(FOUR);\n } else\n for (;num.mod(TWENTYFOUR).cmp(ELEVEN); )\n num.iadd(FOUR);\n if (n2 = num.shrn(1), simpleSieve(n2) && simpleSieve(num) && fermatTest(n2) && fermatTest(num) && millerRabin.test(n2) && millerRabin.test(num))\n return num;\n }\n }\n }\n}), require_primes = __commonJS({\n \"node_modules/diffie-hellman/lib/primes.json\"(exports, module) {\n module.exports = {\n modp1: {\n gen: \"02\",\n prime: \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff\"\n },\n modp2: {\n gen: \"02\",\n prime: \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff\"\n },\n modp5: {\n gen: \"02\",\n prime: \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff\"\n },\n modp14: {\n gen: \"02\",\n prime: \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff\"\n },\n modp15: {\n gen: \"02\",\n prime: \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff\"\n },\n modp16: {\n gen: \"02\",\n prime: \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff\"\n },\n modp17: {\n gen: \"02\",\n prime: \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff\"\n },\n modp18: {\n gen: \"02\",\n prime: \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff\"\n }\n };\n }\n}), require_dh = __commonJS({\n \"node_modules/diffie-hellman/lib/dh.js\"(exports, module) {\n var BN = require_bn(), MillerRabin = require_mr(), millerRabin = new MillerRabin, TWENTYFOUR = new BN(24), ELEVEN = new BN(11), TEN = new BN(10), THREE = new BN(3), SEVEN = new BN(7), primes = require_generatePrime(), randomBytes = require_browser();\n module.exports = DH;\n function setPublicKey(pub, enc) {\n return enc = enc || \"utf8\", Buffer.isBuffer(pub) || (pub = new Buffer(pub, enc)), this._pub = new BN(pub), this;\n }\n function setPrivateKey(priv, enc) {\n return enc = enc || \"utf8\", Buffer.isBuffer(priv) || (priv = new Buffer(priv, enc)), this._priv = new BN(priv), this;\n }\n var primeCache = {};\n function checkPrime(prime, generator) {\n var gen = generator.toString(\"hex\"), hex = [gen, prime.toString(16)].join(\"_\");\n if (hex in primeCache)\n return primeCache[hex];\n var error = 0;\n if (prime.isEven() || !primes.simpleSieve || !primes.fermatTest(prime) || !millerRabin.test(prime))\n return error += 1, gen === \"02\" || gen === \"05\" \? error += 8 : error += 4, primeCache[hex] = error, error;\n millerRabin.test(prime.shrn(1)) || (error += 2);\n var rem;\n switch (gen) {\n case \"02\":\n prime.mod(TWENTYFOUR).cmp(ELEVEN) && (error += 8);\n break;\n case \"05\":\n rem = prime.mod(TEN), rem.cmp(THREE) && rem.cmp(SEVEN) && (error += 8);\n break;\n default:\n error += 4;\n }\n return primeCache[hex] = error, error;\n }\n function DH(prime, generator, malleable) {\n this.setGenerator(generator), this.__prime = new BN(prime), this._prime = BN.mont(this.__prime), this._primeLen = prime.length, this._pub = void 0, this._priv = void 0, this._primeCode = void 0, malleable \? (this.setPublicKey = setPublicKey, this.setPrivateKey = setPrivateKey) : this._primeCode = 8;\n }\n DH.prototype = {}, Object.defineProperty(DH.prototype, \"verifyError\", {\n enumerable: !0,\n get: function() {\n return typeof this._primeCode != \"number\" && (this._primeCode = checkPrime(this.__prime, this.__gen)), this._primeCode;\n }\n }), DH.prototype.generateKeys = function() {\n return this._priv || (this._priv = new BN(randomBytes(this._primeLen))), this._pub = this._gen.toRed(this._prime).redPow(this._priv).fromRed(), this.getPublicKey();\n }, DH.prototype.computeSecret = function(other) {\n other = new BN(other), other = other.toRed(this._prime);\n var secret = other.redPow(this._priv).fromRed(), out = new Buffer(secret.toArray()), prime = this.getPrime();\n if (out.length < prime.length) {\n var front = new Buffer(prime.length - out.length);\n front.fill(0), out = Buffer.concat([front, out]);\n }\n return out;\n }, DH.prototype.getPublicKey = function(enc) {\n return formatReturnValue(this._pub, enc);\n }, DH.prototype.getPrivateKey = function(enc) {\n return formatReturnValue(this._priv, enc);\n }, DH.prototype.getPrime = function(enc) {\n return formatReturnValue(this.__prime, enc);\n }, DH.prototype.getGenerator = function(enc) {\n return formatReturnValue(this._gen, enc);\n }, DH.prototype.setGenerator = function(gen, enc) {\n return enc = enc || \"utf8\", Buffer.isBuffer(gen) || (gen = new Buffer(gen, enc)), this.__gen = gen, this._gen = new BN(gen), this;\n };\n function formatReturnValue(bn, enc) {\n var buf = new Buffer(bn.toArray());\n return enc \? buf.toString(enc) : buf;\n }\n }\n}), require_browser7 = __commonJS({\n \"node_modules/diffie-hellman/browser.js\"(exports) {\n var generatePrime = require_generatePrime(), primes = require_primes(), DH = require_dh();\n function getDiffieHellman(mod) {\n var prime = new Buffer(primes[mod].prime, \"hex\"), gen = new Buffer(primes[mod].gen, \"hex\");\n return new DH(prime, gen);\n }\n var ENCODINGS = {\n binary: !0,\n hex: !0,\n base64: !0\n };\n function createDiffieHellman(prime, enc, generator, genc) {\n return Buffer.isBuffer(enc) || ENCODINGS[enc] === void 0 \? createDiffieHellman(prime, \"binary\", enc, generator) : (enc = enc || \"binary\", genc = genc || \"binary\", generator = generator || new Buffer([2]), Buffer.isBuffer(generator) || (generator = new Buffer(generator, genc)), typeof prime == \"number\" \? new DH(generatePrime(prime, generator), generator, !0) : (Buffer.isBuffer(prime) || (prime = new Buffer(prime, enc)), new DH(prime, generator, !0)));\n }\n exports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffieHellman = getDiffieHellman, exports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman;\n }\n}), require_bn3 = require_bn, require_browserify_rsa = __commonJS({\n \"node_modules/browserify-rsa/index.js\"(exports, module) {\n var BN = require_bn3(), randomBytes = require_browser();\n function blind(priv) {\n var r = getr(priv), blinder = r.toRed(BN.mont(priv.modulus)).redPow(new BN(priv.publicExponent)).fromRed();\n return { blinder, unblinder: r.invm(priv.modulus) };\n }\n function getr(priv) {\n var len = priv.modulus.byteLength(), r;\n do\n r = new BN(randomBytes(len));\n while (r.cmp(priv.modulus) >= 0 || !r.umod(priv.prime1) || !r.umod(priv.prime2));\n return r;\n }\n function crt(msg, priv) {\n var blinds = blind(priv), len = priv.modulus.byteLength(), blinded = new BN(msg).mul(blinds.blinder).umod(priv.modulus), c1 = blinded.toRed(BN.mont(priv.prime1)), c2 = blinded.toRed(BN.mont(priv.prime2)), qinv = priv.coefficient, p = priv.prime1, q = priv.prime2, m1 = c1.redPow(priv.exponent1).fromRed(), m2 = c2.redPow(priv.exponent2).fromRed(), h = m1.isub(m2).imul(qinv).umod(p).imul(q);\n return m2.iadd(h).imul(blinds.unblinder).umod(priv.modulus).toArrayLike(Buffer, \"be\", len);\n }\n crt.getr = getr, module.exports = crt;\n }\n}), require_package = __commonJS({\n \"node_modules/elliptic/package.json\"(exports, module) {\n module.exports = {\n name: \"elliptic\",\n version: \"6.5.4\",\n description: \"EC cryptography\",\n main: \"lib/elliptic.js\",\n files: [\"lib\"],\n scripts: {\n lint: \"eslint lib test\",\n \"lint:fix\": \"npm run lint -- --fix\",\n unit: \"istanbul test _mocha --reporter=spec test/index.js\",\n test: \"npm run lint && npm run unit\",\n version: \"grunt dist && git add dist/\"\n },\n repository: {\n type: \"git\",\n url: \"git@github.com:indutny/elliptic\"\n },\n keywords: [\"EC\", \"Elliptic\", \"curve\", \"Cryptography\"],\n author: \"Fedor Indutny \",\n license: \"MIT\",\n bugs: {\n url: \"https://github.com/indutny/elliptic/issues\"\n },\n homepage: \"https://github.com/indutny/elliptic\",\n devDependencies: {\n brfs: \"^2.0.2\",\n coveralls: \"^3.1.0\",\n eslint: \"^7.6.0\",\n grunt: \"^1.2.1\",\n \"grunt-browserify\": \"^5.3.0\",\n \"grunt-cli\": \"^1.3.2\",\n \"grunt-contrib-connect\": \"^3.0.0\",\n \"grunt-contrib-copy\": \"^1.0.0\",\n \"grunt-contrib-uglify\": \"^5.0.0\",\n \"grunt-mocha-istanbul\": \"^5.0.2\",\n \"grunt-saucelabs\": \"^9.0.1\",\n istanbul: \"^0.4.5\",\n mocha: \"^8.0.1\"\n },\n dependencies: {\n \"bn.js\": \"^4.11.9\",\n brorand: \"^1.1.0\",\n \"hash.js\": \"^1.0.0\",\n \"hmac-drbg\": \"^1.0.1\",\n inherits: \"^2.0.4\",\n \"minimalistic-assert\": \"^1.0.1\",\n \"minimalistic-crypto-utils\": \"^1.0.1\"\n }\n };\n }\n}), require_bn4 = require_bn, require_utils2 = __commonJS({\n \"node_modules/minimalistic-crypto-utils/lib/utils.js\"(exports) {\n var utils = exports;\n function toArray(msg, enc) {\n if (@Array.isArray(msg))\n return msg.slice();\n if (!msg)\n return [];\n var res = [];\n if (typeof msg != \"string\") {\n for (var i = 0;i < msg.length; i++)\n res[i] = msg[i] | 0;\n return res;\n }\n if (enc === \"hex\") {\n msg = msg.replace(/[^a-z0-9]+/gi, \"\"), msg.length % 2 !== 0 && (msg = \"0\" + msg);\n for (var i = 0;i < msg.length; i += 2)\n res.push(parseInt(msg[i] + msg[i + 1], 16));\n } else\n for (var i = 0;i < msg.length; i++) {\n var c = msg.charCodeAt(i), hi = c >> 8, lo = c & 255;\n hi \? res.push(hi, lo) : res.push(lo);\n }\n return res;\n }\n utils.toArray = toArray;\n function zero2(word) {\n return word.length === 1 \? \"0\" + word : word;\n }\n utils.zero2 = zero2;\n function toHex(msg) {\n for (var res = \"\", i = 0;i < msg.length; i++)\n res += zero2(msg[i].toString(16));\n return res;\n }\n utils.toHex = toHex, utils.encode = function(arr, enc) {\n return enc === \"hex\" \? toHex(arr) : arr;\n };\n }\n}), require_utils3 = __commonJS({\n \"node_modules/elliptic/lib/elliptic/utils.js\"(exports) {\n var utils = exports, BN = require_bn4(), minAssert = require_minimalistic_assert(), minUtils = require_utils2();\n utils.assert = minAssert, utils.toArray = minUtils.toArray, utils.zero2 = minUtils.zero2, utils.toHex = minUtils.toHex, utils.encode = minUtils.encode;\n function getNAF(num, w, bits) {\n var naf = new @Array(Math.max(num.bitLength(), bits) + 1);\n naf.fill(0);\n for (var ws = 1 << w + 1, k = num.clone(), i = 0;i < naf.length; i++) {\n var z, mod = k.andln(ws - 1);\n k.isOdd() \? (mod > (ws >> 1) - 1 \? z = (ws >> 1) - mod : z = mod, k.isubn(z)) : z = 0, naf[i] = z, k.iushrn(1);\n }\n return naf;\n }\n utils.getNAF = getNAF;\n function getJSF(k1, k2) {\n var jsf = [[], []];\n k1 = k1.clone(), k2 = k2.clone();\n for (var d1 = 0, d2 = 0, m8;k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0; ) {\n var m14 = k1.andln(3) + d1 & 3, m24 = k2.andln(3) + d2 & 3;\n m14 === 3 && (m14 = -1), m24 === 3 && (m24 = -1);\n var u1;\n (m14 & 1) === 0 \? u1 = 0 : (m8 = k1.andln(7) + d1 & 7, (m8 === 3 || m8 === 5) && m24 === 2 \? u1 = -m14 : u1 = m14), jsf[0].push(u1);\n var u2;\n (m24 & 1) === 0 \? u2 = 0 : (m8 = k2.andln(7) + d2 & 7, (m8 === 3 || m8 === 5) && m14 === 2 \? u2 = -m24 : u2 = m24), jsf[1].push(u2), 2 * d1 === u1 + 1 && (d1 = 1 - d1), 2 * d2 === u2 + 1 && (d2 = 1 - d2), k1.iushrn(1), k2.iushrn(1);\n }\n return jsf;\n }\n utils.getJSF = getJSF;\n function cachedProperty(obj, name, computer) {\n var key2 = \"_\" + name;\n obj.prototype[name] = function() {\n return this[key2] !== void 0 \? this[key2] : this[key2] = computer.@call(this);\n };\n }\n utils.cachedProperty = cachedProperty;\n function parseBytes(bytes) {\n if (bytes instanceof KeyObject)\n bytes = bytes.export();\n else if (bytes instanceof CryptoKey)\n bytes = KeyObject.from(bytes).export();\n return typeof bytes == \"string\" \? utils.toArray(bytes, \"hex\") : bytes;\n }\n utils.parseBytes = parseBytes;\n function intFromLE(bytes) {\n return new BN(bytes, \"hex\", \"le\");\n }\n utils.intFromLE = intFromLE;\n }\n}), require_base = __commonJS({\n \"node_modules/elliptic/lib/elliptic/curve/base.js\"(exports, module) {\n var BN = require_bn4(), utils = require_utils3(), getNAF = utils.getNAF, getJSF = utils.getJSF, assert = utils.assert;\n function BaseCurve(type, conf) {\n this.type = type, this.p = new BN(conf.p, 16), this.red = conf.prime \? BN.red(conf.prime) : BN.mont(this.p), this.zero = new BN(0).toRed(this.red), this.one = new BN(1).toRed(this.red), this.two = new BN(2).toRed(this.red), this.n = conf.n && new BN(conf.n, 16), this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed), this._wnafT1 = new @Array(4), this._wnafT2 = new @Array(4), this._wnafT3 = new @Array(4), this._wnafT4 = new @Array(4), this._bitLength = this.n \? this.n.bitLength() : 0;\n var adjustCount = this.n && this.p.div(this.n);\n !adjustCount || adjustCount.cmpn(100) > 0 \? this.redN = null : (this._maxwellTrick = !0, this.redN = this.n.toRed(this.red));\n }\n module.exports = BaseCurve, BaseCurve.prototype = {}, BaseCurve.prototype.point = function() {\n throw new Error(\"Not implemented\");\n }, BaseCurve.prototype.validate = function() {\n throw new Error(\"Not implemented\");\n }, BaseCurve.prototype._fixedNafMul = function(p, k) {\n assert(p.precomputed);\n var doubles = p._getDoubles(), naf = getNAF(k, 1, this._bitLength), I = (1 << doubles.step + 1) - (doubles.step % 2 === 0 \? 2 : 1);\n I /= 3;\n var repr = [], j, nafW;\n for (j = 0;j < naf.length; j += doubles.step) {\n nafW = 0;\n for (var l = j + doubles.step - 1;l >= j; l--)\n nafW = (nafW << 1) + naf[l];\n repr.push(nafW);\n }\n for (var a = this.jpoint(null, null, null), b = this.jpoint(null, null, null), i = I;i > 0; i--) {\n for (j = 0;j < repr.length; j++)\n nafW = repr[j], nafW === i \? b = b.mixedAdd(doubles.points[j]) : nafW === -i && (b = b.mixedAdd(doubles.points[j].neg()));\n a = a.add(b);\n }\n return a.toP();\n }, BaseCurve.prototype._wnafMul = function(p, k) {\n var w = 4, nafPoints = p._getNAFPoints(w);\n w = nafPoints.wnd;\n for (var wnd = nafPoints.points, naf = getNAF(k, w, this._bitLength), acc = this.jpoint(null, null, null), i = naf.length - 1;i >= 0; i--) {\n for (var l = 0;i >= 0 && naf[i] === 0; i--)\n l++;\n if (i >= 0 && l++, acc = acc.dblp(l), i < 0)\n break;\n var z = naf[i];\n assert(z !== 0), p.type === \"affine\" \? z > 0 \? acc = acc.mixedAdd(wnd[z - 1 >> 1]) : acc = acc.mixedAdd(wnd[-z - 1 >> 1].neg()) : z > 0 \? acc = acc.add(wnd[z - 1 >> 1]) : acc = acc.add(wnd[-z - 1 >> 1].neg());\n }\n return p.type === \"affine\" \? acc.toP() : acc;\n }, BaseCurve.prototype._wnafMulAdd = function(defW, points, coeffs, len, jacobianResult) {\n var wndWidth = this._wnafT1, wnd = this._wnafT2, naf = this._wnafT3, max = 0, i, j, p;\n for (i = 0;i < len; i++) {\n p = points[i];\n var nafPoints = p._getNAFPoints(defW);\n wndWidth[i] = nafPoints.wnd, wnd[i] = nafPoints.points;\n }\n for (i = len - 1;i >= 1; i -= 2) {\n var a = i - 1, b = i;\n if (wndWidth[a] !== 1 || wndWidth[b] !== 1) {\n naf[a] = getNAF(coeffs[a], wndWidth[a], this._bitLength), naf[b] = getNAF(coeffs[b], wndWidth[b], this._bitLength), max = Math.max(naf[a].length, max), max = Math.max(naf[b].length, max);\n continue;\n }\n var comb = [points[a], null, null, points[b]];\n points[a].y.cmp(points[b].y) === 0 \? (comb[1] = points[a].add(points[b]), comb[2] = points[a].toJ().mixedAdd(points[b].neg())) : points[a].y.cmp(points[b].y.redNeg()) === 0 \? (comb[1] = points[a].toJ().mixedAdd(points[b]), comb[2] = points[a].add(points[b].neg())) : (comb[1] = points[a].toJ().mixedAdd(points[b]), comb[2] = points[a].toJ().mixedAdd(points[b].neg()));\n var index = [-3, -1, -5, -7, 0, 7, 5, 1, 3], jsf = getJSF(coeffs[a], coeffs[b]);\n for (max = Math.max(jsf[0].length, max), naf[a] = new @Array(max), naf[b] = new @Array(max), j = 0;j < max; j++) {\n var ja = jsf[0][j] | 0, jb = jsf[1][j] | 0;\n naf[a][j] = index[(ja + 1) * 3 + (jb + 1)], naf[b][j] = 0, wnd[a] = comb;\n }\n }\n var acc = this.jpoint(null, null, null), tmp = this._wnafT4;\n for (i = max;i >= 0; i--) {\n for (var k = 0;i >= 0; ) {\n var zero = !0;\n for (j = 0;j < len; j++)\n tmp[j] = naf[j][i] | 0, tmp[j] !== 0 && (zero = !1);\n if (!zero)\n break;\n k++, i--;\n }\n if (i >= 0 && k++, acc = acc.dblp(k), i < 0)\n break;\n for (j = 0;j < len; j++) {\n var z = tmp[j];\n z !== 0 && (z > 0 \? p = wnd[j][z - 1 >> 1] : z < 0 && (p = wnd[j][-z - 1 >> 1].neg()), p.type === \"affine\" \? acc = acc.mixedAdd(p) : acc = acc.add(p));\n }\n }\n for (i = 0;i < len; i++)\n wnd[i] = null;\n return jacobianResult \? acc : acc.toP();\n };\n function BasePoint(curve, type) {\n this.curve = curve, this.type = type, this.precomputed = null;\n }\n BasePoint.prototype = {}, BaseCurve.BasePoint = BasePoint, BasePoint.prototype.eq = function() {\n throw new Error(\"Not implemented\");\n }, BasePoint.prototype.validate = function() {\n return this.curve.validate(this);\n }, BaseCurve.prototype.decodePoint = function(bytes, enc) {\n bytes = utils.toArray(bytes, enc);\n var len = this.p.byteLength();\n if ((bytes[0] === 4 || bytes[0] === 6 || bytes[0] === 7) && bytes.length - 1 === 2 * len) {\n bytes[0] === 6 \? assert(bytes[bytes.length - 1] % 2 === 0) : bytes[0] === 7 && assert(bytes[bytes.length - 1] % 2 === 1);\n var res = this.point(bytes.slice(1, 1 + len), bytes.slice(1 + len, 1 + 2 * len));\n return res;\n } else if ((bytes[0] === 2 || bytes[0] === 3) && bytes.length - 1 === len)\n return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 3);\n throw new Error(\"Unknown point format\");\n }, BasePoint.prototype.encodeCompressed = function(enc) {\n return this.encode(enc, !0);\n }, BasePoint.prototype._encode = function(compact) {\n var len = this.curve.p.byteLength(), x = this.getX().toArray(\"be\", len);\n return compact \? [this.getY().isEven() \? 2 : 3].concat(x) : [4].concat(x, this.getY().toArray(\"be\", len));\n }, BasePoint.prototype.encode = function(enc, compact) {\n return utils.encode(this._encode(compact), enc);\n }, BasePoint.prototype.precompute = function(power) {\n if (this.precomputed)\n return this;\n var precomputed = {\n doubles: null,\n naf: null,\n beta: null\n };\n return precomputed.naf = this._getNAFPoints(8), precomputed.doubles = this._getDoubles(4, power), precomputed.beta = this._getBeta(), this.precomputed = precomputed, this;\n }, BasePoint.prototype._hasDoubles = function(k) {\n if (!this.precomputed)\n return !1;\n var doubles = this.precomputed.doubles;\n return doubles \? doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step) : !1;\n }, BasePoint.prototype._getDoubles = function(step, power) {\n if (this.precomputed && this.precomputed.doubles)\n return this.precomputed.doubles;\n for (var doubles = [this], acc = this, i = 0;i < power; i += step) {\n for (var j = 0;j < step; j++)\n acc = acc.dbl();\n doubles.push(acc);\n }\n return {\n step,\n points: doubles\n };\n }, BasePoint.prototype._getNAFPoints = function(wnd) {\n if (this.precomputed && this.precomputed.naf)\n return this.precomputed.naf;\n for (var res = [this], max = (1 << wnd) - 1, dbl = max === 1 \? null : this.dbl(), i = 1;i < max; i++)\n res[i] = res[i - 1].add(dbl);\n return {\n wnd,\n points: res\n };\n }, BasePoint.prototype._getBeta = function() {\n return null;\n }, BasePoint.prototype.dblp = function(k) {\n for (var r = this, i = 0;i < k; i++)\n r = r.dbl();\n return r;\n };\n }\n}), require_short = __commonJS({\n \"node_modules/elliptic/lib/elliptic/curve/short.js\"(exports, module) {\n var utils = require_utils3(), BN = require_bn4(), inherits = require_inherits_browser(), Base = require_base(), assert = utils.assert;\n function ShortCurve(conf) {\n Base.@call(this, \"short\", conf), this.a = new BN(conf.a, 16).toRed(this.red), this.b = new BN(conf.b, 16).toRed(this.red), this.tinv = this.two.redInvm(), this.zeroA = this.a.fromRed().cmpn(0) === 0, this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0, this.endo = this._getEndomorphism(conf), this._endoWnafT1 = new @Array(4), this._endoWnafT2 = new @Array(4);\n }\n inherits(ShortCurve, Base), module.exports = ShortCurve, ShortCurve.prototype._getEndomorphism = function(conf) {\n if (!(!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)) {\n var beta, lambda;\n if (conf.beta)\n beta = new BN(conf.beta, 16).toRed(this.red);\n else {\n var betas = this._getEndoRoots(this.p);\n beta = betas[0].cmp(betas[1]) < 0 \? betas[0] : betas[1], beta = beta.toRed(this.red);\n }\n if (conf.lambda)\n lambda = new BN(conf.lambda, 16);\n else {\n var lambdas = this._getEndoRoots(this.n);\n this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0 \? lambda = lambdas[0] : (lambda = lambdas[1], assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0));\n }\n var basis;\n return conf.basis \? basis = conf.basis.map(function(vec) {\n return {\n a: new BN(vec.a, 16),\n b: new BN(vec.b, 16)\n };\n }) : basis = this._getEndoBasis(lambda), {\n beta,\n lambda,\n basis\n };\n }\n }, ShortCurve.prototype._getEndoRoots = function(num) {\n var red = num === this.p \? this.red : BN.mont(num), tinv = new BN(2).toRed(red).redInvm(), ntinv = tinv.redNeg(), s = new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv), l1 = ntinv.redAdd(s).fromRed(), l2 = ntinv.redSub(s).fromRed();\n return [l1, l2];\n }, ShortCurve.prototype._getEndoBasis = function(lambda) {\n for (var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), u = lambda, v = this.n.clone(), x1 = new BN(1), y1 = new BN(0), x2 = new BN(0), y2 = new BN(1), a0, b0, a1, b1, a2, b2, prevR, i = 0, r, x;u.cmpn(0) !== 0; ) {\n var q = v.div(u);\n r = v.sub(q.mul(u)), x = x2.sub(q.mul(x1));\n var y = y2.sub(q.mul(y1));\n if (!a1 && r.cmp(aprxSqrt) < 0)\n a0 = prevR.neg(), b0 = x1, a1 = r.neg(), b1 = x;\n else if (a1 && ++i === 2)\n break;\n prevR = r, v = u, u = r, x2 = x1, x1 = x, y2 = y1, y1 = y;\n }\n a2 = r.neg(), b2 = x;\n var len1 = a1.sqr().add(b1.sqr()), len2 = a2.sqr().add(b2.sqr());\n return len2.cmp(len1) >= 0 && (a2 = a0, b2 = b0), a1.negative && (a1 = a1.neg(), b1 = b1.neg()), a2.negative && (a2 = a2.neg(), b2 = b2.neg()), [\n { a: a1, b: b1 },\n { a: a2, b: b2 }\n ];\n }, ShortCurve.prototype._endoSplit = function(k) {\n var basis = this.endo.basis, v1 = basis[0], v2 = basis[1], c1 = v2.b.mul(k).divRound(this.n), c2 = v1.b.neg().mul(k).divRound(this.n), p1 = c1.mul(v1.a), p2 = c2.mul(v2.a), q1 = c1.mul(v1.b), q2 = c2.mul(v2.b), k1 = k.sub(p1).sub(p2), k2 = q1.add(q2).neg();\n return { k1, k2 };\n }, ShortCurve.prototype.pointFromX = function(x, odd) {\n x = new BN(x, 16), x.red || (x = x.toRed(this.red));\n var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b), y = y2.redSqrt();\n if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)\n throw new Error(\"invalid point\");\n var isOdd = y.fromRed().isOdd();\n return (odd && !isOdd || !odd && isOdd) && (y = y.redNeg()), this.point(x, y);\n }, ShortCurve.prototype.validate = function(point) {\n if (point.inf)\n return !0;\n var { x, y } = point, ax = this.a.redMul(x), rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);\n return y.redSqr().redISub(rhs).cmpn(0) === 0;\n }, ShortCurve.prototype._endoWnafMulAdd = function(points, coeffs, jacobianResult) {\n for (var npoints = this._endoWnafT1, ncoeffs = this._endoWnafT2, i = 0;i < points.length; i++) {\n var split = this._endoSplit(coeffs[i]), p = points[i], beta = p._getBeta();\n split.k1.negative && (split.k1.ineg(), p = p.neg(!0)), split.k2.negative && (split.k2.ineg(), beta = beta.neg(!0)), npoints[i * 2] = p, npoints[i * 2 + 1] = beta, ncoeffs[i * 2] = split.k1, ncoeffs[i * 2 + 1] = split.k2;\n }\n for (var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult), j = 0;j < i * 2; j++)\n npoints[j] = null, ncoeffs[j] = null;\n return res;\n };\n function Point(curve, x, y, isRed) {\n Base.BasePoint.@call(this, curve, \"affine\"), x === null && y === null \? (this.x = null, this.y = null, this.inf = !0) : (this.x = new BN(x, 16), this.y = new BN(y, 16), isRed && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1);\n }\n inherits(Point, Base.BasePoint), ShortCurve.prototype.point = function(x, y, isRed) {\n return new Point(this, x, y, isRed);\n }, ShortCurve.prototype.pointFromJSON = function(obj, red) {\n return Point.fromJSON(this, obj, red);\n }, Point.prototype._getBeta = function() {\n if (this.curve.endo) {\n var pre = this.precomputed;\n if (pre && pre.beta)\n return pre.beta;\n var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y);\n if (pre) {\n var curve = this.curve, endoMul = function(p) {\n return curve.point(p.x.redMul(curve.endo.beta), p.y);\n };\n pre.beta = beta, beta.precomputed = {\n beta: null,\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: pre.naf.points.map(endoMul)\n },\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: pre.doubles.points.map(endoMul)\n }\n };\n }\n return beta;\n }\n }, Point.prototype.toJSON = function() {\n return this.precomputed \? [\n this.x,\n this.y,\n this.precomputed && {\n doubles: this.precomputed.doubles && {\n step: this.precomputed.doubles.step,\n points: this.precomputed.doubles.points.slice(1)\n },\n naf: this.precomputed.naf && {\n wnd: this.precomputed.naf.wnd,\n points: this.precomputed.naf.points.slice(1)\n }\n }\n ] : [this.x, this.y];\n }, Point.fromJSON = function(curve, obj, red) {\n typeof obj == \"string\" && (obj = JSON.parse(obj));\n var res = curve.point(obj[0], obj[1], red);\n if (!obj[2])\n return res;\n function obj2point(obj2) {\n return curve.point(obj2[0], obj2[1], red);\n }\n var pre = obj[2];\n return res.precomputed = {\n beta: null,\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: [res].concat(pre.doubles.points.map(obj2point))\n },\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: [res].concat(pre.naf.points.map(obj2point))\n }\n }, res;\n }, Point.prototype.inspect = function() {\n return this.isInfinity() \? \"\" : \"\";\n }, Point.prototype.isInfinity = function() {\n return this.inf;\n }, Point.prototype.add = function(p) {\n if (this.inf)\n return p;\n if (p.inf)\n return this;\n if (this.eq(p))\n return this.dbl();\n if (this.neg().eq(p))\n return this.curve.point(null, null);\n if (this.x.cmp(p.x) === 0)\n return this.curve.point(null, null);\n var c = this.y.redSub(p.y);\n c.cmpn(0) !== 0 && (c = c.redMul(this.x.redSub(p.x).redInvm()));\n var nx = c.redSqr().redISub(this.x).redISub(p.x), ny = c.redMul(this.x.redSub(nx)).redISub(this.y);\n return this.curve.point(nx, ny);\n }, Point.prototype.dbl = function() {\n if (this.inf)\n return this;\n var ys1 = this.y.redAdd(this.y);\n if (ys1.cmpn(0) === 0)\n return this.curve.point(null, null);\n var a = this.curve.a, x2 = this.x.redSqr(), dyinv = ys1.redInvm(), c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv), nx = c.redSqr().redISub(this.x.redAdd(this.x)), ny = c.redMul(this.x.redSub(nx)).redISub(this.y);\n return this.curve.point(nx, ny);\n }, Point.prototype.getX = function() {\n return this.x.fromRed();\n }, Point.prototype.getY = function() {\n return this.y.fromRed();\n }, Point.prototype.mul = function(k) {\n return k = new BN(k, 16), this.isInfinity() \? this : this._hasDoubles(k) \? this.curve._fixedNafMul(this, k) : this.curve.endo \? this.curve._endoWnafMulAdd([this], [k]) : this.curve._wnafMul(this, k);\n }, Point.prototype.mulAdd = function(k1, p2, k2) {\n var points = [this, p2], coeffs = [k1, k2];\n return this.curve.endo \? this.curve._endoWnafMulAdd(points, coeffs) : this.curve._wnafMulAdd(1, points, coeffs, 2);\n }, Point.prototype.jmulAdd = function(k1, p2, k2) {\n var points = [this, p2], coeffs = [k1, k2];\n return this.curve.endo \? this.curve._endoWnafMulAdd(points, coeffs, !0) : this.curve._wnafMulAdd(1, points, coeffs, 2, !0);\n }, Point.prototype.eq = function(p) {\n return this === p || this.inf === p.inf && (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0);\n }, Point.prototype.neg = function(_precompute) {\n if (this.inf)\n return this;\n var res = this.curve.point(this.x, this.y.redNeg());\n if (_precompute && this.precomputed) {\n var pre = this.precomputed, negate = function(p) {\n return p.neg();\n };\n res.precomputed = {\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: pre.naf.points.map(negate)\n },\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: pre.doubles.points.map(negate)\n }\n };\n }\n return res;\n }, Point.prototype.toJ = function() {\n if (this.inf)\n return this.curve.jpoint(null, null, null);\n var res = this.curve.jpoint(this.x, this.y, this.curve.one);\n return res;\n };\n function JPoint(curve, x, y, z) {\n Base.BasePoint.@call(this, curve, \"jacobian\"), x === null && y === null && z === null \? (this.x = this.curve.one, this.y = this.curve.one, this.z = new BN(0)) : (this.x = new BN(x, 16), this.y = new BN(y, 16), this.z = new BN(z, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one;\n }\n inherits(JPoint, Base.BasePoint), ShortCurve.prototype.jpoint = function(x, y, z) {\n return new JPoint(this, x, y, z);\n }, JPoint.prototype.toP = function() {\n if (this.isInfinity())\n return this.curve.point(null, null);\n var zinv = this.z.redInvm(), zinv2 = zinv.redSqr(), ax = this.x.redMul(zinv2), ay = this.y.redMul(zinv2).redMul(zinv);\n return this.curve.point(ax, ay);\n }, JPoint.prototype.neg = function() {\n return this.curve.jpoint(this.x, this.y.redNeg(), this.z);\n }, JPoint.prototype.add = function(p) {\n if (this.isInfinity())\n return p;\n if (p.isInfinity())\n return this;\n var pz2 = p.z.redSqr(), z2 = this.z.redSqr(), u1 = this.x.redMul(pz2), u2 = p.x.redMul(z2), s1 = this.y.redMul(pz2.redMul(p.z)), s2 = p.y.redMul(z2.redMul(this.z)), h = u1.redSub(u2), r = s1.redSub(s2);\n if (h.cmpn(0) === 0)\n return r.cmpn(0) !== 0 \? this.curve.jpoint(null, null, null) : this.dbl();\n var h2 = h.redSqr(), h3 = h2.redMul(h), v = u1.redMul(h2), nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v), ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)), nz = this.z.redMul(p.z).redMul(h);\n return this.curve.jpoint(nx, ny, nz);\n }, JPoint.prototype.mixedAdd = function(p) {\n if (this.isInfinity())\n return p.toJ();\n if (p.isInfinity())\n return this;\n var z2 = this.z.redSqr(), u1 = this.x, u2 = p.x.redMul(z2), s1 = this.y, s2 = p.y.redMul(z2).redMul(this.z), h = u1.redSub(u2), r = s1.redSub(s2);\n if (h.cmpn(0) === 0)\n return r.cmpn(0) !== 0 \? this.curve.jpoint(null, null, null) : this.dbl();\n var h2 = h.redSqr(), h3 = h2.redMul(h), v = u1.redMul(h2), nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v), ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)), nz = this.z.redMul(h);\n return this.curve.jpoint(nx, ny, nz);\n }, JPoint.prototype.dblp = function(pow) {\n if (pow === 0)\n return this;\n if (this.isInfinity())\n return this;\n if (!pow)\n return this.dbl();\n var i;\n if (this.curve.zeroA || this.curve.threeA) {\n var r = this;\n for (i = 0;i < pow; i++)\n r = r.dbl();\n return r;\n }\n var a = this.curve.a, tinv = this.curve.tinv, jx = this.x, jy = this.y, jz = this.z, jz4 = jz.redSqr().redSqr(), jyd = jy.redAdd(jy);\n for (i = 0;i < pow; i++) {\n var jx2 = jx.redSqr(), jyd2 = jyd.redSqr(), jyd4 = jyd2.redSqr(), c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)), t1 = jx.redMul(jyd2), nx = c.redSqr().redISub(t1.redAdd(t1)), t2 = t1.redISub(nx), dny = c.redMul(t2);\n dny = dny.redIAdd(dny).redISub(jyd4);\n var nz = jyd.redMul(jz);\n i + 1 < pow && (jz4 = jz4.redMul(jyd4)), jx = nx, jz = nz, jyd = dny;\n }\n return this.curve.jpoint(jx, jyd.redMul(tinv), jz);\n }, JPoint.prototype.dbl = function() {\n return this.isInfinity() \? this : this.curve.zeroA \? this._zeroDbl() : this.curve.threeA \? this._threeDbl() : this._dbl();\n }, JPoint.prototype._zeroDbl = function() {\n var nx, ny, nz;\n if (this.zOne) {\n var xx = this.x.redSqr(), yy = this.y.redSqr(), yyyy = yy.redSqr(), s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n s = s.redIAdd(s);\n var m = xx.redAdd(xx).redIAdd(xx), t = m.redSqr().redISub(s).redISub(s), yyyy8 = yyyy.redIAdd(yyyy);\n yyyy8 = yyyy8.redIAdd(yyyy8), yyyy8 = yyyy8.redIAdd(yyyy8), nx = t, ny = m.redMul(s.redISub(t)).redISub(yyyy8), nz = this.y.redAdd(this.y);\n } else {\n var a = this.x.redSqr(), b = this.y.redSqr(), c = b.redSqr(), d = this.x.redAdd(b).redSqr().redISub(a).redISub(c);\n d = d.redIAdd(d);\n var e = a.redAdd(a).redIAdd(a), f = e.redSqr(), c8 = c.redIAdd(c);\n c8 = c8.redIAdd(c8), c8 = c8.redIAdd(c8), nx = f.redISub(d).redISub(d), ny = e.redMul(d.redISub(nx)).redISub(c8), nz = this.y.redMul(this.z), nz = nz.redIAdd(nz);\n }\n return this.curve.jpoint(nx, ny, nz);\n }, JPoint.prototype._threeDbl = function() {\n var nx, ny, nz;\n if (this.zOne) {\n var xx = this.x.redSqr(), yy = this.y.redSqr(), yyyy = yy.redSqr(), s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n s = s.redIAdd(s);\n var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a), t = m.redSqr().redISub(s).redISub(s);\n nx = t;\n var yyyy8 = yyyy.redIAdd(yyyy);\n yyyy8 = yyyy8.redIAdd(yyyy8), yyyy8 = yyyy8.redIAdd(yyyy8), ny = m.redMul(s.redISub(t)).redISub(yyyy8), nz = this.y.redAdd(this.y);\n } else {\n var delta = this.z.redSqr(), gamma = this.y.redSqr(), beta = this.x.redMul(gamma), alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta));\n alpha = alpha.redAdd(alpha).redIAdd(alpha);\n var beta4 = beta.redIAdd(beta);\n beta4 = beta4.redIAdd(beta4);\n var beta8 = beta4.redAdd(beta4);\n nx = alpha.redSqr().redISub(beta8), nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta);\n var ggamma8 = gamma.redSqr();\n ggamma8 = ggamma8.redIAdd(ggamma8), ggamma8 = ggamma8.redIAdd(ggamma8), ggamma8 = ggamma8.redIAdd(ggamma8), ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8);\n }\n return this.curve.jpoint(nx, ny, nz);\n }, JPoint.prototype._dbl = function() {\n var a = this.curve.a, jx = this.x, jy = this.y, jz = this.z, jz4 = jz.redSqr().redSqr(), jx2 = jx.redSqr(), jy2 = jy.redSqr(), c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)), jxd4 = jx.redAdd(jx);\n jxd4 = jxd4.redIAdd(jxd4);\n var t1 = jxd4.redMul(jy2), nx = c.redSqr().redISub(t1.redAdd(t1)), t2 = t1.redISub(nx), jyd8 = jy2.redSqr();\n jyd8 = jyd8.redIAdd(jyd8), jyd8 = jyd8.redIAdd(jyd8), jyd8 = jyd8.redIAdd(jyd8);\n var ny = c.redMul(t2).redISub(jyd8), nz = jy.redAdd(jy).redMul(jz);\n return this.curve.jpoint(nx, ny, nz);\n }, JPoint.prototype.trpl = function() {\n if (!this.curve.zeroA)\n return this.dbl().add(this);\n var xx = this.x.redSqr(), yy = this.y.redSqr(), zz = this.z.redSqr(), yyyy = yy.redSqr(), m = xx.redAdd(xx).redIAdd(xx), mm = m.redSqr(), e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n e = e.redIAdd(e), e = e.redAdd(e).redIAdd(e), e = e.redISub(mm);\n var ee = e.redSqr(), t = yyyy.redIAdd(yyyy);\n t = t.redIAdd(t), t = t.redIAdd(t), t = t.redIAdd(t);\n var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t), yyu4 = yy.redMul(u);\n yyu4 = yyu4.redIAdd(yyu4), yyu4 = yyu4.redIAdd(yyu4);\n var nx = this.x.redMul(ee).redISub(yyu4);\n nx = nx.redIAdd(nx), nx = nx.redIAdd(nx);\n var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee)));\n ny = ny.redIAdd(ny), ny = ny.redIAdd(ny), ny = ny.redIAdd(ny);\n var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee);\n return this.curve.jpoint(nx, ny, nz);\n }, JPoint.prototype.mul = function(k, kbase) {\n return k = new BN(k, kbase), this.curve._wnafMul(this, k);\n }, JPoint.prototype.eq = function(p) {\n if (p.type === \"affine\")\n return this.eq(p.toJ());\n if (this === p)\n return !0;\n var z2 = this.z.redSqr(), pz2 = p.z.redSqr();\n if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0)\n return !1;\n var z3 = z2.redMul(this.z), pz3 = pz2.redMul(p.z);\n return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0;\n }, JPoint.prototype.eqXToP = function(x) {\n var zs = this.z.redSqr(), rx = x.toRed(this.curve.red).redMul(zs);\n if (this.x.cmp(rx) === 0)\n return !0;\n for (var xc = x.clone(), t = this.curve.redN.redMul(zs);; ) {\n if (xc.iadd(this.curve.n), xc.cmp(this.curve.p) >= 0)\n return !1;\n if (rx.redIAdd(t), this.x.cmp(rx) === 0)\n return !0;\n }\n }, JPoint.prototype.inspect = function() {\n return this.isInfinity() \? \"\" : \"\";\n }, JPoint.prototype.isInfinity = function() {\n return this.z.cmpn(0) === 0;\n };\n }\n}), require_mont = __commonJS({\n \"node_modules/elliptic/lib/elliptic/curve/mont.js\"(exports, module) {\n var BN = require_bn4(), inherits = require_inherits_browser(), Base = require_base(), utils = require_utils3();\n function MontCurve(conf) {\n Base.@call(this, \"mont\", conf), this.a = new BN(conf.a, 16).toRed(this.red), this.b = new BN(conf.b, 16).toRed(this.red), this.i4 = new BN(4).toRed(this.red).redInvm(), this.two = new BN(2).toRed(this.red), this.a24 = this.i4.redMul(this.a.redAdd(this.two));\n }\n inherits(MontCurve, Base), module.exports = MontCurve, MontCurve.prototype.validate = function(point) {\n var x = point.normalize().x, x2 = x.redSqr(), rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x), y = rhs.redSqrt();\n return y.redSqr().cmp(rhs) === 0;\n };\n function Point(curve, x, z) {\n Base.BasePoint.@call(this, curve, \"projective\"), x === null && z === null \? (this.x = this.curve.one, this.z = this.curve.zero) : (this.x = new BN(x, 16), this.z = new BN(z, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)));\n }\n inherits(Point, Base.BasePoint), MontCurve.prototype.decodePoint = function(bytes, enc) {\n return this.point(utils.toArray(bytes, enc), 1);\n }, MontCurve.prototype.point = function(x, z) {\n return new Point(this, x, z);\n }, MontCurve.prototype.pointFromJSON = function(obj) {\n return Point.fromJSON(this, obj);\n }, Point.prototype.precompute = function() {\n }, Point.prototype._encode = function() {\n return this.getX().toArray(\"be\", this.curve.p.byteLength());\n }, Point.fromJSON = function(curve, obj) {\n return new Point(curve, obj[0], obj[1] || curve.one);\n }, Point.prototype.inspect = function() {\n return this.isInfinity() \? \"\" : \"\";\n }, Point.prototype.isInfinity = function() {\n return this.z.cmpn(0) === 0;\n }, Point.prototype.dbl = function() {\n var a = this.x.redAdd(this.z), aa = a.redSqr(), b = this.x.redSub(this.z), bb = b.redSqr(), c = aa.redSub(bb), nx = aa.redMul(bb), nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c)));\n return this.curve.point(nx, nz);\n }, Point.prototype.add = function() {\n throw new Error(\"Not supported on Montgomery curve\");\n }, Point.prototype.diffAdd = function(p, diff) {\n var a = this.x.redAdd(this.z), b = this.x.redSub(this.z), c = p.x.redAdd(p.z), d = p.x.redSub(p.z), da = d.redMul(a), cb = c.redMul(b), nx = diff.z.redMul(da.redAdd(cb).redSqr()), nz = diff.x.redMul(da.redISub(cb).redSqr());\n return this.curve.point(nx, nz);\n }, Point.prototype.mul = function(k) {\n for (var t = k.clone(), a = this, b = this.curve.point(null, null), c = this, bits = [];t.cmpn(0) !== 0; t.iushrn(1))\n bits.push(t.andln(1));\n for (var i = bits.length - 1;i >= 0; i--)\n bits[i] === 0 \? (a = a.diffAdd(b, c), b = b.dbl()) : (b = a.diffAdd(b, c), a = a.dbl());\n return b;\n }, Point.prototype.mulAdd = function() {\n throw new Error(\"Not supported on Montgomery curve\");\n }, Point.prototype.jumlAdd = function() {\n throw new Error(\"Not supported on Montgomery curve\");\n }, Point.prototype.eq = function(other) {\n return this.getX().cmp(other.getX()) === 0;\n }, Point.prototype.normalize = function() {\n return this.x = this.x.redMul(this.z.redInvm()), this.z = this.curve.one, this;\n }, Point.prototype.getX = function() {\n return this.normalize(), this.x.fromRed();\n };\n }\n}), require_edwards = __commonJS({\n \"node_modules/elliptic/lib/elliptic/curve/edwards.js\"(exports, module) {\n var utils = require_utils3(), BN = require_bn4(), inherits = require_inherits_browser(), Base = require_base(), assert = utils.assert;\n function EdwardsCurve(conf) {\n this.twisted = (conf.a | 0) !== 1, this.mOneA = this.twisted && (conf.a | 0) === -1, this.extended = this.mOneA, Base.@call(this, \"edwards\", conf), this.a = new BN(conf.a, 16).umod(this.red.m), this.a = this.a.toRed(this.red), this.c = new BN(conf.c, 16).toRed(this.red), this.c2 = this.c.redSqr(), this.d = new BN(conf.d, 16).toRed(this.red), this.dd = this.d.redAdd(this.d), assert(!this.twisted || this.c.fromRed().cmpn(1) === 0), this.oneC = (conf.c | 0) === 1;\n }\n inherits(EdwardsCurve, Base), module.exports = EdwardsCurve, EdwardsCurve.prototype._mulA = function(num) {\n return this.mOneA \? num.redNeg() : this.a.redMul(num);\n }, EdwardsCurve.prototype._mulC = function(num) {\n return this.oneC \? num : this.c.redMul(num);\n }, EdwardsCurve.prototype.jpoint = function(x, y, z, t) {\n return this.point(x, y, z, t);\n }, EdwardsCurve.prototype.pointFromX = function(x, odd) {\n x = new BN(x, 16), x.red || (x = x.toRed(this.red));\n var x2 = x.redSqr(), rhs = this.c2.redSub(this.a.redMul(x2)), lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2)), y2 = rhs.redMul(lhs.redInvm()), y = y2.redSqrt();\n if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)\n throw new Error(\"invalid point\");\n var isOdd = y.fromRed().isOdd();\n return (odd && !isOdd || !odd && isOdd) && (y = y.redNeg()), this.point(x, y);\n }, EdwardsCurve.prototype.pointFromY = function(y, odd) {\n y = new BN(y, 16), y.red || (y = y.toRed(this.red));\n var y2 = y.redSqr(), lhs = y2.redSub(this.c2), rhs = y2.redMul(this.d).redMul(this.c2).redSub(this.a), x2 = lhs.redMul(rhs.redInvm());\n if (x2.cmp(this.zero) === 0) {\n if (odd)\n throw new Error(\"invalid point\");\n return this.point(this.zero, y);\n }\n var x = x2.redSqrt();\n if (x.redSqr().redSub(x2).cmp(this.zero) !== 0)\n throw new Error(\"invalid point\");\n return x.fromRed().isOdd() !== odd && (x = x.redNeg()), this.point(x, y);\n }, EdwardsCurve.prototype.validate = function(point) {\n if (point.isInfinity())\n return !0;\n point.normalize();\n var x2 = point.x.redSqr(), y2 = point.y.redSqr(), lhs = x2.redMul(this.a).redAdd(y2), rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2)));\n return lhs.cmp(rhs) === 0;\n };\n function Point(curve, x, y, z, t) {\n Base.BasePoint.@call(this, curve, \"projective\"), x === null && y === null && z === null \? (this.x = this.curve.zero, this.y = this.curve.one, this.z = this.curve.one, this.t = this.curve.zero, this.zOne = !0) : (this.x = new BN(x, 16), this.y = new BN(y, 16), this.z = z \? new BN(z, 16) : this.curve.one, this.t = t && new BN(t, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.t && !this.t.red && (this.t = this.t.toRed(this.curve.red)), this.zOne = this.z === this.curve.one, this.curve.extended && !this.t && (this.t = this.x.redMul(this.y), this.zOne || (this.t = this.t.redMul(this.z.redInvm()))));\n }\n inherits(Point, Base.BasePoint), EdwardsCurve.prototype.pointFromJSON = function(obj) {\n return Point.fromJSON(this, obj);\n }, EdwardsCurve.prototype.point = function(x, y, z, t) {\n return new Point(this, x, y, z, t);\n }, Point.fromJSON = function(curve, obj) {\n return new Point(curve, obj[0], obj[1], obj[2]);\n }, Point.prototype.inspect = function() {\n return this.isInfinity() \? \"\" : \"\";\n }, Point.prototype.isInfinity = function() {\n return this.x.cmpn(0) === 0 && (this.y.cmp(this.z) === 0 || this.zOne && this.y.cmp(this.curve.c) === 0);\n }, Point.prototype._extDbl = function() {\n var a = this.x.redSqr(), b = this.y.redSqr(), c = this.z.redSqr();\n c = c.redIAdd(c);\n var d = this.curve._mulA(a), e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b), g = d.redAdd(b), f = g.redSub(c), h = d.redSub(b), nx = e.redMul(f), ny = g.redMul(h), nt = e.redMul(h), nz = f.redMul(g);\n return this.curve.point(nx, ny, nz, nt);\n }, Point.prototype._projDbl = function() {\n var b = this.x.redAdd(this.y).redSqr(), c = this.x.redSqr(), d = this.y.redSqr(), nx, ny, nz, e, h, j;\n if (this.curve.twisted) {\n e = this.curve._mulA(c);\n var f = e.redAdd(d);\n this.zOne \? (nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two)), ny = f.redMul(e.redSub(d)), nz = f.redSqr().redSub(f).redSub(f)) : (h = this.z.redSqr(), j = f.redSub(h).redISub(h), nx = b.redSub(c).redISub(d).redMul(j), ny = f.redMul(e.redSub(d)), nz = f.redMul(j));\n } else\n e = c.redAdd(d), h = this.curve._mulC(this.z).redSqr(), j = e.redSub(h).redSub(h), nx = this.curve._mulC(b.redISub(e)).redMul(j), ny = this.curve._mulC(e).redMul(c.redISub(d)), nz = e.redMul(j);\n return this.curve.point(nx, ny, nz);\n }, Point.prototype.dbl = function() {\n return this.isInfinity() \? this : this.curve.extended \? this._extDbl() : this._projDbl();\n }, Point.prototype._extAdd = function(p) {\n var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x)), b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x)), c = this.t.redMul(this.curve.dd).redMul(p.t), d = this.z.redMul(p.z.redAdd(p.z)), e = b.redSub(a), f = d.redSub(c), g = d.redAdd(c), h = b.redAdd(a), nx = e.redMul(f), ny = g.redMul(h), nt = e.redMul(h), nz = f.redMul(g);\n return this.curve.point(nx, ny, nz, nt);\n }, Point.prototype._projAdd = function(p) {\n var a = this.z.redMul(p.z), b = a.redSqr(), c = this.x.redMul(p.x), d = this.y.redMul(p.y), e = this.curve.d.redMul(c).redMul(d), f = b.redSub(e), g = b.redAdd(e), tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d), nx = a.redMul(f).redMul(tmp), ny, nz;\n return this.curve.twisted \? (ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c))), nz = f.redMul(g)) : (ny = a.redMul(g).redMul(d.redSub(c)), nz = this.curve._mulC(f).redMul(g)), this.curve.point(nx, ny, nz);\n }, Point.prototype.add = function(p) {\n return this.isInfinity() \? p : p.isInfinity() \? this : this.curve.extended \? this._extAdd(p) : this._projAdd(p);\n }, Point.prototype.mul = function(k) {\n return this._hasDoubles(k) \? this.curve._fixedNafMul(this, k) : this.curve._wnafMul(this, k);\n }, Point.prototype.mulAdd = function(k1, p, k2) {\n return this.curve._wnafMulAdd(1, [this, p], [k1, k2], 2, !1);\n }, Point.prototype.jmulAdd = function(k1, p, k2) {\n return this.curve._wnafMulAdd(1, [this, p], [k1, k2], 2, !0);\n }, Point.prototype.normalize = function() {\n if (this.zOne)\n return this;\n var zi = this.z.redInvm();\n return this.x = this.x.redMul(zi), this.y = this.y.redMul(zi), this.t && (this.t = this.t.redMul(zi)), this.z = this.curve.one, this.zOne = !0, this;\n }, Point.prototype.neg = function() {\n return this.curve.point(this.x.redNeg(), this.y, this.z, this.t && this.t.redNeg());\n }, Point.prototype.getX = function() {\n return this.normalize(), this.x.fromRed();\n }, Point.prototype.getY = function() {\n return this.normalize(), this.y.fromRed();\n }, Point.prototype.eq = function(other) {\n return this === other || this.getX().cmp(other.getX()) === 0 && this.getY().cmp(other.getY()) === 0;\n }, Point.prototype.eqXToP = function(x) {\n var rx = x.toRed(this.curve.red).redMul(this.z);\n if (this.x.cmp(rx) === 0)\n return !0;\n for (var xc = x.clone(), t = this.curve.redN.redMul(this.z);; ) {\n if (xc.iadd(this.curve.n), xc.cmp(this.curve.p) >= 0)\n return !1;\n if (rx.redIAdd(t), this.x.cmp(rx) === 0)\n return !0;\n }\n }, Point.prototype.toP = Point.prototype.normalize, Point.prototype.mixedAdd = Point.prototype.add;\n }\n}), require_curve = __commonJS({\n \"node_modules/elliptic/lib/elliptic/curve/index.js\"(exports) {\n var curve = exports;\n curve.base = require_base(), curve.short = require_short(), curve.mont = require_mont(), curve.edwards = require_edwards();\n }\n}), require_utils4 = __commonJS({\n \"node_modules/hash.js/lib/hash/utils.js\"(exports) {\n var assert = require_minimalistic_assert(), inherits = require_inherits_browser();\n exports.inherits = inherits;\n function isSurrogatePair(msg, i) {\n return (msg.charCodeAt(i) & 64512) !== 55296 || i < 0 || i + 1 >= msg.length \? !1 : (msg.charCodeAt(i + 1) & 64512) === 56320;\n }\n function toArray(msg, enc) {\n if (@Array.isArray(msg))\n return msg.slice();\n if (!msg)\n return [];\n var res = [];\n if (typeof msg == \"string\")\n if (enc) {\n if (enc === \"hex\")\n for (msg = msg.replace(/[^a-z0-9]+/gi, \"\"), msg.length % 2 !== 0 && (msg = \"0\" + msg), i = 0;i < msg.length; i += 2)\n res.push(parseInt(msg[i] + msg[i + 1], 16));\n } else\n for (var p = 0, i = 0;i < msg.length; i++) {\n var c = msg.charCodeAt(i);\n c < 128 \? res[p++] = c : c < 2048 \? (res[p++] = c >> 6 | 192, res[p++] = c & 63 | 128) : isSurrogatePair(msg, i) \? (c = 65536 + ((c & 1023) << 10) + (msg.charCodeAt(++i) & 1023), res[p++] = c >> 18 | 240, res[p++] = c >> 12 & 63 | 128, res[p++] = c >> 6 & 63 | 128, res[p++] = c & 63 | 128) : (res[p++] = c >> 12 | 224, res[p++] = c >> 6 & 63 | 128, res[p++] = c & 63 | 128);\n }\n else\n for (i = 0;i < msg.length; i++)\n res[i] = msg[i] | 0;\n return res;\n }\n exports.toArray = toArray;\n function toHex(msg) {\n for (var res = \"\", i = 0;i < msg.length; i++)\n res += zero2(msg[i].toString(16));\n return res;\n }\n exports.toHex = toHex;\n function htonl(w) {\n var res = w >>> 24 | w >>> 8 & 65280 | w << 8 & 16711680 | (w & 255) << 24;\n return res >>> 0;\n }\n exports.htonl = htonl;\n function toHex32(msg, endian) {\n for (var res = \"\", i = 0;i < msg.length; i++) {\n var w = msg[i];\n endian === \"little\" && (w = htonl(w)), res += zero8(w.toString(16));\n }\n return res;\n }\n exports.toHex32 = toHex32;\n function zero2(word) {\n return word.length === 1 \? \"0\" + word : word;\n }\n exports.zero2 = zero2;\n function zero8(word) {\n return word.length === 7 \? \"0\" + word : word.length === 6 \? \"00\" + word : word.length === 5 \? \"000\" + word : word.length === 4 \? \"0000\" + word : word.length === 3 \? \"00000\" + word : word.length === 2 \? \"000000\" + word : word.length === 1 \? \"0000000\" + word : word;\n }\n exports.zero8 = zero8;\n function join32(msg, start, end, endian) {\n var len = end - start;\n assert(len % 4 === 0);\n for (var res = new @Array(len / 4), i = 0, k = start;i < res.length; i++, k += 4) {\n var w;\n endian === \"big\" \? w = msg[k] << 24 | msg[k + 1] << 16 | msg[k + 2] << 8 | msg[k + 3] : w = msg[k + 3] << 24 | msg[k + 2] << 16 | msg[k + 1] << 8 | msg[k], res[i] = w >>> 0;\n }\n return res;\n }\n exports.join32 = join32;\n function split32(msg, endian) {\n for (var res = new @Array(msg.length * 4), i = 0, k = 0;i < msg.length; i++, k += 4) {\n var m = msg[i];\n endian === \"big\" \? (res[k] = m >>> 24, res[k + 1] = m >>> 16 & 255, res[k + 2] = m >>> 8 & 255, res[k + 3] = m & 255) : (res[k + 3] = m >>> 24, res[k + 2] = m >>> 16 & 255, res[k + 1] = m >>> 8 & 255, res[k] = m & 255);\n }\n return res;\n }\n exports.split32 = split32;\n function rotr32(w, b) {\n return w >>> b | w << 32 - b;\n }\n exports.rotr32 = rotr32;\n function rotl32(w, b) {\n return w << b | w >>> 32 - b;\n }\n exports.rotl32 = rotl32;\n function sum32(a, b) {\n return a + b >>> 0;\n }\n exports.sum32 = sum32;\n function sum32_3(a, b, c) {\n return a + b + c >>> 0;\n }\n exports.sum32_3 = sum32_3;\n function sum32_4(a, b, c, d) {\n return a + b + c + d >>> 0;\n }\n exports.sum32_4 = sum32_4;\n function sum32_5(a, b, c, d, e) {\n return a + b + c + d + e >>> 0;\n }\n exports.sum32_5 = sum32_5;\n function sum64(buf, pos, ah, al) {\n var bh = buf[pos], bl = buf[pos + 1], lo = al + bl >>> 0, hi = (lo < al \? 1 : 0) + ah + bh;\n buf[pos] = hi >>> 0, buf[pos + 1] = lo;\n }\n exports.sum64 = sum64;\n function sum64_hi(ah, al, bh, bl) {\n var lo = al + bl >>> 0, hi = (lo < al \? 1 : 0) + ah + bh;\n return hi >>> 0;\n }\n exports.sum64_hi = sum64_hi;\n function sum64_lo(ah, al, bh, bl) {\n var lo = al + bl;\n return lo >>> 0;\n }\n exports.sum64_lo = sum64_lo;\n function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) {\n var carry = 0, lo = al;\n lo = lo + bl >>> 0, carry += lo < al \? 1 : 0, lo = lo + cl >>> 0, carry += lo < cl \? 1 : 0, lo = lo + dl >>> 0, carry += lo < dl \? 1 : 0;\n var hi = ah + bh + ch + dh + carry;\n return hi >>> 0;\n }\n exports.sum64_4_hi = sum64_4_hi;\n function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) {\n var lo = al + bl + cl + dl;\n return lo >>> 0;\n }\n exports.sum64_4_lo = sum64_4_lo;\n function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {\n var carry = 0, lo = al;\n lo = lo + bl >>> 0, carry += lo < al \? 1 : 0, lo = lo + cl >>> 0, carry += lo < cl \? 1 : 0, lo = lo + dl >>> 0, carry += lo < dl \? 1 : 0, lo = lo + el >>> 0, carry += lo < el \? 1 : 0;\n var hi = ah + bh + ch + dh + eh + carry;\n return hi >>> 0;\n }\n exports.sum64_5_hi = sum64_5_hi;\n function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {\n var lo = al + bl + cl + dl + el;\n return lo >>> 0;\n }\n exports.sum64_5_lo = sum64_5_lo;\n function rotr64_hi(ah, al, num) {\n var r = al << 32 - num | ah >>> num;\n return r >>> 0;\n }\n exports.rotr64_hi = rotr64_hi;\n function rotr64_lo(ah, al, num) {\n var r = ah << 32 - num | al >>> num;\n return r >>> 0;\n }\n exports.rotr64_lo = rotr64_lo;\n function shr64_hi(ah, al, num) {\n return ah >>> num;\n }\n exports.shr64_hi = shr64_hi;\n function shr64_lo(ah, al, num) {\n var r = ah << 32 - num | al >>> num;\n return r >>> 0;\n }\n exports.shr64_lo = shr64_lo;\n }\n}), require_common = __commonJS({\n \"node_modules/hash.js/lib/hash/common.js\"(exports) {\n var utils = require_utils4(), assert = require_minimalistic_assert();\n function BlockHash() {\n this.pending = null, this.pendingTotal = 0, this.blockSize = this.constructor.blockSize, this.outSize = this.constructor.outSize, this.hmacStrength = this.constructor.hmacStrength, this.padLength = this.constructor.padLength / 8, this.endian = \"big\", this._delta8 = this.blockSize / 8, this._delta32 = this.blockSize / 32;\n }\n BlockHash.prototype = {}, exports.BlockHash = BlockHash, BlockHash.prototype.update = function(msg, enc) {\n if (msg = utils.toArray(msg, enc), this.pending \? this.pending = this.pending.concat(msg) : this.pending = msg, this.pendingTotal += msg.length, this.pending.length >= this._delta8) {\n msg = this.pending;\n var r = msg.length % this._delta8;\n this.pending = msg.slice(msg.length - r, msg.length), this.pending.length === 0 && (this.pending = null), msg = utils.join32(msg, 0, msg.length - r, this.endian);\n for (var i = 0;i < msg.length; i += this._delta32)\n this._update(msg, i, i + this._delta32);\n }\n return this;\n }, BlockHash.prototype.digest = function(enc) {\n return this.update(this._pad()), assert(this.pending === null), this._digest(enc);\n }, BlockHash.prototype._pad = function() {\n var len = this.pendingTotal, bytes = this._delta8, k = bytes - (len + this.padLength) % bytes, res = new @Array(k + this.padLength);\n res[0] = 128;\n for (var i = 1;i < k; i++)\n res[i] = 0;\n if (len <<= 3, this.endian === \"big\") {\n for (var t = 8;t < this.padLength; t++)\n res[i++] = 0;\n res[i++] = 0, res[i++] = 0, res[i++] = 0, res[i++] = 0, res[i++] = len >>> 24 & 255, res[i++] = len >>> 16 & 255, res[i++] = len >>> 8 & 255, res[i++] = len & 255;\n } else\n for (res[i++] = len & 255, res[i++] = len >>> 8 & 255, res[i++] = len >>> 16 & 255, res[i++] = len >>> 24 & 255, res[i++] = 0, res[i++] = 0, res[i++] = 0, res[i++] = 0, t = 8;t < this.padLength; t++)\n res[i++] = 0;\n return res;\n };\n }\n}), require_common2 = __commonJS({\n \"node_modules/hash.js/lib/hash/sha/common.js\"(exports) {\n var utils = require_utils4(), rotr32 = utils.rotr32;\n function ft_1(s, x, y, z) {\n if (s === 0)\n return ch32(x, y, z);\n if (s === 1 || s === 3)\n return p32(x, y, z);\n if (s === 2)\n return maj32(x, y, z);\n }\n exports.ft_1 = ft_1;\n function ch32(x, y, z) {\n return x & y ^ ~x & z;\n }\n exports.ch32 = ch32;\n function maj32(x, y, z) {\n return x & y ^ x & z ^ y & z;\n }\n exports.maj32 = maj32;\n function p32(x, y, z) {\n return x ^ y ^ z;\n }\n exports.p32 = p32;\n function s0_256(x) {\n return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);\n }\n exports.s0_256 = s0_256;\n function s1_256(x) {\n return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);\n }\n exports.s1_256 = s1_256;\n function g0_256(x) {\n return rotr32(x, 7) ^ rotr32(x, 18) ^ x >>> 3;\n }\n exports.g0_256 = g0_256;\n function g1_256(x) {\n return rotr32(x, 17) ^ rotr32(x, 19) ^ x >>> 10;\n }\n exports.g1_256 = g1_256;\n }\n}), require__ = __commonJS({\n \"node_modules/hash.js/lib/hash/sha/1.js\"(exports, module) {\n var utils = require_utils4(), common = require_common(), shaCommon = require_common2(), rotl32 = utils.rotl32, sum32 = utils.sum32, sum32_5 = utils.sum32_5, ft_1 = shaCommon.ft_1, BlockHash = common.BlockHash, sha1_K = [1518500249, 1859775393, 2400959708, 3395469782];\n function SHA1() {\n if (!(this instanceof SHA1))\n return new SHA1;\n BlockHash.@call(this), this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.W = new @Array(80);\n }\n utils.inherits(SHA1, BlockHash), module.exports = SHA1, SHA1.blockSize = 512, SHA1.outSize = 160, SHA1.hmacStrength = 80, SHA1.padLength = 64, SHA1.prototype._update = function(msg, start) {\n for (var W = this.W, i = 0;i < 16; i++)\n W[i] = msg[start + i];\n for (;i < W.length; i++)\n W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);\n var a = this.h[0], b = this.h[1], c = this.h[2], d = this.h[3], e = this.h[4];\n for (i = 0;i < W.length; i++) {\n var s = ~~(i / 20), t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]);\n e = d, d = c, c = rotl32(b, 30), b = a, a = t;\n }\n this.h[0] = sum32(this.h[0], a), this.h[1] = sum32(this.h[1], b), this.h[2] = sum32(this.h[2], c), this.h[3] = sum32(this.h[3], d), this.h[4] = sum32(this.h[4], e);\n }, SHA1.prototype._digest = function(enc) {\n return enc === \"hex\" \? utils.toHex32(this.h, \"big\") : utils.split32(this.h, \"big\");\n };\n }\n}), require__2 = __commonJS({\n \"node_modules/hash.js/lib/hash/sha/256.js\"(exports, module) {\n var utils = require_utils4(), common = require_common(), shaCommon = require_common2(), assert = require_minimalistic_assert(), sum32 = utils.sum32, sum32_4 = utils.sum32_4, sum32_5 = utils.sum32_5, ch32 = shaCommon.ch32, maj32 = shaCommon.maj32, s0_256 = shaCommon.s0_256, s1_256 = shaCommon.s1_256, g0_256 = shaCommon.g0_256, g1_256 = shaCommon.g1_256, BlockHash = common.BlockHash, sha256_K = [\n 1116352408,\n 1899447441,\n 3049323471,\n 3921009573,\n 961987163,\n 1508970993,\n 2453635748,\n 2870763221,\n 3624381080,\n 310598401,\n 607225278,\n 1426881987,\n 1925078388,\n 2162078206,\n 2614888103,\n 3248222580,\n 3835390401,\n 4022224774,\n 264347078,\n 604807628,\n 770255983,\n 1249150122,\n 1555081692,\n 1996064986,\n 2554220882,\n 2821834349,\n 2952996808,\n 3210313671,\n 3336571891,\n 3584528711,\n 113926993,\n 338241895,\n 666307205,\n 773529912,\n 1294757372,\n 1396182291,\n 1695183700,\n 1986661051,\n 2177026350,\n 2456956037,\n 2730485921,\n 2820302411,\n 3259730800,\n 3345764771,\n 3516065817,\n 3600352804,\n 4094571909,\n 275423344,\n 430227734,\n 506948616,\n 659060556,\n 883997877,\n 958139571,\n 1322822218,\n 1537002063,\n 1747873779,\n 1955562222,\n 2024104815,\n 2227730452,\n 2361852424,\n 2428436474,\n 2756734187,\n 3204031479,\n 3329325298\n ];\n function SHA256() {\n if (!(this instanceof SHA256))\n return new SHA256;\n BlockHash.@call(this), this.h = [1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225], this.k = sha256_K, this.W = new @Array(64);\n }\n utils.inherits(SHA256, BlockHash), module.exports = SHA256, SHA256.blockSize = 512, SHA256.outSize = 256, SHA256.hmacStrength = 192, SHA256.padLength = 64, SHA256.prototype._update = function(msg, start) {\n for (var W = this.W, i = 0;i < 16; i++)\n W[i] = msg[start + i];\n for (;i < W.length; i++)\n W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]);\n var a = this.h[0], b = this.h[1], c = this.h[2], d = this.h[3], e = this.h[4], f = this.h[5], g = this.h[6], h = this.h[7];\n for (assert(this.k.length === W.length), i = 0;i < W.length; i++) {\n var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]), T2 = sum32(s0_256(a), maj32(a, b, c));\n h = g, g = f, f = e, e = sum32(d, T1), d = c, c = b, b = a, a = sum32(T1, T2);\n }\n this.h[0] = sum32(this.h[0], a), this.h[1] = sum32(this.h[1], b), this.h[2] = sum32(this.h[2], c), this.h[3] = sum32(this.h[3], d), this.h[4] = sum32(this.h[4], e), this.h[5] = sum32(this.h[5], f), this.h[6] = sum32(this.h[6], g), this.h[7] = sum32(this.h[7], h);\n }, SHA256.prototype._digest = function(enc) {\n return enc === \"hex\" \? utils.toHex32(this.h, \"big\") : utils.split32(this.h, \"big\");\n };\n }\n}), require__3 = __commonJS({\n \"node_modules/hash.js/lib/hash/sha/224.js\"(exports, module) {\n var utils = require_utils4(), SHA256 = require__2();\n function SHA224() {\n if (!(this instanceof SHA224))\n return new SHA224;\n SHA256.@call(this), this.h = [3238371032, 914150663, 812702999, 4144912697, 4290775857, 1750603025, 1694076839, 3204075428];\n }\n utils.inherits(SHA224, SHA256), module.exports = SHA224, SHA224.blockSize = 512, SHA224.outSize = 224, SHA224.hmacStrength = 192, SHA224.padLength = 64, SHA224.prototype._digest = function(enc) {\n return enc === \"hex\" \? utils.toHex32(this.h.slice(0, 7), \"big\") : utils.split32(this.h.slice(0, 7), \"big\");\n };\n }\n}), require__4 = __commonJS({\n \"node_modules/hash.js/lib/hash/sha/512.js\"(exports, module) {\n var utils = require_utils4(), common = require_common(), assert = require_minimalistic_assert(), rotr64_hi = utils.rotr64_hi, rotr64_lo = utils.rotr64_lo, shr64_hi = utils.shr64_hi, shr64_lo = utils.shr64_lo, sum64 = utils.sum64, sum64_hi = utils.sum64_hi, sum64_lo = utils.sum64_lo, sum64_4_hi = utils.sum64_4_hi, sum64_4_lo = utils.sum64_4_lo, sum64_5_hi = utils.sum64_5_hi, sum64_5_lo = utils.sum64_5_lo, BlockHash = common.BlockHash, sha512_K = [\n 1116352408,\n 3609767458,\n 1899447441,\n 602891725,\n 3049323471,\n 3964484399,\n 3921009573,\n 2173295548,\n 961987163,\n 4081628472,\n 1508970993,\n 3053834265,\n 2453635748,\n 2937671579,\n 2870763221,\n 3664609560,\n 3624381080,\n 2734883394,\n 310598401,\n 1164996542,\n 607225278,\n 1323610764,\n 1426881987,\n 3590304994,\n 1925078388,\n 4068182383,\n 2162078206,\n 991336113,\n 2614888103,\n 633803317,\n 3248222580,\n 3479774868,\n 3835390401,\n 2666613458,\n 4022224774,\n 944711139,\n 264347078,\n 2341262773,\n 604807628,\n 2007800933,\n 770255983,\n 1495990901,\n 1249150122,\n 1856431235,\n 1555081692,\n 3175218132,\n 1996064986,\n 2198950837,\n 2554220882,\n 3999719339,\n 2821834349,\n 766784016,\n 2952996808,\n 2566594879,\n 3210313671,\n 3203337956,\n 3336571891,\n 1034457026,\n 3584528711,\n 2466948901,\n 113926993,\n 3758326383,\n 338241895,\n 168717936,\n 666307205,\n 1188179964,\n 773529912,\n 1546045734,\n 1294757372,\n 1522805485,\n 1396182291,\n 2643833823,\n 1695183700,\n 2343527390,\n 1986661051,\n 1014477480,\n 2177026350,\n 1206759142,\n 2456956037,\n 344077627,\n 2730485921,\n 1290863460,\n 2820302411,\n 3158454273,\n 3259730800,\n 3505952657,\n 3345764771,\n 106217008,\n 3516065817,\n 3606008344,\n 3600352804,\n 1432725776,\n 4094571909,\n 1467031594,\n 275423344,\n 851169720,\n 430227734,\n 3100823752,\n 506948616,\n 1363258195,\n 659060556,\n 3750685593,\n 883997877,\n 3785050280,\n 958139571,\n 3318307427,\n 1322822218,\n 3812723403,\n 1537002063,\n 2003034995,\n 1747873779,\n 3602036899,\n 1955562222,\n 1575990012,\n 2024104815,\n 1125592928,\n 2227730452,\n 2716904306,\n 2361852424,\n 442776044,\n 2428436474,\n 593698344,\n 2756734187,\n 3733110249,\n 3204031479,\n 2999351573,\n 3329325298,\n 3815920427,\n 3391569614,\n 3928383900,\n 3515267271,\n 566280711,\n 3940187606,\n 3454069534,\n 4118630271,\n 4000239992,\n 116418474,\n 1914138554,\n 174292421,\n 2731055270,\n 289380356,\n 3203993006,\n 460393269,\n 320620315,\n 685471733,\n 587496836,\n 852142971,\n 1086792851,\n 1017036298,\n 365543100,\n 1126000580,\n 2618297676,\n 1288033470,\n 3409855158,\n 1501505948,\n 4234509866,\n 1607167915,\n 987167468,\n 1816402316,\n 1246189591\n ];\n function SHA512() {\n if (!(this instanceof SHA512))\n return new SHA512;\n BlockHash.@call(this), this.h = [\n 1779033703,\n 4089235720,\n 3144134277,\n 2227873595,\n 1013904242,\n 4271175723,\n 2773480762,\n 1595750129,\n 1359893119,\n 2917565137,\n 2600822924,\n 725511199,\n 528734635,\n 4215389547,\n 1541459225,\n 327033209\n ], this.k = sha512_K, this.W = new @Array(160);\n }\n utils.inherits(SHA512, BlockHash), module.exports = SHA512, SHA512.blockSize = 1024, SHA512.outSize = 512, SHA512.hmacStrength = 192, SHA512.padLength = 128, SHA512.prototype._prepareBlock = function(msg, start) {\n for (var W = this.W, i = 0;i < 32; i++)\n W[i] = msg[start + i];\n for (;i < W.length; i += 2) {\n var c0_hi = g1_512_hi(W[i - 4], W[i - 3]), c0_lo = g1_512_lo(W[i - 4], W[i - 3]), c1_hi = W[i - 14], c1_lo = W[i - 13], c2_hi = g0_512_hi(W[i - 30], W[i - 29]), c2_lo = g0_512_lo(W[i - 30], W[i - 29]), c3_hi = W[i - 32], c3_lo = W[i - 31];\n W[i] = sum64_4_hi(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo), W[i + 1] = sum64_4_lo(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo);\n }\n }, SHA512.prototype._update = function(msg, start) {\n this._prepareBlock(msg, start);\n var W = this.W, ah = this.h[0], al = this.h[1], bh = this.h[2], bl = this.h[3], ch = this.h[4], cl = this.h[5], dh = this.h[6], dl = this.h[7], eh = this.h[8], el = this.h[9], fh = this.h[10], fl = this.h[11], gh = this.h[12], gl = this.h[13], hh = this.h[14], hl = this.h[15];\n assert(this.k.length === W.length);\n for (var i = 0;i < W.length; i += 2) {\n var c0_hi = hh, c0_lo = hl, c1_hi = s1_512_hi(eh, el), c1_lo = s1_512_lo(eh, el), c2_hi = ch64_hi(eh, el, fh, fl, gh, gl), c2_lo = ch64_lo(eh, el, fh, fl, gh, gl), c3_hi = this.k[i], c3_lo = this.k[i + 1], c4_hi = W[i], c4_lo = W[i + 1], T1_hi = sum64_5_hi(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo, c4_hi, c4_lo), T1_lo = sum64_5_lo(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo, c4_hi, c4_lo);\n c0_hi = s0_512_hi(ah, al), c0_lo = s0_512_lo(ah, al), c1_hi = maj64_hi(ah, al, bh, bl, ch, cl), c1_lo = maj64_lo(ah, al, bh, bl, ch, cl);\n var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo), T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo);\n hh = gh, hl = gl, gh = fh, gl = fl, fh = eh, fl = el, eh = sum64_hi(dh, dl, T1_hi, T1_lo), el = sum64_lo(dl, dl, T1_hi, T1_lo), dh = ch, dl = cl, ch = bh, cl = bl, bh = ah, bl = al, ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo), al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo);\n }\n sum64(this.h, 0, ah, al), sum64(this.h, 2, bh, bl), sum64(this.h, 4, ch, cl), sum64(this.h, 6, dh, dl), sum64(this.h, 8, eh, el), sum64(this.h, 10, fh, fl), sum64(this.h, 12, gh, gl), sum64(this.h, 14, hh, hl);\n }, SHA512.prototype._digest = function(enc) {\n return enc === \"hex\" \? utils.toHex32(this.h, \"big\") : utils.split32(this.h, \"big\");\n };\n function ch64_hi(xh, xl, yh, yl, zh) {\n var r = xh & yh ^ ~xh & zh;\n return r < 0 && (r += 4294967296), r;\n }\n function ch64_lo(xh, xl, yh, yl, zh, zl) {\n var r = xl & yl ^ ~xl & zl;\n return r < 0 && (r += 4294967296), r;\n }\n function maj64_hi(xh, xl, yh, yl, zh) {\n var r = xh & yh ^ xh & zh ^ yh & zh;\n return r < 0 && (r += 4294967296), r;\n }\n function maj64_lo(xh, xl, yh, yl, zh, zl) {\n var r = xl & yl ^ xl & zl ^ yl & zl;\n return r < 0 && (r += 4294967296), r;\n }\n function s0_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 28), c1_hi = rotr64_hi(xl, xh, 2), c2_hi = rotr64_hi(xl, xh, 7), r = c0_hi ^ c1_hi ^ c2_hi;\n return r < 0 && (r += 4294967296), r;\n }\n function s0_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 28), c1_lo = rotr64_lo(xl, xh, 2), c2_lo = rotr64_lo(xl, xh, 7), r = c0_lo ^ c1_lo ^ c2_lo;\n return r < 0 && (r += 4294967296), r;\n }\n function s1_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 14), c1_hi = rotr64_hi(xh, xl, 18), c2_hi = rotr64_hi(xl, xh, 9), r = c0_hi ^ c1_hi ^ c2_hi;\n return r < 0 && (r += 4294967296), r;\n }\n function s1_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 14), c1_lo = rotr64_lo(xh, xl, 18), c2_lo = rotr64_lo(xl, xh, 9), r = c0_lo ^ c1_lo ^ c2_lo;\n return r < 0 && (r += 4294967296), r;\n }\n function g0_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 1), c1_hi = rotr64_hi(xh, xl, 8), c2_hi = shr64_hi(xh, xl, 7), r = c0_hi ^ c1_hi ^ c2_hi;\n return r < 0 && (r += 4294967296), r;\n }\n function g0_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 1), c1_lo = rotr64_lo(xh, xl, 8), c2_lo = shr64_lo(xh, xl, 7), r = c0_lo ^ c1_lo ^ c2_lo;\n return r < 0 && (r += 4294967296), r;\n }\n function g1_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 19), c1_hi = rotr64_hi(xl, xh, 29), c2_hi = shr64_hi(xh, xl, 6), r = c0_hi ^ c1_hi ^ c2_hi;\n return r < 0 && (r += 4294967296), r;\n }\n function g1_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 19), c1_lo = rotr64_lo(xl, xh, 29), c2_lo = shr64_lo(xh, xl, 6), r = c0_lo ^ c1_lo ^ c2_lo;\n return r < 0 && (r += 4294967296), r;\n }\n }\n}), require__5 = __commonJS({\n \"node_modules/hash.js/lib/hash/sha/384.js\"(exports, module) {\n var utils = require_utils4(), SHA512 = require__4();\n function SHA384() {\n if (!(this instanceof SHA384))\n return new SHA384;\n SHA512.@call(this), this.h = [\n 3418070365,\n 3238371032,\n 1654270250,\n 914150663,\n 2438529370,\n 812702999,\n 355462360,\n 4144912697,\n 1731405415,\n 4290775857,\n 2394180231,\n 1750603025,\n 3675008525,\n 1694076839,\n 1203062813,\n 3204075428\n ];\n }\n utils.inherits(SHA384, SHA512), module.exports = SHA384, SHA384.blockSize = 1024, SHA384.outSize = 384, SHA384.hmacStrength = 192, SHA384.padLength = 128, SHA384.prototype._digest = function(enc) {\n return enc === \"hex\" \? utils.toHex32(this.h.slice(0, 12), \"big\") : utils.split32(this.h.slice(0, 12), \"big\");\n };\n }\n}), require_sha3 = __commonJS({\n \"node_modules/hash.js/lib/hash/sha.js\"(exports) {\n exports.sha1 = require__(), exports.sha224 = require__3(), exports.sha256 = require__2(), exports.sha384 = require__5(), exports.sha512 = require__4();\n }\n}), require_ripemd = __commonJS({\n \"node_modules/hash.js/lib/hash/ripemd.js\"(exports) {\n var utils = require_utils4(), common = require_common(), rotl32 = utils.rotl32, sum32 = utils.sum32, sum32_3 = utils.sum32_3, sum32_4 = utils.sum32_4, BlockHash = common.BlockHash;\n function RIPEMD160() {\n if (!(this instanceof RIPEMD160))\n return new RIPEMD160;\n BlockHash.@call(this), this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.endian = \"little\";\n }\n utils.inherits(RIPEMD160, BlockHash), exports.ripemd160 = RIPEMD160, RIPEMD160.blockSize = 512, RIPEMD160.outSize = 160, RIPEMD160.hmacStrength = 192, RIPEMD160.padLength = 64, RIPEMD160.prototype._update = function(msg, start) {\n for (var A = this.h[0], B = this.h[1], C = this.h[2], D = this.h[3], E = this.h[4], Ah = A, Bh = B, Ch = C, Dh = D, Eh = E, j = 0;j < 80; j++) {\n var T = sum32(rotl32(sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)), s[j]), E);\n A = E, E = D, D = rotl32(C, 10), C = B, B = T, T = sum32(rotl32(sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)), sh[j]), Eh), Ah = Eh, Eh = Dh, Dh = rotl32(Ch, 10), Ch = Bh, Bh = T;\n }\n T = sum32_3(this.h[1], C, Dh), this.h[1] = sum32_3(this.h[2], D, Eh), this.h[2] = sum32_3(this.h[3], E, Ah), this.h[3] = sum32_3(this.h[4], A, Bh), this.h[4] = sum32_3(this.h[0], B, Ch), this.h[0] = T;\n }, RIPEMD160.prototype._digest = function(enc) {\n return enc === \"hex\" \? utils.toHex32(this.h, \"little\") : utils.split32(this.h, \"little\");\n };\n function f(j, x, y, z) {\n return j <= 15 \? x ^ y ^ z : j <= 31 \? x & y | ~x & z : j <= 47 \? (x | ~y) ^ z : j <= 63 \? x & z | y & ~z : x ^ (y | ~z);\n }\n function K(j) {\n return j <= 15 \? 0 : j <= 31 \? 1518500249 : j <= 47 \? 1859775393 : j <= 63 \? 2400959708 : 2840853838;\n }\n function Kh(j) {\n return j <= 15 \? 1352829926 : j <= 31 \? 1548603684 : j <= 47 \? 1836072691 : j <= 63 \? 2053994217 : 0;\n }\n var r = [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 7,\n 4,\n 13,\n 1,\n 10,\n 6,\n 15,\n 3,\n 12,\n 0,\n 9,\n 5,\n 2,\n 14,\n 11,\n 8,\n 3,\n 10,\n 14,\n 4,\n 9,\n 15,\n 8,\n 1,\n 2,\n 7,\n 0,\n 6,\n 13,\n 11,\n 5,\n 12,\n 1,\n 9,\n 11,\n 10,\n 0,\n 8,\n 12,\n 4,\n 13,\n 3,\n 7,\n 15,\n 14,\n 5,\n 6,\n 2,\n 4,\n 0,\n 5,\n 9,\n 7,\n 12,\n 2,\n 10,\n 14,\n 1,\n 3,\n 8,\n 11,\n 6,\n 15,\n 13\n ], rh = [\n 5,\n 14,\n 7,\n 0,\n 9,\n 2,\n 11,\n 4,\n 13,\n 6,\n 15,\n 8,\n 1,\n 10,\n 3,\n 12,\n 6,\n 11,\n 3,\n 7,\n 0,\n 13,\n 5,\n 10,\n 14,\n 15,\n 8,\n 12,\n 4,\n 9,\n 1,\n 2,\n 15,\n 5,\n 1,\n 3,\n 7,\n 14,\n 6,\n 9,\n 11,\n 8,\n 12,\n 2,\n 10,\n 0,\n 4,\n 13,\n 8,\n 6,\n 4,\n 1,\n 3,\n 11,\n 15,\n 0,\n 5,\n 12,\n 2,\n 13,\n 9,\n 7,\n 10,\n 14,\n 12,\n 15,\n 10,\n 4,\n 1,\n 5,\n 8,\n 7,\n 6,\n 2,\n 13,\n 14,\n 0,\n 3,\n 9,\n 11\n ], s = [\n 11,\n 14,\n 15,\n 12,\n 5,\n 8,\n 7,\n 9,\n 11,\n 13,\n 14,\n 15,\n 6,\n 7,\n 9,\n 8,\n 7,\n 6,\n 8,\n 13,\n 11,\n 9,\n 7,\n 15,\n 7,\n 12,\n 15,\n 9,\n 11,\n 7,\n 13,\n 12,\n 11,\n 13,\n 6,\n 7,\n 14,\n 9,\n 13,\n 15,\n 14,\n 8,\n 13,\n 6,\n 5,\n 12,\n 7,\n 5,\n 11,\n 12,\n 14,\n 15,\n 14,\n 15,\n 9,\n 8,\n 9,\n 14,\n 5,\n 6,\n 8,\n 6,\n 5,\n 12,\n 9,\n 15,\n 5,\n 11,\n 6,\n 8,\n 13,\n 12,\n 5,\n 12,\n 13,\n 14,\n 11,\n 8,\n 5,\n 6\n ], sh = [\n 8,\n 9,\n 9,\n 11,\n 13,\n 15,\n 15,\n 5,\n 7,\n 7,\n 8,\n 11,\n 14,\n 14,\n 12,\n 6,\n 9,\n 13,\n 15,\n 7,\n 12,\n 8,\n 9,\n 11,\n 7,\n 7,\n 12,\n 7,\n 6,\n 15,\n 13,\n 11,\n 9,\n 7,\n 15,\n 11,\n 8,\n 6,\n 6,\n 14,\n 12,\n 13,\n 5,\n 14,\n 13,\n 13,\n 7,\n 5,\n 15,\n 5,\n 8,\n 11,\n 14,\n 14,\n 6,\n 14,\n 6,\n 9,\n 12,\n 9,\n 12,\n 5,\n 15,\n 8,\n 8,\n 5,\n 12,\n 9,\n 12,\n 5,\n 14,\n 6,\n 8,\n 13,\n 6,\n 5,\n 15,\n 13,\n 11,\n 11\n ];\n }\n}), require_hmac = __commonJS({\n \"node_modules/hash.js/lib/hash/hmac.js\"(exports, module) {\n var utils = require_utils4(), assert = require_minimalistic_assert();\n function Hmac(hash, key2, enc) {\n if (key2 = exportIfKeyObject(key2), !(this instanceof Hmac))\n return new Hmac(hash, key2, enc);\n this.Hash = hash, this.blockSize = hash.blockSize / 8, this.outSize = hash.outSize / 8, this.inner = null, this.outer = null, this._init(utils.toArray(key2, enc));\n }\n Hmac.prototype = {}, module.exports = Hmac, Hmac.prototype._init = function(key2) {\n key2.length > this.blockSize && (key2 = new this.Hash().update(key2).digest()), assert(key2.length <= this.blockSize);\n for (var i = key2.length;i < this.blockSize; i++)\n key2.push(0);\n for (i = 0;i < key2.length; i++)\n key2[i] ^= 54;\n for (this.inner = new this.Hash().update(key2), i = 0;i < key2.length; i++)\n key2[i] ^= 106;\n this.outer = new this.Hash().update(key2);\n }, Hmac.prototype.update = function(msg, enc) {\n return this.inner.update(msg, enc), this;\n }, Hmac.prototype.digest = function(enc) {\n return this.outer.update(this.inner.digest()), this.outer.digest(enc);\n };\n }\n}), require_hash2 = __commonJS({\n \"node_modules/hash.js/lib/hash.js\"(exports) {\n var hash = exports;\n hash.utils = require_utils4(), hash.common = require_common(), hash.sha = require_sha3(), hash.ripemd = require_ripemd(), hash.hmac = require_hmac(), hash.sha1 = hash.sha.sha1, hash.sha256 = hash.sha.sha256, hash.sha224 = hash.sha.sha224, hash.sha384 = hash.sha.sha384, hash.sha512 = hash.sha.sha512, hash.ripemd160 = hash.ripemd.ripemd160;\n }\n}), require_secp256k1 = __commonJS({\n \"node_modules/elliptic/lib/elliptic/precomputed/secp256k1.js\"(exports, module) {\n module.exports = {\n doubles: {\n step: 4,\n points: [\n [\n \"e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a\",\n \"f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821\"\n ],\n [\n \"8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508\",\n \"11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf\"\n ],\n [\n \"175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739\",\n \"d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695\"\n ],\n [\n \"363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640\",\n \"4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9\"\n ],\n [\n \"8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c\",\n \"4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36\"\n ],\n [\n \"723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda\",\n \"96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f\"\n ],\n [\n \"eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa\",\n \"5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999\"\n ],\n [\n \"100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0\",\n \"cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09\"\n ],\n [\n \"e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d\",\n \"9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d\"\n ],\n [\n \"feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d\",\n \"e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088\"\n ],\n [\n \"da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1\",\n \"9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d\"\n ],\n [\n \"53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0\",\n \"5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8\"\n ],\n [\n \"8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047\",\n \"10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a\"\n ],\n [\n \"385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862\",\n \"283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453\"\n ],\n [\n \"6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7\",\n \"7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160\"\n ],\n [\n \"3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd\",\n \"56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0\"\n ],\n [\n \"85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83\",\n \"7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6\"\n ],\n [\n \"948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a\",\n \"53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589\"\n ],\n [\n \"6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8\",\n \"bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17\"\n ],\n [\n \"e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d\",\n \"4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda\"\n ],\n [\n \"e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725\",\n \"7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd\"\n ],\n [\n \"213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754\",\n \"4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2\"\n ],\n [\n \"4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c\",\n \"17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6\"\n ],\n [\n \"fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6\",\n \"6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f\"\n ],\n [\n \"76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39\",\n \"c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01\"\n ],\n [\n \"c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891\",\n \"893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3\"\n ],\n [\n \"d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b\",\n \"febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f\"\n ],\n [\n \"b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03\",\n \"2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7\"\n ],\n [\n \"e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d\",\n \"eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78\"\n ],\n [\n \"a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070\",\n \"7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1\"\n ],\n [\n \"90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4\",\n \"e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150\"\n ],\n [\n \"8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da\",\n \"662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82\"\n ],\n [\n \"e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11\",\n \"1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc\"\n ],\n [\n \"8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e\",\n \"efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b\"\n ],\n [\n \"e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41\",\n \"2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51\"\n ],\n [\n \"b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef\",\n \"67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45\"\n ],\n [\n \"d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8\",\n \"db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120\"\n ],\n [\n \"324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d\",\n \"648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84\"\n ],\n [\n \"4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96\",\n \"35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d\"\n ],\n [\n \"9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd\",\n \"ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d\"\n ],\n [\n \"6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5\",\n \"9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8\"\n ],\n [\n \"a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266\",\n \"40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8\"\n ],\n [\n \"7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71\",\n \"34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac\"\n ],\n [\n \"928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac\",\n \"c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f\"\n ],\n [\n \"85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751\",\n \"1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962\"\n ],\n [\n \"ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e\",\n \"493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907\"\n ],\n [\n \"827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241\",\n \"c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec\"\n ],\n [\n \"eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3\",\n \"be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d\"\n ],\n [\n \"e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f\",\n \"4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414\"\n ],\n [\n \"1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19\",\n \"aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd\"\n ],\n [\n \"146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be\",\n \"b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0\"\n ],\n [\n \"fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9\",\n \"6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811\"\n ],\n [\n \"da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2\",\n \"8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1\"\n ],\n [\n \"a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13\",\n \"7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c\"\n ],\n [\n \"174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c\",\n \"ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73\"\n ],\n [\n \"959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba\",\n \"2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd\"\n ],\n [\n \"d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151\",\n \"e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405\"\n ],\n [\n \"64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073\",\n \"d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589\"\n ],\n [\n \"8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458\",\n \"38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e\"\n ],\n [\n \"13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b\",\n \"69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27\"\n ],\n [\n \"bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366\",\n \"d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1\"\n ],\n [\n \"8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa\",\n \"40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482\"\n ],\n [\n \"8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0\",\n \"620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945\"\n ],\n [\n \"dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787\",\n \"7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573\"\n ],\n [\n \"f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e\",\n \"ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82\"\n ]\n ]\n },\n naf: {\n wnd: 7,\n points: [\n [\n \"f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9\",\n \"388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672\"\n ],\n [\n \"2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4\",\n \"d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6\"\n ],\n [\n \"5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc\",\n \"6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da\"\n ],\n [\n \"acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe\",\n \"cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37\"\n ],\n [\n \"774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb\",\n \"d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b\"\n ],\n [\n \"f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8\",\n \"ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81\"\n ],\n [\n \"d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e\",\n \"581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58\"\n ],\n [\n \"defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34\",\n \"4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77\"\n ],\n [\n \"2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c\",\n \"85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a\"\n ],\n [\n \"352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5\",\n \"321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c\"\n ],\n [\n \"2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f\",\n \"2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67\"\n ],\n [\n \"9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714\",\n \"73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402\"\n ],\n [\n \"daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729\",\n \"a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55\"\n ],\n [\n \"c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db\",\n \"2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482\"\n ],\n [\n \"6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4\",\n \"e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82\"\n ],\n [\n \"1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5\",\n \"b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396\"\n ],\n [\n \"605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479\",\n \"2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49\"\n ],\n [\n \"62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d\",\n \"80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf\"\n ],\n [\n \"80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f\",\n \"1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a\"\n ],\n [\n \"7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb\",\n \"d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7\"\n ],\n [\n \"d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9\",\n \"eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933\"\n ],\n [\n \"49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963\",\n \"758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a\"\n ],\n [\n \"77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74\",\n \"958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6\"\n ],\n [\n \"f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530\",\n \"e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37\"\n ],\n [\n \"463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b\",\n \"5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e\"\n ],\n [\n \"f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247\",\n \"cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6\"\n ],\n [\n \"caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1\",\n \"cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476\"\n ],\n [\n \"2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120\",\n \"4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40\"\n ],\n [\n \"7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435\",\n \"91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61\"\n ],\n [\n \"754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18\",\n \"673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683\"\n ],\n [\n \"e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8\",\n \"59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5\"\n ],\n [\n \"186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb\",\n \"3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b\"\n ],\n [\n \"df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f\",\n \"55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417\"\n ],\n [\n \"5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143\",\n \"efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868\"\n ],\n [\n \"290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba\",\n \"e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a\"\n ],\n [\n \"af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45\",\n \"f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6\"\n ],\n [\n \"766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a\",\n \"744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996\"\n ],\n [\n \"59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e\",\n \"c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e\"\n ],\n [\n \"f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8\",\n \"e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d\"\n ],\n [\n \"7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c\",\n \"30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2\"\n ],\n [\n \"948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519\",\n \"e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e\"\n ],\n [\n \"7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab\",\n \"100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437\"\n ],\n [\n \"3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca\",\n \"ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311\"\n ],\n [\n \"d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf\",\n \"8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4\"\n ],\n [\n \"1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610\",\n \"68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575\"\n ],\n [\n \"733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4\",\n \"f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d\"\n ],\n [\n \"15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c\",\n \"d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d\"\n ],\n [\n \"a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940\",\n \"edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629\"\n ],\n [\n \"e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980\",\n \"a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06\"\n ],\n [\n \"311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3\",\n \"66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374\"\n ],\n [\n \"34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf\",\n \"9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee\"\n ],\n [\n \"f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63\",\n \"4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1\"\n ],\n [\n \"d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448\",\n \"fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b\"\n ],\n [\n \"32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf\",\n \"5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661\"\n ],\n [\n \"7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5\",\n \"8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6\"\n ],\n [\n \"ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6\",\n \"8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e\"\n ],\n [\n \"16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5\",\n \"5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d\"\n ],\n [\n \"eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99\",\n \"f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc\"\n ],\n [\n \"78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51\",\n \"f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4\"\n ],\n [\n \"494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5\",\n \"42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c\"\n ],\n [\n \"a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5\",\n \"204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b\"\n ],\n [\n \"c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997\",\n \"4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913\"\n ],\n [\n \"841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881\",\n \"73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154\"\n ],\n [\n \"5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5\",\n \"39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865\"\n ],\n [\n \"36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66\",\n \"d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc\"\n ],\n [\n \"336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726\",\n \"ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224\"\n ],\n [\n \"8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede\",\n \"6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e\"\n ],\n [\n \"1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94\",\n \"60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6\"\n ],\n [\n \"85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31\",\n \"3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511\"\n ],\n [\n \"29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51\",\n \"b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b\"\n ],\n [\n \"a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252\",\n \"ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2\"\n ],\n [\n \"4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5\",\n \"cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c\"\n ],\n [\n \"d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b\",\n \"6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3\"\n ],\n [\n \"ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4\",\n \"322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d\"\n ],\n [\n \"af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f\",\n \"6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700\"\n ],\n [\n \"e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889\",\n \"2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4\"\n ],\n [\n \"591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246\",\n \"b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196\"\n ],\n [\n \"11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984\",\n \"998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4\"\n ],\n [\n \"3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a\",\n \"b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257\"\n ],\n [\n \"cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030\",\n \"bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13\"\n ],\n [\n \"c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197\",\n \"6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096\"\n ],\n [\n \"c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593\",\n \"c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38\"\n ],\n [\n \"a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef\",\n \"21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f\"\n ],\n [\n \"347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38\",\n \"60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448\"\n ],\n [\n \"da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a\",\n \"49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a\"\n ],\n [\n \"c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111\",\n \"5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4\"\n ],\n [\n \"4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502\",\n \"7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437\"\n ],\n [\n \"3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea\",\n \"be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7\"\n ],\n [\n \"cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26\",\n \"8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d\"\n ],\n [\n \"b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986\",\n \"39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a\"\n ],\n [\n \"d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e\",\n \"62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54\"\n ],\n [\n \"48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4\",\n \"25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77\"\n ],\n [\n \"dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda\",\n \"ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517\"\n ],\n [\n \"6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859\",\n \"cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10\"\n ],\n [\n \"e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f\",\n \"f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125\"\n ],\n [\n \"eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c\",\n \"6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e\"\n ],\n [\n \"13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942\",\n \"fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1\"\n ],\n [\n \"ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a\",\n \"1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2\"\n ],\n [\n \"b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80\",\n \"5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423\"\n ],\n [\n \"ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d\",\n \"438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8\"\n ],\n [\n \"8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1\",\n \"cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758\"\n ],\n [\n \"52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63\",\n \"c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375\"\n ],\n [\n \"e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352\",\n \"6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d\"\n ],\n [\n \"7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193\",\n \"ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec\"\n ],\n [\n \"5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00\",\n \"9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0\"\n ],\n [\n \"32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58\",\n \"ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c\"\n ],\n [\n \"e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7\",\n \"d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4\"\n ],\n [\n \"8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8\",\n \"c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f\"\n ],\n [\n \"4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e\",\n \"67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649\"\n ],\n [\n \"3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d\",\n \"cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826\"\n ],\n [\n \"674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b\",\n \"299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5\"\n ],\n [\n \"d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f\",\n \"f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87\"\n ],\n [\n \"30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6\",\n \"462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b\"\n ],\n [\n \"be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297\",\n \"62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc\"\n ],\n [\n \"93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a\",\n \"7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c\"\n ],\n [\n \"b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c\",\n \"ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f\"\n ],\n [\n \"d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52\",\n \"4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a\"\n ],\n [\n \"d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb\",\n \"bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46\"\n ],\n [\n \"463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065\",\n \"bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f\"\n ],\n [\n \"7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917\",\n \"603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03\"\n ],\n [\n \"74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9\",\n \"cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08\"\n ],\n [\n \"30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3\",\n \"553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8\"\n ],\n [\n \"9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57\",\n \"712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373\"\n ],\n [\n \"176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66\",\n \"ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3\"\n ],\n [\n \"75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8\",\n \"9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8\"\n ],\n [\n \"809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721\",\n \"9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1\"\n ],\n [\n \"1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180\",\n \"4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9\"\n ]\n ]\n }\n };\n }\n}), require_curves = __commonJS({\n \"node_modules/elliptic/lib/elliptic/curves.js\"(exports) {\n var curves = exports, hash = require_hash2(), curve = require_curve(), utils = require_utils3(), assert = utils.assert;\n function PresetCurve(options) {\n options.type === \"short\" \? this.curve = new curve.short(options) : options.type === \"edwards\" \? this.curve = new curve.edwards(options) : this.curve = new curve.mont(options), this.g = this.curve.g, this.n = this.curve.n, this.hash = options.hash, assert(this.g.validate(), \"Invalid curve\"), assert(this.g.mul(this.n).isInfinity(), \"Invalid curve, G*N != O\");\n }\n PresetCurve.prototype = {}, curves.PresetCurve = PresetCurve;\n function defineCurve(name, options) {\n Object.defineProperty(curves, name, {\n configurable: !0,\n enumerable: !0,\n get: function() {\n var curve2 = new PresetCurve(options);\n return Object.defineProperty(curves, name, {\n configurable: !0,\n enumerable: !0,\n value: curve2\n }), curve2;\n }\n });\n }\n defineCurve(\"p192\", {\n type: \"short\",\n prime: \"p192\",\n p: \"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff\",\n a: \"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc\",\n b: \"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1\",\n n: \"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831\",\n hash: hash.sha256,\n gRed: !1,\n g: [\n \"188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012\",\n \"07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811\"\n ]\n }), defineCurve(\"p224\", {\n type: \"short\",\n prime: \"p224\",\n p: \"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001\",\n a: \"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe\",\n b: \"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4\",\n n: \"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d\",\n hash: hash.sha256,\n gRed: !1,\n g: [\n \"b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21\",\n \"bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34\"\n ]\n }), defineCurve(\"p256\", {\n type: \"short\",\n prime: null,\n p: \"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff\",\n a: \"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc\",\n b: \"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b\",\n n: \"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551\",\n hash: hash.sha256,\n gRed: !1,\n g: [\n \"6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296\",\n \"4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5\"\n ]\n }), defineCurve(\"p384\", {\n type: \"short\",\n prime: null,\n p: \"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff\",\n a: \"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc\",\n b: \"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef\",\n n: \"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973\",\n hash: hash.sha384,\n gRed: !1,\n g: [\n \"aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7\",\n \"3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f\"\n ]\n }), defineCurve(\"p521\", {\n type: \"short\",\n prime: null,\n p: \"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff\",\n a: \"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc\",\n b: \"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00\",\n n: \"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409\",\n hash: hash.sha512,\n gRed: !1,\n g: [\n \"000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66\",\n \"00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650\"\n ]\n }), defineCurve(\"curve25519\", {\n type: \"mont\",\n prime: \"p25519\",\n p: \"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed\",\n a: \"76d06\",\n b: \"1\",\n n: \"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed\",\n hash: hash.sha256,\n gRed: !1,\n g: [\"9\"]\n }), defineCurve(\"ed25519\", {\n type: \"edwards\",\n prime: \"p25519\",\n p: \"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed\",\n a: \"-1\",\n c: \"1\",\n d: \"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3\",\n n: \"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed\",\n hash: hash.sha256,\n gRed: !1,\n g: [\n \"216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a\",\n \"6666666666666666666666666666666666666666666666666666666666666658\"\n ]\n });\n var pre;\n try {\n pre = require_secp256k1();\n } catch {\n pre = void 0;\n }\n defineCurve(\"secp256k1\", {\n type: \"short\",\n prime: \"k256\",\n p: \"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f\",\n a: \"0\",\n b: \"7\",\n n: \"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141\",\n h: \"1\",\n hash: hash.sha256,\n beta: \"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee\",\n lambda: \"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72\",\n basis: [\n {\n a: \"3086d221a7d46bcde86c90e49284eb15\",\n b: \"-e4437ed6010e88286f547fa90abfe4c3\"\n },\n {\n a: \"114ca50f7a8e2f3f657c1108d9d44cfd8\",\n b: \"3086d221a7d46bcde86c90e49284eb15\"\n }\n ],\n gRed: !1,\n g: [\n \"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798\",\n \"483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8\",\n pre\n ]\n });\n }\n}), require_hmac_drbg = __commonJS({\n \"node_modules/hmac-drbg/lib/hmac-drbg.js\"(exports, module) {\n var hash = require_hash2(), utils = require_utils2(), assert = require_minimalistic_assert();\n function HmacDRBG(options) {\n if (!(this instanceof HmacDRBG))\n return new HmacDRBG(options);\n this.hash = options.hash, this.predResist = !!options.predResist, this.outLen = this.hash.outSize, this.minEntropy = options.minEntropy || this.hash.hmacStrength, this._reseed = null, this.reseedInterval = null, this.K = null, this.V = null;\n var entropy = utils.toArray(options.entropy, options.entropyEnc || \"hex\"), nonce = utils.toArray(options.nonce, options.nonceEnc || \"hex\"), pers = utils.toArray(options.pers, options.persEnc || \"hex\");\n assert(entropy.length >= this.minEntropy / 8, \"Not enough entropy. Minimum is: \" + this.minEntropy + \" bits\"), this._init(entropy, nonce, pers);\n }\n HmacDRBG.prototype = {}, module.exports = HmacDRBG, HmacDRBG.prototype._init = function(entropy, nonce, pers) {\n var seed = entropy.concat(nonce).concat(pers);\n this.K = new @Array(this.outLen / 8), this.V = new @Array(this.outLen / 8);\n for (var i = 0;i < this.V.length; i++)\n this.K[i] = 0, this.V[i] = 1;\n this._update(seed), this._reseed = 1, this.reseedInterval = 281474976710656;\n }, HmacDRBG.prototype._hmac = function() {\n return new hash.hmac(this.hash, this.K);\n }, HmacDRBG.prototype._update = function(seed) {\n var kmac = this._hmac().update(this.V).update([0]);\n seed && (kmac = kmac.update(seed)), this.K = kmac.digest(), this.V = this._hmac().update(this.V).digest(), seed && (this.K = this._hmac().update(this.V).update([1]).update(seed).digest(), this.V = this._hmac().update(this.V).digest());\n }, HmacDRBG.prototype.reseed = function(entropy, entropyEnc, add, addEnc) {\n typeof entropyEnc != \"string\" && (addEnc = add, add = entropyEnc, entropyEnc = null), entropy = utils.toArray(entropy, entropyEnc), add = utils.toArray(add, addEnc), assert(entropy.length >= this.minEntropy / 8, \"Not enough entropy. Minimum is: \" + this.minEntropy + \" bits\"), this._update(entropy.concat(add || [])), this._reseed = 1;\n }, HmacDRBG.prototype.generate = function(len, enc, add, addEnc) {\n if (this._reseed > this.reseedInterval)\n throw new Error(\"Reseed is required\");\n typeof enc != \"string\" && (addEnc = add, add = enc, enc = null), add && (add = utils.toArray(add, addEnc || \"hex\"), this._update(add));\n for (var temp = [];temp.length < len; )\n this.V = this._hmac().update(this.V).digest(), temp = temp.concat(this.V);\n var res = temp.slice(0, len);\n return this._update(add), this._reseed++, utils.encode(res, enc);\n };\n }\n}), require_key = __commonJS({\n \"node_modules/elliptic/lib/elliptic/ec/key.js\"(exports, module) {\n var BN = require_bn4(), utils = require_utils3(), assert = utils.assert;\n function KeyPair(ec, options) {\n this.ec = ec, this.priv = null, this.pub = null, options.priv && this._importPrivate(options.priv, options.privEnc), options.pub && this._importPublic(options.pub, options.pubEnc);\n }\n KeyPair.prototype = {}, module.exports = KeyPair, KeyPair.fromPublic = function(ec, pub, enc) {\n return pub instanceof KeyPair \? pub : new KeyPair(ec, {\n pub,\n pubEnc: enc\n });\n }, KeyPair.fromPrivate = function(ec, priv, enc) {\n return priv instanceof KeyPair \? priv : new KeyPair(ec, {\n priv,\n privEnc: enc\n });\n }, KeyPair.prototype.validate = function() {\n var pub = this.getPublic();\n return pub.isInfinity() \? { result: !1, reason: \"Invalid public key\" } : pub.validate() \? pub.mul(this.ec.curve.n).isInfinity() \? { result: !0, reason: null } : { result: !1, reason: \"Public key * N != O\" } : { result: !1, reason: \"Public key is not a point\" };\n }, KeyPair.prototype.getPublic = function(compact, enc) {\n return typeof compact == \"string\" && (enc = compact, compact = null), this.pub || (this.pub = this.ec.g.mul(this.priv)), enc \? this.pub.encode(enc, compact) : this.pub;\n }, KeyPair.prototype.getPrivate = function(enc) {\n return enc === \"hex\" \? this.priv.toString(16, 2) : this.priv;\n }, KeyPair.prototype._importPrivate = function(key2, enc) {\n this.priv = new BN(key2, enc || 16), this.priv = this.priv.umod(this.ec.curve.n);\n }, KeyPair.prototype._importPublic = function(key2, enc) {\n if (key2.x || key2.y) {\n this.ec.curve.type === \"mont\" \? assert(key2.x, \"Need x coordinate\") : (this.ec.curve.type === \"short\" || this.ec.curve.type === \"edwards\") && assert(key2.x && key2.y, \"Need both x and y coordinate\"), this.pub = this.ec.curve.point(key2.x, key2.y);\n return;\n }\n this.pub = this.ec.curve.decodePoint(key2, enc);\n }, KeyPair.prototype.derive = function(pub) {\n return pub.validate() || assert(pub.validate(), \"public point not validated\"), pub.mul(this.priv).getX();\n }, KeyPair.prototype.sign = function(msg, enc, options) {\n return this.ec.sign(msg, this, enc, options);\n }, KeyPair.prototype.verify = function(msg, signature) {\n return this.ec.verify(msg, signature, this);\n }, KeyPair.prototype.inspect = function() {\n return \"\";\n };\n }\n}), require_signature = __commonJS({\n \"node_modules/elliptic/lib/elliptic/ec/signature.js\"(exports, module) {\n var BN = require_bn4(), utils = require_utils3(), assert = utils.assert;\n function Signature(options, enc) {\n if (options instanceof Signature)\n return options;\n this._importDER(options, enc) || (assert(options.r && options.s, \"Signature without r or s\"), this.r = new BN(options.r, 16), this.s = new BN(options.s, 16), options.recoveryParam === void 0 \? this.recoveryParam = null : this.recoveryParam = options.recoveryParam);\n }\n Signature.prototype = {}, module.exports = Signature;\n function Position() {\n this.place = 0;\n }\n function getLength(buf, p) {\n var initial = buf[p.place++];\n if (!(initial & 128))\n return initial;\n var octetLen = initial & 15;\n if (octetLen === 0 || octetLen > 4)\n return !1;\n for (var val = 0, i = 0, off = p.place;i < octetLen; i++, off++)\n val <<= 8, val |= buf[off], val >>>= 0;\n return val <= 127 \? !1 : (p.place = off, val);\n }\n function rmPadding(buf) {\n for (var i = 0, len = buf.length - 1;!buf[i] && !(buf[i + 1] & 128) && i < len; )\n i++;\n return i === 0 \? buf : buf.slice(i);\n }\n Signature.prototype._importDER = function(data, enc) {\n data = utils.toArray(data, enc);\n var p = new Position;\n if (data[p.place++] !== 48)\n return !1;\n var len = getLength(data, p);\n if (len === !1 || len + p.place !== data.length || data[p.place++] !== 2)\n return !1;\n var rlen = getLength(data, p);\n if (rlen === !1)\n return !1;\n var r = data.slice(p.place, rlen + p.place);\n if (p.place += rlen, data[p.place++] !== 2)\n return !1;\n var slen = getLength(data, p);\n if (slen === !1 || data.length !== slen + p.place)\n return !1;\n var s = data.slice(p.place, slen + p.place);\n if (r[0] === 0)\n if (r[1] & 128)\n r = r.slice(1);\n else\n return !1;\n if (s[0] === 0)\n if (s[1] & 128)\n s = s.slice(1);\n else\n return !1;\n return this.r = new BN(r), this.s = new BN(s), this.recoveryParam = null, !0;\n };\n function constructLength(arr, len) {\n if (len < 128) {\n arr.push(len);\n return;\n }\n var octets = 1 + (Math.log(len) / Math.LN2 >>> 3);\n for (arr.push(octets | 128);--octets; )\n arr.push(len >>> (octets << 3) & 255);\n arr.push(len);\n }\n Signature.prototype.toDER = function(enc) {\n var r = this.r.toArray(), s = this.s.toArray();\n for (r[0] & 128 && (r = [0].concat(r)), s[0] & 128 && (s = [0].concat(s)), r = rmPadding(r), s = rmPadding(s);!s[0] && !(s[1] & 128); )\n s = s.slice(1);\n var arr = [2];\n constructLength(arr, r.length), arr = arr.concat(r), arr.push(2), constructLength(arr, s.length);\n var backHalf = arr.concat(s), res = [48];\n return constructLength(res, backHalf.length), res = res.concat(backHalf), utils.encode(res, enc);\n };\n }\n}), require_ec = __commonJS({\n \"node_modules/elliptic/lib/elliptic/ec/index.js\"(exports, module) {\n var BN = require_bn4(), HmacDRBG = require_hmac_drbg(), utils = require_utils3(), curves = require_curves(), rand = require_brorand(), assert = utils.assert, KeyPair = require_key(), Signature = require_signature();\n function EC(options) {\n if (!(this instanceof EC))\n return new EC(options);\n typeof options == \"string\" && (assert(Object.prototype.hasOwnProperty.@call(curves, options), \"Unknown curve \" + options), options = curves[options]), options instanceof curves.PresetCurve && (options = { curve: options }), this.curve = options.curve.curve, this.n = this.curve.n, this.nh = this.n.ushrn(1), this.g = this.curve.g, this.g = options.curve.g, this.g.precompute(options.curve.n.bitLength() + 1), this.hash = options.hash || options.curve.hash;\n }\n EC.prototype = {}, module.exports = EC, EC.prototype.keyPair = function(options) {\n return new KeyPair(this, options);\n }, EC.prototype.keyFromPrivate = function(priv, enc) {\n return KeyPair.fromPrivate(this, priv, enc);\n }, EC.prototype.keyFromPublic = function(pub, enc) {\n return KeyPair.fromPublic(this, pub, enc);\n }, EC.prototype.genKeyPair = function(options) {\n options || (options = {});\n for (var drbg = new HmacDRBG({\n hash: this.hash,\n pers: options.pers,\n persEnc: options.persEnc || \"utf8\",\n entropy: options.entropy || rand(this.hash.hmacStrength),\n entropyEnc: options.entropy && options.entropyEnc || \"utf8\",\n nonce: this.n.toArray()\n }), bytes = this.n.byteLength(), ns2 = this.n.sub(new BN(2));; ) {\n var priv = new BN(drbg.generate(bytes));\n if (!(priv.cmp(ns2) > 0))\n return priv.iaddn(1), this.keyFromPrivate(priv);\n }\n }, EC.prototype._truncateToN = function(msg, truncOnly) {\n var delta = msg.byteLength() * 8 - this.n.bitLength();\n return delta > 0 && (msg = msg.ushrn(delta)), !truncOnly && msg.cmp(this.n) >= 0 \? msg.sub(this.n) : msg;\n }, EC.prototype.sign = function(msg, key2, enc, options) {\n typeof enc == \"object\" && (options = enc, enc = null), options || (options = {}), key2 = this.keyFromPrivate(key2, enc), msg = this._truncateToN(new BN(msg, 16));\n for (var bytes = this.n.byteLength(), bkey = key2.getPrivate().toArray(\"be\", bytes), nonce = msg.toArray(\"be\", bytes), drbg = new HmacDRBG({\n hash: this.hash,\n entropy: bkey,\n nonce,\n pers: options.pers,\n persEnc: options.persEnc || \"utf8\"\n }), ns1 = this.n.sub(new BN(1)), iter = 0;; iter++) {\n var k = options.k \? options.k(iter) : new BN(drbg.generate(this.n.byteLength()));\n if (k = this._truncateToN(k, !0), !(k.cmpn(1) <= 0 || k.cmp(ns1) >= 0)) {\n var kp = this.g.mul(k);\n if (!kp.isInfinity()) {\n var kpX = kp.getX(), r = kpX.umod(this.n);\n if (r.cmpn(0) !== 0) {\n var s = k.invm(this.n).mul(r.mul(key2.getPrivate()).iadd(msg));\n if (s = s.umod(this.n), s.cmpn(0) !== 0) {\n var recoveryParam = (kp.getY().isOdd() \? 1 : 0) | (kpX.cmp(r) !== 0 \? 2 : 0);\n return options.canonical && s.cmp(this.nh) > 0 && (s = this.n.sub(s), recoveryParam ^= 1), new Signature({ r, s, recoveryParam });\n }\n }\n }\n }\n }\n }, EC.prototype.verify = function(msg, signature, key2, enc) {\n msg = this._truncateToN(new BN(msg, 16)), key2 = this.keyFromPublic(key2, enc), signature = new Signature(signature, \"hex\");\n var { r, s } = signature;\n if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0 || s.cmpn(1) < 0 || s.cmp(this.n) >= 0)\n return !1;\n var sinv = s.invm(this.n), u1 = sinv.mul(msg).umod(this.n), u2 = sinv.mul(r).umod(this.n), p;\n return this.curve._maxwellTrick \? (p = this.g.jmulAdd(u1, key2.getPublic(), u2), p.isInfinity() \? !1 : p.eqXToP(r)) : (p = this.g.mulAdd(u1, key2.getPublic(), u2), p.isInfinity() \? !1 : p.getX().umod(this.n).cmp(r) === 0);\n }, EC.prototype.recoverPubKey = function(msg, signature, j, enc) {\n assert((3 & j) === j, \"The recovery param is more than two bits\"), signature = new Signature(signature, enc);\n var n = this.n, e = new BN(msg), r = signature.r, s = signature.s, isYOdd = j & 1, isSecondKey = j >> 1;\n if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey)\n throw new Error(\"Unable to find sencond key candinate\");\n isSecondKey \? r = this.curve.pointFromX(r.add(this.curve.n), isYOdd) : r = this.curve.pointFromX(r, isYOdd);\n var rInv = signature.r.invm(n), s1 = n.sub(e).mul(rInv).umod(n), s2 = s.mul(rInv).umod(n);\n return this.g.mulAdd(s1, r, s2);\n }, EC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) {\n if (signature = new Signature(signature, enc), signature.recoveryParam !== null)\n return signature.recoveryParam;\n for (var i = 0;i < 4; i++) {\n var Qprime;\n try {\n Qprime = this.recoverPubKey(e, signature, i);\n } catch {\n continue;\n }\n if (Qprime.eq(Q))\n return i;\n }\n throw new Error(\"Unable to find valid recovery factor\");\n };\n }\n}), require_key2 = __commonJS({\n \"node_modules/elliptic/lib/elliptic/eddsa/key.js\"(exports, module) {\n var utils = require_utils3(), assert = utils.assert, parseBytes = utils.parseBytes, cachedProperty = utils.cachedProperty;\n function KeyPair(eddsa, params) {\n this.eddsa = eddsa, this._secret = parseBytes(params.secret), eddsa.isPoint(params.pub) \? this._pub = params.pub : this._pubBytes = parseBytes(params.pub);\n }\n KeyPair.prototype = {}, KeyPair.fromPublic = function(eddsa, pub) {\n return pub instanceof KeyPair \? pub : new KeyPair(eddsa, { pub });\n }, KeyPair.fromSecret = function(eddsa, secret) {\n return secret instanceof KeyPair \? secret : new KeyPair(eddsa, { secret });\n }, KeyPair.prototype.secret = function() {\n return this._secret;\n }, cachedProperty(KeyPair, \"pubBytes\", function() {\n return this.eddsa.encodePoint(this.pub());\n }), cachedProperty(KeyPair, \"pub\", function() {\n return this._pubBytes \? this.eddsa.decodePoint(this._pubBytes) : this.eddsa.g.mul(this.priv());\n }), cachedProperty(KeyPair, \"privBytes\", function() {\n var eddsa = this.eddsa, hash = this.hash(), lastIx = eddsa.encodingLength - 1, a = hash.slice(0, eddsa.encodingLength);\n return a[0] &= 248, a[lastIx] &= 127, a[lastIx] |= 64, a;\n }), cachedProperty(KeyPair, \"priv\", function() {\n return this.eddsa.decodeInt(this.privBytes());\n }), cachedProperty(KeyPair, \"hash\", function() {\n return this.eddsa.hash().update(this.secret()).digest();\n }), cachedProperty(KeyPair, \"messagePrefix\", function() {\n return this.hash().slice(this.eddsa.encodingLength);\n }), KeyPair.prototype.sign = function(message) {\n return assert(this._secret, \"KeyPair can only verify\"), this.eddsa.sign(message, this);\n }, KeyPair.prototype.verify = function(message, sig) {\n return this.eddsa.verify(message, sig, this);\n }, KeyPair.prototype.getSecret = function(enc) {\n return assert(this._secret, \"KeyPair is public only\"), utils.encode(this.secret(), enc);\n }, KeyPair.prototype.getPublic = function(enc) {\n return utils.encode(this.pubBytes(), enc);\n }, module.exports = KeyPair;\n }\n}), require_signature2 = __commonJS({\n \"node_modules/elliptic/lib/elliptic/eddsa/signature.js\"(exports, module) {\n var BN = require_bn4(), utils = require_utils3(), assert = utils.assert, cachedProperty = utils.cachedProperty, parseBytes = utils.parseBytes;\n function Signature(eddsa, sig) {\n this.eddsa = eddsa, typeof sig != \"object\" && (sig = parseBytes(sig)), @Array.isArray(sig) && (sig = {\n R: sig.slice(0, eddsa.encodingLength),\n S: sig.slice(eddsa.encodingLength)\n }), assert(sig.R && sig.S, \"Signature without R or S\"), eddsa.isPoint(sig.R) && (this._R = sig.R), sig.S instanceof BN && (this._S = sig.S), this._Rencoded = @Array.isArray(sig.R) \? sig.R : sig.Rencoded, this._Sencoded = @Array.isArray(sig.S) \? sig.S : sig.Sencoded;\n }\n Signature.prototype = {}, cachedProperty(Signature, \"S\", function() {\n return this.eddsa.decodeInt(this.Sencoded());\n }), cachedProperty(Signature, \"R\", function() {\n return this.eddsa.decodePoint(this.Rencoded());\n }), cachedProperty(Signature, \"Rencoded\", function() {\n return this.eddsa.encodePoint(this.R());\n }), cachedProperty(Signature, \"Sencoded\", function() {\n return this.eddsa.encodeInt(this.S());\n }), Signature.prototype.toBytes = function() {\n return this.Rencoded().concat(this.Sencoded());\n }, Signature.prototype.toHex = function() {\n return utils.encode(this.toBytes(), \"hex\").toUpperCase();\n }, module.exports = Signature;\n }\n}), require_eddsa = __commonJS({\n \"node_modules/elliptic/lib/elliptic/eddsa/index.js\"(exports, module) {\n var hash = require_hash2(), curves = require_curves(), utils = require_utils3(), assert = utils.assert, parseBytes = utils.parseBytes, KeyPair = require_key2(), Signature = require_signature2();\n function EDDSA(curve) {\n if (assert(curve === \"ed25519\", \"only tested with ed25519 so far\"), !(this instanceof EDDSA))\n return new EDDSA(curve);\n curve = curves[curve].curve, this.curve = curve, this.g = curve.g, this.g.precompute(curve.n.bitLength() + 1), this.pointClass = curve.point().constructor, this.encodingLength = Math.ceil(curve.n.bitLength() / 8), this.hash = hash.sha512;\n }\n EDDSA.prototype = {}, module.exports = EDDSA, EDDSA.prototype.sign = function(message, secret) {\n message = parseBytes(message);\n var key2 = this.keyFromSecret(secret), r = this.hashInt(key2.messagePrefix(), message), R = this.g.mul(r), Rencoded = this.encodePoint(R), s_ = this.hashInt(Rencoded, key2.pubBytes(), message).mul(key2.priv()), S = r.add(s_).umod(this.curve.n);\n return this.makeSignature({ R, S, Rencoded });\n }, EDDSA.prototype.verify = function(message, sig, pub) {\n message = parseBytes(message), sig = this.makeSignature(sig);\n var key2 = this.keyFromPublic(pub), h = this.hashInt(sig.Rencoded(), key2.pubBytes(), message), SG = this.g.mul(sig.S()), RplusAh = sig.R().add(key2.pub().mul(h));\n return RplusAh.eq(SG);\n }, EDDSA.prototype.hashInt = function() {\n for (var hash2 = this.hash(), i = 0;i < arguments.length; i++)\n hash2.update(arguments[i]);\n return utils.intFromLE(hash2.digest()).umod(this.curve.n);\n }, EDDSA.prototype.keyFromPublic = function(pub) {\n return KeyPair.fromPublic(this, pub);\n }, EDDSA.prototype.keyFromSecret = function(secret) {\n return KeyPair.fromSecret(this, secret);\n }, EDDSA.prototype.makeSignature = function(sig) {\n return sig instanceof Signature \? sig : new Signature(this, sig);\n }, EDDSA.prototype.encodePoint = function(point) {\n var enc = point.getY().toArray(\"le\", this.encodingLength);\n return enc[this.encodingLength - 1] |= point.getX().isOdd() \? 128 : 0, enc;\n }, EDDSA.prototype.decodePoint = function(bytes) {\n bytes = utils.parseBytes(bytes);\n var lastIx = bytes.length - 1, normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & -129), xIsOdd = (bytes[lastIx] & 128) !== 0, y = utils.intFromLE(normed);\n return this.curve.pointFromY(y, xIsOdd);\n }, EDDSA.prototype.encodeInt = function(num) {\n return num.toArray(\"le\", this.encodingLength);\n }, EDDSA.prototype.decodeInt = function(bytes) {\n return utils.intFromLE(bytes);\n }, EDDSA.prototype.isPoint = function(val) {\n return val instanceof this.pointClass;\n };\n }\n}), require_elliptic = __commonJS({\n \"node_modules/elliptic/lib/elliptic.js\"(exports) {\n var elliptic = exports;\n elliptic.version = require_package().version, elliptic.utils = require_utils3(), elliptic.rand = require_brorand(), elliptic.curve = require_curve(), elliptic.curves = require_curves(), elliptic.ec = require_ec(), elliptic.eddsa = require_eddsa();\n }\n}), require_bn5 = require_bn, require_safer = __commonJS({\n \"node_modules/safer-buffer/safer.js\"(exports, module) {\n var buffer = BufferModule, Buffer2 = Buffer, safer = {}, key2;\n for (key2 in buffer)\n !buffer.hasOwnProperty(key2) || key2 === \"SlowBuffer\" || key2 === \"Buffer\" || (safer[key2] = buffer[key2]);\n var Safer = safer.Buffer = {};\n for (key2 in Buffer2)\n !Buffer2.hasOwnProperty(key2) || key2 === \"allocUnsafe\" || key2 === \"allocUnsafeSlow\" || (Safer[key2] = Buffer2[key2]);\n if (safer.Buffer.prototype = Buffer2.prototype, (!Safer.from || Safer.from === @Uint8Array.from) && (Safer.from = function(value, encodingOrOffset, length) {\n if (typeof value == \"number\")\n @throwTypeError('The \"value\" argument must not be of type number. Received type ' + typeof value);\n if (value && typeof value.length > \"u\")\n @throwTypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \" + typeof value);\n return Buffer2(value, encodingOrOffset, length);\n }), Safer.alloc || (Safer.alloc = function(size, fill, encoding) {\n if (typeof size != \"number\")\n @throwTypeError('The \"size\" argument must be of type number. Received type ' + typeof size);\n if (size < 0 || size >= 2 * (1 << 30))\n @throwRangeError('The value \"' + size + '\" is invalid for option \"size\"');\n var buf = Buffer2(size);\n return !fill || fill.length === 0 \? buf.fill(0) : typeof encoding == \"string\" \? buf.fill(fill, encoding) : buf.fill(fill), buf;\n }), !safer.kStringMaxLength)\n try {\n safer.kStringMaxLength = MAX_STRING_LENGTH;\n } catch {\n }\n safer.constants || (safer.constants = {\n MAX_LENGTH: safer.kMaxLength\n }, safer.kStringMaxLength && (safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength)), module.exports = safer;\n }\n}), require_reporter = __commonJS({\n \"node_modules/asn1.js/lib/asn1/base/reporter.js\"(exports) {\n var inherits = require_inherits_browser();\n function Reporter(options) {\n this._reporterState = {\n obj: null,\n path: [],\n options: options || {},\n errors: []\n };\n }\n Reporter.prototype = {}, exports.Reporter = Reporter, Reporter.prototype.isError = function(obj) {\n return obj instanceof ReporterError;\n }, Reporter.prototype.save = function() {\n let state = this._reporterState;\n return { obj: state.obj, pathLen: state.path.length };\n }, Reporter.prototype.restore = function(data) {\n let state = this._reporterState;\n state.obj = data.obj, state.path = state.path.slice(0, data.pathLen);\n }, Reporter.prototype.enterKey = function(key2) {\n return this._reporterState.path.push(key2);\n }, Reporter.prototype.exitKey = function(index) {\n let state = this._reporterState;\n state.path = state.path.slice(0, index - 1);\n }, Reporter.prototype.leaveKey = function(index, key2, value) {\n let state = this._reporterState;\n this.exitKey(index), state.obj !== null && (state.obj[key2] = value);\n }, Reporter.prototype.path = function() {\n return this._reporterState.path.join(\"/\");\n }, Reporter.prototype.enterObject = function() {\n let state = this._reporterState, prev = state.obj;\n return state.obj = {}, prev;\n }, Reporter.prototype.leaveObject = function(prev) {\n let state = this._reporterState, now = state.obj;\n return state.obj = prev, now;\n }, Reporter.prototype.error = function(msg) {\n let err, state = this._reporterState, inherited = msg instanceof ReporterError;\n if (inherited \? err = msg : err = new ReporterError(state.path.map(function(elem) {\n return \"[\" + JSON.stringify(elem) + \"]\";\n }).join(\"\"), msg.message || msg, msg.stack), !state.options.partial)\n throw err;\n return inherited || state.errors.push(err), err;\n }, Reporter.prototype.wrapResult = function(result) {\n let state = this._reporterState;\n return state.options.partial \? {\n result: this.isError(result) \? null : result,\n errors: state.errors\n } : result;\n };\n function ReporterError(path, msg) {\n this.path = path, this.rethrow(msg);\n }\n inherits(ReporterError, Error), ReporterError.prototype.rethrow = function(msg) {\n if (this.message = msg + \" at: \" + (this.path || \"(shallow)\"), Error.captureStackTrace && Error.captureStackTrace(this, ReporterError), !this.stack)\n try {\n throw new Error(this.message);\n } catch (e) {\n this.stack = e.stack;\n }\n return this;\n };\n }\n}), require_buffer = __commonJS({\n \"node_modules/asn1.js/lib/asn1/base/buffer.js\"(exports) {\n var inherits = require_inherits_browser(), Reporter = require_reporter().Reporter, Buffer2 = require_safer().Buffer;\n function DecoderBuffer(base, options) {\n if (Reporter.@call(this, options), !Buffer2.isBuffer(base)) {\n this.error(\"Input not Buffer\");\n return;\n }\n this.base = base, this.offset = 0, this.length = base.length;\n }\n inherits(DecoderBuffer, Reporter), exports.DecoderBuffer = DecoderBuffer, DecoderBuffer.isDecoderBuffer = function(data) {\n return data instanceof DecoderBuffer \? !0 : typeof data == \"object\" && Buffer2.isBuffer(data.base) && data.constructor.name === \"DecoderBuffer\" && typeof data.offset == \"number\" && typeof data.length == \"number\" && typeof data.save == \"function\" && typeof data.restore == \"function\" && typeof data.isEmpty == \"function\" && typeof data.readUInt8 == \"function\" && typeof data.skip == \"function\" && typeof data.raw == \"function\";\n }, DecoderBuffer.prototype.save = function() {\n return {\n offset: this.offset,\n reporter: Reporter.prototype.save.@call(this)\n };\n }, DecoderBuffer.prototype.restore = function(save) {\n let res = new DecoderBuffer(this.base);\n return res.offset = save.offset, res.length = this.offset, this.offset = save.offset, Reporter.prototype.restore.@call(this, save.reporter), res;\n }, DecoderBuffer.prototype.isEmpty = function() {\n return this.offset === this.length;\n }, DecoderBuffer.prototype.readUInt8 = function(fail) {\n return this.offset + 1 <= this.length \? this.base.readUInt8(this.offset++, !0) : this.error(fail || \"DecoderBuffer overrun\");\n }, DecoderBuffer.prototype.skip = function(bytes, fail) {\n if (!(this.offset + bytes <= this.length))\n return this.error(fail || \"DecoderBuffer overrun\");\n let res = new DecoderBuffer(this.base);\n return res._reporterState = this._reporterState, res.offset = this.offset, res.length = this.offset + bytes, this.offset += bytes, res;\n }, DecoderBuffer.prototype.raw = function(save) {\n return this.base.slice(save \? save.offset : this.offset, this.length);\n };\n function EncoderBuffer(value, reporter) {\n if (@Array.isArray(value))\n this.length = 0, this.value = value.map(function(item) {\n return EncoderBuffer.isEncoderBuffer(item) || (item = new EncoderBuffer(item, reporter)), this.length += item.length, item;\n }, this);\n else if (typeof value == \"number\") {\n if (!(0 <= value && value <= 255))\n return reporter.error(\"non-byte EncoderBuffer value\");\n this.value = value, this.length = 1;\n } else if (typeof value == \"string\")\n this.value = value, this.length = Buffer2.byteLength(value);\n else if (Buffer2.isBuffer(value))\n this.value = value, this.length = value.length;\n else\n return reporter.error(\"Unsupported type: \" + typeof value);\n }\n EncoderBuffer.prototype = {}, exports.EncoderBuffer = EncoderBuffer, EncoderBuffer.isEncoderBuffer = function(data) {\n return data instanceof EncoderBuffer \? !0 : typeof data == \"object\" && data.constructor.name === \"EncoderBuffer\" && typeof data.length == \"number\" && typeof data.join == \"function\";\n }, EncoderBuffer.prototype.join = function(out, offset) {\n return out || (out = Buffer2.alloc(this.length)), offset || (offset = 0), this.length === 0 || (@Array.isArray(this.value) \? this.value.forEach(function(item) {\n item.join(out, offset), offset += item.length;\n }) : (typeof this.value == \"number\" \? out[offset] = this.value : typeof this.value == \"string\" \? out.write(this.value, offset) : Buffer2.isBuffer(this.value) && this.value.copy(out, offset), offset += this.length)), out;\n };\n }\n}), require_node = __commonJS({\n \"node_modules/asn1.js/lib/asn1/base/node.js\"(exports, module) {\n var Reporter = require_reporter().Reporter, EncoderBuffer = require_buffer().EncoderBuffer, DecoderBuffer = require_buffer().DecoderBuffer, assert = require_minimalistic_assert(), tags = [\n \"seq\",\n \"seqof\",\n \"set\",\n \"setof\",\n \"objid\",\n \"bool\",\n \"gentime\",\n \"utctime\",\n \"null_\",\n \"enum\",\n \"int\",\n \"objDesc\",\n \"bitstr\",\n \"bmpstr\",\n \"charstr\",\n \"genstr\",\n \"graphstr\",\n \"ia5str\",\n \"iso646str\",\n \"numstr\",\n \"octstr\",\n \"printstr\",\n \"t61str\",\n \"unistr\",\n \"utf8str\",\n \"videostr\"\n ], methods = [\"key\", \"obj\", \"use\", \"optional\", \"explicit\", \"implicit\", \"def\", \"choice\", \"any\", \"contains\"].concat(tags), overrided = [\n \"_peekTag\",\n \"_decodeTag\",\n \"_use\",\n \"_decodeStr\",\n \"_decodeObjid\",\n \"_decodeTime\",\n \"_decodeNull\",\n \"_decodeInt\",\n \"_decodeBool\",\n \"_decodeList\",\n \"_encodeComposite\",\n \"_encodeStr\",\n \"_encodeObjid\",\n \"_encodeTime\",\n \"_encodeNull\",\n \"_encodeInt\",\n \"_encodeBool\"\n ];\n function Node(enc, parent, name) {\n let state = {};\n this._baseState = state, state.name = name, state.enc = enc, state.parent = parent || null, state.children = null, state.tag = null, state.args = null, state.reverseArgs = null, state.choice = null, state.optional = !1, state.any = !1, state.obj = !1, state.use = null, state.useDecoder = null, state.key = null, state.default = null, state.explicit = null, state.implicit = null, state.contains = null, state.parent || (state.children = [], this._wrap());\n }\n Node.prototype = {}, module.exports = Node;\n var stateProps = [\n \"enc\",\n \"parent\",\n \"children\",\n \"tag\",\n \"args\",\n \"reverseArgs\",\n \"choice\",\n \"optional\",\n \"any\",\n \"obj\",\n \"use\",\n \"alteredUse\",\n \"key\",\n \"default\",\n \"explicit\",\n \"implicit\",\n \"contains\"\n ];\n Node.prototype.clone = function() {\n let state = this._baseState, cstate = {};\n stateProps.forEach(function(prop) {\n cstate[prop] = state[prop];\n });\n let res = new this.constructor(cstate.parent);\n return res._baseState = cstate, res;\n }, Node.prototype._wrap = function() {\n let state = this._baseState;\n methods.forEach(function(method) {\n this[method] = function() {\n let clone = new this.constructor(this);\n return state.children.push(clone), clone[method].@apply(clone, arguments);\n };\n }, this);\n }, Node.prototype._init = function(body) {\n let state = this._baseState;\n assert(state.parent === null), body.@call(this), state.children = state.children.filter(function(child) {\n return child._baseState.parent === this;\n }, this), assert.equal(state.children.length, 1, \"Root node can have only one child\");\n }, Node.prototype._useArgs = function(args) {\n let state = this._baseState, children = args.filter(function(arg) {\n return arg instanceof this.constructor;\n }, this);\n args = args.filter(function(arg) {\n return !(arg instanceof this.constructor);\n }, this), children.length !== 0 && (assert(state.children === null), state.children = children, children.forEach(function(child) {\n child._baseState.parent = this;\n }, this)), args.length !== 0 && (assert(state.args === null), state.args = args, state.reverseArgs = args.map(function(arg) {\n if (typeof arg != \"object\" || arg.constructor !== Object)\n return arg;\n let res = {};\n return Object.keys(arg).forEach(function(key2) {\n key2 == (key2 | 0) && (key2 |= 0);\n let value = arg[key2];\n res[value] = key2;\n }), res;\n }));\n }, overrided.forEach(function(method) {\n Node.prototype[method] = function() {\n let state = this._baseState;\n throw new Error(method + \" not implemented for encoding: \" + state.enc);\n };\n }), tags.forEach(function(tag) {\n Node.prototype[tag] = function() {\n let state = this._baseState, args = @Array.prototype.slice.@call(arguments);\n return assert(state.tag === null), state.tag = tag, this._useArgs(args), this;\n };\n }), Node.prototype.use = function(item) {\n assert(item);\n let state = this._baseState;\n return assert(state.use === null), state.use = item, this;\n }, Node.prototype.optional = function() {\n let state = this._baseState;\n return state.optional = !0, this;\n }, Node.prototype.def = function(val) {\n let state = this._baseState;\n return assert(state.default === null), state.default = val, state.optional = !0, this;\n }, Node.prototype.explicit = function(num) {\n let state = this._baseState;\n return assert(state.explicit === null && state.implicit === null), state.explicit = num, this;\n }, Node.prototype.implicit = function(num) {\n let state = this._baseState;\n return assert(state.explicit === null && state.implicit === null), state.implicit = num, this;\n }, Node.prototype.obj = function() {\n let state = this._baseState, args = @Array.prototype.slice.@call(arguments);\n return state.obj = !0, args.length !== 0 && this._useArgs(args), this;\n }, Node.prototype.key = function(newKey) {\n let state = this._baseState;\n return assert(state.key === null), state.key = newKey, this;\n }, Node.prototype.any = function() {\n let state = this._baseState;\n return state.any = !0, this;\n }, Node.prototype.choice = function(obj) {\n let state = this._baseState;\n return assert(state.choice === null), state.choice = obj, this._useArgs(Object.keys(obj).map(function(key2) {\n return obj[key2];\n })), this;\n }, Node.prototype.contains = function(item) {\n let state = this._baseState;\n return assert(state.use === null), state.contains = item, this;\n }, Node.prototype._decode = function(input, options) {\n let state = this._baseState;\n if (state.parent === null)\n return input.wrapResult(state.children[0]._decode(input, options));\n let result = state.default, present = !0, prevKey = null;\n if (state.key !== null && (prevKey = input.enterKey(state.key)), state.optional) {\n let tag = null;\n if (state.explicit !== null \? tag = state.explicit : state.implicit !== null \? tag = state.implicit : state.tag !== null && (tag = state.tag), tag === null && !state.any) {\n let save = input.save();\n try {\n state.choice === null \? this._decodeGeneric(state.tag, input, options) : this._decodeChoice(input, options), present = !0;\n } catch {\n present = !1;\n }\n input.restore(save);\n } else if (present = this._peekTag(input, tag, state.any), input.isError(present))\n return present;\n }\n let prevObj;\n if (state.obj && present && (prevObj = input.enterObject()), present) {\n if (state.explicit !== null) {\n let explicit = this._decodeTag(input, state.explicit);\n if (input.isError(explicit))\n return explicit;\n input = explicit;\n }\n let start = input.offset;\n if (state.use === null && state.choice === null) {\n let save;\n state.any && (save = input.save());\n let body = this._decodeTag(input, state.implicit !== null \? state.implicit : state.tag, state.any);\n if (input.isError(body))\n return body;\n state.any \? result = input.raw(save) : input = body;\n }\n if (options && options.track && state.tag !== null && options.track(input.path(), start, input.length, \"tagged\"), options && options.track && state.tag !== null && options.track(input.path(), input.offset, input.length, \"content\"), state.any || (state.choice === null \? result = this._decodeGeneric(state.tag, input, options) : result = this._decodeChoice(input, options)), input.isError(result))\n return result;\n if (!state.any && state.choice === null && state.children !== null && state.children.forEach(function(child) {\n child._decode(input, options);\n }), state.contains && (state.tag === \"octstr\" || state.tag === \"bitstr\")) {\n let data = new DecoderBuffer(result);\n result = this._getUse(state.contains, input._reporterState.obj)._decode(data, options);\n }\n }\n return state.obj && present && (result = input.leaveObject(prevObj)), state.key !== null && (result !== null || present === !0) \? input.leaveKey(prevKey, state.key, result) : prevKey !== null && input.exitKey(prevKey), result;\n }, Node.prototype._decodeGeneric = function(tag, input, options) {\n let state = this._baseState;\n return tag === \"seq\" || tag === \"set\" \? null : tag === \"seqof\" || tag === \"setof\" \? this._decodeList(input, tag, state.args[0], options) : /str$/.test(tag) \? this._decodeStr(input, tag, options) : tag === \"objid\" && state.args \? this._decodeObjid(input, state.args[0], state.args[1], options) : tag === \"objid\" \? this._decodeObjid(input, null, null, options) : tag === \"gentime\" || tag === \"utctime\" \? this._decodeTime(input, tag, options) : tag === \"null_\" \? this._decodeNull(input, options) : tag === \"bool\" \? this._decodeBool(input, options) : tag === \"objDesc\" \? this._decodeStr(input, tag, options) : tag === \"int\" || tag === \"enum\" \? this._decodeInt(input, state.args && state.args[0], options) : state.use !== null \? this._getUse(state.use, input._reporterState.obj)._decode(input, options) : input.error(\"unknown tag: \" + tag);\n }, Node.prototype._getUse = function(entity, obj) {\n let state = this._baseState;\n return state.useDecoder = this._use(entity, obj), assert(state.useDecoder._baseState.parent === null), state.useDecoder = state.useDecoder._baseState.children[0], state.implicit !== state.useDecoder._baseState.implicit && (state.useDecoder = state.useDecoder.clone(), state.useDecoder._baseState.implicit = state.implicit), state.useDecoder;\n }, Node.prototype._decodeChoice = function(input, options) {\n let state = this._baseState, result = null, match = !1;\n return Object.keys(state.choice).some(function(key2) {\n let save = input.save(), node = state.choice[key2];\n try {\n let value = node._decode(input, options);\n if (input.isError(value))\n return !1;\n result = { type: key2, value }, match = !0;\n } catch {\n return input.restore(save), !1;\n }\n return !0;\n }, this), match \? result : input.error(\"Choice not matched\");\n }, Node.prototype._createEncoderBuffer = function(data) {\n return new EncoderBuffer(data, this.reporter);\n }, Node.prototype._encode = function(data, reporter, parent) {\n let state = this._baseState;\n if (state.default !== null && state.default === data)\n return;\n let result = this._encodeValue(data, reporter, parent);\n if (result !== void 0 && !this._skipDefault(result, reporter, parent))\n return result;\n }, Node.prototype._encodeValue = function(data, reporter, parent) {\n let state = this._baseState;\n if (state.parent === null)\n return state.children[0]._encode(data, reporter || new Reporter);\n let result = null;\n if (this.reporter = reporter, state.optional && data === void 0)\n if (state.default !== null)\n data = state.default;\n else\n return;\n let content = null, primitive = !1;\n if (state.any)\n result = this._createEncoderBuffer(data);\n else if (state.choice)\n result = this._encodeChoice(data, reporter);\n else if (state.contains)\n content = this._getUse(state.contains, parent)._encode(data, reporter), primitive = !0;\n else if (state.children)\n content = state.children.map(function(child) {\n if (child._baseState.tag === \"null_\")\n return child._encode(null, reporter, data);\n if (child._baseState.key === null)\n return reporter.error(\"Child should have a key\");\n let prevKey = reporter.enterKey(child._baseState.key);\n if (typeof data != \"object\")\n return reporter.error(\"Child expected, but input is not object\");\n let res = child._encode(data[child._baseState.key], reporter, data);\n return reporter.leaveKey(prevKey), res;\n }, this).filter(function(child) {\n return child;\n }), content = this._createEncoderBuffer(content);\n else if (state.tag === \"seqof\" || state.tag === \"setof\") {\n if (!(state.args && state.args.length === 1))\n return reporter.error(\"Too many args for : \" + state.tag);\n if (!@Array.isArray(data))\n return reporter.error(\"seqof/setof, but data is not Array\");\n let child = this.clone();\n child._baseState.implicit = null, content = this._createEncoderBuffer(data.map(function(item) {\n let state2 = this._baseState;\n return this._getUse(state2.args[0], data)._encode(item, reporter);\n }, child));\n } else\n state.use !== null \? result = this._getUse(state.use, parent)._encode(data, reporter) : (content = this._encodePrimitive(state.tag, data), primitive = !0);\n if (!state.any && state.choice === null) {\n let tag = state.implicit !== null \? state.implicit : state.tag, cls = state.implicit === null \? \"universal\" : \"context\";\n tag === null \? state.use === null && reporter.error(\"Tag could be omitted only for .use()\") : state.use === null && (result = this._encodeComposite(tag, primitive, cls, content));\n }\n return state.explicit !== null && (result = this._encodeComposite(state.explicit, !1, \"context\", result)), result;\n }, Node.prototype._encodeChoice = function(data, reporter) {\n let state = this._baseState, node = state.choice[data.type];\n return node || assert(!1, data.type + \" not found in \" + JSON.stringify(Object.keys(state.choice))), node._encode(data.value, reporter);\n }, Node.prototype._encodePrimitive = function(tag, data) {\n let state = this._baseState;\n if (/str$/.test(tag))\n return this._encodeStr(data, tag);\n if (tag === \"objid\" && state.args)\n return this._encodeObjid(data, state.reverseArgs[0], state.args[1]);\n if (tag === \"objid\")\n return this._encodeObjid(data, null, null);\n if (tag === \"gentime\" || tag === \"utctime\")\n return this._encodeTime(data, tag);\n if (tag === \"null_\")\n return this._encodeNull();\n if (tag === \"int\" || tag === \"enum\")\n return this._encodeInt(data, state.args && state.reverseArgs[0]);\n if (tag === \"bool\")\n return this._encodeBool(data);\n if (tag === \"objDesc\")\n return this._encodeStr(data, tag);\n throw new Error(\"Unsupported tag: \" + tag);\n }, Node.prototype._isNumstr = function(str) {\n return /^[0-9 ]*$/.test(str);\n }, Node.prototype._isPrintstr = function(str) {\n return /^[A-Za-z0-9 '()+,-./:=\?]*$/.test(str);\n };\n }\n}), require_der = __commonJS({\n \"node_modules/asn1.js/lib/asn1/constants/der.js\"(exports) {\n function reverse(map) {\n let res = {};\n return Object.keys(map).forEach(function(key2) {\n (key2 | 0) == key2 && (key2 = key2 | 0);\n let value = map[key2];\n res[value] = key2;\n }), res;\n }\n exports.tagClass = {\n 0: \"universal\",\n 1: \"application\",\n 2: \"context\",\n 3: \"private\"\n }, exports.tagClassByName = reverse(exports.tagClass), exports.tag = {\n 0: \"end\",\n 1: \"bool\",\n 2: \"int\",\n 3: \"bitstr\",\n 4: \"octstr\",\n 5: \"null_\",\n 6: \"objid\",\n 7: \"objDesc\",\n 8: \"external\",\n 9: \"real\",\n 10: \"enum\",\n 11: \"embed\",\n 12: \"utf8str\",\n 13: \"relativeOid\",\n 16: \"seq\",\n 17: \"set\",\n 18: \"numstr\",\n 19: \"printstr\",\n 20: \"t61str\",\n 21: \"videostr\",\n 22: \"ia5str\",\n 23: \"utctime\",\n 24: \"gentime\",\n 25: \"graphstr\",\n 26: \"iso646str\",\n 27: \"genstr\",\n 28: \"unistr\",\n 29: \"charstr\",\n 30: \"bmpstr\"\n }, exports.tagByName = reverse(exports.tag);\n }\n}), require_der2 = __commonJS({\n \"node_modules/asn1.js/lib/asn1/encoders/der.js\"(exports, module) {\n var inherits = require_inherits_browser(), Buffer2 = require_safer().Buffer, Node = require_node(), der = require_der();\n function DEREncoder(entity) {\n this.enc = \"der\", this.name = entity.name, this.entity = entity, this.tree = new DERNode, this.tree._init(entity.body);\n }\n DEREncoder.prototype = {}, module.exports = DEREncoder, DEREncoder.prototype.encode = function(data, reporter) {\n return this.tree._encode(data, reporter).join();\n };\n function DERNode(parent) {\n Node.@call(this, \"der\", parent);\n }\n inherits(DERNode, Node), DERNode.prototype._encodeComposite = function(tag, primitive, cls, content) {\n let encodedTag = encodeTag(tag, primitive, cls, this.reporter);\n if (content.length < 128) {\n let header2 = Buffer2.alloc(2);\n return header2[0] = encodedTag, header2[1] = content.length, this._createEncoderBuffer([header2, content]);\n }\n let lenOctets = 1;\n for (let i = content.length;i >= 256; i >>= 8)\n lenOctets++;\n let header = Buffer2.alloc(2 + lenOctets);\n header[0] = encodedTag, header[1] = 128 | lenOctets;\n for (let i = 1 + lenOctets, j = content.length;j > 0; i--, j >>= 8)\n header[i] = j & 255;\n return this._createEncoderBuffer([header, content]);\n }, DERNode.prototype._encodeStr = function(str, tag) {\n if (tag === \"bitstr\")\n return this._createEncoderBuffer([str.unused | 0, str.data]);\n if (tag === \"bmpstr\") {\n let buf = Buffer2.alloc(str.length * 2);\n for (let i = 0;i < str.length; i++)\n buf.writeUInt16BE(str.charCodeAt(i), i * 2);\n return this._createEncoderBuffer(buf);\n } else\n return tag === \"numstr\" \? this._isNumstr(str) \? this._createEncoderBuffer(str) : this.reporter.error(\"Encoding of string type: numstr supports only digits and space\") : tag === \"printstr\" \? this._isPrintstr(str) \? this._createEncoderBuffer(str) : this.reporter.error(\"Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark\") : /str$/.test(tag) \? this._createEncoderBuffer(str) : tag === \"objDesc\" \? this._createEncoderBuffer(str) : this.reporter.error(\"Encoding of string type: \" + tag + \" unsupported\");\n }, DERNode.prototype._encodeObjid = function(id, values, relative) {\n if (typeof id == \"string\") {\n if (!values)\n return this.reporter.error(\"string objid given, but no values map found\");\n if (!values.hasOwnProperty(id))\n return this.reporter.error(\"objid not found in values map\");\n id = values[id].split(/[\\s.]+/g);\n for (let i = 0;i < id.length; i++)\n id[i] |= 0;\n } else if (@Array.isArray(id)) {\n id = id.slice();\n for (let i = 0;i < id.length; i++)\n id[i] |= 0;\n }\n if (!@Array.isArray(id))\n return this.reporter.error(\"objid() should be either array or string, got: \" + JSON.stringify(id));\n if (!relative) {\n if (id[1] >= 40)\n return this.reporter.error(\"Second objid identifier OOB\");\n id.splice(0, 2, id[0] * 40 + id[1]);\n }\n let size = 0;\n for (let i = 0;i < id.length; i++) {\n let ident = id[i];\n for (size++;ident >= 128; ident >>= 7)\n size++;\n }\n let objid = Buffer2.alloc(size), offset = objid.length - 1;\n for (let i = id.length - 1;i >= 0; i--) {\n let ident = id[i];\n for (objid[offset--] = ident & 127;(ident >>= 7) > 0; )\n objid[offset--] = 128 | ident & 127;\n }\n return this._createEncoderBuffer(objid);\n };\n function two(num) {\n return num < 10 \? \"0\" + num : num;\n }\n DERNode.prototype._encodeTime = function(time, tag) {\n let str, date = new Date(time);\n return tag === \"gentime\" \? str = [\n two(date.getUTCFullYear()),\n two(date.getUTCMonth() + 1),\n two(date.getUTCDate()),\n two(date.getUTCHours()),\n two(date.getUTCMinutes()),\n two(date.getUTCSeconds()),\n \"Z\"\n ].join(\"\") : tag === \"utctime\" \? str = [\n two(date.getUTCFullYear() % 100),\n two(date.getUTCMonth() + 1),\n two(date.getUTCDate()),\n two(date.getUTCHours()),\n two(date.getUTCMinutes()),\n two(date.getUTCSeconds()),\n \"Z\"\n ].join(\"\") : this.reporter.error(\"Encoding \" + tag + \" time is not supported yet\"), this._encodeStr(str, \"octstr\");\n }, DERNode.prototype._encodeNull = function() {\n return this._createEncoderBuffer(\"\");\n }, DERNode.prototype._encodeInt = function(num, values) {\n if (typeof num == \"string\") {\n if (!values)\n return this.reporter.error(\"String int or enum given, but no values map\");\n if (!values.hasOwnProperty(num))\n return this.reporter.error(\"Values map doesn't contain: \" + JSON.stringify(num));\n num = values[num];\n }\n if (typeof num != \"number\" && !Buffer2.isBuffer(num)) {\n let numArray = num.toArray();\n !num.sign && numArray[0] & 128 && numArray.unshift(0), num = Buffer2.from(numArray);\n }\n if (Buffer2.isBuffer(num)) {\n let size2 = num.length;\n num.length === 0 && size2++;\n let out2 = Buffer2.alloc(size2);\n return num.copy(out2), num.length === 0 && (out2[0] = 0), this._createEncoderBuffer(out2);\n }\n if (num < 128)\n return this._createEncoderBuffer(num);\n if (num < 256)\n return this._createEncoderBuffer([0, num]);\n let size = 1;\n for (let i = num;i >= 256; i >>= 8)\n size++;\n let out = new @Array(size);\n for (let i = out.length - 1;i >= 0; i--)\n out[i] = num & 255, num >>= 8;\n return out[0] & 128 && out.unshift(0), this._createEncoderBuffer(Buffer2.from(out));\n }, DERNode.prototype._encodeBool = function(value) {\n return this._createEncoderBuffer(value \? 255 : 0);\n }, DERNode.prototype._use = function(entity, obj) {\n return typeof entity == \"function\" && (entity = entity(obj)), entity._getEncoder(\"der\").tree;\n }, DERNode.prototype._skipDefault = function(dataBuffer, reporter, parent) {\n let state = this._baseState, i;\n if (state.default === null)\n return !1;\n let data = dataBuffer.join();\n if (state.defaultBuffer === void 0 && (state.defaultBuffer = this._encodeValue(state.default, reporter, parent).join()), data.length !== state.defaultBuffer.length)\n return !1;\n for (i = 0;i < data.length; i++)\n if (data[i] !== state.defaultBuffer[i])\n return !1;\n return !0;\n };\n function encodeTag(tag, primitive, cls, reporter) {\n let res;\n if (tag === \"seqof\" \? tag = \"seq\" : tag === \"setof\" && (tag = \"set\"), der.tagByName.hasOwnProperty(tag))\n res = der.tagByName[tag];\n else if (typeof tag == \"number\" && (tag | 0) === tag)\n res = tag;\n else\n return reporter.error(\"Unknown tag: \" + tag);\n return res >= 31 \? reporter.error(\"Multi-octet tag encoding unsupported\") : (primitive || (res |= 32), res |= der.tagClassByName[cls || \"universal\"] << 6, res);\n }\n }\n}), require_pem = __commonJS({\n \"node_modules/asn1.js/lib/asn1/encoders/pem.js\"(exports, module) {\n var inherits = require_inherits_browser(), DEREncoder = require_der2();\n function PEMEncoder(entity) {\n DEREncoder.@call(this, entity), this.enc = \"pem\";\n }\n inherits(PEMEncoder, DEREncoder), module.exports = PEMEncoder, PEMEncoder.prototype.encode = function(data, options) {\n let p = DEREncoder.prototype.encode.@call(this, data).toString(\"base64\"), out = [\"-----BEGIN \" + options.label + \"-----\"];\n for (let i = 0;i < p.length; i += 64)\n out.push(p.slice(i, i + 64));\n return out.push(\"-----END \" + options.label + \"-----\"), out.join(`\n`);\n };\n }\n}), require_encoders = __commonJS({\n \"node_modules/asn1.js/lib/asn1/encoders/index.js\"(exports) {\n var encoders = exports;\n encoders.der = require_der2(), encoders.pem = require_pem();\n }\n}), require_der3 = __commonJS({\n \"node_modules/asn1.js/lib/asn1/decoders/der.js\"(exports, module) {\n var inherits = require_inherits_browser(), bignum = require_bn5(), DecoderBuffer = require_buffer().DecoderBuffer, Node = require_node(), der = require_der();\n function DERDecoder(entity) {\n this.enc = \"der\", this.name = entity.name, this.entity = entity, this.tree = new DERNode, this.tree._init(entity.body);\n }\n DERDecoder.prototype = {}, module.exports = DERDecoder, DERDecoder.prototype.decode = function(data, options) {\n return DecoderBuffer.isDecoderBuffer(data) || (data = new DecoderBuffer(data, options)), this.tree._decode(data, options);\n };\n function DERNode(parent) {\n Node.@call(this, \"der\", parent);\n }\n inherits(DERNode, Node), DERNode.prototype._peekTag = function(buffer, tag, any) {\n if (buffer.isEmpty())\n return !1;\n let state = buffer.save(), decodedTag = derDecodeTag(buffer, 'Failed to peek tag: \"' + tag + '\"');\n return buffer.isError(decodedTag) \? decodedTag : (buffer.restore(state), decodedTag.tag === tag || decodedTag.tagStr === tag || decodedTag.tagStr + \"of\" === tag || any);\n }, DERNode.prototype._decodeTag = function(buffer, tag, any) {\n let decodedTag = derDecodeTag(buffer, 'Failed to decode tag of \"' + tag + '\"');\n if (buffer.isError(decodedTag))\n return decodedTag;\n let len = derDecodeLen(buffer, decodedTag.primitive, 'Failed to get length of \"' + tag + '\"');\n if (buffer.isError(len))\n return len;\n if (!any && decodedTag.tag !== tag && decodedTag.tagStr !== tag && decodedTag.tagStr + \"of\" !== tag)\n return buffer.error('Failed to match tag: \"' + tag + '\"');\n if (decodedTag.primitive || len !== null)\n return buffer.skip(len, 'Failed to match body of: \"' + tag + '\"');\n let state = buffer.save(), res = this._skipUntilEnd(buffer, 'Failed to skip indefinite length body: \"' + this.tag + '\"');\n return buffer.isError(res) \? res : (len = buffer.offset - state.offset, buffer.restore(state), buffer.skip(len, 'Failed to match body of: \"' + tag + '\"'));\n }, DERNode.prototype._skipUntilEnd = function(buffer, fail) {\n for (;; ) {\n let tag = derDecodeTag(buffer, fail);\n if (buffer.isError(tag))\n return tag;\n let len = derDecodeLen(buffer, tag.primitive, fail);\n if (buffer.isError(len))\n return len;\n let res;\n if (tag.primitive || len !== null \? res = buffer.skip(len) : res = this._skipUntilEnd(buffer, fail), buffer.isError(res))\n return res;\n if (tag.tagStr === \"end\")\n break;\n }\n }, DERNode.prototype._decodeList = function(buffer, tag, decoder, options) {\n let result = [];\n for (;!buffer.isEmpty(); ) {\n let possibleEnd = this._peekTag(buffer, \"end\");\n if (buffer.isError(possibleEnd))\n return possibleEnd;\n let res = decoder.decode(buffer, \"der\", options);\n if (buffer.isError(res) && possibleEnd)\n break;\n result.push(res);\n }\n return result;\n }, DERNode.prototype._decodeStr = function(buffer, tag) {\n if (tag === \"bitstr\") {\n let unused = buffer.readUInt8();\n return buffer.isError(unused) \? unused : { unused, data: buffer.raw() };\n } else if (tag === \"bmpstr\") {\n let raw = buffer.raw();\n if (raw.length % 2 === 1)\n return buffer.error(\"Decoding of string type: bmpstr length mismatch\");\n let str = \"\";\n for (let i = 0;i < raw.length / 2; i++)\n str += @String.fromCharCode(raw.readUInt16BE(i * 2));\n return str;\n } else if (tag === \"numstr\") {\n let numstr = buffer.raw().toString(\"ascii\");\n return this._isNumstr(numstr) \? numstr : buffer.error(\"Decoding of string type: numstr unsupported characters\");\n } else {\n if (tag === \"octstr\")\n return buffer.raw();\n if (tag === \"objDesc\")\n return buffer.raw();\n if (tag === \"printstr\") {\n let printstr = buffer.raw().toString(\"ascii\");\n return this._isPrintstr(printstr) \? printstr : buffer.error(\"Decoding of string type: printstr unsupported characters\");\n } else\n return /str$/.test(tag) \? buffer.raw().toString() : buffer.error(\"Decoding of string type: \" + tag + \" unsupported\");\n }\n }, DERNode.prototype._decodeObjid = function(buffer, values, relative) {\n let result, identifiers = [], ident = 0, subident = 0;\n for (;!buffer.isEmpty(); )\n subident = buffer.readUInt8(), ident <<= 7, ident |= subident & 127, (subident & 128) === 0 && (identifiers.push(ident), ident = 0);\n subident & 128 && identifiers.push(ident);\n let first = identifiers[0] / 40 | 0, second = identifiers[0] % 40;\n if (relative \? result = identifiers : result = [first, second].concat(identifiers.slice(1)), values) {\n let tmp = values[result.join(\" \")];\n tmp === void 0 && (tmp = values[result.join(\".\")]), tmp !== void 0 && (result = tmp);\n }\n return result;\n }, DERNode.prototype._decodeTime = function(buffer, tag) {\n let str = buffer.raw().toString(), year, mon, day, hour, min, sec;\n if (tag === \"gentime\")\n year = str.slice(0, 4) | 0, mon = str.slice(4, 6) | 0, day = str.slice(6, 8) | 0, hour = str.slice(8, 10) | 0, min = str.slice(10, 12) | 0, sec = str.slice(12, 14) | 0;\n else if (tag === \"utctime\")\n year = str.slice(0, 2) | 0, mon = str.slice(2, 4) | 0, day = str.slice(4, 6) | 0, hour = str.slice(6, 8) | 0, min = str.slice(8, 10) | 0, sec = str.slice(10, 12) | 0, year < 70 \? year = 2000 + year : year = 1900 + year;\n else\n return buffer.error(\"Decoding \" + tag + \" time is not supported yet\");\n return Date.UTC(year, mon - 1, day, hour, min, sec, 0);\n }, DERNode.prototype._decodeNull = function() {\n return null;\n }, DERNode.prototype._decodeBool = function(buffer) {\n let res = buffer.readUInt8();\n return buffer.isError(res) \? res : res !== 0;\n }, DERNode.prototype._decodeInt = function(buffer, values) {\n let raw = buffer.raw(), res = new bignum(raw);\n return values && (res = values[res.toString(10)] || res), res;\n }, DERNode.prototype._use = function(entity, obj) {\n return typeof entity == \"function\" && (entity = entity(obj)), entity._getDecoder(\"der\").tree;\n };\n function derDecodeTag(buf, fail) {\n let tag = buf.readUInt8(fail);\n if (buf.isError(tag))\n return tag;\n let cls = der.tagClass[tag >> 6], primitive = (tag & 32) === 0;\n if ((tag & 31) === 31) {\n let oct = tag;\n for (tag = 0;(oct & 128) === 128; ) {\n if (oct = buf.readUInt8(fail), buf.isError(oct))\n return oct;\n tag <<= 7, tag |= oct & 127;\n }\n } else\n tag &= 31;\n let tagStr = der.tag[tag];\n return {\n cls,\n primitive,\n tag,\n tagStr\n };\n }\n function derDecodeLen(buf, primitive, fail) {\n let len = buf.readUInt8(fail);\n if (buf.isError(len))\n return len;\n if (!primitive && len === 128)\n return null;\n if ((len & 128) === 0)\n return len;\n let num = len & 127;\n if (num > 4)\n return buf.error(\"length octect is too long\");\n len = 0;\n for (let i = 0;i < num; i++) {\n len <<= 8;\n let j = buf.readUInt8(fail);\n if (buf.isError(j))\n return j;\n len |= j;\n }\n return len;\n }\n }\n}), require_pem2 = __commonJS({\n \"node_modules/asn1.js/lib/asn1/decoders/pem.js\"(exports, module) {\n var inherits = require_inherits_browser(), Buffer2 = require_safer().Buffer, DERDecoder = require_der3();\n function PEMDecoder(entity) {\n DERDecoder.@call(this, entity), this.enc = \"pem\";\n }\n inherits(PEMDecoder, DERDecoder), module.exports = PEMDecoder, PEMDecoder.prototype.decode = function(data, options) {\n let lines = data.toString().split(/[\\r\\n]+/g), label = options.label.toUpperCase(), re = /^-----(BEGIN|END) ([^-]+)-----$/, start = -1, end = -1;\n for (let i = 0;i < lines.length; i++) {\n let match = lines[i].match(re);\n if (match !== null && match[2] === label)\n if (start === -1) {\n if (match[1] !== \"BEGIN\")\n break;\n start = i;\n } else {\n if (match[1] !== \"END\")\n break;\n end = i;\n break;\n }\n }\n if (start === -1 || end === -1)\n throw new Error(\"PEM section not found for: \" + label);\n let base64 = lines.slice(start + 1, end).join(\"\");\n base64.replace(/[^a-z0-9+/=]+/gi, \"\");\n let input = Buffer2.from(base64, \"base64\");\n return DERDecoder.prototype.decode.@call(this, input, options);\n };\n }\n}), require_decoders = __commonJS({\n \"node_modules/asn1.js/lib/asn1/decoders/index.js\"(exports) {\n var decoders = exports;\n decoders.der = require_der3(), decoders.pem = require_pem2();\n }\n}), require_api = __commonJS({\n \"node_modules/asn1.js/lib/asn1/api.js\"(exports) {\n var encoders = require_encoders(), decoders = require_decoders(), inherits = require_inherits_browser(), api = exports;\n api.define = function(name, body) {\n return new Entity(name, body);\n };\n function Entity(name, body) {\n this.name = name, this.body = body, this.decoders = {}, this.encoders = {};\n }\n Entity.prototype = {}, Entity.prototype._createNamed = function(Base) {\n let name = this.name;\n function Generated(entity) {\n this._initNamed(entity, name);\n }\n return inherits(Generated, Base), Generated.prototype._initNamed = function(entity, name2) {\n Base.@call(this, entity, name2);\n }, new Generated(this);\n }, Entity.prototype._getDecoder = function(enc) {\n return enc = enc || \"der\", this.decoders.hasOwnProperty(enc) || (this.decoders[enc] = this._createNamed(decoders[enc])), this.decoders[enc];\n }, Entity.prototype.decode = function(data, enc, options) {\n return this._getDecoder(enc).decode(data, options);\n }, Entity.prototype._getEncoder = function(enc) {\n return enc = enc || \"der\", this.encoders.hasOwnProperty(enc) || (this.encoders[enc] = this._createNamed(encoders[enc])), this.encoders[enc];\n }, Entity.prototype.encode = function(data, enc, reporter) {\n return this._getEncoder(enc).encode(data, reporter);\n };\n }\n}), require_base2 = __commonJS({\n \"node_modules/asn1.js/lib/asn1/base/index.js\"(exports) {\n var base = exports;\n base.Reporter = require_reporter().Reporter, base.DecoderBuffer = require_buffer().DecoderBuffer, base.EncoderBuffer = require_buffer().EncoderBuffer, base.Node = require_node();\n }\n}), require_constants = __commonJS({\n \"node_modules/asn1.js/lib/asn1/constants/index.js\"(exports) {\n var constants = exports;\n constants._reverse = function(map) {\n let res = {};\n return Object.keys(map).forEach(function(key2) {\n (key2 | 0) == key2 && (key2 = key2 | 0);\n let value = map[key2];\n res[value] = key2;\n }), res;\n }, constants.der = require_der();\n }\n}), require_asn1 = __commonJS({\n \"node_modules/asn1.js/lib/asn1.js\"(exports) {\n var asn1 = exports;\n asn1.bignum = require_bn5(), asn1.define = require_api().define, asn1.base = require_base2(), asn1.constants = require_constants(), asn1.decoders = require_decoders(), asn1.encoders = require_encoders();\n }\n}), require_certificate = __commonJS({\n \"node_modules/parse-asn1/certificate.js\"(exports, module) {\n var asn = require_asn1(), Time = asn.define(\"Time\", function() {\n this.choice({\n utcTime: this.utctime(),\n generalTime: this.gentime()\n });\n }), AttributeTypeValue = asn.define(\"AttributeTypeValue\", function() {\n this.seq().obj(this.key(\"type\").objid(), this.key(\"value\").any());\n }), AlgorithmIdentifier = asn.define(\"AlgorithmIdentifier\", function() {\n this.seq().obj(this.key(\"algorithm\").objid(), this.key(\"parameters\").optional(), this.key(\"curve\").objid().optional());\n }), SubjectPublicKeyInfo = asn.define(\"SubjectPublicKeyInfo\", function() {\n this.seq().obj(this.key(\"algorithm\").use(AlgorithmIdentifier), this.key(\"subjectPublicKey\").bitstr());\n }), RelativeDistinguishedName = asn.define(\"RelativeDistinguishedName\", function() {\n this.setof(AttributeTypeValue);\n }), RDNSequence = asn.define(\"RDNSequence\", function() {\n this.seqof(RelativeDistinguishedName);\n }), Name = asn.define(\"Name\", function() {\n this.choice({\n rdnSequence: this.use(RDNSequence)\n });\n }), Validity = asn.define(\"Validity\", function() {\n this.seq().obj(this.key(\"notBefore\").use(Time), this.key(\"notAfter\").use(Time));\n }), Extension = asn.define(\"Extension\", function() {\n this.seq().obj(this.key(\"extnID\").objid(), this.key(\"critical\").bool().def(!1), this.key(\"extnValue\").octstr());\n }), TBSCertificate = asn.define(\"TBSCertificate\", function() {\n this.seq().obj(this.key(\"version\").explicit(0).int().optional(), this.key(\"serialNumber\").int(), this.key(\"signature\").use(AlgorithmIdentifier), this.key(\"issuer\").use(Name), this.key(\"validity\").use(Validity), this.key(\"subject\").use(Name), this.key(\"subjectPublicKeyInfo\").use(SubjectPublicKeyInfo), this.key(\"issuerUniqueID\").implicit(1).bitstr().optional(), this.key(\"subjectUniqueID\").implicit(2).bitstr().optional(), this.key(\"extensions\").explicit(3).seqof(Extension).optional());\n }), X509Certificate = asn.define(\"X509Certificate\", function() {\n this.seq().obj(this.key(\"tbsCertificate\").use(TBSCertificate), this.key(\"signatureAlgorithm\").use(AlgorithmIdentifier), this.key(\"signatureValue\").bitstr());\n });\n module.exports = X509Certificate;\n }\n}), require_asn12 = __commonJS({\n \"node_modules/parse-asn1/asn1.js\"(exports) {\n var asn1 = require_asn1();\n exports.certificate = require_certificate();\n var RSAPrivateKey = asn1.define(\"RSAPrivateKey\", function() {\n this.seq().obj(this.key(\"version\").int(), this.key(\"modulus\").int(), this.key(\"publicExponent\").int(), this.key(\"privateExponent\").int(), this.key(\"prime1\").int(), this.key(\"prime2\").int(), this.key(\"exponent1\").int(), this.key(\"exponent2\").int(), this.key(\"coefficient\").int());\n });\n exports.RSAPrivateKey = RSAPrivateKey;\n var RSAPublicKey = asn1.define(\"RSAPublicKey\", function() {\n this.seq().obj(this.key(\"modulus\").int(), this.key(\"publicExponent\").int());\n });\n exports.RSAPublicKey = RSAPublicKey;\n var PublicKey = asn1.define(\"SubjectPublicKeyInfo\", function() {\n this.seq().obj(this.key(\"algorithm\").use(AlgorithmIdentifier), this.key(\"subjectPublicKey\").bitstr());\n });\n exports.PublicKey = PublicKey;\n var AlgorithmIdentifier = asn1.define(\"AlgorithmIdentifier\", function() {\n this.seq().obj(this.key(\"algorithm\").objid(), this.key(\"none\").null_().optional(), this.key(\"curve\").objid().optional(), this.key(\"params\").seq().obj(this.key(\"p\").int(), this.key(\"q\").int(), this.key(\"g\").int()).optional());\n }), PrivateKeyInfo = asn1.define(\"PrivateKeyInfo\", function() {\n this.seq().obj(this.key(\"version\").int(), this.key(\"algorithm\").use(AlgorithmIdentifier), this.key(\"subjectPrivateKey\").octstr());\n });\n exports.PrivateKey = PrivateKeyInfo;\n var EncryptedPrivateKeyInfo = asn1.define(\"EncryptedPrivateKeyInfo\", function() {\n this.seq().obj(this.key(\"algorithm\").seq().obj(this.key(\"id\").objid(), this.key(\"decrypt\").seq().obj(this.key(\"kde\").seq().obj(this.key(\"id\").objid(), this.key(\"kdeparams\").seq().obj(this.key(\"salt\").octstr(), this.key(\"iters\").int())), this.key(\"cipher\").seq().obj(this.key(\"algo\").objid(), this.key(\"iv\").octstr()))), this.key(\"subjectPrivateKey\").octstr());\n });\n exports.EncryptedPrivateKey = EncryptedPrivateKeyInfo;\n var DSAPrivateKey = asn1.define(\"DSAPrivateKey\", function() {\n this.seq().obj(this.key(\"version\").int(), this.key(\"p\").int(), this.key(\"q\").int(), this.key(\"g\").int(), this.key(\"pub_key\").int(), this.key(\"priv_key\").int());\n });\n exports.DSAPrivateKey = DSAPrivateKey, exports.DSAparam = asn1.define(\"DSAparam\", function() {\n this.int();\n });\n var ECPrivateKey = asn1.define(\"ECPrivateKey\", function() {\n this.seq().obj(this.key(\"version\").int(), this.key(\"privateKey\").octstr(), this.key(\"parameters\").optional().explicit(0).use(ECParameters), this.key(\"publicKey\").optional().explicit(1).bitstr());\n });\n exports.ECPrivateKey = ECPrivateKey;\n var ECParameters = asn1.define(\"ECParameters\", function() {\n this.choice({\n namedCurve: this.objid()\n });\n });\n exports.signature = asn1.define(\"signature\", function() {\n this.seq().obj(this.key(\"r\").int(), this.key(\"s\").int());\n });\n }\n}), require_aesid = __commonJS({\n \"node_modules/parse-asn1/aesid.json\"(exports, module) {\n module.exports = {\n \"2.16.840.1.101.3.4.1.1\": \"aes-128-ecb\",\n \"2.16.840.1.101.3.4.1.2\": \"aes-128-cbc\",\n \"2.16.840.1.101.3.4.1.3\": \"aes-128-ofb\",\n \"2.16.840.1.101.3.4.1.4\": \"aes-128-cfb\",\n \"2.16.840.1.101.3.4.1.21\": \"aes-192-ecb\",\n \"2.16.840.1.101.3.4.1.22\": \"aes-192-cbc\",\n \"2.16.840.1.101.3.4.1.23\": \"aes-192-ofb\",\n \"2.16.840.1.101.3.4.1.24\": \"aes-192-cfb\",\n \"2.16.840.1.101.3.4.1.41\": \"aes-256-ecb\",\n \"2.16.840.1.101.3.4.1.42\": \"aes-256-cbc\",\n \"2.16.840.1.101.3.4.1.43\": \"aes-256-ofb\",\n \"2.16.840.1.101.3.4.1.44\": \"aes-256-cfb\"\n };\n }\n}), require_fixProc = __commonJS({\n \"node_modules/parse-asn1/fixProc.js\"(exports, module) {\n var findProc = /Proc-Type: 4,ENCRYPTED[\\n\\r]+DEK-Info: AES-((\?:128)|(\?:192)|(\?:256))-CBC,([0-9A-H]+)[\\n\\r]+([0-9A-z\\n\\r+/=]+)[\\n\\r]+/m, startRegex = /^-----BEGIN ((\?:.*\? KEY)|CERTIFICATE)-----/m, fullRegex = /^-----BEGIN ((\?:.*\? KEY)|CERTIFICATE)-----([0-9A-z\\n\\r+/=]+)-----END \\1-----$/m, evp = require_evp_bytestokey(), ciphers = require_browser5(), Buffer2 = require_safe_buffer().Buffer;\n module.exports = function(okey, password) {\n var key2 = okey.toString(), match = key2.match(findProc), decrypted;\n if (match) {\n var suite = \"aes\" + match[1], iv = Buffer2.from(match[2], \"hex\"), cipherText = Buffer2.from(match[3].replace(/[\\r\\n]/g, \"\"), \"base64\"), cipherKey = evp(password, iv.slice(0, 8), parseInt(match[1], 10)).key, out = [], cipher = ciphers.createDecipheriv(suite, cipherKey, iv);\n out.push(cipher.update(cipherText)), out.push(cipher.final()), decrypted = Buffer2.concat(out);\n } else {\n var match2 = key2.match(fullRegex);\n decrypted = Buffer2.from(match2[2].replace(/[\\r\\n]/g, \"\"), \"base64\");\n }\n var tag = key2.match(startRegex)[1];\n return {\n tag,\n data: decrypted\n };\n };\n }\n}), require_parse_asn1 = __commonJS({\n \"node_modules/parse-asn1/index.js\"(exports, module) {\n var asn1 = require_asn12(), aesid = require_aesid(), fixProc = require_fixProc(), ciphers = require_browser5(), compat = require_browser4(), Buffer2 = require_safe_buffer().Buffer;\n module.exports = parseKeys;\n function parseKeys(buffer) {\n var password;\n if (buffer instanceof KeyObject)\n buffer = buffer.export();\n else if (buffer instanceof CryptoKey)\n buffer = KeyObject.from(buffer).export();\n else if (typeof buffer == \"object\" && !Buffer2.isBuffer(buffer)) {\n if (password = buffer.passphrase, buffer = buffer.key, buffer instanceof KeyObject) {\n var options;\n switch (buffer.type) {\n case \"secret\":\n options = {\n format: \"buffer\"\n };\n break;\n case \"public\":\n options = {\n format: \"pem\",\n type: \"spki\",\n passphrase: password\n };\n break;\n case \"private\":\n options = {\n format: \"pem\",\n type: \"pkcs8\",\n passphrase: password\n };\n break;\n }\n buffer = buffer.export(options);\n } else if (buffer instanceof CryptoKey) {\n var options;\n switch (buffer.type) {\n case \"secret\":\n options = {\n format: \"buffer\"\n };\n break;\n case \"public\":\n options = {\n format: \"pem\",\n type: \"spki\",\n passphrase: password\n };\n break;\n case \"private\":\n options = {\n format: \"pem\",\n type: \"pkcs8\",\n passphrase: password\n };\n break;\n }\n buffer = KeyObject.from(buffer).export(options);\n }\n }\n typeof buffer == \"string\" && (buffer = Buffer2.from(buffer));\n var stripped = fixProc(buffer, password), type = stripped.tag, data = stripped.data, subtype, ndata;\n switch (type) {\n case \"CERTIFICATE\":\n ndata = asn1.certificate.decode(data, \"der\").tbsCertificate.subjectPublicKeyInfo;\n case \"PUBLIC KEY\":\n switch (ndata || (ndata = asn1.PublicKey.decode(data, \"der\")), subtype = ndata.algorithm.algorithm.join(\".\"), subtype) {\n case \"1.2.840.113549.1.1.1\":\n return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, \"der\");\n case \"1.2.840.10045.2.1\":\n return ndata.subjectPrivateKey = ndata.subjectPublicKey, {\n type: \"ec\",\n data: ndata\n };\n case \"1.2.840.10040.4.1\":\n return ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, \"der\"), {\n type: \"dsa\",\n data: ndata.algorithm.params\n };\n default:\n throw new Error(\"unknown key id \" + subtype);\n }\n case \"ENCRYPTED PRIVATE KEY\":\n data = asn1.EncryptedPrivateKey.decode(data, \"der\"), data = decrypt(data, password);\n case \"PRIVATE KEY\":\n switch (ndata = asn1.PrivateKey.decode(data, \"der\"), subtype = ndata.algorithm.algorithm.join(\".\"), subtype) {\n case \"1.2.840.113549.1.1.1\":\n return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, \"der\");\n case \"1.2.840.10045.2.1\":\n return {\n curve: ndata.algorithm.curve,\n privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, \"der\").privateKey\n };\n case \"1.2.840.10040.4.1\":\n return ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, \"der\"), {\n type: \"dsa\",\n params: ndata.algorithm.params\n };\n default:\n throw new Error(\"unknown key id \" + subtype);\n }\n case \"RSA PUBLIC KEY\":\n return asn1.RSAPublicKey.decode(data, \"der\");\n case \"RSA PRIVATE KEY\":\n return asn1.RSAPrivateKey.decode(data, \"der\");\n case \"DSA PRIVATE KEY\":\n return {\n type: \"dsa\",\n params: asn1.DSAPrivateKey.decode(data, \"der\")\n };\n case \"EC PRIVATE KEY\":\n return data = asn1.ECPrivateKey.decode(data, \"der\"), {\n curve: data.parameters.value,\n privateKey: data.privateKey\n };\n default:\n throw new Error(\"unknown key type \" + type);\n }\n }\n parseKeys.signature = asn1.signature;\n function decrypt(data, password) {\n var salt = data.algorithm.decrypt.kde.kdeparams.salt, iters = parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(), 10), algo = aesid[data.algorithm.decrypt.cipher.algo.join(\".\")], iv = data.algorithm.decrypt.cipher.iv, cipherText = data.subjectPrivateKey, keylen = parseInt(algo.split(\"-\")[1], 10) / 8, key2 = compat.pbkdf2Sync(password, salt, iters, keylen, \"sha1\"), cipher = ciphers.createDecipheriv(algo, key2, iv), out = [];\n return out.push(cipher.update(cipherText)), out.push(cipher.final()), Buffer2.concat(out);\n }\n }\n}), require_curves2 = __commonJS({\n \"node_modules/browserify-sign/browser/curves.json\"(exports, module) {\n module.exports = {\n \"1.3.132.0.10\": \"secp256k1\",\n \"1.3.132.0.33\": \"p224\",\n \"1.2.840.10045.3.1.1\": \"p192\",\n \"1.2.840.10045.3.1.7\": \"p256\",\n \"1.3.132.0.34\": \"p384\",\n \"1.3.132.0.35\": \"p521\"\n };\n }\n}), require_sign = __commonJS({\n \"node_modules/browserify-sign/browser/sign.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer, createHmac = require_browser3(), crt = require_browserify_rsa(), EC = require_elliptic().ec, BN = require_bn3(), parseKeys = require_parse_asn1(), curves = require_curves2();\n function sign(hash, key2, hashType, signType, tag) {\n var priv = parseKeys(getKeyFrom(key2, \"private\"));\n if (priv.curve) {\n if (signType !== \"ecdsa\" && signType !== \"ecdsa/rsa\")\n throw new Error(\"wrong private key type\");\n return ecSign(hash, priv);\n } else if (priv.type === \"dsa\") {\n if (signType !== \"dsa\")\n throw new Error(\"wrong private key type\");\n return dsaSign(hash, priv, hashType);\n } else if (signType !== \"rsa\" && signType !== \"ecdsa/rsa\")\n throw new Error(\"wrong private key type\");\n hash = Buffer2.concat([tag, hash]);\n for (var len = priv.modulus.byteLength(), pad = [0, 1];hash.length + pad.length + 1 < len; )\n pad.push(255);\n pad.push(0);\n for (var i = -1;++i < hash.length; )\n pad.push(hash[i]);\n var out = crt(pad, priv);\n return out;\n }\n function ecSign(hash, priv) {\n var curveId = curves[priv.curve.join(\".\")];\n if (!curveId)\n throw new Error(\"unknown curve \" + priv.curve.join(\".\"));\n var curve = new EC(curveId), key2 = curve.keyFromPrivate(priv.privateKey), out = key2.sign(hash);\n return Buffer2.from(out.toDER());\n }\n function dsaSign(hash, priv, algo) {\n for (var x = priv.params.priv_key, p = priv.params.p, q = priv.params.q, g = priv.params.g, r = new BN(0), k, H = bits2int(hash, q).mod(q), s = !1, kv = getKey(x, q, hash, algo);s === !1; )\n k = makeKey(q, kv, algo), r = makeR(g, k, p, q), s = k.invm(q).imul(H.add(x.mul(r))).mod(q), s.cmpn(0) === 0 && (s = !1, r = new BN(0));\n return toDER(r, s);\n }\n function toDER(r, s) {\n r = r.toArray(), s = s.toArray(), r[0] & 128 && (r = [0].concat(r)), s[0] & 128 && (s = [0].concat(s));\n var total = r.length + s.length + 4, res = [48, total, 2, r.length];\n return res = res.concat(r, [2, s.length], s), Buffer2.from(res);\n }\n function getKey(x, q, hash, algo) {\n if (x = Buffer2.from(x.toArray()), x.length < q.byteLength()) {\n var zeros = Buffer2.alloc(q.byteLength() - x.length);\n x = Buffer2.concat([zeros, x]);\n }\n var hlen = hash.length, hbits = bits2octets(hash, q), v = Buffer2.alloc(hlen);\n v.fill(1);\n var k = Buffer2.alloc(hlen);\n return k = createHmac(algo, k).update(v).update(Buffer2.from([0])).update(x).update(hbits).digest(), v = createHmac(algo, k).update(v).digest(), k = createHmac(algo, k).update(v).update(Buffer2.from([1])).update(x).update(hbits).digest(), v = createHmac(algo, k).update(v).digest(), { k, v };\n }\n function bits2int(obits, q) {\n var bits = new BN(obits), shift = (obits.length << 3) - q.bitLength();\n return shift > 0 && bits.ishrn(shift), bits;\n }\n function bits2octets(bits, q) {\n bits = bits2int(bits, q), bits = bits.mod(q);\n var out = Buffer2.from(bits.toArray());\n if (out.length < q.byteLength()) {\n var zeros = Buffer2.alloc(q.byteLength() - out.length);\n out = Buffer2.concat([zeros, out]);\n }\n return out;\n }\n function makeKey(q, kv, algo) {\n var t, k;\n do {\n for (t = Buffer2.alloc(0);t.length * 8 < q.bitLength(); )\n kv.v = createHmac(algo, kv.k).update(kv.v).digest(), t = Buffer2.concat([t, kv.v]);\n k = bits2int(t, q), kv.k = createHmac(algo, kv.k).update(kv.v).update(Buffer2.from([0])).digest(), kv.v = createHmac(algo, kv.k).update(kv.v).digest();\n } while (k.cmp(q) !== -1);\n return k;\n }\n function makeR(g, k, p, q) {\n return g.toRed(BN.mont(p)).redPow(k).fromRed().mod(q);\n }\n module.exports = sign, module.exports.getKey = getKey, module.exports.makeKey = makeKey;\n }\n}), require_verify = __commonJS({\n \"node_modules/browserify-sign/browser/verify.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer, BN = require_bn3(), EC = require_elliptic().ec, parseKeys = require_parse_asn1(), curves = require_curves2();\n function verify(sig, hash, key2, signType, tag) {\n var pub = parseKeys(getKeyFrom(key2, \"public\"));\n if (pub.type === \"ec\") {\n if (signType !== \"ecdsa\" && signType !== \"ecdsa/rsa\")\n throw new Error(\"wrong public key type\");\n return ecVerify(sig, hash, pub);\n } else if (pub.type === \"dsa\") {\n if (signType !== \"dsa\")\n throw new Error(\"wrong public key type\");\n return dsaVerify(sig, hash, pub);\n } else if (signType !== \"rsa\" && signType !== \"ecdsa/rsa\")\n throw new Error(\"wrong public key type\");\n hash = Buffer2.concat([tag, hash]);\n for (var len = pub.modulus.byteLength(), pad = [1], padNum = 0;hash.length + pad.length + 2 < len; )\n pad.push(255), padNum++;\n pad.push(0);\n for (var i = -1;++i < hash.length; )\n pad.push(hash[i]);\n pad = Buffer2.from(pad);\n var red = BN.mont(pub.modulus);\n sig = new BN(sig).toRed(red), sig = sig.redPow(new BN(pub.publicExponent)), sig = Buffer2.from(sig.fromRed().toArray());\n var out = padNum < 8 \? 1 : 0;\n for (len = Math.min(sig.length, pad.length), sig.length !== pad.length && (out = 1), i = -1;++i < len; )\n out |= sig[i] ^ pad[i];\n return out === 0;\n }\n function ecVerify(sig, hash, pub) {\n var curveId = curves[pub.data.algorithm.curve.join(\".\")];\n if (!curveId)\n throw new Error(\"unknown curve \" + pub.data.algorithm.curve.join(\".\"));\n var curve = new EC(curveId), pubkey = pub.data.subjectPrivateKey.data;\n return curve.verify(hash, sig, pubkey);\n }\n function dsaVerify(sig, hash, pub) {\n var p = pub.data.p, q = pub.data.q, g = pub.data.g, y = pub.data.pub_key, unpacked = parseKeys.signature.decode(sig, \"der\"), s = unpacked.s, r = unpacked.r;\n checkValue(s, q), checkValue(r, q);\n var montp = BN.mont(p), w = s.invm(q), v = g.toRed(montp).redPow(new BN(hash).mul(w).mod(q)).fromRed().mul(y.toRed(montp).redPow(r.mul(w).mod(q)).fromRed()).mod(p).mod(q);\n return v.cmp(r) === 0;\n }\n function checkValue(b, q) {\n if (b.cmpn(0) <= 0)\n throw new Error(\"invalid sig\");\n if (b.cmp(q) >= q)\n throw new Error(\"invalid sig\");\n }\n module.exports = verify;\n }\n}), require_browser8 = __commonJS({\n \"node_modules/browserify-sign/browser/index.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer, createHash = require_browser2(), inherits = require_inherits_browser(), sign = require_sign(), verify = require_verify(), algorithms = require_algorithms();\n Object.keys(algorithms).forEach(function(key2) {\n algorithms[key2].id = Buffer2.from(algorithms[key2].id, \"hex\"), algorithms[key2.toLowerCase()] = algorithms[key2];\n });\n function Sign(algorithm) {\n if (typeof algorithm === \"string\")\n algorithm = algorithm.toLowerCase();\n StreamModule.Writable.@call(this);\n var data = algorithms[algorithm];\n if (!data)\n throw new Error(\"Unknown message digest\");\n this._hashType = data.hash, this._hash = createHash(data.hash), this._tag = data.id, this._signType = data.sign;\n }\n inherits(Sign, StreamModule.Writable), Sign.prototype._write = function(data, _, done) {\n this._hash.update(data), done();\n }, Sign.prototype.update = function(data, enc) {\n return typeof data == \"string\" && (data = Buffer2.from(data, enc)), this._hash.update(data), this;\n }, Sign.prototype.sign = function(key2, enc) {\n this.end();\n var hash = this._hash.digest(), sig = sign(hash, key2, this._hashType, this._signType, this._tag);\n return enc \? sig.toString(enc) : sig;\n };\n function Verify(algorithm) {\n if (StreamModule.Writable.@call(this), typeof algorithm === \"string\")\n algorithm = algorithm.toLowerCase();\n var data = algorithms[algorithm];\n if (!data)\n throw new Error(\"Unknown message digest\");\n this._hash = createHash(data.hash), this._tag = data.id, this._signType = data.sign;\n }\n inherits(Verify, StreamModule.Writable), Verify.prototype._write = function(data, _, done) {\n this._hash.update(data), done();\n }, Verify.prototype.update = function(data, enc) {\n return typeof data == \"string\" && (data = Buffer2.from(data, enc)), this._hash.update(data), this;\n }, Verify.prototype.verify = function(key2, sig, enc) {\n typeof sig == \"string\" && (sig = Buffer2.from(sig, enc)), this.end();\n var hash = this._hash.digest();\n return verify(sig, hash, key2, this._signType, this._tag);\n };\n function createSign(algorithm) {\n return new Sign(algorithm);\n }\n function createVerify(algorithm) {\n return new Verify(algorithm);\n }\n module.exports = {\n Sign: createSign,\n Verify: createVerify,\n createSign,\n createVerify\n };\n }\n}), require_bn6 = require_bn, require_browser9 = __commonJS({\n \"node_modules/create-ecdh/browser.js\"(exports, module) {\n var elliptic = require_elliptic(), BN = require_bn6();\n module.exports = function(curve) {\n return new ECDH(curve);\n };\n var aliases = {\n secp256k1: {\n name: \"secp256k1\",\n byteLength: 32\n },\n secp224r1: {\n name: \"p224\",\n byteLength: 28\n },\n prime256v1: {\n name: \"p256\",\n byteLength: 32\n },\n prime192v1: {\n name: \"p192\",\n byteLength: 24\n },\n ed25519: {\n name: \"ed25519\",\n byteLength: 32\n },\n secp384r1: {\n name: \"p384\",\n byteLength: 48\n },\n secp521r1: {\n name: \"p521\",\n byteLength: 66\n }\n };\n aliases.p224 = aliases.secp224r1, aliases.p256 = aliases.secp256r1 = aliases.prime256v1, aliases.p192 = aliases.secp192r1 = aliases.prime192v1, aliases.p384 = aliases.secp384r1, aliases.p521 = aliases.secp521r1;\n function ECDH(curve) {\n this.curveType = aliases[curve], this.curveType || (this.curveType = {\n name: curve\n }), this.curve = new elliptic.ec(this.curveType.name), this.keys = void 0;\n }\n ECDH.prototype = {}, ECDH.prototype.generateKeys = function(enc, format) {\n return this.keys = this.curve.genKeyPair(), this.getPublicKey(enc, format);\n }, ECDH.prototype.computeSecret = function(other, inenc, enc) {\n inenc = inenc || \"utf8\", Buffer.isBuffer(other) || (other = new Buffer(other, inenc));\n var otherPub = this.curve.keyFromPublic(other).getPublic(), out = otherPub.mul(this.keys.getPrivate()).getX();\n return formatReturnValue(out, enc, this.curveType.byteLength);\n }, ECDH.prototype.getPublicKey = function(enc, format) {\n var key2 = this.keys.getPublic(format === \"compressed\", !0);\n return format === \"hybrid\" && (key2[key2.length - 1] % 2 \? key2[0] = 7 : key2[0] = 6), formatReturnValue(key2, enc);\n }, ECDH.prototype.getPrivateKey = function(enc) {\n return formatReturnValue(this.keys.getPrivate(), enc);\n }, ECDH.prototype.setPublicKey = function(pub, enc) {\n return enc = enc || \"utf8\", Buffer.isBuffer(pub) || (pub = new Buffer(pub, enc)), this.keys._importPublic(pub), this;\n }, ECDH.prototype.setPrivateKey = function(priv, enc) {\n enc = enc || \"utf8\", Buffer.isBuffer(priv) || (priv = new Buffer(priv, enc));\n var _priv = new BN(priv);\n return _priv = _priv.toString(16), this.keys = this.curve.genKeyPair(), this.keys._importPrivate(_priv), this;\n };\n function formatReturnValue(bn, enc, len) {\n @Array.isArray(bn) || (bn = bn.toArray());\n var buf = new Buffer(bn);\n if (len && buf.length < len) {\n var zeros = new Buffer(len - buf.length);\n zeros.fill(0), buf = Buffer.concat([zeros, buf]);\n }\n return enc \? buf.toString(enc) : buf;\n }\n }\n}), require_mgf = __commonJS({\n \"node_modules/public-encrypt/mgf.js\"(exports, module) {\n var createHash = require_browser2(), Buffer2 = require_safe_buffer().Buffer;\n module.exports = function(seed, len) {\n for (var t = Buffer2.alloc(0), i = 0, c;t.length < len; )\n c = i2ops(i++), t = Buffer2.concat([t, createHash(\"sha1\").update(seed).update(c).digest()]);\n return t.slice(0, len);\n };\n function i2ops(c) {\n var out = Buffer2.allocUnsafe(4);\n return out.writeUInt32BE(c, 0), out;\n }\n }\n}), require_xor = __commonJS({\n \"node_modules/public-encrypt/xor.js\"(exports, module) {\n module.exports = function(a, b) {\n for (var len = a.length, i = -1;++i < len; )\n a[i] ^= b[i];\n return a;\n };\n }\n}), require_bn7 = require_bn, { CryptoHasher } = globalThis.Bun, require_withPublic = __commonJS({\n \"node_modules/public-encrypt/withPublic.js\"(exports, module) {\n var BN = require_bn7(), Buffer2 = require_safe_buffer().Buffer;\n function withPublic(paddedMsg, key2) {\n return Buffer2.from(paddedMsg.toRed(BN.mont(key2.modulus)).redPow(new BN(key2.publicExponent)).fromRed().toArray());\n }\n module.exports = withPublic;\n }\n}), require_publicEncrypt = __commonJS({\n \"node_modules/public-encrypt/publicEncrypt.js\"(exports, module) {\n var parseKeys = require_parse_asn1(), randomBytes = require_browser(), createHash = require_browser2(), mgf = require_mgf(), xor = require_xor(), BN = require_bn7(), withPublic = require_withPublic(), crt = require_browserify_rsa(), Buffer2 = require_safe_buffer().Buffer;\n module.exports = function(publicKey, msg, reverse) {\n var padding;\n publicKey.padding \? padding = publicKey.padding : reverse \? padding = 1 : padding = 4;\n var key2 = parseKeys(publicKey), paddedMsg;\n if (padding === 4)\n paddedMsg = oaep(key2, msg);\n else if (padding === 1)\n paddedMsg = pkcs1(key2, msg, reverse);\n else if (padding === 3) {\n if (paddedMsg = new BN(msg), paddedMsg.cmp(key2.modulus) >= 0)\n throw new Error(\"data too long for modulus\");\n } else\n throw new Error(\"unknown padding\");\n return reverse \? crt(paddedMsg, key2) : withPublic(paddedMsg, key2);\n };\n function oaep(key2, msg) {\n var k = key2.modulus.byteLength(), mLen = msg.length, iHash = createHash(\"sha1\").update(Buffer2.alloc(0)).digest(), hLen = iHash.length, hLen2 = 2 * hLen;\n if (mLen > k - hLen2 - 2)\n throw new Error(\"message too long\");\n var ps = Buffer2.alloc(k - mLen - hLen2 - 2), dblen = k - hLen - 1, seed = randomBytes(hLen), maskedDb = xor(Buffer2.concat([iHash, ps, Buffer2.alloc(1, 1), msg], dblen), mgf(seed, dblen)), maskedSeed = xor(seed, mgf(maskedDb, hLen));\n return new BN(Buffer2.concat([Buffer2.alloc(1), maskedSeed, maskedDb], k));\n }\n function pkcs1(key2, msg, reverse) {\n var mLen = msg.length, k = key2.modulus.byteLength();\n if (mLen > k - 11)\n throw new Error(\"message too long\");\n var ps;\n return reverse \? ps = Buffer2.alloc(k - mLen - 3, 255) : ps = nonZero(k - mLen - 3), new BN(Buffer2.concat([Buffer2.from([0, reverse \? 1 : 2]), ps, Buffer2.alloc(1), msg], k));\n }\n function nonZero(len) {\n for (var out = Buffer2.allocUnsafe(len), i = 0, cache = randomBytes(len * 2), cur = 0, num;i < len; )\n cur === cache.length && (cache = randomBytes(len * 2), cur = 0), num = cache[cur++], num && (out[i++] = num);\n return out;\n }\n }\n}), require_privateDecrypt = __commonJS({\n \"node_modules/public-encrypt/privateDecrypt.js\"(exports, module) {\n var parseKeys = require_parse_asn1(), mgf = require_mgf(), xor = require_xor(), BN = require_bn7(), crt = require_browserify_rsa(), createHash = require_browser2(), withPublic = require_withPublic(), Buffer2 = require_safe_buffer().Buffer;\n module.exports = function(privateKey, enc, reverse) {\n var padding;\n privateKey.padding \? padding = privateKey.padding : reverse \? padding = 1 : padding = 4;\n var key2 = parseKeys(privateKey), k = key2.modulus.byteLength();\n if (enc.length > k || new BN(enc).cmp(key2.modulus) >= 0)\n throw new Error(\"decryption error\");\n var msg;\n reverse \? msg = withPublic(new BN(enc), key2) : msg = crt(enc, key2);\n var zBuffer = Buffer2.alloc(k - msg.length);\n if (msg = Buffer2.concat([zBuffer, msg], k), padding === 4)\n return oaep(key2, msg);\n if (padding === 1)\n return pkcs1(key2, msg, reverse);\n if (padding === 3)\n return msg;\n throw new Error(\"unknown padding\");\n };\n function oaep(key2, msg) {\n var k = key2.modulus.byteLength(), iHash = createHash(\"sha1\").update(Buffer2.alloc(0)).digest(), hLen = iHash.length;\n if (msg[0] !== 0)\n throw new Error(\"decryption error\");\n var maskedSeed = msg.slice(1, hLen + 1), maskedDb = msg.slice(hLen + 1), seed = xor(maskedSeed, mgf(maskedDb, hLen)), db = xor(maskedDb, mgf(seed, k - hLen - 1));\n if (compare(iHash, db.slice(0, hLen)))\n throw new Error(\"decryption error\");\n for (var i = hLen;db[i] === 0; )\n i++;\n if (db[i++] !== 1)\n throw new Error(\"decryption error\");\n return db.slice(i);\n }\n function pkcs1(key2, msg, reverse) {\n for (var p1 = msg.slice(0, 2), i = 2, status = 0;msg[i++] !== 0; )\n if (i >= msg.length) {\n status++;\n break;\n }\n var ps = msg.slice(2, i - 1);\n if ((p1.toString(\"hex\") !== \"0002\" && !reverse || p1.toString(\"hex\") !== \"0001\" && reverse) && status++, ps.length < 8 && status++, status)\n throw new Error(\"decryption error\");\n return msg.slice(i);\n }\n function compare(a, b) {\n a = Buffer2.from(a), b = Buffer2.from(b);\n var dif = 0, len = a.length;\n a.length !== b.length && (dif++, len = Math.min(a.length, b.length));\n for (var i = -1;++i < len; )\n dif += a[i] ^ b[i];\n return dif;\n }\n }\n}), require_browser10 = __commonJS({\n \"node_modules/public-encrypt/browser.js\"(exports) {\n var publicEncrypt = require_publicEncrypt();\n exports.publicEncrypt = function(key2, buf, options) {\n return publicEncrypt(getKeyFrom(key2, \"public\"), buf, options);\n };\n var privateDecrypt = require_privateDecrypt();\n exports.privateDecrypt = function(key2, buf, options) {\n return privateDecrypt(getKeyFrom(key2, \"private\"), buf, options);\n }, exports.privateEncrypt = function(key2, buf) {\n return publicEncrypt(getKeyFrom(key2, \"private\"), buf, !0);\n }, exports.publicDecrypt = function(key2, buf) {\n return privateDecrypt(getKeyFrom(key2, \"public\"), buf, !0);\n };\n }\n}), require_browser11 = __commonJS({\n \"node_modules/randomfill/browser.js\"(exports) {\n var safeBuffer = require_safe_buffer(), randombytes = require_browser(), Buffer2 = safeBuffer.Buffer, kBufferMaxLength = safeBuffer.kMaxLength, kMaxUint32 = Math.pow(2, 32) - 1;\n function assertOffset(offset, length) {\n if (typeof offset != \"number\" || offset !== offset)\n @throwTypeError(\"offset must be a number\");\n if (offset > kMaxUint32 || offset < 0)\n @throwTypeError(\"offset must be a uint32\");\n if (offset > kBufferMaxLength || offset > length)\n @throwRangeError(\"offset out of range\");\n }\n function assertSize(size, offset, length) {\n if (typeof size != \"number\" || size !== size)\n @throwTypeError(\"size must be a number\");\n if (size > kMaxUint32 || size < 0)\n @throwTypeError(\"size must be a uint32\");\n if (size + offset > length || size > kBufferMaxLength)\n @throwRangeError(\"buffer too small\");\n }\n exports.randomFill = randomFill, exports.randomFillSync = randomFillSync;\n function randomFill(buf, offset, size, cb) {\n if (!Buffer2.isBuffer(buf) && !(buf instanceof global.Uint8Array))\n @throwTypeError('\"buf\" argument must be a Buffer or Uint8Array');\n if (typeof offset == \"function\")\n cb = offset, offset = 0, size = buf.length;\n else if (typeof size == \"function\")\n cb = size, size = buf.length - offset;\n else if (typeof cb != \"function\")\n @throwTypeError('\"cb\" argument must be a function');\n return assertOffset(offset, buf.length), assertSize(size, offset, buf.length), actualFill(buf, offset, size, cb);\n }\n function actualFill(buf, offset, size, cb) {\n if (cb) {\n randombytes(size, function(err, bytes2) {\n if (err)\n return cb(err);\n bytes2.copy(buf, offset), cb(null, buf);\n });\n return;\n }\n var bytes = randombytes(size);\n return bytes.copy(buf, offset), buf;\n }\n function randomFillSync(buf, offset, size) {\n if (typeof offset > \"u\" && (offset = 0), !Buffer2.isBuffer(buf) && !(buf instanceof global.Uint8Array))\n @throwTypeError('\"buf\" argument must be a Buffer or Uint8Array');\n return assertOffset(offset, buf.length), size === void 0 && (size = buf.length - offset), assertSize(size, offset, buf.length), actualFill(buf, offset, size);\n }\n }\n}), require_crypto_browserify2 = __commonJS({\n \"node_modules/crypto-browserify/index.js\"(exports) {\n exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = require_browser(), exports.createHash = require_browser2(), exports.Hash = exports.createHash.Hash, exports.createHmac = exports.Hmac = require_browser3();\n var algos = require_algos(), algoKeys = Object.keys(algos), hashes = [\"sha1\", \"sha224\", \"sha256\", \"sha384\", \"sha512\", \"md5\", \"rmd160\"].concat(algoKeys);\n exports.getHashes = function() {\n return hashes;\n };\n var p = require_browser4();\n exports.pbkdf2 = p.pbkdf2, exports.pbkdf2Sync = p.pbkdf2Sync;\n var aes = require_browser6();\n exports.Cipher = aes.Cipher, exports.createCipher = aes.createCipher, exports.Cipheriv = aes.Cipheriv, exports.createCipheriv = aes.createCipheriv, exports.Decipher = aes.Decipher, exports.createDecipher = aes.createDecipher, exports.Decipheriv = aes.Decipheriv, exports.createDecipheriv = aes.createDecipheriv, exports.getCiphers = aes.getCiphers, exports.listCiphers = aes.listCiphers;\n var dh = require_browser7();\n exports.DiffieHellmanGroup = dh.DiffieHellmanGroup, exports.createDiffieHellmanGroup = dh.createDiffieHellmanGroup, exports.getDiffieHellman = dh.getDiffieHellman, exports.createDiffieHellman = dh.createDiffieHellman, exports.DiffieHellman = dh.DiffieHellman;\n var sign = require_browser8();\n exports.createSign = sign.createSign, exports.Sign = sign.Sign, exports.createVerify = sign.createVerify, exports.Verify = sign.Verify, exports.createECDH = require_browser9();\n var publicEncrypt = require_browser10();\n exports.publicEncrypt = publicEncrypt.publicEncrypt, exports.privateEncrypt = publicEncrypt.privateEncrypt, exports.publicDecrypt = publicEncrypt.publicDecrypt, exports.privateDecrypt = publicEncrypt.privateDecrypt, exports.getRandomValues = (values) => crypto.getRandomValues(values);\n var rf = require_browser11();\n exports.randomFill = rf.randomFill, exports.randomFillSync = rf.randomFillSync, exports.createCredentials = function() {\n throw new Error([\n \"sorry, createCredentials is not implemented yet\",\n \"we accept pull requests\",\n \"https://github.com/crypto-browserify/crypto-browserify\"\n ].join(`\n`));\n }, exports.constants = @processBindingConstants.crypto;\n }\n}), crypto_exports = require_crypto_browserify2(), DEFAULT_ENCODING = \"buffer\", getRandomValues = (array) => crypto.getRandomValues(array), randomUUID = () => crypto.randomUUID(), randomInt = (...args) => crypto.randomInt(...args), timingSafeEqual = \"timingSafeEqual\" in crypto \? (a, b) => {\n let { byteLength: byteLengthA } = a, { byteLength: byteLengthB } = b;\n if (typeof byteLengthA != \"number\" || typeof byteLengthB != \"number\")\n @throwTypeError(\"Input must be an array buffer view\");\n if (byteLengthA !== byteLengthB)\n @throwRangeError(\"Input buffers must have the same length\");\n return crypto.timingSafeEqual(a, b);\n} : void 0, scryptSync = \"scryptSync\" in crypto \? (password, salt, keylen, options) => {\n let res = crypto.scryptSync(password, salt, keylen, options);\n return DEFAULT_ENCODING !== \"buffer\" \? new Buffer(res).toString(DEFAULT_ENCODING) : new Buffer(res);\n} : void 0, scrypt = \"scryptSync\" in crypto \? function(password, salt, keylen, options, callback) {\n if (typeof options == \"function\" && (callback = options, options = void 0), typeof callback != \"function\") {\n var err = @makeTypeError(\"callback must be a function\");\n throw err.code = \"ERR_INVALID_CALLBACK\", err;\n }\n try {\n let result = crypto.scryptSync(password, salt, keylen, options);\n process.nextTick(callback, null, DEFAULT_ENCODING !== \"buffer\" \? new Buffer(result).toString(DEFAULT_ENCODING) : new Buffer(result));\n } catch (err2) {\n throw err2;\n }\n} : void 0;\ntimingSafeEqual && (Object.defineProperty(timingSafeEqual, \"name\", {\n value: \"::bunternal::\"\n}), Object.defineProperty(scrypt, \"name\", {\n value: \"::bunternal::\"\n}), Object.defineProperty(scryptSync, \"name\", {\n value: \"::bunternal::\"\n}));\nvar harcoded_curves = [\n \"p192\",\n \"p224\",\n \"p256\",\n \"p384\",\n \"p521\",\n \"curve25519\",\n \"ed25519\",\n \"secp256k1\",\n \"secp224r1\",\n \"prime256v1\",\n \"prime192v1\",\n \"ed25519\",\n \"secp384r1\",\n \"secp521r1\"\n], {\n symmetricKeySize,\n asymmetricKeyDetails,\n asymmetricKeyType,\n equals,\n exports,\n createSecretKey,\n createPublicKey,\n createPrivateKey,\n generateKeySync,\n generateKeyPairSync\n} = @lazy(\"internal/crypto\"), kCryptoKey = Symbol.for(\"::bunKeyObjectCryptoKey::\");\n\nclass KeyObject {\n [kCryptoKey];\n constructor(key2) {\n if (typeof key2 !== \"object\")\n @throwTypeError('The \"key\" argument must be an instance of CryptoKey.');\n this[kCryptoKey] = key2;\n }\n toString() {\n return \"[object KeyObject]\";\n }\n static from(key2) {\n if (key2 instanceof KeyObject)\n key2 = key2[kCryptoKey];\n return new KeyObject(key2);\n }\n get asymmetricKeyDetails() {\n return asymmetricKeyDetails(this[kCryptoKey]);\n }\n get symmetricKeySize() {\n return symmetricKeySize(this[kCryptoKey]);\n }\n get asymmetricKeyType() {\n return asymmetricKeyType(this[kCryptoKey]);\n }\n [\"export\"](options) {\n switch (arguments.length) {\n case 0:\n switch (this.type) {\n case \"secret\":\n options = {\n format: \"buffer\"\n };\n break;\n case \"public\":\n options = {\n format: \"pem\",\n type: \"spki\"\n };\n break;\n case \"private\":\n options = {\n format: \"pem\",\n type: \"pkcs8\"\n };\n break;\n }\n break;\n case 1:\n if (typeof options === \"object\" && !options.format)\n switch (this.type) {\n case \"secret\":\n options.format = \"buffer\";\n break;\n default:\n options.format = \"pem\";\n break;\n }\n }\n return exports(this[kCryptoKey], options);\n }\n equals(otherKey) {\n if (!(otherKey instanceof KeyObject))\n @throwTypeError(\"otherKey must be a KeyObject\");\n return equals(this[kCryptoKey], otherKey[kCryptoKey]);\n }\n get type() {\n return this[kCryptoKey].type;\n }\n}\ncrypto_exports.generateKeySync = function(algorithm, options) {\n return KeyObject.from(generateKeySync(algorithm, options\?.length));\n};\ncrypto_exports.generateKey = function(algorithm, options, callback) {\n try {\n const key2 = KeyObject.from(generateKeySync(algorithm, options\?.length));\n typeof callback === \"function\" && callback(null, KeyObject.from(key2));\n } catch (err) {\n typeof callback === \"function\" && callback(err);\n }\n};\ncrypto_exports.generateKeyPairSync = _generateKeyPairSync;\ncrypto_exports.generateKeyPair = function(algorithm, options, callback) {\n try {\n const result = _generateKeyPairSync(algorithm, options);\n typeof callback === \"function\" && callback(null, result.publicKey, result.privateKey);\n } catch (err) {\n typeof callback === \"function\" && callback(err);\n }\n};\ncrypto_exports.createSecretKey = function(key2, encoding) {\n if (key2 instanceof KeyObject || key2 instanceof CryptoKey) {\n if (key2.type !== \"secret\") {\n const error = @makeTypeError(`ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE: Invalid key object type ${key2.type}, expected secret`);\n throw error.code = \"ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE\", error;\n }\n return KeyObject.from(key2);\n }\n const buffer = getArrayBufferOrView(key2, encoding || \"utf8\");\n return KeyObject.from(createSecretKey(buffer));\n};\ncrypto_exports.createPrivateKey = _createPrivateKey;\ncrypto_exports.createPublicKey = _createPublicKey;\ncrypto_exports.KeyObject = KeyObject;\nvar _createSign = crypto_exports.createSign;\ncrypto_exports.sign = function(algorithm, data, key2, encoding, callback) {\n if (typeof callback === \"function\")\n try {\n const result = _createSign(algorithm).update(data, encoding).sign(key2, encoding);\n callback(null, result);\n } catch (err) {\n callback(err);\n }\n else\n return _createSign(algorithm).update(data, encoding).sign(key2, encoding);\n};\nvar _createVerify = crypto_exports.createVerify;\ncrypto_exports.verify = function(algorithm, data, key2, signature, callback) {\n if (typeof callback === \"function\")\n try {\n const result = _createVerify(algorithm).update(data).verify(key2, signature);\n callback(null, result);\n } catch (err) {\n callback(err);\n }\n else\n return _createVerify(algorithm).update(data).verify(key2, signature);\n};\nvar webcrypto = crypto;\n__export(crypto_exports, {\n DEFAULT_ENCODING: () => DEFAULT_ENCODING,\n getRandomValues: () => getRandomValues,\n randomUUID: () => randomUUID,\n randomInt: () => randomInt,\n getCurves: () => getCurves,\n scrypt: () => scrypt,\n scryptSync: () => scryptSync,\n timingSafeEqual: () => timingSafeEqual,\n webcrypto: () => webcrypto,\n subtle: () => webcrypto.subtle\n});\n$ = crypto_exports;\n/*! safe-buffer. MIT License. Feross Aboukhadijeh */\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeDgramCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/dgram.ts\nvar createSocket = function() {\n throwNotImplemented(\"node:dgram createSocket\", 1630);\n}, Socket = function() {\n throwNotImplemented(\"node:dgram Socket\", 1630);\n}, _createSocketHandle = function() {\n throwNotImplemented(\"node:dgram _createSocketHandle\", 1630);\n}, $, { hideFromStack, throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6);\n$ = {\n createSocket,\n Socket,\n _createSocketHandle\n};\nhideFromStack(createSocket, Socket, _createSocketHandle);\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeDiagnosticsChannelCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/diagnostics_channel.ts\nvar markActive = function(channel) {\n ObjectSetPrototypeOf(channel, ActiveChannel.prototype), channel._subscribers = [], channel._stores = new SafeMap;\n}, maybeMarkInactive = function(channel) {\n if (!channel._subscribers.length && !channel._stores.size)\n ObjectSetPrototypeOf(channel, Channel.prototype), channel._subscribers = @undefined, channel._stores = @undefined;\n}, defaultTransform = function(data) {\n return data;\n}, wrapStoreRun = function(store, data, next, transform = defaultTransform) {\n return () => {\n let context;\n try {\n context = transform(data);\n } catch (err) {\n return process.nextTick(() => reportError(err)), next();\n }\n return store.run(context, next);\n };\n}, channel = function(name) {\n const channel2 = channels.get(name);\n if (channel2)\n return channel2;\n if (typeof name !== \"string\" && typeof name !== \"symbol\")\n throw new ERR_INVALID_ARG_TYPE(\"channel\", [\"string\", \"symbol\"], name);\n return new Channel(name);\n}, subscribe = function(name, subscription) {\n return channel(name).subscribe(subscription);\n}, unsubscribe = function(name, subscription) {\n return channel(name).unsubscribe(subscription);\n}, hasSubscribers = function(name) {\n const channel2 = channels.get(name);\n if (!channel2)\n return !1;\n return channel2.hasSubscribers;\n}, assertChannel = function(value, name) {\n if (!(value instanceof Channel))\n throw new ERR_INVALID_ARG_TYPE(name, [\"Channel\"], value);\n}, tracingChannel = function(nameOrChannels) {\n return new TracingChannel(nameOrChannels);\n}, validateFunction = function(callable, field) {\n if (typeof callable !== \"function\")\n throw new ERR_INVALID_ARG_TYPE(field, \"Function\", callable);\n return callable;\n}, $, SafeMap = Map, SafeFinalizationRegistry = FinalizationRegistry, ArrayPrototypeAt = (array, index) => array[index], ArrayPrototypeIndexOf = (array, value) => array.indexOf(value), ArrayPrototypePush = (array, value) => array.push(value), ArrayPrototypeSplice = (array, start, deleteCount) => array.splice(start, deleteCount), ObjectGetPrototypeOf = Object.getPrototypeOf, ObjectSetPrototypeOf = Object.setPrototypeOf, SymbolHasInstance = Symbol.hasInstance, ReflectApply = @getByIdDirect(Reflect, \"apply\"), PromiseResolve = @Promise.resolve, PromiseReject = @Promise.reject, PromisePrototypeThen = (promise, onFulfilled, onRejected) => promise.then(onFulfilled, onRejected);\n\nclass WeakReference extends WeakRef {\n constructor() {\n super(...arguments);\n }\n #refs = 0;\n get() {\n return this.deref();\n }\n incRef() {\n return ++this.#refs;\n }\n decRef() {\n return --this.#refs;\n }\n}\n\nclass WeakRefMap extends SafeMap {\n constructor() {\n super(...arguments);\n }\n #finalizers = new SafeFinalizationRegistry((key) => {\n this.delete(key);\n });\n set(key, value) {\n return this.#finalizers.register(value, key), super.set(key, new WeakReference(value));\n }\n get(key) {\n return super.get(key)\?.get();\n }\n incRef(key) {\n return super.get(key)\?.incRef();\n }\n decRef(key) {\n return super.get(key)\?.decRef();\n }\n}\n\nclass ActiveChannel {\n subscribe(subscription) {\n validateFunction(subscription, \"subscription\"), ArrayPrototypePush(this._subscribers, subscription), channels.incRef(this.name);\n }\n unsubscribe(subscription) {\n const index = ArrayPrototypeIndexOf(this._subscribers, subscription);\n if (index === -1)\n return !1;\n return ArrayPrototypeSplice(this._subscribers, index, 1), channels.decRef(this.name), maybeMarkInactive(this), !0;\n }\n bindStore(store, transform) {\n if (!this._stores.has(store))\n channels.incRef(this.name);\n this._stores.set(store, transform);\n }\n unbindStore(store) {\n if (!this._stores.has(store))\n return !1;\n return this._stores.delete(store), channels.decRef(this.name), maybeMarkInactive(this), !0;\n }\n get hasSubscribers() {\n return !0;\n }\n publish(data) {\n for (let i = 0;i < (this._subscribers\?.length || 0); i++)\n try {\n const onMessage = this._subscribers[i];\n onMessage(data, this.name);\n } catch (err) {\n process.nextTick(() => reportError(err));\n }\n }\n runStores(data, fn, thisArg, ...args) {\n let run = () => {\n return this.publish(data), ReflectApply(fn, thisArg, args);\n };\n for (let entry of this._stores.entries()) {\n const store = entry[0], transform = entry[1];\n run = wrapStoreRun(store, data, run, transform);\n }\n return run();\n }\n}\n\nclass Channel {\n constructor(name) {\n this._subscribers = @undefined, this._stores = @undefined, this.name = name, channels.set(name, this);\n }\n static [SymbolHasInstance](instance) {\n const prototype = ObjectGetPrototypeOf(instance);\n return prototype === Channel.prototype || prototype === ActiveChannel.prototype;\n }\n subscribe(subscription) {\n markActive(this), this.subscribe(subscription);\n }\n unsubscribe() {\n return !1;\n }\n bindStore(store, transform) {\n markActive(this), this.bindStore(store, transform);\n }\n unbindStore() {\n return !1;\n }\n get hasSubscribers() {\n return !1;\n }\n publish() {\n }\n runStores(data, fn, thisArg, ...args) {\n return ReflectApply(fn, thisArg, args);\n }\n}\nvar channels = new WeakRefMap, traceEvents = [\"start\", \"end\", \"asyncStart\", \"asyncEnd\", \"error\"];\n\nclass TracingChannel {\n constructor(nameOrChannels) {\n if (typeof nameOrChannels === \"string\")\n this.start = channel(`tracing:${nameOrChannels}:start`), this.end = channel(`tracing:${nameOrChannels}:end`), this.asyncStart = channel(`tracing:${nameOrChannels}:asyncStart`), this.asyncEnd = channel(`tracing:${nameOrChannels}:asyncEnd`), this.error = channel(`tracing:${nameOrChannels}:error`);\n else if (typeof nameOrChannels === \"object\") {\n const { start, end, asyncStart, asyncEnd, error } = nameOrChannels;\n assertChannel(start, \"nameOrChannels.start\"), assertChannel(end, \"nameOrChannels.end\"), assertChannel(asyncStart, \"nameOrChannels.asyncStart\"), assertChannel(asyncEnd, \"nameOrChannels.asyncEnd\"), assertChannel(error, \"nameOrChannels.error\"), this.start = start, this.end = end, this.asyncStart = asyncStart, this.asyncEnd = asyncEnd, this.error = error;\n } else\n throw new ERR_INVALID_ARG_TYPE(\"nameOrChannels\", [\"string\", \"object\", \"Channel\"], nameOrChannels);\n }\n subscribe(handlers) {\n for (let name of traceEvents) {\n if (!handlers[name])\n continue;\n this[name]\?.subscribe(handlers[name]);\n }\n }\n unsubscribe(handlers) {\n let done = !0;\n for (let name of traceEvents) {\n if (!handlers[name])\n continue;\n if (!this[name]\?.unsubscribe(handlers[name]))\n done = !1;\n }\n return done;\n }\n traceSync(fn, context = {}, thisArg, ...args) {\n const { start, end, error } = this;\n return start.runStores(context, () => {\n try {\n const result = ReflectApply(fn, thisArg, args);\n return context.result = result, result;\n } catch (err) {\n throw context.error = err, error.publish(context), err;\n } finally {\n end.publish(context);\n }\n });\n }\n tracePromise(fn, context = {}, thisArg, ...args) {\n const { start, end, asyncStart, asyncEnd, error } = this;\n function reject(err) {\n return context.error = err, error.publish(context), asyncStart.publish(context), asyncEnd.publish(context), PromiseReject(err);\n }\n function resolve(result) {\n return context.result = result, asyncStart.publish(context), asyncEnd.publish(context), result;\n }\n return start.runStores(context, () => {\n try {\n let promise = ReflectApply(fn, thisArg, args);\n if (!(promise instanceof @Promise))\n promise = PromiseResolve(promise);\n return PromisePrototypeThen(promise, resolve, reject);\n } catch (err) {\n throw context.error = err, error.publish(context), err;\n } finally {\n end.publish(context);\n }\n });\n }\n traceCallback(fn, position = -1, context = {}, thisArg, ...args) {\n const { start, end, asyncStart, asyncEnd, error } = this;\n function wrappedCallback(err, res) {\n if (err)\n context.error = err, error.publish(context);\n else\n context.result = res;\n asyncStart.runStores(context, () => {\n try {\n if (callback)\n return ReflectApply(callback, this, arguments);\n } finally {\n asyncEnd.publish(context);\n }\n });\n }\n const callback = ArrayPrototypeAt(args, position);\n if (typeof callback !== \"function\")\n throw new ERR_INVALID_ARG_TYPE(\"callback\", [\"function\"], callback);\n return ArrayPrototypeSplice(args, position, 1, wrappedCallback), start.runStores(context, () => {\n try {\n return ReflectApply(fn, thisArg, args);\n } catch (err) {\n throw context.error = err, error.publish(context), err;\n } finally {\n end.publish(context);\n }\n });\n }\n}\n\nclass ERR_INVALID_ARG_TYPE extends TypeError {\n constructor(name, expected, actual) {\n super(`The ${name} argument must be of type ${expected}. Received type ${typeof actual}`);\n this.code = \"ERR_INVALID_ARG_TYPE\";\n }\n}\n$ = {\n channel,\n hasSubscribers,\n subscribe,\n tracingChannel,\n unsubscribe,\n Channel\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeDNSCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/dns.ts\nvar getServers = function() {\n return dns.getServers();\n}, lookup = function(domain, options, callback) {\n if (typeof options == \"function\")\n callback = options;\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n if (typeof options == \"number\")\n options = { family: options };\n if (domain !== domain || typeof domain !== \"number\" && !domain) {\n console.warn(`DeprecationWarning: The provided hostname \"${@String(domain)}\" is not a valid hostname, and is supported in the dns module solely for compatibility.`), callback(null, null, 4);\n return;\n }\n dns.lookup(domain, options).then((res) => {\n if (res.sort((a, b) => a.family - b.family), options\?.all)\n callback(null, res.map(mapLookupAll));\n else {\n const [{ address, family }] = res;\n callback(null, address, family);\n }\n }, (error) => {\n callback(error);\n });\n}, resolveSrv = function(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveSrv(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, resolveTxt = function(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveTxt(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, resolveSoa = function(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveSoa(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, resolveNaptr = function(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveNaptr(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, resolveMx = function(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveMx(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, resolveCaa = function(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveCaa(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, resolveNs = function(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveNs(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, resolvePtr = function(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolvePtr(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, resolveCname = function(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveCname(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, lookupService = function(address, port, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.lookupService(address, port, callback).then((results) => {\n callback(null, ...results);\n }, (error) => {\n callback(error);\n });\n}, reverse = function(ip, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.reverse(ip, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, resolve = function(hostname, rrtype, callback) {\n if (typeof rrtype == \"function\")\n callback = rrtype;\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolve(hostname).then((results) => {\n switch (rrtype\?.toLowerCase()) {\n case \"a\":\n case \"aaaa\":\n callback(null, hostname, results.map(({ address }) => address));\n break;\n default:\n callback(null, results);\n break;\n }\n }, (error) => {\n callback(error);\n });\n}, Resolver = function(options) {\n return new InternalResolver(options);\n}, setDefaultResultOrder = function() {\n}, setServers = function() {\n}, $, dns = Bun.dns, InternalResolver = class Resolver2 {\n constructor(options) {\n }\n cancel() {\n }\n getServers() {\n return [];\n }\n resolve(hostname, rrtype, callback) {\n if (typeof rrtype == \"function\")\n callback = rrtype, rrtype = null;\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolve(hostname).then((results) => {\n switch (rrtype\?.toLowerCase()) {\n case \"a\":\n case \"aaaa\":\n callback(null, hostname, results.map(mapResolveX));\n break;\n default:\n callback(null, results);\n break;\n }\n }, (error) => {\n callback(error);\n });\n }\n resolve4(hostname, options, callback) {\n if (typeof options == \"function\")\n callback = options, options = null;\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.lookup(hostname, { family: 4 }).then((addresses) => {\n callback(null, options\?.ttl \? addresses : addresses.map(mapResolveX));\n }, (error) => {\n callback(error);\n });\n }\n resolve6(hostname, options, callback) {\n if (typeof options == \"function\")\n callback = options, options = null;\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.lookup(hostname, { family: 6 }).then((addresses) => {\n callback(null, options\?.ttl \? addresses : addresses.map(({ address }) => address));\n }, (error) => {\n callback(error);\n });\n }\n resolveAny(hostname, callback) {\n callback(null, []);\n }\n resolveCname(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveCname(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n resolveMx(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveMx(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n resolveNaptr(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveNaptr(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n resolveNs(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveNs(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n resolvePtr(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolvePtr(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n resolveSrv(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveSrv(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n resolveCaa(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveCaa(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n resolveTxt(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveTxt(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n resolveSoa(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveSoa(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n reverse(ip, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.reverse(ip, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n setServers(servers) {\n }\n};\nResolver.prototype = {};\nObject.setPrototypeOf(Resolver.prototype, InternalResolver.prototype);\nObject.setPrototypeOf(Resolver, InternalResolver);\nvar {\n resolve,\n resolve4,\n resolve6,\n resolveAny,\n resolveCname,\n resolveCaa,\n resolveMx,\n resolveNaptr,\n resolveNs,\n resolvePtr,\n resolveSoa,\n resolveSrv,\n reverse,\n resolveTxt\n} = InternalResolver.prototype, promisifyLookup = (res) => {\n res.sort((a, b) => a.family - b.family);\n const [{ address, family }] = res;\n return { address, family };\n}, mapLookupAll = (res) => {\n const { address, family } = res;\n return { address, family };\n}, promisifyLookupAll = (res) => {\n return res.sort((a, b) => a.family - b.family), res.map(mapLookupAll);\n}, mapResolveX = (a) => a.address, promisifyResolveX = (res) => {\n return res\?.map(mapResolveX);\n}, promises = {\n lookup(domain, options) {\n if (options\?.all)\n return dns.lookup(domain, options).then(promisifyLookupAll);\n return dns.lookup(domain, options).then(promisifyLookup);\n },\n lookupService(address, port) {\n return dns.lookupService(address, port);\n },\n resolve(hostname, rrtype) {\n if (typeof rrtype !== \"string\")\n rrtype = null;\n switch (rrtype\?.toLowerCase()) {\n case \"a\":\n case \"aaaa\":\n return dns.resolve(hostname, rrtype).then(promisifyLookup);\n default:\n return dns.resolve(hostname, rrtype);\n }\n },\n resolve4(hostname, options) {\n if (options\?.ttl)\n return dns.lookup(hostname, { family: 4 });\n return dns.lookup(hostname, { family: 4 }).then(promisifyResolveX);\n },\n resolve6(hostname, options) {\n if (options\?.ttl)\n return dns.lookup(hostname, { family: 6 });\n return dns.lookup(hostname, { family: 6 }).then(promisifyResolveX);\n },\n resolveSrv(hostname) {\n return dns.resolveSrv(hostname);\n },\n resolveTxt(hostname) {\n return dns.resolveTxt(hostname);\n },\n resolveSoa(hostname) {\n return dns.resolveSoa(hostname);\n },\n resolveNaptr(hostname) {\n return dns.resolveNaptr(hostname);\n },\n resolveMx(hostname) {\n return dns.resolveMx(hostname);\n },\n resolveCaa(hostname) {\n return dns.resolveCaa(hostname);\n },\n resolveNs(hostname) {\n return dns.resolveNs(hostname);\n },\n resolvePtr(hostname) {\n return dns.resolvePtr(hostname);\n },\n resolveCname(hostname) {\n return dns.resolveCname(hostname);\n },\n reverse(ip) {\n return dns.reverse(ip);\n },\n Resolver: class Resolver3 {\n constructor(options) {\n }\n cancel() {\n }\n getServers() {\n return [];\n }\n resolve(hostname, rrtype) {\n if (typeof rrtype !== \"string\")\n rrtype = null;\n switch (rrtype\?.toLowerCase()) {\n case \"a\":\n case \"aaaa\":\n return dns.resolve(hostname, rrtype).then(promisifyLookup);\n default:\n return dns.resolve(hostname, rrtype);\n }\n }\n resolve4(hostname, options) {\n if (options\?.ttl)\n return dns.lookup(hostname, { family: 4 });\n return dns.lookup(hostname, { family: 4 }).then(promisifyResolveX);\n }\n resolve6(hostname, options) {\n if (options\?.ttl)\n return dns.lookup(hostname, { family: 6 });\n return dns.lookup(hostname, { family: 6 }).then(promisifyResolveX);\n }\n resolveAny(hostname) {\n return @Promise.resolve([]);\n }\n resolveCname(hostname) {\n return dns.resolveCname(hostname);\n }\n resolveMx(hostname) {\n return dns.resolveMx(hostname);\n }\n resolveNaptr(hostname) {\n return dns.resolveNaptr(hostname);\n }\n resolveNs(hostname) {\n return dns.resolveNs(hostname);\n }\n resolvePtr(hostname) {\n return dns.resolvePtr(hostname);\n }\n resolveSoa(hostname) {\n return dns.resolveSoa(hostname);\n }\n resolveSrv(hostname) {\n return dns.resolveSrv(hostname);\n }\n resolveCaa(hostname) {\n return dns.resolveCaa(hostname);\n }\n resolveTxt(hostname) {\n return dns.resolveTxt(hostname);\n }\n reverse(ip) {\n return dns.reverse(ip);\n }\n setServers(servers) {\n }\n }\n};\nfor (let key of [\"resolveAny\"])\n promises[key] = () => @Promise.resolve(@undefined);\n$ = {\n ADDRCONFIG: 0,\n ALL: 1,\n V4MAPPED: 2,\n NODATA: \"DNS_ENODATA\",\n FORMERR: \"DNS_EFORMERR\",\n SERVFAIL: \"DNS_ESERVFAIL\",\n NOTFOUND: \"DNS_ENOTFOUND\",\n NOTIMP: \"DNS_ENOTIMP\",\n REFUSED: \"DNS_EREFUSED\",\n BADQUERY: \"DNS_EBADQUERY\",\n BADNAME: \"DNS_EBADNAME\",\n BADFAMILY: \"DNS_EBADFAMILY\",\n BADRESP: \"DNS_EBADRESP\",\n CONNREFUSED: \"DNS_ECONNREFUSED\",\n TIMEOUT: \"DNS_ETIMEOUT\",\n EOF: \"DNS_EEOF\",\n FILE: \"DNS_EFILE\",\n NOMEM: \"DNS_ENOMEM\",\n DESTRUCTION: \"DNS_EDESTRUCTION\",\n BADSTR: \"DNS_EBADSTR\",\n BADFLAGS: \"DNS_EBADFLAGS\",\n NONAME: \"DNS_ENONAME\",\n BADHINTS: \"DNS_EBADHINTS\",\n NOTINITIALIZED: \"DNS_ENOTINITIALIZED\",\n LOADIPHLPAPI: \"DNS_ELOADIPHLPAPI\",\n ADDRGETNETWORKPARAMS: \"DNS_EADDRGETNETWORKPARAMS\",\n CANCELLED: \"DNS_ECANCELLED\",\n lookup,\n lookupService,\n Resolver,\n setServers,\n setDefaultResultOrder,\n resolve,\n reverse,\n resolve4,\n resolve6,\n resolveAny,\n resolveCname,\n resolveCaa,\n resolveMx,\n resolveNs,\n resolvePtr,\n resolveSoa,\n resolveSrv,\n resolveTxt,\n resolveNaptr,\n promises,\n getServers\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeDNSPromisesCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/dns.promises.ts\nreturn (@getInternalField(@internalModuleRegistry, 17) || @createInternalModuleById(17)).promises})\n"); -// - -// -static constexpr ASCIILiteral NodeDomainCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/domain.ts\nvar EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20), domain = {};\ndomain.createDomain = domain.create = function() {\n var d = new EventEmitter;\n function emitError(e) {\n d.emit(\"error\", e);\n }\n return d.add = function(emitter) {\n emitter.on(\"error\", emitError);\n }, d.remove = function(emitter) {\n emitter.removeListener(\"error\", emitError);\n }, d.bind = function(fn) {\n return function() {\n var args = @Array.prototype.slice.@call(arguments);\n try {\n fn.@apply(null, args);\n } catch (err) {\n emitError(err);\n }\n };\n }, d.intercept = function(fn) {\n return function(err) {\n if (err)\n emitError(err);\n else {\n var args = @Array.prototype.slice.@call(arguments, 1);\n try {\n fn.@apply(null, args);\n } catch (err2) {\n emitError(err2);\n }\n }\n };\n }, d.run = function(fn) {\n try {\n fn();\n } catch (err) {\n emitError(err);\n }\n return this;\n }, d.dispose = function() {\n return this.removeAllListeners(), this;\n }, d.enter = d.exit = function() {\n return this;\n }, d;\n};\nreturn domain})\n"); -// - -// -static constexpr ASCIILiteral NodeEventsCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/events.ts\nvar emitError = function(emitter, args) {\n var { _events: events } = emitter;\n if (args[0] \?\?= new Error(\"Unhandled error.\"), !events)\n throw args[0];\n var errorMonitor = events[kErrorMonitor];\n if (errorMonitor)\n for (var handler of ArrayPrototypeSlice.@call(errorMonitor))\n handler.@apply(emitter, args);\n var handlers = events.error;\n if (!handlers)\n throw args[0];\n for (var handler of ArrayPrototypeSlice.@call(handlers))\n handler.@apply(emitter, args);\n return !0;\n}, addCatch = function(emitter, promise, type, args) {\n promise.then(@undefined, function(err) {\n process.nextTick(emitUnhandledRejectionOrErr, emitter, err, type, args);\n });\n}, emitUnhandledRejectionOrErr = function(emitter, err, type, args) {\n if (typeof emitter[kRejection] === \"function\")\n emitter[kRejection](err, type, ...args);\n else\n try {\n emitter[kCapture] = !1, emitter.emit(\"error\", err);\n } finally {\n emitter[kCapture] = !0;\n }\n}, overflowWarning = function(emitter, type, handlers) {\n handlers.warned = !0;\n const warn = new Error(`Possible EventEmitter memory leak detected. ${handlers.length} ${@String(type)} listeners ` + `added to [${emitter.constructor.name}]. Use emitter.setMaxListeners() to increase limit`);\n warn.name = \"MaxListenersExceededWarning\", warn.emitter = emitter, warn.type = type, warn.count = handlers.length, process.emitWarning(warn);\n}, onceWrapper = function(type, listener, ...args) {\n this.removeListener(type, listener), listener.@apply(this, args);\n}, once = function(emitter, type, options) {\n var signal = options\?.signal;\n if (validateAbortSignal(signal, \"options.signal\"), signal\?.aborted)\n throw new AbortError(@undefined, { cause: signal\?.reason });\n return new @Promise((resolve, reject) => {\n const errorListener = (err) => {\n if (emitter.removeListener(type, resolver), signal != null)\n eventTargetAgnosticRemoveListener(signal, \"abort\", abortListener);\n reject(err);\n }, resolver = (...args) => {\n if (typeof emitter.removeListener === \"function\")\n emitter.removeListener(\"error\", errorListener);\n if (signal != null)\n eventTargetAgnosticRemoveListener(signal, \"abort\", abortListener);\n resolve(args);\n };\n if (eventTargetAgnosticAddListener(emitter, type, resolver, { once: !0 }), type !== \"error\" && typeof emitter.once === \"function\")\n emitter.once(\"error\", errorListener);\n function abortListener() {\n eventTargetAgnosticRemoveListener(emitter, type, resolver), eventTargetAgnosticRemoveListener(emitter, \"error\", errorListener), reject(new AbortError(@undefined, { cause: signal\?.reason }));\n }\n if (signal != null)\n eventTargetAgnosticAddListener(signal, \"abort\", abortListener, { once: !0 });\n });\n}, on = function(emitter, type, options) {\n var { signal, close, highWatermark = Number.MAX_SAFE_INTEGER, lowWatermark = 1 } = options || {};\n throwNotImplemented(\"events.on\", 2679);\n}, getEventListeners = function(emitter, type) {\n if (emitter instanceof EventTarget)\n throwNotImplemented(\"getEventListeners with an EventTarget\", 2678);\n return emitter.listeners(type);\n}, setMaxListeners = function(n, ...eventTargets) {\n validateNumber(n, \"setMaxListeners\", 0);\n var length;\n if (eventTargets && (length = eventTargets.length))\n for (let i = 0;i < length; i++)\n eventTargets[i].setMaxListeners(n);\n else\n defaultMaxListeners = n;\n}, listenerCount = function(emitter, type) {\n return emitter.listenerCount(type);\n}, eventTargetAgnosticRemoveListener = function(emitter, name, listener, flags) {\n if (typeof emitter.removeListener === \"function\")\n emitter.removeListener(name, listener);\n else\n emitter.removeEventListener(name, listener, flags);\n}, eventTargetAgnosticAddListener = function(emitter, name, listener, flags) {\n if (typeof emitter.on === \"function\")\n if (flags.once)\n emitter.once(name, listener);\n else\n emitter.on(name, listener);\n else\n emitter.addEventListener(name, listener, flags);\n}, ERR_INVALID_ARG_TYPE = function(name, type, value) {\n const err = @makeTypeError(`The \"${name}\" argument must be of type ${type}. Received ${value}`);\n return err.code = \"ERR_INVALID_ARG_TYPE\", err;\n}, ERR_OUT_OF_RANGE = function(name, range, value) {\n const err = new RangeError(`The \"${name}\" argument is out of range. It must be ${range}. Received ${value}`);\n return err.code = \"ERR_OUT_OF_RANGE\", err;\n}, validateAbortSignal = function(signal, name) {\n if (signal !== @undefined && (signal === null || typeof signal !== \"object\" || !(\"aborted\" in signal)))\n throw new ERR_INVALID_ARG_TYPE(name, \"AbortSignal\", signal);\n}, validateNumber = function(value, name, min = @undefined, max) {\n if (typeof value !== \"number\")\n throw new ERR_INVALID_ARG_TYPE(name, \"number\", value);\n if (min != null && value < min || max != null && value > max || (min != null || max != null) && Number.isNaN(value))\n throw new ERR_OUT_OF_RANGE(name, `${min != null \? `>= ${min}` : \"\"}${min != null && max != null \? \" && \" : \"\"}${max != null \? `<= ${max}` : \"\"}`, value);\n}, checkListener = function(listener) {\n if (typeof listener !== \"function\")\n @throwTypeError(\"The listener must be a function\");\n}, { throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6), SymbolFor = Symbol.for, kCapture = Symbol(\"kCapture\"), kErrorMonitor = SymbolFor(\"events.errorMonitor\"), kMaxEventTargetListeners = Symbol(\"events.maxEventTargetListeners\"), kMaxEventTargetListenersWarned = Symbol(\"events.maxEventTargetListenersWarned\"), kWatermarkData = SymbolFor(\"nodejs.watermarkData\"), kRejection = SymbolFor(\"nodejs.rejection\"), captureRejectionSymbol = SymbolFor(\"nodejs.rejection\"), ArrayPrototypeSlice = @Array.prototype.slice, defaultMaxListeners = 10, EventEmitter = function EventEmitter2(opts) {\n if (this._events === @undefined || this._events === this.__proto__._events)\n this._events = { __proto__: null }, this._eventsCount = 0;\n if (this._maxListeners \?\?= @undefined, this[kCapture] = opts\?.captureRejections \? Boolean(opts\?.captureRejections) : EventEmitterPrototype[kCapture])\n this.emit = emitWithRejectionCapture;\n}, EventEmitterPrototype = EventEmitter.prototype = {};\nEventEmitterPrototype._events = @undefined;\nEventEmitterPrototype._eventsCount = 0;\nEventEmitterPrototype._maxListeners = @undefined;\nEventEmitterPrototype.setMaxListeners = function setMaxListeners2(n) {\n return validateNumber(n, \"setMaxListeners\", 0), this._maxListeners = n, this;\n};\nEventEmitterPrototype.constructor = EventEmitter;\nEventEmitterPrototype.getMaxListeners = function getMaxListeners() {\n return this._maxListeners \?\? defaultMaxListeners;\n};\nvar emitWithoutRejectionCapture = function emit(type, ...args) {\n if (type === \"error\")\n return emitError(this, args);\n var { _events: events } = this;\n if (events === @undefined)\n return !1;\n var handlers = events[type];\n if (handlers === @undefined)\n return !1;\n const maybeClonedHandlers = handlers.length > 1 \? handlers.slice() : handlers;\n for (let i = 0, { length } = maybeClonedHandlers;i < length; i++) {\n const handler = maybeClonedHandlers[i];\n switch (args.length) {\n case 0:\n handler.@call(this);\n break;\n case 1:\n handler.@call(this, args[0]);\n break;\n case 2:\n handler.@call(this, args[0], args[1]);\n break;\n case 3:\n handler.@call(this, args[0], args[1], args[2]);\n break;\n default:\n handler.@apply(this, args);\n break;\n }\n }\n return !0;\n}, emitWithRejectionCapture = function emit2(type, ...args) {\n if (type === \"error\")\n return emitError(this, args);\n var { _events: events } = this;\n if (events === @undefined)\n return !1;\n var handlers = events[type];\n if (handlers === @undefined)\n return !1;\n const maybeClonedHandlers = handlers.length > 1 \? handlers.slice() : handlers;\n for (let i = 0, { length } = maybeClonedHandlers;i < length; i++) {\n const handler = maybeClonedHandlers[i];\n let result;\n switch (args.length) {\n case 0:\n result = handler.@call(this);\n break;\n case 1:\n result = handler.@call(this, args[0]);\n break;\n case 2:\n result = handler.@call(this, args[0], args[1]);\n break;\n case 3:\n result = handler.@call(this, args[0], args[1], args[2]);\n break;\n default:\n result = handler.@apply(this, args);\n break;\n }\n if (result !== @undefined && @isPromise(result))\n addCatch(this, result, type, args);\n }\n return !0;\n};\nEventEmitterPrototype.emit = emitWithoutRejectionCapture;\nEventEmitterPrototype.addListener = function addListener(type, fn) {\n checkListener(fn);\n var events = this._events;\n if (!events)\n events = this._events = { __proto__: null }, this._eventsCount = 0;\n else if (events.newListener)\n this.emit(\"newListener\", type, fn.listener \?\? fn);\n var handlers = events[type];\n if (!handlers)\n events[type] = [fn], this._eventsCount++;\n else {\n handlers.push(fn);\n var m = this._maxListeners \?\? defaultMaxListeners;\n if (m > 0 && handlers.length > m && !handlers.warned)\n overflowWarning(this, type, handlers);\n }\n return this;\n};\nEventEmitterPrototype.on = EventEmitterPrototype.addListener;\nEventEmitterPrototype.prependListener = function prependListener(type, fn) {\n checkListener(fn);\n var events = this._events;\n if (!events)\n events = this._events = { __proto__: null }, this._eventsCount = 0;\n else if (events.newListener)\n this.emit(\"newListener\", type, fn.listener \?\? fn);\n var handlers = events[type];\n if (!handlers)\n events[type] = [fn], this._eventsCount++;\n else {\n handlers.unshift(fn);\n var m = this._maxListeners \?\? defaultMaxListeners;\n if (m > 0 && handlers.length > m && !handlers.warned)\n overflowWarning(this, type, handlers);\n }\n return this;\n};\nEventEmitterPrototype.once = function once2(type, fn) {\n checkListener(fn);\n const bound = onceWrapper.bind(this, type, fn);\n return bound.listener = fn, this.addListener(type, bound), this;\n};\nEventEmitterPrototype.prependOnceListener = function prependOnceListener(type, fn) {\n checkListener(fn);\n const bound = onceWrapper.bind(this, type, fn);\n return bound.listener = fn, this.prependListener(type, bound), this;\n};\nEventEmitterPrototype.removeListener = function removeListener(type, fn) {\n checkListener(fn);\n var { _events: events } = this;\n if (!events)\n return this;\n var handlers = events[type];\n if (!handlers)\n return this;\n var length = handlers.length;\n let position = -1;\n for (let i = length - 1;i >= 0; i--)\n if (handlers[i] === fn || handlers[i].listener === fn) {\n position = i;\n break;\n }\n if (position < 0)\n return this;\n if (position === 0)\n handlers.shift();\n else\n handlers.splice(position, 1);\n if (handlers.length === 0)\n delete events[type], this._eventsCount--;\n return this;\n};\nEventEmitterPrototype.off = EventEmitterPrototype.removeListener;\nEventEmitterPrototype.removeAllListeners = function removeAllListeners(type) {\n var { _events: events } = this;\n if (type && events) {\n if (events[type])\n delete events[type], this._eventsCount--;\n } else\n this._events = { __proto__: null };\n return this;\n};\nEventEmitterPrototype.listeners = function listeners(type) {\n var { _events: events } = this;\n if (!events)\n return [];\n var handlers = events[type];\n if (!handlers)\n return [];\n return handlers.map((x) => x.listener \?\? x);\n};\nEventEmitterPrototype.rawListeners = function rawListeners(type) {\n var { _events } = this;\n if (!_events)\n return [];\n var handlers = _events[type];\n if (!handlers)\n return [];\n return handlers.slice();\n};\nEventEmitterPrototype.listenerCount = function listenerCount2(type) {\n var { _events: events } = this;\n if (!events)\n return 0;\n return events[type]\?.length \?\? 0;\n};\nEventEmitterPrototype.eventNames = function eventNames() {\n return this._eventsCount > 0 \? Reflect.ownKeys(this._events) : [];\n};\nEventEmitterPrototype[kCapture] = !1;\n\nclass AbortError extends Error {\n constructor(message = \"The operation was aborted\", options = @undefined) {\n if (options !== @undefined && typeof options !== \"object\")\n throw new codes.ERR_INVALID_ARG_TYPE(\"options\", \"Object\", options);\n super(message, options);\n this.code = \"ABORT_ERR\", this.name = \"AbortError\";\n }\n}\nvar AsyncResource = null;\n\nclass EventEmitterAsyncResource extends EventEmitter {\n triggerAsyncId;\n asyncResource;\n constructor(options) {\n if (!AsyncResource)\n AsyncResource = (@getInternalField(@internalModuleRegistry, 10) || @createInternalModuleById(10)).AsyncResource;\n var { captureRejections = !1, triggerAsyncId, name = new.target.name, requireManualDestroy } = options || {};\n super({ captureRejections });\n this.triggerAsyncId = triggerAsyncId \?\? 0, this.asyncResource = new AsyncResource(name, { triggerAsyncId, requireManualDestroy });\n }\n emit(...args) {\n this.asyncResource.runInAsyncScope(() => super.emit(...args));\n }\n emitDestroy() {\n this.asyncResource.emitDestroy();\n }\n}\nObject.defineProperties(EventEmitter, {\n captureRejections: {\n get() {\n return EventEmitterPrototype[kCapture];\n },\n set(value) {\n validateBoolean(value, \"EventEmitter.captureRejections\"), EventEmitterPrototype[kCapture] = value;\n },\n enumerable: !0\n },\n defaultMaxListeners: {\n enumerable: !0,\n get: () => {\n return defaultMaxListeners;\n },\n set: (arg) => {\n validateNumber(arg, \"defaultMaxListeners\", 0), defaultMaxListeners = arg;\n }\n },\n kMaxEventTargetListeners: {\n value: kMaxEventTargetListeners,\n enumerable: !1,\n configurable: !1,\n writable: !1\n },\n kMaxEventTargetListenersWarned: {\n value: kMaxEventTargetListenersWarned,\n enumerable: !1,\n configurable: !1,\n writable: !1\n }\n});\nObject.assign(EventEmitter, {\n once,\n on,\n getEventListeners,\n setMaxListeners,\n EventEmitter,\n usingDomains: !1,\n captureRejectionSymbol,\n EventEmitterAsyncResource,\n errorMonitor: kErrorMonitor,\n setMaxListeners,\n init: EventEmitter,\n listenerCount\n});\nreturn EventEmitter})\n"); -// - -// -static constexpr ASCIILiteral NodeFSCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/fs.ts\nvar getValidatedPath = function(p) {\n if (p instanceof URL)\n return Bun.fileURLToPath(p);\n if (typeof p !== \"string\")\n @throwTypeError(\"Path must be a string or URL.\");\n return (_pathModule \?\?= @getInternalField(@internalModuleRegistry, 30) || @createInternalModuleById(30)).resolve(p);\n}, watchFile = function(filename, options, listener) {\n if (filename = getValidatedPath(filename), typeof options === \"function\")\n listener = options, options = {};\n if (typeof listener !== \"function\")\n @throwTypeError(\"listener must be a function\");\n var stat = statWatchers.get(filename);\n if (!stat)\n stat = new StatWatcher(filename, options), statWatchers.set(filename, stat);\n return stat.addListener(\"change\", listener), stat;\n}, unwatchFile = function(filename, listener) {\n filename = getValidatedPath(filename);\n var stat = statWatchers.get(filename);\n if (!stat)\n return;\n if (listener) {\n if (stat.removeListener(\"change\", listener), stat.listenerCount(\"change\") !== 0)\n return;\n } else\n stat.removeAllListeners(\"change\");\n stat.stop(), statWatchers.delete(filename);\n}, callbackify = function(fsFunction, args) {\n const callback = args[args.length - 1];\n try {\n var result = fsFunction.@apply(fs, args.slice(0, args.length - 1));\n result.then((...args2) => callback(null, ...args2), (err) => callback(err));\n } catch (e) {\n if (typeof callback === \"function\")\n callback(e);\n else\n throw e;\n }\n}, createReadStream = function(path, options) {\n return new ReadStream(path, options);\n}, WriteStream_handleWrite = function(er, bytes) {\n if (er)\n return WriteStream_errorOrDestroy.@call(this, er);\n this.bytesWritten += bytes;\n}, WriteStream_internalClose = function(err, cb) {\n this[_writeStreamPathFastPathSymbol] = !1;\n var fd = this.fd;\n this[_fs].close(fd, (er) => {\n this.fd = null, cb(err || er);\n });\n}, WriteStream_errorOrDestroy = function(err) {\n var {\n _readableState: r = { destroyed: !1, autoDestroy: !1 },\n _writableState: w = { destroyed: !1, autoDestroy: !1 }\n } = this;\n if (w\?.destroyed || r\?.destroyed)\n return this;\n if (r\?.autoDestroy || w\?.autoDestroy)\n this.destroy(err);\n else if (err)\n this.emit(\"error\", err);\n}, createWriteStream = function(path, options) {\n return new WriteStream(path, options);\n}, cpSync = function(src, dest, options) {\n if (!options)\n return fs.cpSync(src, dest);\n if (typeof options !== \"object\")\n @throwTypeError(\"options must be an object\");\n if (options.dereference || options.filter || options.preserveTimestamps || options.verbatimSymlinks) {\n if (!lazy_cpSync)\n lazy_cpSync = @getInternalField(@internalModuleRegistry, 3) || @createInternalModuleById(3);\n return lazy_cpSync(src, dest, options);\n }\n return fs.cpSync(src, dest, options.recursive, options.errorOnExist, options.force \?\? !0, options.mode);\n}, cp = function(src, dest, options, callback) {\n if (typeof options === \"function\")\n callback = options, options = @undefined;\n promises.cp(src, dest, options).then(() => callback(), callback);\n}, _toUnixTimestamp = function(time, name = \"time\") {\n if (typeof time === \"string\" && +time == time)\n return +time;\n if (NumberIsFinite(time)) {\n if (time < 0)\n return DateNow() / 1000;\n return time;\n }\n if (isDate(time))\n return DatePrototypeGetTime(time) / 1000;\n @throwTypeError(`Expected ${name} to be a number or Date`);\n}, $, ReadStream, WriteStream, EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20), promises = @getInternalField(@internalModuleRegistry, 22) || @createInternalModuleById(22), Stream = @getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39), { isArrayBufferView } = @requireNativeModule(\"util/types\"), _writeStreamPathFastPathSymbol = Symbol.for(\"Bun.NodeWriteStreamFastPath\"), _fs = Symbol.for(\"#fs\"), constants = @processBindingConstants.fs, fs = Bun.fs();\n\nclass FSWatcher extends EventEmitter {\n #watcher;\n #listener;\n constructor(path, options, listener) {\n super();\n if (typeof options === \"function\")\n listener = options, options = {};\n else if (typeof options === \"string\")\n options = { encoding: options };\n if (typeof listener !== \"function\")\n listener = () => {\n };\n this.#listener = listener;\n try {\n this.#watcher = fs.watch(path, options || {}, this.#onEvent.bind(this));\n } catch (e) {\n if (!e.message\?.startsWith(\"FileNotFound\"))\n throw e;\n const notFound = new Error(`ENOENT: no such file or directory, watch '${path}'`);\n throw notFound.code = \"ENOENT\", notFound.errno = -2, notFound.path = path, notFound.syscall = \"watch\", notFound.filename = path, notFound;\n }\n }\n #onEvent(eventType, filenameOrError) {\n if (eventType === \"error\" || eventType === \"close\")\n this.emit(eventType, filenameOrError);\n else\n this.emit(\"change\", eventType, filenameOrError), this.#listener(eventType, filenameOrError);\n }\n close() {\n this.#watcher\?.close(), this.#watcher = null;\n }\n ref() {\n this.#watcher\?.ref();\n }\n unref() {\n this.#watcher\?.unref();\n }\n start() {\n }\n}\n\nclass StatWatcher extends EventEmitter {\n constructor(path, options) {\n super();\n this._handle = fs.watchFile(path, options, this.#onChange.bind(this));\n }\n #onChange(curr, prev) {\n this.emit(\"change\", curr, prev);\n }\n start() {\n }\n stop() {\n this._handle\?.close(), this._handle = null;\n }\n ref() {\n this._handle\?.ref();\n }\n unref() {\n this._handle\?.unref();\n }\n}\nvar access = function access2(...args) {\n callbackify(fs.access, args);\n}, appendFile = function appendFile2(...args) {\n callbackify(fs.appendFile, args);\n}, close = function close2(...args) {\n callbackify(fs.close, args);\n}, rm = function rm2(...args) {\n callbackify(fs.rm, args);\n}, rmdir = function rmdir2(...args) {\n callbackify(fs.rmdir, args);\n}, copyFile = function copyFile2(...args) {\n const callback = args[args.length - 1];\n if (typeof callback !== \"function\") {\n const err = @makeTypeError(\"Callback must be a function\");\n throw err.code = \"ERR_INVALID_ARG_TYPE\", err;\n }\n fs.copyFile(...args).then((result) => callback(null, result), callback);\n}, exists = function exists2(path, callback) {\n if (typeof callback !== \"function\") {\n const err = @makeTypeError(\"Callback must be a function\");\n throw err.code = \"ERR_INVALID_ARG_TYPE\", err;\n }\n try {\n fs.exists.@apply(fs, [path]).then((existed) => callback(existed), (_) => callback(!1));\n } catch (e) {\n callback(!1);\n }\n}, chown = function chown2(...args) {\n callbackify(fs.chown, args);\n}, chmod = function chmod2(...args) {\n callbackify(fs.chmod, args);\n}, fchmod = function fchmod2(...args) {\n callbackify(fs.fchmod, args);\n}, fchown = function fchown2(...args) {\n callbackify(fs.fchown, args);\n}, fstat = function fstat2(...args) {\n callbackify(fs.fstat, args);\n}, fsync = function fsync2(...args) {\n callbackify(fs.fsync, args);\n}, ftruncate = function ftruncate2(...args) {\n callbackify(fs.ftruncate, args);\n}, futimes = function futimes2(...args) {\n callbackify(fs.futimes, args);\n}, lchmod = function lchmod2(...args) {\n callbackify(fs.lchmod, args);\n}, lchown = function lchown2(...args) {\n callbackify(fs.lchown, args);\n}, link = function link2(...args) {\n callbackify(fs.link, args);\n}, mkdir = function mkdir2(...args) {\n callbackify(fs.mkdir, args);\n}, mkdtemp = function mkdtemp2(...args) {\n callbackify(fs.mkdtemp, args);\n}, open = function open2(...args) {\n callbackify(fs.open, args);\n}, read = function read2(fd, buffer, offsetOrOptions, length, position, callback) {\n let offset = offsetOrOptions, params = null;\n if (arguments.length <= 4) {\n if (arguments.length === 4)\n callback = length, params = offsetOrOptions;\n else if (arguments.length === 3) {\n if (!isArrayBufferView(buffer))\n params = buffer, { buffer = @Buffer.alloc(16384) } = params \?\? {};\n callback = offsetOrOptions;\n } else\n callback = buffer, buffer = @Buffer.alloc(16384);\n ({ offset = 0, length = buffer\?.byteLength - offset, position = null } = params \?\? {});\n }\n queueMicrotask(() => {\n try {\n var bytesRead = fs.readSync(fd, buffer, offset, length, position);\n } catch (e) {\n callback(e);\n }\n callback(null, bytesRead, buffer);\n });\n}, write = function write2(...args) {\n callbackify(fs.write, args);\n}, readdir = function readdir2(...args) {\n const callback = args[args.length - 1];\n if (typeof callback !== \"function\")\n @throwTypeError(\"Callback must be a function\");\n fs.readdir(...args).then((result) => callback(null, result), callback);\n}, readFile = function readFile2(...args) {\n const callback = args[args.length - 1];\n if (typeof callback !== \"function\")\n @throwTypeError(\"Callback must be a function\");\n fs.readFile(...args).then((result) => callback(null, result), callback);\n}, writeFile = function writeFile2(...args) {\n callbackify(fs.writeFile, args);\n}, readlink = function readlink2(...args) {\n callbackify(fs.readlink, args);\n}, realpath = function realpath2(...args) {\n const callback = args[args.length - 1];\n if (typeof callback !== \"function\")\n @throwTypeError(\"Callback must be a function\");\n fs.realpath(...args).then((result) => callback(null, result), callback);\n}, rename = function rename2(...args) {\n callbackify(fs.rename, args);\n}, lstat = function lstat2(...args) {\n const callback = args[args.length - 1];\n if (typeof callback !== \"function\")\n @throwTypeError(\"Callback must be a function\");\n fs.lstat(...args).then((result) => callback(null, result), callback);\n}, stat = function stat2(...args) {\n const callback = args[args.length - 1];\n if (typeof callback !== \"function\")\n @throwTypeError(\"Callback must be a function\");\n fs.stat(...args).then((result) => callback(null, result), callback);\n}, symlink = function symlink2(...args) {\n callbackify(fs.symlink, args);\n}, truncate = function truncate2(...args) {\n callbackify(fs.truncate, args);\n}, unlink = function unlink2(...args) {\n callbackify(fs.unlink, args);\n}, utimes = function utimes2(...args) {\n callbackify(fs.utimes, args);\n}, lutimes = function lutimes2(...args) {\n callbackify(fs.lutimes, args);\n}, accessSync = fs.accessSync.bind(fs), appendFileSync = fs.appendFileSync.bind(fs), closeSync = fs.closeSync.bind(fs), copyFileSync = fs.copyFileSync.bind(fs), existsSync = fs.existsSync.bind(fs), chownSync = fs.chownSync.bind(fs), chmodSync = fs.chmodSync.bind(fs), fchmodSync = fs.fchmodSync.bind(fs), fchownSync = fs.fchownSync.bind(fs), fstatSync = fs.fstatSync.bind(fs), fsyncSync = fs.fsyncSync.bind(fs), ftruncateSync = fs.ftruncateSync.bind(fs), futimesSync = fs.futimesSync.bind(fs), lchmodSync = fs.lchmodSync.bind(fs), lchownSync = fs.lchownSync.bind(fs), linkSync = fs.linkSync.bind(fs), lstatSync = fs.lstatSync.bind(fs), mkdirSync = fs.mkdirSync.bind(fs), mkdtempSync = fs.mkdtempSync.bind(fs), openSync = fs.openSync.bind(fs), readSync = fs.readSync.bind(fs), writeSync = fs.writeSync.bind(fs), readdirSync = fs.readdirSync.bind(fs), readFileSync = fs.readFileSync.bind(fs), writeFileSync = fs.writeFileSync.bind(fs), readlinkSync = fs.readlinkSync.bind(fs), realpathSync = fs.realpathSync.bind(fs), renameSync = fs.renameSync.bind(fs), statSync = fs.statSync.bind(fs), symlinkSync = fs.symlinkSync.bind(fs), truncateSync = fs.truncateSync.bind(fs), unlinkSync = fs.unlinkSync.bind(fs), utimesSync = fs.utimesSync.bind(fs), lutimesSync = fs.lutimesSync.bind(fs), rmSync = fs.rmSync.bind(fs), rmdirSync = fs.rmdirSync.bind(fs), writev = (fd, buffers, position, callback) => {\n if (typeof position === \"function\")\n callback = position, position = null;\n queueMicrotask(() => {\n try {\n var written = fs.writevSync(fd, buffers, position);\n } catch (e) {\n callback(e);\n }\n callback(null, written, buffers);\n });\n}, writevSync = fs.writevSync.bind(fs), readv = (fd, buffers, position, callback) => {\n if (typeof position === \"function\")\n callback = position, position = null;\n queueMicrotask(() => {\n try {\n var written = fs.readvSync(fd, buffers, position);\n } catch (e) {\n callback(e);\n }\n callback(null, written, buffers);\n });\n}, readvSync = fs.readvSync.bind(fs), Dirent = fs.Dirent, Stats = fs.Stats, watch = function watch2(path, options, listener) {\n return new FSWatcher(path, options, listener);\n}, statWatchers = new Map, _pathModule, readStreamPathFastPathSymbol = Symbol.for(\"Bun.Node.readStreamPathFastPath\"), readStreamSymbol = Symbol.for(\"Bun.NodeReadStream\"), readStreamPathOrFdSymbol = Symbol.for(\"Bun.NodeReadStreamPathOrFd\"), writeStreamSymbol = Symbol.for(\"Bun.NodeWriteStream\"), writeStreamPathFastPathSymbol = Symbol.for(\"Bun.NodeWriteStreamFastPath\"), writeStreamPathFastPathCallSymbol = Symbol.for(\"Bun.NodeWriteStreamFastPathCall\"), kIoDone = Symbol.for(\"kIoDone\"), defaultReadStreamOptions = {\n file: @undefined,\n fd: null,\n flags: \"r\",\n encoding: @undefined,\n mode: 438,\n autoClose: !0,\n emitClose: !0,\n start: 0,\n end: @Infinity,\n highWaterMark: 65536,\n fs: {\n read,\n open: (path, flags, mode, cb) => {\n var fd;\n try {\n fd = openSync(path, flags, mode);\n } catch (e) {\n cb(e);\n return;\n }\n cb(null, fd);\n },\n openSync,\n close\n },\n autoDestroy: !0\n}, ReadStreamClass;\nReadStream = function(InternalReadStream) {\n ReadStreamClass = InternalReadStream, Object.defineProperty(ReadStreamClass.prototype, Symbol.toStringTag, {\n value: \"ReadStream\",\n enumerable: !1\n });\n function ReadStream3(path, options) {\n return new InternalReadStream(path, options);\n }\n return ReadStream3.prototype = InternalReadStream.prototype, Object.defineProperty(ReadStream3, Symbol.hasInstance, {\n value(instance) {\n return instance instanceof InternalReadStream;\n }\n });\n}(class ReadStream2 extends Stream._getNativeReadableStreamPrototype(2, Stream.Readable) {\n constructor(pathOrFd, options = defaultReadStreamOptions) {\n if (typeof options !== \"object\" || !options)\n @throwTypeError(\"Expected options to be an object\");\n var {\n flags = defaultReadStreamOptions.flags,\n encoding = defaultReadStreamOptions.encoding,\n mode = defaultReadStreamOptions.mode,\n autoClose = defaultReadStreamOptions.autoClose,\n emitClose = defaultReadStreamOptions.emitClose,\n start = defaultReadStreamOptions.start,\n end = defaultReadStreamOptions.end,\n autoDestroy = defaultReadStreamOptions.autoClose,\n fs: fs2 = defaultReadStreamOptions.fs,\n highWaterMark = defaultReadStreamOptions.highWaterMark,\n fd = defaultReadStreamOptions.fd\n } = options;\n if (pathOrFd\?.constructor\?.name === \"URL\")\n pathOrFd = Bun.fileURLToPath(pathOrFd);\n var tempThis = {};\n if (fd != null) {\n if (typeof fd !== \"number\")\n @throwTypeError(\"Expected options.fd to be a number\");\n tempThis.fd = tempThis[readStreamPathOrFdSymbol] = fd, tempThis.autoClose = !1;\n } else if (typeof pathOrFd === \"string\") {\n if (pathOrFd.startsWith(\"file://\"))\n pathOrFd = Bun.fileURLToPath(pathOrFd);\n if (pathOrFd.length === 0)\n @throwTypeError(\"Expected path to be a non-empty string\");\n tempThis.path = tempThis.file = tempThis[readStreamPathOrFdSymbol] = pathOrFd;\n } else if (typeof pathOrFd === \"number\") {\n if (pathOrFd |= 0, pathOrFd < 0)\n @throwTypeError(\"Expected fd to be a positive integer\");\n tempThis.fd = tempThis[readStreamPathOrFdSymbol] = pathOrFd, tempThis.autoClose = !1;\n } else\n @throwTypeError(\"Expected a path or file descriptor\");\n if (tempThis.fd === @undefined)\n tempThis.fd = fs2.openSync(pathOrFd, flags, mode);\n var fileRef = Bun.file(tempThis.fd), stream = fileRef.stream(), native = @direct(stream);\n if (!native)\n throw new Error(\"no native readable stream\");\n var { stream: ptr } = native;\n super(ptr, {\n ...options,\n encoding,\n autoDestroy,\n autoClose,\n emitClose,\n highWaterMark\n });\n if (Object.assign(this, tempThis), this.#fileRef = fileRef, this.end = end, this._read = this.#internalRead, this.start = start, this.flags = flags, this.mode = mode, this.emitClose = emitClose, this[readStreamPathFastPathSymbol] = start === 0 && end === @Infinity && autoClose && fs2 === defaultReadStreamOptions.fs && (encoding === \"buffer\" || encoding === \"binary\" || encoding == null || encoding === \"utf-8\" || encoding === \"utf8\"), this._readableState.autoClose = autoDestroy = autoClose, this._readableState.highWaterMark = highWaterMark, start !== @undefined)\n this.pos = start;\n }\n #fileRef;\n #fs;\n file;\n path;\n fd = null;\n flags;\n mode;\n start;\n end;\n pos;\n bytesRead = 0;\n #fileSize = -1;\n _read;\n [readStreamSymbol] = !0;\n [readStreamPathOrFdSymbol];\n [readStreamPathFastPathSymbol];\n _construct(callback) {\n if (super._construct)\n super._construct(callback);\n else\n callback();\n this.emit(\"open\", this.fd), this.emit(\"ready\");\n }\n _destroy(err, cb) {\n super._destroy(err, cb);\n try {\n var fd = this.fd;\n if (this[readStreamPathFastPathSymbol] = !1, !fd)\n cb(err);\n else\n this.#fs.close(fd, (er) => {\n cb(er || err);\n }), this.fd = null;\n } catch (e) {\n throw e;\n }\n }\n close(cb) {\n if (typeof cb === \"function\")\n Stream.eos(this, cb);\n this.destroy();\n }\n push(chunk) {\n var bytesRead = chunk\?.length \?\? 0;\n if (bytesRead > 0) {\n this.bytesRead += bytesRead;\n var currPos = this.pos;\n if (currPos !== @undefined) {\n if (this.bytesRead < currPos)\n return !0;\n if (currPos === this.start) {\n var n = this.bytesRead - currPos;\n chunk = chunk.slice(-n);\n var [_, ...rest] = arguments;\n if (this.pos = this.bytesRead, this.end !== @undefined && this.bytesRead > this.end)\n chunk = chunk.slice(0, this.end - this.start + 1);\n return super.push(chunk, ...rest);\n }\n var end = this.end;\n if (end !== @undefined && this.bytesRead > end) {\n chunk = chunk.slice(0, end - currPos + 1);\n var [_, ...rest] = arguments;\n return this.pos = this.bytesRead, super.push(chunk, ...rest);\n }\n this.pos = this.bytesRead;\n }\n }\n return super.push(...arguments);\n }\n #internalRead(n) {\n var { pos, end, bytesRead, fd, encoding } = this;\n if (n = pos !== @undefined \? Math.min(end - pos + 1, n) : Math.min(end - bytesRead + 1, n), n <= 0) {\n this.push(null);\n return;\n }\n if (this.#fileSize === -1 && bytesRead === 0 && pos === @undefined) {\n var stat3 = fstatSync(fd);\n if (this.#fileSize = stat3.size, this.#fileSize > 0 && n > this.#fileSize)\n n = this.#fileSize + 1;\n }\n this[kIoDone] = !1;\n var res = super._read(n);\n if (@isPromise(res)) {\n var then = res\?.then;\n if (then && @isCallable(then))\n res.then(() => {\n if (this[kIoDone] = !0, this.destroyed)\n this.emit(kIoDone);\n }, (er) => {\n this[kIoDone] = !0, this.#errorOrDestroy(er);\n });\n } else if (this[kIoDone] = !0, this.destroyed)\n this.emit(kIoDone), this.#errorOrDestroy(new Error(\"ERR_STREAM_PREMATURE_CLOSE\"));\n }\n #errorOrDestroy(err, sync = null) {\n var {\n _readableState: r = { destroyed: !1, autoDestroy: !1 },\n _writableState: w = { destroyed: !1, autoDestroy: !1 }\n } = this;\n if (w\?.destroyed || r\?.destroyed)\n return this;\n if (r\?.autoDestroy || w\?.autoDestroy)\n this.destroy(err);\n else if (err)\n this.emit(\"error\", err);\n }\n pause() {\n return this[readStreamPathFastPathSymbol] = !1, super.pause();\n }\n resume() {\n return this[readStreamPathFastPathSymbol] = !1, super.resume();\n }\n unshift(...args) {\n return this[readStreamPathFastPathSymbol] = !1, super.unshift(...args);\n }\n pipe(dest, pipeOpts) {\n if (this[readStreamPathFastPathSymbol] && (pipeOpts\?.end \?\? !0) && this._readableState\?.pipes\?.length === 0) {\n if ((writeStreamPathFastPathSymbol in dest) && dest[writeStreamPathFastPathSymbol]) {\n if (dest[writeStreamPathFastPathCallSymbol](this, pipeOpts))\n return this;\n }\n }\n return this[readStreamPathFastPathSymbol] = !1, super.pipe(dest, pipeOpts);\n }\n});\nvar defaultWriteStreamOptions = {\n fd: null,\n start: @undefined,\n pos: @undefined,\n encoding: @undefined,\n flags: \"w\",\n mode: 438,\n fs: {\n write,\n close,\n open,\n openSync\n }\n}, WriteStreamClass = WriteStream = function WriteStream2(path, options = defaultWriteStreamOptions) {\n if (!(this instanceof WriteStream2))\n return new WriteStream2(path, options);\n if (!options)\n @throwTypeError(\"Expected options to be an object\");\n var {\n fs: fs2 = defaultWriteStreamOptions.fs,\n start = defaultWriteStreamOptions.start,\n flags = defaultWriteStreamOptions.flags,\n mode = defaultWriteStreamOptions.mode,\n autoClose = !0,\n emitClose = !1,\n autoDestroy = autoClose,\n encoding = defaultWriteStreamOptions.encoding,\n fd = defaultWriteStreamOptions.fd,\n pos = defaultWriteStreamOptions.pos\n } = options, tempThis = {};\n if (fd != null) {\n if (typeof fd !== \"number\")\n throw new Error(\"Expected options.fd to be a number\");\n tempThis.fd = fd, tempThis[_writeStreamPathFastPathSymbol] = !1;\n } else if (typeof path === \"string\") {\n if (path.length === 0)\n @throwTypeError(\"Expected a non-empty path\");\n if (path.startsWith(\"file:\"))\n path = Bun.fileURLToPath(path);\n tempThis.path = path, tempThis.fd = null, tempThis[_writeStreamPathFastPathSymbol] = autoClose && (start === @undefined || start === 0) && fs2.write === defaultWriteStreamOptions.fs.write && fs2.close === defaultWriteStreamOptions.fs.close;\n }\n if (tempThis.fd == null)\n tempThis.fd = fs2.openSync(path, flags, mode);\n if (NativeWritable.@call(this, tempThis.fd, {\n ...options,\n decodeStrings: !1,\n autoDestroy,\n emitClose,\n fd: tempThis\n }), Object.assign(this, tempThis), typeof fs2\?.write !== \"function\")\n @throwTypeError(\"Expected fs.write to be a function\");\n if (typeof fs2\?.close !== \"function\")\n @throwTypeError(\"Expected fs.close to be a function\");\n if (typeof fs2\?.open !== \"function\")\n @throwTypeError(\"Expected fs.open to be a function\");\n if (typeof path === \"object\" && path) {\n if (path instanceof URL)\n path = Bun.fileURLToPath(path);\n }\n if (typeof path !== \"string\" && typeof fd !== \"number\")\n @throwTypeError(\"Expected a path or file descriptor\");\n if (this.start = start, this[_fs] = fs2, this.flags = flags, this.mode = mode, this.bytesWritten = 0, this[writeStreamSymbol] = !0, this[kIoDone] = !1, this.start !== @undefined)\n this.pos = this.start;\n if (encoding !== defaultWriteStreamOptions.encoding) {\n if (this.setDefaultEncoding(encoding), encoding !== \"buffer\" && encoding !== \"utf8\" && encoding !== \"utf-8\" && encoding !== \"binary\")\n this[_writeStreamPathFastPathSymbol] = !1;\n }\n return this;\n}, NativeWritable = Stream.NativeWritable, WriteStreamPrototype = WriteStream.prototype = Object.create(NativeWritable.prototype);\nObject.defineProperties(WriteStreamPrototype, {\n autoClose: {\n get() {\n return this._writableState.autoDestroy;\n },\n set(val) {\n this._writableState.autoDestroy = val;\n }\n },\n pending: {\n get() {\n return this.fd === null;\n }\n }\n});\nWriteStreamPrototype.destroySoon = WriteStreamPrototype.end;\nWriteStreamPrototype.open = function open3() {\n};\nWriteStreamPrototype[writeStreamPathFastPathCallSymbol] = function WriteStreamPathFastPathCallSymbol(readStream, pipeOpts) {\n if (!this[_writeStreamPathFastPathSymbol])\n return !1;\n if (this.fd !== null)\n return this[_writeStreamPathFastPathSymbol] = !1, !1;\n return this[kIoDone] = !1, readStream[kIoDone] = !1, Bun.write(this[_writeStreamPathFastPathSymbol], readStream[readStreamPathOrFdSymbol]).then((bytesWritten) => {\n readStream[kIoDone] = this[kIoDone] = !0, this.bytesWritten += bytesWritten, readStream.bytesRead += bytesWritten, this.end(), readStream.close();\n }, (err) => {\n readStream[kIoDone] = this[kIoDone] = !0, WriteStream_errorOrDestroy.@call(this, err), readStream.emit(\"error\", err);\n });\n};\nWriteStreamPrototype.isBunFastPathEnabled = function isBunFastPathEnabled() {\n return this[_writeStreamPathFastPathSymbol];\n};\nWriteStreamPrototype.disableBunFastPath = function disableBunFastPath() {\n this[_writeStreamPathFastPathSymbol] = !1;\n};\nWriteStreamPrototype._construct = function _construct(callback) {\n if (typeof this.fd === \"number\") {\n callback();\n return;\n }\n callback(), this.emit(\"open\", this.fd), this.emit(\"ready\");\n};\nWriteStreamPrototype._destroy = function _destroy(err, cb) {\n if (this.fd === null)\n return cb(err);\n if (this[kIoDone]) {\n this.once(kIoDone, () => WriteStream_internalClose.@call(this, err, cb));\n return;\n }\n WriteStream_internalClose.@call(this, err, cb);\n};\nWriteStreamPrototype.close = function close3(cb) {\n if (cb) {\n if (this.closed) {\n process.nextTick(cb);\n return;\n }\n this.on(\"close\", cb);\n }\n if (!this.autoClose)\n this.on(\"finish\", this.destroy);\n this.end();\n};\nWriteStreamPrototype.write = function write3(chunk, encoding, cb) {\n if (encoding \?\?= this._writableState\?.defaultEncoding, this[_writeStreamPathFastPathSymbol] = !1, typeof chunk === \"string\")\n chunk = @Buffer.from(chunk, encoding);\n var native = this.pos === @undefined;\n const callback = native \? (err, bytes) => {\n if (this[kIoDone] = !1, WriteStream_handleWrite.@call(this, err, bytes), this.emit(kIoDone), cb)\n !err \? cb() : cb(err);\n } : () => {\n };\n if (this[kIoDone] = !0, this._write)\n return this._write(chunk, encoding, callback);\n else\n return NativeWritable.prototype.write.@call(this, chunk, encoding, callback, native);\n};\nWriteStreamPrototype._write = @undefined;\nWriteStreamPrototype._writev = @undefined;\nWriteStreamPrototype.end = function end(chunk, encoding, cb) {\n var native = this.pos === @undefined;\n return NativeWritable.prototype.end.@call(this, chunk, encoding, cb, native);\n};\nWriteStreamPrototype._destroy = function _destroy2(err, cb) {\n this.close(err, cb);\n};\nObject.defineProperties(fs, {\n createReadStream: {\n value: createReadStream\n },\n createWriteStream: {\n value: createWriteStream\n },\n ReadStream: {\n value: ReadStream\n },\n WriteStream: {\n value: WriteStream\n }\n});\nrealpath.native = realpath;\nrealpathSync.native = realpathSync;\nvar lazy_cpSync = null;\n$ = {\n Dirent,\n FSWatcher,\n ReadStream,\n Stats,\n WriteStream,\n _toUnixTimestamp,\n access,\n accessSync,\n appendFile,\n appendFileSync,\n chmod,\n chmodSync,\n chown,\n chownSync,\n close,\n closeSync,\n constants,\n copyFile,\n copyFileSync,\n cp,\n cpSync,\n createReadStream,\n createWriteStream,\n exists,\n existsSync,\n fchmod,\n fchmodSync,\n fchown,\n fchownSync,\n fstat,\n fstatSync,\n fsync,\n fsyncSync,\n ftruncate,\n ftruncateSync,\n futimes,\n futimesSync,\n lchmod,\n lchmodSync,\n lchown,\n lchownSync,\n link,\n linkSync,\n lstat,\n lstatSync,\n lutimes,\n lutimesSync,\n mkdir,\n mkdirSync,\n mkdtemp,\n mkdtempSync,\n open,\n openSync,\n promises,\n read,\n readFile,\n readFileSync,\n readSync,\n readdir,\n readdirSync,\n readlink,\n readlinkSync,\n readv,\n readvSync,\n realpath,\n realpathSync,\n rename,\n renameSync,\n rm,\n rmSync,\n rmdir,\n rmdirSync,\n stat,\n statSync,\n symlink,\n symlinkSync,\n truncate,\n truncateSync,\n unlink,\n unlinkSync,\n unwatchFile,\n utimes,\n utimesSync,\n watch,\n watchFile,\n write,\n writeFile,\n writeFileSync,\n writeSync,\n writev,\n writevSync,\n [Symbol.for(\"::bunternal::\")]: {\n ReadStreamClass,\n WriteStreamClass\n }\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeFSPromisesCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/fs.promises.ts\nvar watch = function(filename, options = {}) {\n if (filename instanceof URL)\n @throwTypeError(\"Watch URLs are not supported yet\");\n else if (@Buffer.isBuffer(filename))\n filename = filename.toString();\n else if (typeof filename !== \"string\")\n @throwTypeError(\"Expected path to be a string or Buffer\");\n let nextEventResolve = null;\n if (typeof options === \"string\")\n options = { encoding: options };\n const queue = @createFIFO(), watcher = fs.watch(filename, options || {}, (eventType, filename2) => {\n if (queue.push({ eventType, filename: filename2 }), nextEventResolve) {\n const resolve = nextEventResolve;\n nextEventResolve = null, resolve();\n }\n });\n return {\n [Symbol.asyncIterator]() {\n let closed = !1;\n return {\n async next() {\n while (!closed) {\n let event;\n while (event = queue.shift()) {\n if (event.eventType === \"close\")\n return closed = !0, { value: @undefined, done: !0 };\n if (event.eventType === \"error\")\n throw closed = !0, event.filename;\n return { value: event, done: !1 };\n }\n const { promise, resolve } = @Promise.withResolvers();\n nextEventResolve = resolve, await promise;\n }\n return { value: @undefined, done: !0 };\n },\n return() {\n if (!closed) {\n if (watcher.close(), closed = !0, nextEventResolve) {\n const resolve = nextEventResolve;\n nextEventResolve = null, resolve();\n }\n }\n return { value: @undefined, done: !0 };\n }\n };\n }\n };\n}, cp = function(src, dest, options) {\n if (!options)\n return fs.cp(src, dest);\n if (typeof options !== \"object\")\n @throwTypeError(\"options must be an object\");\n if (options.dereference || options.filter || options.preserveTimestamps || options.verbatimSymlinks) {\n if (!lazy_cp)\n lazy_cp = @getInternalField(@internalModuleRegistry, 3) || @createInternalModuleById(3);\n return lazy_cp(src, dest, options);\n }\n return fs.cp(src, dest, options.recursive, options.errorOnExist, options.force \?\? !0, options.mode);\n};\nasync function opendir(dir) {\n const entries = await fs.readdir(dir, { withFileTypes: !0 });\n return new Dir(entries);\n}\nvar $, constants = @processBindingConstants.fs, fs = Bun.fs();\nvar lazy_cp = null;\n\nclass Dir {\n #entries;\n constructor(e) {\n this.#entries = e;\n }\n readSync() {\n return this.#entries.shift() \?\? null;\n }\n read(c) {\n if (c)\n process.nextTick(c, null, this.readSync());\n return @Promise.resolve(this.readSync());\n }\n closeSync() {\n }\n close(c) {\n if (c)\n process.nextTick(c);\n return @Promise.resolve();\n }\n *[Symbol.asyncIterator]() {\n var next;\n while (next = this.readSync())\n yield next;\n }\n}\n$ = {\n access: fs.access.bind(fs),\n appendFile: fs.appendFile.bind(fs),\n close: fs.close.bind(fs),\n copyFile: fs.copyFile.bind(fs),\n cp,\n exists: fs.exists.bind(fs),\n chown: fs.chown.bind(fs),\n chmod: fs.chmod.bind(fs),\n fchmod: fs.fchmod.bind(fs),\n fchown: fs.fchown.bind(fs),\n fstat: fs.fstat.bind(fs),\n fsync: fs.fsync.bind(fs),\n ftruncate: fs.ftruncate.bind(fs),\n futimes: fs.futimes.bind(fs),\n lchmod: fs.lchmod.bind(fs),\n lchown: fs.lchown.bind(fs),\n link: fs.link.bind(fs),\n lstat: fs.lstat.bind(fs),\n mkdir: fs.mkdir.bind(fs),\n mkdtemp: fs.mkdtemp.bind(fs),\n open: fs.open.bind(fs),\n read: fs.read.bind(fs),\n write: fs.write.bind(fs),\n readdir: fs.readdir.bind(fs),\n readFile: fs.readFile.bind(fs),\n writeFile: fs.writeFile.bind(fs),\n readlink: fs.readlink.bind(fs),\n realpath: fs.realpath.bind(fs),\n rename: fs.rename.bind(fs),\n stat: fs.stat.bind(fs),\n symlink: fs.symlink.bind(fs),\n truncate: fs.truncate.bind(fs),\n unlink: fs.unlink.bind(fs),\n utimes: fs.utimes.bind(fs),\n lutimes: fs.lutimes.bind(fs),\n rm: fs.rm.bind(fs),\n rmdir: fs.rmdir.bind(fs),\n writev: async (fd, buffers, position) => {\n var bytesWritten = await fs.writev(fd, buffers, position);\n return {\n bytesWritten,\n buffers\n };\n },\n readv: async (fd, buffers, position) => {\n var bytesRead = await fs.readv(fd, buffers, position);\n return {\n bytesRead,\n buffers\n };\n },\n constants,\n watch,\n opendir\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeHttpCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/http.ts\nvar checkInvalidHeaderChar = function(val) {\n return RegExpPrototypeExec.@call(headerCharRegex, val) !== null;\n};\nvar isValidTLSArray = function(obj) {\n if (typeof obj === \"string\" || isTypedArray(obj) || obj instanceof @ArrayBuffer || obj instanceof Blob)\n return !0;\n if (@Array.isArray(obj)) {\n for (var i = 0;i < obj.length; i++)\n if (typeof obj !== \"string\" && !isTypedArray(obj) && !(obj instanceof @ArrayBuffer) && !(obj instanceof Blob))\n return !1;\n return !0;\n }\n}, validateMsecs = function(numberlike, field) {\n if (typeof numberlike !== \"number\" || numberlike < 0)\n throw new ERR_INVALID_ARG_TYPE(field, \"number\", numberlike);\n return numberlike;\n}, validateFunction = function(callable, field) {\n if (typeof callable !== \"function\")\n throw new ERR_INVALID_ARG_TYPE(field, \"Function\", callable);\n return callable;\n}, createServer = function(options, callback) {\n return new Server(options, callback);\n}, emitListeningNextTick = function(self, onListen, err, hostname, port) {\n if (typeof onListen === \"function\")\n try {\n onListen(err, hostname, port);\n } catch (err2) {\n self.emit(\"error\", err2);\n }\n if (self.listening = !err, err)\n self.emit(\"error\", err);\n else\n self.emit(\"listening\", hostname, port);\n}, assignHeaders = function(object, req) {\n var headers = req.headers.toJSON();\n const rawHeaders = @newArrayWithSize(req.headers.count * 2);\n var i = 0;\n for (let key in headers)\n rawHeaders[i++] = key, rawHeaders[i++] = headers[key];\n object.headers = headers, object.rawHeaders = rawHeaders;\n}, destroyBodyStreamNT = function(bodyStream) {\n bodyStream.destroy();\n}, getDefaultHTTPSAgent = function() {\n return _defaultHTTPSAgent \?\?= new Agent({ defaultPort: 443, protocol: \"https:\" });\n};\nvar urlToHttpOptions = function(url) {\n var { protocol, hostname, hash, search, pathname, href, port, username, password } = url;\n return {\n protocol,\n hostname: typeof hostname === \"string\" && StringPrototypeStartsWith.@call(hostname, \"[\") \? StringPrototypeSlice.@call(hostname, 1, -1) : hostname,\n hash,\n search,\n pathname,\n path: `${pathname || \"\"}${search || \"\"}`,\n href,\n port: port \? Number(port) : protocol === \"https:\" \? 443 : protocol === \"http:\" \? 80 : @undefined,\n auth: username || password \? `${decodeURIComponent(username)}:${decodeURIComponent(password)}` : @undefined\n };\n}, validateHost = function(host, name) {\n if (host !== null && host !== @undefined && typeof host !== \"string\")\n throw new Error(\"Invalid arg type in options\");\n return host;\n}, checkIsHttpToken = function(val) {\n return RegExpPrototypeExec.@call(tokenRegExp, val) !== null;\n};\nvar _writeHead = function(statusCode, reason, obj, response) {\n if (statusCode |= 0, statusCode < 100 || statusCode > 999)\n throw new Error(\"status code must be between 100 and 999\");\n if (typeof reason === \"string\")\n response.statusMessage = reason;\n else {\n if (!response.statusMessage)\n response.statusMessage = STATUS_CODES[statusCode] || \"unknown\";\n obj = reason;\n }\n response.statusCode = statusCode;\n {\n let k;\n if (@Array.isArray(obj)) {\n if (obj.length % 2 !== 0)\n throw new Error(\"raw headers must have an even number of elements\");\n for (let n = 0;n < obj.length; n += 2)\n if (k = obj[n + 0], k)\n response.setHeader(k, obj[n + 1]);\n } else if (obj) {\n const keys = Object.keys(obj);\n for (let i = 0;i < keys.length; i++)\n if (k = keys[i], k)\n response.setHeader(k, obj[k]);\n }\n }\n if (statusCode === 204 || statusCode === 304 || statusCode >= 100 && statusCode <= 199)\n response._hasBody = !1;\n}, request = function(url, options, cb) {\n return new ClientRequest(url, options, cb);\n}, get = function(url, options, cb) {\n const req = request(url, options, cb);\n return req.end(), req;\n}, $, EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20), { isTypedArray } = @requireNativeModule(\"util/types\"), { Duplex, Readable, Writable } = @getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39), { getHeader, setHeader } = @lazy(\"http\"), headerCharRegex = /[^\\t\\x20-\\x7e\\x80-\\xff]/, validateHeaderName = (name, label) => {\n if (typeof name !== \"string\" || !name || !checkIsHttpToken(name))\n throw new Error(\"ERR_INVALID_HTTP_TOKEN\");\n}, validateHeaderValue = (name, value) => {\n if (value === @undefined)\n throw new Error(\"ERR_HTTP_INVALID_HEADER_VALUE\");\n if (checkInvalidHeaderChar(value))\n throw new Error(\"ERR_INVALID_CHAR\");\n}, { URL } = globalThis, globalReportError = globalThis.reportError, setTimeout = globalThis.setTimeout, fetch = Bun.fetch;\nvar kEmptyObject = Object.freeze(Object.create(null)), kOutHeaders = Symbol.for(\"kOutHeaders\"), kEndCalled = Symbol.for(\"kEndCalled\"), kAbortController = Symbol.for(\"kAbortController\"), kClearTimeout = Symbol(\"kClearTimeout\"), kCorked = Symbol.for(\"kCorked\"), searchParamsSymbol = Symbol.for(\"query\"), StringPrototypeSlice = @String.prototype.slice, StringPrototypeStartsWith = @String.prototype.startsWith, StringPrototypeToUpperCase = @String.prototype.toUpperCase, ArrayIsArray = @Array.isArray, RegExpPrototypeExec = @RegExp.prototype.exec, ObjectAssign = Object.assign, INVALID_PATH_REGEX = /[^\\u0021-\\u00ff]/;\nvar _defaultHTTPSAgent, kInternalRequest = Symbol(\"kInternalRequest\"), kInternalSocketData = Symbol.for(\"::bunternal::\"), kEmptyBuffer = @Buffer.alloc(0);\n\nclass ERR_INVALID_ARG_TYPE extends TypeError {\n constructor(name, expected, actual) {\n super(`The ${name} argument must be of type ${expected}. Received type ${typeof actual}`);\n this.code = \"ERR_INVALID_ARG_TYPE\";\n }\n}\nvar FakeSocket = class Socket extends Duplex {\n [kInternalSocketData];\n bytesRead = 0;\n bytesWritten = 0;\n connecting = !1;\n timeout = 0;\n isServer = !1;\n #address;\n address() {\n var internalData;\n return this.#address \?\?= (internalData = this[kInternalSocketData])\?.[0]\?.requestIP(internalData[2]) \?\? {};\n }\n get bufferSize() {\n return this.writableLength;\n }\n connect(port, host, connectListener) {\n return this;\n }\n _destroy(err, callback) {\n }\n _final(callback) {\n }\n get localAddress() {\n return \"127.0.0.1\";\n }\n get localFamily() {\n return \"IPv4\";\n }\n get localPort() {\n return 80;\n }\n get pending() {\n return this.connecting;\n }\n _read(size) {\n }\n get readyState() {\n if (this.connecting)\n return \"opening\";\n if (this.readable)\n return this.writable \? \"open\" : \"readOnly\";\n else\n return this.writable \? \"writeOnly\" : \"closed\";\n }\n ref() {\n }\n get remoteAddress() {\n return this.address()\?.address;\n }\n set remoteAddress(val) {\n this.address().address = val;\n }\n get remotePort() {\n return this.address()\?.port;\n }\n set remotePort(val) {\n this.address().port = val;\n }\n get remoteFamily() {\n return this.address()\?.family;\n }\n set remoteFamily(val) {\n this.address().family = val;\n }\n resetAndDestroy() {\n }\n setKeepAlive(enable = !1, initialDelay = 0) {\n }\n setNoDelay(noDelay = !0) {\n return this;\n }\n setTimeout(timeout, callback) {\n return this;\n }\n unref() {\n }\n _write(chunk, encoding, callback) {\n }\n};\n\nclass Agent extends EventEmitter {\n defaultPort = 80;\n protocol = \"http:\";\n options;\n requests;\n sockets;\n freeSockets;\n keepAliveMsecs;\n keepAlive;\n maxSockets;\n maxFreeSockets;\n scheduling;\n maxTotalSockets;\n totalSocketCount;\n #fakeSocket;\n static get globalAgent() {\n return globalAgent;\n }\n static get defaultMaxSockets() {\n return @Infinity;\n }\n constructor(options = kEmptyObject) {\n super();\n if (this.options = options = { ...options, path: null }, options.noDelay === @undefined)\n options.noDelay = !0;\n this.requests = kEmptyObject, this.sockets = kEmptyObject, this.freeSockets = kEmptyObject, this.keepAliveMsecs = options.keepAliveMsecs || 1000, this.keepAlive = options.keepAlive || !1, this.maxSockets = options.maxSockets || Agent.defaultMaxSockets, this.maxFreeSockets = options.maxFreeSockets || 256, this.scheduling = options.scheduling || \"lifo\", this.maxTotalSockets = options.maxTotalSockets, this.totalSocketCount = 0, this.defaultPort = options.defaultPort || 80, this.protocol = options.protocol || \"http:\";\n }\n createConnection() {\n return this.#fakeSocket \?\?= new FakeSocket;\n }\n getName(options = kEmptyObject) {\n let name = `http:${options.host || \"localhost\"}:`;\n if (options.port)\n name += options.port;\n if (name += \":\", options.localAddress)\n name += options.localAddress;\n if (options.family === 4 || options.family === 6)\n name += `:${options.family}`;\n if (options.socketPath)\n name += `:${options.socketPath}`;\n return name;\n }\n addRequest() {\n }\n createSocket(req, options, cb) {\n cb(null, this.#fakeSocket \?\?= new FakeSocket);\n }\n removeSocket() {\n }\n keepSocketAlive() {\n return !0;\n }\n reuseSocket() {\n }\n destroy() {\n }\n}\n\nclass Server extends EventEmitter {\n #server;\n #options;\n #tls;\n #is_tls = !1;\n listening = !1;\n serverName;\n constructor(options, callback) {\n super();\n if (typeof options === \"function\")\n callback = options, options = {};\n else if (options == null || typeof options === \"object\") {\n options = { ...options }, this.#tls = null;\n let key = options.key;\n if (key) {\n if (!isValidTLSArray(key))\n @throwTypeError(\"key argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");\n this.#is_tls = !0;\n }\n let cert = options.cert;\n if (cert) {\n if (!isValidTLSArray(cert))\n @throwTypeError(\"cert argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");\n this.#is_tls = !0;\n }\n let ca = options.ca;\n if (ca) {\n if (!isValidTLSArray(ca))\n @throwTypeError(\"ca argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");\n this.#is_tls = !0;\n }\n let passphrase = options.passphrase;\n if (passphrase && typeof passphrase !== \"string\")\n @throwTypeError(\"passphrase argument must be an string\");\n let serverName = options.servername;\n if (serverName && typeof serverName !== \"string\")\n @throwTypeError(\"servername argument must be an string\");\n let secureOptions = options.secureOptions || 0;\n if (secureOptions && typeof secureOptions !== \"number\")\n @throwTypeError(\"secureOptions argument must be an number\");\n if (this.#is_tls)\n this.#tls = {\n serverName,\n key,\n cert,\n ca,\n passphrase,\n secureOptions\n };\n else\n this.#tls = null;\n } else\n throw new Error(\"bun-http-polyfill: invalid arguments\");\n if (this.#options = options, callback)\n this.on(\"request\", callback);\n }\n closeAllConnections() {\n const server = this.#server;\n if (!server)\n return;\n this.#server = @undefined, server.stop(!0), this.emit(\"close\");\n }\n closeIdleConnections() {\n }\n close(optionalCallback) {\n const server = this.#server;\n if (!server) {\n if (typeof optionalCallback === \"function\")\n process.nextTick(optionalCallback, new Error(\"Server is not running\"));\n return;\n }\n if (this.#server = @undefined, typeof optionalCallback === \"function\")\n this.once(\"close\", optionalCallback);\n server.stop(), this.emit(\"close\");\n }\n address() {\n if (!this.#server)\n return null;\n return this.#server.address;\n }\n listen(port, host, backlog, onListen) {\n const server = this;\n let socketPath;\n if (typeof port == \"string\" && !Number.isSafeInteger(Number(port)))\n socketPath = port;\n if (typeof host === \"function\")\n onListen = host, host = @undefined;\n if (typeof port === \"function\")\n onListen = port;\n else if (typeof port === \"object\") {\n if (port\?.signal\?.addEventListener(\"abort\", () => {\n this.close();\n }), host = port\?.host, port = port\?.port, typeof port\?.callback === \"function\")\n onListen = port\?.callback;\n }\n if (typeof backlog === \"function\")\n onListen = backlog;\n const ResponseClass = this.#options.ServerResponse || ServerResponse, RequestClass = this.#options.IncomingMessage || IncomingMessage;\n try {\n const tls = this.#tls;\n if (tls)\n this.serverName = tls.serverName || host || \"localhost\";\n this.#server = Bun.serve({\n tls,\n port,\n hostname: host,\n unix: socketPath,\n websocket: {\n open(ws) {\n ws.data.open(ws);\n },\n message(ws, message) {\n ws.data.message(ws, message);\n },\n close(ws, code, reason) {\n ws.data.close(ws, code, reason);\n },\n drain(ws) {\n ws.data.drain(ws);\n }\n },\n fetch(req, _server) {\n var pendingResponse, pendingError, rejectFunction, resolveFunction, reject = (err) => {\n if (pendingError)\n return;\n if (pendingError = err, rejectFunction)\n rejectFunction(err);\n }, reply = function(resp) {\n if (pendingResponse)\n return;\n if (pendingResponse = resp, resolveFunction)\n resolveFunction(resp);\n };\n const http_req = new RequestClass(req), http_res = new ResponseClass({ reply, req: http_req });\n if (http_req.socket[kInternalSocketData] = [_server, http_res, req], http_req.once(\"error\", (err) => reject(err)), http_res.once(\"error\", (err) => reject(err)), req.headers.get(\"upgrade\"))\n server.emit(\"upgrade\", http_req, http_req.socket, kEmptyBuffer);\n else\n server.emit(\"request\", http_req, http_res);\n if (pendingError)\n throw pendingError;\n if (pendingResponse)\n return pendingResponse;\n return new @Promise((resolve, reject2) => {\n resolveFunction = resolve, rejectFunction = reject2;\n });\n }\n }), setTimeout(emitListeningNextTick, 1, this, onListen, null, this.#server.hostname, this.#server.port);\n } catch (err) {\n server.emit(\"error\", err);\n }\n return this;\n }\n setTimeout(msecs, callback) {\n }\n}\nclass IncomingMessage extends Readable {\n method;\n complete;\n constructor(req, defaultIncomingOpts) {\n const method = req.method;\n super();\n const url = new URL(req.url);\n var { type = \"request\", [kInternalRequest]: nodeReq } = defaultIncomingOpts || {};\n this.#noBody = type === \"request\" \? method === \"GET\" || method === \"HEAD\" || method === \"TRACE\" || method === \"CONNECT\" || method === \"OPTIONS\" || (parseInt(req.headers.get(\"Content-Length\") || \"\") || 0) === 0 : !1, this.#req = req, this.method = method, this.#type = type, this.complete = !!this.#noBody, this.#bodyStream = @undefined;\n const socket = new FakeSocket;\n if (url.protocol === \"https:\")\n socket.encrypted = !0;\n this.#fakeSocket = socket, this.url = url.pathname + url.search, this.req = nodeReq, assignHeaders(this, req);\n }\n headers;\n rawHeaders;\n _consuming = !1;\n _dumped = !1;\n #bodyStream;\n #fakeSocket;\n #noBody = !1;\n #aborted = !1;\n #req;\n url;\n #type;\n _construct(callback) {\n if (this.#type === \"response\" || this.#noBody) {\n callback();\n return;\n }\n const contentLength = this.#req.headers.get(\"content-length\");\n if ((contentLength \? parseInt(contentLength, 10) : 0) === 0) {\n this.#noBody = !0, callback();\n return;\n }\n callback();\n }\n async#consumeStream(reader) {\n while (!0) {\n var { done, value } = await reader.readMany();\n if (this.#aborted)\n return;\n if (done) {\n this.push(null), process.nextTick(destroyBodyStreamNT, this);\n break;\n }\n for (var v of value)\n this.push(v);\n }\n }\n _read(size) {\n if (this.#noBody)\n this.push(null), this.complete = !0;\n else if (this.#bodyStream == null) {\n const reader = this.#req.body\?.getReader();\n if (!reader) {\n this.push(null);\n return;\n }\n this.#bodyStream = reader, this.#consumeStream(reader);\n }\n }\n get aborted() {\n return this.#aborted;\n }\n #abort() {\n if (this.#aborted)\n return;\n this.#aborted = !0;\n var bodyStream = this.#bodyStream;\n if (!bodyStream)\n return;\n bodyStream.cancel(), this.complete = !0, this.#bodyStream = @undefined, this.push(null);\n }\n get connection() {\n return this.#fakeSocket;\n }\n get statusCode() {\n return this.#req.status;\n }\n get statusMessage() {\n return STATUS_CODES[this.#req.status];\n }\n get httpVersion() {\n return \"1.1\";\n }\n get rawTrailers() {\n return [];\n }\n get httpVersionMajor() {\n return 1;\n }\n get httpVersionMinor() {\n return 1;\n }\n get trailers() {\n return kEmptyObject;\n }\n get socket() {\n return this.#fakeSocket \?\?= new FakeSocket;\n }\n set socket(val) {\n this.#fakeSocket = val;\n }\n setTimeout(msecs, callback) {\n throw new Error(\"not implemented\");\n }\n}\n\nclass OutgoingMessage extends Writable {\n constructor() {\n super(...arguments);\n }\n #headers;\n headersSent = !1;\n sendDate = !0;\n req;\n timeout;\n #finished = !1;\n [kEndCalled] = !1;\n #fakeSocket;\n #timeoutTimer;\n [kAbortController] = null;\n _implicitHeader() {\n }\n get headers() {\n if (!this.#headers)\n return kEmptyObject;\n return this.#headers.toJSON();\n }\n get shouldKeepAlive() {\n return !0;\n }\n get chunkedEncoding() {\n return !1;\n }\n set chunkedEncoding(value) {\n }\n set shouldKeepAlive(value) {\n }\n get useChunkedEncodingByDefault() {\n return !0;\n }\n set useChunkedEncodingByDefault(value) {\n }\n get socket() {\n return this.#fakeSocket \?\?= new FakeSocket;\n }\n set socket(val) {\n this.#fakeSocket = val;\n }\n get connection() {\n return this.socket;\n }\n get finished() {\n return this.#finished;\n }\n appendHeader(name, value) {\n var headers = this.#headers \?\?= new Headers;\n headers.append(name, value);\n }\n flushHeaders() {\n }\n getHeader(name) {\n return getHeader(this.#headers, name);\n }\n getHeaders() {\n if (!this.#headers)\n return kEmptyObject;\n return this.#headers.toJSON();\n }\n getHeaderNames() {\n var headers = this.#headers;\n if (!headers)\n return [];\n return @Array.from(headers.keys());\n }\n removeHeader(name) {\n if (!this.#headers)\n return;\n this.#headers.delete(name);\n }\n setHeader(name, value) {\n var headers = this.#headers \?\?= new Headers;\n return headers.set(name, value), this;\n }\n hasHeader(name) {\n if (!this.#headers)\n return !1;\n return this.#headers.has(name);\n }\n addTrailers(headers) {\n throw new Error(\"not implemented\");\n }\n [kClearTimeout]() {\n if (this.#timeoutTimer)\n clearTimeout(this.#timeoutTimer), this.removeAllListeners(\"timeout\"), this.#timeoutTimer = @undefined;\n }\n #onTimeout() {\n this.#timeoutTimer = @undefined, this[kAbortController]\?.abort(), this.emit(\"timeout\");\n }\n setTimeout(msecs, callback) {\n if (this.destroyed)\n return this;\n if (this.timeout = msecs = validateMsecs(msecs, \"msecs\"), clearTimeout(this.#timeoutTimer), msecs === 0) {\n if (callback !== @undefined)\n validateFunction(callback, \"callback\"), this.removeListener(\"timeout\", callback);\n this.#timeoutTimer = @undefined;\n } else if (this.#timeoutTimer = setTimeout(this.#onTimeout.bind(this), msecs).unref(), callback !== @undefined)\n validateFunction(callback, \"callback\"), this.once(\"timeout\", callback);\n return this;\n }\n}\nvar OriginalWriteHeadFn, OriginalImplicitHeadFn;\n\nclass ServerResponse extends Writable {\n constructor(c) {\n super();\n if (!c)\n c = {};\n var req = c.req || {}, reply = c.reply;\n if (this.req = req, this._reply = reply, this.sendDate = !0, this.statusCode = 200, this.headersSent = !1, this.statusMessage = @undefined, this.#controller = @undefined, this.#firstWrite = @undefined, this._writableState.decodeStrings = !1, this.#deferred = @undefined, req.method === \"HEAD\")\n this._hasBody = !1;\n }\n req;\n _reply;\n sendDate;\n statusCode;\n #headers;\n headersSent = !1;\n statusMessage;\n #controller;\n #firstWrite;\n _sent100 = !1;\n _defaultKeepAlive = !1;\n _removedConnection = !1;\n _removedContLen = !1;\n _hasBody = !0;\n #deferred = @undefined;\n #finished = !1;\n _implicitHeader() {\n this.writeHead(this.statusCode);\n }\n _write(chunk, encoding, callback) {\n if (!this.#firstWrite && !this.headersSent) {\n this.#firstWrite = chunk, callback();\n return;\n }\n this.#ensureReadableStreamController((controller) => {\n controller.write(chunk), callback();\n });\n }\n _writev(chunks, callback) {\n if (chunks.length === 1 && !this.headersSent && !this.#firstWrite) {\n this.#firstWrite = chunks[0].chunk, callback();\n return;\n }\n this.#ensureReadableStreamController((controller) => {\n for (let chunk of chunks)\n controller.write(chunk.chunk);\n callback();\n });\n }\n #ensureReadableStreamController(run) {\n var thisController = this.#controller;\n if (thisController)\n return run(thisController);\n this.headersSent = !0;\n var firstWrite = this.#firstWrite;\n this.#firstWrite = @undefined, this._reply(new Response(new @ReadableStream({\n type: \"direct\",\n pull: (controller) => {\n if (this.#controller = controller, firstWrite)\n controller.write(firstWrite);\n if (firstWrite = @undefined, run(controller), !this.#finished)\n return new @Promise((resolve) => {\n this.#deferred = resolve;\n });\n }\n }), {\n headers: this.#headers,\n status: this.statusCode,\n statusText: this.statusMessage \?\? STATUS_CODES[this.statusCode]\n }));\n }\n #drainHeadersIfObservable() {\n if (this._implicitHeader === OriginalImplicitHeadFn && this.writeHead === OriginalWriteHeadFn)\n return;\n this._implicitHeader();\n }\n _final(callback) {\n if (!this.headersSent) {\n var data = this.#firstWrite || \"\";\n this.#firstWrite = @undefined, this.#finished = !0, this.#drainHeadersIfObservable(), this._reply(new Response(data, {\n headers: this.#headers,\n status: this.statusCode,\n statusText: this.statusMessage \?\? STATUS_CODES[this.statusCode]\n })), callback && callback();\n return;\n }\n this.#finished = !0, this.#ensureReadableStreamController((controller) => {\n controller.end(), callback();\n var deferred = this.#deferred;\n if (deferred)\n this.#deferred = @undefined, deferred();\n });\n }\n writeProcessing() {\n throw new Error(\"not implemented\");\n }\n addTrailers(headers) {\n throw new Error(\"not implemented\");\n }\n assignSocket(socket) {\n throw new Error(\"not implemented\");\n }\n detachSocket(socket) {\n throw new Error(\"not implemented\");\n }\n writeContinue(callback) {\n throw new Error(\"not implemented\");\n }\n setTimeout(msecs, callback) {\n throw new Error(\"not implemented\");\n }\n get shouldKeepAlive() {\n return !0;\n }\n get chunkedEncoding() {\n return !1;\n }\n set chunkedEncoding(value) {\n }\n set shouldKeepAlive(value) {\n }\n get useChunkedEncodingByDefault() {\n return !0;\n }\n set useChunkedEncodingByDefault(value) {\n }\n appendHeader(name, value) {\n var headers = this.#headers \?\?= new Headers;\n headers.append(name, value);\n }\n flushHeaders() {\n }\n getHeader(name) {\n return getHeader(this.#headers, name);\n }\n getHeaders() {\n var headers = this.#headers;\n if (!headers)\n return kEmptyObject;\n return headers.toJSON();\n }\n getHeaderNames() {\n var headers = this.#headers;\n if (!headers)\n return [];\n return @Array.from(headers.keys());\n }\n removeHeader(name) {\n if (!this.#headers)\n return;\n this.#headers.delete(name);\n }\n setHeader(name, value) {\n var headers = this.#headers \?\?= new Headers;\n return setHeader(headers, name, value), this;\n }\n hasHeader(name) {\n if (!this.#headers)\n return !1;\n return this.#headers.has(name);\n }\n writeHead(statusCode, statusMessage, headers) {\n return _writeHead(statusCode, statusMessage, headers, this), this;\n }\n}\nOriginalWriteHeadFn = ServerResponse.prototype.writeHead;\nOriginalImplicitHeadFn = ServerResponse.prototype._implicitHeader;\n\nclass ClientRequest extends OutgoingMessage {\n #timeout;\n #res = null;\n #upgradeOrConnect = !1;\n #parser = null;\n #maxHeadersCount = null;\n #reusedSocket = !1;\n #host;\n #protocol;\n #method;\n #port;\n #useDefaultPort;\n #joinDuplicateHeaders;\n #maxHeaderSize;\n #agent = globalAgent;\n #path;\n #socketPath;\n #bodyChunks = null;\n #fetchRequest;\n #signal = null;\n [kAbortController] = null;\n #timeoutTimer = @undefined;\n #options;\n #finished;\n get path() {\n return this.#path;\n }\n get port() {\n return this.#port;\n }\n get method() {\n return this.#method;\n }\n get host() {\n return this.#host;\n }\n get protocol() {\n return this.#protocol;\n }\n _write(chunk, encoding, callback) {\n if (!this.#bodyChunks) {\n this.#bodyChunks = [chunk], callback();\n return;\n }\n this.#bodyChunks.push(chunk), callback();\n }\n _writev(chunks, callback) {\n if (!this.#bodyChunks) {\n this.#bodyChunks = chunks, callback();\n return;\n }\n this.#bodyChunks.push(...chunks), callback();\n }\n _final(callback) {\n if (this.#finished = !0, this[kAbortController] = new AbortController, this[kAbortController].signal.addEventListener(\"abort\", () => {\n this[kClearTimeout]();\n }), this.#signal\?.aborted)\n this[kAbortController].abort();\n var method = this.#method, body = this.#bodyChunks\?.length === 1 \? this.#bodyChunks[0] : @Buffer.concat(this.#bodyChunks || []);\n let url, proxy;\n if (this.#path.startsWith(\"http://\") || this.#path.startsWith(\"https://\"))\n url = this.#path, proxy = `${this.#protocol}//${this.#host}${this.#useDefaultPort \? \"\" : \":\" + this.#port}`;\n else\n url = `${this.#protocol}//${this.#host}${this.#useDefaultPort \? \"\" : \":\" + this.#port}${this.#path}`;\n try {\n this.#fetchRequest = fetch(url, {\n method,\n headers: this.getHeaders(),\n body: body && method !== \"GET\" && method !== \"HEAD\" && method !== \"OPTIONS\" \? body : @undefined,\n redirect: \"manual\",\n verbose: !1,\n signal: this[kAbortController].signal,\n proxy,\n timeout: !1,\n decompress: !1\n }).then((response) => {\n var res = this.#res = new IncomingMessage(response, {\n type: \"response\",\n [kInternalRequest]: this\n });\n this.emit(\"response\", res);\n }).catch((err) => {\n this.emit(\"error\", err);\n }).finally(() => {\n this.#fetchRequest = null, this[kClearTimeout]();\n });\n } catch (err) {\n this.emit(\"error\", err);\n } finally {\n callback();\n }\n }\n get aborted() {\n return this.#signal\?.aborted || !!this[kAbortController]\?.signal.aborted;\n }\n abort() {\n if (this.aborted)\n return;\n this[kAbortController].abort();\n }\n constructor(input, options, cb) {\n super();\n if (typeof input === \"string\") {\n const urlStr = input;\n try {\n var urlObject = new URL(urlStr);\n } catch (e) {\n @throwTypeError(`Invalid URL: ${urlStr}`);\n }\n input = urlToHttpOptions(urlObject);\n } else if (input && typeof input === \"object\" && input instanceof URL)\n input = urlToHttpOptions(input);\n else\n cb = options, options = input, input = null;\n if (typeof options === \"function\")\n cb = options, options = input || kEmptyObject;\n else\n options = ObjectAssign(input || {}, options);\n var defaultAgent = options._defaultAgent || Agent.globalAgent;\n let protocol = options.protocol;\n if (!protocol)\n if (options.port === 443)\n protocol = \"https:\";\n else\n protocol = defaultAgent.protocol || \"http:\";\n switch (this.#protocol = protocol, this.#agent\?.protocol) {\n case @undefined:\n break;\n case \"http:\":\n if (protocol === \"https:\") {\n defaultAgent = this.#agent = getDefaultHTTPSAgent();\n break;\n }\n case \"https:\":\n if (protocol === \"https\") {\n defaultAgent = this.#agent = Agent.globalAgent;\n break;\n }\n default:\n break;\n }\n if (options.path) {\n const path = @String(options.path);\n if (RegExpPrototypeExec.@call(INVALID_PATH_REGEX, path) !== null)\n throw new Error(\"Path contains unescaped characters\");\n }\n if (protocol !== \"http:\" && protocol !== \"https:\" && protocol) {\n const expectedProtocol = defaultAgent\?.protocol \?\? \"http:\";\n throw new Error(`Protocol mismatch. Expected: ${expectedProtocol}. Got: ${protocol}`);\n }\n const defaultPort = protocol === \"https:\" \? 443 : 80;\n this.#port = options.port || options.defaultPort || this.#agent\?.defaultPort || defaultPort, this.#useDefaultPort = this.#port === defaultPort;\n const host = this.#host = options.host = validateHost(options.hostname, \"hostname\") || validateHost(options.host, \"host\") || \"localhost\";\n this.#socketPath = options.socketPath;\n const signal = options.signal;\n if (signal)\n signal.addEventListener(\"abort\", () => {\n this[kAbortController]\?.abort();\n }), this.#signal = signal;\n let method = options.method;\n const methodIsString = typeof method === \"string\";\n if (method !== null && method !== @undefined && !methodIsString)\n throw new Error(\"ERR_INVALID_ARG_TYPE: options.method\");\n if (methodIsString && method) {\n if (!checkIsHttpToken(method))\n throw new Error(\"ERR_INVALID_HTTP_TOKEN: Method\");\n method = this.#method = StringPrototypeToUpperCase.@call(method);\n } else\n method = this.#method = \"GET\";\n const _maxHeaderSize = options.maxHeaderSize;\n this.#maxHeaderSize = _maxHeaderSize;\n var _joinDuplicateHeaders = options.joinDuplicateHeaders;\n if (this.#joinDuplicateHeaders = _joinDuplicateHeaders, this.#path = options.path || \"/\", cb)\n this.once(\"response\", cb);\n this.#finished = !1, this.#res = null, this.#upgradeOrConnect = !1, this.#parser = null, this.#maxHeadersCount = null, this.#reusedSocket = !1, this.#host = host, this.#protocol = protocol;\n var timeout = options.timeout;\n if (timeout !== @undefined && timeout !== 0)\n this.setTimeout(timeout, @undefined);\n if (!ArrayIsArray(headers)) {\n var headers = options.headers;\n if (headers)\n for (let key in headers)\n this.setHeader(key, headers[key]);\n var auth = options.auth;\n if (auth && !this.getHeader(\"Authorization\"))\n this.setHeader(\"Authorization\", \"Basic \" + @Buffer.from(auth).toString(\"base64\"));\n }\n var { signal: _signal, ...optsWithoutSignal } = options;\n this.#options = optsWithoutSignal;\n }\n setSocketKeepAlive(enable = !0, initialDelay = 0) {\n }\n setNoDelay(noDelay = !0) {\n }\n [kClearTimeout]() {\n if (this.#timeoutTimer)\n clearTimeout(this.#timeoutTimer), this.#timeoutTimer = @undefined, this.removeAllListeners(\"timeout\");\n }\n #onTimeout() {\n this.#timeoutTimer = @undefined, this[kAbortController]\?.abort(), this.emit(\"timeout\");\n }\n setTimeout(msecs, callback) {\n if (this.destroyed)\n return this;\n if (this.timeout = msecs = validateMsecs(msecs, \"msecs\"), clearTimeout(this.#timeoutTimer), msecs === 0) {\n if (callback !== @undefined)\n validateFunction(callback, \"callback\"), this.removeListener(\"timeout\", callback);\n this.#timeoutTimer = @undefined;\n } else if (this.#timeoutTimer = setTimeout(this.#onTimeout.bind(this), msecs).unref(), callback !== @undefined)\n validateFunction(callback, \"callback\"), this.once(\"timeout\", callback);\n return this;\n }\n}\nvar tokenRegExp = /^[\\^_`a-zA-Z\\-0-9!#$%&'*+.|~]+$/, METHODS = [\n \"ACL\",\n \"BIND\",\n \"CHECKOUT\",\n \"CONNECT\",\n \"COPY\",\n \"DELETE\",\n \"GET\",\n \"HEAD\",\n \"LINK\",\n \"LOCK\",\n \"M-SEARCH\",\n \"MERGE\",\n \"MKACTIVITY\",\n \"MKCALENDAR\",\n \"MKCOL\",\n \"MOVE\",\n \"NOTIFY\",\n \"OPTIONS\",\n \"PATCH\",\n \"POST\",\n \"PROPFIND\",\n \"PROPPATCH\",\n \"PURGE\",\n \"PUT\",\n \"REBIND\",\n \"REPORT\",\n \"SEARCH\",\n \"SOURCE\",\n \"SUBSCRIBE\",\n \"TRACE\",\n \"UNBIND\",\n \"UNLINK\",\n \"UNLOCK\",\n \"UNSUBSCRIBE\"\n], STATUS_CODES = {\n 100: \"Continue\",\n 101: \"Switching Protocols\",\n 102: \"Processing\",\n 103: \"Early Hints\",\n 200: \"OK\",\n 201: \"Created\",\n 202: \"Accepted\",\n 203: \"Non-Authoritative Information\",\n 204: \"No Content\",\n 205: \"Reset Content\",\n 206: \"Partial Content\",\n 207: \"Multi-Status\",\n 208: \"Already Reported\",\n 226: \"IM Used\",\n 300: \"Multiple Choices\",\n 301: \"Moved Permanently\",\n 302: \"Found\",\n 303: \"See Other\",\n 304: \"Not Modified\",\n 305: \"Use Proxy\",\n 307: \"Temporary Redirect\",\n 308: \"Permanent Redirect\",\n 400: \"Bad Request\",\n 401: \"Unauthorized\",\n 402: \"Payment Required\",\n 403: \"Forbidden\",\n 404: \"Not Found\",\n 405: \"Method Not Allowed\",\n 406: \"Not Acceptable\",\n 407: \"Proxy Authentication Required\",\n 408: \"Request Timeout\",\n 409: \"Conflict\",\n 410: \"Gone\",\n 411: \"Length Required\",\n 412: \"Precondition Failed\",\n 413: \"Payload Too Large\",\n 414: \"URI Too Long\",\n 415: \"Unsupported Media Type\",\n 416: \"Range Not Satisfiable\",\n 417: \"Expectation Failed\",\n 418: \"I'm a Teapot\",\n 421: \"Misdirected Request\",\n 422: \"Unprocessable Entity\",\n 423: \"Locked\",\n 424: \"Failed Dependency\",\n 425: \"Too Early\",\n 426: \"Upgrade Required\",\n 428: \"Precondition Required\",\n 429: \"Too Many Requests\",\n 431: \"Request Header Fields Too Large\",\n 451: \"Unavailable For Legal Reasons\",\n 500: \"Internal Server Error\",\n 501: \"Not Implemented\",\n 502: \"Bad Gateway\",\n 503: \"Service Unavailable\",\n 504: \"Gateway Timeout\",\n 505: \"HTTP Version Not Supported\",\n 506: \"Variant Also Negotiates\",\n 507: \"Insufficient Storage\",\n 508: \"Loop Detected\",\n 509: \"Bandwidth Limit Exceeded\",\n 510: \"Not Extended\",\n 511: \"Network Authentication Required\"\n}, globalAgent = new Agent;\n$ = {\n Agent,\n Server,\n METHODS,\n STATUS_CODES,\n createServer,\n ServerResponse,\n IncomingMessage,\n request,\n get,\n maxHeaderSize: 16384,\n validateHeaderName,\n validateHeaderValue,\n setMaxIdleHTTPParsers(max) {\n },\n globalAgent,\n ClientRequest,\n OutgoingMessage\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeHttp2Code = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/http2.ts\nvar connect = function() {\n throwNotImplemented(\"node:http2 connect\", 887);\n}, createServer = function() {\n throwNotImplemented(\"node:http2 createServer\", 887);\n}, createSecureServer = function() {\n throwNotImplemented(\"node:http2 createSecureServer\", 887);\n}, getDefaultSettings = function() {\n return {\n headerTableSize: 4096,\n enablePush: !0,\n initialWindowSize: 65535,\n maxFrameSize: 16384,\n maxConcurrentStreams: 4294967295,\n maxHeaderSize: 65535,\n maxHeaderListSize: 65535,\n enableConnectProtocol: !1\n };\n}, getPackedSettings = function() {\n return @Buffer.alloc(0);\n}, getUnpackedSettings = function() {\n return @Buffer.alloc(0);\n}, Http2ServerRequest = function() {\n throwNotImplemented(\"node:http2 Http2ServerRequest\", 887);\n}, Http2ServerResponse = function() {\n throwNotImplemented(\"node:http2 Http2ServerResponse\", 887);\n}, $, { hideFromStack, throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6), constants = {\n NGHTTP2_ERR_FRAME_SIZE_ERROR: -522,\n NGHTTP2_SESSION_SERVER: 0,\n NGHTTP2_SESSION_CLIENT: 1,\n NGHTTP2_STREAM_STATE_IDLE: 1,\n NGHTTP2_STREAM_STATE_OPEN: 2,\n NGHTTP2_STREAM_STATE_RESERVED_LOCAL: 3,\n NGHTTP2_STREAM_STATE_RESERVED_REMOTE: 4,\n NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL: 5,\n NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE: 6,\n NGHTTP2_STREAM_STATE_CLOSED: 7,\n NGHTTP2_FLAG_NONE: 0,\n NGHTTP2_FLAG_END_STREAM: 1,\n NGHTTP2_FLAG_END_HEADERS: 4,\n NGHTTP2_FLAG_ACK: 1,\n NGHTTP2_FLAG_PADDED: 8,\n NGHTTP2_FLAG_PRIORITY: 32,\n DEFAULT_SETTINGS_HEADER_TABLE_SIZE: 4096,\n DEFAULT_SETTINGS_ENABLE_PUSH: 1,\n DEFAULT_SETTINGS_MAX_CONCURRENT_STREAMS: 4294967295,\n DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE: 65535,\n DEFAULT_SETTINGS_MAX_FRAME_SIZE: 16384,\n DEFAULT_SETTINGS_MAX_HEADER_LIST_SIZE: 65535,\n DEFAULT_SETTINGS_ENABLE_CONNECT_PROTOCOL: 0,\n MAX_MAX_FRAME_SIZE: 16777215,\n MIN_MAX_FRAME_SIZE: 16384,\n MAX_INITIAL_WINDOW_SIZE: 2147483647,\n NGHTTP2_SETTINGS_HEADER_TABLE_SIZE: 1,\n NGHTTP2_SETTINGS_ENABLE_PUSH: 2,\n NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS: 3,\n NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE: 4,\n NGHTTP2_SETTINGS_MAX_FRAME_SIZE: 5,\n NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: 6,\n NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL: 8,\n PADDING_STRATEGY_NONE: 0,\n PADDING_STRATEGY_ALIGNED: 1,\n PADDING_STRATEGY_MAX: 2,\n PADDING_STRATEGY_CALLBACK: 1,\n NGHTTP2_NO_ERROR: 0,\n NGHTTP2_PROTOCOL_ERROR: 1,\n NGHTTP2_INTERNAL_ERROR: 2,\n NGHTTP2_FLOW_CONTROL_ERROR: 3,\n NGHTTP2_SETTINGS_TIMEOUT: 4,\n NGHTTP2_STREAM_CLOSED: 5,\n NGHTTP2_FRAME_SIZE_ERROR: 6,\n NGHTTP2_REFUSED_STREAM: 7,\n NGHTTP2_CANCEL: 8,\n NGHTTP2_COMPRESSION_ERROR: 9,\n NGHTTP2_CONNECT_ERROR: 10,\n NGHTTP2_ENHANCE_YOUR_CALM: 11,\n NGHTTP2_INADEQUATE_SECURITY: 12,\n NGHTTP2_HTTP_1_1_REQUIRED: 13,\n NGHTTP2_DEFAULT_WEIGHT: 16,\n HTTP2_HEADER_STATUS: \":status\",\n HTTP2_HEADER_METHOD: \":method\",\n HTTP2_HEADER_AUTHORITY: \":authority\",\n HTTP2_HEADER_SCHEME: \":scheme\",\n HTTP2_HEADER_PATH: \":path\",\n HTTP2_HEADER_PROTOCOL: \":protocol\",\n HTTP2_HEADER_ACCEPT_ENCODING: \"accept-encoding\",\n HTTP2_HEADER_ACCEPT_LANGUAGE: \"accept-language\",\n HTTP2_HEADER_ACCEPT_RANGES: \"accept-ranges\",\n HTTP2_HEADER_ACCEPT: \"accept\",\n HTTP2_HEADER_ACCESS_CONTROL_ALLOW_CREDENTIALS: \"access-control-allow-credentials\",\n HTTP2_HEADER_ACCESS_CONTROL_ALLOW_HEADERS: \"access-control-allow-headers\",\n HTTP2_HEADER_ACCESS_CONTROL_ALLOW_METHODS: \"access-control-allow-methods\",\n HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN: \"access-control-allow-origin\",\n HTTP2_HEADER_ACCESS_CONTROL_EXPOSE_HEADERS: \"access-control-expose-headers\",\n HTTP2_HEADER_ACCESS_CONTROL_REQUEST_HEADERS: \"access-control-request-headers\",\n HTTP2_HEADER_ACCESS_CONTROL_REQUEST_METHOD: \"access-control-request-method\",\n HTTP2_HEADER_AGE: \"age\",\n HTTP2_HEADER_AUTHORIZATION: \"authorization\",\n HTTP2_HEADER_CACHE_CONTROL: \"cache-control\",\n HTTP2_HEADER_CONNECTION: \"connection\",\n HTTP2_HEADER_CONTENT_DISPOSITION: \"content-disposition\",\n HTTP2_HEADER_CONTENT_ENCODING: \"content-encoding\",\n HTTP2_HEADER_CONTENT_LENGTH: \"content-length\",\n HTTP2_HEADER_CONTENT_TYPE: \"content-type\",\n HTTP2_HEADER_COOKIE: \"cookie\",\n HTTP2_HEADER_DATE: \"date\",\n HTTP2_HEADER_ETAG: \"etag\",\n HTTP2_HEADER_FORWARDED: \"forwarded\",\n HTTP2_HEADER_HOST: \"host\",\n HTTP2_HEADER_IF_MODIFIED_SINCE: \"if-modified-since\",\n HTTP2_HEADER_IF_NONE_MATCH: \"if-none-match\",\n HTTP2_HEADER_IF_RANGE: \"if-range\",\n HTTP2_HEADER_LAST_MODIFIED: \"last-modified\",\n HTTP2_HEADER_LINK: \"link\",\n HTTP2_HEADER_LOCATION: \"location\",\n HTTP2_HEADER_RANGE: \"range\",\n HTTP2_HEADER_REFERER: \"referer\",\n HTTP2_HEADER_SERVER: \"server\",\n HTTP2_HEADER_SET_COOKIE: \"set-cookie\",\n HTTP2_HEADER_STRICT_TRANSPORT_SECURITY: \"strict-transport-security\",\n HTTP2_HEADER_TRANSFER_ENCODING: \"transfer-encoding\",\n HTTP2_HEADER_TE: \"te\",\n HTTP2_HEADER_UPGRADE_INSECURE_REQUESTS: \"upgrade-insecure-requests\",\n HTTP2_HEADER_UPGRADE: \"upgrade\",\n HTTP2_HEADER_USER_AGENT: \"user-agent\",\n HTTP2_HEADER_VARY: \"vary\",\n HTTP2_HEADER_X_CONTENT_TYPE_OPTIONS: \"x-content-type-options\",\n HTTP2_HEADER_X_FRAME_OPTIONS: \"x-frame-options\",\n HTTP2_HEADER_KEEP_ALIVE: \"keep-alive\",\n HTTP2_HEADER_PROXY_CONNECTION: \"proxy-connection\",\n HTTP2_HEADER_X_XSS_PROTECTION: \"x-xss-protection\",\n HTTP2_HEADER_ALT_SVC: \"alt-svc\",\n HTTP2_HEADER_CONTENT_SECURITY_POLICY: \"content-security-policy\",\n HTTP2_HEADER_EARLY_DATA: \"early-data\",\n HTTP2_HEADER_EXPECT_CT: \"expect-ct\",\n HTTP2_HEADER_ORIGIN: \"origin\",\n HTTP2_HEADER_PURPOSE: \"purpose\",\n HTTP2_HEADER_TIMING_ALLOW_ORIGIN: \"timing-allow-origin\",\n HTTP2_HEADER_X_FORWARDED_FOR: \"x-forwarded-for\",\n HTTP2_HEADER_PRIORITY: \"priority\",\n HTTP2_HEADER_ACCEPT_CHARSET: \"accept-charset\",\n HTTP2_HEADER_ACCESS_CONTROL_MAX_AGE: \"access-control-max-age\",\n HTTP2_HEADER_ALLOW: \"allow\",\n HTTP2_HEADER_CONTENT_LANGUAGE: \"content-language\",\n HTTP2_HEADER_CONTENT_LOCATION: \"content-location\",\n HTTP2_HEADER_CONTENT_MD5: \"content-md5\",\n HTTP2_HEADER_CONTENT_RANGE: \"content-range\",\n HTTP2_HEADER_DNT: \"dnt\",\n HTTP2_HEADER_EXPECT: \"expect\",\n HTTP2_HEADER_EXPIRES: \"expires\",\n HTTP2_HEADER_FROM: \"from\",\n HTTP2_HEADER_IF_MATCH: \"if-match\",\n HTTP2_HEADER_IF_UNMODIFIED_SINCE: \"if-unmodified-since\",\n HTTP2_HEADER_MAX_FORWARDS: \"max-forwards\",\n HTTP2_HEADER_PREFER: \"prefer\",\n HTTP2_HEADER_PROXY_AUTHENTICATE: \"proxy-authenticate\",\n HTTP2_HEADER_PROXY_AUTHORIZATION: \"proxy-authorization\",\n HTTP2_HEADER_REFRESH: \"refresh\",\n HTTP2_HEADER_RETRY_AFTER: \"retry-after\",\n HTTP2_HEADER_TRAILER: \"trailer\",\n HTTP2_HEADER_TK: \"tk\",\n HTTP2_HEADER_VIA: \"via\",\n HTTP2_HEADER_WARNING: \"warning\",\n HTTP2_HEADER_WWW_AUTHENTICATE: \"www-authenticate\",\n HTTP2_HEADER_HTTP2_SETTINGS: \"http2-settings\",\n HTTP2_METHOD_ACL: \"ACL\",\n HTTP2_METHOD_BASELINE_CONTROL: \"BASELINE-CONTROL\",\n HTTP2_METHOD_BIND: \"BIND\",\n HTTP2_METHOD_CHECKIN: \"CHECKIN\",\n HTTP2_METHOD_CHECKOUT: \"CHECKOUT\",\n HTTP2_METHOD_CONNECT: \"CONNECT\",\n HTTP2_METHOD_COPY: \"COPY\",\n HTTP2_METHOD_DELETE: \"DELETE\",\n HTTP2_METHOD_GET: \"GET\",\n HTTP2_METHOD_HEAD: \"HEAD\",\n HTTP2_METHOD_LABEL: \"LABEL\",\n HTTP2_METHOD_LINK: \"LINK\",\n HTTP2_METHOD_LOCK: \"LOCK\",\n HTTP2_METHOD_MERGE: \"MERGE\",\n HTTP2_METHOD_MKACTIVITY: \"MKACTIVITY\",\n HTTP2_METHOD_MKCALENDAR: \"MKCALENDAR\",\n HTTP2_METHOD_MKCOL: \"MKCOL\",\n HTTP2_METHOD_MKREDIRECTREF: \"MKREDIRECTREF\",\n HTTP2_METHOD_MKWORKSPACE: \"MKWORKSPACE\",\n HTTP2_METHOD_MOVE: \"MOVE\",\n HTTP2_METHOD_OPTIONS: \"OPTIONS\",\n HTTP2_METHOD_ORDERPATCH: \"ORDERPATCH\",\n HTTP2_METHOD_PATCH: \"PATCH\",\n HTTP2_METHOD_POST: \"POST\",\n HTTP2_METHOD_PRI: \"PRI\",\n HTTP2_METHOD_PROPFIND: \"PROPFIND\",\n HTTP2_METHOD_PROPPATCH: \"PROPPATCH\",\n HTTP2_METHOD_PUT: \"PUT\",\n HTTP2_METHOD_REBIND: \"REBIND\",\n HTTP2_METHOD_REPORT: \"REPORT\",\n HTTP2_METHOD_SEARCH: \"SEARCH\",\n HTTP2_METHOD_TRACE: \"TRACE\",\n HTTP2_METHOD_UNBIND: \"UNBIND\",\n HTTP2_METHOD_UNCHECKOUT: \"UNCHECKOUT\",\n HTTP2_METHOD_UNLINK: \"UNLINK\",\n HTTP2_METHOD_UNLOCK: \"UNLOCK\",\n HTTP2_METHOD_UPDATE: \"UPDATE\",\n HTTP2_METHOD_UPDATEREDIRECTREF: \"UPDATEREDIRECTREF\",\n HTTP2_METHOD_VERSION_CONTROL: \"VERSION-CONTROL\",\n HTTP_STATUS_CONTINUE: 100,\n HTTP_STATUS_SWITCHING_PROTOCOLS: 101,\n HTTP_STATUS_PROCESSING: 102,\n HTTP_STATUS_EARLY_HINTS: 103,\n HTTP_STATUS_OK: 200,\n HTTP_STATUS_CREATED: 201,\n HTTP_STATUS_ACCEPTED: 202,\n HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION: 203,\n HTTP_STATUS_NO_CONTENT: 204,\n HTTP_STATUS_RESET_CONTENT: 205,\n HTTP_STATUS_PARTIAL_CONTENT: 206,\n HTTP_STATUS_MULTI_STATUS: 207,\n HTTP_STATUS_ALREADY_REPORTED: 208,\n HTTP_STATUS_IM_USED: 226,\n HTTP_STATUS_MULTIPLE_CHOICES: 300,\n HTTP_STATUS_MOVED_PERMANENTLY: 301,\n HTTP_STATUS_FOUND: 302,\n HTTP_STATUS_SEE_OTHER: 303,\n HTTP_STATUS_NOT_MODIFIED: 304,\n HTTP_STATUS_USE_PROXY: 305,\n HTTP_STATUS_TEMPORARY_REDIRECT: 307,\n HTTP_STATUS_PERMANENT_REDIRECT: 308,\n HTTP_STATUS_BAD_REQUEST: 400,\n HTTP_STATUS_UNAUTHORIZED: 401,\n HTTP_STATUS_PAYMENT_REQUIRED: 402,\n HTTP_STATUS_FORBIDDEN: 403,\n HTTP_STATUS_NOT_FOUND: 404,\n HTTP_STATUS_METHOD_NOT_ALLOWED: 405,\n HTTP_STATUS_NOT_ACCEPTABLE: 406,\n HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED: 407,\n HTTP_STATUS_REQUEST_TIMEOUT: 408,\n HTTP_STATUS_CONFLICT: 409,\n HTTP_STATUS_GONE: 410,\n HTTP_STATUS_LENGTH_REQUIRED: 411,\n HTTP_STATUS_PRECONDITION_FAILED: 412,\n HTTP_STATUS_PAYLOAD_TOO_LARGE: 413,\n HTTP_STATUS_URI_TOO_LONG: 414,\n HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE: 415,\n HTTP_STATUS_RANGE_NOT_SATISFIABLE: 416,\n HTTP_STATUS_EXPECTATION_FAILED: 417,\n HTTP_STATUS_TEAPOT: 418,\n HTTP_STATUS_MISDIRECTED_REQUEST: 421,\n HTTP_STATUS_UNPROCESSABLE_ENTITY: 422,\n HTTP_STATUS_LOCKED: 423,\n HTTP_STATUS_FAILED_DEPENDENCY: 424,\n HTTP_STATUS_TOO_EARLY: 425,\n HTTP_STATUS_UPGRADE_REQUIRED: 426,\n HTTP_STATUS_PRECONDITION_REQUIRED: 428,\n HTTP_STATUS_TOO_MANY_REQUESTS: 429,\n HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE: 431,\n HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS: 451,\n HTTP_STATUS_INTERNAL_SERVER_ERROR: 500,\n HTTP_STATUS_NOT_IMPLEMENTED: 501,\n HTTP_STATUS_BAD_GATEWAY: 502,\n HTTP_STATUS_SERVICE_UNAVAILABLE: 503,\n HTTP_STATUS_GATEWAY_TIMEOUT: 504,\n HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED: 505,\n HTTP_STATUS_VARIANT_ALSO_NEGOTIATES: 506,\n HTTP_STATUS_INSUFFICIENT_STORAGE: 507,\n HTTP_STATUS_LOOP_DETECTED: 508,\n HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED: 509,\n HTTP_STATUS_NOT_EXTENDED: 510,\n HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED: 511\n}, sensitiveHeaders = Symbol.for(\"nodejs.http2.sensitiveHeaders\");\nHttp2ServerRequest.prototype = {};\nHttp2ServerResponse.prototype = {};\n$ = {\n constants,\n createServer,\n createSecureServer,\n getDefaultSettings,\n getPackedSettings,\n getUnpackedSettings,\n sensitiveHeaders,\n Http2ServerRequest,\n Http2ServerResponse,\n connect\n};\nhideFromStack([\n Http2ServerRequest,\n Http2ServerResponse,\n connect,\n createServer,\n createSecureServer,\n getDefaultSettings,\n getPackedSettings,\n getUnpackedSettings\n]);\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeHttpsCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/https.ts\nvar request = function(input, options, cb) {\n if (input && typeof input === \"object\" && !(input instanceof URL))\n input.protocol \?\?= \"https:\";\n else if (typeof options === \"object\")\n options.protocol \?\?= \"https:\";\n return http.request(input, options, cb);\n}, get = function(input, options, cb) {\n const req = request(input, options, cb);\n return req.end(), req;\n}, $, http = @getInternalField(@internalModuleRegistry, 23) || @createInternalModuleById(23);\n$ = {\n ...http,\n get,\n request\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeInspectorCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/inspector.ts\nvar open = function() {\n throwNotImplemented(\"node:inspector open\", 2445);\n}, close = function() {\n throwNotImplemented(\"node:inspector close\", 2445);\n}, url = function() {\n throwNotImplemented(\"node:inspector url\", 2445);\n}, waitForDebugger = function() {\n throwNotImplemented(\"node:inspector waitForDebugger\", 2445);\n}, $, { hideFromStack, throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6), EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20);\n\nclass Session extends EventEmitter {\n constructor() {\n super();\n throwNotImplemented(\"node:inspector Session\", 2445);\n }\n}\nvar console = {\n ...globalThis.console,\n context: {\n console: globalThis.console\n }\n};\n$ = {\n console,\n open,\n close,\n url,\n waitForDebugger,\n Session\n};\nhideFromStack(open, close, url, waitForDebugger, Session.prototype.constructor);\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeNetCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/net.ts\nvar isIPv4 = function(s) {\n return IPv4Reg.test(s);\n}, isIPv6 = function(s) {\n return IPv6Reg.test(s);\n}, isIP = function(s) {\n if (isIPv4(s))\n return 4;\n if (isIPv6(s))\n return 6;\n return 0;\n}, closeNT = function(self) {\n self.emit(\"close\");\n}, endNT = function(socket, callback, err) {\n socket.end(), callback(err);\n}, createConnection = function(port, host, connectListener) {\n if (typeof port === \"object\")\n return new Socket(port).connect(port, host, connectListener);\n return new Socket().connect(port, host, connectListener);\n}, emitErrorNextTick = function(self, error) {\n self.emit(\"error\", error);\n}, emitErrorAndCloseNextTick = function(self, error) {\n self.emit(\"error\", error), self.emit(\"close\");\n}, emitListeningNextTick = function(self, onListen) {\n if (typeof onListen === \"function\")\n try {\n onListen();\n } catch (err) {\n self.emit(\"error\", err);\n }\n self.emit(\"listening\");\n}, createServer = function(options, connectionListener) {\n return new Server(options, connectionListener);\n}, $, { Duplex } = @getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39), EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20);\nvar IPv4Reg = new @RegExp(\"^((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$\");\nvar IPv6Reg = new @RegExp(\"^((\?:(\?:[0-9a-fA-F]{1,4}):){7}(\?:(\?:[0-9a-fA-F]{1,4})|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){6}(\?:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|:(\?:[0-9a-fA-F]{1,4})|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){5}(\?::((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,2}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){4}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,1}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,3}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){3}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,2}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,4}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){2}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,3}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,5}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){1}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,4}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,6}|:)|(\?::((\?::(\?:[0-9a-fA-F]{1,4})){0,5}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(\?::(\?:[0-9a-fA-F]{1,4})){1,7}|:)))(%[0-9a-zA-Z-.:]{1,})\?$\"), { connect: bunConnect } = Bun, { setTimeout } = globalThis, bunTlsSymbol = Symbol.for(\"::buntls::\"), bunSocketServerHandlers = Symbol.for(\"::bunsocket_serverhandlers::\"), bunSocketServerConnections = Symbol.for(\"::bunnetserverconnections::\"), bunSocketServerOptions = Symbol.for(\"::bunnetserveroptions::\"), bunSocketInternal = Symbol.for(\"::bunnetsocketinternal::\"), bunTLSConnectOptions = Symbol.for(\"::buntlsconnectoptions::\"), SocketClass, Socket = function(InternalSocket) {\n SocketClass = InternalSocket, Object.defineProperty(SocketClass.prototype, Symbol.toStringTag, {\n value: \"Socket\",\n enumerable: !1\n });\n function Socket3(options) {\n return new InternalSocket(options);\n }\n return Socket3.prototype = InternalSocket.prototype, Object.defineProperty(Socket3, Symbol.hasInstance, {\n value(instance) {\n return instance instanceof InternalSocket;\n }\n });\n}(class Socket2 extends Duplex {\n static #Handlers = {\n close: Socket2.#Close,\n data({ data: self }, buffer) {\n self.bytesRead += buffer.length;\n const queue = self.#readQueue;\n if (queue.isEmpty()) {\n if (self.push(buffer))\n return;\n }\n queue.push(buffer);\n },\n drain: Socket2.#Drain,\n end: Socket2.#Close,\n error(socket, error) {\n const self = socket.data, callback = self.#writeCallback;\n if (callback)\n self.#writeCallback = null, callback(error);\n self.emit(\"error\", error);\n },\n open(socket) {\n const self = socket.data;\n socket.timeout(self.timeout), socket.ref(), self[bunSocketInternal] = socket, self.connecting = !1;\n const options = self[bunTLSConnectOptions];\n if (options) {\n const { session } = options;\n if (session)\n self.setSession(session);\n }\n if (!self.#upgraded)\n self.emit(\"connect\", self);\n Socket2.#Drain(socket);\n },\n handshake(socket, success, verifyError) {\n const { data: self } = socket;\n self._securePending = !1, self.secureConnecting = !1, self._secureEstablished = !!success, self.emit(\"secure\", self);\n const { checkServerIdentity } = self[bunTLSConnectOptions];\n if (!verifyError && typeof checkServerIdentity === \"function\" && self.servername) {\n const cert = self.getPeerCertificate(!0);\n verifyError = checkServerIdentity(self.servername, cert);\n }\n if (self._requestCert || self._rejectUnauthorized) {\n if (verifyError) {\n if (self.authorized = !1, self.authorizationError = verifyError.code || verifyError.message, self._rejectUnauthorized) {\n self.destroy(verifyError);\n return;\n }\n }\n } else\n self.authorized = !0;\n self.emit(\"secureConnect\", verifyError);\n },\n timeout(socket) {\n const self = socket.data;\n self.emit(\"timeout\", self);\n },\n binaryType: \"buffer\"\n };\n static #Close(socket) {\n const self = socket.data;\n if (self.#closed)\n return;\n self.#closed = !0, self[bunSocketInternal] = null;\n const queue = self.#readQueue;\n if (queue.isEmpty()) {\n if (self.push(null))\n return;\n }\n queue.push(null);\n }\n static #Drain(socket) {\n const self = socket.data, callback = self.#writeCallback;\n if (callback) {\n const chunk = self.#writeChunk, written = socket.write(chunk);\n if (self.bytesWritten += written, written < chunk.length)\n self.#writeChunk = chunk.slice(written);\n else\n self.#writeCallback = null, self.#writeChunk = null, callback(null);\n }\n }\n static [bunSocketServerHandlers] = {\n data: Socket2.#Handlers.data,\n close(socket) {\n Socket2.#Handlers.close(socket), this.data[bunSocketServerConnections]--;\n },\n end(socket) {\n Socket2.#Handlers.end(socket), this.data[bunSocketServerConnections]--;\n },\n open(socket) {\n const self = this.data, options = self[bunSocketServerOptions], { pauseOnConnect, connectionListener, InternalSocketClass, requestCert, rejectUnauthorized } = options, _socket = new InternalSocketClass({});\n if (_socket.isServer = !0, _socket._requestCert = requestCert, _socket._rejectUnauthorized = rejectUnauthorized, _socket.#attach(this.localPort, socket), self.maxConnections && self[bunSocketServerConnections] >= self.maxConnections) {\n const data = {\n localAddress: _socket.localAddress,\n localPort: _socket.localPort,\n localFamily: _socket.localFamily,\n remoteAddress: _socket.remoteAddress,\n remotePort: _socket.remotePort,\n remoteFamily: _socket.remoteFamily || \"IPv4\"\n };\n socket.end(), self.emit(\"drop\", data);\n return;\n }\n if (!pauseOnConnect)\n _socket.resume();\n if (self[bunSocketServerConnections]++, typeof connectionListener == \"function\")\n if (InternalSocketClass.name === \"TLSSocket\")\n self.once(\"secureConnection\", () => connectionListener(_socket));\n else\n connectionListener(_socket);\n self.emit(\"connection\", _socket);\n },\n handshake(socket, success, verifyError) {\n const { data: self } = socket;\n if (self.emit(\"secure\", self), self._securePending = !1, self.secureConnecting = !1, self._secureEstablished = !!success, self._requestCert || self._rejectUnauthorized) {\n if (verifyError) {\n if (self.authorized = !1, self.authorizationError = verifyError.code || verifyError.message, self._rejectUnauthorized) {\n self.destroy(verifyError);\n return;\n }\n }\n } else\n self.authorized = !0;\n self.emit(\"secureConnection\", verifyError);\n },\n error(socket, error) {\n Socket2.#Handlers.error(socket, error), this.data.emit(\"error\", error);\n },\n timeout: Socket2.#Handlers.timeout,\n connectError: Socket2.#Handlers.connectError,\n drain: Socket2.#Handlers.drain,\n binaryType: \"buffer\"\n };\n bytesRead = 0;\n bytesWritten = 0;\n #closed = !1;\n connecting = !1;\n localAddress = \"127.0.0.1\";\n #readQueue = @createFIFO();\n remotePort;\n [bunSocketInternal] = null;\n [bunTLSConnectOptions] = null;\n timeout = 0;\n #writeCallback;\n #writeChunk;\n #pendingRead;\n isServer = !1;\n _handle;\n _parent;\n _parentWrap;\n #socket;\n #upgraded;\n constructor(options) {\n const { socket, signal, write, read, allowHalfOpen = !1, ...opts } = options || {};\n super({\n ...opts,\n allowHalfOpen,\n readable: !0,\n writable: !0\n });\n if (this._handle = this, this._parent = this, this._parentWrap = this, this.#pendingRead = @undefined, this.#upgraded = null, socket instanceof Socket2)\n this.#socket = socket;\n signal\?.once(\"abort\", () => this.destroy()), this.once(\"connect\", () => this.emit(\"ready\"));\n }\n address() {\n return {\n address: this.localAddress,\n family: this.localFamily,\n port: this.localPort\n };\n }\n get bufferSize() {\n return this.writableLength;\n }\n #attach(port, socket) {\n if (this.remotePort = port, socket.data = this, socket.timeout(this.timeout), socket.ref(), this[bunSocketInternal] = socket, this.connecting = !1, !this.#upgraded)\n this.emit(\"connect\", this);\n Socket2.#Drain(socket);\n }\n #closeRawConnection() {\n const connection = this.#upgraded;\n connection[bunSocketInternal] = null, connection.unref(), connection.destroy(), process.nextTick(closeNT, connection);\n }\n connect(port, host, connectListener) {\n var path, connection = this.#socket, _checkServerIdentity = @undefined;\n if (typeof port === \"string\") {\n if (path = port, port = @undefined, typeof host === \"function\")\n connectListener = host, host = @undefined;\n } else if (typeof host == \"function\") {\n if (typeof port === \"string\")\n path = port, port = @undefined;\n connectListener = host, host = @undefined;\n }\n if (typeof port == \"object\") {\n var {\n port,\n host,\n path,\n socket,\n localAddress,\n localPort,\n family,\n hints,\n lookup,\n noDelay,\n keepAlive,\n keepAliveInitialDelay,\n requestCert,\n rejectUnauthorized,\n pauseOnConnect,\n servername,\n checkServerIdentity,\n session\n } = port;\n if (_checkServerIdentity = checkServerIdentity, this.servername = servername, socket)\n connection = socket;\n }\n if (!pauseOnConnect)\n this.resume();\n this.connecting = !0, this.remotePort = port;\n const bunTLS = this[bunTlsSymbol];\n var tls = @undefined;\n if (typeof bunTLS === \"function\") {\n if (tls = bunTLS.@call(this, port, host, !0), this._requestCert = !0, this._rejectUnauthorized = rejectUnauthorized, tls) {\n if (tls.rejectUnauthorized = rejectUnauthorized, tls.requestCert = !0, tls.session = session || tls.session, this.servername = tls.servername, tls.checkServerIdentity = _checkServerIdentity || tls.checkServerIdentity, this[bunTLSConnectOptions] = tls, !connection && tls.socket)\n connection = tls.socket;\n }\n if (connection) {\n if (typeof connection !== \"object\" || !(connection instanceof Socket2) || typeof connection[bunTlsSymbol] === \"function\")\n @throwTypeError(\"socket must be an instance of net.Socket\");\n }\n if (this.authorized = !1, this.secureConnecting = !0, this._secureEstablished = !1, this._securePending = !0, connectListener)\n this.on(\"secureConnect\", connectListener);\n } else if (connectListener)\n this.on(\"connect\", connectListener);\n try {\n if (connection) {\n const socket2 = connection[bunSocketInternal];\n if (socket2) {\n this.connecting = !0, this.#upgraded = connection;\n const result = socket2.upgradeTLS({\n data: this,\n tls,\n socket: Socket2.#Handlers\n });\n if (result) {\n const [raw, tls2] = result;\n connection[bunSocketInternal] = raw, raw.timeout(raw.timeout), this.once(\"end\", this.#closeRawConnection), raw.connecting = !1, this[bunSocketInternal] = tls2;\n } else\n throw this[bunSocketInternal] = null, new Error(\"Invalid socket\");\n } else\n connection.once(\"connect\", () => {\n const socket3 = connection[bunSocketInternal];\n if (!socket3)\n return;\n this.connecting = !0, this.#upgraded = connection;\n const result = socket3.upgradeTLS({\n data: this,\n tls,\n socket: Socket2.#Handlers\n });\n if (result) {\n const [raw, tls2] = result;\n connection[bunSocketInternal] = raw, raw.timeout(raw.timeout), this.once(\"end\", this.#closeRawConnection), raw.connecting = !1, this[bunSocketInternal] = tls2;\n } else\n throw this[bunSocketInternal] = null, new Error(\"Invalid socket\");\n });\n } else if (path)\n bunConnect({\n data: this,\n unix: path,\n socket: Socket2.#Handlers,\n tls\n }).catch((error) => {\n this.emit(\"error\", error), this.emit(\"close\");\n });\n else\n bunConnect({\n data: this,\n hostname: host || \"localhost\",\n port,\n socket: Socket2.#Handlers,\n tls\n }).catch((error) => {\n this.emit(\"error\", error), this.emit(\"close\");\n });\n } catch (error) {\n process.nextTick(emitErrorAndCloseNextTick, this, error);\n }\n return this;\n }\n _destroy(err, callback) {\n const socket = this[bunSocketInternal];\n socket && process.nextTick(endNT, socket, callback, err);\n }\n _final(callback) {\n this[bunSocketInternal]\?.end(), callback(), process.nextTick(closeNT, this);\n }\n get localAddress() {\n return \"127.0.0.1\";\n }\n get localFamily() {\n return \"IPv4\";\n }\n get localPort() {\n return this[bunSocketInternal]\?.localPort;\n }\n get pending() {\n return this.connecting;\n }\n _read(size) {\n const queue = this.#readQueue;\n let chunk;\n while (chunk = queue.peek()) {\n const can_continue = !this.push(chunk);\n if (queue.shift(), !can_continue)\n break;\n }\n }\n get readyState() {\n if (this.connecting)\n return \"opening\";\n if (this.readable)\n return this.writable \? \"open\" : \"readOnly\";\n else\n return this.writable \? \"writeOnly\" : \"closed\";\n }\n ref() {\n this[bunSocketInternal]\?.ref();\n }\n get remoteAddress() {\n return this[bunSocketInternal]\?.remoteAddress;\n }\n get remoteFamily() {\n return \"IPv4\";\n }\n resetAndDestroy() {\n this[bunSocketInternal]\?.end();\n }\n setKeepAlive(enable = !1, initialDelay = 0) {\n return this;\n }\n setNoDelay(noDelay = !0) {\n return this;\n }\n setTimeout(timeout, callback) {\n if (this[bunSocketInternal]\?.timeout(timeout), this.timeout = timeout, callback)\n this.once(\"timeout\", callback);\n return this;\n }\n unref() {\n this[bunSocketInternal]\?.unref();\n }\n _write(chunk, encoding, callback) {\n if (typeof chunk == \"string\" && encoding !== \"ascii\")\n chunk = @Buffer.from(chunk, encoding);\n var written = this[bunSocketInternal]\?.write(chunk);\n if (written == chunk.length)\n callback();\n else if (this.#writeCallback)\n callback(new Error(\"overlapping _write()\"));\n else {\n if (written > 0)\n if (typeof chunk == \"string\")\n chunk = chunk.slice(written);\n else\n chunk = chunk.subarray(written);\n this.#writeCallback = callback, this.#writeChunk = chunk;\n }\n }\n}), connect = createConnection;\n\nclass Server extends EventEmitter {\n #server;\n #listening = !1;\n [bunSocketServerConnections] = 0;\n [bunSocketServerOptions];\n maxConnections = 0;\n constructor(options, connectionListener) {\n super();\n if (typeof options === \"function\")\n connectionListener = options, options = {};\n else if (options == null || typeof options === \"object\")\n options = { ...options };\n else\n throw new Error(\"bun-net-polyfill: invalid arguments\");\n const { maxConnections } = options;\n this.maxConnections = Number.isSafeInteger(maxConnections) && maxConnections > 0 \? maxConnections : 0, options.connectionListener = connectionListener, this[bunSocketServerOptions] = options;\n }\n ref() {\n return this.#server\?.ref(), this;\n }\n unref() {\n return this.#server\?.unref(), this;\n }\n close(callback) {\n if (this.#server) {\n if (this.#server.stop(!0), this.#server = null, this.#listening = !1, this[bunSocketServerConnections] = 0, this.emit(\"close\"), typeof callback === \"function\")\n callback();\n return this;\n }\n if (typeof callback === \"function\") {\n const error = new Error(\"Server is not running\");\n error.code = \"ERR_SERVER_NOT_RUNNING\", callback(error);\n }\n return this;\n }\n address() {\n const server = this.#server;\n if (server) {\n const unix = server.unix;\n if (unix)\n return unix;\n let address = server.hostname;\n const type = isIP(address), port = server.port;\n if (typeof port === \"number\")\n return {\n port,\n address,\n family: type \? `IPv${type}` : @undefined\n };\n if (type)\n return {\n address,\n family: type \? `IPv${type}` : @undefined\n };\n return address;\n }\n return null;\n }\n getConnections(callback) {\n if (typeof callback === \"function\")\n callback(null, this.#server \? this[bunSocketServerConnections] : 0);\n return this;\n }\n listen(port, hostname, onListen) {\n let backlog, path, exclusive = !1;\n if (typeof port === \"string\") {\n if (Number.isSafeInteger(hostname)) {\n if (hostname > 0)\n backlog = hostname;\n } else if (typeof hostname === \"function\")\n onListen = hostname;\n path = port, hostname = @undefined, port = @undefined;\n } else {\n if (typeof hostname === \"function\")\n onListen = hostname, hostname = @undefined;\n if (typeof port === \"function\")\n onListen = port, port = 0;\n else if (typeof port === \"object\") {\n const options = port;\n options.signal\?.addEventListener(\"abort\", () => this.close()), hostname = options.host, exclusive = options.exclusive === !0;\n const path2 = options.path;\n if (port = options.port, !Number.isSafeInteger(port) || port < 0)\n if (path2)\n hostname = path2, port = @undefined;\n else {\n let message = 'The argument \\'options\\' must have the property \"port\" or \"path\"';\n try {\n message = `${message}. Received ${JSON.stringify(options)}`;\n } catch {\n }\n const error = @makeTypeError(message);\n throw error.code = \"ERR_INVALID_ARG_VALUE\", error;\n }\n else if (!Number.isSafeInteger(port) || port < 0)\n port = 0;\n if (typeof port.callback === \"function\")\n onListen = port\?.callback;\n } else if (!Number.isSafeInteger(port) || port < 0)\n port = 0;\n hostname = hostname || \"::\";\n }\n try {\n var tls = @undefined, TLSSocketClass = @undefined;\n const bunTLS = this[bunTlsSymbol], options = this[bunSocketServerOptions];\n if (typeof bunTLS === \"function\")\n [tls, TLSSocketClass] = bunTLS.@call(this, port, hostname, !1), options.servername = tls.serverName, options.InternalSocketClass = TLSSocketClass;\n else\n options.InternalSocketClass = SocketClass;\n this.#server = Bun.listen(path \? {\n exclusive,\n unix: path,\n tls,\n socket: SocketClass[bunSocketServerHandlers]\n } : {\n exclusive,\n port,\n hostname,\n tls,\n socket: SocketClass[bunSocketServerHandlers]\n }), this.#server.data = this, this.#listening = !0, setTimeout(emitListeningNextTick, 1, this, onListen);\n } catch (err) {\n this.#listening = !1, setTimeout(emitErrorNextTick, 1, this, err);\n }\n return this;\n }\n}\n$ = {\n createServer,\n Server,\n createConnection,\n connect,\n isIP,\n isIPv4,\n isIPv6,\n Socket,\n [Symbol.for(\"::bunternal::\")]: SocketClass\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeOSCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/os.ts\nvar lazyCpus = function({ cpus }) {\n return () => {\n const array = new @Array(navigator.hardwareConcurrency);\n function populate() {\n const results = cpus(), length = results.length;\n array.length = length;\n for (let i = 0;i < length; i++)\n array[i] = results[i];\n }\n for (let i = 0;i < array.length; i++) {\n const instance = {\n get model() {\n if (array[i] === instance)\n populate();\n return array[i].model;\n },\n set model(value) {\n if (array[i] === instance)\n populate();\n array[i].model = value;\n },\n get speed() {\n if (array[i] === instance)\n populate();\n return array[i].speed;\n },\n set speed(value) {\n if (array[i] === instance)\n populate();\n array[i].speed = value;\n },\n get times() {\n if (array[i] === instance)\n populate();\n return array[i].times;\n },\n set times(value) {\n if (array[i] === instance)\n populate();\n array[i].times = value;\n },\n toJSON() {\n if (array[i] === instance)\n populate();\n return array[i];\n }\n };\n array[i] = instance;\n }\n return array;\n };\n}, bound = function(obj) {\n return {\n availableParallelism: () => {\n return navigator.hardwareConcurrency;\n },\n arch: obj.arch.bind(obj),\n cpus: lazyCpus(obj),\n endianness: obj.endianness.bind(obj),\n freemem: obj.freemem.bind(obj),\n getPriority: obj.getPriority.bind(obj),\n homedir: obj.homedir.bind(obj),\n hostname: obj.hostname.bind(obj),\n loadavg: obj.loadavg.bind(obj),\n networkInterfaces: obj.networkInterfaces.bind(obj),\n platform: obj.platform.bind(obj),\n release: obj.release.bind(obj),\n setPriority: obj.setPriority.bind(obj),\n get tmpdir() {\n return tmpdir;\n },\n totalmem: obj.totalmem.bind(obj),\n type: obj.type.bind(obj),\n uptime: obj.uptime.bind(obj),\n userInfo: obj.userInfo.bind(obj),\n version: obj.version.bind(obj),\n machine: obj.machine.bind(obj),\n devNull: obj.devNull,\n EOL: obj.EOL,\n constants: @processBindingConstants.os\n };\n}, tmpdir = function() {\n var env = Bun.env;\n return tmpdir = function() {\n var path = env.TMPDIR || env.TMP || env.TEMP || \"/tmp\";\n const length = path.length;\n if (length > 1 && path[length - 1] === \"/\")\n path = path.slice(0, -1);\n return path;\n }, tmpdir();\n};\nreturn bound(Bun._Os())})\n"); -// - -// -static constexpr ASCIILiteral NodePathPosixCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/path.posix.ts\nreturn (@getInternalField(@internalModuleRegistry, 30) || @createInternalModuleById(30)).posix})\n"); -// - -// -static constexpr ASCIILiteral NodePathCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/path.ts\nvar bound = function(obj) {\n const toNamespacedPath = obj.toNamespacedPath.bind(obj);\n return {\n resolve: obj.resolve.bind(obj),\n normalize: obj.normalize.bind(obj),\n isAbsolute: obj.isAbsolute.bind(obj),\n join: obj.join.bind(obj),\n relative: obj.relative.bind(obj),\n toNamespacedPath,\n dirname: obj.dirname.bind(obj),\n basename: obj.basename.bind(obj),\n extname: obj.extname.bind(obj),\n format: obj.format.bind(obj),\n parse: obj.parse.bind(obj),\n sep: obj.sep,\n delimiter: obj.delimiter,\n win32: @undefined,\n posix: @undefined,\n _makeLong: toNamespacedPath\n };\n}, posix = bound(Bun._Path(!1)), win32 = bound(Bun._Path(!0));\nposix.win32 = win32.win32 = win32;\nposix.posix = win32.posix = posix;\nreturn win32})\n"); -// - -// -static constexpr ASCIILiteral NodePathWin32Code = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/path.win32.ts\nreturn (@getInternalField(@internalModuleRegistry, 30) || @createInternalModuleById(30)).win32})\n"); -// - -// -static constexpr ASCIILiteral NodePerfHooksCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/perf_hooks.ts\nvar $, { throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6), constants = {\n NODE_PERFORMANCE_GC_MAJOR: 4,\n NODE_PERFORMANCE_GC_MINOR: 1,\n NODE_PERFORMANCE_GC_INCREMENTAL: 8,\n NODE_PERFORMANCE_GC_WEAKCB: 16,\n NODE_PERFORMANCE_GC_FLAGS_NO: 0,\n NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: 2,\n NODE_PERFORMANCE_GC_FLAGS_FORCED: 4,\n NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING: 8,\n NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE: 16,\n NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: 32,\n NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: 64\n}, performance = globalThis.performance;\n\nclass PerformanceObserver {\n constructor() {\n throwNotImplemented(\"PerformanceObserver\");\n }\n}\n\nclass PerformanceEntry {\n constructor() {\n throwNotImplemented(\"PerformanceEntry\");\n }\n}\n$ = {\n performance,\n constants,\n PerformanceEntry,\n PerformanceObserver\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodePunycodeCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/punycode.ts\nvar error = function(type) {\n @throwRangeError(errors[type]);\n}, map = function(array, callback) {\n const result = [];\n let length = array.length;\n while (length--)\n result[length] = callback(array[length]);\n return result;\n}, mapDomain = function(domain, callback) {\n const parts = domain.split(\"@\");\n let result = \"\";\n if (parts.length > 1)\n result = parts[0] + \"@\", domain = parts[1];\n domain = domain.replace(regexSeparators, \".\");\n const labels = domain.split(\".\"), encoded = map(labels, callback).join(\".\");\n return result + encoded;\n}, ucs2decode = function(string) {\n const output = [];\n let counter = 0;\n const length = string.length;\n while (counter < length) {\n const value = string.charCodeAt(counter++);\n if (value >= 55296 && value <= 56319 && counter < length) {\n const extra = string.charCodeAt(counter++);\n if ((extra & 64512) == 56320)\n output.push(((value & 1023) << 10) + (extra & 1023) + 65536);\n else\n output.push(value), counter--;\n } else\n output.push(value);\n }\n return output;\n}, $, maxInt = 2147483647, base = 36, tMin = 1, tMax = 26, skew = 38, damp = 700, initialBias = 72, initialN = 128, delimiter = \"-\", regexPunycode = /^xn--/, regexNonASCII = /[^\\0-\\x7F]/, regexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g, errors = {\n overflow: \"Overflow: input needs wider integers to process\",\n \"not-basic\": \"Illegal input >= 0x80 (not a basic code point)\",\n \"invalid-input\": \"Invalid input\"\n}, baseMinusTMin = base - tMin, floor = Math.floor, stringFromCharCode = @String.fromCharCode, ucs2encode = (codePoints) => @String.fromCodePoint(...codePoints), basicToDigit = function(codePoint) {\n if (codePoint >= 48 && codePoint < 58)\n return 26 + (codePoint - 48);\n if (codePoint >= 65 && codePoint < 91)\n return codePoint - 65;\n if (codePoint >= 97 && codePoint < 123)\n return codePoint - 97;\n return base;\n}, digitToBasic = function(digit, flag) {\n return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n}, adapt = function(delta, numPoints, firstTime) {\n let k = 0;\n delta = firstTime \? floor(delta / damp) : delta >> 1, delta += floor(delta / numPoints);\n for (;delta > baseMinusTMin * tMax >> 1; k += base)\n delta = floor(delta / baseMinusTMin);\n return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n}, decode = function(input) {\n const output = [], inputLength = input.length;\n let i = 0, n = initialN, bias = initialBias, basic = input.lastIndexOf(delimiter);\n if (basic < 0)\n basic = 0;\n for (let j = 0;j < basic; ++j) {\n if (input.charCodeAt(j) >= 128)\n error(\"not-basic\");\n output.push(input.charCodeAt(j));\n }\n for (let index = basic > 0 \? basic + 1 : 0;index < inputLength; ) {\n const oldi = i;\n for (let w = 1, k = base;; k += base) {\n if (index >= inputLength)\n error(\"invalid-input\");\n const digit = basicToDigit(input.charCodeAt(index++));\n if (digit >= base)\n error(\"invalid-input\");\n if (digit > floor((maxInt - i) / w))\n error(\"overflow\");\n i += digit * w;\n const t = k <= bias \? tMin : k >= bias + tMax \? tMax : k - bias;\n if (digit < t)\n break;\n const baseMinusT = base - t;\n if (w > floor(maxInt / baseMinusT))\n error(\"overflow\");\n w *= baseMinusT;\n }\n const out = output.length + 1;\n if (bias = adapt(i - oldi, out, oldi == 0), floor(i / out) > maxInt - n)\n error(\"overflow\");\n n += floor(i / out), i %= out, output.splice(i++, 0, n);\n }\n return @String.fromCodePoint(...output);\n}, encode = function(input) {\n const output = [];\n input = ucs2decode(input);\n const inputLength = input.length;\n let n = initialN, delta = 0, bias = initialBias;\n for (let currentValue of input)\n if (currentValue < 128)\n output.push(stringFromCharCode(currentValue));\n const basicLength = output.length;\n let handledCPCount = basicLength;\n if (basicLength)\n output.push(delimiter);\n while (handledCPCount < inputLength) {\n let m = maxInt;\n for (let currentValue of input)\n if (currentValue >= n && currentValue < m)\n m = currentValue;\n const handledCPCountPlusOne = handledCPCount + 1;\n if (m - n > floor((maxInt - delta) / handledCPCountPlusOne))\n error(\"overflow\");\n delta += (m - n) * handledCPCountPlusOne, n = m;\n for (let currentValue of input) {\n if (currentValue < n && ++delta > maxInt)\n error(\"overflow\");\n if (currentValue === n) {\n let q = delta;\n for (let k = base;; k += base) {\n const t = k <= bias \? tMin : k >= bias + tMax \? tMax : k - bias;\n if (q < t)\n break;\n const qMinusT = q - t, baseMinusT = base - t;\n output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))), q = floor(qMinusT / baseMinusT);\n }\n output.push(stringFromCharCode(digitToBasic(q, 0))), bias = adapt(delta, handledCPCountPlusOne, handledCPCount === basicLength), delta = 0, ++handledCPCount;\n }\n }\n ++delta, ++n;\n }\n return output.join(\"\");\n}, toUnicode = function(input) {\n return mapDomain(input, function(string) {\n return regexPunycode.test(string) \? decode(string.slice(4).toLowerCase()) : string;\n });\n}, toASCII = function(input) {\n return mapDomain(input, function(string) {\n return regexNonASCII.test(string) \? \"xn--\" + encode(string) : string;\n });\n};\n$ = {\n version: \"2.1.0\",\n ucs2: {\n decode: ucs2decode,\n encode: ucs2encode\n },\n decode,\n encode,\n toASCII,\n toUnicode\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeQuerystringCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/querystring.ts\nvar __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports), Buffer = @requireNativeModule(\"buffer\").Buffer, require_object_keys = __commonJS((exports, module) => {\n var objectKeys = Object.keys || function() {\n var hasOwnProperty = Object.prototype.hasOwnProperty, hasDontEnumBug = !{ toString: null }.propertyIsEnumerable(\"toString\"), dontEnums = [\n \"toString\",\n \"toLocaleString\",\n \"valueOf\",\n \"hasOwnProperty\",\n \"isPrototypeOf\",\n \"propertyIsEnumerable\",\n \"constructor\"\n ], dontEnumsLength = dontEnums.length;\n return function(obj) {\n if (typeof obj !== \"function\" && (typeof obj !== \"object\" || obj === null))\n @throwTypeError(\"Object.keys called on non-object\");\n var result = [], prop, i;\n for (prop in obj)\n if (hasOwnProperty.@call(obj, prop))\n result.push(prop);\n if (hasDontEnumBug) {\n for (i = 0;i < dontEnumsLength; i++)\n if (hasOwnProperty.@call(obj, dontEnums[i]))\n result.push(dontEnums[i]);\n }\n return result;\n };\n }();\n module.exports = objectKeys;\n}), require_src = __commonJS((exports, module) => {\n var ParsedQueryString = function() {\n }, unescapeBuffer = function(s, decodeSpaces) {\n var out = Buffer.allocUnsafe(s.length), state = 0, n, m, hexchar, c;\n for (var inIndex = 0, outIndex = 0;; inIndex++) {\n if (inIndex < s.length)\n c = s.charCodeAt(inIndex);\n else {\n if (state > 0) {\n if (out[outIndex++] = 37, state === 2)\n out[outIndex++] = hexchar;\n }\n break;\n }\n switch (state) {\n case 0:\n switch (c) {\n case 37:\n n = 0, m = 0, state = 1;\n break;\n case 43:\n if (decodeSpaces)\n c = 32;\n default:\n out[outIndex++] = c;\n break;\n }\n break;\n case 1:\n if (hexchar = c, n = unhexTable[c], !(n >= 0)) {\n out[outIndex++] = 37, out[outIndex++] = c, state = 0;\n break;\n }\n state = 2;\n break;\n case 2:\n if (state = 0, m = unhexTable[c], !(m >= 0)) {\n out[outIndex++] = 37, out[outIndex++] = hexchar, out[outIndex++] = c;\n break;\n }\n out[outIndex++] = 16 * n + m;\n break;\n }\n }\n return out.slice(0, outIndex);\n }, qsUnescape = function(s, decodeSpaces) {\n try {\n return decodeURIComponent(s);\n } catch (e) {\n return QueryString.unescapeBuffer(s, decodeSpaces).toString();\n }\n }, qsEscape = function(str) {\n if (typeof str !== \"string\")\n if (typeof str === \"object\")\n str = @String(str);\n else\n str += \"\";\n var out = \"\", lastPos = 0;\n for (var i2 = 0;i2 < str.length; ++i2) {\n var c = str.charCodeAt(i2);\n if (c < 128) {\n if (noEscape[c] === 1)\n continue;\n if (lastPos < i2)\n out += str.slice(lastPos, i2);\n lastPos = i2 + 1, out += hexTable[c];\n continue;\n }\n if (lastPos < i2)\n out += str.slice(lastPos, i2);\n if (c < 2048) {\n lastPos = i2 + 1, out += hexTable[192 | c >> 6] + hexTable[128 | c & 63];\n continue;\n }\n if (c < 55296 || c >= 57344) {\n lastPos = i2 + 1, out += hexTable[224 | c >> 12] + hexTable[128 | c >> 6 & 63] + hexTable[128 | c & 63];\n continue;\n }\n ++i2;\n var c2;\n if (i2 < str.length)\n c2 = str.charCodeAt(i2) & 1023;\n else\n throw new URIError(\"URI malformed\");\n lastPos = i2 + 1, c = 65536 + ((c & 1023) << 10 | c2), out += hexTable[240 | c >> 18] + hexTable[128 | c >> 12 & 63] + hexTable[128 | c >> 6 & 63] + hexTable[128 | c & 63];\n }\n if (lastPos === 0)\n return str;\n if (lastPos < str.length)\n return out + str.slice(lastPos);\n return out;\n }, stringifyPrimitive = function(v) {\n if (typeof v === \"string\")\n return v;\n if (typeof v === \"number\" && @isFinite(v))\n return \"\" + v;\n if (typeof v === \"boolean\")\n return v \? \"true\" : \"false\";\n return \"\";\n }, stringify = function(obj, sep, eq, options) {\n sep = sep || \"&\", eq = eq || \"=\";\n var encode = QueryString.escape;\n if (options && typeof options.encodeURIComponent === \"function\")\n encode = options.encodeURIComponent;\n if (obj !== null && typeof obj === \"object\") {\n var keys = objectKeys(obj), len = keys.length, flast = len - 1, fields = \"\";\n for (var i2 = 0;i2 < len; ++i2) {\n var k = keys[i2], v = obj[k], ks = encode(stringifyPrimitive(k)) + eq;\n if (isArray(v)) {\n var vlen = v.length, vlast = vlen - 1;\n for (var j = 0;j < vlen; ++j)\n if (fields += ks + encode(stringifyPrimitive(v[j])), j < vlast)\n fields += sep;\n if (vlen && i2 < flast)\n fields += sep;\n } else if (fields += ks + encode(stringifyPrimitive(v)), i2 < flast)\n fields += sep;\n }\n return fields;\n }\n return \"\";\n }, charCodes = function(str) {\n if (str.length === 0)\n return [];\n if (str.length === 1)\n return [str.charCodeAt(0)];\n const ret = [];\n for (var i2 = 0;i2 < str.length; ++i2)\n ret[ret.length] = str.charCodeAt(i2);\n return ret;\n }, parse = function(qs, sep, eq, options) {\n const obj = new ParsedQueryString;\n if (typeof qs !== \"string\" || qs.length === 0)\n return obj;\n var sepCodes = !sep \? defSepCodes : charCodes(sep + \"\"), eqCodes = !eq \? defEqCodes : charCodes(eq + \"\");\n const sepLen = sepCodes.length, eqLen = eqCodes.length;\n var pairs = 1000;\n if (options && typeof options.maxKeys === \"number\")\n pairs = options.maxKeys > 0 \? options.maxKeys : -1;\n var decode = QueryString.unescape;\n if (options && typeof options.decodeURIComponent === \"function\")\n decode = options.decodeURIComponent;\n const customDecode = decode !== qsUnescape, keys = [];\n var posIdx = 0, lastPos = 0, sepIdx = 0, eqIdx = 0, key = \"\", value = \"\", keyEncoded = customDecode, valEncoded = customDecode, encodeCheck = 0;\n for (var i2 = 0;i2 < qs.length; ++i2) {\n const code = qs.charCodeAt(i2);\n if (code === sepCodes[sepIdx]) {\n if (++sepIdx === sepLen) {\n const end = i2 - sepIdx + 1;\n if (eqIdx < eqLen) {\n if (lastPos < end)\n key += qs.slice(lastPos, end);\n } else if (lastPos < end)\n value += qs.slice(lastPos, end);\n if (keyEncoded)\n key = decodeStr(key, decode);\n if (valEncoded)\n value = decodeStr(value, decode);\n if (key || value || lastPos - posIdx > sepLen || i2 === 0)\n if (indexOf(keys, key) === -1)\n obj[key] = value, keys[keys.length] = key;\n else {\n const curValue = obj[key] || \"\";\n if (curValue.pop)\n curValue[curValue.length] = value;\n else if (curValue)\n obj[key] = [curValue, value];\n }\n else if (i2 === 1)\n delete obj[key];\n if (--pairs === 0)\n break;\n keyEncoded = valEncoded = customDecode, encodeCheck = 0, key = value = \"\", posIdx = lastPos, lastPos = i2 + 1, sepIdx = eqIdx = 0;\n }\n continue;\n } else if (sepIdx = 0, !valEncoded)\n if (code === 37)\n encodeCheck = 1;\n else if (encodeCheck > 0 && (code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) {\n if (++encodeCheck === 3)\n valEncoded = !0;\n } else\n encodeCheck = 0;\n if (eqIdx < eqLen) {\n if (code === eqCodes[eqIdx]) {\n if (++eqIdx === eqLen) {\n const end = i2 - eqIdx + 1;\n if (lastPos < end)\n key += qs.slice(lastPos, end);\n encodeCheck = 0, lastPos = i2 + 1;\n }\n continue;\n } else if (eqIdx = 0, !keyEncoded)\n if (code === 37)\n encodeCheck = 1;\n else if (encodeCheck > 0 && (code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) {\n if (++encodeCheck === 3)\n keyEncoded = !0;\n } else\n encodeCheck = 0;\n }\n if (code === 43) {\n if (eqIdx < eqLen) {\n if (lastPos < i2)\n key += qs.slice(lastPos, i2);\n key += \"%20\", keyEncoded = !0;\n } else {\n if (lastPos < i2)\n value += qs.slice(lastPos, i2);\n value += \"%20\", valEncoded = !0;\n }\n lastPos = i2 + 1;\n }\n }\n if (pairs !== 0 && (lastPos < qs.length || eqIdx > 0)) {\n if (lastPos < qs.length) {\n if (eqIdx < eqLen)\n key += qs.slice(lastPos);\n else if (sepIdx < sepLen)\n value += qs.slice(lastPos);\n }\n if (keyEncoded)\n key = decodeStr(key, decode);\n if (valEncoded)\n value = decodeStr(value, decode);\n if (indexOf(keys, key) === -1)\n obj[key] = value, keys[keys.length] = key;\n else {\n const curValue = obj[key];\n if (curValue.pop)\n curValue[curValue.length] = value;\n else\n obj[key] = [curValue, value];\n }\n }\n return obj;\n }, decodeStr = function(s, decoder) {\n try {\n return decoder(s);\n } catch (e) {\n return QueryString.unescape(s, !0);\n }\n }, QueryString = module.exports = {\n unescapeBuffer,\n unescape: qsUnescape,\n escape: qsEscape,\n stringify,\n encode: stringify,\n parse,\n decode: parse\n }, objectKeys = require_object_keys(), isArray = (arg) => Object.prototype.toString.@call(arg) === \"[object Array]\", indexOf = (arr, searchElement, fromIndex) => {\n var k;\n if (arr == null)\n @throwTypeError('\"arr\" is null or not defined');\n var o = Object(arr), len = o.length >>> 0;\n if (len === 0)\n return -1;\n var n = fromIndex | 0;\n if (n >= len)\n return -1;\n k = Math.max(n >= 0 \? n : len - Math.abs(n), 0);\n while (k < len) {\n if ((k in o) && o[k] === searchElement)\n return k;\n k++;\n }\n return -1;\n };\n ParsedQueryString.prototype = Object.create \? Object.create(null) : {};\n var unhexTable = [\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1\n ], hexTable = [];\n for (i = 0;i < 256; ++i)\n hexTable[i] = \"%\" + ((i < 16 \? \"0\" : \"\") + i.toString(16)).toUpperCase();\n var i, noEscape = [\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 0,\n 1,\n 1,\n 1,\n 1,\n 0,\n 0,\n 1,\n 1,\n 0,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 0,\n 0,\n 0,\n 1,\n 0\n ], defSepCodes = [38], defEqCodes = [61];\n});\nreturn require_src()})\n"); -// - -// -static constexpr ASCIILiteral NodeReadlineCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/readline.ts\nvar stripVTControlCharacters = function(str) {\n return validateString(str, \"str\"), RegExpPrototypeSymbolReplace.@call(ansi, str, \"\");\n}, promisify = function(original) {\n if (validateFunction(original, \"original\"), original[kCustomPromisifiedSymbol]) {\n var fn = original[kCustomPromisifiedSymbol];\n return validateFunction(fn, \"util.promisify.custom\"), ObjectDefineProperty(fn, kCustomPromisifiedSymbol, {\n __proto__: null,\n value: fn,\n enumerable: !1,\n writable: !1,\n configurable: !0\n });\n }\n var argumentNames = original[kCustomPromisifyArgsSymbol];\n function fn(...args) {\n return new @Promise((resolve, reject) => {\n ArrayPrototypePush.@call(args, (err, ...values) => {\n if (err)\n return reject(err);\n if (argumentNames !== @undefined && values.length > 1) {\n var obj = {};\n for (var i2 = 0;i2 < argumentNames.length; i2++)\n obj[argumentNames[i2]] = values[i2];\n resolve(obj);\n } else\n resolve(values[0]);\n }), ReflectApply(original, this, args);\n });\n }\n ObjectSetPrototypeOf(fn, ObjectGetPrototypeOf(original)), ObjectDefineProperty(fn, kCustomPromisifiedSymbol, {\n __proto__: null,\n value: fn,\n enumerable: !1,\n writable: !1,\n configurable: !0\n });\n var descriptors = ObjectGetOwnPropertyDescriptors(original), propertiesValues = ObjectValues(descriptors);\n for (var i = 0;i < propertiesValues.length; i++)\n ObjectSetPrototypeOf(propertiesValues[i], null);\n return ObjectDefineProperties(fn, descriptors);\n}, getNodeErrorByName = function(typeName) {\n var base = errorBases[typeName];\n if (base)\n return base;\n if (!ObjectKeys(VALID_NODE_ERROR_BASES).includes(typeName))\n throw new Error(\"Invalid NodeError type\");\n var Base = VALID_NODE_ERROR_BASES[typeName];\n\n class NodeError extends Base {\n [kIsNodeError] = !0;\n code;\n constructor(msg, opts) {\n super(msg, opts);\n this.code = opts\?.code || \"ERR_GENERIC\";\n }\n toString() {\n return `${this.name} [${this.code}]: ${this.message}`;\n }\n }\n return errorBases[typeName] = NodeError, NodeError;\n}, validateFunction = function(value, name) {\n if (typeof value !== \"function\")\n throw new ERR_INVALID_ARG_TYPE(name, \"Function\", value);\n}, validateAbortSignal = function(signal, name) {\n if (signal !== @undefined && (signal === null || typeof signal !== \"object\" || !(\"aborted\" in signal)))\n throw new ERR_INVALID_ARG_TYPE(name, \"AbortSignal\", signal);\n}, validateArray = function(value, name, minLength = 0) {\n if (!ArrayIsArray(value))\n throw new ERR_INVALID_ARG_TYPE(name, \"Array\", value);\n if (value.length < minLength) {\n var reason = `must be longer than ${minLength}`;\n throw new ERR_INVALID_ARG_VALUE(name, value, reason);\n }\n}, validateString = function(value, name) {\n if (typeof value !== \"string\")\n throw new ERR_INVALID_ARG_TYPE(name, \"string\", value);\n}, validateBoolean = function(value, name) {\n if (typeof value !== \"boolean\")\n throw new ERR_INVALID_ARG_TYPE(name, \"boolean\", value);\n};\nvar validateInteger = function(value, name, min = NumberMIN_SAFE_INTEGER, max = NumberMAX_SAFE_INTEGER) {\n if (typeof value !== \"number\")\n throw new ERR_INVALID_ARG_TYPE(name, \"number\", value);\n if (!NumberIsInteger(value))\n throw new ERR_OUT_OF_RANGE(name, \"an integer\", value);\n if (value < min || value > max)\n throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);\n}, validateUint32 = function(value, name, positive = !1) {\n if (typeof value !== \"number\")\n throw new ERR_INVALID_ARG_TYPE(name, \"number\", value);\n if (!NumberIsInteger(value))\n throw new ERR_OUT_OF_RANGE(name, \"an integer\", value);\n var min = positive \? 1 : 0, max = 4294967295;\n if (value < min || value > max)\n throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);\n}, CSI = function(strings, ...args) {\n var ret = `${kEscape}[`;\n for (var n = 0;n < strings.length; n++)\n if (ret += strings[n], n < args.length)\n ret += args[n];\n return ret;\n}, charLengthLeft = function(str, i) {\n if (i <= 0)\n return 0;\n if (i > 1 && StringPrototypeCodePointAt.@call(str, i - 2) >= kUTF16SurrogateThreshold || StringPrototypeCodePointAt.@call(str, i - 1) >= kUTF16SurrogateThreshold)\n return 2;\n return 1;\n}, charLengthAt = function(str, i) {\n if (str.length <= i)\n return 1;\n return StringPrototypeCodePointAt.@call(str, i) >= kUTF16SurrogateThreshold \? 2 : 1;\n};\nfunction* emitKeys(stream) {\n while (!0) {\n var ch = yield, s = ch, escaped = !1, keySeq = null, keyName, keyCtrl2 = !1, keyMeta = !1, keyShift = !1;\n if (ch === kEscape) {\n if (escaped = !0, s += ch = yield, ch === kEscape)\n s += ch = yield;\n }\n if (escaped && (ch === \"O\" || ch === \"[\")) {\n var code = ch, modifier = 0;\n if (ch === \"O\") {\n if (s += ch = yield, ch >= \"0\" && ch <= \"9\")\n modifier = (ch >> 0) - 1, s += ch = yield;\n code += ch;\n } else if (ch === \"[\") {\n if (s += ch = yield, ch === \"[\")\n code += ch, s += ch = yield;\n var cmdStart = s.length - 1;\n if (ch >= \"0\" && ch <= \"9\") {\n if (s += ch = yield, ch >= \"0\" && ch <= \"9\")\n s += ch = yield;\n }\n if (ch === \";\") {\n if (s += ch = yield, ch >= \"0\" && ch <= \"9\")\n s += yield;\n }\n var cmd = StringPrototypeSlice.@call(s, cmdStart), match;\n if (match = RegExpPrototypeExec.@call(/^(\\d\\d\?)(;(\\d))\?([~^$])$/, cmd))\n code += match[1] + match[4], modifier = (match[3] || 1) - 1;\n else if (match = RegExpPrototypeExec.@call(/^((\\d;)\?(\\d))\?([A-Za-z])$/, cmd))\n code += match[4], modifier = (match[3] || 1) - 1;\n else\n code += cmd;\n }\n switch (keyCtrl2 = !!(modifier & 4), keyMeta = !!(modifier & 10), keyShift = !!(modifier & 1), code) {\n case \"[P\":\n keyName = \"f1\";\n break;\n case \"[Q\":\n keyName = \"f2\";\n break;\n case \"[R\":\n keyName = \"f3\";\n break;\n case \"[S\":\n keyName = \"f4\";\n break;\n case \"OP\":\n keyName = \"f1\";\n break;\n case \"OQ\":\n keyName = \"f2\";\n break;\n case \"OR\":\n keyName = \"f3\";\n break;\n case \"OS\":\n keyName = \"f4\";\n break;\n case \"[11~\":\n keyName = \"f1\";\n break;\n case \"[12~\":\n keyName = \"f2\";\n break;\n case \"[13~\":\n keyName = \"f3\";\n break;\n case \"[14~\":\n keyName = \"f4\";\n break;\n case \"[[A\":\n keyName = \"f1\";\n break;\n case \"[[B\":\n keyName = \"f2\";\n break;\n case \"[[C\":\n keyName = \"f3\";\n break;\n case \"[[D\":\n keyName = \"f4\";\n break;\n case \"[[E\":\n keyName = \"f5\";\n break;\n case \"[15~\":\n keyName = \"f5\";\n break;\n case \"[17~\":\n keyName = \"f6\";\n break;\n case \"[18~\":\n keyName = \"f7\";\n break;\n case \"[19~\":\n keyName = \"f8\";\n break;\n case \"[20~\":\n keyName = \"f9\";\n break;\n case \"[21~\":\n keyName = \"f10\";\n break;\n case \"[23~\":\n keyName = \"f11\";\n break;\n case \"[24~\":\n keyName = \"f12\";\n break;\n case \"[A\":\n keyName = \"up\";\n break;\n case \"[B\":\n keyName = \"down\";\n break;\n case \"[C\":\n keyName = \"right\";\n break;\n case \"[D\":\n keyName = \"left\";\n break;\n case \"[E\":\n keyName = \"clear\";\n break;\n case \"[F\":\n keyName = \"end\";\n break;\n case \"[H\":\n keyName = \"home\";\n break;\n case \"OA\":\n keyName = \"up\";\n break;\n case \"OB\":\n keyName = \"down\";\n break;\n case \"OC\":\n keyName = \"right\";\n break;\n case \"OD\":\n keyName = \"left\";\n break;\n case \"OE\":\n keyName = \"clear\";\n break;\n case \"OF\":\n keyName = \"end\";\n break;\n case \"OH\":\n keyName = \"home\";\n break;\n case \"[1~\":\n keyName = \"home\";\n break;\n case \"[2~\":\n keyName = \"insert\";\n break;\n case \"[3~\":\n keyName = \"delete\";\n break;\n case \"[4~\":\n keyName = \"end\";\n break;\n case \"[5~\":\n keyName = \"pageup\";\n break;\n case \"[6~\":\n keyName = \"pagedown\";\n break;\n case \"[[5~\":\n keyName = \"pageup\";\n break;\n case \"[[6~\":\n keyName = \"pagedown\";\n break;\n case \"[7~\":\n keyName = \"home\";\n break;\n case \"[8~\":\n keyName = \"end\";\n break;\n case \"[a\":\n keyName = \"up\", keyShift = !0;\n break;\n case \"[b\":\n keyName = \"down\", keyShift = !0;\n break;\n case \"[c\":\n keyName = \"right\", keyShift = !0;\n break;\n case \"[d\":\n keyName = \"left\", keyShift = !0;\n break;\n case \"[e\":\n keyName = \"clear\", keyShift = !0;\n break;\n case \"[2$\":\n keyName = \"insert\", keyShift = !0;\n break;\n case \"[3$\":\n keyName = \"delete\", keyShift = !0;\n break;\n case \"[5$\":\n keyName = \"pageup\", keyShift = !0;\n break;\n case \"[6$\":\n keyName = \"pagedown\", keyShift = !0;\n break;\n case \"[7$\":\n keyName = \"home\", keyShift = !0;\n break;\n case \"[8$\":\n keyName = \"end\", keyShift = !0;\n break;\n case \"Oa\":\n keyName = \"up\", keyCtrl2 = !0;\n break;\n case \"Ob\":\n keyName = \"down\", keyCtrl2 = !0;\n break;\n case \"Oc\":\n keyName = \"right\", keyCtrl2 = !0;\n break;\n case \"Od\":\n keyName = \"left\", keyCtrl2 = !0;\n break;\n case \"Oe\":\n keyName = \"clear\", keyCtrl2 = !0;\n break;\n case \"[2^\":\n keyName = \"insert\", keyCtrl2 = !0;\n break;\n case \"[3^\":\n keyName = \"delete\", keyCtrl2 = !0;\n break;\n case \"[5^\":\n keyName = \"pageup\", keyCtrl2 = !0;\n break;\n case \"[6^\":\n keyName = \"pagedown\", keyCtrl2 = !0;\n break;\n case \"[7^\":\n keyName = \"home\", keyCtrl2 = !0;\n break;\n case \"[8^\":\n keyName = \"end\", keyCtrl2 = !0;\n break;\n case \"[Z\":\n keyName = \"tab\", keyShift = !0;\n break;\n default:\n keyName = \"undefined\";\n break;\n }\n } else if (ch === \"\\r\")\n keyName = \"return\", keyMeta = escaped;\n else if (ch === \"\\n\")\n keyName = \"enter\", keyMeta = escaped;\n else if (ch === \"\\t\")\n keyName = \"tab\", keyMeta = escaped;\n else if (ch === \"\\b\" || ch === \"\\x7F\")\n keyName = \"backspace\", keyMeta = escaped;\n else if (ch === kEscape)\n keyName = \"escape\", keyMeta = escaped;\n else if (ch === \" \")\n keyName = \"space\", keyMeta = escaped;\n else if (!escaped && ch <= \"\\x1A\")\n keyName = StringFromCharCode(StringPrototypeCharCodeAt.@call(ch) + StringPrototypeCharCodeAt.@call(\"a\") - 1), keyCtrl2 = !0;\n else if (RegExpPrototypeExec.@call(/^[0-9A-Za-z]$/, ch) !== null)\n keyName = StringPrototypeToLowerCase.@call(ch), keyShift = RegExpPrototypeExec.@call(/^[A-Z]$/, ch) !== null, keyMeta = escaped;\n else if (escaped)\n keyName = ch.length \? @undefined : \"escape\", keyMeta = !0;\n else\n keyName = @undefined;\n if (keySeq = s, s.length !== 0 && (keyName !== @undefined || escaped))\n stream.emit(\"keypress\", escaped \? @undefined : s, {\n sequence: keySeq,\n name: keyName,\n ctrl: keyCtrl2,\n meta: keyMeta,\n shift: keyShift\n });\n else if (charLengthAt(s, 0) === s.length)\n stream.emit(\"keypress\", s, {\n sequence: keySeq,\n name: keyName,\n ctrl: keyCtrl2,\n meta: keyMeta,\n shift: keyShift\n });\n }\n}\nvar commonPrefix = function(strings) {\n if (strings.length === 0)\n return \"\";\n if (strings.length === 1)\n return strings[0];\n var sorted = ArrayPrototypeSort.@call(ArrayPrototypeSlice.@call(strings)), min = sorted[0], max = sorted[sorted.length - 1];\n for (var i = 0;i < min.length; i++)\n if (min[i] !== max[i])\n return StringPrototypeSlice.@call(min, 0, i);\n return min;\n}, cursorTo = function(stream, x, y, callback) {\n if (callback !== @undefined)\n validateFunction(callback, \"callback\");\n if (typeof y === \"function\")\n callback = y, y = @undefined;\n if (NumberIsNaN(x))\n throw new ERR_INVALID_ARG_VALUE(\"x\", x);\n if (NumberIsNaN(y))\n throw new ERR_INVALID_ARG_VALUE(\"y\", y);\n if (stream == null || typeof x !== \"number\" && typeof y !== \"number\") {\n if (typeof callback === \"function\")\n process.nextTick(callback, null);\n return !0;\n }\n if (typeof x !== \"number\")\n throw new ERR_INVALID_CURSOR_POS;\n var data = typeof y !== \"number\" \? CSI`${x + 1}G` : CSI`${y + 1};${x + 1}H`;\n return stream.write(data, callback);\n}, moveCursor = function(stream, dx, dy, callback) {\n if (callback !== @undefined)\n validateFunction(callback, \"callback\");\n if (stream == null || !(dx || dy)) {\n if (typeof callback === \"function\")\n process.nextTick(callback, null);\n return !0;\n }\n var data = \"\";\n if (dx < 0)\n data += CSI`${-dx}D`;\n else if (dx > 0)\n data += CSI`${dx}C`;\n if (dy < 0)\n data += CSI`${-dy}A`;\n else if (dy > 0)\n data += CSI`${dy}B`;\n return stream.write(data, callback);\n}, clearLine = function(stream, dir, callback) {\n if (callback !== @undefined)\n validateFunction(callback, \"callback\");\n if (stream === null || stream === @undefined) {\n if (typeof callback === \"function\")\n process.nextTick(callback, null);\n return !0;\n }\n var type = dir < 0 \? kClearToLineBeginning : dir > 0 \? kClearToLineEnd : kClearLine;\n return stream.write(type, callback);\n}, clearScreenDown = function(stream, callback) {\n if (callback !== @undefined)\n validateFunction(callback, \"callback\");\n if (stream === null || stream === @undefined) {\n if (typeof callback === \"function\")\n process.nextTick(callback, null);\n return !0;\n }\n return stream.write(kClearScreenDown, callback);\n}, emitKeypressEvents = function(stream, iface = {}) {\n if (stream[KEYPRESS_DECODER])\n return;\n stream[KEYPRESS_DECODER] = new StringDecoder(\"utf8\"), stream[ESCAPE_DECODER] = emitKeys(stream), stream[ESCAPE_DECODER].next();\n var triggerEscape = () => stream[ESCAPE_DECODER].next(\"\"), { escapeCodeTimeout = ESCAPE_CODE_TIMEOUT } = iface, timeoutId;\n function onData(input) {\n if (stream.listenerCount(\"keypress\") > 0) {\n var string = stream[KEYPRESS_DECODER].write(input);\n if (string) {\n clearTimeout(timeoutId), iface[kSawKeyPress] = charLengthAt(string, 0) === string.length, iface.isCompletionEnabled = !1;\n var length = 0;\n for (var character of new SafeStringIterator(string)) {\n if (length += character.length, length === string.length)\n iface.isCompletionEnabled = !0;\n try {\n if (stream[ESCAPE_DECODER].next(character), length === string.length && character === kEscape)\n timeoutId = setTimeout(triggerEscape, escapeCodeTimeout);\n } catch (err) {\n throw stream[ESCAPE_DECODER] = emitKeys(stream), stream[ESCAPE_DECODER].next(), err;\n }\n }\n }\n } else\n stream.removeListener(\"data\", onData), stream.on(\"newListener\", onNewListener);\n }\n function onNewListener(event) {\n if (event === \"keypress\")\n stream.on(\"data\", onData), stream.removeListener(\"newListener\", onNewListener);\n }\n if (stream.listenerCount(\"keypress\") > 0)\n stream.on(\"data\", onData);\n else\n stream.on(\"newListener\", onNewListener);\n}, onSelfCloseWithTerminal = function() {\n var input = this.input, output = this.output;\n if (!input)\n throw new Error(\"Input not set, invalid state for readline!\");\n if (input.removeListener(\"keypress\", this[kOnKeyPress]), input.removeListener(\"error\", this[kOnError]), input.removeListener(\"end\", this[kOnTermEnd]), output !== null && output !== @undefined)\n output.removeListener(\"resize\", this[kOnResize]);\n}, onSelfCloseWithoutTerminal = function() {\n var input = this.input;\n if (!input)\n throw new Error(\"Input not set, invalid state for readline!\");\n input.removeListener(\"data\", this[kOnData]), input.removeListener(\"error\", this[kOnError]), input.removeListener(\"end\", this[kOnEnd]);\n}, onError = function(err) {\n this.emit(\"error\", err);\n}, onData = function(data) {\n debug(\"onData\"), this[kNormalWrite](data);\n}, onEnd = function() {\n if (debug(\"onEnd\"), typeof this[kLine_buffer] === \"string\" && this[kLine_buffer].length > 0)\n this.emit(\"line\", this[kLine_buffer]);\n this.close();\n}, onTermEnd = function() {\n if (debug(\"onTermEnd\"), typeof this.line === \"string\" && this.line.length > 0)\n this.emit(\"line\", this.line);\n this.close();\n}, onKeyPress = function(s, key) {\n if (this[kTtyWrite](s, key), key && key.sequence) {\n var ch = StringPrototypeCodePointAt.@call(key.sequence, 0);\n if (ch >= 55296 && ch <= 57343)\n this[kRefreshLine]();\n }\n}, onResize = function() {\n this[kRefreshLine]();\n}, InterfaceConstructor = function(input, output, completer, terminal) {\n if (!(this instanceof InterfaceConstructor))\n return new InterfaceConstructor(input, output, completer, terminal);\n EventEmitter.@call(this), this[kOnSelfCloseWithoutTerminal] = onSelfCloseWithoutTerminal.bind(this), this[kOnSelfCloseWithTerminal] = onSelfCloseWithTerminal.bind(this), this[kOnError] = onError.bind(this), this[kOnData] = onData.bind(this), this[kOnEnd] = onEnd.bind(this), this[kOnTermEnd] = onTermEnd.bind(this), this[kOnKeyPress] = onKeyPress.bind(this), this[kOnResize] = onResize.bind(this), this[kSawReturnAt] = 0, this.isCompletionEnabled = !0, this[kSawKeyPress] = !1, this[kPreviousKey] = null, this.escapeCodeTimeout = ESCAPE_CODE_TIMEOUT, this.tabSize = 8;\n var history, historySize, removeHistoryDuplicates = !1, crlfDelay, prompt = \"> \", signal;\n if (input\?.input) {\n output = input.output, completer = input.completer, terminal = input.terminal, history = input.history, historySize = input.historySize, signal = input.signal;\n var tabSize = input.tabSize;\n if (tabSize !== @undefined)\n validateUint32(tabSize, \"tabSize\", !0), this.tabSize = tabSize;\n removeHistoryDuplicates = input.removeHistoryDuplicates;\n var inputPrompt = input.prompt;\n if (inputPrompt !== @undefined)\n prompt = inputPrompt;\n var inputEscapeCodeTimeout = input.escapeCodeTimeout;\n if (inputEscapeCodeTimeout !== @undefined)\n if (NumberIsFinite(inputEscapeCodeTimeout))\n this.escapeCodeTimeout = inputEscapeCodeTimeout;\n else\n throw new ERR_INVALID_ARG_VALUE(\"input.escapeCodeTimeout\", this.escapeCodeTimeout);\n if (signal)\n validateAbortSignal(signal, \"options.signal\");\n crlfDelay = input.crlfDelay, input = input.input;\n }\n if (completer !== @undefined && typeof completer !== \"function\")\n throw new ERR_INVALID_ARG_VALUE(\"completer\", completer);\n if (history === @undefined)\n history = [];\n else\n validateArray(history, \"history\");\n if (historySize === @undefined)\n historySize = kHistorySize;\n if (typeof historySize !== \"number\" || NumberIsNaN(historySize) || historySize < 0)\n throw new ERR_INVALID_ARG_VALUE(\"historySize\", historySize);\n if (terminal === @undefined && !(output === null || output === @undefined))\n terminal = !!output.isTTY;\n if (this.line = \"\", this[kSubstringSearch] = null, this.output = output, this.input = input, this[kUndoStack] = [], this[kRedoStack] = [], this.history = history, this.historySize = historySize, this[kKillRing] = [], this[kKillRingCursor] = 0, this.removeHistoryDuplicates = !!removeHistoryDuplicates, this.crlfDelay = crlfDelay \? MathMax(kMincrlfDelay, crlfDelay) : kMincrlfDelay, this.completer = completer, this.setPrompt(prompt), this.terminal = !!terminal, this[kLineObjectStream] = @undefined, input.on(\"error\", this[kOnError]), !this.terminal)\n input.on(\"data\", this[kOnData]), input.on(\"end\", this[kOnEnd]), this.once(\"close\", this[kOnSelfCloseWithoutTerminal]), this[kDecoder] = new StringDecoder(\"utf8\");\n else {\n if (emitKeypressEvents(input, this), input.on(\"keypress\", this[kOnKeyPress]), input.on(\"end\", this[kOnTermEnd]), this[kSetRawMode](!0), this.terminal = !0, this.cursor = 0, this.historyIndex = -1, output !== null && output !== @undefined)\n output.on(\"resize\", this[kOnResize]);\n this.once(\"close\", this[kOnSelfCloseWithTerminal]);\n }\n if (signal) {\n var onAborted = (() => this.close()).bind(this);\n if (signal.aborted)\n process.nextTick(onAborted);\n else\n signal.addEventListener(\"abort\", onAborted, { once: !0 }), this.once(\"close\", () => signal.removeEventListener(\"abort\", onAborted));\n }\n this.line = \"\", input.resume();\n}, Interface = function(input, output, completer, terminal) {\n if (!(this instanceof Interface))\n return new Interface(input, output, completer, terminal);\n if (input\?.input && typeof input.completer === \"function\" && input.completer.length !== 2) {\n var { completer } = input;\n input.completer = (v, cb) => cb(null, completer(v));\n } else if (typeof completer === \"function\" && completer.length !== 2) {\n var realCompleter = completer;\n completer = (v, cb) => cb(null, realCompleter(v));\n }\n InterfaceConstructor.@call(this, input, output, completer, terminal);\n}, createInterface = function(input, output, completer, terminal) {\n return new Interface(input, output, completer, terminal);\n};\nvar $, EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20), { StringDecoder } = @requireNativeModule(\"string_decoder\"), isWritable, { inspect } = Bun, debug = process.env.BUN_JS_DEBUG \? console.log : () => {\n}, SymbolAsyncIterator = Symbol.asyncIterator, SymbolIterator = Symbol.iterator, SymbolFor = Symbol.for, SymbolReplace = Symbol.replace, ArrayFrom = @Array.from, ArrayIsArray = @Array.isArray, ArrayPrototypeFilter = @Array.prototype.filter, ArrayPrototypeSort = @Array.prototype.sort, ArrayPrototypeIndexOf = @Array.prototype.indexOf, ArrayPrototypeJoin = @Array.prototype.join, ArrayPrototypeMap = @Array.prototype.map, ArrayPrototypePop = @Array.prototype.pop, ArrayPrototypePush = @Array.prototype.push, ArrayPrototypeSlice = @Array.prototype.slice, ArrayPrototypeSplice = @Array.prototype.splice, ArrayPrototypeReverse = @Array.prototype.reverse, ArrayPrototypeShift = @Array.prototype.shift, ArrayPrototypeUnshift = @Array.prototype.unshift, RegExpPrototypeExec = @RegExp.prototype.exec, RegExpPrototypeSymbolReplace = @RegExp.prototype[SymbolReplace], StringFromCharCode = @String.fromCharCode, StringPrototypeCharCodeAt = @String.prototype.charCodeAt, StringPrototypeCodePointAt = @String.prototype.codePointAt, StringPrototypeSlice = @String.prototype.slice, StringPrototypeToLowerCase = @String.prototype.toLowerCase, StringPrototypeEndsWith = @String.prototype.endsWith, StringPrototypeRepeat = @String.prototype.repeat, StringPrototypeStartsWith = @String.prototype.startsWith, StringPrototypeTrim = @String.prototype.trim, StringPrototypeNormalize = @String.prototype.normalize, NumberIsNaN = Number.isNaN, NumberIsFinite = Number.isFinite, NumberIsInteger = Number.isInteger, NumberMAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER, NumberMIN_SAFE_INTEGER = Number.MIN_SAFE_INTEGER, MathCeil = Math.ceil, MathFloor = Math.floor, MathMax = Math.max, DateNow = Date.now, FunctionPrototype = Function.prototype, StringPrototype = @String.prototype, StringPrototypeSymbolIterator = StringPrototype[SymbolIterator], StringIteratorPrototypeNext = StringPrototypeSymbolIterator.@call(\"\").next, ObjectSetPrototypeOf = Object.setPrototypeOf, ObjectDefineProperty = Object.defineProperty, ObjectDefineProperties = Object.defineProperties, ObjectFreeze = Object.freeze;\nvar { create: ObjectCreate, keys: ObjectKeys } = Object;\nvar createSafeIterator = (factory, next) => {\n class SafeIterator {\n #iterator;\n constructor(iterable) {\n this.#iterator = factory.@call(iterable);\n }\n next() {\n return next.@call(this.#iterator);\n }\n [SymbolIterator]() {\n return this;\n }\n }\n return ObjectSetPrototypeOf(SafeIterator.prototype, null), ObjectFreeze(SafeIterator.prototype), ObjectFreeze(SafeIterator), SafeIterator;\n}, SafeStringIterator = createSafeIterator(StringPrototypeSymbolIterator, StringIteratorPrototypeNext), isFullWidthCodePoint = (code) => {\n return code >= 4352 && (code <= 4447 || code === 9001 || code === 9002 || code >= 11904 && code <= 12871 && code !== 12351 || code >= 12880 && code <= 19903 || code >= 19968 && code <= 42182 || code >= 43360 && code <= 43388 || code >= 44032 && code <= 55203 || code >= 63744 && code <= 64255 || code >= 65040 && code <= 65049 || code >= 65072 && code <= 65131 || code >= 65281 && code <= 65376 || code >= 65504 && code <= 65510 || code >= 110592 && code <= 110593 || code >= 127488 && code <= 127569 || code >= 127744 && code <= 128591 || code >= 131072 && code <= 262141);\n}, isZeroWidthCodePoint = (code) => {\n return code <= 31 || code >= 127 && code <= 159 || code >= 768 && code <= 879 || code >= 8203 && code <= 8207 || code >= 8400 && code <= 8447 || code >= 65024 && code <= 65039 || code >= 65056 && code <= 65071 || code >= 917760 && code <= 917999;\n}, getStringWidth = function getStringWidth2(str, removeControlChars = !0) {\n var width = 0;\n if (removeControlChars)\n str = stripVTControlCharacters(str);\n str = StringPrototypeNormalize.@call(str, \"NFC\");\n for (var char of new SafeStringIterator(str)) {\n var code = StringPrototypeCodePointAt.@call(char, 0);\n if (isFullWidthCodePoint(code))\n width += 2;\n else if (!isZeroWidthCodePoint(code))\n width++;\n }\n return width;\n}, ansiPattern = \"[\\\\u001B\\\\u009B][[\\\\]()#;\?]*(\?:(\?:(\?:(\?:;[-a-zA-Z\\\\d\\\\/#&.:=\?%@~_]+)*|[a-zA-Z\\\\d]+(\?:;[-a-zA-Z\\\\d\\\\/#&.:=\?%@~_]*)*)\?\\\\u0007)|(\?:(\?:\\\\d{1,4}(\?:;\\\\d{0,4})*)\?[\\\\dA-PR-TZcf-ntqry=><~]))\", ansi = new @RegExp(ansiPattern, \"g\"), kCustomPromisifiedSymbol = SymbolFor(\"nodejs.util.promisify.custom\"), kCustomPromisifyArgsSymbol = Symbol(\"customPromisifyArgs\");\npromisify.custom = kCustomPromisifiedSymbol;\nvar kUTF16SurrogateThreshold = 65536, kEscape = \"\\x1B\", kSubstringSearch = Symbol(\"kSubstringSearch\"), kIsNodeError = Symbol(\"kIsNodeError\"), errorBases = {}, VALID_NODE_ERROR_BASES = {\n TypeError,\n RangeError,\n Error\n}, NodeError = getNodeErrorByName(\"Error\"), NodeTypeError = getNodeErrorByName(\"TypeError\"), NodeRangeError = getNodeErrorByName(\"RangeError\");\n\nclass ERR_INVALID_ARG_TYPE extends NodeTypeError {\n constructor(name, type, value) {\n super(`The \"${name}\" argument must be of type ${type}. Received type ${typeof value}`, {\n code: \"ERR_INVALID_ARG_TYPE\"\n });\n }\n}\n\nclass ERR_INVALID_ARG_VALUE extends NodeTypeError {\n constructor(name, value, reason = \"not specified\") {\n super(`The value \"${@String(value)}\" is invalid for argument '${name}'. Reason: ${reason}`, {\n code: \"ERR_INVALID_ARG_VALUE\"\n });\n }\n}\n\nclass ERR_INVALID_CURSOR_POS extends NodeTypeError {\n constructor() {\n super(\"Cannot set cursor row without setting its column\", {\n code: \"ERR_INVALID_CURSOR_POS\"\n });\n }\n}\n\nclass ERR_OUT_OF_RANGE extends NodeRangeError {\n constructor(name, range, received) {\n super(`The value of \"${name}\" is out of range. It must be ${range}. Received ${received}`, {\n code: \"ERR_OUT_OF_RANGE\"\n });\n }\n}\n\nclass ERR_USE_AFTER_CLOSE extends NodeError {\n constructor() {\n super(\"This socket has been ended by the other party\", {\n code: \"ERR_USE_AFTER_CLOSE\"\n });\n }\n}\n\nclass AbortError extends Error {\n code;\n constructor() {\n super(\"The operation was aborted\");\n this.code = \"ABORT_ERR\";\n }\n}\nvar kClearLine, kClearScreenDown, kClearToLineBeginning, kClearToLineEnd;\nCSI.kEscape = kEscape;\nCSI.kClearLine = kClearLine = CSI`2K`;\nCSI.kClearScreenDown = kClearScreenDown = CSI`0J`;\nCSI.kClearToLineBeginning = kClearToLineBeginning = CSI`1K`;\nCSI.kClearToLineEnd = kClearToLineEnd = CSI`0K`;\nvar KEYPRESS_DECODER = Symbol(\"keypress-decoder\"), ESCAPE_DECODER = Symbol(\"escape-decoder\"), ESCAPE_CODE_TIMEOUT = 500, kEmptyObject = ObjectFreeze(ObjectCreate(null)), kHistorySize = 30, kMaxUndoRedoStackSize = 2048, kMincrlfDelay = 100, lineEnding = /\\r\?\\n|\\r(\?!\\n)/g, kMaxLengthOfKillRing = 32, kLineObjectStream = Symbol(\"line object stream\"), kQuestionCancel = Symbol(\"kQuestionCancel\"), kQuestion = Symbol(\"kQuestion\"), kAddHistory = Symbol(\"_addHistory\"), kBeforeEdit = Symbol(\"_beforeEdit\"), kDecoder = Symbol(\"_decoder\"), kDeleteLeft = Symbol(\"_deleteLeft\"), kDeleteLineLeft = Symbol(\"_deleteLineLeft\"), kDeleteLineRight = Symbol(\"_deleteLineRight\"), kDeleteRight = Symbol(\"_deleteRight\"), kDeleteWordLeft = Symbol(\"_deleteWordLeft\"), kDeleteWordRight = Symbol(\"_deleteWordRight\"), kGetDisplayPos = Symbol(\"_getDisplayPos\"), kHistoryNext = Symbol(\"_historyNext\"), kHistoryPrev = Symbol(\"_historyPrev\"), kInsertString = Symbol(\"_insertString\"), kLine = Symbol(\"_line\"), kLine_buffer = Symbol(\"_line_buffer\"), kKillRing = Symbol(\"_killRing\"), kKillRingCursor = Symbol(\"_killRingCursor\"), kMoveCursor = Symbol(\"_moveCursor\"), kNormalWrite = Symbol(\"_normalWrite\"), kOldPrompt = Symbol(\"_oldPrompt\"), kOnLine = Symbol(\"_onLine\"), kPreviousKey = Symbol(\"_previousKey\"), kPrompt = Symbol(\"_prompt\"), kPushToKillRing = Symbol(\"_pushToKillRing\"), kPushToUndoStack = Symbol(\"_pushToUndoStack\"), kQuestionCallback = Symbol(\"_questionCallback\"), kRedo = Symbol(\"_redo\"), kRedoStack = Symbol(\"_redoStack\"), kRefreshLine = Symbol(\"_refreshLine\"), kSawKeyPress = Symbol(\"_sawKeyPress\"), kSawReturnAt = Symbol(\"_sawReturnAt\"), kSetRawMode = Symbol(\"_setRawMode\"), kTabComplete = Symbol(\"_tabComplete\"), kTabCompleter = Symbol(\"_tabCompleter\"), kTtyWrite = Symbol(\"_ttyWrite\"), kUndo = Symbol(\"_undo\"), kUndoStack = Symbol(\"_undoStack\"), kWordLeft = Symbol(\"_wordLeft\"), kWordRight = Symbol(\"_wordRight\"), kWriteToOutput = Symbol(\"_writeToOutput\"), kYank = Symbol(\"_yank\"), kYanking = Symbol(\"_yanking\"), kYankPop = Symbol(\"_yankPop\"), kFirstEventParam = Symbol(\"nodejs.kFirstEventParam\"), kOnSelfCloseWithTerminal = Symbol(\"_onSelfCloseWithTerminal\"), kOnSelfCloseWithoutTerminal = Symbol(\"_onSelfCloseWithoutTerminal\"), kOnKeyPress = Symbol(\"_onKeyPress\"), kOnError = Symbol(\"_onError\"), kOnData = Symbol(\"_onData\"), kOnEnd = Symbol(\"_onEnd\"), kOnTermEnd = Symbol(\"_onTermEnd\"), kOnResize = Symbol(\"_onResize\");\nInterfaceConstructor.prototype = {};\nObjectSetPrototypeOf(InterfaceConstructor.prototype, EventEmitter.prototype);\nvar _Interface = class Interface2 extends InterfaceConstructor {\n constructor(input, output, completer, terminal) {\n super(input, output, completer, terminal);\n }\n get columns() {\n var output = this.output;\n if (output && output.columns)\n return output.columns;\n return @Infinity;\n }\n setPrompt(prompt) {\n this[kPrompt] = prompt;\n }\n getPrompt() {\n return this[kPrompt];\n }\n [kSetRawMode](flag) {\n const mode = flag + 0, wasInRawMode = this.input.isRaw;\n var setRawMode = this.input.setRawMode;\n if (typeof setRawMode === \"function\")\n setRawMode.@call(this.input, mode);\n return wasInRawMode;\n }\n prompt(preserveCursor) {\n if (this.paused)\n this.resume();\n if (this.terminal) {\n if (!preserveCursor)\n this.cursor = 0;\n this[kRefreshLine]();\n } else\n this[kWriteToOutput](this[kPrompt]);\n }\n [kQuestion](query, cb) {\n if (this.closed)\n throw new ERR_USE_AFTER_CLOSE(\"readline\");\n if (this[kQuestionCallback])\n this.prompt();\n else\n this[kOldPrompt] = this[kPrompt], this.setPrompt(query), this[kQuestionCallback] = cb, this.prompt();\n }\n [kOnLine](line) {\n if (this[kQuestionCallback]) {\n var cb = this[kQuestionCallback];\n this[kQuestionCallback] = null, this.setPrompt(this[kOldPrompt]), cb(line);\n } else\n this.emit(\"line\", line);\n }\n [kBeforeEdit](oldText, oldCursor) {\n this[kPushToUndoStack](oldText, oldCursor);\n }\n [kQuestionCancel]() {\n if (this[kQuestionCallback])\n this[kQuestionCallback] = null, this.setPrompt(this[kOldPrompt]), this.clearLine();\n }\n [kWriteToOutput](stringToWrite) {\n if (validateString(stringToWrite, \"stringToWrite\"), this.output !== null && this.output !== @undefined)\n this.output.write(stringToWrite);\n }\n [kAddHistory]() {\n if (this.line.length === 0)\n return \"\";\n if (this.historySize === 0)\n return this.line;\n if (StringPrototypeTrim.@call(this.line).length === 0)\n return this.line;\n if (this.history.length === 0 || this.history[0] !== this.line) {\n if (this.removeHistoryDuplicates) {\n var dupIndex = ArrayPrototypeIndexOf.@call(this.history, this.line);\n if (dupIndex !== -1)\n ArrayPrototypeSplice.@call(this.history, dupIndex, 1);\n }\n if (ArrayPrototypeUnshift.@call(this.history, this.line), this.history.length > this.historySize)\n ArrayPrototypePop.@call(this.history);\n }\n this.historyIndex = -1;\n var line = this.history[0];\n return this.emit(\"history\", this.history), line;\n }\n [kRefreshLine]() {\n var line = this[kPrompt] + this.line, dispPos = this[kGetDisplayPos](line), lineCols = dispPos.cols, lineRows = dispPos.rows, cursorPos = this.getCursorPos(), prevRows = this.prevRows || 0;\n if (prevRows > 0)\n moveCursor(this.output, 0, -prevRows);\n if (cursorTo(this.output, 0), clearScreenDown(this.output), this[kWriteToOutput](line), lineCols === 0)\n this[kWriteToOutput](\" \");\n cursorTo(this.output, cursorPos.cols);\n var diff = lineRows - cursorPos.rows;\n if (diff > 0)\n moveCursor(this.output, 0, -diff);\n this.prevRows = cursorPos.rows;\n }\n close() {\n if (this.closed)\n return;\n if (this.pause(), this.terminal)\n this[kSetRawMode](!1);\n this.closed = !0, this.emit(\"close\");\n }\n pause() {\n if (this.paused)\n return;\n return this.input.pause(), this.paused = !0, this.emit(\"pause\"), this;\n }\n resume() {\n if (!this.paused)\n return;\n return this.input.resume(), this.paused = !1, this.emit(\"resume\"), this;\n }\n write(d, key) {\n if (this.paused)\n this.resume();\n if (this.terminal)\n this[kTtyWrite](d, key);\n else\n this[kNormalWrite](d);\n }\n [kNormalWrite](b) {\n if (b === @undefined)\n return;\n var string = this[kDecoder].write(b);\n if (this[kSawReturnAt] && DateNow() - this[kSawReturnAt] <= this.crlfDelay) {\n if (StringPrototypeCodePointAt.@call(string) === 10)\n string = StringPrototypeSlice.@call(string, 1);\n this[kSawReturnAt] = 0;\n }\n var newPartContainsEnding = RegExpPrototypeExec.@call(lineEnding, string);\n if (newPartContainsEnding !== null) {\n if (this[kLine_buffer])\n string = this[kLine_buffer] + string, this[kLine_buffer] = null, newPartContainsEnding = RegExpPrototypeExec.@call(lineEnding, string);\n this[kSawReturnAt] = StringPrototypeEndsWith.@call(string, \"\\r\") \? DateNow() : 0;\n var indexes = [0, newPartContainsEnding.index, lineEnding.lastIndex], nextMatch;\n while ((nextMatch = RegExpPrototypeExec.@call(lineEnding, string)) !== null)\n ArrayPrototypePush.@call(indexes, nextMatch.index, lineEnding.lastIndex);\n var lastIndex = indexes.length - 1;\n this[kLine_buffer] = StringPrototypeSlice.@call(string, indexes[lastIndex]);\n for (var i = 1;i < lastIndex; i += 2)\n this[kOnLine](StringPrototypeSlice.@call(string, indexes[i - 1], indexes[i]));\n } else if (string)\n if (this[kLine_buffer])\n this[kLine_buffer] += string;\n else\n this[kLine_buffer] = string;\n }\n [kInsertString](c) {\n if (this[kBeforeEdit](this.line, this.cursor), this.cursor < this.line.length) {\n var beg = StringPrototypeSlice.@call(this.line, 0, this.cursor), end = StringPrototypeSlice.@call(this.line, this.cursor, this.line.length);\n this.line = beg + c + end, this.cursor += c.length, this[kRefreshLine]();\n } else {\n var oldPos = this.getCursorPos();\n this.line += c, this.cursor += c.length;\n var newPos = this.getCursorPos();\n if (oldPos.rows < newPos.rows)\n this[kRefreshLine]();\n else\n this[kWriteToOutput](c);\n }\n }\n async[kTabComplete](lastKeypressWasTab) {\n this.pause();\n var string = StringPrototypeSlice.@call(this.line, 0, this.cursor), value;\n try {\n value = await this.completer(string);\n } catch (err) {\n this[kWriteToOutput](`Tab completion error: ${inspect(err)}`);\n return;\n } finally {\n this.resume();\n }\n this[kTabCompleter](lastKeypressWasTab, value);\n }\n [kTabCompleter](lastKeypressWasTab, { 0: completions, 1: completeOn }) {\n if (!completions || completions.length === 0)\n return;\n var prefix = commonPrefix(ArrayPrototypeFilter.@call(completions, (e) => e !== \"\"));\n if (StringPrototypeStartsWith.@call(prefix, completeOn) && prefix.length > completeOn.length) {\n this[kInsertString](StringPrototypeSlice.@call(prefix, completeOn.length));\n return;\n } else if (!StringPrototypeStartsWith.@call(completeOn, prefix)) {\n this.line = StringPrototypeSlice.@call(this.line, 0, this.cursor - completeOn.length) + prefix + StringPrototypeSlice.@call(this.line, this.cursor, this.line.length), this.cursor = this.cursor - completeOn.length + prefix.length, this._refreshLine();\n return;\n }\n if (!lastKeypressWasTab)\n return;\n this[kBeforeEdit](this.line, this.cursor);\n var completionsWidth = ArrayPrototypeMap.@call(completions, (e) => getStringWidth(e)), width = MathMax.@apply(completionsWidth) + 2, maxColumns = MathFloor(this.columns / width) || 1;\n if (maxColumns === @Infinity)\n maxColumns = 1;\n var output = \"\\r\\n\", lineIndex = 0, whitespace = 0;\n for (var i = 0;i < completions.length; i++) {\n var completion = completions[i];\n if (completion === \"\" || lineIndex === maxColumns)\n output += \"\\r\\n\", lineIndex = 0, whitespace = 0;\n else\n output += StringPrototypeRepeat.@call(\" \", whitespace);\n if (completion !== \"\")\n output += completion, whitespace = width - completionsWidth[i], lineIndex++;\n else\n output += \"\\r\\n\";\n }\n if (lineIndex !== 0)\n output += \"\\r\\n\\r\\n\";\n this[kWriteToOutput](output), this[kRefreshLine]();\n }\n [kWordLeft]() {\n if (this.cursor > 0) {\n var leading = StringPrototypeSlice.@call(this.line, 0, this.cursor), reversed = ArrayPrototypeJoin.@call(ArrayPrototypeReverse.@call(ArrayFrom(leading)), \"\"), match = RegExpPrototypeExec.@call(/^\\s*(\?:[^\\w\\s]+|\\w+)\?/, reversed);\n this[kMoveCursor](-match[0].length);\n }\n }\n [kWordRight]() {\n if (this.cursor < this.line.length) {\n var trailing = StringPrototypeSlice.@call(this.line, this.cursor), match = RegExpPrototypeExec.@call(/^(\?:\\s+|[^\\w\\s]+|\\w+)\\s*/, trailing);\n this[kMoveCursor](match[0].length);\n }\n }\n [kDeleteLeft]() {\n if (this.cursor > 0 && this.line.length > 0) {\n this[kBeforeEdit](this.line, this.cursor);\n var charSize = charLengthLeft(this.line, this.cursor);\n this.line = StringPrototypeSlice.@call(this.line, 0, this.cursor - charSize) + StringPrototypeSlice.@call(this.line, this.cursor, this.line.length), this.cursor -= charSize, this[kRefreshLine]();\n }\n }\n [kDeleteRight]() {\n if (this.cursor < this.line.length) {\n this[kBeforeEdit](this.line, this.cursor);\n var charSize = charLengthAt(this.line, this.cursor);\n this.line = StringPrototypeSlice.@call(this.line, 0, this.cursor) + StringPrototypeSlice.@call(this.line, this.cursor + charSize, this.line.length), this[kRefreshLine]();\n }\n }\n [kDeleteWordLeft]() {\n if (this.cursor > 0) {\n this[kBeforeEdit](this.line, this.cursor);\n var leading = StringPrototypeSlice.@call(this.line, 0, this.cursor), reversed = ArrayPrototypeJoin.@call(ArrayPrototypeReverse.@call(ArrayFrom(leading)), \"\"), match = RegExpPrototypeExec.@call(/^\\s*(\?:[^\\w\\s]+|\\w+)\?/, reversed);\n leading = StringPrototypeSlice.@call(leading, 0, leading.length - match[0].length), this.line = leading + StringPrototypeSlice.@call(this.line, this.cursor, this.line.length), this.cursor = leading.length, this[kRefreshLine]();\n }\n }\n [kDeleteWordRight]() {\n if (this.cursor < this.line.length) {\n this[kBeforeEdit](this.line, this.cursor);\n var trailing = StringPrototypeSlice.@call(this.line, this.cursor), match = RegExpPrototypeExec.@call(/^(\?:\\s+|\\W+|\\w+)\\s*/, trailing);\n this.line = StringPrototypeSlice.@call(this.line, 0, this.cursor) + StringPrototypeSlice.@call(trailing, match[0].length), this[kRefreshLine]();\n }\n }\n [kDeleteLineLeft]() {\n this[kBeforeEdit](this.line, this.cursor);\n var del = StringPrototypeSlice.@call(this.line, 0, this.cursor);\n this.line = StringPrototypeSlice.@call(this.line, this.cursor), this.cursor = 0, this[kPushToKillRing](del), this[kRefreshLine]();\n }\n [kDeleteLineRight]() {\n this[kBeforeEdit](this.line, this.cursor);\n var del = StringPrototypeSlice.@call(this.line, this.cursor);\n this.line = StringPrototypeSlice.@call(this.line, 0, this.cursor), this[kPushToKillRing](del), this[kRefreshLine]();\n }\n [kPushToKillRing](del) {\n if (!del || del === this[kKillRing][0])\n return;\n ArrayPrototypeUnshift.@call(this[kKillRing], del), this[kKillRingCursor] = 0;\n while (this[kKillRing].length > kMaxLengthOfKillRing)\n ArrayPrototypePop.@call(this[kKillRing]);\n }\n [kYank]() {\n if (this[kKillRing].length > 0)\n this[kYanking] = !0, this[kInsertString](this[kKillRing][this[kKillRingCursor]]);\n }\n [kYankPop]() {\n if (!this[kYanking])\n return;\n if (this[kKillRing].length > 1) {\n var lastYank = this[kKillRing][this[kKillRingCursor]];\n if (this[kKillRingCursor]++, this[kKillRingCursor] >= this[kKillRing].length)\n this[kKillRingCursor] = 0;\n var currentYank = this[kKillRing][this[kKillRingCursor]], head = StringPrototypeSlice.@call(this.line, 0, this.cursor - lastYank.length), tail = StringPrototypeSlice.@call(this.line, this.cursor);\n this.line = head + currentYank + tail, this.cursor = head.length + currentYank.length, this[kRefreshLine]();\n }\n }\n clearLine() {\n this[kMoveCursor](+@Infinity), this[kWriteToOutput](\"\\r\\n\"), this.line = \"\", this.cursor = 0, this.prevRows = 0;\n }\n [kLine]() {\n var line = this[kAddHistory]();\n this[kUndoStack] = [], this[kRedoStack] = [], this.clearLine(), this[kOnLine](line);\n }\n [kPushToUndoStack](text, cursor) {\n if (ArrayPrototypePush.@call(this[kUndoStack], { text, cursor }) > kMaxUndoRedoStackSize)\n ArrayPrototypeShift.@call(this[kUndoStack]);\n }\n [kUndo]() {\n if (this[kUndoStack].length <= 0)\n return;\n ArrayPrototypePush.@call(this[kRedoStack], {\n text: this.line,\n cursor: this.cursor\n });\n var entry = ArrayPrototypePop.@call(this[kUndoStack]);\n this.line = entry.text, this.cursor = entry.cursor, this[kRefreshLine]();\n }\n [kRedo]() {\n if (this[kRedoStack].length <= 0)\n return;\n ArrayPrototypePush.@call(this[kUndoStack], {\n text: this.line,\n cursor: this.cursor\n });\n var entry = ArrayPrototypePop.@call(this[kRedoStack]);\n this.line = entry.text, this.cursor = entry.cursor, this[kRefreshLine]();\n }\n [kHistoryNext]() {\n if (this.historyIndex >= 0) {\n this[kBeforeEdit](this.line, this.cursor);\n var search = this[kSubstringSearch] || \"\", index = this.historyIndex - 1;\n while (index >= 0 && (!StringPrototypeStartsWith.@call(this.history[index], search) || this.line === this.history[index]))\n index--;\n if (index === -1)\n this.line = search;\n else\n this.line = this.history[index];\n this.historyIndex = index, this.cursor = this.line.length, this[kRefreshLine]();\n }\n }\n [kHistoryPrev]() {\n if (this.historyIndex < this.history.length && this.history.length) {\n this[kBeforeEdit](this.line, this.cursor);\n var search = this[kSubstringSearch] || \"\", index = this.historyIndex + 1;\n while (index < this.history.length && (!StringPrototypeStartsWith.@call(this.history[index], search) || this.line === this.history[index]))\n index++;\n if (index === this.history.length)\n this.line = search;\n else\n this.line = this.history[index];\n this.historyIndex = index, this.cursor = this.line.length, this[kRefreshLine]();\n }\n }\n [kGetDisplayPos](str) {\n var offset = 0, col = this.columns, rows = 0;\n str = stripVTControlCharacters(str);\n for (var char of new SafeStringIterator(str)) {\n if (char === \"\\n\") {\n rows += MathCeil(offset / col) || 1, offset = 0;\n continue;\n }\n if (char === \"\\t\") {\n offset += this.tabSize - offset % this.tabSize;\n continue;\n }\n var width = getStringWidth(char, !1);\n if (width === 0 || width === 1)\n offset += width;\n else {\n if ((offset + 1) % col === 0)\n offset++;\n offset += 2;\n }\n }\n var cols = offset % col;\n return rows += (offset - cols) / col, { cols, rows };\n }\n getCursorPos() {\n var strBeforeCursor = this[kPrompt] + StringPrototypeSlice.@call(this.line, 0, this.cursor);\n return this[kGetDisplayPos](strBeforeCursor);\n }\n [kMoveCursor](dx) {\n if (dx === 0)\n return;\n var oldPos = this.getCursorPos();\n if (this.cursor += dx, this.cursor < 0)\n this.cursor = 0;\n else if (this.cursor > this.line.length)\n this.cursor = this.line.length;\n var newPos = this.getCursorPos();\n if (oldPos.rows === newPos.rows) {\n var diffWidth = newPos.cols - oldPos.cols;\n moveCursor(this.output, diffWidth, 0);\n } else\n this[kRefreshLine]();\n }\n [kTtyWrite](s, key) {\n var previousKey = this[kPreviousKey];\n key = key || kEmptyObject, this[kPreviousKey] = key;\n var { name: keyName, meta: keyMeta, ctrl: keyCtrl2, shift: keyShift, sequence: keySeq } = key;\n if (!keyMeta || keyName !== \"y\")\n this[kYanking] = !1;\n if ((keyName === \"up\" || keyName === \"down\") && !keyCtrl2 && !keyMeta && !keyShift) {\n if (this[kSubstringSearch] === null)\n this[kSubstringSearch] = StringPrototypeSlice.@call(this.line, 0, this.cursor);\n } else if (this[kSubstringSearch] !== null) {\n if (this[kSubstringSearch] = null, this.history.length === this.historyIndex)\n this.historyIndex = -1;\n }\n if (typeof keySeq === \"string\")\n switch (StringPrototypeCodePointAt.@call(keySeq, 0)) {\n case 31:\n this[kUndo]();\n return;\n case 30:\n this[kRedo]();\n return;\n default:\n break;\n }\n if (keyName === \"escape\")\n return;\n if (keyCtrl2 && keyShift)\n switch (keyName) {\n case \"backspace\":\n this[kDeleteLineLeft]();\n break;\n case \"delete\":\n this[kDeleteLineRight]();\n break;\n }\n else if (keyCtrl2)\n switch (keyName) {\n case \"c\":\n if (this.listenerCount(\"SIGINT\") > 0)\n this.emit(\"SIGINT\");\n else\n this.close();\n break;\n case \"h\":\n this[kDeleteLeft]();\n break;\n case \"d\":\n if (this.cursor === 0 && this.line.length === 0)\n this.close();\n else if (this.cursor < this.line.length)\n this[kDeleteRight]();\n break;\n case \"u\":\n this[kDeleteLineLeft]();\n break;\n case \"k\":\n this[kDeleteLineRight]();\n break;\n case \"a\":\n this[kMoveCursor](-@Infinity);\n break;\n case \"e\":\n this[kMoveCursor](+@Infinity);\n break;\n case \"b\":\n this[kMoveCursor](-charLengthLeft(this.line, this.cursor));\n break;\n case \"f\":\n this[kMoveCursor](+charLengthAt(this.line, this.cursor));\n break;\n case \"l\":\n cursorTo(this.output, 0, 0), clearScreenDown(this.output), this[kRefreshLine]();\n break;\n case \"n\":\n this[kHistoryNext]();\n break;\n case \"p\":\n this[kHistoryPrev]();\n break;\n case \"y\":\n this[kYank]();\n break;\n case \"z\":\n break;\n case \"w\":\n case \"backspace\":\n this[kDeleteWordLeft]();\n break;\n case \"delete\":\n this[kDeleteWordRight]();\n break;\n case \"left\":\n this[kWordLeft]();\n break;\n case \"right\":\n this[kWordRight]();\n break;\n }\n else if (keyMeta)\n switch (keyName) {\n case \"b\":\n this[kWordLeft]();\n break;\n case \"f\":\n this[kWordRight]();\n break;\n case \"d\":\n case \"delete\":\n this[kDeleteWordRight]();\n break;\n case \"backspace\":\n this[kDeleteWordLeft]();\n break;\n case \"y\":\n this[kYankPop]();\n break;\n }\n else {\n if (this[kSawReturnAt] && keyName !== \"enter\")\n this[kSawReturnAt] = 0;\n switch (keyName) {\n case \"return\":\n this[kSawReturnAt] = DateNow(), this[kLine]();\n break;\n case \"enter\":\n if (this[kSawReturnAt] === 0 || DateNow() - this[kSawReturnAt] > this.crlfDelay)\n this[kLine]();\n this[kSawReturnAt] = 0;\n break;\n case \"backspace\":\n this[kDeleteLeft]();\n break;\n case \"delete\":\n this[kDeleteRight]();\n break;\n case \"left\":\n this[kMoveCursor](-charLengthLeft(this.line, this.cursor));\n break;\n case \"right\":\n this[kMoveCursor](+charLengthAt(this.line, this.cursor));\n break;\n case \"home\":\n this[kMoveCursor](-@Infinity);\n break;\n case \"end\":\n this[kMoveCursor](+@Infinity);\n break;\n case \"up\":\n this[kHistoryPrev]();\n break;\n case \"down\":\n this[kHistoryNext]();\n break;\n case \"tab\":\n if (typeof this.completer === \"function\" && this.isCompletionEnabled) {\n var lastKeypressWasTab = previousKey && previousKey.name === \"tab\";\n this[kTabComplete](lastKeypressWasTab);\n break;\n }\n default:\n if (typeof s === \"string\" && s) {\n var nextMatch = RegExpPrototypeExec.@call(lineEnding, s);\n if (nextMatch !== null) {\n this[kInsertString](StringPrototypeSlice.@call(s, 0, nextMatch.index));\n var { lastIndex } = lineEnding;\n while ((nextMatch = RegExpPrototypeExec.@call(lineEnding, s)) !== null)\n this[kLine](), this[kInsertString](StringPrototypeSlice.@call(s, lastIndex, nextMatch.index)), { lastIndex } = lineEnding;\n if (lastIndex === s.length)\n this[kLine]();\n } else\n this[kInsertString](s);\n }\n }\n }\n }\n [SymbolAsyncIterator]() {\n if (this[kLineObjectStream] === @undefined)\n this[kLineObjectStream] = EventEmitter.on(this, \"line\", {\n close: [\"close\"],\n highWatermark: 1024,\n [kFirstEventParam]: !0\n });\n return this[kLineObjectStream];\n }\n};\nInterface.prototype = {};\nObjectSetPrototypeOf(Interface.prototype, _Interface.prototype);\nObjectSetPrototypeOf(Interface, _Interface);\nInterface.prototype.question = function question(query, options, cb) {\n if (cb = typeof options === \"function\" \? options : cb, options === null || typeof options !== \"object\")\n options = kEmptyObject;\n var signal = options\?.signal;\n if (signal) {\n if (validateAbortSignal(signal, \"options.signal\"), signal.aborted)\n return;\n var onAbort = () => {\n this[kQuestionCancel]();\n };\n signal.addEventListener(\"abort\", onAbort, { once: !0 });\n var cleanup = () => {\n signal.removeEventListener(\"abort\", onAbort);\n }, originalCb = cb;\n cb = typeof cb === \"function\" \? (answer) => {\n return cleanup(), originalCb(answer);\n } : cleanup;\n }\n if (typeof cb === \"function\")\n this[kQuestion](query, cb);\n};\nInterface.prototype.question[promisify.custom] = function question2(query, options) {\n if (options === null || typeof options !== \"object\")\n options = kEmptyObject;\n var signal = options\?.signal;\n if (signal && signal.aborted)\n return PromiseReject(new AbortError(@undefined, { cause: signal.reason }));\n return new @Promise((resolve, reject) => {\n var cb = resolve;\n if (signal) {\n var onAbort = () => {\n reject(new AbortError(@undefined, { cause: signal.reason }));\n };\n signal.addEventListener(\"abort\", onAbort, { once: !0 }), cb = (answer) => {\n signal.removeEventListener(\"abort\", onAbort), resolve(answer);\n };\n }\n this.question(query, options, cb);\n });\n};\nObjectDefineProperties(Interface.prototype, {\n [kSetRawMode]: {\n __proto__: null,\n get() {\n return this._setRawMode;\n }\n },\n [kOnLine]: {\n __proto__: null,\n get() {\n return this._onLine;\n }\n },\n [kWriteToOutput]: {\n __proto__: null,\n get() {\n return this._writeToOutput;\n }\n },\n [kAddHistory]: {\n __proto__: null,\n get() {\n return this._addHistory;\n }\n },\n [kRefreshLine]: {\n __proto__: null,\n get() {\n return this._refreshLine;\n }\n },\n [kNormalWrite]: {\n __proto__: null,\n get() {\n return this._normalWrite;\n }\n },\n [kInsertString]: {\n __proto__: null,\n get() {\n return this._insertString;\n }\n },\n [kTabComplete]: {\n __proto__: null,\n get() {\n return this._tabComplete;\n }\n },\n [kWordLeft]: {\n __proto__: null,\n get() {\n return this._wordLeft;\n }\n },\n [kWordRight]: {\n __proto__: null,\n get() {\n return this._wordRight;\n }\n },\n [kDeleteLeft]: {\n __proto__: null,\n get() {\n return this._deleteLeft;\n }\n },\n [kDeleteRight]: {\n __proto__: null,\n get() {\n return this._deleteRight;\n }\n },\n [kDeleteWordLeft]: {\n __proto__: null,\n get() {\n return this._deleteWordLeft;\n }\n },\n [kDeleteWordRight]: {\n __proto__: null,\n get() {\n return this._deleteWordRight;\n }\n },\n [kDeleteLineLeft]: {\n __proto__: null,\n get() {\n return this._deleteLineLeft;\n }\n },\n [kDeleteLineRight]: {\n __proto__: null,\n get() {\n return this._deleteLineRight;\n }\n },\n [kLine]: {\n __proto__: null,\n get() {\n return this._line;\n }\n },\n [kHistoryNext]: {\n __proto__: null,\n get() {\n return this._historyNext;\n }\n },\n [kHistoryPrev]: {\n __proto__: null,\n get() {\n return this._historyPrev;\n }\n },\n [kGetDisplayPos]: {\n __proto__: null,\n get() {\n return this._getDisplayPos;\n }\n },\n [kMoveCursor]: {\n __proto__: null,\n get() {\n return this._moveCursor;\n }\n },\n [kTtyWrite]: {\n __proto__: null,\n get() {\n return this._ttyWrite;\n }\n },\n _decoder: {\n __proto__: null,\n get() {\n return this[kDecoder];\n },\n set(value) {\n this[kDecoder] = value;\n }\n },\n _line_buffer: {\n __proto__: null,\n get() {\n return this[kLine_buffer];\n },\n set(value) {\n this[kLine_buffer] = value;\n }\n },\n _oldPrompt: {\n __proto__: null,\n get() {\n return this[kOldPrompt];\n },\n set(value) {\n this[kOldPrompt] = value;\n }\n },\n _previousKey: {\n __proto__: null,\n get() {\n return this[kPreviousKey];\n },\n set(value) {\n this[kPreviousKey] = value;\n }\n },\n _prompt: {\n __proto__: null,\n get() {\n return this[kPrompt];\n },\n set(value) {\n this[kPrompt] = value;\n }\n },\n _questionCallback: {\n __proto__: null,\n get() {\n return this[kQuestionCallback];\n },\n set(value) {\n this[kQuestionCallback] = value;\n }\n },\n _sawKeyPress: {\n __proto__: null,\n get() {\n return this[kSawKeyPress];\n },\n set(value) {\n this[kSawKeyPress] = value;\n }\n },\n _sawReturnAt: {\n __proto__: null,\n get() {\n return this[kSawReturnAt];\n },\n set(value) {\n this[kSawReturnAt] = value;\n }\n }\n});\nInterface.prototype._setRawMode = _Interface.prototype[kSetRawMode];\nInterface.prototype._onLine = _Interface.prototype[kOnLine];\nInterface.prototype._writeToOutput = _Interface.prototype[kWriteToOutput];\nInterface.prototype._addHistory = _Interface.prototype[kAddHistory];\nInterface.prototype._refreshLine = _Interface.prototype[kRefreshLine];\nInterface.prototype._normalWrite = _Interface.prototype[kNormalWrite];\nInterface.prototype._insertString = _Interface.prototype[kInsertString];\nInterface.prototype._tabComplete = function(lastKeypressWasTab) {\n this.pause();\n var string = StringPrototypeSlice.@call(this.line, 0, this.cursor);\n this.completer(string, (err, value) => {\n if (this.resume(), err) {\n this._writeToOutput(`Tab completion error: ${inspect(err)}`);\n return;\n }\n this[kTabCompleter](lastKeypressWasTab, value);\n });\n};\nInterface.prototype._wordLeft = _Interface.prototype[kWordLeft];\nInterface.prototype._wordRight = _Interface.prototype[kWordRight];\nInterface.prototype._deleteLeft = _Interface.prototype[kDeleteLeft];\nInterface.prototype._deleteRight = _Interface.prototype[kDeleteRight];\nInterface.prototype._deleteWordLeft = _Interface.prototype[kDeleteWordLeft];\nInterface.prototype._deleteWordRight = _Interface.prototype[kDeleteWordRight];\nInterface.prototype._deleteLineLeft = _Interface.prototype[kDeleteLineLeft];\nInterface.prototype._deleteLineRight = _Interface.prototype[kDeleteLineRight];\nInterface.prototype._line = _Interface.prototype[kLine];\nInterface.prototype._historyNext = _Interface.prototype[kHistoryNext];\nInterface.prototype._historyPrev = _Interface.prototype[kHistoryPrev];\nInterface.prototype._getDisplayPos = _Interface.prototype[kGetDisplayPos];\nInterface.prototype._getCursorPos = _Interface.prototype.getCursorPos;\nInterface.prototype._moveCursor = _Interface.prototype[kMoveCursor];\nInterface.prototype._ttyWrite = _Interface.prototype[kTtyWrite];\n\nclass Readline {\n #autoCommit = !1;\n #stream;\n #todo = [];\n constructor(stream, options = @undefined) {\n if (isWritable \?\?= (@getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39)).isWritable, !isWritable(stream))\n throw new ERR_INVALID_ARG_TYPE(\"stream\", \"Writable\", stream);\n if (this.#stream = stream, options\?.autoCommit != null)\n validateBoolean(options.autoCommit, \"options.autoCommit\"), this.#autoCommit = options.autoCommit;\n }\n cursorTo(x, y = @undefined) {\n if (validateInteger(x, \"x\"), y != null)\n validateInteger(y, \"y\");\n var data = y == null \? CSI`${x + 1}G` : CSI`${y + 1};${x + 1}H`;\n if (this.#autoCommit)\n process.nextTick(() => this.#stream.write(data));\n else\n ArrayPrototypePush.@call(this.#todo, data);\n return this;\n }\n moveCursor(dx, dy) {\n if (dx || dy) {\n validateInteger(dx, \"dx\"), validateInteger(dy, \"dy\");\n var data = \"\";\n if (dx < 0)\n data += CSI`${-dx}D`;\n else if (dx > 0)\n data += CSI`${dx}C`;\n if (dy < 0)\n data += CSI`${-dy}A`;\n else if (dy > 0)\n data += CSI`${dy}B`;\n if (this.#autoCommit)\n process.nextTick(() => this.#stream.write(data));\n else\n ArrayPrototypePush.@call(this.#todo, data);\n }\n return this;\n }\n clearLine(dir) {\n validateInteger(dir, \"dir\", -1, 1);\n var data = dir < 0 \? kClearToLineBeginning : dir > 0 \? kClearToLineEnd : kClearLine;\n if (this.#autoCommit)\n process.nextTick(() => this.#stream.write(data));\n else\n ArrayPrototypePush.@call(this.#todo, data);\n return this;\n }\n clearScreenDown() {\n if (this.#autoCommit)\n process.nextTick(() => this.#stream.write(kClearScreenDown));\n else\n ArrayPrototypePush.@call(this.#todo, kClearScreenDown);\n return this;\n }\n commit() {\n return new @Promise((resolve) => {\n this.#stream.write(ArrayPrototypeJoin.@call(this.#todo, \"\"), resolve), this.#todo = [];\n });\n }\n rollback() {\n return this.#todo = [], this;\n }\n}\nvar PromisesInterface = class Interface3 extends _Interface {\n constructor(input, output, completer, terminal) {\n super(input, output, completer, terminal);\n }\n question(query, options = kEmptyObject) {\n var signal = options\?.signal;\n if (signal) {\n if (validateAbortSignal(signal, \"options.signal\"), signal.aborted)\n return PromiseReject(new AbortError(@undefined, { cause: signal.reason }));\n }\n return new @Promise((resolve, reject) => {\n var cb = resolve;\n if (options\?.signal) {\n var onAbort = () => {\n this[kQuestionCancel](), reject(new AbortError(@undefined, { cause: signal.reason }));\n };\n signal.addEventListener(\"abort\", onAbort, { once: !0 }), cb = (answer) => {\n signal.removeEventListener(\"abort\", onAbort), resolve(answer);\n };\n }\n this[kQuestion](query, cb);\n });\n }\n};\n$ = {\n Interface,\n clearLine,\n clearScreenDown,\n createInterface,\n cursorTo,\n emitKeypressEvents,\n moveCursor,\n promises: {\n Readline,\n Interface: PromisesInterface,\n createInterface(input, output, completer, terminal) {\n return new PromisesInterface(input, output, completer, terminal);\n }\n },\n [SymbolFor(\"__BUN_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED__\")]: {\n CSI,\n utils: {\n getStringWidth,\n stripVTControlCharacters\n }\n }\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeReadlinePromisesCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/readline.promises.ts\nreturn (@getInternalField(@internalModuleRegistry, 35) || @createInternalModuleById(35)).promises})\n"); -// - -// -static constexpr ASCIILiteral NodeReplCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/repl.ts\nvar $, { throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6);\n$ = {\n lines: [],\n context: globalThis,\n historyIndex: -1,\n cursor: 0,\n historySize: 1000,\n removeHistoryDuplicates: !1,\n crlfDelay: 100,\n completer: () => {\n throwNotImplemented(\"node:repl\");\n },\n history: [],\n _initialPrompt: \"> \",\n terminal: !0,\n input: new Proxy({}, {\n get() {\n throwNotImplemented(\"node:repl\");\n },\n has: () => !1,\n ownKeys: () => [],\n getOwnPropertyDescriptor: () => @undefined,\n set() {\n throwNotImplemented(\"node:repl\");\n }\n }),\n line: \"\",\n eval: () => {\n throwNotImplemented(\"node:repl\");\n },\n isCompletionEnabled: !0,\n escapeCodeTimeout: 500,\n tabSize: 8,\n breakEvalOnSigint: !0,\n useGlobal: !0,\n underscoreAssigned: !1,\n last: @undefined,\n _domain: @undefined,\n allowBlockingCompletions: !1,\n useColors: !0,\n output: new Proxy({}, {\n get() {\n throwNotImplemented(\"node:repl\");\n },\n has: () => !1,\n ownKeys: () => [],\n getOwnPropertyDescriptor: () => @undefined,\n set() {\n throwNotImplemented(\"node:repl\");\n }\n }),\n _builtinLibs: [\n \"bun\",\n \"ffi\",\n \"assert\",\n \"assert/strict\",\n \"async_hooks\",\n \"buffer\",\n \"child_process\",\n \"cluster\",\n \"console\",\n \"constants\",\n \"crypto\",\n \"dgram\",\n \"diagnostics_channel\",\n \"dns\",\n \"dns/promises\",\n \"domain\",\n \"events\",\n \"fs\",\n \"fs/promises\",\n \"http\",\n \"http2\",\n \"https\",\n \"inspector\",\n \"inspector/promises\",\n \"module\",\n \"net\",\n \"os\",\n \"path\",\n \"path/posix\",\n \"path/win32\",\n \"perf_hooks\",\n \"process\",\n \"punycode\",\n \"querystring\",\n \"readline\",\n \"readline/promises\",\n \"repl\",\n \"stream\",\n \"stream/consumers\",\n \"stream/promises\",\n \"stream/web\",\n \"string_decoder\",\n \"sys\",\n \"timers\",\n \"timers/promises\",\n \"tls\",\n \"trace_events\",\n \"tty\",\n \"url\",\n \"util\",\n \"util/types\",\n \"v8\",\n \"vm\",\n \"wasi\",\n \"worker_threads\",\n \"zlib\"\n ]\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeStreamConsumersCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/stream.consumers.ts\nvar $, arrayBuffer = Bun.readableStreamToArrayBuffer, text = Bun.readableStreamToText, json = (stream) => Bun.readableStreamToText(stream).then(JSON.parse), buffer = async (readableStream) => {\n return new @Buffer(await arrayBuffer(readableStream));\n}, blob = Bun.readableStreamToBlob;\n$ = {\n arrayBuffer,\n text,\n json,\n buffer,\n blob\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeStreamCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/stream.ts\nvar isReadableStream = function(value) {\n return typeof value === \"object\" && value !== null && value instanceof @ReadableStream;\n}, validateBoolean = function(value, name) {\n if (typeof value !== \"boolean\")\n throw new ERR_INVALID_ARG_TYPE(name, \"boolean\", value);\n};\nvar ERR_INVALID_ARG_TYPE = function(name, type, value) {\n return new Error(`The argument '${name}' is invalid. Received '${value}' for type '${type}'`);\n}, ERR_INVALID_ARG_VALUE = function(name, value, reason) {\n return new Error(`The value '${value}' is invalid for argument '${name}'. Reason: ${reason}`);\n}, createNativeStreamReadable = function(nativeType, Readable) {\n var [pull, start, cancel, setClose, deinit, updateRef, drainFn] = @lazy(nativeType), closer = [!1], handleNumberResult = function(nativeReadable, result, view, isClosed) {\n if (result > 0) {\n const slice = view.subarray(0, result), remainder = view.subarray(result);\n if (slice.byteLength > 0)\n nativeReadable.push(slice);\n if (isClosed)\n nativeReadable.push(null);\n return remainder.byteLength > 0 \? remainder : @undefined;\n }\n if (isClosed)\n nativeReadable.push(null);\n return view;\n }, handleArrayBufferViewResult = function(nativeReadable, result, view, isClosed) {\n if (result.byteLength > 0)\n nativeReadable.push(result);\n if (isClosed)\n nativeReadable.push(null);\n return view;\n }, DYNAMICALLY_ADJUST_CHUNK_SIZE = process.env.BUN_DISABLE_DYNAMIC_CHUNK_SIZE !== \"1\";\n const finalizer = new FinalizationRegistry((ptr) => ptr && deinit(ptr)), MIN_BUFFER_SIZE = 512;\n var NativeReadable = class NativeReadable2 extends Readable {\n #bunNativePtr;\n #refCount = 1;\n #constructed = !1;\n #remainingChunk = @undefined;\n #highWaterMark;\n #pendingRead = !1;\n #hasResized = !DYNAMICALLY_ADJUST_CHUNK_SIZE;\n #unregisterToken;\n constructor(ptr, options = {}) {\n super(options);\n if (typeof options.highWaterMark === \"number\")\n this.#highWaterMark = options.highWaterMark;\n else\n this.#highWaterMark = 262144;\n this.#bunNativePtr = ptr, this.#constructed = !1, this.#remainingChunk = @undefined, this.#pendingRead = !1, this.#unregisterToken = {}, finalizer.register(this, this.#bunNativePtr, this.#unregisterToken);\n }\n _read(maxToRead) {\n if (this.#pendingRead)\n return;\n var ptr = this.#bunNativePtr;\n if (ptr === 0) {\n this.push(null);\n return;\n }\n if (!this.#constructed)\n this.#internalConstruct(ptr);\n return this.#internalRead(this.#getRemainingChunk(maxToRead), ptr);\n }\n #internalConstruct(ptr) {\n this.#constructed = !0;\n const result = start(ptr, this.#highWaterMark);\n if (typeof result === \"number\" && result > 1)\n this.#hasResized = !0, this.#highWaterMark = Math.min(this.#highWaterMark, result);\n if (drainFn) {\n const drainResult = drainFn(ptr);\n if ((drainResult\?.byteLength \?\? 0) > 0)\n this.push(drainResult);\n }\n }\n #getRemainingChunk(maxToRead = this.#highWaterMark) {\n var chunk = this.#remainingChunk;\n if (chunk\?.byteLength \?\? 0 < MIN_BUFFER_SIZE) {\n var size = maxToRead > MIN_BUFFER_SIZE \? maxToRead : MIN_BUFFER_SIZE;\n this.#remainingChunk = chunk = new @Buffer(size);\n }\n return chunk;\n }\n #handleResult(result, view, isClosed) {\n if (typeof result === \"number\") {\n if (result >= this.#highWaterMark && !this.#hasResized && !isClosed)\n this.#highWaterMark *= 2, this.#hasResized = !0;\n return handleNumberResult(this, result, view, isClosed);\n } else if (typeof result === \"boolean\")\n return process.nextTick(() => {\n this.push(null);\n }), view\?.byteLength \?\? 0 > 0 \? view : @undefined;\n else if (@ArrayBuffer.isView(result)) {\n if (result.byteLength >= this.#highWaterMark && !this.#hasResized && !isClosed)\n this.#highWaterMark *= 2, this.#hasResized = !0;\n return handleArrayBufferViewResult(this, result, view, isClosed);\n } else\n throw new Error(\"Invalid result from pull\");\n }\n #internalRead(view, ptr) {\n closer[0] = !1;\n var result = pull(ptr, view, closer);\n if (@isPromise(result))\n return this.#pendingRead = !0, result.then((result2) => {\n this.#pendingRead = !1, this.#remainingChunk = this.#handleResult(result2, view, closer[0]);\n }, (reason) => {\n errorOrDestroy(this, reason);\n });\n else\n this.#remainingChunk = this.#handleResult(result, view, closer[0]);\n }\n _destroy(error, callback) {\n var ptr = this.#bunNativePtr;\n if (ptr === 0) {\n callback(error);\n return;\n }\n if (finalizer.unregister(this.#unregisterToken), this.#bunNativePtr = 0, updateRef)\n updateRef(ptr, !1);\n cancel(ptr, error), callback(error);\n }\n ref() {\n var ptr = this.#bunNativePtr;\n if (ptr === 0)\n return;\n if (this.#refCount++ === 0)\n updateRef(ptr, !0);\n }\n unref() {\n var ptr = this.#bunNativePtr;\n if (ptr === 0)\n return;\n if (this.#refCount-- === 1)\n updateRef(ptr, !1);\n }\n };\n if (!updateRef)\n NativeReadable.prototype.ref = @undefined, NativeReadable.prototype.unref = @undefined;\n return NativeReadable;\n}, getNativeReadableStreamPrototype = function(nativeType, Readable) {\n return nativeReadableStreamPrototypes[nativeType] ||= createNativeStreamReadable(nativeType, Readable);\n}, getNativeReadableStream = function(Readable, stream, options) {\n if (!(stream && typeof stream === \"object\" && stream instanceof @ReadableStream))\n return @undefined;\n const native = @direct(stream);\n if (!native)\n return @undefined;\n const { stream: ptr, data: type } = native;\n return new (getNativeReadableStreamPrototype(type, Readable))(ptr, options);\n}, NativeWritable = function(pathOrFdOrSink, options = {}) {\n Writable.@call(this, options), this[_native] = !0, this._construct = NativeWritable_internalConstruct, this._destroy = NativeWritable_internalDestroy, this._final = NativeWritable_internalFinal, this[_pathOrFdOrSink] = pathOrFdOrSink;\n}, NativeWritable_internalConstruct = function(cb) {\n if (this._writableState.constructed = !0, this.constructed = !0, typeof cb === \"function\")\n cb();\n process.nextTick(() => {\n this.emit(\"open\", this.fd), this.emit(\"ready\");\n });\n}, NativeWritable_lazyConstruct = function(stream) {\n var sink = stream[_pathOrFdOrSink];\n if (typeof sink === \"object\")\n if (typeof sink.write === \"function\")\n return stream[_fileSink] = sink;\n else\n throw new Error(\"Invalid FileSink\");\n else\n return stream[_fileSink] = Bun.file(sink).writer();\n}, NativeWritable_internalDestroy = function(error, cb) {\n const w = this._writableState, r = this._readableState;\n if (w)\n w.destroyed = !0, w.closeEmitted = !0;\n if (r)\n r.destroyed = !0, r.closeEmitted = !0;\n if (typeof cb === \"function\")\n cb(error);\n if (w\?.closeEmitted || r\?.closeEmitted)\n this.emit(\"close\");\n}, NativeWritable_internalFinal = function(cb) {\n var sink = this[_fileSink];\n if (sink)\n sink.end();\n if (cb)\n cb();\n}, EE = @lazy(\"events\"), StringDecoder = @requireNativeModule(\"string_decoder\").StringDecoder, __getOwnPropNames = Object.getOwnPropertyNames, __commonJS = (cb, mod) => function __require2() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n}, runOnNextTick = process.nextTick;\nvar ArrayIsArray = @Array.isArray, require_primordials = __commonJS({\n \"node_modules/readable-stream/lib/ours/primordials.js\"(exports, module) {\n module.exports = {\n ArrayIsArray(self) {\n return @Array.isArray(self);\n },\n ArrayPrototypeIncludes(self, el) {\n return self.includes(el);\n },\n ArrayPrototypeIndexOf(self, el) {\n return self.indexOf(el);\n },\n ArrayPrototypeJoin(self, sep) {\n return self.join(sep);\n },\n ArrayPrototypeMap(self, fn) {\n return self.map(fn);\n },\n ArrayPrototypePop(self, el) {\n return self.pop(el);\n },\n ArrayPrototypePush(self, el) {\n return self.push(el);\n },\n ArrayPrototypeSlice(self, start, end) {\n return self.slice(start, end);\n },\n Error,\n FunctionPrototypeCall(fn, thisArgs, ...args) {\n return fn.@call(thisArgs, ...args);\n },\n FunctionPrototypeSymbolHasInstance(self, instance) {\n return Function.prototype[Symbol.hasInstance].@call(self, instance);\n },\n MathFloor: Math.floor,\n Number,\n NumberIsInteger: Number.isInteger,\n NumberIsNaN: Number.isNaN,\n NumberMAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER,\n NumberMIN_SAFE_INTEGER: Number.MIN_SAFE_INTEGER,\n NumberParseInt: Number.parseInt,\n ObjectDefineProperties(self, props) {\n return Object.defineProperties(self, props);\n },\n ObjectDefineProperty(self, name, prop) {\n return Object.defineProperty(self, name, prop);\n },\n ObjectGetOwnPropertyDescriptor(self, name) {\n return Object.getOwnPropertyDescriptor(self, name);\n },\n ObjectKeys(obj) {\n return Object.keys(obj);\n },\n ObjectSetPrototypeOf(target, proto) {\n return Object.setPrototypeOf(target, proto);\n },\n Promise: @Promise,\n PromisePrototypeCatch(self, fn) {\n return self.catch(fn);\n },\n PromisePrototypeThen(self, thenFn, catchFn) {\n return self.then(thenFn, catchFn);\n },\n PromiseReject(err) {\n return @Promise.reject(err);\n },\n ReflectApply: @getByIdDirect(Reflect, \"apply\"),\n RegExpPrototypeTest(self, value) {\n return self.test(value);\n },\n SafeSet: Set,\n String: @String,\n StringPrototypeSlice(self, start, end) {\n return self.slice(start, end);\n },\n StringPrototypeToLowerCase(self) {\n return self.toLowerCase();\n },\n StringPrototypeToUpperCase(self) {\n return self.toUpperCase();\n },\n StringPrototypeTrim(self) {\n return self.trim();\n },\n Symbol,\n SymbolAsyncIterator: Symbol.asyncIterator,\n SymbolHasInstance: Symbol.hasInstance,\n SymbolIterator: Symbol.iterator,\n TypedArrayPrototypeSet(self, buf, len) {\n return self.set(buf, len);\n },\n Uint8Array: @Uint8Array\n };\n }\n}), require_util = __commonJS({\n \"node_modules/readable-stream/lib/ours/util.js\"(exports, module) {\n var AsyncFunction = Object.getPrototypeOf(async function() {\n }).constructor, isBlob = typeof Blob !== \"undefined\" \? function isBlob2(b) {\n return b instanceof Blob;\n } : function isBlob2(b) {\n return !1;\n }, AggregateError = class extends Error {\n constructor(errors) {\n if (!@Array.isArray(errors))\n @throwTypeError(`Expected input to be an Array, got ${typeof errors}`);\n let message = \"\";\n for (let i = 0;i < errors.length; i++)\n message += ` ${errors[i].stack}\n`;\n super(message);\n this.name = \"AggregateError\", this.errors = errors;\n }\n };\n module.exports = {\n AggregateError,\n once(callback) {\n let called = !1;\n return function(...args) {\n if (called)\n return;\n called = !0, callback.@apply(this, args);\n };\n },\n createDeferredPromise: function() {\n let resolve, reject;\n return {\n promise: new @Promise((res, rej) => {\n resolve = res, reject = rej;\n }),\n resolve,\n reject\n };\n },\n promisify(fn) {\n return new @Promise((resolve, reject) => {\n fn((err, ...args) => {\n if (err)\n return reject(err);\n return resolve(...args);\n });\n });\n },\n debuglog() {\n return function() {\n };\n },\n format(format, ...args) {\n return format.replace(/%([sdifj])/g, function(...[_unused, type]) {\n const replacement = args.shift();\n if (type === \"f\")\n return replacement.toFixed(6);\n else if (type === \"j\")\n return JSON.stringify(replacement);\n else if (type === \"s\" && typeof replacement === \"object\")\n return `${replacement.constructor !== Object \? replacement.constructor.name : \"\"} {}`.trim();\n else\n return replacement.toString();\n });\n },\n inspect(value) {\n switch (typeof value) {\n case \"string\":\n if (value.includes(\"'\")) {\n if (!value.includes('\"'))\n return `\"${value}\"`;\n else if (!value.includes(\"`\") && !value.includes(\"${\"))\n return `\\`${value}\\``;\n }\n return `'${value}'`;\n case \"number\":\n if (isNaN(value))\n return \"NaN\";\n else if (Object.is(value, -0))\n return @String(value);\n return value;\n case \"bigint\":\n return `${@String(value)}n`;\n case \"boolean\":\n case \"undefined\":\n return @String(value);\n case \"object\":\n return \"{}\";\n }\n },\n types: {\n isAsyncFunction(fn) {\n return fn instanceof AsyncFunction;\n },\n isArrayBufferView(arr) {\n return @ArrayBuffer.isView(arr);\n }\n },\n isBlob\n }, module.exports.promisify.custom = Symbol.for(\"nodejs.util.promisify.custom\");\n }\n}), require_errors = __commonJS({\n \"node_modules/readable-stream/lib/ours/errors.js\"(exports, module) {\n var { format, inspect, AggregateError: CustomAggregateError } = require_util(), AggregateError = globalThis.AggregateError || CustomAggregateError, kIsNodeError = Symbol(\"kIsNodeError\"), kTypes = [\"string\", \"function\", \"number\", \"object\", \"Function\", \"Object\", \"boolean\", \"bigint\", \"symbol\"], classRegExp = /^([A-Z][a-z0-9]*)+$/, nodeInternalPrefix = \"__node_internal_\", codes = {};\n function assert(value, message) {\n if (!value)\n throw new codes.ERR_INTERNAL_ASSERTION(message);\n }\n function addNumericalSeparator(val) {\n let res = \"\", i = val.length;\n const start = val[0] === \"-\" \? 1 : 0;\n for (;i >= start + 4; i -= 3)\n res = `_${val.slice(i - 3, i)}${res}`;\n return `${val.slice(0, i)}${res}`;\n }\n function getMessage(key, msg, args) {\n if (typeof msg === \"function\")\n return assert(msg.length <= args.length, `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${msg.length}).`), msg(...args);\n const expectedLength = (msg.match(/%[dfijoOs]/g) || []).length;\n if (assert(expectedLength === args.length, `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${expectedLength}).`), args.length === 0)\n return msg;\n return format(msg, ...args);\n }\n function E(code, message, Base) {\n if (!Base)\n Base = Error;\n\n class NodeError extends Base {\n constructor(...args) {\n super(getMessage(code, message, args));\n }\n toString() {\n return `${this.name} [${code}]: ${this.message}`;\n }\n }\n Object.defineProperties(NodeError.prototype, {\n name: {\n value: Base.name,\n writable: !0,\n enumerable: !1,\n configurable: !0\n },\n toString: {\n value() {\n return `${this.name} [${code}]: ${this.message}`;\n },\n writable: !0,\n enumerable: !1,\n configurable: !0\n }\n }), NodeError.prototype.code = code, NodeError.prototype[kIsNodeError] = !0, codes[code] = NodeError;\n }\n function hideStackFrames(fn) {\n const hidden = nodeInternalPrefix + fn.name;\n return Object.defineProperty(fn, \"name\", {\n value: hidden\n }), fn;\n }\n function aggregateTwoErrors(innerError, outerError) {\n if (innerError && outerError && innerError !== outerError) {\n if (@Array.isArray(outerError.errors))\n return outerError.errors.push(innerError), outerError;\n const err = new AggregateError([outerError, innerError], outerError.message);\n return err.code = outerError.code, err;\n }\n return innerError || outerError;\n }\n var AbortError2 = class extends Error {\n constructor(message = \"The operation was aborted\", options = void 0) {\n if (options !== void 0 && typeof options !== \"object\")\n throw new codes.ERR_INVALID_ARG_TYPE(\"options\", \"Object\", options);\n super(message, options);\n this.code = \"ABORT_ERR\", this.name = \"AbortError\";\n }\n };\n E(\"ERR_ASSERTION\", \"%s\", Error), E(\"ERR_INVALID_ARG_TYPE\", (name, expected, actual) => {\n if (assert(typeof name === \"string\", \"'name' must be a string\"), !@Array.isArray(expected))\n expected = [expected];\n let msg = \"The \";\n if (name.endsWith(\" argument\"))\n msg += `${name} `;\n else\n msg += `\"${name}\" ${name.includes(\".\") \? \"property\" : \"argument\"} `;\n msg += \"must be \";\n const types = [], instances = [], other = [];\n for (let value of expected)\n if (assert(typeof value === \"string\", \"All expected entries have to be of type string\"), kTypes.includes(value))\n types.push(value.toLowerCase());\n else if (classRegExp.test(value))\n instances.push(value);\n else\n assert(value !== \"object\", 'The value \"object\" should be written as \"Object\"'), other.push(value);\n if (instances.length > 0) {\n const pos = types.indexOf(\"object\");\n if (pos !== -1)\n types.splice(types, pos, 1), instances.push(\"Object\");\n }\n if (types.length > 0) {\n switch (types.length) {\n case 1:\n msg += `of type ${types[0]}`;\n break;\n case 2:\n msg += `one of type ${types[0]} or ${types[1]}`;\n break;\n default: {\n const last = types.pop();\n msg += `one of type ${types.join(\", \")}, or ${last}`;\n }\n }\n if (instances.length > 0 || other.length > 0)\n msg += \" or \";\n }\n if (instances.length > 0) {\n switch (instances.length) {\n case 1:\n msg += `an instance of ${instances[0]}`;\n break;\n case 2:\n msg += `an instance of ${instances[0]} or ${instances[1]}`;\n break;\n default: {\n const last = instances.pop();\n msg += `an instance of ${instances.join(\", \")}, or ${last}`;\n }\n }\n if (other.length > 0)\n msg += \" or \";\n }\n switch (other.length) {\n case 0:\n break;\n case 1:\n if (other[0].toLowerCase() !== other[0])\n msg += \"an \";\n msg += `${other[0]}`;\n break;\n case 2:\n msg += `one of ${other[0]} or ${other[1]}`;\n break;\n default: {\n const last = other.pop();\n msg += `one of ${other.join(\", \")}, or ${last}`;\n }\n }\n if (actual == null)\n msg += `. Received ${actual}`;\n else if (typeof actual === \"function\" && actual.name)\n msg += `. Received function ${actual.name}`;\n else if (typeof actual === \"object\") {\n var _actual$constructor;\n if ((_actual$constructor = actual.constructor) !== null && _actual$constructor !== void 0 && _actual$constructor.name)\n msg += `. Received an instance of ${actual.constructor.name}`;\n else {\n const inspected = inspect(actual, {\n depth: -1\n });\n msg += `. Received ${inspected}`;\n }\n } else {\n let inspected = inspect(actual, {\n colors: !1\n });\n if (inspected.length > 25)\n inspected = `${inspected.slice(0, 25)}...`;\n msg += `. Received type ${typeof actual} (${inspected})`;\n }\n return msg;\n }, TypeError), E(\"ERR_INVALID_ARG_VALUE\", (name, value, reason = \"is invalid\") => {\n let inspected = inspect(value);\n if (inspected.length > 128)\n inspected = inspected.slice(0, 128) + \"...\";\n return `The ${name.includes(\".\") \? \"property\" : \"argument\"} '${name}' ${reason}. Received ${inspected}`;\n }, TypeError), E(\"ERR_INVALID_RETURN_VALUE\", (input, name, value) => {\n var _value$constructor;\n const type = value !== null && value !== void 0 && (_value$constructor = value.constructor) !== null && _value$constructor !== void 0 && _value$constructor.name \? `instance of ${value.constructor.name}` : `type ${typeof value}`;\n return `Expected ${input} to be returned from the \"${name}\" function but got ${type}.`;\n }, TypeError), E(\"ERR_MISSING_ARGS\", (...args) => {\n assert(args.length > 0, \"At least one arg needs to be specified\");\n let msg;\n const len = args.length;\n switch (args = (@Array.isArray(args) \? args : [args]).map((a) => `\"${a}\"`).join(\" or \"), len) {\n case 1:\n msg += `The ${args[0]} argument`;\n break;\n case 2:\n msg += `The ${args[0]} and ${args[1]} arguments`;\n break;\n default:\n {\n const last = args.pop();\n msg += `The ${args.join(\", \")}, and ${last} arguments`;\n }\n break;\n }\n return `${msg} must be specified`;\n }, TypeError), E(\"ERR_OUT_OF_RANGE\", (str, range, input) => {\n assert(range, 'Missing \"range\" argument');\n let received;\n if (Number.isInteger(input) && Math.abs(input) > 4294967296)\n received = addNumericalSeparator(@String(input));\n else if (typeof input === \"bigint\") {\n if (received = @String(input), input > 2n ** 32n || input < -(2n ** 32n))\n received = addNumericalSeparator(received);\n received += \"n\";\n } else\n received = inspect(input);\n return `The value of \"${str}\" is out of range. It must be ${range}. Received ${received}`;\n }, RangeError), E(\"ERR_MULTIPLE_CALLBACK\", \"Callback called multiple times\", Error), E(\"ERR_METHOD_NOT_IMPLEMENTED\", \"The %s method is not implemented\", Error), E(\"ERR_STREAM_ALREADY_FINISHED\", \"Cannot call %s after a stream was finished\", Error), E(\"ERR_STREAM_CANNOT_PIPE\", \"Cannot pipe, not readable\", Error), E(\"ERR_STREAM_DESTROYED\", \"Cannot call %s after a stream was destroyed\", Error), E(\"ERR_STREAM_NULL_VALUES\", \"May not write null values to stream\", TypeError), E(\"ERR_STREAM_PREMATURE_CLOSE\", \"Premature close\", Error), E(\"ERR_STREAM_PUSH_AFTER_EOF\", \"stream.push() after EOF\", Error), E(\"ERR_STREAM_UNSHIFT_AFTER_END_EVENT\", \"stream.unshift() after end event\", Error), E(\"ERR_STREAM_WRITE_AFTER_END\", \"write after end\", Error), E(\"ERR_UNKNOWN_ENCODING\", \"Unknown encoding: %s\", TypeError), module.exports = {\n AbortError: AbortError2,\n aggregateTwoErrors: hideStackFrames(aggregateTwoErrors),\n hideStackFrames,\n codes\n };\n }\n}), require_validators = __commonJS({\n \"node_modules/readable-stream/lib/internal/validators.js\"(exports, module) {\n var {\n ArrayIsArray: ArrayIsArray2,\n ArrayPrototypeIncludes,\n ArrayPrototypeJoin,\n ArrayPrototypeMap,\n NumberIsInteger,\n NumberMAX_SAFE_INTEGER,\n NumberMIN_SAFE_INTEGER,\n NumberParseInt,\n RegExpPrototypeTest,\n String: String2,\n StringPrototypeToUpperCase,\n StringPrototypeTrim\n } = require_primordials(), {\n hideStackFrames,\n codes: { ERR_SOCKET_BAD_PORT, ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE2, ERR_INVALID_ARG_VALUE: ERR_INVALID_ARG_VALUE2, ERR_OUT_OF_RANGE, ERR_UNKNOWN_SIGNAL }\n } = require_errors(), { normalizeEncoding } = require_util(), { isAsyncFunction, isArrayBufferView } = require_util().types, signals = {};\n function isInt32(value) {\n return value === (value | 0);\n }\n function isUint32(value) {\n return value === value >>> 0;\n }\n var octalReg = /^[0-7]+$/, modeDesc = \"must be a 32-bit unsigned integer or an octal string\";\n function parseFileMode(value, name, def) {\n if (typeof value === \"undefined\")\n value = def;\n if (typeof value === \"string\") {\n if (!RegExpPrototypeTest(octalReg, value))\n throw new ERR_INVALID_ARG_VALUE2(name, value, modeDesc);\n value = NumberParseInt(value, 8);\n }\n return validateInt32(value, name, 0, 4294967295), value;\n }\n var validateInteger = hideStackFrames((value, name, min = NumberMIN_SAFE_INTEGER, max = NumberMAX_SAFE_INTEGER) => {\n if (typeof value !== \"number\")\n throw new ERR_INVALID_ARG_TYPE2(name, \"number\", value);\n if (!NumberIsInteger(value))\n throw new ERR_OUT_OF_RANGE(name, \"an integer\", value);\n if (value < min || value > max)\n throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);\n }), validateInt32 = hideStackFrames((value, name, min = -2147483648, max = 2147483647) => {\n if (typeof value !== \"number\")\n throw new ERR_INVALID_ARG_TYPE2(name, \"number\", value);\n if (!isInt32(value)) {\n if (!NumberIsInteger(value))\n throw new ERR_OUT_OF_RANGE(name, \"an integer\", value);\n throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);\n }\n if (value < min || value > max)\n throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);\n }), validateUint32 = hideStackFrames((value, name, positive) => {\n if (typeof value !== \"number\")\n throw new ERR_INVALID_ARG_TYPE2(name, \"number\", value);\n if (!isUint32(value)) {\n if (!NumberIsInteger(value))\n throw new ERR_OUT_OF_RANGE(name, \"an integer\", value);\n throw new ERR_OUT_OF_RANGE(name, `>= ${positive \? 1 : 0} && < 4294967296`, value);\n }\n if (positive && value === 0)\n throw new ERR_OUT_OF_RANGE(name, \">= 1 && < 4294967296\", value);\n });\n function validateString(value, name) {\n if (typeof value !== \"string\")\n throw new ERR_INVALID_ARG_TYPE2(name, \"string\", value);\n }\n function validateNumber(value, name) {\n if (typeof value !== \"number\")\n throw new ERR_INVALID_ARG_TYPE2(name, \"number\", value);\n }\n var validateOneOf = hideStackFrames((value, name, oneOf) => {\n if (!ArrayPrototypeIncludes(oneOf, value)) {\n const reason = \"must be one of: \" + ArrayPrototypeJoin(ArrayPrototypeMap(oneOf, (v) => typeof v === \"string\" \? `'${v}'` : String2(v)), \", \");\n throw new ERR_INVALID_ARG_VALUE2(name, value, reason);\n }\n });\n function validateBoolean2(value, name) {\n if (typeof value !== \"boolean\")\n throw new ERR_INVALID_ARG_TYPE2(name, \"boolean\", value);\n }\n var validateObject = hideStackFrames((value, name, options) => {\n const useDefaultOptions = options == null, allowArray = useDefaultOptions \? !1 : options.allowArray, allowFunction = useDefaultOptions \? !1 : options.allowFunction;\n if (!(useDefaultOptions \? !1 : options.nullable) && value === null || !allowArray && ArrayIsArray2(value) || typeof value !== \"object\" && (!allowFunction || typeof value !== \"function\"))\n throw new ERR_INVALID_ARG_TYPE2(name, \"Object\", value);\n }), validateArray = hideStackFrames((value, name, minLength = 0) => {\n if (!ArrayIsArray2(value))\n throw new ERR_INVALID_ARG_TYPE2(name, \"Array\", value);\n if (value.length < minLength) {\n const reason = `must be longer than ${minLength}`;\n throw new ERR_INVALID_ARG_VALUE2(name, value, reason);\n }\n });\n function validateSignalName(signal, name = \"signal\") {\n if (validateString(signal, name), signals[signal] === void 0) {\n if (signals[StringPrototypeToUpperCase(signal)] !== void 0)\n throw new ERR_UNKNOWN_SIGNAL(signal + \" (signals must use all capital letters)\");\n throw new ERR_UNKNOWN_SIGNAL(signal);\n }\n }\n var validateBuffer = hideStackFrames((buffer, name = \"buffer\") => {\n if (!isArrayBufferView(buffer))\n throw new ERR_INVALID_ARG_TYPE2(name, [\"Buffer\", \"TypedArray\", \"DataView\"], buffer);\n });\n function validateEncoding(data, encoding) {\n const normalizedEncoding = normalizeEncoding(encoding), length = data.length;\n if (normalizedEncoding === \"hex\" && length % 2 !== 0)\n throw new ERR_INVALID_ARG_VALUE2(\"encoding\", encoding, `is invalid for data of length ${length}`);\n }\n function validatePort(port, name = \"Port\", allowZero = !0) {\n if (typeof port !== \"number\" && typeof port !== \"string\" || typeof port === \"string\" && StringPrototypeTrim(port).length === 0 || +port !== +port >>> 0 || port > 65535 || port === 0 && !allowZero)\n throw new ERR_SOCKET_BAD_PORT(name, port, allowZero);\n return port | 0;\n }\n var validateAbortSignal = hideStackFrames((signal, name) => {\n if (signal !== void 0 && (signal === null || typeof signal !== \"object\" || !(\"aborted\" in signal)))\n throw new ERR_INVALID_ARG_TYPE2(name, \"AbortSignal\", signal);\n }), validateFunction = hideStackFrames((value, name) => {\n if (typeof value !== \"function\")\n throw new ERR_INVALID_ARG_TYPE2(name, \"Function\", value);\n }), validatePlainFunction = hideStackFrames((value, name) => {\n if (typeof value !== \"function\" || isAsyncFunction(value))\n throw new ERR_INVALID_ARG_TYPE2(name, \"Function\", value);\n }), validateUndefined = hideStackFrames((value, name) => {\n if (value !== void 0)\n throw new ERR_INVALID_ARG_TYPE2(name, \"undefined\", value);\n });\n module.exports = {\n isInt32,\n isUint32,\n parseFileMode,\n validateArray,\n validateBoolean: validateBoolean2,\n validateBuffer,\n validateEncoding,\n validateFunction,\n validateInt32,\n validateInteger,\n validateNumber,\n validateObject,\n validateOneOf,\n validatePlainFunction,\n validatePort,\n validateSignalName,\n validateString,\n validateUint32,\n validateUndefined,\n validateAbortSignal\n };\n }\n}), require_utils = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/utils.js\"(exports, module) {\n var { Symbol: Symbol2, SymbolAsyncIterator, SymbolIterator } = require_primordials(), kDestroyed = Symbol2(\"kDestroyed\"), kIsErrored = Symbol2(\"kIsErrored\"), kIsReadable = Symbol2(\"kIsReadable\"), kIsDisturbed = Symbol2(\"kIsDisturbed\");\n function isReadableNodeStream(obj, strict = !1) {\n var _obj$_readableState;\n return !!(obj && typeof obj.pipe === \"function\" && typeof obj.on === \"function\" && (!strict || typeof obj.pause === \"function\" && typeof obj.resume === \"function\") && (!obj._writableState || ((_obj$_readableState = obj._readableState) === null || _obj$_readableState === void 0 \? void 0 : _obj$_readableState.readable) !== !1) && (!obj._writableState || obj._readableState));\n }\n function isWritableNodeStream(obj) {\n var _obj$_writableState;\n return !!(obj && typeof obj.write === \"function\" && typeof obj.on === \"function\" && (!obj._readableState || ((_obj$_writableState = obj._writableState) === null || _obj$_writableState === void 0 \? void 0 : _obj$_writableState.writable) !== !1));\n }\n function isDuplexNodeStream(obj) {\n return !!(obj && typeof obj.pipe === \"function\" && obj._readableState && typeof obj.on === \"function\" && typeof obj.write === \"function\");\n }\n function isNodeStream(obj) {\n return obj && (obj._readableState || obj._writableState || typeof obj.write === \"function\" && typeof obj.on === \"function\" || typeof obj.pipe === \"function\" && typeof obj.on === \"function\");\n }\n function isIterable(obj, isAsync) {\n if (obj == null)\n return !1;\n if (isAsync === !0)\n return typeof obj[SymbolAsyncIterator] === \"function\";\n if (isAsync === !1)\n return typeof obj[SymbolIterator] === \"function\";\n return typeof obj[SymbolAsyncIterator] === \"function\" || typeof obj[SymbolIterator] === \"function\";\n }\n function isDestroyed(stream) {\n if (!isNodeStream(stream))\n return null;\n const { _writableState: wState, _readableState: rState } = stream, state = wState || rState;\n return !!(stream.destroyed || stream[kDestroyed] || state !== null && state !== void 0 && state.destroyed);\n }\n function isWritableEnded(stream) {\n if (!isWritableNodeStream(stream))\n return null;\n if (stream.writableEnded === !0)\n return !0;\n const wState = stream._writableState;\n if (wState !== null && wState !== void 0 && wState.errored)\n return !1;\n if (typeof (wState === null || wState === void 0 \? void 0 : wState.ended) !== \"boolean\")\n return null;\n return wState.ended;\n }\n function isWritableFinished(stream, strict) {\n if (!isWritableNodeStream(stream))\n return null;\n if (stream.writableFinished === !0)\n return !0;\n const wState = stream._writableState;\n if (wState !== null && wState !== void 0 && wState.errored)\n return !1;\n if (typeof (wState === null || wState === void 0 \? void 0 : wState.finished) !== \"boolean\")\n return null;\n return !!(wState.finished || strict === !1 && wState.ended === !0 && wState.length === 0);\n }\n function isReadableEnded(stream) {\n if (!isReadableNodeStream(stream))\n return null;\n if (stream.readableEnded === !0)\n return !0;\n const rState = stream._readableState;\n if (!rState || rState.errored)\n return !1;\n if (typeof (rState === null || rState === void 0 \? void 0 : rState.ended) !== \"boolean\")\n return null;\n return rState.ended;\n }\n function isReadableFinished(stream, strict) {\n if (!isReadableNodeStream(stream))\n return null;\n const rState = stream._readableState;\n if (rState !== null && rState !== void 0 && rState.errored)\n return !1;\n if (typeof (rState === null || rState === void 0 \? void 0 : rState.endEmitted) !== \"boolean\")\n return null;\n return !!(rState.endEmitted || strict === !1 && rState.ended === !0 && rState.length === 0);\n }\n function isReadable(stream) {\n if (stream && stream[kIsReadable] != null)\n return stream[kIsReadable];\n if (typeof (stream === null || stream === void 0 \? void 0 : stream.readable) !== \"boolean\")\n return null;\n if (isDestroyed(stream))\n return !1;\n return isReadableNodeStream(stream) && stream.readable && !isReadableFinished(stream);\n }\n function isWritable(stream) {\n if (typeof (stream === null || stream === void 0 \? void 0 : stream.writable) !== \"boolean\")\n return null;\n if (isDestroyed(stream))\n return !1;\n return isWritableNodeStream(stream) && stream.writable && !isWritableEnded(stream);\n }\n function isFinished(stream, opts) {\n if (!isNodeStream(stream))\n return null;\n if (isDestroyed(stream))\n return !0;\n if ((opts === null || opts === void 0 \? void 0 : opts.readable) !== !1 && isReadable(stream))\n return !1;\n if ((opts === null || opts === void 0 \? void 0 : opts.writable) !== !1 && isWritable(stream))\n return !1;\n return !0;\n }\n function isWritableErrored(stream) {\n var _stream$_writableStat, _stream$_writableStat2;\n if (!isNodeStream(stream))\n return null;\n if (stream.writableErrored)\n return stream.writableErrored;\n return (_stream$_writableStat = (_stream$_writableStat2 = stream._writableState) === null || _stream$_writableStat2 === void 0 \? void 0 : _stream$_writableStat2.errored) !== null && _stream$_writableStat !== void 0 \? _stream$_writableStat : null;\n }\n function isReadableErrored(stream) {\n var _stream$_readableStat, _stream$_readableStat2;\n if (!isNodeStream(stream))\n return null;\n if (stream.readableErrored)\n return stream.readableErrored;\n return (_stream$_readableStat = (_stream$_readableStat2 = stream._readableState) === null || _stream$_readableStat2 === void 0 \? void 0 : _stream$_readableStat2.errored) !== null && _stream$_readableStat !== void 0 \? _stream$_readableStat : null;\n }\n function isClosed(stream) {\n if (!isNodeStream(stream))\n return null;\n if (typeof stream.closed === \"boolean\")\n return stream.closed;\n const { _writableState: wState, _readableState: rState } = stream;\n if (typeof (wState === null || wState === void 0 \? void 0 : wState.closed) === \"boolean\" || typeof (rState === null || rState === void 0 \? void 0 : rState.closed) === \"boolean\")\n return (wState === null || wState === void 0 \? void 0 : wState.closed) || (rState === null || rState === void 0 \? void 0 : rState.closed);\n if (typeof stream._closed === \"boolean\" && isOutgoingMessage(stream))\n return stream._closed;\n return null;\n }\n function isOutgoingMessage(stream) {\n return typeof stream._closed === \"boolean\" && typeof stream._defaultKeepAlive === \"boolean\" && typeof stream._removedConnection === \"boolean\" && typeof stream._removedContLen === \"boolean\";\n }\n function isServerResponse(stream) {\n return typeof stream._sent100 === \"boolean\" && isOutgoingMessage(stream);\n }\n function isServerRequest(stream) {\n var _stream$req;\n return typeof stream._consuming === \"boolean\" && typeof stream._dumped === \"boolean\" && ((_stream$req = stream.req) === null || _stream$req === void 0 \? void 0 : _stream$req.upgradeOrConnect) === void 0;\n }\n function willEmitClose(stream) {\n if (!isNodeStream(stream))\n return null;\n const { _writableState: wState, _readableState: rState } = stream, state = wState || rState;\n return !state && isServerResponse(stream) || !!(state && state.autoDestroy && state.emitClose && state.closed === !1);\n }\n function isDisturbed(stream) {\n var _stream$kIsDisturbed;\n return !!(stream && ((_stream$kIsDisturbed = stream[kIsDisturbed]) !== null && _stream$kIsDisturbed !== void 0 \? _stream$kIsDisturbed : stream.readableDidRead || stream.readableAborted));\n }\n function isErrored(stream) {\n var _ref, _ref2, _ref3, _ref4, _ref5, _stream$kIsErrored, _stream$_readableStat3, _stream$_writableStat3, _stream$_readableStat4, _stream$_writableStat4;\n return !!(stream && ((_ref = (_ref2 = (_ref3 = (_ref4 = (_ref5 = (_stream$kIsErrored = stream[kIsErrored]) !== null && _stream$kIsErrored !== void 0 \? _stream$kIsErrored : stream.readableErrored) !== null && _ref5 !== void 0 \? _ref5 : stream.writableErrored) !== null && _ref4 !== void 0 \? _ref4 : (_stream$_readableStat3 = stream._readableState) === null || _stream$_readableStat3 === void 0 \? void 0 : _stream$_readableStat3.errorEmitted) !== null && _ref3 !== void 0 \? _ref3 : (_stream$_writableStat3 = stream._writableState) === null || _stream$_writableStat3 === void 0 \? void 0 : _stream$_writableStat3.errorEmitted) !== null && _ref2 !== void 0 \? _ref2 : (_stream$_readableStat4 = stream._readableState) === null || _stream$_readableStat4 === void 0 \? void 0 : _stream$_readableStat4.errored) !== null && _ref !== void 0 \? _ref : (_stream$_writableStat4 = stream._writableState) === null || _stream$_writableStat4 === void 0 \? void 0 : _stream$_writableStat4.errored));\n }\n module.exports = {\n kDestroyed,\n isDisturbed,\n kIsDisturbed,\n isErrored,\n kIsErrored,\n isReadable,\n kIsReadable,\n isClosed,\n isDestroyed,\n isDuplexNodeStream,\n isFinished,\n isIterable,\n isReadableNodeStream,\n isReadableEnded,\n isReadableFinished,\n isReadableErrored,\n isNodeStream,\n isWritable,\n isWritableNodeStream,\n isWritableEnded,\n isWritableFinished,\n isWritableErrored,\n isServerRequest,\n isServerResponse,\n willEmitClose\n };\n }\n}), require_end_of_stream = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/end-of-stream.js\"(exports, module) {\n var { AbortError: AbortError2, codes } = require_errors(), { ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE2, ERR_STREAM_PREMATURE_CLOSE } = codes, { once } = require_util(), { validateAbortSignal, validateFunction, validateObject } = require_validators(), { Promise: Promise2 } = require_primordials(), {\n isClosed,\n isReadable,\n isReadableNodeStream,\n isReadableFinished,\n isReadableErrored,\n isWritable,\n isWritableNodeStream,\n isWritableFinished,\n isWritableErrored,\n isNodeStream,\n willEmitClose: _willEmitClose\n } = require_utils();\n function isRequest(stream) {\n return stream.setHeader && typeof stream.abort === \"function\";\n }\n var nop = () => {\n };\n function eos(stream, options, callback) {\n var _options$readable, _options$writable;\n if (arguments.length === 2)\n callback = options, options = {};\n else if (options == null)\n options = {};\n else\n validateObject(options, \"options\");\n validateFunction(callback, \"callback\"), validateAbortSignal(options.signal, \"options.signal\"), callback = once(callback);\n const readable = (_options$readable = options.readable) !== null && _options$readable !== void 0 \? _options$readable : isReadableNodeStream(stream), writable = (_options$writable = options.writable) !== null && _options$writable !== void 0 \? _options$writable : isWritableNodeStream(stream);\n if (!isNodeStream(stream))\n throw new ERR_INVALID_ARG_TYPE2(\"stream\", \"Stream\", stream);\n const { _writableState: wState, _readableState: rState } = stream, onlegacyfinish = () => {\n if (!stream.writable)\n onfinish();\n };\n let willEmitClose = _willEmitClose(stream) && isReadableNodeStream(stream) === readable && isWritableNodeStream(stream) === writable, writableFinished = isWritableFinished(stream, !1);\n const onfinish = () => {\n if (writableFinished = !0, stream.destroyed)\n willEmitClose = !1;\n if (willEmitClose && (!stream.readable || readable))\n return;\n if (!readable || readableFinished)\n callback.@call(stream);\n };\n let readableFinished = isReadableFinished(stream, !1);\n const onend = () => {\n if (readableFinished = !0, stream.destroyed)\n willEmitClose = !1;\n if (willEmitClose && (!stream.writable || writable))\n return;\n if (!writable || writableFinished)\n callback.@call(stream);\n }, onerror = (err) => {\n callback.@call(stream, err);\n };\n let closed = isClosed(stream);\n const onclose = () => {\n closed = !0;\n const errored = isWritableErrored(stream) || isReadableErrored(stream);\n if (errored && typeof errored !== \"boolean\")\n return callback.@call(stream, errored);\n if (readable && !readableFinished && isReadableNodeStream(stream, !0)) {\n if (!isReadableFinished(stream, !1))\n return callback.@call(stream, new ERR_STREAM_PREMATURE_CLOSE);\n }\n if (writable && !writableFinished) {\n if (!isWritableFinished(stream, !1))\n return callback.@call(stream, new ERR_STREAM_PREMATURE_CLOSE);\n }\n callback.@call(stream);\n }, onrequest = () => {\n stream.req.on(\"finish\", onfinish);\n };\n if (isRequest(stream)) {\n if (stream.on(\"complete\", onfinish), !willEmitClose)\n stream.on(\"abort\", onclose);\n if (stream.req)\n onrequest();\n else\n stream.on(\"request\", onrequest);\n } else if (writable && !wState)\n stream.on(\"end\", onlegacyfinish), stream.on(\"close\", onlegacyfinish);\n if (!willEmitClose && typeof stream.aborted === \"boolean\")\n stream.on(\"aborted\", onclose);\n if (stream.on(\"end\", onend), stream.on(\"finish\", onfinish), options.error !== !1)\n stream.on(\"error\", onerror);\n if (stream.on(\"close\", onclose), closed)\n runOnNextTick(onclose);\n else if (wState !== null && wState !== void 0 && wState.errorEmitted || rState !== null && rState !== void 0 && rState.errorEmitted) {\n if (!willEmitClose)\n runOnNextTick(onclose);\n } else if (!readable && (!willEmitClose || isReadable(stream)) && (writableFinished || isWritable(stream) === !1))\n runOnNextTick(onclose);\n else if (!writable && (!willEmitClose || isWritable(stream)) && (readableFinished || isReadable(stream) === !1))\n runOnNextTick(onclose);\n else if (rState && stream.req && stream.aborted)\n runOnNextTick(onclose);\n const cleanup = () => {\n if (callback = nop, stream.removeListener(\"aborted\", onclose), stream.removeListener(\"complete\", onfinish), stream.removeListener(\"abort\", onclose), stream.removeListener(\"request\", onrequest), stream.req)\n stream.req.removeListener(\"finish\", onfinish);\n stream.removeListener(\"end\", onlegacyfinish), stream.removeListener(\"close\", onlegacyfinish), stream.removeListener(\"finish\", onfinish), stream.removeListener(\"end\", onend), stream.removeListener(\"error\", onerror), stream.removeListener(\"close\", onclose);\n };\n if (options.signal && !closed) {\n const abort = () => {\n const endCallback = callback;\n cleanup(), endCallback.@call(stream, new AbortError2(void 0, {\n cause: options.signal.reason\n }));\n };\n if (options.signal.aborted)\n runOnNextTick(abort);\n else {\n const originalCallback = callback;\n callback = once((...args) => {\n options.signal.removeEventListener(\"abort\", abort), originalCallback.@apply(stream, args);\n }), options.signal.addEventListener(\"abort\", abort);\n }\n }\n return cleanup;\n }\n function finished(stream, opts) {\n return new Promise2((resolve, reject) => {\n eos(stream, opts, (err) => {\n if (err)\n reject(err);\n else\n resolve();\n });\n });\n }\n module.exports = eos, module.exports.finished = finished;\n }\n}), require_operators = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/operators.js\"(exports, module) {\n var {\n codes: { ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE2, ERR_MISSING_ARGS, ERR_OUT_OF_RANGE },\n AbortError: AbortError2\n } = require_errors(), { validateAbortSignal, validateInteger, validateObject } = require_validators(), kWeakHandler = require_primordials().Symbol(\"kWeak\"), { finished } = require_end_of_stream(), {\n ArrayPrototypePush,\n MathFloor,\n Number: Number2,\n NumberIsNaN,\n Promise: Promise2,\n PromiseReject,\n PromisePrototypeCatch,\n Symbol: Symbol2\n } = require_primordials(), kEmpty = Symbol2(\"kEmpty\"), kEof = Symbol2(\"kEof\");\n function map(fn, options) {\n if (typeof fn !== \"function\")\n throw new ERR_INVALID_ARG_TYPE2(\"fn\", [\"Function\", \"AsyncFunction\"], fn);\n if (options != null)\n validateObject(options, \"options\");\n if ((options === null || options === void 0 \? void 0 : options.signal) != null)\n validateAbortSignal(options.signal, \"options.signal\");\n let concurrency = 1;\n if ((options === null || options === void 0 \? void 0 : options.concurrency) != null)\n concurrency = MathFloor(options.concurrency);\n return validateInteger(concurrency, \"concurrency\", 1), async function* map2() {\n var _options$signal, _options$signal2;\n const ac = new AbortController, stream = this, queue = [], signal = ac.signal, signalOpt = {\n signal\n }, abort = () => ac.abort();\n if (options !== null && options !== void 0 && (_options$signal = options.signal) !== null && _options$signal !== void 0 && _options$signal.aborted)\n abort();\n options === null || options === void 0 || (_options$signal2 = options.signal) === null || _options$signal2 === void 0 || _options$signal2.addEventListener(\"abort\", abort);\n let next, resume, done = !1;\n function onDone() {\n done = !0;\n }\n async function pump() {\n try {\n for await (let val of stream) {\n var _val;\n if (done)\n return;\n if (signal.aborted)\n throw new AbortError2;\n try {\n val = fn(val, signalOpt);\n } catch (err) {\n val = PromiseReject(err);\n }\n if (val === kEmpty)\n continue;\n if (typeof ((_val = val) === null || _val === void 0 \? void 0 : _val.catch) === \"function\")\n val.catch(onDone);\n if (queue.push(val), next)\n next(), next = null;\n if (!done && queue.length && queue.length >= concurrency)\n await new Promise2((resolve) => {\n resume = resolve;\n });\n }\n queue.push(kEof);\n } catch (err) {\n const val = PromiseReject(err);\n PromisePrototypeCatch(val, onDone), queue.push(val);\n } finally {\n var _options$signal3;\n if (done = !0, next)\n next(), next = null;\n options === null || options === void 0 || (_options$signal3 = options.signal) === null || _options$signal3 === void 0 || _options$signal3.removeEventListener(\"abort\", abort);\n }\n }\n pump();\n try {\n while (!0) {\n while (queue.length > 0) {\n const val = await queue[0];\n if (val === kEof)\n return;\n if (signal.aborted)\n throw new AbortError2;\n if (val !== kEmpty)\n yield val;\n if (queue.shift(), resume)\n resume(), resume = null;\n }\n await new Promise2((resolve) => {\n next = resolve;\n });\n }\n } finally {\n if (ac.abort(), done = !0, resume)\n resume(), resume = null;\n }\n }.@call(this);\n }\n function asIndexedPairs(options = void 0) {\n if (options != null)\n validateObject(options, \"options\");\n if ((options === null || options === void 0 \? void 0 : options.signal) != null)\n validateAbortSignal(options.signal, \"options.signal\");\n return async function* asIndexedPairs2() {\n let index = 0;\n for await (let val of this) {\n var _options$signal4;\n if (options !== null && options !== void 0 && (_options$signal4 = options.signal) !== null && _options$signal4 !== void 0 && _options$signal4.aborted)\n throw new AbortError2({\n cause: options.signal.reason\n });\n yield [index++, val];\n }\n }.@call(this);\n }\n async function some(fn, options = void 0) {\n for await (let unused of filter.@call(this, fn, options))\n return !0;\n return !1;\n }\n async function every(fn, options = void 0) {\n if (typeof fn !== \"function\")\n throw new ERR_INVALID_ARG_TYPE2(\"fn\", [\"Function\", \"AsyncFunction\"], fn);\n return !await some.@call(this, async (...args) => {\n return !await fn(...args);\n }, options);\n }\n async function find(fn, options) {\n for await (let result of filter.@call(this, fn, options))\n return result;\n return;\n }\n async function forEach(fn, options) {\n if (typeof fn !== \"function\")\n throw new ERR_INVALID_ARG_TYPE2(\"fn\", [\"Function\", \"AsyncFunction\"], fn);\n async function forEachFn(value, options2) {\n return await fn(value, options2), kEmpty;\n }\n for await (let unused of map.@call(this, forEachFn, options))\n ;\n }\n function filter(fn, options) {\n if (typeof fn !== \"function\")\n throw new ERR_INVALID_ARG_TYPE2(\"fn\", [\"Function\", \"AsyncFunction\"], fn);\n async function filterFn(value, options2) {\n if (await fn(value, options2))\n return value;\n return kEmpty;\n }\n return map.@call(this, filterFn, options);\n }\n var ReduceAwareErrMissingArgs = class extends ERR_MISSING_ARGS {\n constructor() {\n super(\"reduce\");\n this.message = \"Reduce of an empty stream requires an initial value\";\n }\n };\n async function reduce(reducer, initialValue, options) {\n var _options$signal5;\n if (typeof reducer !== \"function\")\n throw new ERR_INVALID_ARG_TYPE2(\"reducer\", [\"Function\", \"AsyncFunction\"], reducer);\n if (options != null)\n validateObject(options, \"options\");\n if ((options === null || options === void 0 \? void 0 : options.signal) != null)\n validateAbortSignal(options.signal, \"options.signal\");\n let hasInitialValue = arguments.length > 1;\n if (options !== null && options !== void 0 && (_options$signal5 = options.signal) !== null && _options$signal5 !== void 0 && _options$signal5.aborted) {\n const err = new AbortError2(void 0, {\n cause: options.signal.reason\n });\n throw this.once(\"error\", () => {\n }), await finished(this.destroy(err)), err;\n }\n const ac = new AbortController, signal = ac.signal;\n if (options !== null && options !== void 0 && options.signal) {\n const opts = {\n once: !0,\n [kWeakHandler]: this\n };\n options.signal.addEventListener(\"abort\", () => ac.abort(), opts);\n }\n let gotAnyItemFromStream = !1;\n try {\n for await (let value of this) {\n var _options$signal6;\n if (gotAnyItemFromStream = !0, options !== null && options !== void 0 && (_options$signal6 = options.signal) !== null && _options$signal6 !== void 0 && _options$signal6.aborted)\n throw new AbortError2;\n if (!hasInitialValue)\n initialValue = value, hasInitialValue = !0;\n else\n initialValue = await reducer(initialValue, value, {\n signal\n });\n }\n if (!gotAnyItemFromStream && !hasInitialValue)\n throw new ReduceAwareErrMissingArgs;\n } finally {\n ac.abort();\n }\n return initialValue;\n }\n async function toArray(options) {\n if (options != null)\n validateObject(options, \"options\");\n if ((options === null || options === void 0 \? void 0 : options.signal) != null)\n validateAbortSignal(options.signal, \"options.signal\");\n const result = [];\n for await (let val of this) {\n var _options$signal7;\n if (options !== null && options !== void 0 && (_options$signal7 = options.signal) !== null && _options$signal7 !== void 0 && _options$signal7.aborted)\n throw new AbortError2(void 0, {\n cause: options.signal.reason\n });\n ArrayPrototypePush(result, val);\n }\n return result;\n }\n function flatMap(fn, options) {\n const values = map.@call(this, fn, options);\n return async function* flatMap2() {\n for await (let val of values)\n yield* val;\n }.@call(this);\n }\n function toIntegerOrInfinity(number) {\n if (number = Number2(number), NumberIsNaN(number))\n return 0;\n if (number < 0)\n throw new ERR_OUT_OF_RANGE(\"number\", \">= 0\", number);\n return number;\n }\n function drop(number, options = void 0) {\n if (options != null)\n validateObject(options, \"options\");\n if ((options === null || options === void 0 \? void 0 : options.signal) != null)\n validateAbortSignal(options.signal, \"options.signal\");\n return number = toIntegerOrInfinity(number), async function* drop2() {\n var _options$signal8;\n if (options !== null && options !== void 0 && (_options$signal8 = options.signal) !== null && _options$signal8 !== void 0 && _options$signal8.aborted)\n throw new AbortError2;\n for await (let val of this) {\n var _options$signal9;\n if (options !== null && options !== void 0 && (_options$signal9 = options.signal) !== null && _options$signal9 !== void 0 && _options$signal9.aborted)\n throw new AbortError2;\n if (number-- <= 0)\n yield val;\n }\n }.@call(this);\n }\n function take(number, options = void 0) {\n if (options != null)\n validateObject(options, \"options\");\n if ((options === null || options === void 0 \? void 0 : options.signal) != null)\n validateAbortSignal(options.signal, \"options.signal\");\n return number = toIntegerOrInfinity(number), async function* take2() {\n var _options$signal10;\n if (options !== null && options !== void 0 && (_options$signal10 = options.signal) !== null && _options$signal10 !== void 0 && _options$signal10.aborted)\n throw new AbortError2;\n for await (let val of this) {\n var _options$signal11;\n if (options !== null && options !== void 0 && (_options$signal11 = options.signal) !== null && _options$signal11 !== void 0 && _options$signal11.aborted)\n throw new AbortError2;\n if (number-- > 0)\n yield val;\n else\n return;\n }\n }.@call(this);\n }\n module.exports.streamReturningOperators = {\n asIndexedPairs,\n drop,\n filter,\n flatMap,\n map,\n take\n }, module.exports.promiseReturningOperators = {\n every,\n forEach,\n reduce,\n toArray,\n some,\n find\n };\n }\n}), require_destroy = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/destroy.js\"(exports, module) {\n var {\n aggregateTwoErrors,\n codes: { ERR_MULTIPLE_CALLBACK },\n AbortError: AbortError2\n } = require_errors(), { Symbol: Symbol2 } = require_primordials(), { kDestroyed, isDestroyed, isFinished, isServerRequest } = require_utils(), kDestroy = \"#kDestroy\", kConstruct = \"#kConstruct\";\n function checkError(err, w, r) {\n if (err) {\n if (err.stack, w && !w.errored)\n w.errored = err;\n if (r && !r.errored)\n r.errored = err;\n }\n }\n function destroy2(err, cb) {\n const r = this._readableState, w = this._writableState, s = w || r;\n if (w && w.destroyed || r && r.destroyed) {\n if (typeof cb === \"function\")\n cb();\n return this;\n }\n if (checkError(err, w, r), w)\n w.destroyed = !0;\n if (r)\n r.destroyed = !0;\n if (!s.constructed)\n this.once(kDestroy, (er) => {\n _destroy(this, aggregateTwoErrors(er, err), cb);\n });\n else\n _destroy(this, err, cb);\n return this;\n }\n function _destroy(self, err, cb) {\n let called = !1;\n function onDestroy(err2) {\n if (called)\n return;\n called = !0;\n const { _readableState: r, _writableState: w } = self;\n if (checkError(err2, w, r), w)\n w.closed = !0;\n if (r)\n r.closed = !0;\n if (typeof cb === \"function\")\n cb(err2);\n if (err2)\n runOnNextTick(emitErrorCloseNT, self, err2);\n else\n runOnNextTick(emitCloseNT, self);\n }\n try {\n self._destroy(err || null, onDestroy);\n } catch (err2) {\n onDestroy(err2);\n }\n }\n function emitErrorCloseNT(self, err) {\n emitErrorNT(self, err), emitCloseNT(self);\n }\n function emitCloseNT(self) {\n const { _readableState: r, _writableState: w } = self;\n if (w)\n w.closeEmitted = !0;\n if (r)\n r.closeEmitted = !0;\n if (w && w.emitClose || r && r.emitClose)\n self.emit(\"close\");\n }\n function emitErrorNT(self, err) {\n const r = self\?._readableState, w = self\?._writableState;\n if (w\?.errorEmitted || r\?.errorEmitted)\n return;\n if (w)\n w.errorEmitted = !0;\n if (r)\n r.errorEmitted = !0;\n self\?.emit\?.(\"error\", err);\n }\n function undestroy() {\n const r = this._readableState, w = this._writableState;\n if (r)\n r.constructed = !0, r.closed = !1, r.closeEmitted = !1, r.destroyed = !1, r.errored = null, r.errorEmitted = !1, r.reading = !1, r.ended = r.readable === !1, r.endEmitted = r.readable === !1;\n if (w)\n w.constructed = !0, w.destroyed = !1, w.closed = !1, w.closeEmitted = !1, w.errored = null, w.errorEmitted = !1, w.finalCalled = !1, w.prefinished = !1, w.ended = w.writable === !1, w.ending = w.writable === !1, w.finished = w.writable === !1;\n }\n function errorOrDestroy2(stream, err, sync) {\n const r = stream\?._readableState, w = stream\?._writableState;\n if (w && w.destroyed || r && r.destroyed)\n return this;\n if (r && r.autoDestroy || w && w.autoDestroy)\n stream.destroy(err);\n else if (err) {\n if (Error.captureStackTrace(err), w && !w.errored)\n w.errored = err;\n if (r && !r.errored)\n r.errored = err;\n if (sync)\n runOnNextTick(emitErrorNT, stream, err);\n else\n emitErrorNT(stream, err);\n }\n }\n function construct(stream, cb) {\n if (typeof stream._construct !== \"function\")\n return;\n const { _readableState: r, _writableState: w } = stream;\n if (r)\n r.constructed = !1;\n if (w)\n w.constructed = !1;\n if (stream.once(kConstruct, cb), stream.listenerCount(kConstruct) > 1)\n return;\n runOnNextTick(constructNT, stream);\n }\n function constructNT(stream) {\n let called = !1;\n function onConstruct(err) {\n if (called) {\n errorOrDestroy2(stream, err !== null && err !== void 0 \? err : new ERR_MULTIPLE_CALLBACK);\n return;\n }\n called = !0;\n const { _readableState: r, _writableState: w } = stream, s = w || r;\n if (r)\n r.constructed = !0;\n if (w)\n w.constructed = !0;\n if (s.destroyed)\n stream.emit(kDestroy, err);\n else if (err)\n errorOrDestroy2(stream, err, !0);\n else\n runOnNextTick(emitConstructNT, stream);\n }\n try {\n stream._construct(onConstruct);\n } catch (err) {\n onConstruct(err);\n }\n }\n function emitConstructNT(stream) {\n stream.emit(kConstruct);\n }\n function isRequest(stream) {\n return stream && stream.setHeader && typeof stream.abort === \"function\";\n }\n function emitCloseLegacy(stream) {\n stream.emit(\"close\");\n }\n function emitErrorCloseLegacy(stream, err) {\n stream.emit(\"error\", err), runOnNextTick(emitCloseLegacy, stream);\n }\n function destroyer(stream, err) {\n if (!stream || isDestroyed(stream))\n return;\n if (!err && !isFinished(stream))\n err = new AbortError2;\n if (isServerRequest(stream))\n stream.socket = null, stream.destroy(err);\n else if (isRequest(stream))\n stream.abort();\n else if (isRequest(stream.req))\n stream.req.abort();\n else if (typeof stream.destroy === \"function\")\n stream.destroy(err);\n else if (typeof stream.close === \"function\")\n stream.close();\n else if (err)\n runOnNextTick(emitErrorCloseLegacy, stream);\n else\n runOnNextTick(emitCloseLegacy, stream);\n if (!stream.destroyed)\n stream[kDestroyed] = !0;\n }\n module.exports = {\n construct,\n destroyer,\n destroy: destroy2,\n undestroy,\n errorOrDestroy: errorOrDestroy2\n };\n }\n}), require_legacy = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/legacy.js\"(exports, module) {\n var { ArrayIsArray: ArrayIsArray2, ObjectSetPrototypeOf } = require_primordials();\n function Stream(options) {\n if (!(this instanceof Stream))\n return new Stream(options);\n EE.@call(this, options);\n }\n Stream.prototype = {}, ObjectSetPrototypeOf(Stream.prototype, EE.prototype), ObjectSetPrototypeOf(Stream, EE), Stream.prototype.pipe = function(dest, options) {\n const source = this;\n function ondata(chunk) {\n if (dest.writable && dest.write(chunk) === !1 && source.pause)\n source.pause();\n }\n source.on(\"data\", ondata);\n function ondrain() {\n if (source.readable && source.resume)\n source.resume();\n }\n if (dest.on(\"drain\", ondrain), !dest._isStdio && (!options || options.end !== !1))\n source.on(\"end\", onend), source.on(\"close\", onclose);\n let didOnEnd = !1;\n function onend() {\n if (didOnEnd)\n return;\n didOnEnd = !0, dest.end();\n }\n function onclose() {\n if (didOnEnd)\n return;\n if (didOnEnd = !0, typeof dest.destroy === \"function\")\n dest.destroy();\n }\n function onerror(er) {\n if (cleanup(), EE.listenerCount(this, \"error\") === 0)\n this.emit(\"error\", er);\n }\n prependListener(source, \"error\", onerror), prependListener(dest, \"error\", onerror);\n function cleanup() {\n source.removeListener(\"data\", ondata), dest.removeListener(\"drain\", ondrain), source.removeListener(\"end\", onend), source.removeListener(\"close\", onclose), source.removeListener(\"error\", onerror), dest.removeListener(\"error\", onerror), source.removeListener(\"end\", cleanup), source.removeListener(\"close\", cleanup), dest.removeListener(\"close\", cleanup);\n }\n return source.on(\"end\", cleanup), source.on(\"close\", cleanup), dest.on(\"close\", cleanup), dest.emit(\"pipe\", source), dest;\n };\n function prependListener(emitter, event, fn) {\n if (typeof emitter.prependListener === \"function\")\n return emitter.prependListener(event, fn);\n if (!emitter._events || !emitter._events[event])\n emitter.on(event, fn);\n else if (ArrayIsArray2(emitter._events[event]))\n emitter._events[event].unshift(fn);\n else\n emitter._events[event] = [fn, emitter._events[event]];\n }\n module.exports = {\n Stream,\n prependListener\n };\n }\n}), require_add_abort_signal = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/add-abort-signal.js\"(exports, module) {\n var { AbortError: AbortError2, codes } = require_errors(), eos = require_end_of_stream(), { ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE2 } = codes, validateAbortSignal = (signal, name) => {\n if (typeof signal !== \"object\" || !(\"aborted\" in signal))\n throw new ERR_INVALID_ARG_TYPE2(name, \"AbortSignal\", signal);\n };\n function isNodeStream(obj) {\n return !!(obj && typeof obj.pipe === \"function\");\n }\n module.exports.addAbortSignal = function addAbortSignal(signal, stream) {\n if (validateAbortSignal(signal, \"signal\"), !isNodeStream(stream))\n throw new ERR_INVALID_ARG_TYPE2(\"stream\", \"stream.Stream\", stream);\n return module.exports.addAbortSignalNoValidate(signal, stream);\n }, module.exports.addAbortSignalNoValidate = function(signal, stream) {\n if (typeof signal !== \"object\" || !(\"aborted\" in signal))\n return stream;\n const onAbort = () => {\n stream.destroy(new AbortError2(void 0, {\n cause: signal.reason\n }));\n };\n if (signal.aborted)\n onAbort();\n else\n signal.addEventListener(\"abort\", onAbort), eos(stream, () => signal.removeEventListener(\"abort\", onAbort));\n return stream;\n };\n }\n}), require_state = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/state.js\"(exports, module) {\n var { MathFloor, NumberIsInteger } = require_primordials(), { ERR_INVALID_ARG_VALUE: ERR_INVALID_ARG_VALUE2 } = require_errors().codes;\n function highWaterMarkFrom(options, isDuplex, duplexKey) {\n return options.highWaterMark != null \? options.highWaterMark : isDuplex \? options[duplexKey] : null;\n }\n function getDefaultHighWaterMark(objectMode) {\n return objectMode \? 16 : 16384;\n }\n function getHighWaterMark(state, options, duplexKey, isDuplex) {\n const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);\n if (hwm != null) {\n if (!NumberIsInteger(hwm) || hwm < 0) {\n const name = isDuplex \? `options.${duplexKey}` : \"options.highWaterMark\";\n throw new ERR_INVALID_ARG_VALUE2(name, hwm);\n }\n return MathFloor(hwm);\n }\n return getDefaultHighWaterMark(state.objectMode);\n }\n module.exports = {\n getHighWaterMark,\n getDefaultHighWaterMark\n };\n }\n}), require_from = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/from.js\"(exports, module) {\n var { PromisePrototypeThen, SymbolAsyncIterator, SymbolIterator } = require_primordials(), { ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE2, ERR_STREAM_NULL_VALUES } = require_errors().codes;\n function from(Readable, iterable, opts) {\n let iterator;\n if (typeof iterable === \"string\" || iterable instanceof @Buffer)\n return new Readable({\n objectMode: !0,\n ...opts,\n read() {\n this.push(iterable), this.push(null);\n }\n });\n let isAsync;\n if (iterable && iterable[SymbolAsyncIterator])\n isAsync = !0, iterator = iterable[SymbolAsyncIterator]();\n else if (iterable && iterable[SymbolIterator])\n isAsync = !1, iterator = iterable[SymbolIterator]();\n else\n throw new ERR_INVALID_ARG_TYPE2(\"iterable\", [\"Iterable\"], iterable);\n const readable = new Readable({\n objectMode: !0,\n highWaterMark: 1,\n ...opts\n });\n let reading = !1;\n readable._read = function() {\n if (!reading)\n reading = !0, next();\n }, readable._destroy = function(error, cb) {\n PromisePrototypeThen(close(error), () => runOnNextTick(cb, error), (e) => runOnNextTick(cb, e || error));\n };\n async function close(error) {\n const hadError = error !== void 0 && error !== null, hasThrow = typeof iterator.throw === \"function\";\n if (hadError && hasThrow) {\n const { value, done } = await iterator.throw(error);\n if (await value, done)\n return;\n }\n if (typeof iterator.return === \"function\") {\n const { value } = await iterator.return();\n await value;\n }\n }\n async function next() {\n for (;; ) {\n try {\n const { value, done } = isAsync \? await iterator.next() : iterator.next();\n if (done)\n readable.push(null);\n else {\n const res = value && typeof value.then === \"function\" \? await value : value;\n if (res === null)\n throw reading = !1, new ERR_STREAM_NULL_VALUES;\n else if (readable.push(res))\n continue;\n else\n reading = !1;\n }\n } catch (err) {\n readable.destroy(err);\n }\n break;\n }\n }\n return readable;\n }\n module.exports = from;\n }\n}), _ReadableFromWeb, _ReadableFromWebForUndici, require_readable = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/readable.js\"(exports, module) {\n var {\n ArrayPrototypeIndexOf,\n NumberIsInteger,\n NumberIsNaN,\n NumberParseInt,\n ObjectDefineProperties,\n ObjectKeys,\n ObjectSetPrototypeOf,\n Promise: Promise2,\n SafeSet,\n SymbolAsyncIterator,\n Symbol: Symbol2\n } = require_primordials(), ReadableState = @lazy(\"bun:stream\").ReadableState, { Stream, prependListener } = require_legacy();\n function Readable(options) {\n if (!(this instanceof Readable))\n return new Readable(options);\n const isDuplex = this instanceof require_duplex();\n if (this._readableState = new ReadableState(options, this, isDuplex), options) {\n const { read, destroy: destroy2, construct, signal } = options;\n if (typeof read === \"function\")\n this._read = read;\n if (typeof destroy2 === \"function\")\n this._destroy = destroy2;\n if (typeof construct === \"function\")\n this._construct = construct;\n if (signal && !isDuplex)\n addAbortSignal(signal, this);\n }\n Stream.@call(this, options), destroyImpl.construct(this, () => {\n if (this._readableState.needReadable)\n maybeReadMore(this, this._readableState);\n });\n }\n Readable.prototype = {}, ObjectSetPrototypeOf(Readable.prototype, Stream.prototype), ObjectSetPrototypeOf(Readable, Stream), Readable.prototype.on = function(ev, fn) {\n const res = Stream.prototype.on.@call(this, ev, fn), state = this._readableState;\n if (ev === \"data\") {\n if (state.readableListening = this.listenerCount(\"readable\") > 0, state.flowing !== !1)\n this.resume();\n } else if (ev === \"readable\") {\n if (!state.endEmitted && !state.readableListening) {\n if (state.readableListening = state.needReadable = !0, state.flowing = !1, state.emittedReadable = !1, state.length)\n emitReadable(this, state);\n else if (!state.reading)\n runOnNextTick(nReadingNextTick, this);\n } else if (state.endEmitted)\n ;\n }\n return res;\n };\n\n class ReadableFromWeb extends Readable {\n #reader;\n #closed;\n #pendingChunks;\n #stream;\n constructor(options, stream) {\n const { objectMode, highWaterMark, encoding, signal } = options;\n super({\n objectMode,\n highWaterMark,\n encoding,\n signal\n });\n this.#pendingChunks = [], this.#reader = @undefined, this.#stream = stream, this.#closed = !1;\n }\n #drainPending() {\n var pendingChunks = this.#pendingChunks, pendingChunksI = 0, pendingChunksCount = pendingChunks.length;\n for (;pendingChunksI < pendingChunksCount; pendingChunksI++) {\n const chunk = pendingChunks[pendingChunksI];\n if (pendingChunks[pendingChunksI] = @undefined, !this.push(chunk, @undefined))\n return this.#pendingChunks = pendingChunks.slice(pendingChunksI + 1), !0;\n }\n if (pendingChunksCount > 0)\n this.#pendingChunks = [];\n return !1;\n }\n #handleDone(reader) {\n reader.releaseLock(), this.#reader = @undefined, this.#closed = !0, this.push(null);\n return;\n }\n async _read() {\n var stream = this.#stream, reader = this.#reader;\n if (stream)\n reader = this.#reader = stream.getReader(), this.#stream = @undefined;\n else if (this.#drainPending())\n return;\n var deferredError;\n try {\n do {\n var done = !1, value;\n const firstResult = reader.readMany();\n if (@isPromise(firstResult)) {\n if ({ done, value } = await firstResult, this.#closed) {\n this.#pendingChunks.push(...value);\n return;\n }\n } else\n ({ done, value } = firstResult);\n if (done) {\n this.#handleDone(reader);\n return;\n }\n if (!this.push(value[0])) {\n this.#pendingChunks = value.slice(1);\n return;\n }\n for (let i = 1, count = value.length;i < count; i++)\n if (!this.push(value[i])) {\n this.#pendingChunks = value.slice(i + 1);\n return;\n }\n } while (!this.#closed);\n } catch (e) {\n deferredError = e;\n } finally {\n if (deferredError)\n throw deferredError;\n }\n }\n _destroy(error, callback) {\n if (!this.#closed) {\n var reader = this.#reader;\n if (reader)\n this.#reader = @undefined, reader.cancel(error).finally(() => {\n this.#closed = !0, callback(error);\n });\n return;\n }\n try {\n callback(error);\n } catch (error2) {\n globalThis.reportError(error2);\n }\n }\n }\n _ReadableFromWebForUndici = ReadableFromWeb;\n function newStreamReadableFromReadableStream(readableStream, options = {}) {\n if (!isReadableStream(readableStream))\n throw new ERR_INVALID_ARG_TYPE2(\"readableStream\", \"ReadableStream\", readableStream);\n validateObject(options, \"options\");\n const {\n highWaterMark,\n encoding,\n objectMode = !1,\n signal\n } = options;\n if (encoding !== @undefined && !@Buffer.isEncoding(encoding))\n throw new ERR_INVALID_ARG_VALUE(encoding, \"options.encoding\");\n return validateBoolean(objectMode, \"options.objectMode\"), getNativeReadableStream(Readable, readableStream, options) || new ReadableFromWeb({\n highWaterMark,\n encoding,\n objectMode,\n signal\n }, readableStream);\n }\n module.exports = Readable, _ReadableFromWeb = newStreamReadableFromReadableStream;\n var { addAbortSignal } = require_add_abort_signal(), eos = require_end_of_stream();\n const { maybeReadMore: _maybeReadMore, resume, emitReadable: _emitReadable, onEofChunk } = @lazy(\"bun:stream\");\n function maybeReadMore(stream, state) {\n process.nextTick(_maybeReadMore, stream, state);\n }\n function emitReadable(stream, state) {\n _emitReadable(stream, state);\n }\n var destroyImpl = require_destroy(), {\n aggregateTwoErrors,\n codes: {\n ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE2,\n ERR_METHOD_NOT_IMPLEMENTED,\n ERR_OUT_OF_RANGE,\n ERR_STREAM_PUSH_AFTER_EOF,\n ERR_STREAM_UNSHIFT_AFTER_END_EVENT\n }\n } = require_errors(), { validateObject } = require_validators(), from = require_from(), nop = () => {\n }, { errorOrDestroy: errorOrDestroy2 } = destroyImpl;\n Readable.prototype.destroy = destroyImpl.destroy, Readable.prototype._undestroy = destroyImpl.undestroy, Readable.prototype._destroy = function(err, cb) {\n cb(err);\n }, Readable.prototype[EE.captureRejectionSymbol] = function(err) {\n this.destroy(err);\n }, Readable.prototype.push = function(chunk, encoding) {\n return readableAddChunk(this, chunk, encoding, !1);\n }, Readable.prototype.unshift = function(chunk, encoding) {\n return readableAddChunk(this, chunk, encoding, !0);\n };\n function readableAddChunk(stream, chunk, encoding, addToFront) {\n const state = stream._readableState;\n let err;\n if (!state.objectMode) {\n if (typeof chunk === \"string\") {\n if (encoding = encoding || state.defaultEncoding, state.encoding !== encoding)\n if (addToFront && state.encoding)\n chunk = @Buffer.from(chunk, encoding).toString(state.encoding);\n else\n chunk = @Buffer.from(chunk, encoding), encoding = \"\";\n } else if (chunk instanceof @Buffer)\n encoding = \"\";\n else if (Stream._isUint8Array(chunk)) {\n if (addToFront || !state.decoder)\n chunk = Stream._uint8ArrayToBuffer(chunk);\n encoding = \"\";\n } else if (chunk != null)\n err = new ERR_INVALID_ARG_TYPE2(\"chunk\", [\"string\", \"Buffer\", \"Uint8Array\"], chunk);\n }\n if (err)\n errorOrDestroy2(stream, err);\n else if (chunk === null)\n state.reading = !1, onEofChunk(stream, state);\n else if (state.objectMode || chunk && chunk.length > 0)\n if (addToFront)\n if (state.endEmitted)\n errorOrDestroy2(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT);\n else if (state.destroyed || state.errored)\n return !1;\n else\n addChunk(stream, state, chunk, !0);\n else if (state.ended)\n errorOrDestroy2(stream, new ERR_STREAM_PUSH_AFTER_EOF);\n else if (state.destroyed || state.errored)\n return !1;\n else if (state.reading = !1, state.decoder && !encoding)\n if (chunk = state.decoder.write(chunk), state.objectMode || chunk.length !== 0)\n addChunk(stream, state, chunk, !1);\n else\n maybeReadMore(stream, state);\n else\n addChunk(stream, state, chunk, !1);\n else if (!addToFront)\n state.reading = !1, maybeReadMore(stream, state);\n return !state.ended && (state.length < state.highWaterMark || state.length === 0);\n }\n function addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync && stream.listenerCount(\"data\") > 0) {\n if (state.multiAwaitDrain)\n state.awaitDrainWriters.clear();\n else\n state.awaitDrainWriters = null;\n state.dataEmitted = !0, stream.emit(\"data\", chunk);\n } else {\n if (state.length += state.objectMode \? 1 : chunk.length, addToFront)\n state.buffer.unshift(chunk);\n else\n state.buffer.push(chunk);\n if (state.needReadable)\n emitReadable(stream, state);\n }\n maybeReadMore(stream, state);\n }\n Readable.prototype.isPaused = function() {\n const state = this._readableState;\n return state.paused === !0 || state.flowing === !1;\n }, Readable.prototype.setEncoding = function(enc) {\n const decoder = new StringDecoder(enc);\n this._readableState.decoder = decoder, this._readableState.encoding = this._readableState.decoder.encoding;\n const buffer = this._readableState.buffer;\n let content = \"\";\n for (let i = buffer.length;i > 0; i--)\n content += decoder.write(buffer.shift());\n if (content !== \"\")\n buffer.push(content);\n return this._readableState.length = content.length, this;\n };\n var MAX_HWM = 1073741824;\n function computeNewHighWaterMark(n) {\n if (n > MAX_HWM)\n throw new ERR_OUT_OF_RANGE(\"size\", \"<= 1GiB\", n);\n else\n n--, n |= n >>> 1, n |= n >>> 2, n |= n >>> 4, n |= n >>> 8, n |= n >>> 16, n++;\n return n;\n }\n function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended)\n return 0;\n if (state.objectMode)\n return 1;\n if (NumberIsNaN(n)) {\n if (state.flowing && state.length)\n return state.buffer.first().length;\n return state.length;\n }\n if (n <= state.length)\n return n;\n return state.ended \? state.length : 0;\n }\n Readable.prototype.read = function(n) {\n if (!NumberIsInteger(n))\n n = NumberParseInt(n, 10);\n const state = this._readableState, nOrig = n;\n if (n > state.highWaterMark)\n state.highWaterMark = computeNewHighWaterMark(n);\n if (n !== 0)\n state.emittedReadable = !1;\n if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 \? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {\n if (state.length === 0 && state.ended)\n endReadable(this);\n else\n emitReadable(this, state);\n return null;\n }\n if (n = howMuchToRead(n, state), n === 0 && state.ended) {\n if (state.length === 0)\n endReadable(this);\n return null;\n }\n let doRead = state.needReadable;\n if (state.length === 0 || state.length - n < state.highWaterMark)\n doRead = !0;\n if (state.ended || state.reading || state.destroyed || state.errored || !state.constructed)\n doRead = !1;\n else if (doRead) {\n if (state.reading = !0, state.sync = !0, state.length === 0)\n state.needReadable = !0;\n try {\n var result = this._read(state.highWaterMark);\n if (@isPromise(result)) {\n const peeked = Bun.peek(result);\n if (peeked !== result)\n result = peeked;\n }\n if (@isPromise(result) && result\?.then && @isCallable(result.then))\n result.then(nop, function(err) {\n errorOrDestroy2(this, err);\n });\n } catch (err) {\n errorOrDestroy2(this, err);\n }\n if (state.sync = !1, !state.reading)\n n = howMuchToRead(nOrig, state);\n }\n let ret;\n if (n > 0)\n ret = fromList(n, state);\n else\n ret = null;\n if (ret === null)\n state.needReadable = state.length <= state.highWaterMark, n = 0;\n else if (state.length -= n, state.multiAwaitDrain)\n state.awaitDrainWriters.clear();\n else\n state.awaitDrainWriters = null;\n if (state.length === 0) {\n if (!state.ended)\n state.needReadable = !0;\n if (nOrig !== n && state.ended)\n endReadable(this);\n }\n if (ret !== null && !state.errorEmitted && !state.closeEmitted)\n state.dataEmitted = !0, this.emit(\"data\", ret);\n return ret;\n }, Readable.prototype._read = function(n) {\n throw new ERR_METHOD_NOT_IMPLEMENTED(\"_read()\");\n }, Readable.prototype.pipe = function(dest, pipeOpts) {\n const src = this, state = this._readableState;\n if (state.pipes.length === 1) {\n if (!state.multiAwaitDrain)\n state.multiAwaitDrain = !0, state.awaitDrainWriters = new SafeSet(state.awaitDrainWriters \? [state.awaitDrainWriters] : []);\n }\n state.pipes.push(dest);\n const endFn = (!pipeOpts || pipeOpts.end !== !1) && dest !== process.stdout && dest !== process.stderr \? onend : unpipe;\n if (state.endEmitted)\n runOnNextTick(endFn);\n else\n src.once(\"end\", endFn);\n dest.on(\"unpipe\", onunpipe);\n function onunpipe(readable, unpipeInfo) {\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === !1)\n unpipeInfo.hasUnpiped = !0, cleanup();\n }\n }\n function onend() {\n dest.end();\n }\n let ondrain, cleanedUp = !1;\n function cleanup() {\n if (dest.removeListener(\"close\", onclose), dest.removeListener(\"finish\", onfinish), ondrain)\n dest.removeListener(\"drain\", ondrain);\n if (dest.removeListener(\"error\", onerror), dest.removeListener(\"unpipe\", onunpipe), src.removeListener(\"end\", onend), src.removeListener(\"end\", unpipe), src.removeListener(\"data\", ondata), cleanedUp = !0, ondrain && state.awaitDrainWriters && (!dest._writableState || dest._writableState.needDrain))\n ondrain();\n }\n function pause() {\n if (!cleanedUp) {\n if (state.pipes.length === 1 && state.pipes[0] === dest)\n state.awaitDrainWriters = dest, state.multiAwaitDrain = !1;\n else if (state.pipes.length > 1 && state.pipes.includes(dest))\n state.awaitDrainWriters.add(dest);\n src.pause();\n }\n if (!ondrain)\n ondrain = pipeOnDrain(src, dest), dest.on(\"drain\", ondrain);\n }\n src.on(\"data\", ondata);\n function ondata(chunk) {\n if (dest.write(chunk) === !1)\n pause();\n }\n function onerror(er) {\n if (unpipe(), dest.removeListener(\"error\", onerror), dest.listenerCount(\"error\") === 0) {\n const s = dest._writableState || dest._readableState;\n if (s && !s.errorEmitted)\n errorOrDestroy2(dest, er);\n else\n dest.emit(\"error\", er);\n }\n }\n prependListener(dest, \"error\", onerror);\n function onclose() {\n dest.removeListener(\"finish\", onfinish), unpipe();\n }\n dest.once(\"close\", onclose);\n function onfinish() {\n dest.removeListener(\"close\", onclose), unpipe();\n }\n dest.once(\"finish\", onfinish);\n function unpipe() {\n src.unpipe(dest);\n }\n if (dest.emit(\"pipe\", src), dest.writableNeedDrain === !0) {\n if (state.flowing)\n pause();\n } else if (!state.flowing)\n src.resume();\n return dest;\n };\n function pipeOnDrain(src, dest) {\n return function pipeOnDrainFunctionResult() {\n const state = src._readableState;\n if (state.awaitDrainWriters === dest)\n state.awaitDrainWriters = null;\n else if (state.multiAwaitDrain)\n state.awaitDrainWriters.delete(dest);\n if ((!state.awaitDrainWriters || state.awaitDrainWriters.size === 0) && src.listenerCount(\"data\"))\n src.resume();\n };\n }\n Readable.prototype.unpipe = function(dest) {\n const state = this._readableState, unpipeInfo = {\n hasUnpiped: !1\n };\n if (state.pipes.length === 0)\n return this;\n if (!dest) {\n const dests = state.pipes;\n state.pipes = [], this.pause();\n for (let i = 0;i < dests.length; i++)\n dests[i].emit(\"unpipe\", this, {\n hasUnpiped: !1\n });\n return this;\n }\n const index = ArrayPrototypeIndexOf(state.pipes, dest);\n if (index === -1)\n return this;\n if (state.pipes.splice(index, 1), state.pipes.length === 0)\n this.pause();\n return dest.emit(\"unpipe\", this, unpipeInfo), this;\n }, Readable.prototype.addListener = Readable.prototype.on, Readable.prototype.removeListener = function(ev, fn) {\n const res = Stream.prototype.removeListener.@call(this, ev, fn);\n if (ev === \"readable\")\n runOnNextTick(updateReadableListening, this);\n return res;\n }, Readable.prototype.off = Readable.prototype.removeListener, Readable.prototype.removeAllListeners = function(ev) {\n const res = Stream.prototype.removeAllListeners.@apply(this, arguments);\n if (ev === \"readable\" || ev === void 0)\n runOnNextTick(updateReadableListening, this);\n return res;\n };\n function updateReadableListening(self) {\n const state = self._readableState;\n if (state.readableListening = self.listenerCount(\"readable\") > 0, state.resumeScheduled && state.paused === !1)\n state.flowing = !0;\n else if (self.listenerCount(\"data\") > 0)\n self.resume();\n else if (!state.readableListening)\n state.flowing = null;\n }\n function nReadingNextTick(self) {\n self.read(0);\n }\n Readable.prototype.resume = function() {\n const state = this._readableState;\n if (!state.flowing)\n state.flowing = !state.readableListening, resume(this, state);\n return state.paused = !1, this;\n }, Readable.prototype.pause = function() {\n if (this._readableState.flowing !== !1)\n this._readableState.flowing = !1, this.emit(\"pause\");\n return this._readableState.paused = !0, this;\n }, Readable.prototype.wrap = function(stream) {\n let paused = !1;\n stream.on(\"data\", (chunk) => {\n if (!this.push(chunk) && stream.pause)\n paused = !0, stream.pause();\n }), stream.on(\"end\", () => {\n this.push(null);\n }), stream.on(\"error\", (err) => {\n errorOrDestroy2(this, err);\n }), stream.on(\"close\", () => {\n this.destroy();\n }), stream.on(\"destroy\", () => {\n this.destroy();\n }), this._read = () => {\n if (paused && stream.resume)\n paused = !1, stream.resume();\n };\n const streamKeys = ObjectKeys(stream);\n for (let j = 1;j < streamKeys.length; j++) {\n const i = streamKeys[j];\n if (this[i] === void 0 && typeof stream[i] === \"function\")\n this[i] = stream[i].bind(stream);\n }\n return this;\n }, Readable.prototype[SymbolAsyncIterator] = function() {\n return streamToAsyncIterator(this);\n }, Readable.prototype.iterator = function(options) {\n if (options !== void 0)\n validateObject(options, \"options\");\n return streamToAsyncIterator(this, options);\n };\n function streamToAsyncIterator(stream, options) {\n if (typeof stream.read !== \"function\")\n stream = Readable.wrap(stream, {\n objectMode: !0\n });\n const iter = createAsyncIterator(stream, options);\n return iter.stream = stream, iter;\n }\n async function* createAsyncIterator(stream, options) {\n let callback = nop;\n function next(resolve) {\n if (this === stream)\n callback(), callback = nop;\n else\n callback = resolve;\n }\n stream.on(\"readable\", next);\n let error;\n const cleanup = eos(stream, {\n writable: !1\n }, (err) => {\n error = err \? aggregateTwoErrors(error, err) : null, callback(), callback = nop;\n });\n try {\n while (!0) {\n const chunk = stream.destroyed \? null : stream.read();\n if (chunk !== null)\n yield chunk;\n else if (error)\n throw error;\n else if (error === null)\n return;\n else\n await new Promise2(next);\n }\n } catch (err) {\n throw error = aggregateTwoErrors(error, err), error;\n } finally {\n if ((error || (options === null || options === void 0 \? void 0 : options.destroyOnReturn) !== !1) && (error === void 0 || stream._readableState.autoDestroy))\n destroyImpl.destroyer(stream, null);\n else\n stream.off(\"readable\", next), cleanup();\n }\n }\n ObjectDefineProperties(Readable.prototype, {\n readable: {\n get() {\n const r = this._readableState;\n return !!r && r.readable !== !1 && !r.destroyed && !r.errorEmitted && !r.endEmitted;\n },\n set(val) {\n if (this._readableState)\n this._readableState.readable = !!val;\n }\n },\n readableDidRead: {\n enumerable: !1,\n get: function() {\n return this._readableState.dataEmitted;\n }\n },\n readableAborted: {\n enumerable: !1,\n get: function() {\n return !!(this._readableState.readable !== !1 && (this._readableState.destroyed || this._readableState.errored) && !this._readableState.endEmitted);\n }\n },\n readableHighWaterMark: {\n enumerable: !1,\n get: function() {\n return this._readableState.highWaterMark;\n }\n },\n readableBuffer: {\n enumerable: !1,\n get: function() {\n return this._readableState && this._readableState.buffer;\n }\n },\n readableFlowing: {\n enumerable: !1,\n get: function() {\n return this._readableState.flowing;\n },\n set: function(state) {\n if (this._readableState)\n this._readableState.flowing = state;\n }\n },\n readableLength: {\n enumerable: !1,\n get() {\n return this._readableState.length;\n }\n },\n readableObjectMode: {\n enumerable: !1,\n get() {\n return this._readableState \? this._readableState.objectMode : !1;\n }\n },\n readableEncoding: {\n enumerable: !1,\n get() {\n return this._readableState \? this._readableState.encoding : null;\n }\n },\n errored: {\n enumerable: !1,\n get() {\n return this._readableState \? this._readableState.errored : null;\n }\n },\n closed: {\n get() {\n return this._readableState \? this._readableState.closed : !1;\n }\n },\n destroyed: {\n enumerable: !1,\n get() {\n return this._readableState \? this._readableState.destroyed : !1;\n },\n set(value) {\n if (!this._readableState)\n return;\n this._readableState.destroyed = value;\n }\n },\n readableEnded: {\n enumerable: !1,\n get() {\n return this._readableState \? this._readableState.endEmitted : !1;\n }\n }\n }), Readable._fromList = fromList;\n function fromList(n, state) {\n if (state.length === 0)\n return null;\n let ret;\n if (state.objectMode)\n ret = state.buffer.shift();\n else if (!n || n >= state.length) {\n if (state.decoder)\n ret = state.buffer.join(\"\");\n else if (state.buffer.length === 1)\n ret = state.buffer.first();\n else\n ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else\n ret = state.buffer.consume(n, state.decoder);\n return ret;\n }\n function endReadable(stream) {\n const state = stream._readableState;\n if (!state.endEmitted)\n state.ended = !0, runOnNextTick(endReadableNT, state, stream);\n }\n function endReadableNT(state, stream) {\n if (!state.errored && !state.closeEmitted && !state.endEmitted && state.length === 0) {\n if (state.endEmitted = !0, stream.emit(\"end\"), stream.writable && stream.allowHalfOpen === !1)\n runOnNextTick(endWritableNT, stream);\n else if (state.autoDestroy) {\n const wState = stream._writableState;\n if (!wState || wState.autoDestroy && (wState.finished || wState.writable === !1))\n stream.destroy();\n }\n }\n }\n function endWritableNT(stream) {\n if (stream.writable && !stream.writableEnded && !stream.destroyed)\n stream.end();\n }\n Readable.from = function(iterable, opts) {\n return from(Readable, iterable, opts);\n };\n var webStreamsAdapters = {\n newStreamReadableFromReadableStream,\n newReadableStreamFromStreamReadable(streamReadable, options = {}) {\n if (typeof streamReadable\?._readableState !== \"object\")\n throw new ERR_INVALID_ARG_TYPE2(\"streamReadable\", \"stream.Readable\", streamReadable);\n var { isDestroyed, isReadable } = require_utils();\n if (isDestroyed(streamReadable) || !isReadable(streamReadable)) {\n const readable = new @ReadableStream;\n return readable.cancel(), readable;\n }\n const { readableObjectMode: objectMode, readableHighWaterMark: highWaterMark } = streamReadable, strategy = ((strategy2) => {\n if (strategy2)\n return strategy2;\n if (objectMode)\n return new CountQueuingStrategy({ highWaterMark });\n return { highWaterMark };\n })(options\?.strategy);\n let controller;\n function onData(chunk) {\n if (controller.enqueue(chunk), controller.desiredSize <= 0)\n streamReadable.pause();\n }\n streamReadable.pause();\n const cleanup = eos(streamReadable, (error) => {\n if (error\?.code === \"ERR_STREAM_PREMATURE_CLOSE\")\n error = new AbortError(@undefined, { cause: error });\n if (cleanup(), streamReadable.on(\"error\", () => {\n }), error)\n return controller.error(error);\n controller.close();\n });\n return streamReadable.on(\"data\", onData), new @ReadableStream({\n start(c) {\n controller = c;\n },\n pull() {\n streamReadable.resume();\n },\n cancel(reason) {\n destroy(streamReadable, reason);\n }\n }, strategy);\n }\n };\n Readable.fromWeb = function(readableStream, options) {\n return webStreamsAdapters.newStreamReadableFromReadableStream(readableStream, options);\n }, Readable.toWeb = function(streamReadable, options) {\n return webStreamsAdapters.newReadableStreamFromStreamReadable(streamReadable, options);\n }, Readable.wrap = function(src, options) {\n var _ref, _src$readableObjectMo;\n return new Readable({\n objectMode: (_ref = (_src$readableObjectMo = src.readableObjectMode) !== null && _src$readableObjectMo !== void 0 \? _src$readableObjectMo : src.objectMode) !== null && _ref !== void 0 \? _ref : !0,\n ...options,\n destroy(err, callback) {\n destroyImpl.destroyer(src, err), callback(err);\n }\n }).wrap(src);\n };\n }\n}), require_writable = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/writable.js\"(exports, module) {\n var {\n ArrayPrototypeSlice,\n Error: Error2,\n FunctionPrototypeSymbolHasInstance,\n ObjectDefineProperty,\n ObjectDefineProperties,\n ObjectSetPrototypeOf,\n StringPrototypeToLowerCase,\n Symbol: Symbol2,\n SymbolHasInstance\n } = require_primordials(), Stream = require_legacy().Stream, destroyImpl = require_destroy(), { addAbortSignal } = require_add_abort_signal(), { getHighWaterMark, getDefaultHighWaterMark } = require_state(), {\n ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE2,\n ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK,\n ERR_STREAM_CANNOT_PIPE,\n ERR_STREAM_DESTROYED,\n ERR_STREAM_ALREADY_FINISHED,\n ERR_STREAM_NULL_VALUES,\n ERR_STREAM_WRITE_AFTER_END,\n ERR_UNKNOWN_ENCODING\n } = require_errors().codes, { errorOrDestroy: errorOrDestroy2 } = destroyImpl;\n function Writable(options = {}) {\n const isDuplex = this instanceof require_duplex();\n if (!isDuplex && !FunctionPrototypeSymbolHasInstance(Writable, this))\n return new Writable(options);\n if (this._writableState = new WritableState(options, this, isDuplex), options) {\n if (typeof options.write === \"function\")\n this._write = options.write;\n if (typeof options.writev === \"function\")\n this._writev = options.writev;\n if (typeof options.destroy === \"function\")\n this._destroy = options.destroy;\n if (typeof options.final === \"function\")\n this._final = options.final;\n if (typeof options.construct === \"function\")\n this._construct = options.construct;\n if (options.signal)\n addAbortSignal(options.signal, this);\n }\n Stream.@call(this, options), destroyImpl.construct(this, () => {\n const state = this._writableState;\n if (!state.writing)\n clearBuffer(this, state);\n finishMaybe(this, state);\n });\n }\n Writable.prototype = {}, ObjectSetPrototypeOf(Writable.prototype, Stream.prototype), ObjectSetPrototypeOf(Writable, Stream), module.exports = Writable;\n function nop() {\n }\n var kOnFinished = Symbol2(\"kOnFinished\");\n function WritableState(options, stream, isDuplex) {\n if (typeof isDuplex !== \"boolean\")\n isDuplex = stream instanceof require_duplex();\n if (this.objectMode = !!(options && options.objectMode), isDuplex)\n this.objectMode = this.objectMode || !!(options && options.writableObjectMode);\n this.highWaterMark = options \? getHighWaterMark(this, options, \"writableHighWaterMark\", isDuplex) : getDefaultHighWaterMark(!1), this.finalCalled = !1, this.needDrain = !1, this.ending = !1, this.ended = !1, this.finished = !1, this.destroyed = !1;\n const noDecode = !!(options && options.decodeStrings === !1);\n this.decodeStrings = !noDecode, this.defaultEncoding = options && options.defaultEncoding || \"utf8\", this.length = 0, this.writing = !1, this.corked = 0, this.sync = !0, this.bufferProcessing = !1, this.onwrite = onwrite.bind(void 0, stream), this.writecb = null, this.writelen = 0, this.afterWriteTickInfo = null, resetBuffer(this), this.pendingcb = 0, this.constructed = !0, this.prefinished = !1, this.errorEmitted = !1, this.emitClose = !options || options.emitClose !== !1, this.autoDestroy = !options || options.autoDestroy !== !1, this.errored = null, this.closed = !1, this.closeEmitted = !1, this[kOnFinished] = [];\n }\n WritableState.prototype = {};\n function resetBuffer(state) {\n state.buffered = [], state.bufferedIndex = 0, state.allBuffers = !0, state.allNoop = !0;\n }\n WritableState.prototype.getBuffer = function getBuffer() {\n return ArrayPrototypeSlice(this.buffered, this.bufferedIndex);\n }, ObjectDefineProperty(WritableState.prototype, \"bufferedRequestCount\", {\n get() {\n return this.buffered.length - this.bufferedIndex;\n }\n }), ObjectDefineProperty(Writable, SymbolHasInstance, {\n value: function(object) {\n if (FunctionPrototypeSymbolHasInstance(this, object))\n return !0;\n if (this !== Writable)\n return !1;\n return object && object._writableState instanceof WritableState;\n }\n }), Writable.prototype.pipe = function() {\n errorOrDestroy2(this, new ERR_STREAM_CANNOT_PIPE);\n };\n function _write(stream, chunk, encoding, cb) {\n const state = stream._writableState;\n if (typeof encoding === \"function\")\n cb = encoding, encoding = state.defaultEncoding;\n else {\n if (!encoding)\n encoding = state.defaultEncoding;\n else if (encoding !== \"buffer\" && !@Buffer.isEncoding(encoding))\n throw new ERR_UNKNOWN_ENCODING(encoding);\n if (typeof cb !== \"function\")\n cb = nop;\n }\n if (chunk === null)\n throw new ERR_STREAM_NULL_VALUES;\n else if (!state.objectMode)\n if (typeof chunk === \"string\") {\n if (state.decodeStrings !== !1)\n chunk = @Buffer.from(chunk, encoding), encoding = \"buffer\";\n } else if (chunk instanceof @Buffer)\n encoding = \"buffer\";\n else if (Stream._isUint8Array(chunk))\n chunk = Stream._uint8ArrayToBuffer(chunk), encoding = \"buffer\";\n else\n throw new ERR_INVALID_ARG_TYPE2(\"chunk\", [\"string\", \"Buffer\", \"Uint8Array\"], chunk);\n let err;\n if (state.ending)\n err = new ERR_STREAM_WRITE_AFTER_END;\n else if (state.destroyed)\n err = new ERR_STREAM_DESTROYED(\"write\");\n if (err)\n return runOnNextTick(cb, err), errorOrDestroy2(stream, err, !0), err;\n return state.pendingcb++, writeOrBuffer(stream, state, chunk, encoding, cb);\n }\n Writable.prototype.write = function(chunk, encoding, cb) {\n return _write(this, chunk, encoding, cb) === !0;\n }, Writable.prototype.cork = function() {\n this._writableState.corked++;\n }, Writable.prototype.uncork = function() {\n const state = this._writableState;\n if (state.corked) {\n if (state.corked--, !state.writing)\n clearBuffer(this, state);\n }\n }, Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n if (typeof encoding === \"string\")\n encoding = StringPrototypeToLowerCase(encoding);\n if (!@Buffer.isEncoding(encoding))\n throw new ERR_UNKNOWN_ENCODING(encoding);\n return this._writableState.defaultEncoding = encoding, this;\n };\n function writeOrBuffer(stream, state, chunk, encoding, callback) {\n const len = state.objectMode \? 1 : chunk.length;\n state.length += len;\n const ret = state.length < state.highWaterMark;\n if (!ret)\n state.needDrain = !0;\n if (state.writing || state.corked || state.errored || !state.constructed) {\n if (state.buffered.push({\n chunk,\n encoding,\n callback\n }), state.allBuffers && encoding !== \"buffer\")\n state.allBuffers = !1;\n if (state.allNoop && callback !== nop)\n state.allNoop = !1;\n } else\n state.writelen = len, state.writecb = callback, state.writing = !0, state.sync = !0, stream._write(chunk, encoding, state.onwrite), state.sync = !1;\n return ret && !state.errored && !state.destroyed;\n }\n function doWrite(stream, state, writev, len, chunk, encoding, cb) {\n if (state.writelen = len, state.writecb = cb, state.writing = !0, state.sync = !0, state.destroyed)\n state.onwrite(new ERR_STREAM_DESTROYED(\"write\"));\n else if (writev)\n stream._writev(chunk, state.onwrite);\n else\n stream._write(chunk, encoding, state.onwrite);\n state.sync = !1;\n }\n function onwriteError(stream, state, er, cb) {\n --state.pendingcb, cb(er), errorBuffer(state), errorOrDestroy2(stream, er);\n }\n function onwrite(stream, er) {\n const state = stream._writableState, sync = state.sync, cb = state.writecb;\n if (typeof cb !== \"function\") {\n errorOrDestroy2(stream, new ERR_MULTIPLE_CALLBACK);\n return;\n }\n if (state.writing = !1, state.writecb = null, state.length -= state.writelen, state.writelen = 0, er) {\n if (Error.captureStackTrace(er), !state.errored)\n state.errored = er;\n if (stream._readableState && !stream._readableState.errored)\n stream._readableState.errored = er;\n if (sync)\n runOnNextTick(onwriteError, stream, state, er, cb);\n else\n onwriteError(stream, state, er, cb);\n } else {\n if (state.buffered.length > state.bufferedIndex)\n clearBuffer(stream, state);\n if (sync)\n if (state.afterWriteTickInfo !== null && state.afterWriteTickInfo.cb === cb)\n state.afterWriteTickInfo.count++;\n else\n state.afterWriteTickInfo = {\n count: 1,\n cb,\n stream,\n state\n }, runOnNextTick(afterWriteTick, state.afterWriteTickInfo);\n else\n afterWrite(stream, state, 1, cb);\n }\n }\n function afterWriteTick({ stream, state, count, cb }) {\n return state.afterWriteTickInfo = null, afterWrite(stream, state, count, cb);\n }\n function afterWrite(stream, state, count, cb) {\n if (!state.ending && !stream.destroyed && state.length === 0 && state.needDrain)\n state.needDrain = !1, stream.emit(\"drain\");\n while (count-- > 0)\n state.pendingcb--, cb();\n if (state.destroyed)\n errorBuffer(state);\n finishMaybe(stream, state);\n }\n function errorBuffer(state) {\n if (state.writing)\n return;\n for (let n = state.bufferedIndex;n < state.buffered.length; ++n) {\n var _state$errored;\n const { chunk, callback } = state.buffered[n], len = state.objectMode \? 1 : chunk.length;\n state.length -= len, callback((_state$errored = state.errored) !== null && _state$errored !== void 0 \? _state$errored : new ERR_STREAM_DESTROYED(\"write\"));\n }\n const onfinishCallbacks = state[kOnFinished].splice(0);\n for (let i = 0;i < onfinishCallbacks.length; i++) {\n var _state$errored2;\n onfinishCallbacks[i]((_state$errored2 = state.errored) !== null && _state$errored2 !== void 0 \? _state$errored2 : new ERR_STREAM_DESTROYED(\"end\"));\n }\n resetBuffer(state);\n }\n function clearBuffer(stream, state) {\n if (state.corked || state.bufferProcessing || state.destroyed || !state.constructed)\n return;\n const { buffered, bufferedIndex, objectMode } = state, bufferedLength = buffered.length - bufferedIndex;\n if (!bufferedLength)\n return;\n let i = bufferedIndex;\n if (state.bufferProcessing = !0, bufferedLength > 1 && stream._writev) {\n state.pendingcb -= bufferedLength - 1;\n const callback = state.allNoop \? nop : (err) => {\n for (let n = i;n < buffered.length; ++n)\n buffered[n].callback(err);\n }, chunks = state.allNoop && i === 0 \? buffered : ArrayPrototypeSlice(buffered, i);\n chunks.allBuffers = state.allBuffers, doWrite(stream, state, !0, state.length, chunks, \"\", callback), resetBuffer(state);\n } else {\n do {\n const { chunk, encoding, callback } = buffered[i];\n buffered[i++] = null;\n const len = objectMode \? 1 : chunk.length;\n doWrite(stream, state, !1, len, chunk, encoding, callback);\n } while (i < buffered.length && !state.writing);\n if (i === buffered.length)\n resetBuffer(state);\n else if (i > 256)\n buffered.splice(0, i), state.bufferedIndex = 0;\n else\n state.bufferedIndex = i;\n }\n state.bufferProcessing = !1;\n }\n Writable.prototype._write = function(chunk, encoding, cb) {\n if (this._writev)\n this._writev([\n {\n chunk,\n encoding\n }\n ], cb);\n else\n throw new ERR_METHOD_NOT_IMPLEMENTED(\"_write()\");\n }, Writable.prototype._writev = null, Writable.prototype.end = function(chunk, encoding, cb, native = !1) {\n const state = this._writableState;\n if (typeof chunk === \"function\")\n cb = chunk, chunk = null, encoding = null;\n else if (typeof encoding === \"function\")\n cb = encoding, encoding = null;\n let err;\n if (chunk !== null && chunk !== void 0) {\n let ret;\n if (!native)\n ret = _write(this, chunk, encoding);\n else\n ret = this.write(chunk, encoding);\n if (ret instanceof Error2)\n err = ret;\n }\n if (state.corked)\n state.corked = 1, this.uncork();\n if (err)\n this.emit(\"error\", err);\n else if (!state.errored && !state.ending)\n state.ending = !0, finishMaybe(this, state, !0), state.ended = !0;\n else if (state.finished)\n err = new ERR_STREAM_ALREADY_FINISHED(\"end\");\n else if (state.destroyed)\n err = new ERR_STREAM_DESTROYED(\"end\");\n if (typeof cb === \"function\")\n if (err || state.finished)\n runOnNextTick(cb, err);\n else\n state[kOnFinished].push(cb);\n return this;\n };\n function needFinish(state, tag) {\n var needFinish2 = state.ending && !state.destroyed && state.constructed && state.length === 0 && !state.errored && state.buffered.length === 0 && !state.finished && !state.writing && !state.errorEmitted && !state.closeEmitted;\n return needFinish2;\n }\n function callFinal(stream, state) {\n let called = !1;\n function onFinish(err) {\n if (called) {\n errorOrDestroy2(stream, err !== null && err !== void 0 \? err : ERR_MULTIPLE_CALLBACK());\n return;\n }\n if (called = !0, state.pendingcb--, err) {\n const onfinishCallbacks = state[kOnFinished].splice(0);\n for (let i = 0;i < onfinishCallbacks.length; i++)\n onfinishCallbacks[i](err);\n errorOrDestroy2(stream, err, state.sync);\n } else if (needFinish(state))\n state.prefinished = !0, stream.emit(\"prefinish\"), state.pendingcb++, runOnNextTick(finish, stream, state);\n }\n state.sync = !0, state.pendingcb++;\n try {\n stream._final(onFinish);\n } catch (err) {\n onFinish(err);\n }\n state.sync = !1;\n }\n function prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled)\n if (typeof stream._final === \"function\" && !state.destroyed)\n state.finalCalled = !0, callFinal(stream, state);\n else\n state.prefinished = !0, stream.emit(\"prefinish\");\n }\n function finishMaybe(stream, state, sync) {\n if (!needFinish(state, stream.__id))\n return;\n if (prefinish(stream, state), state.pendingcb === 0) {\n if (sync)\n state.pendingcb++, runOnNextTick((stream2, state2) => {\n if (needFinish(state2))\n finish(stream2, state2);\n else\n state2.pendingcb--;\n }, stream, state);\n else if (needFinish(state))\n state.pendingcb++, finish(stream, state);\n }\n }\n function finish(stream, state) {\n state.pendingcb--, state.finished = !0;\n const onfinishCallbacks = state[kOnFinished].splice(0);\n for (let i = 0;i < onfinishCallbacks.length; i++)\n onfinishCallbacks[i]();\n if (stream.emit(\"finish\"), state.autoDestroy) {\n const rState = stream._readableState;\n if (!rState || rState.autoDestroy && (rState.endEmitted || rState.readable === !1))\n stream.destroy();\n }\n }\n ObjectDefineProperties(Writable.prototype, {\n closed: {\n get() {\n return this._writableState \? this._writableState.closed : !1;\n }\n },\n destroyed: {\n get() {\n return this._writableState \? this._writableState.destroyed : !1;\n },\n set(value) {\n if (this._writableState)\n this._writableState.destroyed = value;\n }\n },\n writable: {\n get() {\n const w = this._writableState;\n return !!w && w.writable !== !1 && !w.destroyed && !w.errored && !w.ending && !w.ended;\n },\n set(val) {\n if (this._writableState)\n this._writableState.writable = !!val;\n }\n },\n writableFinished: {\n get() {\n return this._writableState \? this._writableState.finished : !1;\n }\n },\n writableObjectMode: {\n get() {\n return this._writableState \? this._writableState.objectMode : !1;\n }\n },\n writableBuffer: {\n get() {\n return this._writableState && this._writableState.getBuffer();\n }\n },\n writableEnded: {\n get() {\n return this._writableState \? this._writableState.ending : !1;\n }\n },\n writableNeedDrain: {\n get() {\n const wState = this._writableState;\n if (!wState)\n return !1;\n return !wState.destroyed && !wState.ending && wState.needDrain;\n }\n },\n writableHighWaterMark: {\n get() {\n return this._writableState && this._writableState.highWaterMark;\n }\n },\n writableCorked: {\n get() {\n return this._writableState \? this._writableState.corked : 0;\n }\n },\n writableLength: {\n get() {\n return this._writableState && this._writableState.length;\n }\n },\n errored: {\n enumerable: !1,\n get() {\n return this._writableState \? this._writableState.errored : null;\n }\n },\n writableAborted: {\n enumerable: !1,\n get: function() {\n return !!(this._writableState.writable !== !1 && (this._writableState.destroyed || this._writableState.errored) && !this._writableState.finished);\n }\n }\n });\n var destroy2 = destroyImpl.destroy;\n Writable.prototype.destroy = function(err, cb) {\n const state = this._writableState;\n if (!state.destroyed && (state.bufferedIndex < state.buffered.length || state[kOnFinished].length))\n runOnNextTick(errorBuffer, state);\n return destroy2.@call(this, err, cb), this;\n }, Writable.prototype._undestroy = destroyImpl.undestroy, Writable.prototype._destroy = function(err, cb) {\n cb(err);\n }, Writable.prototype[EE.captureRejectionSymbol] = function(err) {\n this.destroy(err);\n };\n var webStreamsAdapters;\n function lazyWebStreams() {\n if (webStreamsAdapters === void 0)\n webStreamsAdapters = {};\n return webStreamsAdapters;\n }\n Writable.fromWeb = function(writableStream, options) {\n return lazyWebStreams().newStreamWritableFromWritableStream(writableStream, options);\n }, Writable.toWeb = function(streamWritable) {\n return lazyWebStreams().newWritableStreamFromStreamWritable(streamWritable);\n };\n }\n}), require_duplexify = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/duplexify.js\"(exports, module) {\n var {\n isReadable,\n isWritable,\n isIterable,\n isNodeStream,\n isReadableNodeStream,\n isWritableNodeStream,\n isDuplexNodeStream\n } = require_utils(), eos = require_end_of_stream(), {\n AbortError: AbortError2,\n codes: { ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE2, ERR_INVALID_RETURN_VALUE }\n } = require_errors(), { destroyer } = require_destroy(), Duplex = require_duplex(), Readable = require_readable(), { createDeferredPromise } = require_util(), from = require_from(), isBlob = typeof Blob !== \"undefined\" \? function isBlob2(b) {\n return b instanceof Blob;\n } : function isBlob2(b) {\n return !1;\n }, { FunctionPrototypeCall } = require_primordials();\n\n class Duplexify extends Duplex {\n constructor(options) {\n super(options);\n if ((options === null || options === @undefined \? @undefined : options.readable) === !1)\n this._readableState.readable = !1, this._readableState.ended = !0, this._readableState.endEmitted = !0;\n if ((options === null || options === @undefined \? @undefined : options.writable) === !1)\n this._writableState.writable = !1, this._writableState.ending = !0, this._writableState.ended = !0, this._writableState.finished = !0;\n }\n }\n module.exports = function duplexify(body, name) {\n if (isDuplexNodeStream(body))\n return body;\n if (isReadableNodeStream(body))\n return _duplexify({\n readable: body\n });\n if (isWritableNodeStream(body))\n return _duplexify({\n writable: body\n });\n if (isNodeStream(body))\n return _duplexify({\n writable: !1,\n readable: !1\n });\n if (typeof body === \"function\") {\n const { value, write, final, destroy: destroy2 } = fromAsyncGen(body);\n if (isIterable(value))\n return from(Duplexify, value, {\n objectMode: !0,\n write,\n final,\n destroy: destroy2\n });\n const then2 = value === null || value === void 0 \? void 0 : value.then;\n if (typeof then2 === \"function\") {\n let d;\n const promise = FunctionPrototypeCall(then2, value, (val) => {\n if (val != null)\n throw new ERR_INVALID_RETURN_VALUE(\"nully\", \"body\", val);\n }, (err) => {\n destroyer(d, err);\n });\n return d = new Duplexify({\n objectMode: !0,\n readable: !1,\n write,\n final(cb) {\n final(async () => {\n try {\n await promise, runOnNextTick(cb, null);\n } catch (err) {\n runOnNextTick(cb, err);\n }\n });\n },\n destroy: destroy2\n });\n }\n throw new ERR_INVALID_RETURN_VALUE(\"Iterable, AsyncIterable or AsyncFunction\", name, value);\n }\n if (isBlob(body))\n return duplexify(body.arrayBuffer());\n if (isIterable(body))\n return from(Duplexify, body, {\n objectMode: !0,\n writable: !1\n });\n if (typeof (body === null || body === void 0 \? void 0 : body.writable) === \"object\" || typeof (body === null || body === void 0 \? void 0 : body.readable) === \"object\") {\n const readable = body !== null && body !== void 0 && body.readable \? isReadableNodeStream(body === null || body === void 0 \? void 0 : body.readable) \? body === null || body === void 0 \? void 0 : body.readable : duplexify(body.readable) : void 0, writable = body !== null && body !== void 0 && body.writable \? isWritableNodeStream(body === null || body === void 0 \? void 0 : body.writable) \? body === null || body === void 0 \? void 0 : body.writable : duplexify(body.writable) : void 0;\n return _duplexify({\n readable,\n writable\n });\n }\n const then = body === null || body === void 0 \? void 0 : body.then;\n if (typeof then === \"function\") {\n let d;\n return FunctionPrototypeCall(then, body, (val) => {\n if (val != null)\n d.push(val);\n d.push(null);\n }, (err) => {\n destroyer(d, err);\n }), d = new Duplexify({\n objectMode: !0,\n writable: !1,\n read() {\n }\n });\n }\n throw new ERR_INVALID_ARG_TYPE2(name, [\n \"Blob\",\n \"ReadableStream\",\n \"WritableStream\",\n \"Stream\",\n \"Iterable\",\n \"AsyncIterable\",\n \"Function\",\n \"{ readable, writable } pair\",\n \"Promise\"\n ], body);\n };\n function fromAsyncGen(fn) {\n let { promise, resolve } = createDeferredPromise();\n const ac = new AbortController, signal = ac.signal;\n return {\n value: fn(async function* () {\n while (!0) {\n const _promise = promise;\n promise = null;\n const { chunk, done, cb } = await _promise;\n if (runOnNextTick(cb), done)\n return;\n if (signal.aborted)\n throw new AbortError2(void 0, {\n cause: signal.reason\n });\n ({ promise, resolve } = createDeferredPromise()), yield chunk;\n }\n }(), {\n signal\n }),\n write(chunk, encoding, cb) {\n const _resolve = resolve;\n resolve = null, _resolve({\n chunk,\n done: !1,\n cb\n });\n },\n final(cb) {\n const _resolve = resolve;\n resolve = null, _resolve({\n done: !0,\n cb\n });\n },\n destroy(err, cb) {\n ac.abort(), cb(err);\n }\n };\n }\n function _duplexify(pair) {\n const r = pair.readable && typeof pair.readable.read !== \"function\" \? Readable.wrap(pair.readable) : pair.readable, w = pair.writable;\n let readable = !!isReadable(r), writable = !!isWritable(w), ondrain, onfinish, onreadable, onclose, d;\n function onfinished(err) {\n const cb = onclose;\n if (onclose = null, cb)\n cb(err);\n else if (err)\n d.destroy(err);\n else if (!readable && !writable)\n d.destroy();\n }\n if (d = new Duplexify({\n readableObjectMode: !!(r !== null && r !== void 0 && r.readableObjectMode),\n writableObjectMode: !!(w !== null && w !== void 0 && w.writableObjectMode),\n readable,\n writable\n }), writable)\n eos(w, (err) => {\n if (writable = !1, err)\n destroyer(r, err);\n onfinished(err);\n }), d._write = function(chunk, encoding, callback) {\n if (w.write(chunk, encoding))\n callback();\n else\n ondrain = callback;\n }, d._final = function(callback) {\n w.end(), onfinish = callback;\n }, w.on(\"drain\", function() {\n if (ondrain) {\n const cb = ondrain;\n ondrain = null, cb();\n }\n }), w.on(\"finish\", function() {\n if (onfinish) {\n const cb = onfinish;\n onfinish = null, cb();\n }\n });\n if (readable)\n eos(r, (err) => {\n if (readable = !1, err)\n destroyer(r, err);\n onfinished(err);\n }), r.on(\"readable\", function() {\n if (onreadable) {\n const cb = onreadable;\n onreadable = null, cb();\n }\n }), r.on(\"end\", function() {\n d.push(null);\n }), d._read = function() {\n while (!0) {\n const buf = r.read();\n if (buf === null) {\n onreadable = d._read;\n return;\n }\n if (!d.push(buf))\n return;\n }\n };\n return d._destroy = function(err, callback) {\n if (!err && onclose !== null)\n err = new AbortError2;\n if (onreadable = null, ondrain = null, onfinish = null, onclose === null)\n callback(err);\n else\n onclose = callback, destroyer(w, err), destroyer(r, err);\n }, d;\n }\n }\n}), require_duplex = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/duplex.js\"(exports, module) {\n var { ObjectDefineProperties, ObjectGetOwnPropertyDescriptor, ObjectKeys, ObjectSetPrototypeOf } = require_primordials(), Readable = require_readable();\n function Duplex(options) {\n if (!(this instanceof Duplex))\n return new Duplex(options);\n if (Readable.@call(this, options), Writable.@call(this, options), options) {\n if (this.allowHalfOpen = options.allowHalfOpen !== !1, options.readable === !1)\n this._readableState.readable = !1, this._readableState.ended = !0, this._readableState.endEmitted = !0;\n if (options.writable === !1)\n this._writableState.writable = !1, this._writableState.ending = !0, this._writableState.ended = !0, this._writableState.finished = !0;\n } else\n this.allowHalfOpen = !0;\n }\n Duplex.prototype = {}, module.exports = Duplex, ObjectSetPrototypeOf(Duplex.prototype, Readable.prototype), ObjectSetPrototypeOf(Duplex, Readable);\n for (var method in Writable.prototype)\n if (!Duplex.prototype[method])\n Duplex.prototype[method] = Writable.prototype[method];\n ObjectDefineProperties(Duplex.prototype, {\n writable: ObjectGetOwnPropertyDescriptor(Writable.prototype, \"writable\"),\n writableHighWaterMark: ObjectGetOwnPropertyDescriptor(Writable.prototype, \"writableHighWaterMark\"),\n writableObjectMode: ObjectGetOwnPropertyDescriptor(Writable.prototype, \"writableObjectMode\"),\n writableBuffer: ObjectGetOwnPropertyDescriptor(Writable.prototype, \"writableBuffer\"),\n writableLength: ObjectGetOwnPropertyDescriptor(Writable.prototype, \"writableLength\"),\n writableFinished: ObjectGetOwnPropertyDescriptor(Writable.prototype, \"writableFinished\"),\n writableCorked: ObjectGetOwnPropertyDescriptor(Writable.prototype, \"writableCorked\"),\n writableEnded: ObjectGetOwnPropertyDescriptor(Writable.prototype, \"writableEnded\"),\n writableNeedDrain: ObjectGetOwnPropertyDescriptor(Writable.prototype, \"writableNeedDrain\"),\n destroyed: {\n get() {\n if (this._readableState === void 0 || this._writableState === void 0)\n return !1;\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set(value) {\n if (this._readableState && this._writableState)\n this._readableState.destroyed = value, this._writableState.destroyed = value;\n }\n }\n });\n var webStreamsAdapters;\n function lazyWebStreams() {\n if (webStreamsAdapters === void 0)\n webStreamsAdapters = {};\n return webStreamsAdapters;\n }\n Duplex.fromWeb = function(pair, options) {\n return lazyWebStreams().newStreamDuplexFromReadableWritablePair(pair, options);\n }, Duplex.toWeb = function(duplex) {\n return lazyWebStreams().newReadableWritablePairFromDuplex(duplex);\n };\n var duplexify;\n Duplex.from = function(body) {\n if (!duplexify)\n duplexify = require_duplexify();\n return duplexify(body, \"body\");\n };\n }\n}), require_transform = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/transform.js\"(exports, module) {\n var { ObjectSetPrototypeOf, Symbol: Symbol2 } = require_primordials(), { ERR_METHOD_NOT_IMPLEMENTED } = require_errors().codes, Duplex = require_duplex();\n function Transform(options) {\n if (!(this instanceof Transform))\n return new Transform(options);\n if (Duplex.@call(this, options), this._readableState.sync = !1, this[kCallback] = null, options) {\n if (typeof options.transform === \"function\")\n this._transform = options.transform;\n if (typeof options.flush === \"function\")\n this._flush = options.flush;\n }\n this.on(\"prefinish\", prefinish.bind(this));\n }\n Transform.prototype = {}, ObjectSetPrototypeOf(Transform.prototype, Duplex.prototype), ObjectSetPrototypeOf(Transform, Duplex), module.exports = Transform;\n var kCallback = Symbol2(\"kCallback\");\n function final(cb) {\n if (typeof this._flush === \"function\" && !this.destroyed)\n this._flush((er, data) => {\n if (er) {\n if (cb)\n cb(er);\n else\n this.destroy(er);\n return;\n }\n if (data != null)\n this.push(data);\n if (this.push(null), cb)\n cb();\n });\n else if (this.push(null), cb)\n cb();\n }\n function prefinish() {\n if (this._final !== final)\n final.@call(this);\n }\n Transform.prototype._final = final, Transform.prototype._transform = function(chunk, encoding, callback) {\n throw new ERR_METHOD_NOT_IMPLEMENTED(\"_transform()\");\n }, Transform.prototype._write = function(chunk, encoding, callback) {\n const rState = this._readableState, wState = this._writableState, length = rState.length;\n this._transform(chunk, encoding, (err, val) => {\n if (err) {\n callback(err);\n return;\n }\n if (val != null)\n this.push(val);\n if (wState.ended || length === rState.length || rState.length < rState.highWaterMark || rState.highWaterMark === 0 || rState.length === 0)\n callback();\n else\n this[kCallback] = callback;\n });\n }, Transform.prototype._read = function() {\n if (this[kCallback]) {\n const callback = this[kCallback];\n this[kCallback] = null, callback();\n }\n };\n }\n}), require_passthrough = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/passthrough.js\"(exports, module) {\n var { ObjectSetPrototypeOf } = require_primordials(), Transform = require_transform();\n function PassThrough(options) {\n if (!(this instanceof PassThrough))\n return new PassThrough(options);\n Transform.@call(this, options);\n }\n PassThrough.prototype = {}, ObjectSetPrototypeOf(PassThrough.prototype, Transform.prototype), ObjectSetPrototypeOf(PassThrough, Transform), PassThrough.prototype._transform = function(chunk, encoding, cb) {\n cb(null, chunk);\n }, module.exports = PassThrough;\n }\n}), require_pipeline = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/pipeline.js\"(exports, module) {\n var { ArrayIsArray: ArrayIsArray2, Promise: Promise2, SymbolAsyncIterator } = require_primordials(), eos = require_end_of_stream(), { once } = require_util(), destroyImpl = require_destroy(), Duplex = require_duplex(), {\n aggregateTwoErrors,\n codes: { ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE2, ERR_INVALID_RETURN_VALUE, ERR_MISSING_ARGS, ERR_STREAM_DESTROYED },\n AbortError: AbortError2\n } = require_errors(), { validateFunction, validateAbortSignal } = require_validators(), { isIterable, isReadable, isReadableNodeStream, isNodeStream } = require_utils(), PassThrough, Readable;\n function destroyer(stream, reading, writing) {\n let finished = !1;\n stream.on(\"close\", () => {\n finished = !0;\n });\n const cleanup = eos(stream, {\n readable: reading,\n writable: writing\n }, (err) => {\n finished = !err;\n });\n return {\n destroy: (err) => {\n if (finished)\n return;\n finished = !0, destroyImpl.destroyer(stream, err || new ERR_STREAM_DESTROYED(\"pipe\"));\n },\n cleanup\n };\n }\n function popCallback(streams) {\n return validateFunction(streams[streams.length - 1], \"streams[stream.length - 1]\"), streams.pop();\n }\n function makeAsyncIterable(val) {\n if (isIterable(val))\n return val;\n else if (isReadableNodeStream(val))\n return fromReadable(val);\n throw new ERR_INVALID_ARG_TYPE2(\"val\", [\"Readable\", \"Iterable\", \"AsyncIterable\"], val);\n }\n async function* fromReadable(val) {\n if (!Readable)\n Readable = require_readable();\n yield* Readable.prototype[SymbolAsyncIterator].@call(val);\n }\n async function pump(iterable, writable, finish, { end }) {\n let error, onresolve = null;\n const resume = (err) => {\n if (err)\n error = err;\n if (onresolve) {\n const callback = onresolve;\n onresolve = null, callback();\n }\n }, wait = () => new Promise2((resolve, reject) => {\n if (error)\n reject(error);\n else\n onresolve = () => {\n if (error)\n reject(error);\n else\n resolve();\n };\n });\n writable.on(\"drain\", resume);\n const cleanup = eos(writable, {\n readable: !1\n }, resume);\n try {\n if (writable.writableNeedDrain)\n await wait();\n for await (let chunk of iterable)\n if (!writable.write(chunk))\n await wait();\n if (end)\n writable.end();\n await wait(), finish();\n } catch (err) {\n finish(error !== err \? aggregateTwoErrors(error, err) : err);\n } finally {\n cleanup(), writable.off(\"drain\", resume);\n }\n }\n function pipeline(...streams) {\n return pipelineImpl(streams, once(popCallback(streams)));\n }\n function pipelineImpl(streams, callback, opts) {\n if (streams.length === 1 && ArrayIsArray2(streams[0]))\n streams = streams[0];\n if (streams.length < 2)\n throw new ERR_MISSING_ARGS(\"streams\");\n const ac = new AbortController, signal = ac.signal, outerSignal = opts === null || opts === void 0 \? void 0 : opts.signal, lastStreamCleanup = [];\n validateAbortSignal(outerSignal, \"options.signal\");\n function abort() {\n finishImpl(new AbortError2);\n }\n outerSignal === null || outerSignal === void 0 || outerSignal.addEventListener(\"abort\", abort);\n let error, value;\n const destroys = [];\n let finishCount = 0;\n function finish(err) {\n finishImpl(err, --finishCount === 0);\n }\n function finishImpl(err, final) {\n if (err && (!error || error.code === \"ERR_STREAM_PREMATURE_CLOSE\"))\n error = err;\n if (!error && !final)\n return;\n while (destroys.length)\n destroys.shift()(error);\n if (outerSignal === null || outerSignal === void 0 || outerSignal.removeEventListener(\"abort\", abort), ac.abort(), final) {\n if (!error)\n lastStreamCleanup.forEach((fn) => fn());\n runOnNextTick(callback, error, value);\n }\n }\n let ret;\n for (let i = 0;i < streams.length; i++) {\n const stream = streams[i], reading = i < streams.length - 1, writing = i > 0, end = reading || (opts === null || opts === void 0 \? void 0 : opts.end) !== !1, isLastStream = i === streams.length - 1;\n if (isNodeStream(stream)) {\n let onError = function(err) {\n if (err && err.name !== \"AbortError\" && err.code !== \"ERR_STREAM_PREMATURE_CLOSE\")\n finish(err);\n };\n if (end) {\n const { destroy: destroy2, cleanup } = destroyer(stream, reading, writing);\n if (destroys.push(destroy2), isReadable(stream) && isLastStream)\n lastStreamCleanup.push(cleanup);\n }\n if (stream.on(\"error\", onError), isReadable(stream) && isLastStream)\n lastStreamCleanup.push(() => {\n stream.removeListener(\"error\", onError);\n });\n }\n if (i === 0)\n if (typeof stream === \"function\") {\n if (ret = stream({\n signal\n }), !isIterable(ret))\n throw new ERR_INVALID_RETURN_VALUE(\"Iterable, AsyncIterable or Stream\", \"source\", ret);\n } else if (isIterable(stream) || isReadableNodeStream(stream))\n ret = stream;\n else\n ret = Duplex.from(stream);\n else if (typeof stream === \"function\")\n if (ret = makeAsyncIterable(ret), ret = stream(ret, {\n signal\n }), reading) {\n if (!isIterable(ret, !0))\n throw new ERR_INVALID_RETURN_VALUE(\"AsyncIterable\", `transform[${i - 1}]`, ret);\n } else {\n var _ret;\n if (!PassThrough)\n PassThrough = require_passthrough();\n const pt = new PassThrough({\n objectMode: !0\n }), then = (_ret = ret) === null || _ret === void 0 \? void 0 : _ret.then;\n if (typeof then === \"function\")\n finishCount++, then.@call(ret, (val) => {\n if (value = val, val != null)\n pt.write(val);\n if (end)\n pt.end();\n runOnNextTick(finish);\n }, (err) => {\n pt.destroy(err), runOnNextTick(finish, err);\n });\n else if (isIterable(ret, !0))\n finishCount++, pump(ret, pt, finish, {\n end\n });\n else\n throw new ERR_INVALID_RETURN_VALUE(\"AsyncIterable or Promise\", \"destination\", ret);\n ret = pt;\n const { destroy: destroy2, cleanup } = destroyer(ret, !1, !0);\n if (destroys.push(destroy2), isLastStream)\n lastStreamCleanup.push(cleanup);\n }\n else if (isNodeStream(stream)) {\n if (isReadableNodeStream(ret)) {\n finishCount += 2;\n const cleanup = pipe(ret, stream, finish, {\n end\n });\n if (isReadable(stream) && isLastStream)\n lastStreamCleanup.push(cleanup);\n } else if (isIterable(ret))\n finishCount++, pump(ret, stream, finish, {\n end\n });\n else\n throw new ERR_INVALID_ARG_TYPE2(\"val\", [\"Readable\", \"Iterable\", \"AsyncIterable\"], ret);\n ret = stream;\n } else\n ret = Duplex.from(stream);\n }\n if (signal !== null && signal !== void 0 && signal.aborted || outerSignal !== null && outerSignal !== void 0 && outerSignal.aborted)\n runOnNextTick(abort);\n return ret;\n }\n function pipe(src, dst, finish, { end }) {\n if (src.pipe(dst, {\n end\n }), end)\n src.once(\"end\", () => dst.end());\n else\n finish();\n return eos(src, {\n readable: !0,\n writable: !1\n }, (err) => {\n const rState = src._readableState;\n if (err && err.code === \"ERR_STREAM_PREMATURE_CLOSE\" && rState && rState.ended && !rState.errored && !rState.errorEmitted)\n src.once(\"end\", finish).once(\"error\", finish);\n else\n finish(err);\n }), eos(dst, {\n readable: !1,\n writable: !0\n }, finish);\n }\n module.exports = {\n pipelineImpl,\n pipeline\n };\n }\n}), require_compose = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/compose.js\"(exports, module) {\n var { pipeline } = require_pipeline(), Duplex = require_duplex(), { destroyer } = require_destroy(), { isNodeStream, isReadable, isWritable } = require_utils(), {\n AbortError: AbortError2,\n codes: { ERR_INVALID_ARG_VALUE: ERR_INVALID_ARG_VALUE2, ERR_MISSING_ARGS }\n } = require_errors();\n module.exports = function compose(...streams) {\n if (streams.length === 0)\n throw new ERR_MISSING_ARGS(\"streams\");\n if (streams.length === 1)\n return Duplex.from(streams[0]);\n const orgStreams = [...streams];\n if (typeof streams[0] === \"function\")\n streams[0] = Duplex.from(streams[0]);\n if (typeof streams[streams.length - 1] === \"function\") {\n const idx = streams.length - 1;\n streams[idx] = Duplex.from(streams[idx]);\n }\n for (let n = 0;n < streams.length; ++n) {\n if (!isNodeStream(streams[n]))\n continue;\n if (n < streams.length - 1 && !isReadable(streams[n]))\n throw new ERR_INVALID_ARG_VALUE2(`streams[${n}]`, orgStreams[n], \"must be readable\");\n if (n > 0 && !isWritable(streams[n]))\n throw new ERR_INVALID_ARG_VALUE2(`streams[${n}]`, orgStreams[n], \"must be writable\");\n }\n let ondrain, onfinish, onreadable, onclose, d;\n function onfinished(err) {\n const cb = onclose;\n if (onclose = null, cb)\n cb(err);\n else if (err)\n d.destroy(err);\n else if (!readable && !writable)\n d.destroy();\n }\n const head = streams[0], tail = pipeline(streams, onfinished), writable = !!isWritable(head), readable = !!isReadable(tail);\n if (d = new Duplex({\n writableObjectMode: !!(head !== null && head !== void 0 && head.writableObjectMode),\n readableObjectMode: !!(tail !== null && tail !== void 0 && tail.writableObjectMode),\n writable,\n readable\n }), writable)\n d._write = function(chunk, encoding, callback) {\n if (head.write(chunk, encoding))\n callback();\n else\n ondrain = callback;\n }, d._final = function(callback) {\n head.end(), onfinish = callback;\n }, head.on(\"drain\", function() {\n if (ondrain) {\n const cb = ondrain;\n ondrain = null, cb();\n }\n }), tail.on(\"finish\", function() {\n if (onfinish) {\n const cb = onfinish;\n onfinish = null, cb();\n }\n });\n if (readable)\n tail.on(\"readable\", function() {\n if (onreadable) {\n const cb = onreadable;\n onreadable = null, cb();\n }\n }), tail.on(\"end\", function() {\n d.push(null);\n }), d._read = function() {\n while (!0) {\n const buf = tail.read();\n if (buf === null) {\n onreadable = d._read;\n return;\n }\n if (!d.push(buf))\n return;\n }\n };\n return d._destroy = function(err, callback) {\n if (!err && onclose !== null)\n err = new AbortError2;\n if (onreadable = null, ondrain = null, onfinish = null, onclose === null)\n callback(err);\n else\n onclose = callback, destroyer(tail, err);\n }, d;\n };\n }\n}), require_promises = __commonJS({\n \"node_modules/readable-stream/lib/stream/promises.js\"(exports, module) {\n var { ArrayPrototypePop, Promise: Promise2 } = require_primordials(), { isIterable, isNodeStream } = require_utils(), { pipelineImpl: pl } = require_pipeline(), { finished } = require_end_of_stream();\n function pipeline(...streams) {\n return new Promise2((resolve, reject) => {\n let signal, end;\n const lastArg = streams[streams.length - 1];\n if (lastArg && typeof lastArg === \"object\" && !isNodeStream(lastArg) && !isIterable(lastArg)) {\n const options = ArrayPrototypePop(streams);\n signal = options.signal, end = options.end;\n }\n pl(streams, (err, value) => {\n if (err)\n reject(err);\n else\n resolve(value);\n }, {\n signal,\n end\n });\n });\n }\n module.exports = {\n finished,\n pipeline\n };\n }\n}), require_stream = __commonJS({\n \"node_modules/readable-stream/lib/stream.js\"(exports, module) {\n var { ObjectDefineProperty, ObjectKeys, ReflectApply } = require_primordials(), {\n promisify: { custom: customPromisify }\n } = require_util(), { streamReturningOperators, promiseReturningOperators } = require_operators(), {\n codes: { ERR_ILLEGAL_CONSTRUCTOR }\n } = require_errors(), compose = require_compose(), { pipeline } = require_pipeline(), { destroyer } = require_destroy(), eos = require_end_of_stream(), promises = require_promises(), utils = require_utils(), Stream = module.exports = require_legacy().Stream;\n Stream.isDisturbed = utils.isDisturbed, Stream.isErrored = utils.isErrored, Stream.isWritable = utils.isWritable, Stream.isReadable = utils.isReadable, Stream.Readable = require_readable();\n for (let key of ObjectKeys(streamReturningOperators)) {\n let fn = function(...args) {\n if (new.target)\n throw ERR_ILLEGAL_CONSTRUCTOR();\n return Stream.Readable.from(ReflectApply(op, this, args));\n };\n const op = streamReturningOperators[key];\n ObjectDefineProperty(fn, \"name\", {\n value: op.name\n }), ObjectDefineProperty(fn, \"length\", {\n value: op.length\n }), ObjectDefineProperty(Stream.Readable.prototype, key, {\n value: fn,\n enumerable: !1,\n configurable: !0,\n writable: !0\n });\n }\n for (let key of ObjectKeys(promiseReturningOperators)) {\n let fn = function(...args) {\n if (new.target)\n throw ERR_ILLEGAL_CONSTRUCTOR();\n return ReflectApply(op, this, args);\n };\n const op = promiseReturningOperators[key];\n ObjectDefineProperty(fn, \"name\", {\n value: op.name\n }), ObjectDefineProperty(fn, \"length\", {\n value: op.length\n }), ObjectDefineProperty(Stream.Readable.prototype, key, {\n value: fn,\n enumerable: !1,\n configurable: !0,\n writable: !0\n });\n }\n Stream.Writable = require_writable(), Stream.Duplex = require_duplex(), Stream.Transform = require_transform(), Stream.PassThrough = require_passthrough(), Stream.pipeline = pipeline;\n var { addAbortSignal } = require_add_abort_signal();\n Stream.addAbortSignal = addAbortSignal, Stream.finished = eos, Stream.destroy = destroyer, Stream.compose = compose, ObjectDefineProperty(Stream, \"promises\", {\n configurable: !0,\n enumerable: !0,\n get() {\n return promises;\n }\n }), ObjectDefineProperty(pipeline, customPromisify, {\n enumerable: !0,\n get() {\n return promises.pipeline;\n }\n }), ObjectDefineProperty(eos, customPromisify, {\n enumerable: !0,\n get() {\n return promises.finished;\n }\n }), Stream.Stream = Stream, Stream._isUint8Array = function isUint8Array(value) {\n return value instanceof @Uint8Array;\n }, Stream._uint8ArrayToBuffer = function _uint8ArrayToBuffer(chunk) {\n return new @Buffer(chunk.buffer, chunk.byteOffset, chunk.byteLength);\n };\n }\n}), nativeReadableStreamPrototypes = {\n 0: @undefined,\n 1: @undefined,\n 2: @undefined,\n 3: @undefined,\n 4: @undefined,\n 5: @undefined\n}, Writable = require_writable(), _pathOrFdOrSink = Symbol(\"pathOrFdOrSink\"), _fileSink = Symbol(\"fileSink\"), _native = Symbol(\"native\");\nNativeWritable.prototype = Object.create(Writable.prototype);\nvar WritablePrototypeWrite = Writable.prototype.write;\nNativeWritable.prototype.write = function NativeWritablePrototypeWrite(chunk, encoding, cb, native) {\n if (!(native \?\? this[_native]))\n return this[_native] = !1, WritablePrototypeWrite.@call(this, chunk, encoding, cb);\n var fileSink = this[_fileSink] \?\? NativeWritable_lazyConstruct(this), result = fileSink.write(chunk);\n if (@isPromise(result))\n return result.then(() => {\n this.emit(\"drain\"), fileSink.flush(!0);\n }), !1;\n if (fileSink.flush(!0), typeof encoding === \"function\")\n cb = encoding;\n if (cb)\n cb(null, chunk.byteLength);\n return !0;\n};\nvar WritablePrototypeEnd = Writable.prototype.end;\nNativeWritable.prototype.end = function end(chunk, encoding, cb, native) {\n return WritablePrototypeEnd.@call(this, chunk, encoding, cb, native \?\? this[_native]);\n};\nNativeWritable.prototype.ref = function ref() {\n var sink = this[_fileSink];\n if (!sink)\n this.NativeWritable_lazyConstruct();\n sink.ref();\n};\nNativeWritable.prototype.unref = function unref() {\n this[_fileSink]\?.unref();\n};\nvar exports = require_stream(), promises = require_promises();\nexports._getNativeReadableStreamPrototype = getNativeReadableStreamPrototype;\nexports.NativeWritable = NativeWritable;\nObject.defineProperty(exports, \"promises\", {\n configurable: !0,\n enumerable: !0,\n get() {\n return promises;\n }\n});\nexports[Symbol.for(\"::bunternal::\")] = { _ReadableFromWeb, _ReadableFromWebForUndici };\nexports.eos = require_end_of_stream();\nexports.EventEmitter = EE;\nreturn exports})\n"); -// - -// -static constexpr ASCIILiteral NodeStreamPromisesCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/stream.promises.ts\nreturn (@getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39)).promises})\n"); -// - -// -static constexpr ASCIILiteral NodeStreamWebCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/stream.web.ts\nvar $;\n$ = {\n ReadableStream: @ReadableStream,\n ReadableStreamDefaultReader: @ReadableStreamDefaultReader,\n ReadableStreamBYOBReader: @ReadableStreamBYOBReader,\n ReadableStreamBYOBRequest: @ReadableStreamBYOBRequest,\n ReadableByteStreamController: @ReadableByteStreamController,\n ReadableStreamDefaultController: @ReadableStreamDefaultController,\n TransformStream: @TransformStream,\n TransformStreamDefaultController: @TransformStreamDefaultController,\n WritableStream: @WritableStream,\n WritableStreamDefaultWriter: @WritableStreamDefaultWriter,\n WritableStreamDefaultController: @WritableStreamDefaultController,\n ByteLengthQueuingStrategy,\n CountQueuingStrategy,\n TextEncoderStream: @undefined,\n TextDecoderStream: @undefined,\n CompressionStream: @undefined,\n DecompressionStream: @undefined\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeTimersCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/timers.ts\nvar $;\n$ = {\n setTimeout,\n clearTimeout,\n setInterval,\n setImmediate,\n clearInterval,\n clearImmediate\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeTimersPromisesCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/timers.promises.ts\nvar validateObject = function(object, name) {\n if (object === null || typeof object !== \"object\")\n throw new ERR_INVALID_ARG_TYPE(name, \"Object\", object);\n}, validateBoolean = function(value, name) {\n if (typeof value !== \"boolean\")\n throw new ERR_INVALID_ARG_TYPE(name, \"boolean\", value);\n}, validateAbortSignal = function(signal, name) {\n if (typeof signal !== \"undefined\" && (signal === null || typeof signal !== \"object\" || !(\"aborted\" in signal)))\n throw new ERR_INVALID_ARG_TYPE(name, \"AbortSignal\", signal);\n}, asyncIterator = function({ next: nextFunction, return: returnFunction }) {\n const result = {};\n if (typeof nextFunction === \"function\")\n result.next = nextFunction;\n if (typeof returnFunction === \"function\")\n result.return = returnFunction;\n return result[symbolAsyncIterator] = function() {\n return this;\n }, result;\n}, setTimeoutPromise = function(after = 1, value, options = {}) {\n const arguments_ = [].concat(value \?\? []);\n try {\n validateObject(options, \"options\");\n } catch (error) {\n return @Promise.reject(error);\n }\n const { signal, ref: reference = !0 } = options;\n try {\n validateAbortSignal(signal, \"options.signal\");\n } catch (error) {\n return @Promise.reject(error);\n }\n try {\n validateBoolean(reference, \"options.ref\");\n } catch (error) {\n return @Promise.reject(error);\n }\n if (signal\?.aborted)\n return @Promise.reject(new AbortError);\n let onCancel;\n const returnValue = new @Promise((resolve, reject) => {\n const timeout = setTimeout(() => resolve(value), after, ...arguments_);\n if (!reference)\n timeout\?.unref\?.();\n if (signal)\n onCancel = () => {\n clearTimeout(timeout), reject(new AbortError);\n }, signal.addEventListener(\"abort\", onCancel);\n });\n if (typeof onCancel !== \"undefined\")\n returnValue.finally(() => signal.removeEventListener(\"abort\", onCancel));\n return returnValue;\n}, setImmediatePromise = function(value, options = {}) {\n try {\n validateObject(options, \"options\");\n } catch (error) {\n return @Promise.reject(error);\n }\n const { signal, ref: reference = !0 } = options;\n try {\n validateAbortSignal(signal, \"options.signal\");\n } catch (error) {\n return @Promise.reject(error);\n }\n try {\n validateBoolean(reference, \"options.ref\");\n } catch (error) {\n return @Promise.reject(error);\n }\n if (signal\?.aborted)\n return @Promise.reject(new AbortError);\n let onCancel;\n const returnValue = new @Promise((resolve, reject) => {\n const immediate = setImmediate(() => resolve(value));\n if (!reference)\n immediate\?.unref\?.();\n if (signal)\n onCancel = () => {\n clearImmediate(immediate), reject(new AbortError);\n }, signal.addEventListener(\"abort\", onCancel);\n });\n if (typeof onCancel !== \"undefined\")\n returnValue.finally(() => signal.removeEventListener(\"abort\", onCancel));\n return returnValue;\n}, setIntervalPromise = function(after = 1, value, options = {}) {\n try {\n validateObject(options, \"options\");\n } catch (error) {\n return asyncIterator({\n next: function() {\n return @Promise.reject(error);\n }\n });\n }\n const { signal, ref: reference = !0 } = options;\n try {\n validateAbortSignal(signal, \"options.signal\");\n } catch (error) {\n return asyncIterator({\n next: function() {\n return @Promise.reject(error);\n }\n });\n }\n try {\n validateBoolean(reference, \"options.ref\");\n } catch (error) {\n return asyncIterator({\n next: function() {\n return @Promise.reject(error);\n }\n });\n }\n if (signal\?.aborted)\n return asyncIterator({\n next: function() {\n return @Promise.reject(new AbortError);\n }\n });\n let onCancel, interval;\n try {\n let notYielded = 0, callback;\n if (interval = setInterval(() => {\n if (notYielded++, callback)\n callback(), callback = @undefined;\n }, after), !reference)\n interval\?.unref\?.();\n if (signal)\n onCancel = () => {\n if (clearInterval(interval), callback)\n callback(), callback = @undefined;\n }, signal.addEventListener(\"abort\", onCancel);\n return asyncIterator({\n next: function() {\n return new @Promise((resolve, reject) => {\n if (!signal\?.aborted)\n if (notYielded === 0)\n callback = resolve;\n else\n resolve();\n else if (notYielded === 0)\n reject(new AbortError);\n else\n resolve();\n }).then(() => {\n if (notYielded > 0)\n return notYielded = notYielded - 1, { done: !1, value };\n return { done: !0 };\n });\n },\n return: function() {\n return clearInterval(interval), signal\?.removeEventListener(\"abort\", onCancel), @Promise.resolve({});\n }\n });\n } catch (error) {\n return asyncIterator({\n next: function() {\n clearInterval(interval), signal\?.removeEventListener(\"abort\", onCancel);\n }\n });\n }\n}, $, symbolAsyncIterator = Symbol.asyncIterator;\n\nclass ERR_INVALID_ARG_TYPE extends Error {\n constructor(name, expected, actual) {\n super(`${name} must be ${expected}, ${typeof actual} given`);\n this.code = \"ERR_INVALID_ARG_TYPE\";\n }\n}\n\nclass AbortError extends Error {\n constructor() {\n super(\"The operation was aborted\");\n this.code = \"ABORT_ERR\";\n }\n}\n$ = {\n setTimeout: setTimeoutPromise,\n setImmediate: setImmediatePromise,\n setInterval: setIntervalPromise,\n scheduler: {\n wait: (delay, options) => setTimeoutPromise(delay, @undefined, options),\n yield: setImmediatePromise\n }\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeTLSCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/tls.ts\nvar parseCertString = function() {\n throwNotImplemented(\"Not implemented\");\n}, isValidTLSArray = function(obj) {\n if (typeof obj === \"string\" || isTypedArray(obj) || obj instanceof @ArrayBuffer || obj instanceof Blob)\n return !0;\n if (@Array.isArray(obj)) {\n for (var i = 0;i < obj.length; i++)\n if (typeof obj !== \"string\" && !isTypedArray(obj) && !(obj instanceof @ArrayBuffer) && !(obj instanceof Blob))\n return !1;\n return !0;\n }\n}, unfqdn = function(host) {\n return RegExpPrototypeSymbolReplace.@call(/[.]$/, host, \"\");\n}, toLowerCase = function(c) {\n return StringFromCharCode.@call(32 + StringPrototypeCharCodeAt.@call(c, 0));\n}, splitHost = function(host) {\n return StringPrototypeSplit.@call(RegExpPrototypeSymbolReplace.@call(/[A-Z]/g, unfqdn(host), toLowerCase), \".\");\n}, check = function(hostParts, pattern, wildcards) {\n if (!pattern)\n return !1;\n const patternParts = splitHost(pattern);\n if (hostParts.length !== patternParts.length)\n return !1;\n if (ArrayPrototypeIncludes.@call(patternParts, \"\"))\n return !1;\n const isBad = (s) => RegExpPrototypeExec.@call(/[^\\u0021-\\u007F]/u, s) !== null;\n if (ArrayPrototypeSome.@call(patternParts, isBad))\n return !1;\n for (let i = hostParts.length - 1;i > 0; i -= 1)\n if (hostParts[i] !== patternParts[i])\n return !1;\n const hostSubdomain = hostParts[0], patternSubdomain = patternParts[0], patternSubdomainParts = StringPrototypeSplit.@call(patternSubdomain, \"*\");\n if (patternSubdomainParts.length === 1 || StringPrototypeIncludes.@call(patternSubdomain, \"xn--\"))\n return hostSubdomain === patternSubdomain;\n if (!wildcards)\n return !1;\n if (patternSubdomainParts.length > 2)\n return !1;\n if (patternParts.length <= 2)\n return !1;\n const { 0: prefix, 1: suffix } = patternSubdomainParts;\n if (prefix.length + suffix.length > hostSubdomain.length)\n return !1;\n if (!StringPrototypeStartsWith.@call(hostSubdomain, prefix))\n return !1;\n if (!StringPrototypeEndsWith.@call(hostSubdomain, suffix))\n return !1;\n return !0;\n}, splitEscapedAltNames = function(altNames) {\n const result = [];\n let currentToken = \"\", offset = 0;\n while (offset !== altNames.length) {\n const nextSep = StringPrototypeIndexOf.@call(altNames, \", \", offset), nextQuote = StringPrototypeIndexOf.@call(altNames, '\"', offset);\n if (nextQuote !== -1 && (nextSep === -1 || nextQuote < nextSep)) {\n currentToken += StringPrototypeSubstring.@call(altNames, offset, nextQuote);\n const match = RegExpPrototypeExec.@call(jsonStringPattern, StringPrototypeSubstring.@call(altNames, nextQuote));\n if (!match) {\n let error = new SyntaxError(\"ERR_TLS_CERT_ALTNAME_FORMAT: Invalid subject alternative name string\");\n throw error.name = ERR_TLS_CERT_ALTNAME_FORMAT, error;\n }\n currentToken += JSON.parse(match[0]), offset = nextQuote + match[0].length;\n } else if (nextSep !== -1)\n currentToken += StringPrototypeSubstring.@call(altNames, offset, nextSep), ArrayPrototypePush.@call(result, currentToken), currentToken = \"\", offset = nextSep + 2;\n else\n currentToken += StringPrototypeSubstring.@call(altNames, offset), offset = altNames.length;\n }\n return ArrayPrototypePush.@call(result, currentToken), result;\n}, checkServerIdentity = function(hostname, cert) {\n const { subject, subjectaltname: altNames } = cert, dnsNames = [], ips = [];\n if (hostname = \"\" + hostname, altNames) {\n const splitAltNames = StringPrototypeIncludes.@call(altNames, '\"') \? splitEscapedAltNames(altNames) : StringPrototypeSplit.@call(altNames, \", \");\n ArrayPrototypeForEach.@call(splitAltNames, (name) => {\n if (StringPrototypeStartsWith.@call(name, \"DNS:\"))\n ArrayPrototypePush.@call(dnsNames, StringPrototypeSlice.@call(name, 4));\n else if (StringPrototypeStartsWith.@call(name, \"IP Address:\"))\n ArrayPrototypePush.@call(ips, canonicalizeIP(StringPrototypeSlice.@call(name, 11)));\n });\n }\n let valid = !1, reason = \"Unknown reason\";\n if (hostname = unfqdn(hostname), net.isIP(hostname)) {\n if (valid = ArrayPrototypeIncludes.@call(ips, canonicalizeIP(hostname)), !valid)\n reason = `IP: ${hostname} is not in the cert's list: ` + ArrayPrototypeJoin.@call(ips, \", \");\n } else if (dnsNames.length > 0 || subject\?.CN) {\n const hostParts = splitHost(hostname), wildcard = (pattern) => check(hostParts, pattern, !0);\n if (dnsNames.length > 0) {\n if (valid = ArrayPrototypeSome.@call(dnsNames, wildcard), !valid)\n reason = `Host: ${hostname}. is not in the cert's altnames: ${altNames}`;\n } else {\n const cn = subject.CN;\n if (@Array.isArray(cn))\n valid = ArrayPrototypeSome.@call(cn, wildcard);\n else if (cn)\n valid = wildcard(cn);\n if (!valid)\n reason = `Host: ${hostname}. is not cert's CN: ${cn}`;\n }\n } else\n reason = \"Cert does not contain a DNS name\";\n if (!valid) {\n let error = new Error(`ERR_TLS_CERT_ALTNAME_INVALID: Hostname/IP does not match certificate's altnames: ${reason}`);\n return error.name = \"ERR_TLS_CERT_ALTNAME_INVALID\", error.reason = reason, error.host = hostname, error.cert = cert, error;\n }\n}, SecureContext = function(options) {\n return new InternalSecureContext(options);\n}, createSecureContext = function(options) {\n return new SecureContext(options);\n}, translatePeerCertificate = function(c) {\n if (!c)\n return null;\n if (c.issuerCertificate != null && c.issuerCertificate !== c)\n c.issuerCertificate = translatePeerCertificate(c.issuerCertificate);\n if (c.infoAccess != null) {\n const info = c.infoAccess;\n c.infoAccess = { __proto__: null }, RegExpPrototypeSymbolReplace.@call(/([^\\n:]*):([^\\n]*)(\?:\\n|$)/g, info, (all, key, val) => {\n if (val.charCodeAt(0) === 34)\n val = JSONParse(val);\n if (key in c.infoAccess)\n ArrayPrototypePush.@call(c.infoAccess[key], val);\n else\n c.infoAccess[key] = [val];\n });\n }\n return c;\n}, createServer = function(options, connectionListener) {\n return new Server(options, connectionListener);\n}, getCiphers = function() {\n return DEFAULT_CIPHERS.split(\":\");\n}, convertProtocols = function(protocols) {\n const lens = new @Array(protocols.length), buff = @Buffer.allocUnsafe(ArrayPrototypeReduce.@call(protocols, (p, c, i) => {\n const len = @Buffer.byteLength(c);\n if (len > 255)\n @throwRangeError(\"The byte length of the protocol at index \" + `${i} exceeds the maximum length.`, \"<= 255\", len, !0);\n return lens[i] = len, p + 1 + len;\n }, 0));\n let offset = 0;\n for (let i = 0, c = protocols.length;i < c; i++)\n buff[offset++] = lens[i], buff.write(protocols[i], offset), offset += lens[i];\n return buff;\n}, convertALPNProtocols = function(protocols, out) {\n if (@Array.isArray(protocols))\n out.ALPNProtocols = convertProtocols(protocols);\n else if (isTypedArray(protocols))\n out.ALPNProtocols = @Buffer.from(protocols);\n else if (isArrayBufferView(protocols))\n out.ALPNProtocols = @Buffer.from(protocols.buffer.slice(protocols.byteOffset, protocols.byteOffset + protocols.byteLength));\n else if (@Buffer.isBuffer(protocols))\n out.ALPNProtocols = protocols;\n}, $, { isArrayBufferView, isTypedArray } = @requireNativeModule(\"util/types\"), net = @getInternalField(@internalModuleRegistry, 27) || @createInternalModuleById(27), { Server: NetServer, [Symbol.for(\"::bunternal::\")]: InternalTCPSocket } = net, bunSocketInternal = Symbol.for(\"::bunnetsocketinternal::\"), { rootCertificates, canonicalizeIP } = @lazy(\"internal/tls\"), SymbolReplace = Symbol.replace, RegExpPrototypeSymbolReplace = @RegExp.prototype[SymbolReplace], RegExpPrototypeExec = @RegExp.prototype.exec, StringPrototypeStartsWith = @String.prototype.startsWith, StringPrototypeSlice = @String.prototype.slice, StringPrototypeIncludes = @String.prototype.includes, StringPrototypeSplit = @String.prototype.split, StringPrototypeIndexOf = @String.prototype.indexOf, StringPrototypeSubstring = @String.prototype.substring, StringPrototypeEndsWith = @String.prototype.endsWith, StringFromCharCode = @String.fromCharCode, StringPrototypeCharCodeAt = @String.prototype.charCodeAt, ArrayPrototypeIncludes = @Array.prototype.includes, ArrayPrototypeJoin = @Array.prototype.join, ArrayPrototypeForEach = @Array.prototype.forEach, ArrayPrototypePush = @Array.prototype.push, ArrayPrototypeSome = @Array.prototype.some, ArrayPrototypeReduce = @Array.prototype.reduce, jsonStringPattern = /^\"(\?:[^\"\\\\\\u0000-\\u001f]|\\\\(\?:[\"\\\\/bfnrt]|u[0-9a-fA-F]{4}))*\"/, InternalSecureContext = class SecureContext2 {\n context;\n constructor(options) {\n const context = {};\n if (options) {\n let key = options.key;\n if (key) {\n if (!isValidTLSArray(key))\n @throwTypeError(\"key argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");\n this.key = key;\n }\n let cert = options.cert;\n if (cert) {\n if (!isValidTLSArray(cert))\n @throwTypeError(\"cert argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");\n this.cert = cert;\n }\n let ca = options.ca;\n if (ca) {\n if (!isValidTLSArray(ca))\n @throwTypeError(\"ca argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");\n this.ca = ca;\n }\n let passphrase = options.passphrase;\n if (passphrase && typeof passphrase !== \"string\")\n @throwTypeError(\"passphrase argument must be an string\");\n this.passphrase = passphrase;\n let servername = options.servername;\n if (servername && typeof servername !== \"string\")\n @throwTypeError(\"servername argument must be an string\");\n this.servername = servername;\n let secureOptions = options.secureOptions || 0;\n if (secureOptions && typeof secureOptions !== \"number\")\n @throwTypeError(\"secureOptions argument must be an number\");\n this.secureOptions = secureOptions;\n }\n this.context = context;\n }\n}, buntls = Symbol.for(\"::buntls::\"), SocketClass, TLSSocket = function(InternalTLSSocket) {\n SocketClass = InternalTLSSocket, Object.defineProperty(SocketClass.prototype, Symbol.toStringTag, {\n value: \"TLSSocket\",\n enumerable: !1\n });\n function Socket(options) {\n return new InternalTLSSocket(options);\n }\n return Socket.prototype = InternalTLSSocket.prototype, Object.defineProperty(Socket, Symbol.hasInstance, {\n value(instance) {\n return instance instanceof InternalTLSSocket;\n }\n });\n}(class TLSSocket2 extends InternalTCPSocket {\n #secureContext;\n ALPNProtocols;\n #socket;\n #checkServerIdentity;\n #session;\n constructor(socket, options) {\n super(socket instanceof InternalTCPSocket \? options : options || socket);\n if (options = options || socket || {}, typeof options === \"object\") {\n const { ALPNProtocols } = options;\n if (ALPNProtocols)\n convertALPNProtocols(ALPNProtocols, this);\n if (socket instanceof InternalTCPSocket)\n this.#socket = socket;\n }\n this.#secureContext = options.secureContext || createSecureContext(options), this.authorized = !1, this.secureConnecting = !0, this._secureEstablished = !1, this._securePending = !0, this.#checkServerIdentity = options.checkServerIdentity || checkServerIdentity, this.#session = options.session || null;\n }\n _secureEstablished = !1;\n _securePending = !0;\n _newSessionPending;\n _controlReleased;\n secureConnecting = !1;\n _SNICallback;\n servername;\n authorized = !1;\n authorizationError;\n #renegotiationDisabled = !1;\n encrypted = !0;\n _start() {\n this.connect();\n }\n getSession() {\n return this[bunSocketInternal]\?.getSession();\n }\n getEphemeralKeyInfo() {\n return this[bunSocketInternal]\?.getEphemeralKeyInfo();\n }\n getCipher() {\n return this[bunSocketInternal]\?.getCipher();\n }\n getSharedSigalgs() {\n return this[bunSocketInternal]\?.getSharedSigalgs();\n }\n getProtocol() {\n return this[bunSocketInternal]\?.getTLSVersion();\n }\n getFinished() {\n return this[bunSocketInternal]\?.getTLSFinishedMessage() || @undefined;\n }\n getPeerFinished() {\n return this[bunSocketInternal]\?.getTLSPeerFinishedMessage() || @undefined;\n }\n isSessionReused() {\n return !!this.#session;\n }\n renegotiate() {\n if (this.#renegotiationDisabled) {\n const error = new Error(\"ERR_TLS_RENEGOTIATION_DISABLED: TLS session renegotiation disabled for this socket\");\n throw error.name = \"ERR_TLS_RENEGOTIATION_DISABLED\", error;\n }\n throw Error(\"Not implented in Bun yet\");\n }\n disableRenegotiation() {\n this.#renegotiationDisabled = !0;\n }\n getTLSTicket() {\n return this[bunSocketInternal]\?.getTLSTicket();\n }\n exportKeyingMaterial(length, label, context) {\n if (context)\n return this[bunSocketInternal]\?.exportKeyingMaterial(length, label, context);\n return this[bunSocketInternal]\?.exportKeyingMaterial(length, label);\n }\n setMaxSendFragment(size) {\n return this[bunSocketInternal]\?.setMaxSendFragment(size) || !1;\n }\n enableTrace() {\n }\n setServername(name) {\n if (this.isServer) {\n let error = new Error(\"ERR_TLS_SNI_FROM_SERVER: Cannot issue SNI from a TLS server-side socket\");\n throw error.name = \"ERR_TLS_SNI_FROM_SERVER\", error;\n }\n this.servername = name, this[bunSocketInternal]\?.setServername(name);\n }\n setSession(session) {\n if (this.#session = session, typeof session === \"string\")\n session = @Buffer.from(session, \"latin1\");\n return this[bunSocketInternal]\?.setSession(session);\n }\n getPeerCertificate(abbreviated) {\n const cert = arguments.length < 1 \? this[bunSocketInternal]\?.getPeerCertificate() : this[bunSocketInternal]\?.getPeerCertificate(abbreviated);\n if (cert)\n return translatePeerCertificate(cert);\n }\n getCertificate() {\n const cert = this[bunSocketInternal]\?.getCertificate();\n if (cert)\n return translatePeerCertificate(cert);\n }\n getPeerX509Certificate() {\n throw Error(\"Not implented in Bun yet\");\n }\n getX509Certificate() {\n throw Error(\"Not implented in Bun yet\");\n }\n get alpnProtocol() {\n return this[bunSocketInternal]\?.alpnProtocol;\n }\n [buntls](port, host) {\n return {\n socket: this.#socket,\n ALPNProtocols: this.ALPNProtocols,\n serverName: this.servername || host || \"localhost\",\n checkServerIdentity: this.#checkServerIdentity,\n session: this.#session,\n ...this.#secureContext\n };\n }\n});\n\nclass Server extends NetServer {\n key;\n cert;\n ca;\n passphrase;\n secureOptions;\n _rejectUnauthorized;\n _requestCert;\n servername;\n ALPNProtocols;\n constructor(options, secureConnectionListener) {\n super(options, secureConnectionListener);\n this.setSecureContext(options);\n }\n setSecureContext(options) {\n if (options instanceof InternalSecureContext)\n options = options.context;\n if (options) {\n const { ALPNProtocols } = options;\n if (ALPNProtocols)\n convertALPNProtocols(ALPNProtocols, this);\n let key = options.key;\n if (key) {\n if (!isValidTLSArray(key))\n @throwTypeError(\"key argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");\n this.key = key;\n }\n let cert = options.cert;\n if (cert) {\n if (!isValidTLSArray(cert))\n @throwTypeError(\"cert argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");\n this.cert = cert;\n }\n let ca = options.ca;\n if (ca) {\n if (!isValidTLSArray(ca))\n @throwTypeError(\"ca argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");\n this.ca = ca;\n }\n let passphrase = options.passphrase;\n if (passphrase && typeof passphrase !== \"string\")\n @throwTypeError(\"passphrase argument must be an string\");\n this.passphrase = passphrase;\n let servername = options.servername;\n if (servername && typeof servername !== \"string\")\n @throwTypeError(\"servername argument must be an string\");\n this.servername = servername;\n let secureOptions = options.secureOptions || 0;\n if (secureOptions && typeof secureOptions !== \"number\")\n @throwTypeError(\"secureOptions argument must be an number\");\n this.secureOptions = secureOptions;\n const requestCert = options.requestCert || !1;\n if (requestCert)\n this._requestCert = requestCert;\n else\n this._requestCert = @undefined;\n const rejectUnauthorized = options.rejectUnauthorized || !1;\n if (rejectUnauthorized)\n this._rejectUnauthorized = rejectUnauthorized;\n else\n this._rejectUnauthorized = @undefined;\n }\n }\n getTicketKeys() {\n throw Error(\"Not implented in Bun yet\");\n }\n setTicketKeys() {\n throw Error(\"Not implented in Bun yet\");\n }\n [buntls](port, host, isClient) {\n return [\n {\n serverName: this.servername || host || \"localhost\",\n key: this.key,\n cert: this.cert,\n ca: this.ca,\n passphrase: this.passphrase,\n secureOptions: this.secureOptions,\n rejectUnauthorized: isClient \? !1 : this._rejectUnauthorized,\n requestCert: isClient \? !1 : this._requestCert,\n ALPNProtocols: this.ALPNProtocols\n },\n SocketClass\n ];\n }\n}\nvar CLIENT_RENEG_LIMIT = 3, CLIENT_RENEG_WINDOW = 600, DEFAULT_ECDH_CURVE = \"auto\", DEFAULT_CIPHERS = \"DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256\", DEFAULT_MIN_VERSION = \"TLSv1.2\", DEFAULT_MAX_VERSION = \"TLSv1.3\", createConnection = (port, host, connectListener) => {\n if (typeof port === \"object\") {\n port.checkServerIdentity;\n const { ALPNProtocols } = port;\n if (ALPNProtocols)\n convertALPNProtocols(ALPNProtocols, port);\n return new TLSSocket(port).connect(port, host, connectListener);\n }\n return new TLSSocket().connect(port, host, connectListener);\n}, connect = createConnection;\n$ = {\n CLIENT_RENEG_LIMIT,\n CLIENT_RENEG_WINDOW,\n connect,\n convertALPNProtocols,\n createConnection,\n createSecureContext,\n createServer,\n DEFAULT_CIPHERS,\n DEFAULT_ECDH_CURVE,\n DEFAULT_MAX_VERSION,\n DEFAULT_MIN_VERSION,\n getCiphers,\n parseCertString,\n SecureContext,\n Server,\n TLSSocket,\n checkServerIdentity,\n rootCertificates\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeTraceEventsCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/trace_events.ts\nvar ERR_INVALID_ARG_TYPE = function(name, type, value) {\n const err = @makeTypeError(`The \"${name}\" argument must be of type ${type}. Received ${value}`);\n return err.code = \"ERR_INVALID_ARG_TYPE\", err;\n}, createTracing = function(opts) {\n if (typeof opts !== \"object\" || opts == null)\n throw new ERR_INVALID_ARG_TYPE(\"options\", \"Object\", opts);\n return new Tracing(opts);\n}, getEnabledCategories = function() {\n return \"\";\n}, $;\n\nclass Tracing {\n enabled = !1;\n categories = \"\";\n}\n$ = {\n createTracing,\n getEnabledCategories\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeTtyCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/tty.ts\nvar ReadStream = function(fd) {\n if (!(this instanceof ReadStream))\n return new ReadStream(fd);\n if (fd >> 0 !== fd || fd < 0)\n @throwRangeError(\"fd must be a positive integer\");\n const stream = (@getInternalField(@internalModuleRegistry, 21) || @createInternalModuleById(21)).ReadStream.@call(this, \"\", {\n fd\n });\n return Object.setPrototypeOf(stream, ReadStream.prototype), stream.isRaw = !1, stream.isTTY = !0, stream;\n}, warnOnDeactivatedColors = function(env) {\n if (warned)\n return;\n let name = \"\";\n if (env.NODE_DISABLE_COLORS !== @undefined)\n name = \"NODE_DISABLE_COLORS\";\n if (env.NO_COLOR !== @undefined) {\n if (name !== \"\")\n name += \"' and '\";\n name += \"NO_COLOR\";\n }\n if (name !== \"\")\n process.emitWarning(`The '${name}' env is ignored due to the 'FORCE_COLOR' env being set.`, \"Warning\"), warned = !0;\n}, WriteStream = function(fd) {\n if (!(this instanceof WriteStream))\n return new WriteStream(fd);\n if (fd >> 0 !== fd || fd < 0)\n @throwRangeError(\"fd must be a positive integer\");\n const stream = (@getInternalField(@internalModuleRegistry, 21) || @createInternalModuleById(21)).WriteStream.@call(this, \"\", {\n fd\n });\n if (stream.columns = @undefined, stream.rows = @undefined, stream.isTTY = isatty(stream.fd), stream.isTTY) {\n const windowSizeArray = [0, 0];\n if (_getWindowSize(fd, windowSizeArray) === !0)\n stream.columns = windowSizeArray[0], stream.rows = windowSizeArray[1];\n }\n return stream;\n}, { ttySetMode, isatty, getWindowSize: _getWindowSize } = @lazy(\"tty\"), NumberIsInteger = Number.isInteger;\nObject.defineProperty(ReadStream, \"prototype\", {\n get() {\n const Prototype = Object.create((@getInternalField(@internalModuleRegistry, 21) || @createInternalModuleById(21)).ReadStream.prototype);\n return Prototype.setRawMode = function(flag) {\n const mode = flag \? 1 : 0, err = ttySetMode(this.fd, mode);\n if (err)\n return this.emit(\"error\", new Error(\"setRawMode failed with errno: \" + err)), this;\n return this.isRaw = flag, this;\n }, Object.defineProperty(ReadStream, \"prototype\", { value: Prototype }), Prototype;\n },\n enumerable: !0,\n configurable: !0\n});\nvar OSRelease, COLORS_2 = 1, COLORS_16 = 4, COLORS_256 = 8, COLORS_16m = 24, TERM_ENVS = {\n eterm: COLORS_16,\n cons25: COLORS_16,\n console: COLORS_16,\n cygwin: COLORS_16,\n dtterm: COLORS_16,\n gnome: COLORS_16,\n hurd: COLORS_16,\n jfbterm: COLORS_16,\n konsole: COLORS_16,\n kterm: COLORS_16,\n mlterm: COLORS_16,\n mosh: COLORS_16m,\n putty: COLORS_16,\n st: COLORS_16,\n \"rxvt-unicode-24bit\": COLORS_16m,\n terminator: COLORS_16m\n}, TERM_ENVS_REG_EXP = [/ansi/, /color/, /linux/, /^con[0-9]*x[0-9]/, /^rxvt/, /^screen/, /^xterm/, /^vt100/], warned = !1;\nObject.defineProperty(WriteStream, \"prototype\", {\n get() {\n const Real = (@getInternalField(@internalModuleRegistry, 21) || @createInternalModuleById(21)).WriteStream.prototype;\n Object.defineProperty(WriteStream, \"prototype\", { value: Real }), WriteStream.prototype._refreshSize = function() {\n const oldCols = this.columns, oldRows = this.rows, windowSizeArray = [0, 0];\n if (_getWindowSize(this.fd, windowSizeArray) === !0) {\n if (oldCols !== windowSizeArray[0] || oldRows !== windowSizeArray[1])\n this.columns = windowSizeArray[0], this.rows = windowSizeArray[1], this.emit(\"resize\");\n }\n };\n var readline = @undefined;\n return WriteStream.prototype.clearLine = function(dir, cb) {\n return (readline \?\?= @getInternalField(@internalModuleRegistry, 35) || @createInternalModuleById(35)).clearLine(this, dir, cb);\n }, WriteStream.prototype.clearScreenDown = function(cb) {\n return (readline \?\?= @getInternalField(@internalModuleRegistry, 35) || @createInternalModuleById(35)).clearScreenDown(this, cb);\n }, WriteStream.prototype.cursorTo = function(x, y, cb) {\n return (readline \?\?= @getInternalField(@internalModuleRegistry, 35) || @createInternalModuleById(35)).cursorTo(this, x, y, cb);\n }, WriteStream.prototype.getColorDepth = function(env = process.env) {\n if (env.FORCE_COLOR !== @undefined)\n switch (env.FORCE_COLOR) {\n case \"\":\n case \"1\":\n case \"true\":\n return warnOnDeactivatedColors(env), COLORS_16;\n case \"2\":\n return warnOnDeactivatedColors(env), COLORS_256;\n case \"3\":\n return warnOnDeactivatedColors(env), COLORS_16m;\n default:\n return COLORS_2;\n }\n if (env.NODE_DISABLE_COLORS !== @undefined || env.NO_COLOR !== @undefined || env.TERM === \"dumb\")\n return COLORS_2;\n if (OSRelease === @undefined) {\n const { release } = @getInternalField(@internalModuleRegistry, 28) || @createInternalModuleById(28);\n OSRelease = release().split(\".\");\n }\n if (+OSRelease[0] >= 10) {\n const build = +OSRelease[2];\n if (build >= 14931)\n return COLORS_16m;\n if (build >= 10586)\n return COLORS_256;\n }\n return COLORS_16;\n switch (env.TERM_PROGRAM) {\n case \"iTerm.app\":\n if (!env.TERM_PROGRAM_VERSION || /^[0-2]\\./.test(env.TERM_PROGRAM_VERSION))\n return COLORS_256;\n return COLORS_16m;\n case \"HyperTerm\":\n case \"MacTerm\":\n return COLORS_16m;\n case \"Apple_Terminal\":\n return COLORS_256;\n }\n }, WriteStream.prototype.getWindowSize = function() {\n return [this.columns, this.rows];\n }, WriteStream.prototype.hasColors = function(count, env) {\n if (env === @undefined && (count === @undefined || typeof count === \"object\" && count !== null))\n env = count, count = 16;\n else\n validateInteger(count, \"count\", 2);\n return count <= 2 ** this.getColorDepth(env);\n }, WriteStream.prototype.moveCursor = function(dx, dy, cb) {\n return (readline \?\?= @getInternalField(@internalModuleRegistry, 35) || @createInternalModuleById(35)).moveCursor(this, dx, dy, cb);\n }, Real;\n },\n enumerable: !0,\n configurable: !0\n});\nvar validateInteger = (value, name, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER) => {\n if (typeof value !== \"number\")\n throw new ERR_INVALID_ARG_TYPE(name, \"number\", value);\n if (!NumberIsInteger(value))\n throw new ERR_OUT_OF_RANGE(name, \"an integer\", value);\n if (value < min || value > max)\n throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);\n};\nreturn { ReadStream, WriteStream, isatty }})\n"); -// - -// -static constexpr ASCIILiteral NodeUrlCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/url.ts\nvar Url = function() {\n this.protocol = null, this.slashes = null, this.auth = null, this.host = null, this.port = null, this.hostname = null, this.hash = null, this.search = null, this.query = null, this.pathname = null, this.path = null, this.href = null;\n}, urlParse = function(url, parseQueryString, slashesDenoteHost) {\n if (url && typeof url === \"object\" && url instanceof Url)\n return url;\n var u = new Url;\n return u.parse(url, parseQueryString, slashesDenoteHost), u;\n}, urlFormat = function(obj) {\n if (typeof obj === \"string\")\n obj = urlParse(obj);\n if (!(obj instanceof Url))\n return Url.prototype.format.@call(obj);\n return obj.format();\n}, urlResolve = function(source, relative) {\n return urlParse(source, !1, !0).resolve(relative);\n}, urlResolveObject = function(source, relative) {\n if (!source)\n return relative;\n return urlParse(source, !1, !0).resolveObject(relative);\n}, urlToHttpOptions = function(url) {\n const options = {\n protocol: url.protocol,\n hostname: typeof url.hostname === \"string\" && url.hostname.startsWith(\"[\") \? url.hostname.slice(1, -1) : url.hostname,\n hash: url.hash,\n search: url.search,\n pathname: url.pathname,\n path: `${url.pathname || \"\"}${url.search || \"\"}`,\n href: url.href\n };\n if (url.port !== \"\")\n options.port = Number(url.port);\n if (url.username || url.password)\n options.auth = `${decodeURIComponent(url.username)}:${decodeURIComponent(url.password)}`;\n return options;\n}, $, { URL, URLSearchParams } = globalThis;\nUrl.prototype = {};\nvar protocolPattern = /^([a-z0-9.+-]+:)/i, portPattern = /:[0-9]*$/, simplePathPattern = /^(\\/\\/\?(\?!\\/)[^\?\\s]*)(\\\?[^\\s]*)\?$/, delims = [\"<\", \">\", '\"', \"`\", \" \", \"\\r\", \"\\n\", \"\\t\"], unwise = [\"{\", \"}\", \"|\", \"\\\\\", \"^\", \"`\"].concat(delims), autoEscape = [\"'\"].concat(unwise), nonHostChars = [\"%\", \"/\", \"\?\", \";\", \"#\"].concat(autoEscape), hostEndingChars = [\"/\", \"\?\", \"#\"], hostnameMaxLen = 255, hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, unsafeProtocol = {\n javascript: !0,\n \"javascript:\": !0\n}, hostlessProtocol = {\n javascript: !0,\n \"javascript:\": !0\n}, slashedProtocol = {\n http: !0,\n https: !0,\n ftp: !0,\n gopher: !0,\n file: !0,\n \"http:\": !0,\n \"https:\": !0,\n \"ftp:\": !0,\n \"gopher:\": !0,\n \"file:\": !0\n};\nUrl.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {\n if (typeof url !== \"string\")\n @throwTypeError(\"Parameter 'url' must be a string, not \" + typeof url);\n var queryIndex = url.indexOf(\"\?\"), splitter = queryIndex !== -1 && queryIndex < url.indexOf(\"#\") \? \"\?\" : \"#\", uSplit = url.split(splitter), slashRegex = /\\\\/g;\n uSplit[0] = uSplit[0].replace(slashRegex, \"/\"), url = uSplit.join(splitter);\n var rest = url;\n if (rest = rest.trim(), !slashesDenoteHost && url.split(\"#\").length === 1) {\n var simplePath = simplePathPattern.exec(rest);\n if (simplePath) {\n if (this.path = rest, this.href = rest, this.pathname = simplePath[1], simplePath[2])\n if (this.search = simplePath[2], parseQueryString)\n this.query = new URLSearchParams(this.search.substr(1)).toJSON();\n else\n this.query = this.search.substr(1);\n else if (parseQueryString)\n this.search = \"\", this.query = {};\n return this;\n }\n }\n var proto = protocolPattern.exec(rest);\n if (proto) {\n proto = proto[0];\n var lowerProto = proto.toLowerCase();\n this.protocol = lowerProto, rest = rest.substr(proto.length);\n }\n if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@/]+@[^@/]+/)) {\n var slashes = rest.substr(0, 2) === \"//\";\n if (slashes && !(proto && hostlessProtocol[proto]))\n rest = rest.substr(2), this.slashes = !0;\n }\n if (!hostlessProtocol[proto] && (slashes || proto && !slashedProtocol[proto])) {\n var hostEnd = -1;\n for (var i = 0;i < hostEndingChars.length; i++) {\n var hec = rest.indexOf(hostEndingChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n var auth, atSign;\n if (hostEnd === -1)\n atSign = rest.lastIndexOf(\"@\");\n else\n atSign = rest.lastIndexOf(\"@\", hostEnd);\n if (atSign !== -1)\n auth = rest.slice(0, atSign), rest = rest.slice(atSign + 1), this.auth = decodeURIComponent(auth);\n hostEnd = -1;\n for (var i = 0;i < nonHostChars.length; i++) {\n var hec = rest.indexOf(nonHostChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n if (hostEnd === -1)\n hostEnd = rest.length;\n this.host = rest.slice(0, hostEnd), rest = rest.slice(hostEnd), this.parseHost(), this.hostname = this.hostname || \"\";\n var ipv6Hostname = this.hostname[0] === \"[\" && this.hostname[this.hostname.length - 1] === \"]\";\n if (!ipv6Hostname) {\n var hostparts = this.hostname.split(/\\./);\n for (var i = 0, l = hostparts.length;i < l; i++) {\n var part = hostparts[i];\n if (!part)\n continue;\n if (!part.match(hostnamePartPattern)) {\n var newpart = \"\";\n for (var j = 0, k = part.length;j < k; j++)\n if (part.charCodeAt(j) > 127)\n newpart += \"x\";\n else\n newpart += part[j];\n if (!newpart.match(hostnamePartPattern)) {\n var validParts = hostparts.slice(0, i), notHost = hostparts.slice(i + 1), bit = part.match(hostnamePartStart);\n if (bit)\n validParts.push(bit[1]), notHost.unshift(bit[2]);\n if (notHost.length)\n rest = \"/\" + notHost.join(\".\") + rest;\n this.hostname = validParts.join(\".\");\n break;\n }\n }\n }\n }\n if (this.hostname.length > hostnameMaxLen)\n this.hostname = \"\";\n else\n this.hostname = this.hostname.toLowerCase();\n if (!ipv6Hostname)\n this.hostname = new URL(\"http://\" + this.hostname).hostname;\n var p = this.port \? \":\" + this.port : \"\", h = this.hostname || \"\";\n if (this.host = h + p, this.href += this.host, ipv6Hostname) {\n if (this.hostname = this.hostname.substr(1, this.hostname.length - 2), rest[0] !== \"/\")\n rest = \"/\" + rest;\n }\n }\n if (!unsafeProtocol[lowerProto])\n for (var i = 0, l = autoEscape.length;i < l; i++) {\n var ae = autoEscape[i];\n if (rest.indexOf(ae) === -1)\n continue;\n var esc = encodeURIComponent(ae);\n if (esc === ae)\n esc = escape(ae);\n rest = rest.split(ae).join(esc);\n }\n var hash = rest.indexOf(\"#\");\n if (hash !== -1)\n this.hash = rest.substr(hash), rest = rest.slice(0, hash);\n var qm = rest.indexOf(\"\?\");\n if (qm !== -1) {\n if (this.search = rest.substr(qm), this.query = rest.substr(qm + 1), parseQueryString) {\n const query = this.query;\n this.query = new URLSearchParams(query).toJSON();\n }\n rest = rest.slice(0, qm);\n } else if (parseQueryString)\n this.search = \"\", this.query = {};\n if (rest)\n this.pathname = rest;\n if (slashedProtocol[lowerProto] && this.hostname && !this.pathname)\n this.pathname = \"/\";\n if (this.pathname || this.search) {\n var p = this.pathname || \"\", s = this.search || \"\";\n this.path = p + s;\n }\n return this.href = this.format(), this;\n};\nUrl.prototype.format = function() {\n var auth = this.auth || \"\";\n if (auth)\n auth = encodeURIComponent(auth), auth = auth.replace(/%3A/i, \":\"), auth += \"@\";\n var protocol = this.protocol || \"\", pathname = this.pathname || \"\", hash = this.hash || \"\", host = !1, query = \"\";\n if (this.host)\n host = auth + this.host;\n else if (this.hostname) {\n if (host = auth + (this.hostname.indexOf(\":\") === -1 \? this.hostname : \"[\" + this.hostname + \"]\"), this.port)\n host += \":\" + this.port;\n }\n if (this.query && typeof this.query === \"object\" && Object.keys(this.query).length)\n query = new URLSearchParams(this.query).toString();\n var search = this.search || query && \"\?\" + query || \"\";\n if (protocol && protocol.substr(-1) !== \":\")\n protocol += \":\";\n if (this.slashes || (!protocol || slashedProtocol[protocol]) && host !== !1) {\n if (host = \"//\" + (host || \"\"), pathname && pathname.charAt(0) !== \"/\")\n pathname = \"/\" + pathname;\n } else if (!host)\n host = \"\";\n if (hash && hash.charAt(0) !== \"#\")\n hash = \"#\" + hash;\n if (search && search.charAt(0) !== \"\?\")\n search = \"\?\" + search;\n return pathname = pathname.replace(/[\?#]/g, function(match) {\n return encodeURIComponent(match);\n }), search = search.replace(\"#\", \"%23\"), protocol + host + pathname + search + hash;\n};\nUrl.prototype.resolve = function(relative) {\n return this.resolveObject(urlParse(relative, !1, !0)).format();\n};\nUrl.prototype.resolveObject = function(relative) {\n if (typeof relative === \"string\") {\n var rel = new Url;\n rel.parse(relative, !1, !0), relative = rel;\n }\n var result = new Url, tkeys = Object.keys(this);\n for (var tk = 0;tk < tkeys.length; tk++) {\n var tkey = tkeys[tk];\n result[tkey] = this[tkey];\n }\n if (result.hash = relative.hash, relative.href === \"\")\n return result.href = result.format(), result;\n if (relative.slashes && !relative.protocol) {\n var rkeys = Object.keys(relative);\n for (var rk = 0;rk < rkeys.length; rk++) {\n var rkey = rkeys[rk];\n if (rkey !== \"protocol\")\n result[rkey] = relative[rkey];\n }\n if (slashedProtocol[result.protocol] && result.hostname && !result.pathname)\n result.pathname = \"/\", result.path = result.pathname;\n return result.href = result.format(), result;\n }\n if (relative.protocol && relative.protocol !== result.protocol) {\n if (!slashedProtocol[relative.protocol]) {\n var keys = Object.keys(relative);\n for (var v = 0;v < keys.length; v++) {\n var k = keys[v];\n result[k] = relative[k];\n }\n return result.href = result.format(), result;\n }\n if (result.protocol = relative.protocol, !relative.host && !hostlessProtocol[relative.protocol]) {\n var relPath = (relative.pathname || \"\").split(\"/\");\n while (relPath.length && !(relative.host = relPath.shift()))\n ;\n if (!relative.host)\n relative.host = \"\";\n if (!relative.hostname)\n relative.hostname = \"\";\n if (relPath[0] !== \"\")\n relPath.unshift(\"\");\n if (relPath.length < 2)\n relPath.unshift(\"\");\n result.pathname = relPath.join(\"/\");\n } else\n result.pathname = relative.pathname;\n if (result.search = relative.search, result.query = relative.query, result.host = relative.host || \"\", result.auth = relative.auth, result.hostname = relative.hostname || relative.host, result.port = relative.port, result.pathname || result.search) {\n var p = result.pathname || \"\", s = result.search || \"\";\n result.path = p + s;\n }\n return result.slashes = result.slashes || relative.slashes, result.href = result.format(), result;\n }\n var isSourceAbs = result.pathname && result.pathname.charAt(0) === \"/\", isRelAbs = relative.host || relative.pathname && relative.pathname.charAt(0) === \"/\", mustEndAbs = isRelAbs || isSourceAbs || result.host && relative.pathname, removeAllDots = mustEndAbs, srcPath = result.pathname && result.pathname.split(\"/\") || [], relPath = relative.pathname && relative.pathname.split(\"/\") || [], psychotic = result.protocol && !slashedProtocol[result.protocol];\n if (psychotic) {\n if (result.hostname = \"\", result.port = null, result.host)\n if (srcPath[0] === \"\")\n srcPath[0] = result.host;\n else\n srcPath.unshift(result.host);\n if (result.host = \"\", relative.protocol) {\n if (relative.hostname = null, relative.port = null, relative.host)\n if (relPath[0] === \"\")\n relPath[0] = relative.host;\n else\n relPath.unshift(relative.host);\n relative.host = null;\n }\n mustEndAbs = mustEndAbs && (relPath[0] === \"\" || srcPath[0] === \"\");\n }\n if (isRelAbs)\n result.host = relative.host || relative.host === \"\" \? relative.host : result.host, result.hostname = relative.hostname || relative.hostname === \"\" \? relative.hostname : result.hostname, result.search = relative.search, result.query = relative.query, srcPath = relPath;\n else if (relPath.length) {\n if (!srcPath)\n srcPath = [];\n srcPath.pop(), srcPath = srcPath.concat(relPath), result.search = relative.search, result.query = relative.query;\n } else if (relative.search != null) {\n if (psychotic) {\n result.host = srcPath.shift(), result.hostname = result.host;\n var authInHost = result.host && result.host.indexOf(\"@\") > 0 \? result.host.split(\"@\") : !1;\n if (authInHost)\n result.auth = authInHost.shift(), result.hostname = authInHost.shift(), result.host = result.hostname;\n }\n if (result.search = relative.search, result.query = relative.query, result.pathname !== null || result.search !== null)\n result.path = (result.pathname \? result.pathname : \"\") + (result.search \? result.search : \"\");\n return result.href = result.format(), result;\n }\n if (!srcPath.length) {\n if (result.pathname = null, result.search)\n result.path = \"/\" + result.search;\n else\n result.path = null;\n return result.href = result.format(), result;\n }\n var last = srcPath.slice(-1)[0], hasTrailingSlash = (result.host || relative.host || srcPath.length > 1) && (last === \".\" || last === \"..\") || last === \"\", up = 0;\n for (var i = srcPath.length;i >= 0; i--)\n if (last = srcPath[i], last === \".\")\n srcPath.splice(i, 1);\n else if (last === \"..\")\n srcPath.splice(i, 1), up++;\n else if (up)\n srcPath.splice(i, 1), up--;\n if (!mustEndAbs && !removeAllDots)\n for (;up--; up)\n srcPath.unshift(\"..\");\n if (mustEndAbs && srcPath[0] !== \"\" && (!srcPath[0] || srcPath[0].charAt(0) !== \"/\"))\n srcPath.unshift(\"\");\n if (hasTrailingSlash && srcPath.join(\"/\").substr(-1) !== \"/\")\n srcPath.push(\"\");\n var isAbsolute = srcPath[0] === \"\" || srcPath[0] && srcPath[0].charAt(0) === \"/\";\n if (psychotic) {\n result.hostname = isAbsolute \? \"\" : srcPath.length \? srcPath.shift() : \"\", result.host = result.hostname;\n var authInHost = result.host && result.host.indexOf(\"@\") > 0 \? result.host.split(\"@\") : !1;\n if (authInHost)\n result.auth = authInHost.shift(), result.hostname = authInHost.shift(), result.host = result.hostname;\n }\n if (mustEndAbs = mustEndAbs || result.host && srcPath.length, mustEndAbs && !isAbsolute)\n srcPath.unshift(\"\");\n if (srcPath.length > 0)\n result.pathname = srcPath.join(\"/\");\n else\n result.pathname = null, result.path = null;\n if (result.pathname !== null || result.search !== null)\n result.path = (result.pathname \? result.pathname : \"\") + (result.search \? result.search : \"\");\n return result.auth = relative.auth || result.auth, result.slashes = result.slashes || relative.slashes, result.href = result.format(), result;\n};\nUrl.prototype.parseHost = function() {\n var host = this.host, port = portPattern.exec(host);\n if (port) {\n if (port = port[0], port !== \":\")\n this.port = port.substr(1);\n host = host.substr(0, host.length - port.length);\n }\n if (host)\n this.hostname = host;\n};\nvar pathToFileURL = @lazy(\"pathToFileURL\"), fileURLToPath = @lazy(\"fileURLToPath\");\n$ = {\n parse: urlParse,\n resolve: urlResolve,\n resolveObject: urlResolveObject,\n format: urlFormat,\n Url,\n URLSearchParams,\n URL,\n pathToFileURL,\n fileURLToPath,\n urlToHttpOptions\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeUtilCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/util.ts\nvar isBuffer = function(value) {\n return @Buffer.isBuffer(value);\n}, isFunction = function(value) {\n return typeof value === \"function\";\n}, deprecate = function(fn, msg, code) {\n if (process.noDeprecation === !0)\n return fn;\n var warned = !1;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n var err = new Error(msg);\n if (code)\n err.code = code;\n throw err;\n } else if (process.traceDeprecation)\n console.trace(msg);\n else\n console.error(msg);\n warned = !0;\n }\n return fn.@apply(this, arguments);\n }\n return deprecated;\n}, debuglog = function(set) {\n if (set = set.toUpperCase(), !debugs[set])\n if (debugEnvRegex.test(set)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = format.@apply(cjs_exports, arguments);\n console.error(\"%s %d: %s\", set, pid, msg);\n };\n } else\n debugs[set] = function() {\n };\n return debugs[set];\n}, isBoolean = function(arg) {\n return typeof arg === \"boolean\";\n}, isNull = function(arg) {\n return arg === null;\n}, isNullOrUndefined = function(arg) {\n return arg == null;\n}, isNumber = function(arg) {\n return typeof arg === \"number\";\n}, isString = function(arg) {\n return typeof arg === \"string\";\n}, isSymbol = function(arg) {\n return typeof arg === \"symbol\";\n}, isUndefined = function(arg) {\n return arg === void 0;\n}, isObject = function(arg) {\n return typeof arg === \"object\" && arg !== null;\n}, isPrimitive = function(arg) {\n return arg === null || typeof arg === \"boolean\" || typeof arg === \"number\" || typeof arg === \"string\" || typeof arg === \"symbol\" || typeof arg === \"undefined\";\n}, pad = function(n) {\n return n < 10 \? \"0\" + n.toString(10) : n.toString(10);\n}, timestamp = function() {\n var d = new Date, time = [pad(d.getHours()), pad(d.getMinutes()), pad(d.getSeconds())].join(\":\");\n return [d.getDate(), months[d.getMonth()], time].join(\" \");\n}, callbackifyOnRejected = function(reason, cb) {\n if (!reason) {\n var newReason = new Error(\"Promise was rejected with a falsy value\");\n newReason.reason = reason, newReason.code = \"ERR_FALSY_VALUE_REJECTION\", reason = newReason;\n }\n return cb(reason);\n}, callbackify = function(original) {\n if (typeof original !== \"function\")\n @throwTypeError('The \"original\" argument must be of type Function');\n function callbackified() {\n var args = @Array.prototype.slice.@call(arguments), maybeCb = args.pop();\n if (typeof maybeCb !== \"function\")\n @throwTypeError(\"The last argument must be of type Function\");\n var self = this, cb = function() {\n return maybeCb.@apply(self, arguments);\n };\n original.@apply(this, args).then(function(ret) {\n process.nextTick(cb, null, ret);\n }, function(rej) {\n process.nextTick(callbackifyOnRejected, rej, cb);\n });\n }\n return Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original)), Object.defineProperties(callbackified, getOwnPropertyDescriptors(original)), callbackified;\n}, $, types = @requireNativeModule(\"util/types\"), utl = @getInternalField(@internalModuleRegistry, 7) || @createInternalModuleById(7), cjs_exports = {}, deepEquals = Bun.deepEquals, isDeepStrictEqual = (a, b) => deepEquals(a, b, !0), getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors, inspect = utl.inspect, formatWithOptions = utl.formatWithOptions, format = utl.format, stripVTControlCharacters = utl.stripVTControlCharacters, debugs = {}, debugEnvRegex = /^$/;\nif (process.env.NODE_DEBUG)\n debugEnv = process.env.NODE_DEBUG, debugEnv = debugEnv.replace(/[|\\\\{}()[\\]^$+\?.]/g, \"\\\\$&\").replace(/\\*/g, \".*\").replace(/,/g, \"$|^\").toUpperCase(), debugEnvRegex = new @RegExp(\"^\" + debugEnv + \"$\", \"i\");\nvar debugEnv, isRegExp = types.isRegExp, isDate = types.isDate, isError = types.isNativeError, months = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], log = function log2() {\n console.log(\"%s - %s\", timestamp(), format.@apply(cjs_exports, arguments));\n}, inherits = function inherits2(ctor, superCtor) {\n ctor.super_ = superCtor, ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: !1,\n writable: !0,\n configurable: !0\n }\n });\n}, _extend = function(origin, add) {\n if (!add || !isObject(add))\n return origin;\n var keys = Object.keys(add), i = keys.length;\n while (i--)\n origin[keys[i]] = add[keys[i]];\n return origin;\n}, kCustomPromisifiedSymbol = Symbol.for(\"util.promisify.custom\"), promisify = function promisify2(original) {\n if (typeof original !== \"function\")\n @throwTypeError('The \"original\" argument must be of type Function');\n if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {\n var fn = original[kCustomPromisifiedSymbol];\n if (typeof fn !== \"function\")\n @throwTypeError('The \"util.promisify.custom\" argument must be of type Function');\n return Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn,\n enumerable: !1,\n writable: !1,\n configurable: !0\n }), fn;\n }\n function fn() {\n var promiseResolve, promiseReject, promise = new @Promise(function(resolve, reject) {\n promiseResolve = resolve, promiseReject = reject;\n }), args = [];\n for (var i = 0;i < arguments.length; i++)\n args.push(arguments[i]);\n args.push(function(err, value) {\n if (err)\n promiseReject(err);\n else\n promiseResolve(value);\n });\n try {\n original.@apply(this, args);\n } catch (err) {\n promiseReject(err);\n }\n return promise;\n }\n if (Object.setPrototypeOf(fn, Object.getPrototypeOf(original)), kCustomPromisifiedSymbol)\n Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn,\n enumerable: !1,\n writable: !1,\n configurable: !0\n });\n return Object.defineProperties(fn, getOwnPropertyDescriptors(original));\n};\npromisify.custom = kCustomPromisifiedSymbol;\nvar toUSVString = (input) => {\n return (input + \"\").toWellFormed();\n};\n$ = Object.assign(cjs_exports, {\n format,\n formatWithOptions,\n stripVTControlCharacters,\n deprecate,\n debuglog,\n _extend,\n inspect,\n types,\n isArray: @isArray,\n isBoolean,\n isNull,\n isNullOrUndefined,\n isNumber,\n isString,\n isSymbol,\n isUndefined,\n isRegExp,\n isObject,\n isDate,\n isFunction,\n isError,\n isPrimitive,\n isBuffer,\n log,\n inherits,\n toUSVString,\n promisify,\n callbackify,\n isDeepStrictEqual,\n TextDecoder,\n TextEncoder\n});\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeV8Code = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/v8.ts\nvar notimpl = function(message) {\n throwNotImplemented(\"node:v8 \" + message);\n}, cachedDataVersionTag = function() {\n notimpl(\"cachedDataVersionTag\");\n}, getHeapSnapshot = function() {\n notimpl(\"getHeapSnapshot\");\n}, getHeapStatistics = function() {\n const stats = jsc.heapStats();\n return {\n total_heap_size: stats.heapCapacity,\n total_heap_size_executable: 0,\n total_physical_size: stats.heapSize,\n total_available_size: @Infinity,\n used_heap_size: stats.heapSize,\n heap_size_limit: @Infinity,\n malloced_memory: stats.heapSize,\n peak_malloced_memory: @Infinity,\n does_zap_garbage: 0,\n number_of_native_contexts: @Infinity,\n number_of_detached_contexts: @Infinity,\n total_global_handles_size: @Infinity,\n used_global_handles_size: @Infinity,\n external_memory: @Infinity\n };\n}, getHeapSpaceStatistics = function() {\n notimpl(\"getHeapSpaceStatistics\");\n}, getHeapCodeStatistics = function() {\n notimpl(\"getHeapCodeStatistics\");\n}, setFlagsFromString = function() {\n notimpl(\"setFlagsFromString\");\n}, deserialize = function(value) {\n return jsc.deserialize(value);\n}, takeCoverage = function() {\n notimpl(\"takeCoverage\");\n}, stopCoverage = function() {\n notimpl(\"stopCoverage\");\n}, serialize = function(arg1) {\n return jsc.serialize(arg1, { binaryType: \"nodebuffer\" });\n}, writeHeapSnapshot = function() {\n notimpl(\"writeHeapSnapshot\");\n}, setHeapSnapshotNearHeapLimit = function() {\n notimpl(\"setHeapSnapshotNearHeapLimit\");\n}, $, { hideFromStack, throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6), jsc = @requireNativeModule(\"bun:jsc\");\n\nclass Deserializer {\n constructor() {\n notimpl(\"Deserializer\");\n }\n}\n\nclass Serializer {\n constructor() {\n notimpl(\"Serializer\");\n }\n}\n\nclass DefaultDeserializer extends Deserializer {\n constructor() {\n super(...arguments);\n }\n}\n\nclass DefaultSerializer extends Serializer {\n constructor() {\n super(...arguments);\n }\n}\n\nclass GCProfiler {\n constructor() {\n notimpl(\"GCProfiler\");\n }\n}\nvar promiseHooks = {\n createHook: () => {\n notimpl(\"createHook\");\n },\n onInit: () => {\n notimpl(\"onInit\");\n },\n onBefore: () => {\n notimpl(\"onBefore\");\n },\n onAfter: () => {\n notimpl(\"onAfter\");\n },\n onSettled: () => {\n notimpl(\"onSettled\");\n }\n}, startupSnapshot = {\n addDeserializeCallback: () => notimpl(\"addDeserializeCallback\"),\n addSerializeCallback: () => notimpl(\"addSerializeCallback\"),\n setDeserializeMainFunction: () => notimpl(\"setDeserializeMainFunction\"),\n isBuildingSnapshot: () => notimpl(\"isBuildingSnapshot\")\n};\n$ = {\n cachedDataVersionTag,\n getHeapSnapshot,\n getHeapStatistics,\n getHeapSpaceStatistics,\n getHeapCodeStatistics,\n setFlagsFromString,\n deserialize,\n takeCoverage,\n stopCoverage,\n serialize,\n writeHeapSnapshot,\n setHeapSnapshotNearHeapLimit,\n promiseHooks,\n startupSnapshot,\n Deserializer,\n Serializer\n};\nhideFromStack(notimpl, cachedDataVersionTag, getHeapSnapshot, getHeapStatistics, getHeapSpaceStatistics, getHeapCodeStatistics, setFlagsFromString, deserialize, takeCoverage, stopCoverage, serialize, writeHeapSnapshot, setHeapSnapshotNearHeapLimit, Deserializer, Serializer, DefaultDeserializer, DefaultSerializer, GCProfiler);\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeVMCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/vm.ts\nvar runInContext = function(code, context, options) {\n return new Script(code, options).runInContext(context);\n}, compileFunction = function() {\n throwNotImplemented(\"node:vm compileFunction\");\n}, measureMemory = function() {\n throwNotImplemented(\"node:vm measureMemory\");\n}, $, { throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6), vm = @lazy(\"vm\"), { createContext, isContext, Script, runInNewContext, runInThisContext } = vm;\n\nclass Module {\n constructor() {\n throwNotImplemented(\"node:vm Module\");\n }\n}\n\nclass SourceTextModule {\n constructor() {\n throwNotImplemented(\"node:vm Module\");\n }\n}\n\nclass SyntheticModule {\n constructor() {\n throwNotImplemented(\"node:vm Module\");\n }\n}\n$ = {\n createContext,\n runInContext,\n runInNewContext,\n runInThisContext,\n isContext,\n compileFunction,\n measureMemory,\n Script,\n Module,\n SourceTextModule,\n SyntheticModule\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeWasiCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/wasi.ts\nvar nodeFsConstants = @processBindingConstants.fs, __getOwnPropNames = Object.getOwnPropertyNames, __commonJS = (cb, mod) => function __require2() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n}, require_types = __commonJS({\n \"node_modules/wasi-js/dist/types.js\"(exports) {\n Object.defineProperty(exports, \"__esModule\", { value: !0 }), exports.WASIKillError = exports.WASIExitError = exports.WASIError = void 0;\n var WASIError = class extends Error {\n constructor(errno) {\n super();\n this.errno = errno, Object.setPrototypeOf(this, WASIError.prototype);\n }\n };\n exports.WASIError = WASIError;\n var WASIExitError = class extends Error {\n constructor(code) {\n super(`WASI Exit error: ${code}`);\n this.code = code, Object.setPrototypeOf(this, WASIExitError.prototype);\n }\n };\n exports.WASIExitError = WASIExitError;\n var WASIKillError = class extends Error {\n constructor(signal) {\n super(`WASI Kill signal: ${signal}`);\n this.signal = signal, Object.setPrototypeOf(this, WASIKillError.prototype);\n }\n };\n exports.WASIKillError = WASIKillError;\n }\n}), require_constants = __commonJS({\n \"node_modules/wasi-js/dist/constants.js\"(exports) {\n Object.defineProperty(exports, \"__esModule\", { value: !0 }), exports.WASI_ENOMSG = exports.WASI_ENOMEM = exports.WASI_ENOLINK = exports.WASI_ENOLCK = exports.WASI_ENOEXEC = exports.WASI_ENOENT = exports.WASI_ENODEV = exports.WASI_ENOBUFS = exports.WASI_ENFILE = exports.WASI_ENETUNREACH = exports.WASI_ENETRESET = exports.WASI_ENETDOWN = exports.WASI_ENAMETOOLONG = exports.WASI_EMULTIHOP = exports.WASI_EMSGSIZE = exports.WASI_EMLINK = exports.WASI_EMFILE = exports.WASI_ELOOP = exports.WASI_EISDIR = exports.WASI_EISCONN = exports.WASI_EIO = exports.WASI_EINVAL = exports.WASI_EINTR = exports.WASI_EINPROGRESS = exports.WASI_EILSEQ = exports.WASI_EIDRM = exports.WASI_EHOSTUNREACH = exports.WASI_EFBIG = exports.WASI_EFAULT = exports.WASI_EEXIST = exports.WASI_EDQUOT = exports.WASI_EDOM = exports.WASI_EDESTADDRREQ = exports.WASI_EDEADLK = exports.WASI_ECONNRESET = exports.WASI_ECONNREFUSED = exports.WASI_ECONNABORTED = exports.WASI_ECHILD = exports.WASI_ECANCELED = exports.WASI_EBUSY = exports.WASI_EBADMSG = exports.WASI_EBADF = exports.WASI_EALREADY = exports.WASI_EAGAIN = exports.WASI_EAFNOSUPPORT = exports.WASI_EADDRNOTAVAIL = exports.WASI_EADDRINUSE = exports.WASI_EACCES = exports.WASI_E2BIG = exports.WASI_ESUCCESS = void 0, exports.WASI_SIGVTALRM = exports.WASI_SIGUSR2 = exports.WASI_SIGUSR1 = exports.WASI_SIGURG = exports.WASI_SIGTTOU = exports.WASI_SIGTTIN = exports.WASI_SIGTSTP = exports.WASI_SIGTRAP = exports.WASI_SIGTERM = exports.WASI_SIGSTOP = exports.WASI_SIGSEGV = exports.WASI_SIGQUIT = exports.WASI_SIGPIPE = exports.WASI_SIGKILL = exports.WASI_SIGINT = exports.WASI_SIGILL = exports.WASI_SIGHUP = exports.WASI_SIGFPE = exports.WASI_SIGCONT = exports.WASI_SIGCHLD = exports.WASI_SIGBUS = exports.WASI_SIGALRM = exports.WASI_SIGABRT = exports.WASI_ENOTCAPABLE = exports.WASI_EXDEV = exports.WASI_ETXTBSY = exports.WASI_ETIMEDOUT = exports.WASI_ESTALE = exports.WASI_ESRCH = exports.WASI_ESPIPE = exports.WASI_EROFS = exports.WASI_ERANGE = exports.WASI_EPROTOTYPE = exports.WASI_EPROTONOSUPPORT = exports.WASI_EPROTO = exports.WASI_EPIPE = exports.WASI_EPERM = exports.WASI_EOWNERDEAD = exports.WASI_EOVERFLOW = exports.WASI_ENXIO = exports.WASI_ENOTTY = exports.WASI_ENOTSUP = exports.WASI_ENOTSOCK = exports.WASI_ENOTRECOVERABLE = exports.WASI_ENOTEMPTY = exports.WASI_ENOTDIR = exports.WASI_ENOTCONN = exports.WASI_ENOSYS = exports.WASI_ENOSPC = exports.WASI_ENOPROTOOPT = void 0, exports.RIGHTS_REGULAR_FILE_BASE = exports.RIGHTS_CHARACTER_DEVICE_INHERITING = exports.RIGHTS_CHARACTER_DEVICE_BASE = exports.RIGHTS_BLOCK_DEVICE_INHERITING = exports.RIGHTS_BLOCK_DEVICE_BASE = exports.RIGHTS_ALL = exports.WASI_RIGHT_SOCK_SHUTDOWN = exports.WASI_RIGHT_POLL_FD_READWRITE = exports.WASI_RIGHT_PATH_UNLINK_FILE = exports.WASI_RIGHT_PATH_REMOVE_DIRECTORY = exports.WASI_RIGHT_PATH_SYMLINK = exports.WASI_RIGHT_FD_FILESTAT_SET_TIMES = exports.WASI_RIGHT_FD_FILESTAT_SET_SIZE = exports.WASI_RIGHT_FD_FILESTAT_GET = exports.WASI_RIGHT_PATH_FILESTAT_SET_TIMES = exports.WASI_RIGHT_PATH_FILESTAT_SET_SIZE = exports.WASI_RIGHT_PATH_FILESTAT_GET = exports.WASI_RIGHT_PATH_RENAME_TARGET = exports.WASI_RIGHT_PATH_RENAME_SOURCE = exports.WASI_RIGHT_PATH_READLINK = exports.WASI_RIGHT_FD_READDIR = exports.WASI_RIGHT_PATH_OPEN = exports.WASI_RIGHT_PATH_LINK_TARGET = exports.WASI_RIGHT_PATH_LINK_SOURCE = exports.WASI_RIGHT_PATH_CREATE_FILE = exports.WASI_RIGHT_PATH_CREATE_DIRECTORY = exports.WASI_RIGHT_FD_ALLOCATE = exports.WASI_RIGHT_FD_ADVISE = exports.WASI_RIGHT_FD_WRITE = exports.WASI_RIGHT_FD_TELL = exports.WASI_RIGHT_FD_SYNC = exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS = exports.WASI_RIGHT_FD_SEEK = exports.WASI_RIGHT_FD_READ = exports.WASI_RIGHT_FD_DATASYNC = exports.WASI_FDFLAG_SYNC = exports.WASI_FDFLAG_RSYNC = exports.WASI_FDFLAG_NONBLOCK = exports.WASI_FDFLAG_DSYNC = exports.WASI_FDFLAG_APPEND = exports.WASI_FILETYPE_SYMBOLIC_LINK = exports.WASI_FILETYPE_SOCKET_STREAM = exports.WASI_FILETYPE_SOCKET_DGRAM = exports.WASI_FILETYPE_REGULAR_FILE = exports.WASI_FILETYPE_DIRECTORY = exports.WASI_FILETYPE_CHARACTER_DEVICE = exports.WASI_FILETYPE_BLOCK_DEVICE = exports.WASI_FILETYPE_UNKNOWN = exports.WASI_SIGXFSZ = exports.WASI_SIGXCPU = void 0, exports.SIGNAL_MAP = exports.ERROR_MAP = exports.WASI_WHENCE_END = exports.WASI_WHENCE_CUR = exports.WASI_WHENCE_SET = exports.WASI_STDERR_FILENO = exports.WASI_STDOUT_FILENO = exports.WASI_STDIN_FILENO = exports.WASI_DIRCOOKIE_START = exports.WASI_PREOPENTYPE_DIR = exports.WASI_O_TRUNC = exports.WASI_O_EXCL = exports.WASI_O_DIRECTORY = exports.WASI_O_CREAT = exports.WASI_FILESTAT_SET_MTIM_NOW = exports.WASI_FILESTAT_SET_MTIM = exports.WASI_FILESTAT_SET_ATIM_NOW = exports.WASI_FILESTAT_SET_ATIM = exports.WASI_EVENTTYPE_FD_WRITE = exports.WASI_EVENTTYPE_FD_READ = exports.WASI_EVENTTYPE_CLOCK = exports.WASI_CLOCK_THREAD_CPUTIME_ID = exports.WASI_CLOCK_PROCESS_CPUTIME_ID = exports.WASI_CLOCK_MONOTONIC = exports.WASI_CLOCK_REALTIME = exports.RIGHTS_TTY_INHERITING = exports.RIGHTS_TTY_BASE = exports.RIGHTS_SOCKET_INHERITING = exports.RIGHTS_SOCKET_BASE = exports.RIGHTS_DIRECTORY_INHERITING = exports.RIGHTS_DIRECTORY_BASE = exports.RIGHTS_REGULAR_FILE_INHERITING = void 0, exports.WASI_ESUCCESS = 0, exports.WASI_E2BIG = 1, exports.WASI_EACCES = 2, exports.WASI_EADDRINUSE = 3, exports.WASI_EADDRNOTAVAIL = 4, exports.WASI_EAFNOSUPPORT = 5, exports.WASI_EAGAIN = 6, exports.WASI_EALREADY = 7, exports.WASI_EBADF = 8, exports.WASI_EBADMSG = 9, exports.WASI_EBUSY = 10, exports.WASI_ECANCELED = 11, exports.WASI_ECHILD = 12, exports.WASI_ECONNABORTED = 13, exports.WASI_ECONNREFUSED = 14, exports.WASI_ECONNRESET = 15, exports.WASI_EDEADLK = 16, exports.WASI_EDESTADDRREQ = 17, exports.WASI_EDOM = 18, exports.WASI_EDQUOT = 19, exports.WASI_EEXIST = 20, exports.WASI_EFAULT = 21, exports.WASI_EFBIG = 22, exports.WASI_EHOSTUNREACH = 23, exports.WASI_EIDRM = 24, exports.WASI_EILSEQ = 25, exports.WASI_EINPROGRESS = 26, exports.WASI_EINTR = 27, exports.WASI_EINVAL = 28, exports.WASI_EIO = 29, exports.WASI_EISCONN = 30, exports.WASI_EISDIR = 31, exports.WASI_ELOOP = 32, exports.WASI_EMFILE = 33, exports.WASI_EMLINK = 34, exports.WASI_EMSGSIZE = 35, exports.WASI_EMULTIHOP = 36, exports.WASI_ENAMETOOLONG = 37, exports.WASI_ENETDOWN = 38, exports.WASI_ENETRESET = 39, exports.WASI_ENETUNREACH = 40, exports.WASI_ENFILE = 41, exports.WASI_ENOBUFS = 42, exports.WASI_ENODEV = 43, exports.WASI_ENOENT = 44, exports.WASI_ENOEXEC = 45, exports.WASI_ENOLCK = 46, exports.WASI_ENOLINK = 47, exports.WASI_ENOMEM = 48, exports.WASI_ENOMSG = 49, exports.WASI_ENOPROTOOPT = 50, exports.WASI_ENOSPC = 51, exports.WASI_ENOSYS = 52, exports.WASI_ENOTCONN = 53, exports.WASI_ENOTDIR = 54, exports.WASI_ENOTEMPTY = 55, exports.WASI_ENOTRECOVERABLE = 56, exports.WASI_ENOTSOCK = 57, exports.WASI_ENOTSUP = 58, exports.WASI_ENOTTY = 59, exports.WASI_ENXIO = 60, exports.WASI_EOVERFLOW = 61, exports.WASI_EOWNERDEAD = 62, exports.WASI_EPERM = 63, exports.WASI_EPIPE = 64, exports.WASI_EPROTO = 65, exports.WASI_EPROTONOSUPPORT = 66, exports.WASI_EPROTOTYPE = 67, exports.WASI_ERANGE = 68, exports.WASI_EROFS = 69, exports.WASI_ESPIPE = 70, exports.WASI_ESRCH = 71, exports.WASI_ESTALE = 72, exports.WASI_ETIMEDOUT = 73, exports.WASI_ETXTBSY = 74, exports.WASI_EXDEV = 75, exports.WASI_ENOTCAPABLE = 76, exports.WASI_SIGABRT = 0, exports.WASI_SIGALRM = 1, exports.WASI_SIGBUS = 2, exports.WASI_SIGCHLD = 3, exports.WASI_SIGCONT = 4, exports.WASI_SIGFPE = 5, exports.WASI_SIGHUP = 6, exports.WASI_SIGILL = 7, exports.WASI_SIGINT = 8, exports.WASI_SIGKILL = 9, exports.WASI_SIGPIPE = 10, exports.WASI_SIGQUIT = 11, exports.WASI_SIGSEGV = 12, exports.WASI_SIGSTOP = 13, exports.WASI_SIGTERM = 14, exports.WASI_SIGTRAP = 15, exports.WASI_SIGTSTP = 16, exports.WASI_SIGTTIN = 17, exports.WASI_SIGTTOU = 18, exports.WASI_SIGURG = 19, exports.WASI_SIGUSR1 = 20, exports.WASI_SIGUSR2 = 21, exports.WASI_SIGVTALRM = 22, exports.WASI_SIGXCPU = 23, exports.WASI_SIGXFSZ = 24, exports.WASI_FILETYPE_UNKNOWN = 0, exports.WASI_FILETYPE_BLOCK_DEVICE = 1, exports.WASI_FILETYPE_CHARACTER_DEVICE = 2, exports.WASI_FILETYPE_DIRECTORY = 3, exports.WASI_FILETYPE_REGULAR_FILE = 4, exports.WASI_FILETYPE_SOCKET_DGRAM = 5, exports.WASI_FILETYPE_SOCKET_STREAM = 6, exports.WASI_FILETYPE_SYMBOLIC_LINK = 7, exports.WASI_FDFLAG_APPEND = 1, exports.WASI_FDFLAG_DSYNC = 2, exports.WASI_FDFLAG_NONBLOCK = 4, exports.WASI_FDFLAG_RSYNC = 8, exports.WASI_FDFLAG_SYNC = 16, exports.WASI_RIGHT_FD_DATASYNC = BigInt(1), exports.WASI_RIGHT_FD_READ = BigInt(2), exports.WASI_RIGHT_FD_SEEK = BigInt(4), exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS = BigInt(8), exports.WASI_RIGHT_FD_SYNC = BigInt(16), exports.WASI_RIGHT_FD_TELL = BigInt(32), exports.WASI_RIGHT_FD_WRITE = BigInt(64), exports.WASI_RIGHT_FD_ADVISE = BigInt(128), exports.WASI_RIGHT_FD_ALLOCATE = BigInt(256), exports.WASI_RIGHT_PATH_CREATE_DIRECTORY = BigInt(512), exports.WASI_RIGHT_PATH_CREATE_FILE = BigInt(1024), exports.WASI_RIGHT_PATH_LINK_SOURCE = BigInt(2048), exports.WASI_RIGHT_PATH_LINK_TARGET = BigInt(4096), exports.WASI_RIGHT_PATH_OPEN = BigInt(8192), exports.WASI_RIGHT_FD_READDIR = BigInt(16384), exports.WASI_RIGHT_PATH_READLINK = BigInt(32768), exports.WASI_RIGHT_PATH_RENAME_SOURCE = BigInt(65536), exports.WASI_RIGHT_PATH_RENAME_TARGET = BigInt(131072), exports.WASI_RIGHT_PATH_FILESTAT_GET = BigInt(262144), exports.WASI_RIGHT_PATH_FILESTAT_SET_SIZE = BigInt(524288), exports.WASI_RIGHT_PATH_FILESTAT_SET_TIMES = BigInt(1048576), exports.WASI_RIGHT_FD_FILESTAT_GET = BigInt(2097152), exports.WASI_RIGHT_FD_FILESTAT_SET_SIZE = BigInt(4194304), exports.WASI_RIGHT_FD_FILESTAT_SET_TIMES = BigInt(8388608), exports.WASI_RIGHT_PATH_SYMLINK = BigInt(16777216), exports.WASI_RIGHT_PATH_REMOVE_DIRECTORY = BigInt(33554432), exports.WASI_RIGHT_PATH_UNLINK_FILE = BigInt(67108864), exports.WASI_RIGHT_POLL_FD_READWRITE = BigInt(134217728), exports.WASI_RIGHT_SOCK_SHUTDOWN = BigInt(268435456), exports.RIGHTS_ALL = exports.WASI_RIGHT_FD_DATASYNC | exports.WASI_RIGHT_FD_READ | exports.WASI_RIGHT_FD_SEEK | exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS | exports.WASI_RIGHT_FD_SYNC | exports.WASI_RIGHT_FD_TELL | exports.WASI_RIGHT_FD_WRITE | exports.WASI_RIGHT_FD_ADVISE | exports.WASI_RIGHT_FD_ALLOCATE | exports.WASI_RIGHT_PATH_CREATE_DIRECTORY | exports.WASI_RIGHT_PATH_CREATE_FILE | exports.WASI_RIGHT_PATH_LINK_SOURCE | exports.WASI_RIGHT_PATH_LINK_TARGET | exports.WASI_RIGHT_PATH_OPEN | exports.WASI_RIGHT_FD_READDIR | exports.WASI_RIGHT_PATH_READLINK | exports.WASI_RIGHT_PATH_RENAME_SOURCE | exports.WASI_RIGHT_PATH_RENAME_TARGET | exports.WASI_RIGHT_PATH_FILESTAT_GET | exports.WASI_RIGHT_PATH_FILESTAT_SET_SIZE | exports.WASI_RIGHT_PATH_FILESTAT_SET_TIMES | exports.WASI_RIGHT_FD_FILESTAT_GET | exports.WASI_RIGHT_FD_FILESTAT_SET_TIMES | exports.WASI_RIGHT_FD_FILESTAT_SET_SIZE | exports.WASI_RIGHT_PATH_SYMLINK | exports.WASI_RIGHT_PATH_UNLINK_FILE | exports.WASI_RIGHT_PATH_REMOVE_DIRECTORY | exports.WASI_RIGHT_POLL_FD_READWRITE | exports.WASI_RIGHT_SOCK_SHUTDOWN, exports.RIGHTS_BLOCK_DEVICE_BASE = exports.RIGHTS_ALL, exports.RIGHTS_BLOCK_DEVICE_INHERITING = exports.RIGHTS_ALL, exports.RIGHTS_CHARACTER_DEVICE_BASE = exports.RIGHTS_ALL, exports.RIGHTS_CHARACTER_DEVICE_INHERITING = exports.RIGHTS_ALL, exports.RIGHTS_REGULAR_FILE_BASE = exports.WASI_RIGHT_FD_DATASYNC | exports.WASI_RIGHT_FD_READ | exports.WASI_RIGHT_FD_SEEK | exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS | exports.WASI_RIGHT_FD_SYNC | exports.WASI_RIGHT_FD_TELL | exports.WASI_RIGHT_FD_WRITE | exports.WASI_RIGHT_FD_ADVISE | exports.WASI_RIGHT_FD_ALLOCATE | exports.WASI_RIGHT_FD_FILESTAT_GET | exports.WASI_RIGHT_FD_FILESTAT_SET_SIZE | exports.WASI_RIGHT_FD_FILESTAT_SET_TIMES | exports.WASI_RIGHT_POLL_FD_READWRITE, exports.RIGHTS_REGULAR_FILE_INHERITING = BigInt(0), exports.RIGHTS_DIRECTORY_BASE = exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS | exports.WASI_RIGHT_FD_SYNC | exports.WASI_RIGHT_FD_ADVISE | exports.WASI_RIGHT_PATH_CREATE_DIRECTORY | exports.WASI_RIGHT_PATH_CREATE_FILE | exports.WASI_RIGHT_PATH_LINK_SOURCE | exports.WASI_RIGHT_PATH_LINK_TARGET | exports.WASI_RIGHT_PATH_OPEN | exports.WASI_RIGHT_FD_READDIR | exports.WASI_RIGHT_PATH_READLINK | exports.WASI_RIGHT_PATH_RENAME_SOURCE | exports.WASI_RIGHT_PATH_RENAME_TARGET | exports.WASI_RIGHT_PATH_FILESTAT_GET | exports.WASI_RIGHT_PATH_FILESTAT_SET_SIZE | exports.WASI_RIGHT_PATH_FILESTAT_SET_TIMES | exports.WASI_RIGHT_FD_FILESTAT_GET | exports.WASI_RIGHT_FD_FILESTAT_SET_TIMES | exports.WASI_RIGHT_PATH_SYMLINK | exports.WASI_RIGHT_PATH_UNLINK_FILE | exports.WASI_RIGHT_PATH_REMOVE_DIRECTORY | exports.WASI_RIGHT_POLL_FD_READWRITE, exports.RIGHTS_DIRECTORY_INHERITING = exports.RIGHTS_DIRECTORY_BASE | exports.RIGHTS_REGULAR_FILE_BASE, exports.RIGHTS_SOCKET_BASE = exports.WASI_RIGHT_FD_READ | exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS | exports.WASI_RIGHT_FD_WRITE | exports.WASI_RIGHT_FD_FILESTAT_GET | exports.WASI_RIGHT_POLL_FD_READWRITE | exports.WASI_RIGHT_SOCK_SHUTDOWN, exports.RIGHTS_SOCKET_INHERITING = exports.RIGHTS_ALL, exports.RIGHTS_TTY_BASE = exports.WASI_RIGHT_FD_READ | exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS | exports.WASI_RIGHT_FD_WRITE | exports.WASI_RIGHT_FD_FILESTAT_GET | exports.WASI_RIGHT_POLL_FD_READWRITE, exports.RIGHTS_TTY_INHERITING = BigInt(0), exports.WASI_CLOCK_REALTIME = 0, exports.WASI_CLOCK_MONOTONIC = 1, exports.WASI_CLOCK_PROCESS_CPUTIME_ID = 2, exports.WASI_CLOCK_THREAD_CPUTIME_ID = 3, exports.WASI_EVENTTYPE_CLOCK = 0, exports.WASI_EVENTTYPE_FD_READ = 1, exports.WASI_EVENTTYPE_FD_WRITE = 2, exports.WASI_FILESTAT_SET_ATIM = 1 << 0, exports.WASI_FILESTAT_SET_ATIM_NOW = 1 << 1, exports.WASI_FILESTAT_SET_MTIM = 1 << 2, exports.WASI_FILESTAT_SET_MTIM_NOW = 1 << 3, exports.WASI_O_CREAT = 1 << 0, exports.WASI_O_DIRECTORY = 1 << 1, exports.WASI_O_EXCL = 1 << 2, exports.WASI_O_TRUNC = 1 << 3, exports.WASI_PREOPENTYPE_DIR = 0, exports.WASI_DIRCOOKIE_START = 0, exports.WASI_STDIN_FILENO = 0, exports.WASI_STDOUT_FILENO = 1, exports.WASI_STDERR_FILENO = 2, exports.WASI_WHENCE_SET = 0, exports.WASI_WHENCE_CUR = 1, exports.WASI_WHENCE_END = 2, exports.ERROR_MAP = {\n E2BIG: exports.WASI_E2BIG,\n EACCES: exports.WASI_EACCES,\n EADDRINUSE: exports.WASI_EADDRINUSE,\n EADDRNOTAVAIL: exports.WASI_EADDRNOTAVAIL,\n EAFNOSUPPORT: exports.WASI_EAFNOSUPPORT,\n EALREADY: exports.WASI_EALREADY,\n EAGAIN: exports.WASI_EAGAIN,\n EBADF: exports.WASI_EBADF,\n EBADMSG: exports.WASI_EBADMSG,\n EBUSY: exports.WASI_EBUSY,\n ECANCELED: exports.WASI_ECANCELED,\n ECHILD: exports.WASI_ECHILD,\n ECONNABORTED: exports.WASI_ECONNABORTED,\n ECONNREFUSED: exports.WASI_ECONNREFUSED,\n ECONNRESET: exports.WASI_ECONNRESET,\n EDEADLOCK: exports.WASI_EDEADLK,\n EDESTADDRREQ: exports.WASI_EDESTADDRREQ,\n EDOM: exports.WASI_EDOM,\n EDQUOT: exports.WASI_EDQUOT,\n EEXIST: exports.WASI_EEXIST,\n EFAULT: exports.WASI_EFAULT,\n EFBIG: exports.WASI_EFBIG,\n EHOSTDOWN: exports.WASI_EHOSTUNREACH,\n EHOSTUNREACH: exports.WASI_EHOSTUNREACH,\n EIDRM: exports.WASI_EIDRM,\n EILSEQ: exports.WASI_EILSEQ,\n EINPROGRESS: exports.WASI_EINPROGRESS,\n EINTR: exports.WASI_EINTR,\n EINVAL: exports.WASI_EINVAL,\n EIO: exports.WASI_EIO,\n EISCONN: exports.WASI_EISCONN,\n EISDIR: exports.WASI_EISDIR,\n ELOOP: exports.WASI_ELOOP,\n EMFILE: exports.WASI_EMFILE,\n EMLINK: exports.WASI_EMLINK,\n EMSGSIZE: exports.WASI_EMSGSIZE,\n EMULTIHOP: exports.WASI_EMULTIHOP,\n ENAMETOOLONG: exports.WASI_ENAMETOOLONG,\n ENETDOWN: exports.WASI_ENETDOWN,\n ENETRESET: exports.WASI_ENETRESET,\n ENETUNREACH: exports.WASI_ENETUNREACH,\n ENFILE: exports.WASI_ENFILE,\n ENOBUFS: exports.WASI_ENOBUFS,\n ENODEV: exports.WASI_ENODEV,\n ENOENT: exports.WASI_ENOENT,\n ENOEXEC: exports.WASI_ENOEXEC,\n ENOLCK: exports.WASI_ENOLCK,\n ENOLINK: exports.WASI_ENOLINK,\n ENOMEM: exports.WASI_ENOMEM,\n ENOMSG: exports.WASI_ENOMSG,\n ENOPROTOOPT: exports.WASI_ENOPROTOOPT,\n ENOSPC: exports.WASI_ENOSPC,\n ENOSYS: exports.WASI_ENOSYS,\n ENOTCONN: exports.WASI_ENOTCONN,\n ENOTDIR: exports.WASI_ENOTDIR,\n ENOTEMPTY: exports.WASI_ENOTEMPTY,\n ENOTRECOVERABLE: exports.WASI_ENOTRECOVERABLE,\n ENOTSOCK: exports.WASI_ENOTSOCK,\n ENOTTY: exports.WASI_ENOTTY,\n ENXIO: exports.WASI_ENXIO,\n EOVERFLOW: exports.WASI_EOVERFLOW,\n EOWNERDEAD: exports.WASI_EOWNERDEAD,\n EPERM: exports.WASI_EPERM,\n EPIPE: exports.WASI_EPIPE,\n EPROTO: exports.WASI_EPROTO,\n EPROTONOSUPPORT: exports.WASI_EPROTONOSUPPORT,\n EPROTOTYPE: exports.WASI_EPROTOTYPE,\n ERANGE: exports.WASI_ERANGE,\n EROFS: exports.WASI_EROFS,\n ESPIPE: exports.WASI_ESPIPE,\n ESRCH: exports.WASI_ESRCH,\n ESTALE: exports.WASI_ESTALE,\n ETIMEDOUT: exports.WASI_ETIMEDOUT,\n ETXTBSY: exports.WASI_ETXTBSY,\n EXDEV: exports.WASI_EXDEV\n }, exports.SIGNAL_MAP = {\n [exports.WASI_SIGHUP]: \"SIGHUP\",\n [exports.WASI_SIGINT]: \"SIGINT\",\n [exports.WASI_SIGQUIT]: \"SIGQUIT\",\n [exports.WASI_SIGILL]: \"SIGILL\",\n [exports.WASI_SIGTRAP]: \"SIGTRAP\",\n [exports.WASI_SIGABRT]: \"SIGABRT\",\n [exports.WASI_SIGBUS]: \"SIGBUS\",\n [exports.WASI_SIGFPE]: \"SIGFPE\",\n [exports.WASI_SIGKILL]: \"SIGKILL\",\n [exports.WASI_SIGUSR1]: \"SIGUSR1\",\n [exports.WASI_SIGSEGV]: \"SIGSEGV\",\n [exports.WASI_SIGUSR2]: \"SIGUSR2\",\n [exports.WASI_SIGPIPE]: \"SIGPIPE\",\n [exports.WASI_SIGALRM]: \"SIGALRM\",\n [exports.WASI_SIGTERM]: \"SIGTERM\",\n [exports.WASI_SIGCHLD]: \"SIGCHLD\",\n [exports.WASI_SIGCONT]: \"SIGCONT\",\n [exports.WASI_SIGSTOP]: \"SIGSTOP\",\n [exports.WASI_SIGTSTP]: \"SIGTSTP\",\n [exports.WASI_SIGTTIN]: \"SIGTTIN\",\n [exports.WASI_SIGTTOU]: \"SIGTTOU\",\n [exports.WASI_SIGURG]: \"SIGURG\",\n [exports.WASI_SIGXCPU]: \"SIGXCPU\",\n [exports.WASI_SIGXFSZ]: \"SIGXFSZ\",\n [exports.WASI_SIGVTALRM]: \"SIGVTALRM\"\n };\n }\n}), require_wasi = __commonJS({\n \"node_modules/wasi-js/dist/wasi.js\"(exports) {\n var __importDefault = exports && exports.__importDefault || function(mod) {\n return mod && mod.__esModule \? mod : { default: mod };\n };\n let fs;\n Object.defineProperty(exports, \"__esModule\", { value: !0 }), exports.SOCKET_DEFAULT_RIGHTS = void 0;\n var log = () => {\n }, logOpen = () => {\n }, SC_OPEN_MAX = 32768, types_1 = require_types(), constants_1 = require_constants(), STDIN_DEFAULT_RIGHTS = constants_1.WASI_RIGHT_FD_DATASYNC | constants_1.WASI_RIGHT_FD_READ | constants_1.WASI_RIGHT_FD_SYNC | constants_1.WASI_RIGHT_FD_ADVISE | constants_1.WASI_RIGHT_FD_FILESTAT_GET | constants_1.WASI_RIGHT_POLL_FD_READWRITE, STDOUT_DEFAULT_RIGHTS = constants_1.WASI_RIGHT_FD_DATASYNC | constants_1.WASI_RIGHT_FD_WRITE | constants_1.WASI_RIGHT_FD_SYNC | constants_1.WASI_RIGHT_FD_ADVISE | constants_1.WASI_RIGHT_FD_FILESTAT_GET | constants_1.WASI_RIGHT_POLL_FD_READWRITE, STDERR_DEFAULT_RIGHTS = STDOUT_DEFAULT_RIGHTS;\n exports.SOCKET_DEFAULT_RIGHTS = constants_1.WASI_RIGHT_FD_DATASYNC | constants_1.WASI_RIGHT_FD_READ | constants_1.WASI_RIGHT_FD_WRITE | constants_1.WASI_RIGHT_FD_ADVISE | constants_1.WASI_RIGHT_FD_FILESTAT_GET | constants_1.WASI_RIGHT_POLL_FD_READWRITE | constants_1.WASI_RIGHT_FD_FDSTAT_SET_FLAGS;\n var msToNs = (ms) => {\n const msInt = Math.trunc(ms), decimal = BigInt(Math.round((ms - msInt) * 1e6));\n return BigInt(msInt) * BigInt(1e6) + decimal;\n }, nsToMs = (ns) => {\n if (typeof ns === \"number\")\n ns = Math.trunc(ns);\n const nsInt = BigInt(ns);\n return Number(nsInt / BigInt(1e6));\n }, wrap = (f) => (...args) => {\n try {\n return f(...args);\n } catch (err) {\n let e = err;\n while (e.prev != null)\n e = e.prev;\n if (e\?.code && typeof e\?.code === \"string\")\n return constants_1.ERROR_MAP[e.code] || constants_1.WASI_EINVAL;\n if (e instanceof types_1.WASIError)\n return e.errno;\n throw e;\n }\n }, stat = (wasi, fd) => {\n const entry = wasi.FD_MAP.get(fd);\n if (!entry)\n throw new types_1.WASIError(constants_1.WASI_EBADF);\n if (entry.filetype === void 0) {\n const stats = wasi.fstatSync(entry.real), { filetype, rightsBase, rightsInheriting } = translateFileAttributes(wasi, fd, stats);\n if (entry.filetype = filetype, !entry.rights)\n entry.rights = {\n base: rightsBase,\n inheriting: rightsInheriting\n };\n }\n return entry;\n }, translateFileAttributes = (wasi, fd, stats) => {\n switch (!0) {\n case stats.isBlockDevice():\n return {\n filetype: constants_1.WASI_FILETYPE_BLOCK_DEVICE,\n rightsBase: constants_1.RIGHTS_BLOCK_DEVICE_BASE,\n rightsInheriting: constants_1.RIGHTS_BLOCK_DEVICE_INHERITING\n };\n case stats.isCharacterDevice(): {\n const filetype = constants_1.WASI_FILETYPE_CHARACTER_DEVICE;\n if (fd !== void 0 && wasi.bindings.isTTY(fd))\n return {\n filetype,\n rightsBase: constants_1.RIGHTS_TTY_BASE,\n rightsInheriting: constants_1.RIGHTS_TTY_INHERITING\n };\n return {\n filetype,\n rightsBase: constants_1.RIGHTS_CHARACTER_DEVICE_BASE,\n rightsInheriting: constants_1.RIGHTS_CHARACTER_DEVICE_INHERITING\n };\n }\n case stats.isDirectory():\n return {\n filetype: constants_1.WASI_FILETYPE_DIRECTORY,\n rightsBase: constants_1.RIGHTS_DIRECTORY_BASE,\n rightsInheriting: constants_1.RIGHTS_DIRECTORY_INHERITING\n };\n case stats.isFIFO():\n return {\n filetype: constants_1.WASI_FILETYPE_SOCKET_STREAM,\n rightsBase: constants_1.RIGHTS_SOCKET_BASE,\n rightsInheriting: constants_1.RIGHTS_SOCKET_INHERITING\n };\n case stats.isFile():\n return {\n filetype: constants_1.WASI_FILETYPE_REGULAR_FILE,\n rightsBase: constants_1.RIGHTS_REGULAR_FILE_BASE,\n rightsInheriting: constants_1.RIGHTS_REGULAR_FILE_INHERITING\n };\n case stats.isSocket():\n return {\n filetype: constants_1.WASI_FILETYPE_SOCKET_STREAM,\n rightsBase: constants_1.RIGHTS_SOCKET_BASE,\n rightsInheriting: constants_1.RIGHTS_SOCKET_INHERITING\n };\n case stats.isSymbolicLink():\n return {\n filetype: constants_1.WASI_FILETYPE_SYMBOLIC_LINK,\n rightsBase: BigInt(0),\n rightsInheriting: BigInt(0)\n };\n default:\n return {\n filetype: constants_1.WASI_FILETYPE_UNKNOWN,\n rightsBase: BigInt(0),\n rightsInheriting: BigInt(0)\n };\n }\n }, warnedAboutSleep = !1, defaultConfig;\n function getDefaults() {\n if (defaultConfig)\n return defaultConfig;\n const defaultBindings = {\n hrtime: () => process.hrtime.bigint(),\n exit: (code) => {\n process.exit(code);\n },\n kill: (signal) => {\n process.kill(process.pid, signal);\n },\n randomFillSync: (array) => crypto.getRandomValues(array),\n isTTY: (fd) => (@getInternalField(@internalModuleRegistry, 46) || @createInternalModuleById(46)).isatty(fd),\n fs: Bun.fs(),\n path: @getInternalField(@internalModuleRegistry, 30) || @createInternalModuleById(30)\n };\n return defaultConfig = {\n args: [],\n env: {},\n preopens: {},\n bindings: defaultBindings,\n sleep: (ms) => {\n Bun.sleepSync(ms);\n }\n };\n }\n var WASI = class WASI2 {\n constructor(wasiConfig = {}) {\n const defaultConfig2 = getDefaults();\n this.lastStdin = 0, this.sleep = wasiConfig.sleep || defaultConfig2.sleep, this.getStdin = wasiConfig.getStdin, this.sendStdout = wasiConfig.sendStdout, this.sendStderr = wasiConfig.sendStderr;\n let preopens = wasiConfig.preopens \?\? defaultConfig2.preopens;\n this.env = wasiConfig.env \?\? defaultConfig2.env;\n const args = wasiConfig.args \?\? defaultConfig2.args;\n this.memory = void 0, this.view = void 0, this.bindings = wasiConfig.bindings || defaultConfig2.bindings;\n const bindings2 = this.bindings;\n fs = bindings2.fs, this.FD_MAP = new Map([\n [\n constants_1.WASI_STDIN_FILENO,\n {\n real: 0,\n filetype: constants_1.WASI_FILETYPE_CHARACTER_DEVICE,\n rights: {\n base: STDIN_DEFAULT_RIGHTS,\n inheriting: BigInt(0)\n },\n path: \"/dev/stdin\"\n }\n ],\n [\n constants_1.WASI_STDOUT_FILENO,\n {\n real: 1,\n filetype: constants_1.WASI_FILETYPE_CHARACTER_DEVICE,\n rights: {\n base: STDOUT_DEFAULT_RIGHTS,\n inheriting: BigInt(0)\n },\n path: \"/dev/stdout\"\n }\n ],\n [\n constants_1.WASI_STDERR_FILENO,\n {\n real: 2,\n filetype: constants_1.WASI_FILETYPE_CHARACTER_DEVICE,\n rights: {\n base: STDERR_DEFAULT_RIGHTS,\n inheriting: BigInt(0)\n },\n path: \"/dev/stderr\"\n }\n ]\n ]);\n const path = bindings2.path;\n for (let [k, v] of Object.entries(preopens)) {\n const real = fs.openSync(v, nodeFsConstants.O_RDONLY), newfd = this.getUnusedFileDescriptor();\n this.FD_MAP.set(newfd, {\n real,\n filetype: constants_1.WASI_FILETYPE_DIRECTORY,\n rights: {\n base: constants_1.RIGHTS_DIRECTORY_BASE,\n inheriting: constants_1.RIGHTS_DIRECTORY_INHERITING\n },\n fakePath: k,\n path: v\n });\n }\n const getiovs = (iovs, iovsLen) => {\n this.refreshMemory();\n const { view, memory } = this, { buffer } = memory, { byteLength } = buffer;\n if (iovsLen === 1) {\n const ptr = iovs, buf = view.getUint32(ptr, !0);\n let bufLen = view.getUint32(ptr + 4, !0);\n if (bufLen > byteLength - buf)\n console.log({\n buf,\n bufLen,\n total_memory: byteLength\n }), log(\"getiovs: warning -- truncating buffer to fit in memory\"), bufLen = Math.min(bufLen, Math.max(0, byteLength - buf));\n try {\n return [new @Uint8Array(buffer, buf, bufLen)];\n } catch (err) {\n throw console.warn(\"WASI.getiovs -- invalid buffer\", err), new types_1.WASIError(constants_1.WASI_EINVAL);\n }\n }\n const buffers = [];\n buffers.length = iovsLen;\n for (let i = 0, ptr = iovs;i < iovsLen; i++, ptr += 8) {\n const buf = view.getUint32(ptr, !0);\n let bufLen = view.getUint32(ptr + 4, !0);\n if (bufLen > byteLength - buf)\n console.log({\n buf,\n bufLen,\n total_memory: byteLength\n }), log(\"getiovs: warning -- truncating buffer to fit in memory\"), bufLen = Math.min(bufLen, Math.max(0, byteLength - buf));\n try {\n buffers[i] = new @Uint8Array(buffer, buf, bufLen);\n } catch (err) {\n throw console.warn(\"WASI.getiovs -- invalid buffer\", err), new types_1.WASIError(constants_1.WASI_EINVAL);\n }\n }\n return buffers;\n }, CHECK_FD = (fd, rights) => {\n const stats = stat(this, fd);\n if (rights !== BigInt(0) && (stats.rights.base & rights) === BigInt(0))\n throw new types_1.WASIError(constants_1.WASI_EPERM);\n return stats;\n }, CPUTIME_START = Bun.nanoseconds(), timeOrigin = Math.trunc(performance.timeOrigin * 1e6), now = (clockId) => {\n switch (clockId) {\n case constants_1.WASI_CLOCK_MONOTONIC:\n return Bun.nanoseconds();\n case constants_1.WASI_CLOCK_REALTIME:\n return Bun.nanoseconds() + timeOrigin;\n case constants_1.WASI_CLOCK_PROCESS_CPUTIME_ID:\n case constants_1.WASI_CLOCK_THREAD_CPUTIME_ID:\n return Bun.nanoseconds() - CPUTIME_START;\n default:\n return null;\n }\n };\n if (this.wasiImport = {\n args_get: (argv, argvBuf) => {\n this.refreshMemory();\n let coffset = argv, offset = argvBuf;\n return args.forEach((a) => {\n this.view.setUint32(coffset, offset, !0), coffset += 4, offset += @Buffer.from(this.memory.buffer).write(`${a}\\0`, offset);\n }), constants_1.WASI_ESUCCESS;\n },\n args_sizes_get: (argc, argvBufSize) => {\n this.refreshMemory(), this.view.setUint32(argc, args.length, !0);\n const size = args.reduce((acc, a) => acc + @Buffer.byteLength(a) + 1, 0);\n return this.view.setUint32(argvBufSize, size, !0), constants_1.WASI_ESUCCESS;\n },\n environ_get: (environ, environBuf) => {\n this.refreshMemory();\n let coffset = environ, offset = environBuf;\n return Object.entries(this.env).forEach(([key, value]) => {\n this.view.setUint32(coffset, offset, !0), coffset += 4, offset += @Buffer.from(this.memory.buffer).write(`${key}=${value}\\0`, offset);\n }), constants_1.WASI_ESUCCESS;\n },\n environ_sizes_get: (environCount, environBufSize) => {\n this.refreshMemory();\n const envProcessed = Object.entries(this.env).map(([key, value]) => `${key}=${value}\\0`), size = envProcessed.reduce((acc, e) => acc + @Buffer.byteLength(e), 0);\n return this.view.setUint32(environCount, envProcessed.length, !0), this.view.setUint32(environBufSize, size, !0), constants_1.WASI_ESUCCESS;\n },\n clock_res_get: (clockId, resolution) => {\n let res;\n switch (clockId) {\n case constants_1.WASI_CLOCK_MONOTONIC:\n case constants_1.WASI_CLOCK_PROCESS_CPUTIME_ID:\n case constants_1.WASI_CLOCK_THREAD_CPUTIME_ID: {\n res = BigInt(1);\n break;\n }\n case constants_1.WASI_CLOCK_REALTIME: {\n res = BigInt(1000);\n break;\n }\n }\n if (!res)\n throw Error(\"invalid clockId\");\n return this.view.setBigUint64(resolution, res), constants_1.WASI_ESUCCESS;\n },\n clock_time_get: (clockId, _precision, time) => {\n this.refreshMemory();\n const n = now(clockId);\n if (n === null)\n return constants_1.WASI_EINVAL;\n return this.view.setBigUint64(time, BigInt(n), !0), constants_1.WASI_ESUCCESS;\n },\n fd_advise: wrap((fd, _offset, _len, _advice) => {\n return CHECK_FD(fd, constants_1.WASI_RIGHT_FD_ADVISE), constants_1.WASI_ENOSYS;\n }),\n fd_allocate: wrap((fd, _offset, _len) => {\n return CHECK_FD(fd, constants_1.WASI_RIGHT_FD_ALLOCATE), constants_1.WASI_ENOSYS;\n }),\n fd_close: wrap((fd) => {\n const stats = CHECK_FD(fd, BigInt(0));\n return fs.closeSync(stats.real), this.FD_MAP.delete(fd), constants_1.WASI_ESUCCESS;\n }),\n fd_datasync: wrap((fd) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_DATASYNC);\n return fs.fdatasyncSync(stats.real), constants_1.WASI_ESUCCESS;\n }),\n fd_fdstat_get: wrap((fd, bufPtr) => {\n const stats = CHECK_FD(fd, BigInt(0));\n if (this.refreshMemory(), stats.filetype == null)\n throw Error(\"stats.filetype must be set\");\n return this.view.setUint8(bufPtr, stats.filetype), this.view.setUint16(bufPtr + 2, 0, !0), this.view.setUint16(bufPtr + 4, 0, !0), this.view.setBigUint64(bufPtr + 8, BigInt(stats.rights.base), !0), this.view.setBigUint64(bufPtr + 8 + 8, BigInt(stats.rights.inheriting), !0), constants_1.WASI_ESUCCESS;\n }),\n fd_fdstat_set_flags: wrap((fd, flags) => {\n if (CHECK_FD(fd, constants_1.WASI_RIGHT_FD_FDSTAT_SET_FLAGS), this.wasiImport.sock_fcntlSetFlags(fd, flags) == 0)\n return constants_1.WASI_ESUCCESS;\n return constants_1.WASI_ENOSYS;\n }),\n fd_fdstat_set_rights: wrap((fd, fsRightsBase, fsRightsInheriting) => {\n const stats = CHECK_FD(fd, BigInt(0));\n if ((stats.rights.base | fsRightsBase) > stats.rights.base)\n return constants_1.WASI_EPERM;\n if ((stats.rights.inheriting | fsRightsInheriting) > stats.rights.inheriting)\n return constants_1.WASI_EPERM;\n return stats.rights.base = fsRightsBase, stats.rights.inheriting = fsRightsInheriting, constants_1.WASI_ESUCCESS;\n }),\n fd_filestat_get: wrap((fd, bufPtr) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_FILESTAT_GET), rstats = this.fstatSync(stats.real);\n if (this.refreshMemory(), this.view.setBigUint64(bufPtr, BigInt(rstats.dev), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, BigInt(rstats.ino), !0), bufPtr += 8, stats.filetype == null)\n throw Error(\"stats.filetype must be set\");\n return this.view.setUint8(bufPtr, stats.filetype), bufPtr += 8, this.view.setBigUint64(bufPtr, BigInt(rstats.nlink), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, BigInt(rstats.size), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, msToNs(rstats.atimeMs), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, msToNs(rstats.mtimeMs), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, msToNs(rstats.ctimeMs), !0), constants_1.WASI_ESUCCESS;\n }),\n fd_filestat_set_size: wrap((fd, stSize) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_FILESTAT_SET_SIZE);\n return fs.ftruncateSync(stats.real, Number(stSize)), constants_1.WASI_ESUCCESS;\n }),\n fd_filestat_set_times: wrap((fd, stAtim, stMtim, fstflags) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_FILESTAT_SET_TIMES), rstats = this.fstatSync(stats.real);\n let { atime: atim, mtime: mtim } = rstats;\n const n = nsToMs(now(constants_1.WASI_CLOCK_REALTIME)), atimflags = constants_1.WASI_FILESTAT_SET_ATIM | constants_1.WASI_FILESTAT_SET_ATIM_NOW;\n if ((fstflags & atimflags) === atimflags)\n return constants_1.WASI_EINVAL;\n const mtimflags = constants_1.WASI_FILESTAT_SET_MTIM | constants_1.WASI_FILESTAT_SET_MTIM_NOW;\n if ((fstflags & mtimflags) === mtimflags)\n return constants_1.WASI_EINVAL;\n if ((fstflags & constants_1.WASI_FILESTAT_SET_ATIM) === constants_1.WASI_FILESTAT_SET_ATIM)\n atim = nsToMs(stAtim);\n else if ((fstflags & constants_1.WASI_FILESTAT_SET_ATIM_NOW) === constants_1.WASI_FILESTAT_SET_ATIM_NOW)\n atim = n;\n if ((fstflags & constants_1.WASI_FILESTAT_SET_MTIM) === constants_1.WASI_FILESTAT_SET_MTIM)\n mtim = nsToMs(stMtim);\n else if ((fstflags & constants_1.WASI_FILESTAT_SET_MTIM_NOW) === constants_1.WASI_FILESTAT_SET_MTIM_NOW)\n mtim = n;\n return fs.futimesSync(stats.real, new Date(atim), new Date(mtim)), constants_1.WASI_ESUCCESS;\n }),\n fd_prestat_get: wrap((fd, bufPtr) => {\n const stats = CHECK_FD(fd, BigInt(0));\n return this.refreshMemory(), this.view.setUint8(bufPtr, constants_1.WASI_PREOPENTYPE_DIR), this.view.setUint32(bufPtr + 4, @Buffer.byteLength(stats.fakePath \?\? stats.path \?\? \"\"), !0), constants_1.WASI_ESUCCESS;\n }),\n fd_prestat_dir_name: wrap((fd, pathPtr, pathLen) => {\n const stats = CHECK_FD(fd, BigInt(0));\n return this.refreshMemory(), @Buffer.from(this.memory.buffer).write(stats.fakePath \?\? stats.path \?\? \"\", pathPtr, pathLen, \"utf8\"), constants_1.WASI_ESUCCESS;\n }),\n fd_pwrite: wrap((fd, iovs, iovsLen, offset, nwritten) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_WRITE | constants_1.WASI_RIGHT_FD_SEEK);\n let written = 0;\n return getiovs(iovs, iovsLen).forEach((iov) => {\n let w = 0;\n while (w < iov.byteLength)\n w += fs.writeSync(stats.real, iov, w, iov.byteLength - w, Number(offset) + written + w);\n written += w;\n }), this.view.setUint32(nwritten, written, !0), constants_1.WASI_ESUCCESS;\n }),\n fd_write: wrap((fd, iovs, iovsLen, nwritten) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_WRITE), IS_STDOUT = fd == constants_1.WASI_STDOUT_FILENO, IS_STDERR = fd == constants_1.WASI_STDERR_FILENO;\n let written = 0;\n return getiovs(iovs, iovsLen).forEach((iov) => {\n if (iov.byteLength == 0)\n return;\n if (IS_STDOUT && this.sendStdout != null)\n this.sendStdout(iov), written += iov.byteLength;\n else if (IS_STDERR && this.sendStderr != null)\n this.sendStderr(iov), written += iov.byteLength;\n else {\n let w = 0;\n while (w < iov.byteLength) {\n const i = fs.writeSync(stats.real, iov, w, iov.byteLength - w, stats.offset \? Number(stats.offset) : null);\n if (stats.offset)\n stats.offset += BigInt(i);\n w += i;\n }\n written += w;\n }\n }), this.view.setUint32(nwritten, written, !0), constants_1.WASI_ESUCCESS;\n }),\n fd_pread: wrap((fd, iovs, iovsLen, offset, nread) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_READ | constants_1.WASI_RIGHT_FD_SEEK);\n let read = 0;\n outer:\n for (let iov of getiovs(iovs, iovsLen)) {\n let r = 0;\n while (r < iov.byteLength) {\n const length = iov.byteLength - r, rr = fs.readSync(stats.real, iov, r, iov.byteLength - r, Number(offset) + read + r);\n if (r += rr, read += rr, rr === 0 || rr < length)\n break outer;\n }\n read += r;\n }\n return this.view.setUint32(nread, read, !0), constants_1.WASI_ESUCCESS;\n }),\n fd_read: wrap((fd, iovs, iovsLen, nread) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_READ), IS_STDIN = fd == constants_1.WASI_STDIN_FILENO;\n let read = 0;\n outer:\n for (let iov of getiovs(iovs, iovsLen)) {\n let r = 0;\n while (r < iov.byteLength) {\n let length = iov.byteLength - r, position = IS_STDIN || stats.offset === void 0 \? null : Number(stats.offset), rr = 0;\n if (IS_STDIN)\n if (this.getStdin != null) {\n if (this.stdinBuffer == null)\n this.stdinBuffer = this.getStdin();\n if (this.stdinBuffer != null) {\n if (rr = this.stdinBuffer.copy(iov), rr == this.stdinBuffer.length)\n this.stdinBuffer = void 0;\n else\n this.stdinBuffer = this.stdinBuffer.slice(rr);\n if (rr > 0)\n this.lastStdin = (new Date()).valueOf();\n }\n } else {\n if (this.sleep == null && !warnedAboutSleep)\n warnedAboutSleep = !0, console.log(\"(cpu waiting for stdin: please define a way to sleep!) \");\n try {\n rr = fs.readSync(stats.real, iov, r, length, position);\n } catch (_err) {\n }\n if (rr == 0)\n this.shortPause();\n else\n this.lastStdin = (new Date()).valueOf();\n }\n else\n rr = fs.readSync(stats.real, iov, r, length, position);\n if (stats.filetype == constants_1.WASI_FILETYPE_REGULAR_FILE)\n stats.offset = (stats.offset \? stats.offset : BigInt(0)) + BigInt(rr);\n if (r += rr, read += rr, rr === 0 || rr < length)\n break outer;\n }\n }\n return this.view.setUint32(nread, read, !0), constants_1.WASI_ESUCCESS;\n }),\n fd_readdir: wrap((fd, bufPtr, bufLen, cookie, bufusedPtr) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_READDIR);\n this.refreshMemory();\n const entries = fs.readdirSync(stats.path, { withFileTypes: !0 }), startPtr = bufPtr;\n for (let i = Number(cookie);i < entries.length; i += 1) {\n const entry = entries[i];\n let nameLength = @Buffer.byteLength(entry.name);\n if (bufPtr - startPtr > bufLen)\n break;\n if (this.view.setBigUint64(bufPtr, BigInt(i + 1), !0), bufPtr += 8, bufPtr - startPtr > bufLen)\n break;\n const rstats = fs.lstatSync(path.resolve(stats.path, entry.name));\n if (this.view.setBigUint64(bufPtr, BigInt(rstats.ino), !0), bufPtr += 8, bufPtr - startPtr > bufLen)\n break;\n if (this.view.setUint32(bufPtr, nameLength, !0), bufPtr += 4, bufPtr - startPtr > bufLen)\n break;\n let filetype;\n switch (!0) {\n case rstats.isBlockDevice():\n filetype = constants_1.WASI_FILETYPE_BLOCK_DEVICE;\n break;\n case rstats.isCharacterDevice():\n filetype = constants_1.WASI_FILETYPE_CHARACTER_DEVICE;\n break;\n case rstats.isDirectory():\n filetype = constants_1.WASI_FILETYPE_DIRECTORY;\n break;\n case rstats.isFIFO():\n filetype = constants_1.WASI_FILETYPE_SOCKET_STREAM;\n break;\n case rstats.isFile():\n filetype = constants_1.WASI_FILETYPE_REGULAR_FILE;\n break;\n case rstats.isSocket():\n filetype = constants_1.WASI_FILETYPE_SOCKET_STREAM;\n break;\n case rstats.isSymbolicLink():\n filetype = constants_1.WASI_FILETYPE_SYMBOLIC_LINK;\n break;\n default:\n filetype = constants_1.WASI_FILETYPE_UNKNOWN;\n break;\n }\n if (this.view.setUint8(bufPtr, filetype), bufPtr += 1, bufPtr += 3, bufPtr + nameLength >= startPtr + bufLen)\n break;\n @Buffer.from(this.memory.buffer).write(entry.name, bufPtr), bufPtr += nameLength;\n }\n const bufused = bufPtr - startPtr;\n return this.view.setUint32(bufusedPtr, Math.min(bufused, bufLen), !0), constants_1.WASI_ESUCCESS;\n }),\n fd_renumber: wrap((from, to) => {\n return CHECK_FD(from, BigInt(0)), CHECK_FD(to, BigInt(0)), fs.closeSync(this.FD_MAP.get(from).real), this.FD_MAP.set(from, this.FD_MAP.get(to)), this.FD_MAP.delete(to), constants_1.WASI_ESUCCESS;\n }),\n fd_seek: wrap((fd, offset, whence, newOffsetPtr) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_SEEK);\n switch (this.refreshMemory(), whence) {\n case constants_1.WASI_WHENCE_CUR:\n stats.offset = (stats.offset \? stats.offset : BigInt(0)) + BigInt(offset);\n break;\n case constants_1.WASI_WHENCE_END:\n const { size } = this.fstatSync(stats.real);\n stats.offset = BigInt(size) + BigInt(offset);\n break;\n case constants_1.WASI_WHENCE_SET:\n stats.offset = BigInt(offset);\n break;\n }\n if (stats.offset == null)\n throw Error(\"stats.offset must be defined\");\n return this.view.setBigUint64(newOffsetPtr, stats.offset, !0), constants_1.WASI_ESUCCESS;\n }),\n fd_tell: wrap((fd, offsetPtr) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_TELL);\n if (this.refreshMemory(), !stats.offset)\n stats.offset = BigInt(0);\n return this.view.setBigUint64(offsetPtr, stats.offset, !0), constants_1.WASI_ESUCCESS;\n }),\n fd_sync: wrap((fd) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_SYNC);\n return fs.fsyncSync(stats.real), constants_1.WASI_ESUCCESS;\n }),\n path_create_directory: wrap((fd, pathPtr, pathLen) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_CREATE_DIRECTORY);\n if (!stats.path)\n return constants_1.WASI_EINVAL;\n this.refreshMemory();\n const p = @Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n return fs.mkdirSync(path.resolve(stats.path, p)), constants_1.WASI_ESUCCESS;\n }),\n path_filestat_get: wrap((fd, flags, pathPtr, pathLen, bufPtr) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_FILESTAT_GET);\n if (!stats.path)\n return constants_1.WASI_EINVAL;\n this.refreshMemory();\n const p = @Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n let rstats;\n if (flags)\n rstats = fs.statSync(path.resolve(stats.path, p));\n else\n rstats = fs.lstatSync(path.resolve(stats.path, p));\n return this.view.setBigUint64(bufPtr, BigInt(rstats.dev), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, BigInt(rstats.ino), !0), bufPtr += 8, this.view.setUint8(bufPtr, translateFileAttributes(this, void 0, rstats).filetype), bufPtr += 8, this.view.setBigUint64(bufPtr, BigInt(rstats.nlink), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, BigInt(rstats.size), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, BigInt(rstats.atime.getTime() * 1e6), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, BigInt(rstats.mtime.getTime() * 1e6), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, BigInt(rstats.ctime.getTime() * 1e6), !0), constants_1.WASI_ESUCCESS;\n }),\n path_filestat_set_times: wrap((fd, _dirflags, pathPtr, pathLen, stAtim, stMtim, fstflags) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_FILESTAT_SET_TIMES);\n if (!stats.path)\n return constants_1.WASI_EINVAL;\n this.refreshMemory();\n const rstats = this.fstatSync(stats.real);\n let { atime: atim, mtime: mtim } = rstats;\n const n = nsToMs(now(constants_1.WASI_CLOCK_REALTIME)), atimflags = constants_1.WASI_FILESTAT_SET_ATIM | constants_1.WASI_FILESTAT_SET_ATIM_NOW;\n if ((fstflags & atimflags) === atimflags)\n return constants_1.WASI_EINVAL;\n const mtimflags = constants_1.WASI_FILESTAT_SET_MTIM | constants_1.WASI_FILESTAT_SET_MTIM_NOW;\n if ((fstflags & mtimflags) === mtimflags)\n return constants_1.WASI_EINVAL;\n if ((fstflags & constants_1.WASI_FILESTAT_SET_ATIM) === constants_1.WASI_FILESTAT_SET_ATIM)\n atim = nsToMs(stAtim);\n else if ((fstflags & constants_1.WASI_FILESTAT_SET_ATIM_NOW) === constants_1.WASI_FILESTAT_SET_ATIM_NOW)\n atim = n;\n if ((fstflags & constants_1.WASI_FILESTAT_SET_MTIM) === constants_1.WASI_FILESTAT_SET_MTIM)\n mtim = nsToMs(stMtim);\n else if ((fstflags & constants_1.WASI_FILESTAT_SET_MTIM_NOW) === constants_1.WASI_FILESTAT_SET_MTIM_NOW)\n mtim = n;\n const p = @Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n return fs.utimesSync(path.resolve(stats.path, p), new Date(atim), new Date(mtim)), constants_1.WASI_ESUCCESS;\n }),\n path_link: wrap((oldFd, _oldFlags, oldPath, oldPathLen, newFd, newPath, newPathLen) => {\n const ostats = CHECK_FD(oldFd, constants_1.WASI_RIGHT_PATH_LINK_SOURCE), nstats = CHECK_FD(newFd, constants_1.WASI_RIGHT_PATH_LINK_TARGET);\n if (!ostats.path || !nstats.path)\n return constants_1.WASI_EINVAL;\n this.refreshMemory();\n const op = @Buffer.from(this.memory.buffer, oldPath, oldPathLen).toString(), np = @Buffer.from(this.memory.buffer, newPath, newPathLen).toString();\n return fs.linkSync(path.resolve(ostats.path, op), path.resolve(nstats.path, np)), constants_1.WASI_ESUCCESS;\n }),\n path_open: wrap((dirfd, _dirflags, pathPtr, pathLen, oflags, fsRightsBase, fsRightsInheriting, fsFlags, fdPtr) => {\n try {\n const stats = CHECK_FD(dirfd, constants_1.WASI_RIGHT_PATH_OPEN);\n fsRightsBase = BigInt(fsRightsBase), fsRightsInheriting = BigInt(fsRightsInheriting);\n const read = (fsRightsBase & (constants_1.WASI_RIGHT_FD_READ | constants_1.WASI_RIGHT_FD_READDIR)) !== BigInt(0), write = (fsRightsBase & (constants_1.WASI_RIGHT_FD_DATASYNC | constants_1.WASI_RIGHT_FD_WRITE | constants_1.WASI_RIGHT_FD_ALLOCATE | constants_1.WASI_RIGHT_FD_FILESTAT_SET_SIZE)) !== BigInt(0);\n let noflags;\n if (write && read)\n noflags = nodeFsConstants.O_RDWR;\n else if (read)\n noflags = nodeFsConstants.O_RDONLY;\n else if (write)\n noflags = nodeFsConstants.O_WRONLY;\n let neededBase = fsRightsBase | constants_1.WASI_RIGHT_PATH_OPEN, neededInheriting = fsRightsBase | fsRightsInheriting;\n if ((oflags & constants_1.WASI_O_CREAT) !== 0)\n noflags |= nodeFsConstants.O_CREAT, neededBase |= constants_1.WASI_RIGHT_PATH_CREATE_FILE;\n if ((oflags & constants_1.WASI_O_DIRECTORY) !== 0)\n noflags |= nodeFsConstants.O_DIRECTORY;\n if ((oflags & constants_1.WASI_O_EXCL) !== 0)\n noflags |= nodeFsConstants.O_EXCL;\n if ((oflags & constants_1.WASI_O_TRUNC) !== 0)\n noflags |= nodeFsConstants.O_TRUNC, neededBase |= constants_1.WASI_RIGHT_PATH_FILESTAT_SET_SIZE;\n if ((fsFlags & constants_1.WASI_FDFLAG_APPEND) !== 0)\n noflags |= nodeFsConstants.O_APPEND;\n if ((fsFlags & constants_1.WASI_FDFLAG_DSYNC) !== 0) {\n if (nodeFsConstants.O_DSYNC)\n noflags |= nodeFsConstants.O_DSYNC;\n else\n noflags |= nodeFsConstants.O_SYNC;\n neededInheriting |= constants_1.WASI_RIGHT_FD_DATASYNC;\n }\n if ((fsFlags & constants_1.WASI_FDFLAG_NONBLOCK) !== 0)\n noflags |= nodeFsConstants.O_NONBLOCK;\n if ((fsFlags & constants_1.WASI_FDFLAG_RSYNC) !== 0) {\n if (nodeFsConstants.O_RSYNC)\n noflags |= nodeFsConstants.O_RSYNC;\n else\n noflags |= nodeFsConstants.O_SYNC;\n neededInheriting |= constants_1.WASI_RIGHT_FD_SYNC;\n }\n if ((fsFlags & constants_1.WASI_FDFLAG_SYNC) !== 0)\n noflags |= nodeFsConstants.O_SYNC, neededInheriting |= constants_1.WASI_RIGHT_FD_SYNC;\n if (write && (noflags & (nodeFsConstants.O_APPEND | nodeFsConstants.O_TRUNC)) === 0)\n neededInheriting |= constants_1.WASI_RIGHT_FD_SEEK;\n this.refreshMemory();\n const p = @Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n if (p == \"dev/tty\")\n return this.view.setUint32(fdPtr, constants_1.WASI_STDIN_FILENO, !0), constants_1.WASI_ESUCCESS;\n if (logOpen(\"path_open\", p), p.startsWith(\"proc/\"))\n throw new types_1.WASIError(constants_1.WASI_EBADF);\n const fullUnresolved = path.resolve(p);\n let full;\n try {\n full = fs.realpathSync(fullUnresolved);\n } catch (e) {\n if (e\?.code === \"ENOENT\")\n full = fullUnresolved;\n else\n throw e;\n }\n let isDirectory;\n if (write)\n try {\n isDirectory = fs.statSync(full).isDirectory();\n } catch (_err) {\n }\n let realfd;\n if (!write && isDirectory)\n realfd = fs.openSync(full, nodeFsConstants.O_RDONLY);\n else\n realfd = fs.openSync(full, noflags);\n const newfd = this.getUnusedFileDescriptor();\n this.FD_MAP.set(newfd, {\n real: realfd,\n filetype: void 0,\n rights: {\n base: neededBase,\n inheriting: neededInheriting\n },\n path: full\n }), stat(this, newfd), this.view.setUint32(fdPtr, newfd, !0);\n } catch (e) {\n console.error(e);\n }\n return constants_1.WASI_ESUCCESS;\n }),\n path_readlink: wrap((fd, pathPtr, pathLen, buf, bufLen, bufused) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_READLINK);\n if (!stats.path)\n return constants_1.WASI_EINVAL;\n this.refreshMemory();\n const p = @Buffer.from(this.memory.buffer, pathPtr, pathLen).toString(), full = path.resolve(stats.path, p), r = fs.readlinkSync(full), used = @Buffer.from(this.memory.buffer).write(r, buf, bufLen);\n return this.view.setUint32(bufused, used, !0), constants_1.WASI_ESUCCESS;\n }),\n path_remove_directory: wrap((fd, pathPtr, pathLen) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_REMOVE_DIRECTORY);\n if (!stats.path)\n return constants_1.WASI_EINVAL;\n this.refreshMemory();\n const p = @Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n return fs.rmdirSync(path.resolve(stats.path, p)), constants_1.WASI_ESUCCESS;\n }),\n path_rename: wrap((oldFd, oldPath, oldPathLen, newFd, newPath, newPathLen) => {\n const ostats = CHECK_FD(oldFd, constants_1.WASI_RIGHT_PATH_RENAME_SOURCE), nstats = CHECK_FD(newFd, constants_1.WASI_RIGHT_PATH_RENAME_TARGET);\n if (!ostats.path || !nstats.path)\n return constants_1.WASI_EINVAL;\n this.refreshMemory();\n const op = @Buffer.from(this.memory.buffer, oldPath, oldPathLen).toString(), np = @Buffer.from(this.memory.buffer, newPath, newPathLen).toString();\n return fs.renameSync(path.resolve(ostats.path, op), path.resolve(nstats.path, np)), constants_1.WASI_ESUCCESS;\n }),\n path_symlink: wrap((oldPath, oldPathLen, fd, newPath, newPathLen) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_SYMLINK);\n if (!stats.path)\n return constants_1.WASI_EINVAL;\n this.refreshMemory();\n const op = @Buffer.from(this.memory.buffer, oldPath, oldPathLen).toString(), np = @Buffer.from(this.memory.buffer, newPath, newPathLen).toString();\n return fs.symlinkSync(op, path.resolve(stats.path, np)), constants_1.WASI_ESUCCESS;\n }),\n path_unlink_file: wrap((fd, pathPtr, pathLen) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_UNLINK_FILE);\n if (!stats.path)\n return constants_1.WASI_EINVAL;\n this.refreshMemory();\n const p = @Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n return fs.unlinkSync(path.resolve(stats.path, p)), constants_1.WASI_ESUCCESS;\n }),\n poll_oneoff: (sin, sout, nsubscriptions, neventsPtr) => {\n let nevents = 0, name = \"\", waitTimeNs = BigInt(0), fd = -1, fd_type = \"read\", fd_timeout_ms = 0;\n const startNs = BigInt(bindings2.hrtime());\n this.refreshMemory();\n let last_sin = sin;\n for (let i = 0;i < nsubscriptions; i += 1) {\n const userdata = this.view.getBigUint64(sin, !0);\n sin += 8;\n const type = this.view.getUint8(sin);\n if (sin += 1, sin += 7, log.enabled) {\n if (type == constants_1.WASI_EVENTTYPE_CLOCK)\n name = \"poll_oneoff (type=WASI_EVENTTYPE_CLOCK): \";\n else if (type == constants_1.WASI_EVENTTYPE_FD_READ)\n name = \"poll_oneoff (type=WASI_EVENTTYPE_FD_READ): \";\n else\n name = \"poll_oneoff (type=WASI_EVENTTYPE_FD_WRITE): \";\n log(name);\n }\n switch (type) {\n case constants_1.WASI_EVENTTYPE_CLOCK: {\n const clockid = this.view.getUint32(sin, !0);\n sin += 4, sin += 4;\n const timeout = this.view.getBigUint64(sin, !0);\n sin += 8, sin += 8;\n const subclockflags = this.view.getUint16(sin, !0);\n sin += 2, sin += 6;\n const absolute = subclockflags === 1;\n if (log.enabled)\n log(name, { clockid, timeout, absolute });\n if (!absolute)\n fd_timeout_ms = timeout / BigInt(1e6);\n let e = constants_1.WASI_ESUCCESS;\n const t = now(clockid);\n if (t == null)\n e = constants_1.WASI_EINVAL;\n else {\n const tNS = BigInt(t), waitNs = (absolute \? timeout : tNS + timeout) - tNS;\n if (waitNs > waitTimeNs)\n waitTimeNs = waitNs;\n }\n this.view.setBigUint64(sout, userdata, !0), sout += 8, this.view.setUint16(sout, e, !0), sout += 2, this.view.setUint8(sout, constants_1.WASI_EVENTTYPE_CLOCK), sout += 1, sout += 5, nevents += 1;\n break;\n }\n case constants_1.WASI_EVENTTYPE_FD_READ:\n case constants_1.WASI_EVENTTYPE_FD_WRITE: {\n if (fd = this.view.getUint32(sin, !0), fd_type = type == constants_1.WASI_EVENTTYPE_FD_READ \? \"read\" : \"write\", sin += 4, log(name, \"fd =\", fd), sin += 28, this.view.setBigUint64(sout, userdata, !0), sout += 8, this.view.setUint16(sout, constants_1.WASI_ENOSYS, !0), sout += 2, this.view.setUint8(sout, type), sout += 1, sout += 5, nevents += 1, fd == constants_1.WASI_STDIN_FILENO && constants_1.WASI_EVENTTYPE_FD_READ == type)\n this.shortPause();\n break;\n }\n default:\n return constants_1.WASI_EINVAL;\n }\n if (sin - last_sin != 48)\n console.warn(\"*** BUG in wasi-js in poll_oneoff \", {\n i,\n sin,\n last_sin,\n diff: sin - last_sin\n });\n last_sin = sin;\n }\n if (this.view.setUint32(neventsPtr, nevents, !0), nevents == 2 && fd >= 0) {\n const r = this.wasiImport.sock_pollSocket(fd, fd_type, fd_timeout_ms);\n if (r != constants_1.WASI_ENOSYS)\n return r;\n }\n if (waitTimeNs > 0) {\n if (waitTimeNs -= Bun.nanoseconds() - timeOrigin, waitTimeNs >= 1e6) {\n if (this.sleep == null && !warnedAboutSleep)\n warnedAboutSleep = !0, console.log(\"(100% cpu burning waiting for stdin: please define a way to sleep!) \");\n if (this.sleep != null) {\n const ms = nsToMs(waitTimeNs);\n this.sleep(ms);\n } else {\n const end = BigInt(bindings2.hrtime()) + waitTimeNs;\n while (BigInt(bindings2.hrtime()) < end)\n ;\n }\n }\n }\n return constants_1.WASI_ESUCCESS;\n },\n proc_exit: (rval) => {\n return bindings2.exit(rval), constants_1.WASI_ESUCCESS;\n },\n proc_raise: (sig) => {\n if (!(sig in constants_1.SIGNAL_MAP))\n return constants_1.WASI_EINVAL;\n return bindings2.kill(constants_1.SIGNAL_MAP[sig]), constants_1.WASI_ESUCCESS;\n },\n random_get: (bufPtr, bufLen) => {\n return this.refreshMemory(), crypto.getRandomValues(this.memory.buffer, bufPtr, bufLen), bufLen;\n },\n sched_yield() {\n return constants_1.WASI_ESUCCESS;\n },\n sock_recv() {\n return constants_1.WASI_ENOSYS;\n },\n sock_send() {\n return constants_1.WASI_ENOSYS;\n },\n sock_shutdown() {\n return constants_1.WASI_ENOSYS;\n },\n sock_fcntlSetFlags(_fd, _flags) {\n return constants_1.WASI_ENOSYS;\n },\n sock_pollSocket(_fd, _eventtype, _timeout_ms) {\n return constants_1.WASI_ENOSYS;\n }\n }, log.enabled)\n Object.keys(this.wasiImport).forEach((key) => {\n const prevImport = this.wasiImport[key];\n this.wasiImport[key] = function(...args2) {\n log(key, args2);\n try {\n let result = prevImport(...args2);\n return log(\"result\", result), result;\n } catch (e) {\n throw log(\"error: \", e), e;\n }\n };\n });\n }\n getState() {\n return { env: this.env, FD_MAP: this.FD_MAP, bindings };\n }\n setState(state) {\n this.env = state.env, this.FD_MAP = state.FD_MAP, bindings = state.bindings;\n }\n fstatSync(real_fd) {\n if (real_fd <= 2)\n try {\n return fs.fstatSync(real_fd);\n } catch (_) {\n const now = new Date;\n return {\n dev: 0,\n mode: 8592,\n nlink: 1,\n uid: 0,\n gid: 0,\n rdev: 0,\n blksize: 65536,\n ino: 0,\n size: 0,\n blocks: 0,\n atimeMs: now.valueOf(),\n mtimeMs: now.valueOf(),\n ctimeMs: now.valueOf(),\n birthtimeMs: 0,\n atime: new Date,\n mtime: new Date,\n ctime: new Date,\n birthtime: new Date(0)\n };\n }\n return fs.fstatSync(real_fd);\n }\n shortPause() {\n if (this.sleep == null)\n return;\n if ((new Date()).valueOf() - this.lastStdin > 2000)\n this.sleep(50);\n }\n getUnusedFileDescriptor(start = 3) {\n let fd = start;\n while (this.FD_MAP.has(fd))\n fd += 1;\n if (fd > SC_OPEN_MAX)\n throw Error(\"no available file descriptors\");\n return fd;\n }\n refreshMemory() {\n if (!this.view || this.view.buffer.byteLength === 0)\n this.view = new DataView(this.memory.buffer);\n }\n setMemory(memory) {\n this.memory = memory;\n }\n start(instance, memory) {\n const exports2 = instance.exports;\n if (exports2 === null || typeof exports2 !== \"object\")\n throw new Error(`instance.exports must be an Object. Received ${exports2}.`);\n if (memory == null) {\n if (memory = exports2.memory, !(memory instanceof WebAssembly.Memory))\n throw new Error(`instance.exports.memory must be a WebAssembly.Memory. Recceived ${memory}.`);\n }\n if (this.setMemory(memory), exports2._start)\n exports2._start();\n }\n getImports(module2) {\n let namespace = null;\n const imports = WebAssembly.Module.imports(module2);\n for (let imp of imports) {\n if (imp.kind !== \"function\")\n continue;\n if (!imp.module.startsWith(\"wasi_\"))\n continue;\n namespace = imp.module;\n break;\n }\n switch (namespace) {\n case \"wasi_unstable\":\n return {\n wasi_unstable: this.wasiImport\n };\n case \"wasi_snapshot_preview1\":\n return {\n wasi_snapshot_preview1: this.wasiImport\n };\n default:\n throw new Error(\"No WASI namespace found. Only wasi_unstable and wasi_snapshot_preview1 are supported.\\n\\nList of imports:\\n\\n\" + imports.map(({ name, kind, module }) => `${module}:${name} (${kind})`).join(\"\\n\") + \"\\n\");\n }\n }\n initWasiFdInfo() {\n if (this.env.WASI_FD_INFO != null) {\n const fdInfo = JSON.parse(this.env.WASI_FD_INFO);\n for (let wasi_fd in fdInfo) {\n console.log(wasi_fd);\n const fd = parseInt(wasi_fd);\n if (this.FD_MAP.has(fd))\n continue;\n const real = fdInfo[wasi_fd];\n try {\n this.fstatSync(real);\n } catch (_err) {\n console.log(\"discarding \", { wasi_fd, real });\n continue;\n }\n const file = {\n real,\n filetype: constants_1.WASI_FILETYPE_SOCKET_STREAM,\n rights: {\n base: STDIN_DEFAULT_RIGHTS,\n inheriting: BigInt(0)\n }\n };\n this.FD_MAP.set(fd, file);\n }\n console.log(\"after initWasiFdInfo: \", this.FD_MAP), console.log(\"fdInfo = \", fdInfo);\n } else\n console.log(\"no WASI_FD_INFO\");\n }\n };\n exports.default = WASI;\n }\n});\nreturn { WASI: require_wasi().default }})\n"); -// - -// -static constexpr ASCIILiteral NodeWorkerThreadsCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/worker_threads.ts\nvar emitWarning = function(type, message) {\n if (emittedWarnings.has(type))\n return;\n emittedWarnings.add(type), console.warn(\"[bun] Warning:\", message);\n}, injectFakeEmitter = function(Class) {\n function messageEventHandler(event) {\n return event.data;\n }\n function errorEventHandler(event) {\n return event.error;\n }\n const wrappedListener = Symbol(\"wrappedListener\");\n function wrapped(run, listener) {\n const callback = function(event) {\n return listener(run(event));\n };\n return listener[wrappedListener] = callback, callback;\n }\n function functionForEventType(event, listener) {\n switch (event) {\n case \"error\":\n case \"messageerror\":\n return wrapped(errorEventHandler, listener);\n default:\n return wrapped(messageEventHandler, listener);\n }\n }\n Class.prototype.on = function(event, listener) {\n return this.addEventListener(event, functionForEventType(event, listener)), this;\n }, Class.prototype.off = function(event, listener) {\n if (listener)\n this.removeEventListener(event, listener[wrappedListener] || listener);\n else\n this.removeEventListener(event);\n return this;\n }, Class.prototype.once = function(event, listener) {\n return this.addEventListener(event, functionForEventType(event, listener), { once: !0 }), this;\n };\n function EventClass(eventName) {\n if (eventName === \"error\" || eventName === \"messageerror\")\n return ErrorEvent;\n return MessageEvent;\n }\n Class.prototype.emit = function(event, ...args) {\n return this.dispatchEvent(new (EventClass(event))(event, ...args)), this;\n }, Class.prototype.prependListener = Class.prototype.on, Class.prototype.prependOnceListener = Class.prototype.once;\n}, receiveMessageOnPort = function(port) {\n let res = _receiveMessageOnPort(port);\n if (!res)\n return @undefined;\n return {\n message: res\n };\n}, fakeParentPort = function() {\n const fake = Object.create(MessagePort.prototype);\n return Object.defineProperty(fake, \"onmessage\", {\n get() {\n return self.onmessage;\n },\n set(value) {\n self.onmessage = value;\n }\n }), Object.defineProperty(fake, \"onmessageerror\", {\n get() {\n return self.onmessageerror;\n },\n set(value) {\n }\n }), Object.defineProperty(fake, \"postMessage\", {\n value(...args) {\n return self.postMessage(...args);\n }\n }), Object.defineProperty(fake, \"close\", {\n value() {\n return process.exit(0);\n }\n }), Object.defineProperty(fake, \"start\", {\n value() {\n }\n }), Object.defineProperty(fake, \"unref\", {\n value() {\n }\n }), Object.defineProperty(fake, \"ref\", {\n value() {\n }\n }), Object.defineProperty(fake, \"hasRef\", {\n value() {\n return !1;\n }\n }), Object.defineProperty(fake, \"setEncoding\", {\n value() {\n }\n }), Object.defineProperty(fake, \"addEventListener\", {\n value: self.addEventListener.bind(self)\n }), Object.defineProperty(fake, \"removeEventListener\", {\n value: self.removeEventListener.bind(self)\n }), fake;\n}, getEnvironmentData = function() {\n return process.env;\n}, setEnvironmentData = function(env) {\n process.env = env;\n}, markAsUntransferable = function() {\n throwNotImplemented(\"worker_threads.markAsUntransferable\");\n}, moveMessagePortToContext = function() {\n throwNotImplemented(\"worker_threads.moveMessagePortToContext\");\n}, $, EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20), { throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6), { MessageChannel, BroadcastChannel, Worker: WebWorker } = globalThis, SHARE_ENV = Symbol(\"nodejs.worker_threads.SHARE_ENV\"), isMainThread = Bun.isMainThread, [_workerData, _threadId, _receiveMessageOnPort] = @lazy(\"worker_threads\"), emittedWarnings = new Set, _MessagePort = globalThis.MessagePort;\ninjectFakeEmitter(_MessagePort);\nvar MessagePort = _MessagePort, resourceLimits = {}, workerData = _workerData, threadId = _threadId, parentPort = isMainThread \? null : fakeParentPort(), unsupportedOptions = [\n \"eval\",\n \"argv\",\n \"execArgv\",\n \"stdin\",\n \"stdout\",\n \"stderr\",\n \"trackedUnmanagedFds\",\n \"resourceLimits\"\n];\n\nclass Worker extends EventEmitter {\n #worker;\n #performance;\n #onExitPromise = @undefined;\n constructor(filename, options = {}) {\n super();\n for (let key of unsupportedOptions)\n if (key in options)\n emitWarning(\"option.\" + key, `worker_threads.Worker option \"${key}\" is not implemented.`);\n this.#worker = new WebWorker(filename, options), this.#worker.addEventListener(\"close\", this.#onClose.bind(this)), this.#worker.addEventListener(\"error\", this.#onError.bind(this)), this.#worker.addEventListener(\"message\", this.#onMessage.bind(this)), this.#worker.addEventListener(\"messageerror\", this.#onMessageError.bind(this)), this.#worker.addEventListener(\"open\", this.#onOpen.bind(this));\n }\n get threadId() {\n return this.#worker.threadId;\n }\n ref() {\n this.#worker.ref();\n }\n unref() {\n this.#worker.unref();\n }\n get stdin() {\n return null;\n }\n get stdout() {\n return null;\n }\n get stderr() {\n return null;\n }\n get performance() {\n return this.#performance \?\?= {\n eventLoopUtilization() {\n return emitWarning(\"performance\", \"worker_threads.Worker.performance is not implemented.\"), {\n idle: 0,\n active: 0,\n utilization: 0\n };\n }\n };\n }\n terminate() {\n const onExitPromise = this.#onExitPromise;\n if (onExitPromise)\n return @isPromise(onExitPromise) \? onExitPromise : @Promise.resolve(onExitPromise);\n const { resolve, promise } = @Promise.withResolvers();\n return this.#worker.addEventListener(\"close\", (event) => {\n resolve(event.code);\n }, { once: !0 }), this.#worker.terminate(), this.#onExitPromise = promise;\n }\n postMessage(...args) {\n return this.#worker.postMessage(...args);\n }\n #onClose(e) {\n this.#onExitPromise = e.code, this.emit(\"exit\", e.code);\n }\n #onError(error) {\n this.emit(\"error\", error);\n }\n #onMessage(event) {\n this.emit(\"message\", event.data);\n }\n #onMessageError(event) {\n this.emit(\"messageerror\", event.error \?\? event.data \?\? event);\n }\n #onOpen() {\n this.emit(\"online\");\n }\n async getHeapSnapshot() {\n throwNotImplemented(\"worker_threads.Worker.getHeapSnapshot\");\n }\n}\n$ = {\n Worker,\n workerData,\n parentPort,\n resourceLimits,\n isMainThread,\n MessageChannel,\n BroadcastChannel,\n MessagePort,\n getEnvironmentData,\n setEnvironmentData,\n getHeapSnapshot() {\n return {};\n },\n markAsUntransferable,\n moveMessagePortToContext,\n receiveMessageOnPort,\n SHARE_ENV,\n threadId\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeZlibCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/zlib.ts\nvar assert = @getInternalField(@internalModuleRegistry, 8) || @createInternalModuleById(8), BufferModule = @requireNativeModule(\"buffer\"), StreamModule = @getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39), Util = @getInternalField(@internalModuleRegistry, 48) || @createInternalModuleById(48), __getOwnPropNames = Object.getOwnPropertyNames, __commonJS = (cb, mod) => function __require() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n}, require_zstream = __commonJS({\n \"node_modules/pako/lib/zlib/zstream.js\"(exports, module2) {\n function ZStream() {\n this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = \"\", this.state = null, this.data_type = 2, this.adler = 0;\n }\n module2.exports = ZStream;\n }\n}), require_common = __commonJS({\n \"node_modules/pako/lib/utils/common.js\"(exports) {\n var TYPED_OK = typeof @Uint8Array !== \"undefined\" && typeof Uint16Array !== \"undefined\" && typeof Int32Array !== \"undefined\";\n function _has(obj, key) {\n return Object.prototype.hasOwnProperty.@call(obj, key);\n }\n exports.assign = function(obj) {\n var sources = @Array.prototype.slice.@call(arguments, 1);\n while (sources.length) {\n var source = sources.shift();\n if (!source)\n continue;\n if (typeof source !== \"object\")\n @throwTypeError(source + \"must be non-object\");\n for (var p in source)\n if (_has(source, p))\n obj[p] = source[p];\n }\n return obj;\n }, exports.shrinkBuf = function(buf, size) {\n if (buf.length === size)\n return buf;\n if (buf.subarray)\n return buf.subarray(0, size);\n return buf.length = size, buf;\n };\n var fnTyped = {\n arraySet: function(dest, src, src_offs, len, dest_offs) {\n if (src.subarray && dest.subarray) {\n dest.set(src.subarray(src_offs, src_offs + len), dest_offs);\n return;\n }\n for (var i = 0;i < len; i++)\n dest[dest_offs + i] = src[src_offs + i];\n },\n flattenChunks: function(chunks) {\n var i, l, len, pos, chunk, result;\n len = 0;\n for (i = 0, l = chunks.length;i < l; i++)\n len += chunks[i].length;\n result = new @Uint8Array(len), pos = 0;\n for (i = 0, l = chunks.length;i < l; i++)\n chunk = chunks[i], result.set(chunk, pos), pos += chunk.length;\n return result;\n }\n }, fnUntyped = {\n arraySet: function(dest, src, src_offs, len, dest_offs) {\n for (var i = 0;i < len; i++)\n dest[dest_offs + i] = src[src_offs + i];\n },\n flattenChunks: function(chunks) {\n return [].concat.@apply([], chunks);\n }\n };\n exports.setTyped = function(on) {\n if (on)\n exports.Buf8 = @Uint8Array, exports.Buf16 = Uint16Array, exports.Buf32 = Int32Array, exports.assign(exports, fnTyped);\n else\n exports.Buf8 = @Array, exports.Buf16 = @Array, exports.Buf32 = @Array, exports.assign(exports, fnUntyped);\n }, exports.setTyped(TYPED_OK);\n }\n}), require_trees = __commonJS({\n \"node_modules/pako/lib/zlib/trees.js\"(exports) {\n var utils = require_common(), Z_FIXED = 4, Z_BINARY = 0, Z_TEXT = 1, Z_UNKNOWN = 2;\n function zero(buf) {\n var len = buf.length;\n while (--len >= 0)\n buf[len] = 0;\n }\n var STORED_BLOCK = 0, STATIC_TREES = 1, DYN_TREES = 2, MIN_MATCH = 3, MAX_MATCH = 258, LENGTH_CODES = 29, LITERALS = 256, L_CODES = LITERALS + 1 + LENGTH_CODES, D_CODES = 30, BL_CODES = 19, HEAP_SIZE = 2 * L_CODES + 1, MAX_BITS = 15, Buf_size = 16, MAX_BL_BITS = 7, END_BLOCK = 256, REP_3_6 = 16, REPZ_3_10 = 17, REPZ_11_138 = 18, extra_lbits = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0], extra_dbits = [\n 0,\n 0,\n 0,\n 0,\n 1,\n 1,\n 2,\n 2,\n 3,\n 3,\n 4,\n 4,\n 5,\n 5,\n 6,\n 6,\n 7,\n 7,\n 8,\n 8,\n 9,\n 9,\n 10,\n 10,\n 11,\n 11,\n 12,\n 12,\n 13,\n 13\n ], extra_blbits = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7], bl_order = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], DIST_CODE_LEN = 512, static_ltree = new @Array((L_CODES + 2) * 2);\n zero(static_ltree);\n var static_dtree = new @Array(D_CODES * 2);\n zero(static_dtree);\n var _dist_code = new @Array(DIST_CODE_LEN);\n zero(_dist_code);\n var _length_code = new @Array(MAX_MATCH - MIN_MATCH + 1);\n zero(_length_code);\n var base_length = new @Array(LENGTH_CODES);\n zero(base_length);\n var base_dist = new @Array(D_CODES);\n zero(base_dist);\n function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {\n this.static_tree = static_tree, this.extra_bits = extra_bits, this.extra_base = extra_base, this.elems = elems, this.max_length = max_length, this.has_stree = static_tree && static_tree.length;\n }\n var static_l_desc, static_d_desc, static_bl_desc;\n function TreeDesc(dyn_tree, stat_desc) {\n this.dyn_tree = dyn_tree, this.max_code = 0, this.stat_desc = stat_desc;\n }\n function d_code(dist) {\n return dist < 256 \? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];\n }\n function put_short(s, w) {\n s.pending_buf[s.pending++] = w & 255, s.pending_buf[s.pending++] = w >>> 8 & 255;\n }\n function send_bits(s, value, length) {\n if (s.bi_valid > Buf_size - length)\n s.bi_buf |= value << s.bi_valid & 65535, put_short(s, s.bi_buf), s.bi_buf = value >> Buf_size - s.bi_valid, s.bi_valid += length - Buf_size;\n else\n s.bi_buf |= value << s.bi_valid & 65535, s.bi_valid += length;\n }\n function send_code(s, c, tree) {\n send_bits(s, tree[c * 2], tree[c * 2 + 1]);\n }\n function bi_reverse(code, len) {\n var res = 0;\n do\n res |= code & 1, code >>>= 1, res <<= 1;\n while (--len > 0);\n return res >>> 1;\n }\n function bi_flush(s) {\n if (s.bi_valid === 16)\n put_short(s, s.bi_buf), s.bi_buf = 0, s.bi_valid = 0;\n else if (s.bi_valid >= 8)\n s.pending_buf[s.pending++] = s.bi_buf & 255, s.bi_buf >>= 8, s.bi_valid -= 8;\n }\n function gen_bitlen(s, desc) {\n var { dyn_tree: tree, max_code } = desc, stree = desc.stat_desc.static_tree, has_stree = desc.stat_desc.has_stree, extra = desc.stat_desc.extra_bits, base = desc.stat_desc.extra_base, max_length = desc.stat_desc.max_length, h, n, m, bits, xbits, f, overflow = 0;\n for (bits = 0;bits <= MAX_BITS; bits++)\n s.bl_count[bits] = 0;\n tree[s.heap[s.heap_max] * 2 + 1] = 0;\n for (h = s.heap_max + 1;h < HEAP_SIZE; h++) {\n if (n = s.heap[h], bits = tree[tree[n * 2 + 1] * 2 + 1] + 1, bits > max_length)\n bits = max_length, overflow++;\n if (tree[n * 2 + 1] = bits, n > max_code)\n continue;\n if (s.bl_count[bits]++, xbits = 0, n >= base)\n xbits = extra[n - base];\n if (f = tree[n * 2], s.opt_len += f * (bits + xbits), has_stree)\n s.static_len += f * (stree[n * 2 + 1] + xbits);\n }\n if (overflow === 0)\n return;\n do {\n bits = max_length - 1;\n while (s.bl_count[bits] === 0)\n bits--;\n s.bl_count[bits]--, s.bl_count[bits + 1] += 2, s.bl_count[max_length]--, overflow -= 2;\n } while (overflow > 0);\n for (bits = max_length;bits !== 0; bits--) {\n n = s.bl_count[bits];\n while (n !== 0) {\n if (m = s.heap[--h], m > max_code)\n continue;\n if (tree[m * 2 + 1] !== bits)\n s.opt_len += (bits - tree[m * 2 + 1]) * tree[m * 2], tree[m * 2 + 1] = bits;\n n--;\n }\n }\n }\n function gen_codes(tree, max_code, bl_count) {\n var next_code = new @Array(MAX_BITS + 1), code = 0, bits, n;\n for (bits = 1;bits <= MAX_BITS; bits++)\n next_code[bits] = code = code + bl_count[bits - 1] << 1;\n for (n = 0;n <= max_code; n++) {\n var len = tree[n * 2 + 1];\n if (len === 0)\n continue;\n tree[n * 2] = bi_reverse(next_code[len]++, len);\n }\n }\n function tr_static_init() {\n var n, bits, length, code, dist, bl_count = new @Array(MAX_BITS + 1);\n length = 0;\n for (code = 0;code < LENGTH_CODES - 1; code++) {\n base_length[code] = length;\n for (n = 0;n < 1 << extra_lbits[code]; n++)\n _length_code[length++] = code;\n }\n _length_code[length - 1] = code, dist = 0;\n for (code = 0;code < 16; code++) {\n base_dist[code] = dist;\n for (n = 0;n < 1 << extra_dbits[code]; n++)\n _dist_code[dist++] = code;\n }\n dist >>= 7;\n for (;code < D_CODES; code++) {\n base_dist[code] = dist << 7;\n for (n = 0;n < 1 << extra_dbits[code] - 7; n++)\n _dist_code[256 + dist++] = code;\n }\n for (bits = 0;bits <= MAX_BITS; bits++)\n bl_count[bits] = 0;\n n = 0;\n while (n <= 143)\n static_ltree[n * 2 + 1] = 8, n++, bl_count[8]++;\n while (n <= 255)\n static_ltree[n * 2 + 1] = 9, n++, bl_count[9]++;\n while (n <= 279)\n static_ltree[n * 2 + 1] = 7, n++, bl_count[7]++;\n while (n <= 287)\n static_ltree[n * 2 + 1] = 8, n++, bl_count[8]++;\n gen_codes(static_ltree, L_CODES + 1, bl_count);\n for (n = 0;n < D_CODES; n++)\n static_dtree[n * 2 + 1] = 5, static_dtree[n * 2] = bi_reverse(n, 5);\n static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS), static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS), static_bl_desc = new StaticTreeDesc(new @Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS);\n }\n function init_block(s) {\n var n;\n for (n = 0;n < L_CODES; n++)\n s.dyn_ltree[n * 2] = 0;\n for (n = 0;n < D_CODES; n++)\n s.dyn_dtree[n * 2] = 0;\n for (n = 0;n < BL_CODES; n++)\n s.bl_tree[n * 2] = 0;\n s.dyn_ltree[END_BLOCK * 2] = 1, s.opt_len = s.static_len = 0, s.last_lit = s.matches = 0;\n }\n function bi_windup(s) {\n if (s.bi_valid > 8)\n put_short(s, s.bi_buf);\n else if (s.bi_valid > 0)\n s.pending_buf[s.pending++] = s.bi_buf;\n s.bi_buf = 0, s.bi_valid = 0;\n }\n function copy_block(s, buf, len, header) {\n if (bi_windup(s), header)\n put_short(s, len), put_short(s, ~len);\n utils.arraySet(s.pending_buf, s.window, buf, len, s.pending), s.pending += len;\n }\n function smaller(tree, n, m, depth) {\n var _n2 = n * 2, _m2 = m * 2;\n return tree[_n2] < tree[_m2] || tree[_n2] === tree[_m2] && depth[n] <= depth[m];\n }\n function pqdownheap(s, tree, k) {\n var v = s.heap[k], j = k << 1;\n while (j <= s.heap_len) {\n if (j < s.heap_len && smaller(tree, s.heap[j + 1], s.heap[j], s.depth))\n j++;\n if (smaller(tree, v, s.heap[j], s.depth))\n break;\n s.heap[k] = s.heap[j], k = j, j <<= 1;\n }\n s.heap[k] = v;\n }\n function compress_block(s, ltree, dtree) {\n var dist, lc, lx = 0, code, extra;\n if (s.last_lit !== 0)\n do\n if (dist = s.pending_buf[s.d_buf + lx * 2] << 8 | s.pending_buf[s.d_buf + lx * 2 + 1], lc = s.pending_buf[s.l_buf + lx], lx++, dist === 0)\n send_code(s, lc, ltree);\n else {\n if (code = _length_code[lc], send_code(s, code + LITERALS + 1, ltree), extra = extra_lbits[code], extra !== 0)\n lc -= base_length[code], send_bits(s, lc, extra);\n if (dist--, code = d_code(dist), send_code(s, code, dtree), extra = extra_dbits[code], extra !== 0)\n dist -= base_dist[code], send_bits(s, dist, extra);\n }\n while (lx < s.last_lit);\n send_code(s, END_BLOCK, ltree);\n }\n function build_tree(s, desc) {\n var tree = desc.dyn_tree, stree = desc.stat_desc.static_tree, has_stree = desc.stat_desc.has_stree, elems = desc.stat_desc.elems, n, m, max_code = -1, node;\n s.heap_len = 0, s.heap_max = HEAP_SIZE;\n for (n = 0;n < elems; n++)\n if (tree[n * 2] !== 0)\n s.heap[++s.heap_len] = max_code = n, s.depth[n] = 0;\n else\n tree[n * 2 + 1] = 0;\n while (s.heap_len < 2)\n if (node = s.heap[++s.heap_len] = max_code < 2 \? ++max_code : 0, tree[node * 2] = 1, s.depth[node] = 0, s.opt_len--, has_stree)\n s.static_len -= stree[node * 2 + 1];\n desc.max_code = max_code;\n for (n = s.heap_len >> 1;n >= 1; n--)\n pqdownheap(s, tree, n);\n node = elems;\n do\n n = s.heap[1], s.heap[1] = s.heap[s.heap_len--], pqdownheap(s, tree, 1), m = s.heap[1], s.heap[--s.heap_max] = n, s.heap[--s.heap_max] = m, tree[node * 2] = tree[n * 2] + tree[m * 2], s.depth[node] = (s.depth[n] >= s.depth[m] \? s.depth[n] : s.depth[m]) + 1, tree[n * 2 + 1] = tree[m * 2 + 1] = node, s.heap[1] = node++, pqdownheap(s, tree, 1);\n while (s.heap_len >= 2);\n s.heap[--s.heap_max] = s.heap[1], gen_bitlen(s, desc), gen_codes(tree, max_code, s.bl_count);\n }\n function scan_tree(s, tree, max_code) {\n var n, prevlen = -1, curlen, nextlen = tree[1], count = 0, max_count = 7, min_count = 4;\n if (nextlen === 0)\n max_count = 138, min_count = 3;\n tree[(max_code + 1) * 2 + 1] = 65535;\n for (n = 0;n <= max_code; n++) {\n if (curlen = nextlen, nextlen = tree[(n + 1) * 2 + 1], ++count < max_count && curlen === nextlen)\n continue;\n else if (count < min_count)\n s.bl_tree[curlen * 2] += count;\n else if (curlen !== 0) {\n if (curlen !== prevlen)\n s.bl_tree[curlen * 2]++;\n s.bl_tree[REP_3_6 * 2]++;\n } else if (count <= 10)\n s.bl_tree[REPZ_3_10 * 2]++;\n else\n s.bl_tree[REPZ_11_138 * 2]++;\n if (count = 0, prevlen = curlen, nextlen === 0)\n max_count = 138, min_count = 3;\n else if (curlen === nextlen)\n max_count = 6, min_count = 3;\n else\n max_count = 7, min_count = 4;\n }\n }\n function send_tree(s, tree, max_code) {\n var n, prevlen = -1, curlen, nextlen = tree[1], count = 0, max_count = 7, min_count = 4;\n if (nextlen === 0)\n max_count = 138, min_count = 3;\n for (n = 0;n <= max_code; n++) {\n if (curlen = nextlen, nextlen = tree[(n + 1) * 2 + 1], ++count < max_count && curlen === nextlen)\n continue;\n else if (count < min_count)\n do\n send_code(s, curlen, s.bl_tree);\n while (--count !== 0);\n else if (curlen !== 0) {\n if (curlen !== prevlen)\n send_code(s, curlen, s.bl_tree), count--;\n send_code(s, REP_3_6, s.bl_tree), send_bits(s, count - 3, 2);\n } else if (count <= 10)\n send_code(s, REPZ_3_10, s.bl_tree), send_bits(s, count - 3, 3);\n else\n send_code(s, REPZ_11_138, s.bl_tree), send_bits(s, count - 11, 7);\n if (count = 0, prevlen = curlen, nextlen === 0)\n max_count = 138, min_count = 3;\n else if (curlen === nextlen)\n max_count = 6, min_count = 3;\n else\n max_count = 7, min_count = 4;\n }\n }\n function build_bl_tree(s) {\n var max_blindex;\n scan_tree(s, s.dyn_ltree, s.l_desc.max_code), scan_tree(s, s.dyn_dtree, s.d_desc.max_code), build_tree(s, s.bl_desc);\n for (max_blindex = BL_CODES - 1;max_blindex >= 3; max_blindex--)\n if (s.bl_tree[bl_order[max_blindex] * 2 + 1] !== 0)\n break;\n return s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4, max_blindex;\n }\n function send_all_trees(s, lcodes, dcodes, blcodes) {\n var rank;\n send_bits(s, lcodes - 257, 5), send_bits(s, dcodes - 1, 5), send_bits(s, blcodes - 4, 4);\n for (rank = 0;rank < blcodes; rank++)\n send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1], 3);\n send_tree(s, s.dyn_ltree, lcodes - 1), send_tree(s, s.dyn_dtree, dcodes - 1);\n }\n function detect_data_type(s) {\n var black_mask = 4093624447, n;\n for (n = 0;n <= 31; n++, black_mask >>>= 1)\n if (black_mask & 1 && s.dyn_ltree[n * 2] !== 0)\n return Z_BINARY;\n if (s.dyn_ltree[18] !== 0 || s.dyn_ltree[20] !== 0 || s.dyn_ltree[26] !== 0)\n return Z_TEXT;\n for (n = 32;n < LITERALS; n++)\n if (s.dyn_ltree[n * 2] !== 0)\n return Z_TEXT;\n return Z_BINARY;\n }\n var static_init_done = !1;\n function _tr_init(s) {\n if (!static_init_done)\n tr_static_init(), static_init_done = !0;\n s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc), s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc), s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc), s.bi_buf = 0, s.bi_valid = 0, init_block(s);\n }\n function _tr_stored_block(s, buf, stored_len, last) {\n send_bits(s, (STORED_BLOCK << 1) + (last \? 1 : 0), 3), copy_block(s, buf, stored_len, !0);\n }\n function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3), send_code(s, END_BLOCK, static_ltree), bi_flush(s);\n }\n function _tr_flush_block(s, buf, stored_len, last) {\n var opt_lenb, static_lenb, max_blindex = 0;\n if (s.level > 0) {\n if (s.strm.data_type === Z_UNKNOWN)\n s.strm.data_type = detect_data_type(s);\n if (build_tree(s, s.l_desc), build_tree(s, s.d_desc), max_blindex = build_bl_tree(s), opt_lenb = s.opt_len + 3 + 7 >>> 3, static_lenb = s.static_len + 3 + 7 >>> 3, static_lenb <= opt_lenb)\n opt_lenb = static_lenb;\n } else\n opt_lenb = static_lenb = stored_len + 5;\n if (stored_len + 4 <= opt_lenb && buf !== -1)\n _tr_stored_block(s, buf, stored_len, last);\n else if (s.strategy === Z_FIXED || static_lenb === opt_lenb)\n send_bits(s, (STATIC_TREES << 1) + (last \? 1 : 0), 3), compress_block(s, static_ltree, static_dtree);\n else\n send_bits(s, (DYN_TREES << 1) + (last \? 1 : 0), 3), send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1), compress_block(s, s.dyn_ltree, s.dyn_dtree);\n if (init_block(s), last)\n bi_windup(s);\n }\n function _tr_tally(s, dist, lc) {\n if (s.pending_buf[s.d_buf + s.last_lit * 2] = dist >>> 8 & 255, s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 255, s.pending_buf[s.l_buf + s.last_lit] = lc & 255, s.last_lit++, dist === 0)\n s.dyn_ltree[lc * 2]++;\n else\n s.matches++, dist--, s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]++, s.dyn_dtree[d_code(dist) * 2]++;\n return s.last_lit === s.lit_bufsize - 1;\n }\n exports._tr_init = _tr_init, exports._tr_stored_block = _tr_stored_block, exports._tr_flush_block = _tr_flush_block, exports._tr_tally = _tr_tally, exports._tr_align = _tr_align;\n }\n}), require_adler32 = __commonJS({\n \"node_modules/pako/lib/zlib/adler32.js\"(exports, module2) {\n function adler32(adler, buf, len, pos) {\n var s1 = adler & 65535 | 0, s2 = adler >>> 16 & 65535 | 0, n = 0;\n while (len !== 0) {\n n = len > 2000 \? 2000 : len, len -= n;\n do\n s1 = s1 + buf[pos++] | 0, s2 = s2 + s1 | 0;\n while (--n);\n s1 %= 65521, s2 %= 65521;\n }\n return s1 | s2 << 16 | 0;\n }\n module2.exports = adler32;\n }\n}), require_crc32 = __commonJS({\n \"node_modules/pako/lib/zlib/crc32.js\"(exports, module2) {\n function makeTable() {\n var c, table = [];\n for (var n = 0;n < 256; n++) {\n c = n;\n for (var k = 0;k < 8; k++)\n c = c & 1 \? 3988292384 ^ c >>> 1 : c >>> 1;\n table[n] = c;\n }\n return table;\n }\n var crcTable = makeTable();\n function crc32(crc, buf, len, pos) {\n var t = crcTable, end = pos + len;\n crc ^= -1;\n for (var i = pos;i < end; i++)\n crc = crc >>> 8 ^ t[(crc ^ buf[i]) & 255];\n return crc ^ -1;\n }\n module2.exports = crc32;\n }\n}), require_messages = __commonJS({\n \"node_modules/pako/lib/zlib/messages.js\"(exports, module2) {\n module2.exports = {\n 2: \"need dictionary\",\n 1: \"stream end\",\n 0: \"\",\n \"-1\": \"file error\",\n \"-2\": \"stream error\",\n \"-3\": \"data error\",\n \"-4\": \"insufficient memory\",\n \"-5\": \"buffer error\",\n \"-6\": \"incompatible version\"\n };\n }\n}), require_deflate = __commonJS({\n \"node_modules/pako/lib/zlib/deflate.js\"(exports) {\n var utils = require_common(), trees = require_trees(), adler32 = require_adler32(), crc32 = require_crc32(), msg = require_messages(), Z_NO_FLUSH = 0, Z_PARTIAL_FLUSH = 1, Z_FULL_FLUSH = 3, Z_FINISH = 4, Z_BLOCK = 5, Z_OK = 0, Z_STREAM_END = 1, Z_STREAM_ERROR = -2, Z_DATA_ERROR = -3, Z_BUF_ERROR = -5, Z_DEFAULT_COMPRESSION = -1, Z_FILTERED = 1, Z_HUFFMAN_ONLY = 2, Z_RLE = 3, Z_FIXED = 4, Z_DEFAULT_STRATEGY = 0, Z_UNKNOWN = 2, Z_DEFLATED = 8, MAX_MEM_LEVEL = 9, MAX_WBITS = 15, DEF_MEM_LEVEL = 8, LENGTH_CODES = 29, LITERALS = 256, L_CODES = LITERALS + 1 + LENGTH_CODES, D_CODES = 30, BL_CODES = 19, HEAP_SIZE = 2 * L_CODES + 1, MAX_BITS = 15, MIN_MATCH = 3, MAX_MATCH = 258, MIN_LOOKAHEAD = MAX_MATCH + MIN_MATCH + 1, PRESET_DICT = 32, INIT_STATE = 42, EXTRA_STATE = 69, NAME_STATE = 73, COMMENT_STATE = 91, HCRC_STATE = 103, BUSY_STATE = 113, FINISH_STATE = 666, BS_NEED_MORE = 1, BS_BLOCK_DONE = 2, BS_FINISH_STARTED = 3, BS_FINISH_DONE = 4, OS_CODE = 3;\n function err(strm, errorCode) {\n return strm.msg = msg[errorCode], errorCode;\n }\n function rank(f) {\n return (f << 1) - (f > 4 \? 9 : 0);\n }\n function zero(buf) {\n var len = buf.length;\n while (--len >= 0)\n buf[len] = 0;\n }\n function flush_pending(strm) {\n var s = strm.state, len = s.pending;\n if (len > strm.avail_out)\n len = strm.avail_out;\n if (len === 0)\n return;\n if (utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out), strm.next_out += len, s.pending_out += len, strm.total_out += len, strm.avail_out -= len, s.pending -= len, s.pending === 0)\n s.pending_out = 0;\n }\n function flush_block_only(s, last) {\n trees._tr_flush_block(s, s.block_start >= 0 \? s.block_start : -1, s.strstart - s.block_start, last), s.block_start = s.strstart, flush_pending(s.strm);\n }\n function put_byte(s, b) {\n s.pending_buf[s.pending++] = b;\n }\n function putShortMSB(s, b) {\n s.pending_buf[s.pending++] = b >>> 8 & 255, s.pending_buf[s.pending++] = b & 255;\n }\n function read_buf(strm, buf, start, size) {\n var len = strm.avail_in;\n if (len > size)\n len = size;\n if (len === 0)\n return 0;\n if (strm.avail_in -= len, utils.arraySet(buf, strm.input, strm.next_in, len, start), strm.state.wrap === 1)\n strm.adler = adler32(strm.adler, buf, len, start);\n else if (strm.state.wrap === 2)\n strm.adler = crc32(strm.adler, buf, len, start);\n return strm.next_in += len, strm.total_in += len, len;\n }\n function longest_match(s, cur_match) {\n var { max_chain_length: chain_length, strstart: scan } = s, match, len, best_len = s.prev_length, nice_match = s.nice_match, limit = s.strstart > s.w_size - MIN_LOOKAHEAD \? s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0, _win = s.window, wmask = s.w_mask, prev = s.prev, strend = s.strstart + MAX_MATCH, scan_end1 = _win[scan + best_len - 1], scan_end = _win[scan + best_len];\n if (s.prev_length >= s.good_match)\n chain_length >>= 2;\n if (nice_match > s.lookahead)\n nice_match = s.lookahead;\n do {\n if (match = cur_match, _win[match + best_len] !== scan_end || _win[match + best_len - 1] !== scan_end1 || _win[match] !== _win[scan] || _win[++match] !== _win[scan + 1])\n continue;\n scan += 2, match++;\n do\n ;\n while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && scan < strend);\n if (len = MAX_MATCH - (strend - scan), scan = strend - MAX_MATCH, len > best_len) {\n if (s.match_start = cur_match, best_len = len, len >= nice_match)\n break;\n scan_end1 = _win[scan + best_len - 1], scan_end = _win[scan + best_len];\n }\n } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);\n if (best_len <= s.lookahead)\n return best_len;\n return s.lookahead;\n }\n function fill_window(s) {\n var _w_size = s.w_size, p, n, m, more, str;\n do {\n if (more = s.window_size - s.lookahead - s.strstart, s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {\n utils.arraySet(s.window, s.window, _w_size, _w_size, 0), s.match_start -= _w_size, s.strstart -= _w_size, s.block_start -= _w_size, n = s.hash_size, p = n;\n do\n m = s.head[--p], s.head[p] = m >= _w_size \? m - _w_size : 0;\n while (--n);\n n = _w_size, p = n;\n do\n m = s.prev[--p], s.prev[p] = m >= _w_size \? m - _w_size : 0;\n while (--n);\n more += _w_size;\n }\n if (s.strm.avail_in === 0)\n break;\n if (n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more), s.lookahead += n, s.lookahead + s.insert >= MIN_MATCH) {\n str = s.strstart - s.insert, s.ins_h = s.window[str], s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + 1]) & s.hash_mask;\n while (s.insert)\n if (s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask, s.prev[str & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = str, str++, s.insert--, s.lookahead + s.insert < MIN_MATCH)\n break;\n }\n } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);\n }\n function deflate_stored(s, flush) {\n var max_block_size = 65535;\n if (max_block_size > s.pending_buf_size - 5)\n max_block_size = s.pending_buf_size - 5;\n for (;; ) {\n if (s.lookahead <= 1) {\n if (fill_window(s), s.lookahead === 0 && flush === Z_NO_FLUSH)\n return BS_NEED_MORE;\n if (s.lookahead === 0)\n break;\n }\n s.strstart += s.lookahead, s.lookahead = 0;\n var max_start = s.block_start + max_block_size;\n if (s.strstart === 0 || s.strstart >= max_start) {\n if (s.lookahead = s.strstart - max_start, s.strstart = max_start, flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n if (s.strstart - s.block_start >= s.w_size - MIN_LOOKAHEAD) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n }\n if (s.insert = 0, flush === Z_FINISH) {\n if (flush_block_only(s, !0), s.strm.avail_out === 0)\n return BS_FINISH_STARTED;\n return BS_FINISH_DONE;\n }\n if (s.strstart > s.block_start) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n return BS_NEED_MORE;\n }\n function deflate_fast(s, flush) {\n var hash_head, bflush;\n for (;; ) {\n if (s.lookahead < MIN_LOOKAHEAD) {\n if (fill_window(s), s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH)\n return BS_NEED_MORE;\n if (s.lookahead === 0)\n break;\n }\n if (hash_head = 0, s.lookahead >= MIN_MATCH)\n s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask, hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = s.strstart;\n if (hash_head !== 0 && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD)\n s.match_length = longest_match(s, hash_head);\n if (s.match_length >= MIN_MATCH)\n if (bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH), s.lookahead -= s.match_length, s.match_length <= s.max_lazy_match && s.lookahead >= MIN_MATCH) {\n s.match_length--;\n do\n s.strstart++, s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask, hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = s.strstart;\n while (--s.match_length !== 0);\n s.strstart++;\n } else\n s.strstart += s.match_length, s.match_length = 0, s.ins_h = s.window[s.strstart], s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + 1]) & s.hash_mask;\n else\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]), s.lookahead--, s.strstart++;\n if (bflush) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n }\n if (s.insert = s.strstart < MIN_MATCH - 1 \? s.strstart : MIN_MATCH - 1, flush === Z_FINISH) {\n if (flush_block_only(s, !0), s.strm.avail_out === 0)\n return BS_FINISH_STARTED;\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n return BS_BLOCK_DONE;\n }\n function deflate_slow(s, flush) {\n var hash_head, bflush, max_insert;\n for (;; ) {\n if (s.lookahead < MIN_LOOKAHEAD) {\n if (fill_window(s), s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH)\n return BS_NEED_MORE;\n if (s.lookahead === 0)\n break;\n }\n if (hash_head = 0, s.lookahead >= MIN_MATCH)\n s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask, hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = s.strstart;\n if (s.prev_length = s.match_length, s.prev_match = s.match_start, s.match_length = MIN_MATCH - 1, hash_head !== 0 && s.prev_length < s.max_lazy_match && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD) {\n if (s.match_length = longest_match(s, hash_head), s.match_length <= 5 && (s.strategy === Z_FILTERED || s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096))\n s.match_length = MIN_MATCH - 1;\n }\n if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {\n max_insert = s.strstart + s.lookahead - MIN_MATCH, bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH), s.lookahead -= s.prev_length - 1, s.prev_length -= 2;\n do\n if (++s.strstart <= max_insert)\n s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask, hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = s.strstart;\n while (--s.prev_length !== 0);\n if (s.match_available = 0, s.match_length = MIN_MATCH - 1, s.strstart++, bflush) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n } else if (s.match_available) {\n if (bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]), bflush)\n flush_block_only(s, !1);\n if (s.strstart++, s.lookahead--, s.strm.avail_out === 0)\n return BS_NEED_MORE;\n } else\n s.match_available = 1, s.strstart++, s.lookahead--;\n }\n if (s.match_available)\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]), s.match_available = 0;\n if (s.insert = s.strstart < MIN_MATCH - 1 \? s.strstart : MIN_MATCH - 1, flush === Z_FINISH) {\n if (flush_block_only(s, !0), s.strm.avail_out === 0)\n return BS_FINISH_STARTED;\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n return BS_BLOCK_DONE;\n }\n function deflate_rle(s, flush) {\n var bflush, prev, scan, strend, _win = s.window;\n for (;; ) {\n if (s.lookahead <= MAX_MATCH) {\n if (fill_window(s), s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH)\n return BS_NEED_MORE;\n if (s.lookahead === 0)\n break;\n }\n if (s.match_length = 0, s.lookahead >= MIN_MATCH && s.strstart > 0) {\n if (scan = s.strstart - 1, prev = _win[scan], prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {\n strend = s.strstart + MAX_MATCH;\n do\n ;\n while (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && scan < strend);\n if (s.match_length = MAX_MATCH - (strend - scan), s.match_length > s.lookahead)\n s.match_length = s.lookahead;\n }\n }\n if (s.match_length >= MIN_MATCH)\n bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH), s.lookahead -= s.match_length, s.strstart += s.match_length, s.match_length = 0;\n else\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]), s.lookahead--, s.strstart++;\n if (bflush) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n }\n if (s.insert = 0, flush === Z_FINISH) {\n if (flush_block_only(s, !0), s.strm.avail_out === 0)\n return BS_FINISH_STARTED;\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n return BS_BLOCK_DONE;\n }\n function deflate_huff(s, flush) {\n var bflush;\n for (;; ) {\n if (s.lookahead === 0) {\n if (fill_window(s), s.lookahead === 0) {\n if (flush === Z_NO_FLUSH)\n return BS_NEED_MORE;\n break;\n }\n }\n if (s.match_length = 0, bflush = trees._tr_tally(s, 0, s.window[s.strstart]), s.lookahead--, s.strstart++, bflush) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n }\n if (s.insert = 0, flush === Z_FINISH) {\n if (flush_block_only(s, !0), s.strm.avail_out === 0)\n return BS_FINISH_STARTED;\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n return BS_BLOCK_DONE;\n }\n function Config(good_length, max_lazy, nice_length, max_chain, func) {\n this.good_length = good_length, this.max_lazy = max_lazy, this.nice_length = nice_length, this.max_chain = max_chain, this.func = func;\n }\n var configuration_table = [\n new Config(0, 0, 0, 0, deflate_stored),\n new Config(4, 4, 8, 4, deflate_fast),\n new Config(4, 5, 16, 8, deflate_fast),\n new Config(4, 6, 32, 32, deflate_fast),\n new Config(4, 4, 16, 16, deflate_slow),\n new Config(8, 16, 32, 32, deflate_slow),\n new Config(8, 16, 128, 128, deflate_slow),\n new Config(8, 32, 128, 256, deflate_slow),\n new Config(32, 128, 258, 1024, deflate_slow),\n new Config(32, 258, 258, 4096, deflate_slow)\n ];\n function lm_init(s) {\n s.window_size = 2 * s.w_size, zero(s.head), s.max_lazy_match = configuration_table[s.level].max_lazy, s.good_match = configuration_table[s.level].good_length, s.nice_match = configuration_table[s.level].nice_length, s.max_chain_length = configuration_table[s.level].max_chain, s.strstart = 0, s.block_start = 0, s.lookahead = 0, s.insert = 0, s.match_length = s.prev_length = MIN_MATCH - 1, s.match_available = 0, s.ins_h = 0;\n }\n function DeflateState() {\n this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = Z_DEFLATED, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2), this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2), this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2), zero(this.dyn_ltree), zero(this.dyn_dtree), zero(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new utils.Buf16(MAX_BITS + 1), this.heap = new utils.Buf16(2 * L_CODES + 1), zero(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new utils.Buf16(2 * L_CODES + 1), zero(this.depth), this.l_buf = 0, this.lit_bufsize = 0, this.last_lit = 0, this.d_buf = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0;\n }\n function deflateResetKeep(strm) {\n var s;\n if (!strm || !strm.state)\n return err(strm, Z_STREAM_ERROR);\n if (strm.total_in = strm.total_out = 0, strm.data_type = Z_UNKNOWN, s = strm.state, s.pending = 0, s.pending_out = 0, s.wrap < 0)\n s.wrap = -s.wrap;\n return s.status = s.wrap \? INIT_STATE : BUSY_STATE, strm.adler = s.wrap === 2 \? 0 : 1, s.last_flush = Z_NO_FLUSH, trees._tr_init(s), Z_OK;\n }\n function deflateReset(strm) {\n var ret = deflateResetKeep(strm);\n if (ret === Z_OK)\n lm_init(strm.state);\n return ret;\n }\n function deflateSetHeader(strm, head) {\n if (!strm || !strm.state)\n return Z_STREAM_ERROR;\n if (strm.state.wrap !== 2)\n return Z_STREAM_ERROR;\n return strm.state.gzhead = head, Z_OK;\n }\n function deflateInit2(strm, level, method, windowBits, memLevel, strategy) {\n if (!strm)\n return Z_STREAM_ERROR;\n var wrap = 1;\n if (level === Z_DEFAULT_COMPRESSION)\n level = 6;\n if (windowBits < 0)\n wrap = 0, windowBits = -windowBits;\n else if (windowBits > 15)\n wrap = 2, windowBits -= 16;\n if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED)\n return err(strm, Z_STREAM_ERROR);\n if (windowBits === 8)\n windowBits = 9;\n var s = new DeflateState;\n return strm.state = s, s.strm = strm, s.wrap = wrap, s.gzhead = null, s.w_bits = windowBits, s.w_size = 1 << s.w_bits, s.w_mask = s.w_size - 1, s.hash_bits = memLevel + 7, s.hash_size = 1 << s.hash_bits, s.hash_mask = s.hash_size - 1, s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH), s.window = new utils.Buf8(s.w_size * 2), s.head = new utils.Buf16(s.hash_size), s.prev = new utils.Buf16(s.w_size), s.lit_bufsize = 1 << memLevel + 6, s.pending_buf_size = s.lit_bufsize * 4, s.pending_buf = new utils.Buf8(s.pending_buf_size), s.d_buf = 1 * s.lit_bufsize, s.l_buf = 3 * s.lit_bufsize, s.level = level, s.strategy = strategy, s.method = method, deflateReset(strm);\n }\n function deflateInit(strm, level) {\n return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);\n }\n function deflate(strm, flush) {\n var old_flush, s, beg, val;\n if (!strm || !strm.state || flush > Z_BLOCK || flush < 0)\n return strm \? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;\n if (s = strm.state, !strm.output || !strm.input && strm.avail_in !== 0 || s.status === FINISH_STATE && flush !== Z_FINISH)\n return err(strm, strm.avail_out === 0 \? Z_BUF_ERROR : Z_STREAM_ERROR);\n if (s.strm = strm, old_flush = s.last_flush, s.last_flush = flush, s.status === INIT_STATE)\n if (s.wrap === 2)\n if (strm.adler = 0, put_byte(s, 31), put_byte(s, 139), put_byte(s, 8), !s.gzhead)\n put_byte(s, 0), put_byte(s, 0), put_byte(s, 0), put_byte(s, 0), put_byte(s, 0), put_byte(s, s.level === 9 \? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 \? 4 : 0), put_byte(s, OS_CODE), s.status = BUSY_STATE;\n else {\n if (put_byte(s, (s.gzhead.text \? 1 : 0) + (s.gzhead.hcrc \? 2 : 0) + (!s.gzhead.extra \? 0 : 4) + (!s.gzhead.name \? 0 : 8) + (!s.gzhead.comment \? 0 : 16)), put_byte(s, s.gzhead.time & 255), put_byte(s, s.gzhead.time >> 8 & 255), put_byte(s, s.gzhead.time >> 16 & 255), put_byte(s, s.gzhead.time >> 24 & 255), put_byte(s, s.level === 9 \? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 \? 4 : 0), put_byte(s, s.gzhead.os & 255), s.gzhead.extra && s.gzhead.extra.length)\n put_byte(s, s.gzhead.extra.length & 255), put_byte(s, s.gzhead.extra.length >> 8 & 255);\n if (s.gzhead.hcrc)\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);\n s.gzindex = 0, s.status = EXTRA_STATE;\n }\n else {\n var header = Z_DEFLATED + (s.w_bits - 8 << 4) << 8, level_flags = -1;\n if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2)\n level_flags = 0;\n else if (s.level < 6)\n level_flags = 1;\n else if (s.level === 6)\n level_flags = 2;\n else\n level_flags = 3;\n if (header |= level_flags << 6, s.strstart !== 0)\n header |= PRESET_DICT;\n if (header += 31 - header % 31, s.status = BUSY_STATE, putShortMSB(s, header), s.strstart !== 0)\n putShortMSB(s, strm.adler >>> 16), putShortMSB(s, strm.adler & 65535);\n strm.adler = 1;\n }\n if (s.status === EXTRA_STATE)\n if (s.gzhead.extra) {\n beg = s.pending;\n while (s.gzindex < (s.gzhead.extra.length & 65535)) {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg)\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n if (flush_pending(strm), beg = s.pending, s.pending === s.pending_buf_size)\n break;\n }\n put_byte(s, s.gzhead.extra[s.gzindex] & 255), s.gzindex++;\n }\n if (s.gzhead.hcrc && s.pending > beg)\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n if (s.gzindex === s.gzhead.extra.length)\n s.gzindex = 0, s.status = NAME_STATE;\n } else\n s.status = NAME_STATE;\n if (s.status === NAME_STATE)\n if (s.gzhead.name) {\n beg = s.pending;\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg)\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n if (flush_pending(strm), beg = s.pending, s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n if (s.gzindex < s.gzhead.name.length)\n val = s.gzhead.name.charCodeAt(s.gzindex++) & 255;\n else\n val = 0;\n put_byte(s, val);\n } while (val !== 0);\n if (s.gzhead.hcrc && s.pending > beg)\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n if (val === 0)\n s.gzindex = 0, s.status = COMMENT_STATE;\n } else\n s.status = COMMENT_STATE;\n if (s.status === COMMENT_STATE)\n if (s.gzhead.comment) {\n beg = s.pending;\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg)\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n if (flush_pending(strm), beg = s.pending, s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n if (s.gzindex < s.gzhead.comment.length)\n val = s.gzhead.comment.charCodeAt(s.gzindex++) & 255;\n else\n val = 0;\n put_byte(s, val);\n } while (val !== 0);\n if (s.gzhead.hcrc && s.pending > beg)\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n if (val === 0)\n s.status = HCRC_STATE;\n } else\n s.status = HCRC_STATE;\n if (s.status === HCRC_STATE)\n if (s.gzhead.hcrc) {\n if (s.pending + 2 > s.pending_buf_size)\n flush_pending(strm);\n if (s.pending + 2 <= s.pending_buf_size)\n put_byte(s, strm.adler & 255), put_byte(s, strm.adler >> 8 & 255), strm.adler = 0, s.status = BUSY_STATE;\n } else\n s.status = BUSY_STATE;\n if (s.pending !== 0) {\n if (flush_pending(strm), strm.avail_out === 0)\n return s.last_flush = -1, Z_OK;\n } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && flush !== Z_FINISH)\n return err(strm, Z_BUF_ERROR);\n if (s.status === FINISH_STATE && strm.avail_in !== 0)\n return err(strm, Z_BUF_ERROR);\n if (strm.avail_in !== 0 || s.lookahead !== 0 || flush !== Z_NO_FLUSH && s.status !== FINISH_STATE) {\n var bstate = s.strategy === Z_HUFFMAN_ONLY \? deflate_huff(s, flush) : s.strategy === Z_RLE \? deflate_rle(s, flush) : configuration_table[s.level].func(s, flush);\n if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE)\n s.status = FINISH_STATE;\n if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {\n if (strm.avail_out === 0)\n s.last_flush = -1;\n return Z_OK;\n }\n if (bstate === BS_BLOCK_DONE) {\n if (flush === Z_PARTIAL_FLUSH)\n trees._tr_align(s);\n else if (flush !== Z_BLOCK) {\n if (trees._tr_stored_block(s, 0, 0, !1), flush === Z_FULL_FLUSH) {\n if (zero(s.head), s.lookahead === 0)\n s.strstart = 0, s.block_start = 0, s.insert = 0;\n }\n }\n if (flush_pending(strm), strm.avail_out === 0)\n return s.last_flush = -1, Z_OK;\n }\n }\n if (flush !== Z_FINISH)\n return Z_OK;\n if (s.wrap <= 0)\n return Z_STREAM_END;\n if (s.wrap === 2)\n put_byte(s, strm.adler & 255), put_byte(s, strm.adler >> 8 & 255), put_byte(s, strm.adler >> 16 & 255), put_byte(s, strm.adler >> 24 & 255), put_byte(s, strm.total_in & 255), put_byte(s, strm.total_in >> 8 & 255), put_byte(s, strm.total_in >> 16 & 255), put_byte(s, strm.total_in >> 24 & 255);\n else\n putShortMSB(s, strm.adler >>> 16), putShortMSB(s, strm.adler & 65535);\n if (flush_pending(strm), s.wrap > 0)\n s.wrap = -s.wrap;\n return s.pending !== 0 \? Z_OK : Z_STREAM_END;\n }\n function deflateEnd(strm) {\n var status;\n if (!strm || !strm.state)\n return Z_STREAM_ERROR;\n if (status = strm.state.status, status !== INIT_STATE && status !== EXTRA_STATE && status !== NAME_STATE && status !== COMMENT_STATE && status !== HCRC_STATE && status !== BUSY_STATE && status !== FINISH_STATE)\n return err(strm, Z_STREAM_ERROR);\n return strm.state = null, status === BUSY_STATE \? err(strm, Z_DATA_ERROR) : Z_OK;\n }\n function deflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length, s, str, n, wrap, avail, next, input, tmpDict;\n if (!strm || !strm.state)\n return Z_STREAM_ERROR;\n if (s = strm.state, wrap = s.wrap, wrap === 2 || wrap === 1 && s.status !== INIT_STATE || s.lookahead)\n return Z_STREAM_ERROR;\n if (wrap === 1)\n strm.adler = adler32(strm.adler, dictionary, dictLength, 0);\n if (s.wrap = 0, dictLength >= s.w_size) {\n if (wrap === 0)\n zero(s.head), s.strstart = 0, s.block_start = 0, s.insert = 0;\n tmpDict = new utils.Buf8(s.w_size), utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0), dictionary = tmpDict, dictLength = s.w_size;\n }\n avail = strm.avail_in, next = strm.next_in, input = strm.input, strm.avail_in = dictLength, strm.next_in = 0, strm.input = dictionary, fill_window(s);\n while (s.lookahead >= MIN_MATCH) {\n str = s.strstart, n = s.lookahead - (MIN_MATCH - 1);\n do\n s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask, s.prev[str & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = str, str++;\n while (--n);\n s.strstart = str, s.lookahead = MIN_MATCH - 1, fill_window(s);\n }\n return s.strstart += s.lookahead, s.block_start = s.strstart, s.insert = s.lookahead, s.lookahead = 0, s.match_length = s.prev_length = MIN_MATCH - 1, s.match_available = 0, strm.next_in = next, strm.input = input, strm.avail_in = avail, s.wrap = wrap, Z_OK;\n }\n exports.deflateInit = deflateInit, exports.deflateInit2 = deflateInit2, exports.deflateReset = deflateReset, exports.deflateResetKeep = deflateResetKeep, exports.deflateSetHeader = deflateSetHeader, exports.deflate = deflate, exports.deflateEnd = deflateEnd, exports.deflateSetDictionary = deflateSetDictionary, exports.deflateInfo = \"pako deflate (from Nodeca project)\";\n }\n}), require_inffast = __commonJS({\n \"node_modules/pako/lib/zlib/inffast.js\"(exports, module2) {\n var BAD = 30, TYPE = 12;\n module2.exports = function inflate_fast(strm, start) {\n var state, _in, last, _out, beg, end, dmax, wsize, whave, wnext, s_window, hold, bits, lcode, dcode, lmask, dmask, here, op, len, dist, from, from_source, input, output;\n state = strm.state, _in = strm.next_in, input = strm.input, last = _in + (strm.avail_in - 5), _out = strm.next_out, output = strm.output, beg = _out - (start - strm.avail_out), end = _out + (strm.avail_out - 257), dmax = state.dmax, wsize = state.wsize, whave = state.whave, wnext = state.wnext, s_window = state.window, hold = state.hold, bits = state.bits, lcode = state.lencode, dcode = state.distcode, lmask = (1 << state.lenbits) - 1, dmask = (1 << state.distbits) - 1;\n top:\n do {\n if (bits < 15)\n hold += input[_in++] << bits, bits += 8, hold += input[_in++] << bits, bits += 8;\n here = lcode[hold & lmask];\n dolen:\n for (;; ) {\n if (op = here >>> 24, hold >>>= op, bits -= op, op = here >>> 16 & 255, op === 0)\n output[_out++] = here & 65535;\n else if (op & 16) {\n if (len = here & 65535, op &= 15, op) {\n if (bits < op)\n hold += input[_in++] << bits, bits += 8;\n len += hold & (1 << op) - 1, hold >>>= op, bits -= op;\n }\n if (bits < 15)\n hold += input[_in++] << bits, bits += 8, hold += input[_in++] << bits, bits += 8;\n here = dcode[hold & dmask];\n dodist:\n for (;; ) {\n if (op = here >>> 24, hold >>>= op, bits -= op, op = here >>> 16 & 255, op & 16) {\n if (dist = here & 65535, op &= 15, bits < op) {\n if (hold += input[_in++] << bits, bits += 8, bits < op)\n hold += input[_in++] << bits, bits += 8;\n }\n if (dist += hold & (1 << op) - 1, dist > dmax) {\n strm.msg = \"invalid distance too far back\", state.mode = BAD;\n break top;\n }\n if (hold >>>= op, bits -= op, op = _out - beg, dist > op) {\n if (op = dist - op, op > whave) {\n if (state.sane) {\n strm.msg = \"invalid distance too far back\", state.mode = BAD;\n break top;\n }\n }\n if (from = 0, from_source = s_window, wnext === 0) {\n if (from += wsize - op, op < len) {\n len -= op;\n do\n output[_out++] = s_window[from++];\n while (--op);\n from = _out - dist, from_source = output;\n }\n } else if (wnext < op) {\n if (from += wsize + wnext - op, op -= wnext, op < len) {\n len -= op;\n do\n output[_out++] = s_window[from++];\n while (--op);\n if (from = 0, wnext < len) {\n op = wnext, len -= op;\n do\n output[_out++] = s_window[from++];\n while (--op);\n from = _out - dist, from_source = output;\n }\n }\n } else if (from += wnext - op, op < len) {\n len -= op;\n do\n output[_out++] = s_window[from++];\n while (--op);\n from = _out - dist, from_source = output;\n }\n while (len > 2)\n output[_out++] = from_source[from++], output[_out++] = from_source[from++], output[_out++] = from_source[from++], len -= 3;\n if (len) {\n if (output[_out++] = from_source[from++], len > 1)\n output[_out++] = from_source[from++];\n }\n } else {\n from = _out - dist;\n do\n output[_out++] = output[from++], output[_out++] = output[from++], output[_out++] = output[from++], len -= 3;\n while (len > 2);\n if (len) {\n if (output[_out++] = output[from++], len > 1)\n output[_out++] = output[from++];\n }\n }\n } else if ((op & 64) === 0) {\n here = dcode[(here & 65535) + (hold & (1 << op) - 1)];\n continue dodist;\n } else {\n strm.msg = \"invalid distance code\", state.mode = BAD;\n break top;\n }\n break;\n }\n } else if ((op & 64) === 0) {\n here = lcode[(here & 65535) + (hold & (1 << op) - 1)];\n continue dolen;\n } else if (op & 32) {\n state.mode = TYPE;\n break top;\n } else {\n strm.msg = \"invalid literal/length code\", state.mode = BAD;\n break top;\n }\n break;\n }\n } while (_in < last && _out < end);\n len = bits >> 3, _in -= len, bits -= len << 3, hold &= (1 << bits) - 1, strm.next_in = _in, strm.next_out = _out, strm.avail_in = _in < last \? 5 + (last - _in) : 5 - (_in - last), strm.avail_out = _out < end \? 257 + (end - _out) : 257 - (_out - end), state.hold = hold, state.bits = bits;\n return;\n };\n }\n}), require_inftrees = __commonJS({\n \"node_modules/pako/lib/zlib/inftrees.js\"(exports, module2) {\n var utils = require_common(), MAXBITS = 15, ENOUGH_LENS = 852, ENOUGH_DISTS = 592, CODES = 0, LENS = 1, DISTS = 2, lbase = [\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 13,\n 15,\n 17,\n 19,\n 23,\n 27,\n 31,\n 35,\n 43,\n 51,\n 59,\n 67,\n 83,\n 99,\n 115,\n 131,\n 163,\n 195,\n 227,\n 258,\n 0,\n 0\n ], lext = [\n 16,\n 16,\n 16,\n 16,\n 16,\n 16,\n 16,\n 16,\n 17,\n 17,\n 17,\n 17,\n 18,\n 18,\n 18,\n 18,\n 19,\n 19,\n 19,\n 19,\n 20,\n 20,\n 20,\n 20,\n 21,\n 21,\n 21,\n 21,\n 16,\n 72,\n 78\n ], dbase = [\n 1,\n 2,\n 3,\n 4,\n 5,\n 7,\n 9,\n 13,\n 17,\n 25,\n 33,\n 49,\n 65,\n 97,\n 129,\n 193,\n 257,\n 385,\n 513,\n 769,\n 1025,\n 1537,\n 2049,\n 3073,\n 4097,\n 6145,\n 8193,\n 12289,\n 16385,\n 24577,\n 0,\n 0\n ], dext = [\n 16,\n 16,\n 16,\n 16,\n 17,\n 17,\n 18,\n 18,\n 19,\n 19,\n 20,\n 20,\n 21,\n 21,\n 22,\n 22,\n 23,\n 23,\n 24,\n 24,\n 25,\n 25,\n 26,\n 26,\n 27,\n 27,\n 28,\n 28,\n 29,\n 29,\n 64,\n 64\n ];\n module2.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) {\n var bits = opts.bits, len = 0, sym = 0, min = 0, max = 0, root = 0, curr = 0, drop = 0, left = 0, used = 0, huff = 0, incr, fill, low, mask, next, base = null, base_index = 0, end, count = new utils.Buf16(MAXBITS + 1), offs = new utils.Buf16(MAXBITS + 1), extra = null, extra_index = 0, here_bits, here_op, here_val;\n for (len = 0;len <= MAXBITS; len++)\n count[len] = 0;\n for (sym = 0;sym < codes; sym++)\n count[lens[lens_index + sym]]++;\n root = bits;\n for (max = MAXBITS;max >= 1; max--)\n if (count[max] !== 0)\n break;\n if (root > max)\n root = max;\n if (max === 0)\n return table[table_index++] = 1 << 24 | 64 << 16 | 0, table[table_index++] = 1 << 24 | 64 << 16 | 0, opts.bits = 1, 0;\n for (min = 1;min < max; min++)\n if (count[min] !== 0)\n break;\n if (root < min)\n root = min;\n left = 1;\n for (len = 1;len <= MAXBITS; len++)\n if (left <<= 1, left -= count[len], left < 0)\n return -1;\n if (left > 0 && (type === CODES || max !== 1))\n return -1;\n offs[1] = 0;\n for (len = 1;len < MAXBITS; len++)\n offs[len + 1] = offs[len] + count[len];\n for (sym = 0;sym < codes; sym++)\n if (lens[lens_index + sym] !== 0)\n work[offs[lens[lens_index + sym]]++] = sym;\n if (type === CODES)\n base = extra = work, end = 19;\n else if (type === LENS)\n base = lbase, base_index -= 257, extra = lext, extra_index -= 257, end = 256;\n else\n base = dbase, extra = dext, end = -1;\n if (huff = 0, sym = 0, len = min, next = table_index, curr = root, drop = 0, low = -1, used = 1 << root, mask = used - 1, type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS)\n return 1;\n for (;; ) {\n if (here_bits = len - drop, work[sym] < end)\n here_op = 0, here_val = work[sym];\n else if (work[sym] > end)\n here_op = extra[extra_index + work[sym]], here_val = base[base_index + work[sym]];\n else\n here_op = 96, here_val = 0;\n incr = 1 << len - drop, fill = 1 << curr, min = fill;\n do\n fill -= incr, table[next + (huff >> drop) + fill] = here_bits << 24 | here_op << 16 | here_val | 0;\n while (fill !== 0);\n incr = 1 << len - 1;\n while (huff & incr)\n incr >>= 1;\n if (incr !== 0)\n huff &= incr - 1, huff += incr;\n else\n huff = 0;\n if (sym++, --count[len] === 0) {\n if (len === max)\n break;\n len = lens[lens_index + work[sym]];\n }\n if (len > root && (huff & mask) !== low) {\n if (drop === 0)\n drop = root;\n next += min, curr = len - drop, left = 1 << curr;\n while (curr + drop < max) {\n if (left -= count[curr + drop], left <= 0)\n break;\n curr++, left <<= 1;\n }\n if (used += 1 << curr, type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS)\n return 1;\n low = huff & mask, table[low] = root << 24 | curr << 16 | next - table_index | 0;\n }\n }\n if (huff !== 0)\n table[next + huff] = len - drop << 24 | 64 << 16 | 0;\n return opts.bits = root, 0;\n };\n }\n}), require_inflate = __commonJS({\n \"node_modules/pako/lib/zlib/inflate.js\"(exports) {\n var utils = require_common(), adler32 = require_adler32(), crc32 = require_crc32(), inflate_fast = require_inffast(), inflate_table = require_inftrees(), CODES = 0, LENS = 1, DISTS = 2, Z_FINISH = 4, Z_BLOCK = 5, Z_TREES = 6, Z_OK = 0, Z_STREAM_END = 1, Z_NEED_DICT = 2, Z_STREAM_ERROR = -2, Z_DATA_ERROR = -3, Z_MEM_ERROR = -4, Z_BUF_ERROR = -5, Z_DEFLATED = 8, HEAD = 1, FLAGS = 2, TIME = 3, OS = 4, EXLEN = 5, EXTRA = 6, NAME = 7, COMMENT = 8, HCRC = 9, DICTID = 10, DICT = 11, TYPE = 12, TYPEDO = 13, STORED = 14, COPY_ = 15, COPY = 16, TABLE = 17, LENLENS = 18, CODELENS = 19, LEN_ = 20, LEN = 21, LENEXT = 22, DIST = 23, DISTEXT = 24, MATCH = 25, LIT = 26, CHECK = 27, LENGTH = 28, DONE = 29, BAD = 30, MEM = 31, SYNC = 32, ENOUGH_LENS = 852, ENOUGH_DISTS = 592, MAX_WBITS = 15, DEF_WBITS = MAX_WBITS;\n function zswap32(q) {\n return (q >>> 24 & 255) + (q >>> 8 & 65280) + ((q & 65280) << 8) + ((q & 255) << 24);\n }\n function InflateState() {\n this.mode = 0, this.last = !1, this.wrap = 0, this.havedict = !1, this.flags = 0, this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0, this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0, this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null, this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0, this.ndist = 0, this.have = 0, this.next = null, this.lens = new utils.Buf16(320), this.work = new utils.Buf16(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0;\n }\n function inflateResetKeep(strm) {\n var state;\n if (!strm || !strm.state)\n return Z_STREAM_ERROR;\n if (state = strm.state, strm.total_in = strm.total_out = state.total = 0, strm.msg = \"\", state.wrap)\n strm.adler = state.wrap & 1;\n return state.mode = HEAD, state.last = 0, state.havedict = 0, state.dmax = 32768, state.head = null, state.hold = 0, state.bits = 0, state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS), state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS), state.sane = 1, state.back = -1, Z_OK;\n }\n function inflateReset(strm) {\n var state;\n if (!strm || !strm.state)\n return Z_STREAM_ERROR;\n return state = strm.state, state.wsize = 0, state.whave = 0, state.wnext = 0, inflateResetKeep(strm);\n }\n function inflateReset2(strm, windowBits) {\n var wrap, state;\n if (!strm || !strm.state)\n return Z_STREAM_ERROR;\n if (state = strm.state, windowBits < 0)\n wrap = 0, windowBits = -windowBits;\n else if (wrap = (windowBits >> 4) + 1, windowBits < 48)\n windowBits &= 15;\n if (windowBits && (windowBits < 8 || windowBits > 15))\n return Z_STREAM_ERROR;\n if (state.window !== null && state.wbits !== windowBits)\n state.window = null;\n return state.wrap = wrap, state.wbits = windowBits, inflateReset(strm);\n }\n function inflateInit2(strm, windowBits) {\n var ret, state;\n if (!strm)\n return Z_STREAM_ERROR;\n if (state = new InflateState, strm.state = state, state.window = null, ret = inflateReset2(strm, windowBits), ret !== Z_OK)\n strm.state = null;\n return ret;\n }\n function inflateInit(strm) {\n return inflateInit2(strm, DEF_WBITS);\n }\n var virgin = !0, lenfix, distfix;\n function fixedtables(state) {\n if (virgin) {\n var sym;\n lenfix = new utils.Buf32(512), distfix = new utils.Buf32(32), sym = 0;\n while (sym < 144)\n state.lens[sym++] = 8;\n while (sym < 256)\n state.lens[sym++] = 9;\n while (sym < 280)\n state.lens[sym++] = 7;\n while (sym < 288)\n state.lens[sym++] = 8;\n inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, {\n bits: 9\n }), sym = 0;\n while (sym < 32)\n state.lens[sym++] = 5;\n inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, {\n bits: 5\n }), virgin = !1;\n }\n state.lencode = lenfix, state.lenbits = 9, state.distcode = distfix, state.distbits = 5;\n }\n function updatewindow(strm, src, end, copy) {\n var dist, state = strm.state;\n if (state.window === null)\n state.wsize = 1 << state.wbits, state.wnext = 0, state.whave = 0, state.window = new utils.Buf8(state.wsize);\n if (copy >= state.wsize)\n utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0), state.wnext = 0, state.whave = state.wsize;\n else {\n if (dist = state.wsize - state.wnext, dist > copy)\n dist = copy;\n if (utils.arraySet(state.window, src, end - copy, dist, state.wnext), copy -= dist, copy)\n utils.arraySet(state.window, src, end - copy, copy, 0), state.wnext = copy, state.whave = state.wsize;\n else {\n if (state.wnext += dist, state.wnext === state.wsize)\n state.wnext = 0;\n if (state.whave < state.wsize)\n state.whave += dist;\n }\n }\n return 0;\n }\n function inflate(strm, flush) {\n var state, input, output, next, put, have, left, hold, bits, _in, _out, copy, from, from_source, here = 0, here_bits, here_op, here_val, last_bits, last_op, last_val, len, ret, hbuf = new utils.Buf8(4), opts, n, order = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];\n if (!strm || !strm.state || !strm.output || !strm.input && strm.avail_in !== 0)\n return Z_STREAM_ERROR;\n if (state = strm.state, state.mode === TYPE)\n state.mode = TYPEDO;\n put = strm.next_out, output = strm.output, left = strm.avail_out, next = strm.next_in, input = strm.input, have = strm.avail_in, hold = state.hold, bits = state.bits, _in = have, _out = left, ret = Z_OK;\n inf_leave:\n for (;; )\n switch (state.mode) {\n case HEAD:\n if (state.wrap === 0) {\n state.mode = TYPEDO;\n break;\n }\n while (bits < 16) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (state.wrap & 2 && hold === 35615) {\n state.check = 0, hbuf[0] = hold & 255, hbuf[1] = hold >>> 8 & 255, state.check = crc32(state.check, hbuf, 2, 0), hold = 0, bits = 0, state.mode = FLAGS;\n break;\n }\n if (state.flags = 0, state.head)\n state.head.done = !1;\n if (!(state.wrap & 1) || (((hold & 255) << 8) + (hold >> 8)) % 31) {\n strm.msg = \"incorrect header check\", state.mode = BAD;\n break;\n }\n if ((hold & 15) !== Z_DEFLATED) {\n strm.msg = \"unknown compression method\", state.mode = BAD;\n break;\n }\n if (hold >>>= 4, bits -= 4, len = (hold & 15) + 8, state.wbits === 0)\n state.wbits = len;\n else if (len > state.wbits) {\n strm.msg = \"invalid window size\", state.mode = BAD;\n break;\n }\n state.dmax = 1 << len, strm.adler = state.check = 1, state.mode = hold & 512 \? DICTID : TYPE, hold = 0, bits = 0;\n break;\n case FLAGS:\n while (bits < 16) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (state.flags = hold, (state.flags & 255) !== Z_DEFLATED) {\n strm.msg = \"unknown compression method\", state.mode = BAD;\n break;\n }\n if (state.flags & 57344) {\n strm.msg = \"unknown header flags set\", state.mode = BAD;\n break;\n }\n if (state.head)\n state.head.text = hold >> 8 & 1;\n if (state.flags & 512)\n hbuf[0] = hold & 255, hbuf[1] = hold >>> 8 & 255, state.check = crc32(state.check, hbuf, 2, 0);\n hold = 0, bits = 0, state.mode = TIME;\n case TIME:\n while (bits < 32) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (state.head)\n state.head.time = hold;\n if (state.flags & 512)\n hbuf[0] = hold & 255, hbuf[1] = hold >>> 8 & 255, hbuf[2] = hold >>> 16 & 255, hbuf[3] = hold >>> 24 & 255, state.check = crc32(state.check, hbuf, 4, 0);\n hold = 0, bits = 0, state.mode = OS;\n case OS:\n while (bits < 16) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (state.head)\n state.head.xflags = hold & 255, state.head.os = hold >> 8;\n if (state.flags & 512)\n hbuf[0] = hold & 255, hbuf[1] = hold >>> 8 & 255, state.check = crc32(state.check, hbuf, 2, 0);\n hold = 0, bits = 0, state.mode = EXLEN;\n case EXLEN:\n if (state.flags & 1024) {\n while (bits < 16) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (state.length = hold, state.head)\n state.head.extra_len = hold;\n if (state.flags & 512)\n hbuf[0] = hold & 255, hbuf[1] = hold >>> 8 & 255, state.check = crc32(state.check, hbuf, 2, 0);\n hold = 0, bits = 0;\n } else if (state.head)\n state.head.extra = null;\n state.mode = EXTRA;\n case EXTRA:\n if (state.flags & 1024) {\n if (copy = state.length, copy > have)\n copy = have;\n if (copy) {\n if (state.head) {\n if (len = state.head.extra_len - state.length, !state.head.extra)\n state.head.extra = new @Array(state.head.extra_len);\n utils.arraySet(state.head.extra, input, next, copy, len);\n }\n if (state.flags & 512)\n state.check = crc32(state.check, input, copy, next);\n have -= copy, next += copy, state.length -= copy;\n }\n if (state.length)\n break inf_leave;\n }\n state.length = 0, state.mode = NAME;\n case NAME:\n if (state.flags & 2048) {\n if (have === 0)\n break inf_leave;\n copy = 0;\n do\n if (len = input[next + copy++], state.head && len && state.length < 65536)\n state.head.name += @String.fromCharCode(len);\n while (len && copy < have);\n if (state.flags & 512)\n state.check = crc32(state.check, input, copy, next);\n if (have -= copy, next += copy, len)\n break inf_leave;\n } else if (state.head)\n state.head.name = null;\n state.length = 0, state.mode = COMMENT;\n case COMMENT:\n if (state.flags & 4096) {\n if (have === 0)\n break inf_leave;\n copy = 0;\n do\n if (len = input[next + copy++], state.head && len && state.length < 65536)\n state.head.comment += @String.fromCharCode(len);\n while (len && copy < have);\n if (state.flags & 512)\n state.check = crc32(state.check, input, copy, next);\n if (have -= copy, next += copy, len)\n break inf_leave;\n } else if (state.head)\n state.head.comment = null;\n state.mode = HCRC;\n case HCRC:\n if (state.flags & 512) {\n while (bits < 16) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (hold !== (state.check & 65535)) {\n strm.msg = \"header crc mismatch\", state.mode = BAD;\n break;\n }\n hold = 0, bits = 0;\n }\n if (state.head)\n state.head.hcrc = state.flags >> 9 & 1, state.head.done = !0;\n strm.adler = state.check = 0, state.mode = TYPE;\n break;\n case DICTID:\n while (bits < 32) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n strm.adler = state.check = zswap32(hold), hold = 0, bits = 0, state.mode = DICT;\n case DICT:\n if (state.havedict === 0)\n return strm.next_out = put, strm.avail_out = left, strm.next_in = next, strm.avail_in = have, state.hold = hold, state.bits = bits, Z_NEED_DICT;\n strm.adler = state.check = 1, state.mode = TYPE;\n case TYPE:\n if (flush === Z_BLOCK || flush === Z_TREES)\n break inf_leave;\n case TYPEDO:\n if (state.last) {\n hold >>>= bits & 7, bits -= bits & 7, state.mode = CHECK;\n break;\n }\n while (bits < 3) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n switch (state.last = hold & 1, hold >>>= 1, bits -= 1, hold & 3) {\n case 0:\n state.mode = STORED;\n break;\n case 1:\n if (fixedtables(state), state.mode = LEN_, flush === Z_TREES) {\n hold >>>= 2, bits -= 2;\n break inf_leave;\n }\n break;\n case 2:\n state.mode = TABLE;\n break;\n case 3:\n strm.msg = \"invalid block type\", state.mode = BAD;\n }\n hold >>>= 2, bits -= 2;\n break;\n case STORED:\n hold >>>= bits & 7, bits -= bits & 7;\n while (bits < 32) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if ((hold & 65535) !== (hold >>> 16 ^ 65535)) {\n strm.msg = \"invalid stored block lengths\", state.mode = BAD;\n break;\n }\n if (state.length = hold & 65535, hold = 0, bits = 0, state.mode = COPY_, flush === Z_TREES)\n break inf_leave;\n case COPY_:\n state.mode = COPY;\n case COPY:\n if (copy = state.length, copy) {\n if (copy > have)\n copy = have;\n if (copy > left)\n copy = left;\n if (copy === 0)\n break inf_leave;\n utils.arraySet(output, input, next, copy, put), have -= copy, next += copy, left -= copy, put += copy, state.length -= copy;\n break;\n }\n state.mode = TYPE;\n break;\n case TABLE:\n while (bits < 14) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (state.nlen = (hold & 31) + 257, hold >>>= 5, bits -= 5, state.ndist = (hold & 31) + 1, hold >>>= 5, bits -= 5, state.ncode = (hold & 15) + 4, hold >>>= 4, bits -= 4, state.nlen > 286 || state.ndist > 30) {\n strm.msg = \"too many length or distance symbols\", state.mode = BAD;\n break;\n }\n state.have = 0, state.mode = LENLENS;\n case LENLENS:\n while (state.have < state.ncode) {\n while (bits < 3) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n state.lens[order[state.have++]] = hold & 7, hold >>>= 3, bits -= 3;\n }\n while (state.have < 19)\n state.lens[order[state.have++]] = 0;\n if (state.lencode = state.lendyn, state.lenbits = 7, opts = { bits: state.lenbits }, ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts), state.lenbits = opts.bits, ret) {\n strm.msg = \"invalid code lengths set\", state.mode = BAD;\n break;\n }\n state.have = 0, state.mode = CODELENS;\n case CODELENS:\n while (state.have < state.nlen + state.ndist) {\n for (;; ) {\n if (here = state.lencode[hold & (1 << state.lenbits) - 1], here_bits = here >>> 24, here_op = here >>> 16 & 255, here_val = here & 65535, here_bits <= bits)\n break;\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (here_val < 16)\n hold >>>= here_bits, bits -= here_bits, state.lens[state.have++] = here_val;\n else {\n if (here_val === 16) {\n n = here_bits + 2;\n while (bits < n) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (hold >>>= here_bits, bits -= here_bits, state.have === 0) {\n strm.msg = \"invalid bit length repeat\", state.mode = BAD;\n break;\n }\n len = state.lens[state.have - 1], copy = 3 + (hold & 3), hold >>>= 2, bits -= 2;\n } else if (here_val === 17) {\n n = here_bits + 3;\n while (bits < n) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n hold >>>= here_bits, bits -= here_bits, len = 0, copy = 3 + (hold & 7), hold >>>= 3, bits -= 3;\n } else {\n n = here_bits + 7;\n while (bits < n) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n hold >>>= here_bits, bits -= here_bits, len = 0, copy = 11 + (hold & 127), hold >>>= 7, bits -= 7;\n }\n if (state.have + copy > state.nlen + state.ndist) {\n strm.msg = \"invalid bit length repeat\", state.mode = BAD;\n break;\n }\n while (copy--)\n state.lens[state.have++] = len;\n }\n }\n if (state.mode === BAD)\n break;\n if (state.lens[256] === 0) {\n strm.msg = \"invalid code -- missing end-of-block\", state.mode = BAD;\n break;\n }\n if (state.lenbits = 9, opts = { bits: state.lenbits }, ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts), state.lenbits = opts.bits, ret) {\n strm.msg = \"invalid literal/lengths set\", state.mode = BAD;\n break;\n }\n if (state.distbits = 6, state.distcode = state.distdyn, opts = { bits: state.distbits }, ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts), state.distbits = opts.bits, ret) {\n strm.msg = \"invalid distances set\", state.mode = BAD;\n break;\n }\n if (state.mode = LEN_, flush === Z_TREES)\n break inf_leave;\n case LEN_:\n state.mode = LEN;\n case LEN:\n if (have >= 6 && left >= 258) {\n if (strm.next_out = put, strm.avail_out = left, strm.next_in = next, strm.avail_in = have, state.hold = hold, state.bits = bits, inflate_fast(strm, _out), put = strm.next_out, output = strm.output, left = strm.avail_out, next = strm.next_in, input = strm.input, have = strm.avail_in, hold = state.hold, bits = state.bits, state.mode === TYPE)\n state.back = -1;\n break;\n }\n state.back = 0;\n for (;; ) {\n if (here = state.lencode[hold & (1 << state.lenbits) - 1], here_bits = here >>> 24, here_op = here >>> 16 & 255, here_val = here & 65535, here_bits <= bits)\n break;\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (here_op && (here_op & 240) === 0) {\n last_bits = here_bits, last_op = here_op, last_val = here_val;\n for (;; ) {\n if (here = state.lencode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)], here_bits = here >>> 24, here_op = here >>> 16 & 255, here_val = here & 65535, last_bits + here_bits <= bits)\n break;\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n hold >>>= last_bits, bits -= last_bits, state.back += last_bits;\n }\n if (hold >>>= here_bits, bits -= here_bits, state.back += here_bits, state.length = here_val, here_op === 0) {\n state.mode = LIT;\n break;\n }\n if (here_op & 32) {\n state.back = -1, state.mode = TYPE;\n break;\n }\n if (here_op & 64) {\n strm.msg = \"invalid literal/length code\", state.mode = BAD;\n break;\n }\n state.extra = here_op & 15, state.mode = LENEXT;\n case LENEXT:\n if (state.extra) {\n n = state.extra;\n while (bits < n) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n state.length += hold & (1 << state.extra) - 1, hold >>>= state.extra, bits -= state.extra, state.back += state.extra;\n }\n state.was = state.length, state.mode = DIST;\n case DIST:\n for (;; ) {\n if (here = state.distcode[hold & (1 << state.distbits) - 1], here_bits = here >>> 24, here_op = here >>> 16 & 255, here_val = here & 65535, here_bits <= bits)\n break;\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if ((here_op & 240) === 0) {\n last_bits = here_bits, last_op = here_op, last_val = here_val;\n for (;; ) {\n if (here = state.distcode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)], here_bits = here >>> 24, here_op = here >>> 16 & 255, here_val = here & 65535, last_bits + here_bits <= bits)\n break;\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n hold >>>= last_bits, bits -= last_bits, state.back += last_bits;\n }\n if (hold >>>= here_bits, bits -= here_bits, state.back += here_bits, here_op & 64) {\n strm.msg = \"invalid distance code\", state.mode = BAD;\n break;\n }\n state.offset = here_val, state.extra = here_op & 15, state.mode = DISTEXT;\n case DISTEXT:\n if (state.extra) {\n n = state.extra;\n while (bits < n) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n state.offset += hold & (1 << state.extra) - 1, hold >>>= state.extra, bits -= state.extra, state.back += state.extra;\n }\n if (state.offset > state.dmax) {\n strm.msg = \"invalid distance too far back\", state.mode = BAD;\n break;\n }\n state.mode = MATCH;\n case MATCH:\n if (left === 0)\n break inf_leave;\n if (copy = _out - left, state.offset > copy) {\n if (copy = state.offset - copy, copy > state.whave) {\n if (state.sane) {\n strm.msg = \"invalid distance too far back\", state.mode = BAD;\n break;\n }\n }\n if (copy > state.wnext)\n copy -= state.wnext, from = state.wsize - copy;\n else\n from = state.wnext - copy;\n if (copy > state.length)\n copy = state.length;\n from_source = state.window;\n } else\n from_source = output, from = put - state.offset, copy = state.length;\n if (copy > left)\n copy = left;\n left -= copy, state.length -= copy;\n do\n output[put++] = from_source[from++];\n while (--copy);\n if (state.length === 0)\n state.mode = LEN;\n break;\n case LIT:\n if (left === 0)\n break inf_leave;\n output[put++] = state.length, left--, state.mode = LEN;\n break;\n case CHECK:\n if (state.wrap) {\n while (bits < 32) {\n if (have === 0)\n break inf_leave;\n have--, hold |= input[next++] << bits, bits += 8;\n }\n if (_out -= left, strm.total_out += _out, state.total += _out, _out)\n strm.adler = state.check = state.flags \? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out);\n if (_out = left, (state.flags \? hold : zswap32(hold)) !== state.check) {\n strm.msg = \"incorrect data check\", state.mode = BAD;\n break;\n }\n hold = 0, bits = 0;\n }\n state.mode = LENGTH;\n case LENGTH:\n if (state.wrap && state.flags) {\n while (bits < 32) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (hold !== (state.total & 4294967295)) {\n strm.msg = \"incorrect length check\", state.mode = BAD;\n break;\n }\n hold = 0, bits = 0;\n }\n state.mode = DONE;\n case DONE:\n ret = Z_STREAM_END;\n break inf_leave;\n case BAD:\n ret = Z_DATA_ERROR;\n break inf_leave;\n case MEM:\n return Z_MEM_ERROR;\n case SYNC:\n default:\n return Z_STREAM_ERROR;\n }\n if (strm.next_out = put, strm.avail_out = left, strm.next_in = next, strm.avail_in = have, state.hold = hold, state.bits = bits, state.wsize || _out !== strm.avail_out && state.mode < BAD && (state.mode < CHECK || flush !== Z_FINISH)) {\n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out))\n return state.mode = MEM, Z_MEM_ERROR;\n }\n if (_in -= strm.avail_in, _out -= strm.avail_out, strm.total_in += _in, strm.total_out += _out, state.total += _out, state.wrap && _out)\n strm.adler = state.check = state.flags \? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out);\n if (strm.data_type = state.bits + (state.last \? 64 : 0) + (state.mode === TYPE \? 128 : 0) + (state.mode === LEN_ || state.mode === COPY_ \? 256 : 0), (_in === 0 && _out === 0 || flush === Z_FINISH) && ret === Z_OK)\n ret = Z_BUF_ERROR;\n return ret;\n }\n function inflateEnd(strm) {\n if (!strm || !strm.state)\n return Z_STREAM_ERROR;\n var state = strm.state;\n if (state.window)\n state.window = null;\n return strm.state = null, Z_OK;\n }\n function inflateGetHeader(strm, head) {\n var state;\n if (!strm || !strm.state)\n return Z_STREAM_ERROR;\n if (state = strm.state, (state.wrap & 2) === 0)\n return Z_STREAM_ERROR;\n return state.head = head, head.done = !1, Z_OK;\n }\n function inflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length, state, dictid, ret;\n if (!strm || !strm.state)\n return Z_STREAM_ERROR;\n if (state = strm.state, state.wrap !== 0 && state.mode !== DICT)\n return Z_STREAM_ERROR;\n if (state.mode === DICT) {\n if (dictid = 1, dictid = adler32(dictid, dictionary, dictLength, 0), dictid !== state.check)\n return Z_DATA_ERROR;\n }\n if (ret = updatewindow(strm, dictionary, dictLength, dictLength), ret)\n return state.mode = MEM, Z_MEM_ERROR;\n return state.havedict = 1, Z_OK;\n }\n exports.inflateReset = inflateReset, exports.inflateReset2 = inflateReset2, exports.inflateResetKeep = inflateResetKeep, exports.inflateInit = inflateInit, exports.inflateInit2 = inflateInit2, exports.inflate = inflate, exports.inflateEnd = inflateEnd, exports.inflateGetHeader = inflateGetHeader, exports.inflateSetDictionary = inflateSetDictionary, exports.inflateInfo = \"pako inflate (from Nodeca project)\";\n }\n}), require_constants = __commonJS({\n \"node_modules/pako/lib/zlib/constants.js\"(exports, module2) {\n module2.exports = {\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_TREES: 6,\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n Z_BUF_ERROR: -5,\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n Z_BINARY: 0,\n Z_TEXT: 1,\n Z_UNKNOWN: 2,\n Z_DEFLATED: 8\n };\n }\n}), require_binding = __commonJS({\n \"node_modules/browserify-zlib/lib/binding.js\"(exports) {\n var Zstream = require_zstream(), zlib_deflate = require_deflate(), zlib_inflate = require_inflate(), constants = require_constants();\n for (key in constants)\n exports[key] = constants[key];\n var key;\n exports.NONE = 0, exports.DEFLATE = 1, exports.INFLATE = 2, exports.GZIP = 3, exports.GUNZIP = 4, exports.DEFLATERAW = 5, exports.INFLATERAW = 6, exports.UNZIP = 7;\n var GZIP_HEADER_ID1 = 31, GZIP_HEADER_ID2 = 139;\n function Zlib(mode) {\n if (typeof mode !== \"number\" || mode < exports.DEFLATE || mode > exports.UNZIP)\n @throwTypeError(\"Bad argument\");\n this.dictionary = null, this.err = 0, this.flush = 0, this.init_done = !1, this.level = 0, this.memLevel = 0, this.mode = mode, this.strategy = 0, this.windowBits = 0, this.write_in_progress = !1, this.pending_close = !1, this.gzip_id_bytes_read = 0;\n }\n Zlib.prototype = {}, Zlib.prototype.close = function() {\n if (this.write_in_progress) {\n this.pending_close = !0;\n return;\n }\n if (this.pending_close = !1, assert(this.init_done, \"close before init\"), assert(this.mode <= exports.UNZIP), this.mode === exports.DEFLATE || this.mode === exports.GZIP || this.mode === exports.DEFLATERAW)\n zlib_deflate.deflateEnd(this.strm);\n else if (this.mode === exports.INFLATE || this.mode === exports.GUNZIP || this.mode === exports.INFLATERAW || this.mode === exports.UNZIP)\n zlib_inflate.inflateEnd(this.strm);\n this.mode = exports.NONE, this.dictionary = null;\n }, Zlib.prototype.write = function(flush, input, in_off, in_len, out, out_off, out_len) {\n return this._write(!0, flush, input, in_off, in_len, out, out_off, out_len);\n }, Zlib.prototype.writeSync = function(flush, input, in_off, in_len, out, out_off, out_len) {\n return this._write(!1, flush, input, in_off, in_len, out, out_off, out_len);\n }, Zlib.prototype._write = function(async, flush, input, in_off, in_len, out, out_off, out_len) {\n if (assert.equal(arguments.length, 8), assert(this.init_done, \"write before init\"), assert(this.mode !== exports.NONE, \"already finalized\"), assert.equal(!1, this.write_in_progress, \"write already in progress\"), assert.equal(!1, this.pending_close, \"close is pending\"), this.write_in_progress = !0, assert.equal(!1, flush === void 0, \"must provide flush value\"), this.write_in_progress = !0, flush !== exports.Z_NO_FLUSH && flush !== exports.Z_PARTIAL_FLUSH && flush !== exports.Z_SYNC_FLUSH && flush !== exports.Z_FULL_FLUSH && flush !== exports.Z_FINISH && flush !== exports.Z_BLOCK)\n throw new Error(\"Invalid flush value\");\n if (input == null)\n input = @Buffer.alloc(0), in_len = 0, in_off = 0;\n if (this.strm.avail_in = in_len, this.strm.input = input, this.strm.next_in = in_off, this.strm.avail_out = out_len, this.strm.output = out, this.strm.next_out = out_off, this.flush = flush, !async) {\n if (this._process(), this._checkError())\n return this._afterSync();\n return;\n }\n var self = this;\n return process.nextTick(function() {\n self._process(), self._after();\n }), this;\n }, Zlib.prototype._afterSync = function() {\n var avail_out = this.strm.avail_out, avail_in = this.strm.avail_in;\n return this.write_in_progress = !1, [avail_in, avail_out];\n }, Zlib.prototype._process = function() {\n var next_expected_header_byte = null;\n switch (this.mode) {\n case exports.DEFLATE:\n case exports.GZIP:\n case exports.DEFLATERAW:\n this.err = zlib_deflate.deflate(this.strm, this.flush);\n break;\n case exports.UNZIP:\n if (this.strm.avail_in > 0)\n next_expected_header_byte = this.strm.next_in;\n switch (this.gzip_id_bytes_read) {\n case 0:\n if (next_expected_header_byte === null)\n break;\n if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID1) {\n if (this.gzip_id_bytes_read = 1, next_expected_header_byte++, this.strm.avail_in === 1)\n break;\n } else {\n this.mode = exports.INFLATE;\n break;\n }\n case 1:\n if (next_expected_header_byte === null)\n break;\n if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID2)\n this.gzip_id_bytes_read = 2, this.mode = exports.GUNZIP;\n else\n this.mode = exports.INFLATE;\n break;\n default:\n throw new Error(\"invalid number of gzip magic number bytes read\");\n }\n case exports.INFLATE:\n case exports.GUNZIP:\n case exports.INFLATERAW:\n if (this.err = zlib_inflate.inflate(this.strm, this.flush), this.err === exports.Z_NEED_DICT && this.dictionary) {\n if (this.err = zlib_inflate.inflateSetDictionary(this.strm, this.dictionary), this.err === exports.Z_OK)\n this.err = zlib_inflate.inflate(this.strm, this.flush);\n else if (this.err === exports.Z_DATA_ERROR)\n this.err = exports.Z_NEED_DICT;\n }\n while (this.strm.avail_in > 0 && this.mode === exports.GUNZIP && this.err === exports.Z_STREAM_END && this.strm.next_in[0] !== 0)\n this.reset(), this.err = zlib_inflate.inflate(this.strm, this.flush);\n break;\n default:\n throw new Error(\"Unknown mode \" + this.mode);\n }\n }, Zlib.prototype._checkError = function() {\n switch (this.err) {\n case exports.Z_OK:\n case exports.Z_BUF_ERROR:\n if (this.strm.avail_out !== 0 && this.flush === exports.Z_FINISH)\n return this._error(\"unexpected end of file\"), !1;\n break;\n case exports.Z_STREAM_END:\n break;\n case exports.Z_NEED_DICT:\n if (this.dictionary == null)\n this._error(\"Missing dictionary\");\n else\n this._error(\"Bad dictionary\");\n return !1;\n default:\n return this._error(\"Zlib error\"), !1;\n }\n return !0;\n }, Zlib.prototype._after = function() {\n if (!this._checkError())\n return;\n var avail_out = this.strm.avail_out, avail_in = this.strm.avail_in;\n if (this.write_in_progress = !1, this.callback(avail_in, avail_out), this.pending_close)\n this.close();\n }, Zlib.prototype._error = function(message) {\n if (this.strm.msg)\n message = this.strm.msg;\n if (this.onerror(message, this.err), this.write_in_progress = !1, this.pending_close)\n this.close();\n }, Zlib.prototype.init = function(windowBits, level, memLevel, strategy, dictionary) {\n assert(arguments.length === 4 || arguments.length === 5, \"init(windowBits, level, memLevel, strategy, [dictionary])\"), assert(windowBits >= 8 && windowBits <= 15, \"invalid windowBits\"), assert(level >= -1 && level <= 9, \"invalid compression level\"), assert(memLevel >= 1 && memLevel <= 9, \"invalid memlevel\"), assert(strategy === exports.Z_FILTERED || strategy === exports.Z_HUFFMAN_ONLY || strategy === exports.Z_RLE || strategy === exports.Z_FIXED || strategy === exports.Z_DEFAULT_STRATEGY, \"invalid strategy\"), this._init(level, windowBits, memLevel, strategy, dictionary), this._setDictionary();\n }, Zlib.prototype.params = function() {\n throw new Error(\"deflateParams Not supported\");\n }, Zlib.prototype.reset = function() {\n this._reset(), this._setDictionary();\n }, Zlib.prototype._init = function(level, windowBits, memLevel, strategy, dictionary) {\n if (this.level = level, this.windowBits = windowBits, this.memLevel = memLevel, this.strategy = strategy, this.flush = exports.Z_NO_FLUSH, this.err = exports.Z_OK, this.mode === exports.GZIP || this.mode === exports.GUNZIP)\n this.windowBits += 16;\n if (this.mode === exports.UNZIP)\n this.windowBits += 32;\n if (this.mode === exports.DEFLATERAW || this.mode === exports.INFLATERAW)\n this.windowBits = -1 * this.windowBits;\n switch (this.strm = new Zstream, this.mode) {\n case exports.DEFLATE:\n case exports.GZIP:\n case exports.DEFLATERAW:\n this.err = zlib_deflate.deflateInit2(this.strm, this.level, exports.Z_DEFLATED, this.windowBits, this.memLevel, this.strategy);\n break;\n case exports.INFLATE:\n case exports.GUNZIP:\n case exports.INFLATERAW:\n case exports.UNZIP:\n this.err = zlib_inflate.inflateInit2(this.strm, this.windowBits);\n break;\n default:\n throw new Error(\"Unknown mode \" + this.mode);\n }\n if (this.err !== exports.Z_OK)\n this._error(\"Init error\");\n this.dictionary = dictionary, this.write_in_progress = !1, this.init_done = !0;\n }, Zlib.prototype._setDictionary = function() {\n if (this.dictionary == null)\n return;\n switch (this.err = exports.Z_OK, this.mode) {\n case exports.DEFLATE:\n case exports.DEFLATERAW:\n this.err = zlib_deflate.deflateSetDictionary(this.strm, this.dictionary);\n break;\n default:\n break;\n }\n if (this.err !== exports.Z_OK)\n this._error(\"Failed to set dictionary\");\n }, Zlib.prototype._reset = function() {\n switch (this.err = exports.Z_OK, this.mode) {\n case exports.DEFLATE:\n case exports.DEFLATERAW:\n case exports.GZIP:\n this.err = zlib_deflate.deflateReset(this.strm);\n break;\n case exports.INFLATE:\n case exports.INFLATERAW:\n case exports.GUNZIP:\n this.err = zlib_inflate.inflateReset(this.strm);\n break;\n default:\n break;\n }\n if (this.err !== exports.Z_OK)\n this._error(\"Failed to reset stream\");\n }, exports.Zlib = Zlib;\n }\n}), require_lib = __commonJS({\n \"node_modules/browserify-zlib/lib/index.js\"(exports) {\n var Buffer2 = BufferModule.Buffer, Transform = StreamModule.Transform, binding = require_binding(), util = Util, kMaxLength = BufferModule.kMaxLength, kRangeErrorMessage = \"Cannot create final Buffer. It would be larger than 0x\" + kMaxLength.toString(16) + \" bytes\";\n binding.Z_MIN_WINDOWBITS = 8, binding.Z_MAX_WINDOWBITS = 15, binding.Z_DEFAULT_WINDOWBITS = 15, binding.Z_MIN_CHUNK = 64, binding.Z_MAX_CHUNK = @Infinity, binding.Z_DEFAULT_CHUNK = 16384, binding.Z_MIN_MEMLEVEL = 1, binding.Z_MAX_MEMLEVEL = 9, binding.Z_DEFAULT_MEMLEVEL = 8, binding.Z_MIN_LEVEL = -1, binding.Z_MAX_LEVEL = 9, binding.Z_DEFAULT_LEVEL = binding.Z_DEFAULT_COMPRESSION;\n var bkeys = Object.keys(binding);\n for (bk = 0;bk < bkeys.length; bk++)\n if (bkey = bkeys[bk], bkey.match(/^Z/))\n Object.defineProperty(exports, bkey, {\n enumerable: !0,\n value: binding[bkey],\n writable: !1\n });\n var bkey, bk, codes = {\n Z_OK: binding.Z_OK,\n Z_STREAM_END: binding.Z_STREAM_END,\n Z_NEED_DICT: binding.Z_NEED_DICT,\n Z_ERRNO: binding.Z_ERRNO,\n Z_STREAM_ERROR: binding.Z_STREAM_ERROR,\n Z_DATA_ERROR: binding.Z_DATA_ERROR,\n Z_MEM_ERROR: binding.Z_MEM_ERROR,\n Z_BUF_ERROR: binding.Z_BUF_ERROR,\n Z_VERSION_ERROR: binding.Z_VERSION_ERROR\n }, ckeys = Object.keys(codes);\n for (ck = 0;ck < ckeys.length; ck++)\n ckey = ckeys[ck], codes[codes[ckey]] = ckey;\n var ckey, ck;\n Object.defineProperty(exports, \"codes\", {\n enumerable: !0,\n value: Object.freeze(codes),\n writable: !1\n }), exports.constants = require_constants(), exports.Deflate = Deflate, exports.Inflate = Inflate, exports.Gzip = Gzip, exports.Gunzip = Gunzip, exports.DeflateRaw = DeflateRaw, exports.InflateRaw = InflateRaw, exports.Unzip = Unzip, exports.createDeflate = function(o) {\n return new Deflate(o);\n }, exports.createInflate = function(o) {\n return new Inflate(o);\n }, exports.createDeflateRaw = function(o) {\n return new DeflateRaw(o);\n }, exports.createInflateRaw = function(o) {\n return new InflateRaw(o);\n }, exports.createGzip = function(o) {\n return new Gzip(o);\n }, exports.createGunzip = function(o) {\n return new Gunzip(o);\n }, exports.createUnzip = function(o) {\n return new Unzip(o);\n }, exports.deflate = function(buffer, opts, callback) {\n if (typeof opts === \"function\")\n callback = opts, opts = {};\n return zlibBuffer(new Deflate(opts), buffer, callback);\n }, exports.deflateSync = function(buffer, opts) {\n return zlibBufferSync(new Deflate(opts), buffer);\n }, exports.gzip = function(buffer, opts, callback) {\n if (typeof opts === \"function\")\n callback = opts, opts = {};\n return zlibBuffer(new Gzip(opts), buffer, callback);\n }, exports.gzipSync = function(buffer, opts) {\n return zlibBufferSync(new Gzip(opts), buffer);\n }, exports.deflateRaw = function(buffer, opts, callback) {\n if (typeof opts === \"function\")\n callback = opts, opts = {};\n return zlibBuffer(new DeflateRaw(opts), buffer, callback);\n }, exports.deflateRawSync = function(buffer, opts) {\n return zlibBufferSync(new DeflateRaw(opts), buffer);\n }, exports.unzip = function(buffer, opts, callback) {\n if (typeof opts === \"function\")\n callback = opts, opts = {};\n return zlibBuffer(new Unzip(opts), buffer, callback);\n }, exports.unzipSync = function(buffer, opts) {\n return zlibBufferSync(new Unzip(opts), buffer);\n }, exports.inflate = function(buffer, opts, callback) {\n if (typeof opts === \"function\")\n callback = opts, opts = {};\n return zlibBuffer(new Inflate(opts), buffer, callback);\n }, exports.inflateSync = function(buffer, opts) {\n return zlibBufferSync(new Inflate(opts), buffer);\n }, exports.gunzip = function(buffer, opts, callback) {\n if (typeof opts === \"function\")\n callback = opts, opts = {};\n return zlibBuffer(new Gunzip(opts), buffer, callback);\n }, exports.gunzipSync = function(buffer, opts) {\n return zlibBufferSync(new Gunzip(opts), buffer);\n }, exports.inflateRaw = function(buffer, opts, callback) {\n if (typeof opts === \"function\")\n callback = opts, opts = {};\n return zlibBuffer(new InflateRaw(opts), buffer, callback);\n }, exports.inflateRawSync = function(buffer, opts) {\n return zlibBufferSync(new InflateRaw(opts), buffer);\n }, exports.brotliCompress = function(buffer, opts, callback) {\n throw new Error(\"zlib.brotliCompress is not implemented\");\n };\n function zlibBuffer(engine, buffer, callback) {\n var buffers = [], nread = 0;\n engine.on(\"error\", onError), engine.on(\"end\", onEnd), engine.end(buffer), flow();\n function flow() {\n var chunk;\n while ((chunk = engine.read()) !== null)\n buffers.push(chunk), nread += chunk.length;\n engine.once(\"readable\", flow);\n }\n function onError(err) {\n engine.removeListener(\"end\", onEnd), engine.removeListener(\"readable\", flow), callback(err);\n }\n function onEnd() {\n var buf, err = null;\n if (nread >= kMaxLength)\n err = new RangeError(kRangeErrorMessage);\n else\n buf = Buffer2.concat(buffers, nread);\n buffers = [], engine.close(), callback(err, buf);\n }\n }\n function zlibBufferSync(engine, buffer) {\n if (typeof buffer === \"string\")\n buffer = Buffer2.from(buffer);\n if (!Buffer2.isBuffer(buffer))\n @throwTypeError(\"Not a string or buffer\");\n var flushFlag = engine._finishFlushFlag;\n return engine._processChunk(buffer, flushFlag);\n }\n function Deflate(opts) {\n if (!(this instanceof Deflate))\n return new Deflate(opts);\n Zlib.@call(this, opts, binding.DEFLATE);\n }\n function Inflate(opts) {\n if (!(this instanceof Inflate))\n return new Inflate(opts);\n Zlib.@call(this, opts, binding.INFLATE);\n }\n function Gzip(opts) {\n if (!(this instanceof Gzip))\n return new Gzip(opts);\n Zlib.@call(this, opts, binding.GZIP);\n }\n function Gunzip(opts) {\n if (!(this instanceof Gunzip))\n return new Gunzip(opts);\n Zlib.@call(this, opts, binding.GUNZIP);\n }\n function DeflateRaw(opts) {\n if (!(this instanceof DeflateRaw))\n return new DeflateRaw(opts);\n Zlib.@call(this, opts, binding.DEFLATERAW);\n }\n function InflateRaw(opts) {\n if (!(this instanceof InflateRaw))\n return new InflateRaw(opts);\n Zlib.@call(this, opts, binding.INFLATERAW);\n }\n function Unzip(opts) {\n if (!(this instanceof Unzip))\n return new Unzip(opts);\n Zlib.@call(this, opts, binding.UNZIP);\n }\n function isValidFlushFlag(flag) {\n return flag === binding.Z_NO_FLUSH || flag === binding.Z_PARTIAL_FLUSH || flag === binding.Z_SYNC_FLUSH || flag === binding.Z_FULL_FLUSH || flag === binding.Z_FINISH || flag === binding.Z_BLOCK;\n }\n function Zlib(opts, mode) {\n var _this = this;\n if (this._opts = opts = opts || {}, this._chunkSize = opts.chunkSize || exports.Z_DEFAULT_CHUNK, Transform.@call(this, opts), opts.flush && !isValidFlushFlag(opts.flush))\n throw new Error(\"Invalid flush flag: \" + opts.flush);\n if (opts.finishFlush && !isValidFlushFlag(opts.finishFlush))\n throw new Error(\"Invalid flush flag: \" + opts.finishFlush);\n if (this._flushFlag = opts.flush || binding.Z_NO_FLUSH, this._finishFlushFlag = typeof opts.finishFlush !== \"undefined\" \? opts.finishFlush : binding.Z_FINISH, opts.chunkSize) {\n if (opts.chunkSize < exports.Z_MIN_CHUNK || opts.chunkSize > exports.Z_MAX_CHUNK)\n throw new Error(\"Invalid chunk size: \" + opts.chunkSize);\n }\n if (opts.windowBits) {\n if (opts.windowBits < exports.Z_MIN_WINDOWBITS || opts.windowBits > exports.Z_MAX_WINDOWBITS)\n throw new Error(\"Invalid windowBits: \" + opts.windowBits);\n }\n if (opts.level) {\n if (opts.level < exports.Z_MIN_LEVEL || opts.level > exports.Z_MAX_LEVEL)\n throw new Error(\"Invalid compression level: \" + opts.level);\n }\n if (opts.memLevel) {\n if (opts.memLevel < exports.Z_MIN_MEMLEVEL || opts.memLevel > exports.Z_MAX_MEMLEVEL)\n throw new Error(\"Invalid memLevel: \" + opts.memLevel);\n }\n if (opts.strategy) {\n if (opts.strategy != exports.Z_FILTERED && opts.strategy != exports.Z_HUFFMAN_ONLY && opts.strategy != exports.Z_RLE && opts.strategy != exports.Z_FIXED && opts.strategy != exports.Z_DEFAULT_STRATEGY)\n throw new Error(\"Invalid strategy: \" + opts.strategy);\n }\n if (opts.dictionary) {\n if (!Buffer2.isBuffer(opts.dictionary))\n throw new Error(\"Invalid dictionary: it should be a Buffer instance\");\n }\n this._handle = new binding.Zlib(mode);\n var self = this;\n this._hadError = !1, this._handle.onerror = function(message, errno) {\n _close(self), self._hadError = !0;\n var error = new Error(message);\n error.errno = errno, error.code = exports.codes[errno], self.emit(\"error\", error);\n };\n var level = exports.Z_DEFAULT_COMPRESSION;\n if (typeof opts.level === \"number\")\n level = opts.level;\n var strategy = exports.Z_DEFAULT_STRATEGY;\n if (typeof opts.strategy === \"number\")\n strategy = opts.strategy;\n this._handle.init(opts.windowBits || exports.Z_DEFAULT_WINDOWBITS, level, opts.memLevel || exports.Z_DEFAULT_MEMLEVEL, strategy, opts.dictionary), this._buffer = Buffer2.allocUnsafe(this._chunkSize), this._offset = 0, this._level = level, this._strategy = strategy, this.once(\"end\", this.close), Object.defineProperty(this, \"_closed\", {\n get: function() {\n return !_this._handle;\n },\n configurable: !0,\n enumerable: !0\n });\n }\n util.inherits(Zlib, Transform), Zlib.prototype.params = function(level, strategy, callback) {\n if (level < exports.Z_MIN_LEVEL || level > exports.Z_MAX_LEVEL)\n @throwRangeError(\"Invalid compression level: \" + level);\n if (strategy != exports.Z_FILTERED && strategy != exports.Z_HUFFMAN_ONLY && strategy != exports.Z_RLE && strategy != exports.Z_FIXED && strategy != exports.Z_DEFAULT_STRATEGY)\n @throwTypeError(\"Invalid strategy: \" + strategy);\n if (this._level !== level || this._strategy !== strategy) {\n var self = this;\n this.flush(binding.Z_SYNC_FLUSH, function() {\n if (assert(self._handle, \"zlib binding closed\"), self._handle.params(level, strategy), !self._hadError) {\n if (self._level = level, self._strategy = strategy, callback)\n callback();\n }\n });\n } else\n process.nextTick(callback);\n }, Zlib.prototype.reset = function() {\n return assert(this._handle, \"zlib binding closed\"), this._handle.reset();\n }, Zlib.prototype._flush = function(callback) {\n this._transform(Buffer2.alloc(0), \"\", callback);\n }, Zlib.prototype.flush = function(kind, callback) {\n var _this2 = this, ws = this._writableState;\n if (typeof kind === \"function\" || kind === void 0 && !callback)\n callback = kind, kind = binding.Z_FULL_FLUSH;\n if (ws.ended) {\n if (callback)\n process.nextTick(callback);\n } else if (ws.ending) {\n if (callback)\n this.once(\"end\", callback);\n } else if (ws.needDrain) {\n if (callback)\n this.once(\"drain\", function() {\n return _this2.flush(kind, callback);\n });\n } else\n this._flushFlag = kind, this.write(Buffer2.alloc(0), \"\", callback);\n }, Zlib.prototype.close = function(callback) {\n _close(this, callback), process.nextTick(emitCloseNT, this);\n };\n function _close(engine, callback) {\n if (callback)\n process.nextTick(callback);\n if (!engine._handle)\n return;\n engine._handle.close(), engine._handle = null;\n }\n function emitCloseNT(self) {\n self.emit(\"close\");\n }\n Zlib.prototype._transform = function(chunk, encoding, cb) {\n var flushFlag, ws = this._writableState, ending = ws.ending || ws.ended, last = ending && (!chunk || ws.length === chunk.length);\n if (chunk !== null && !Buffer2.isBuffer(chunk))\n return cb(new Error(\"invalid input\"));\n if (!this._handle)\n return cb(new Error(\"zlib binding closed\"));\n if (last)\n flushFlag = this._finishFlushFlag;\n else if (flushFlag = this._flushFlag, chunk.length >= ws.length)\n this._flushFlag = this._opts.flush || binding.Z_NO_FLUSH;\n this._processChunk(chunk, flushFlag, cb);\n }, Zlib.prototype._processChunk = function(chunk, flushFlag, cb) {\n var availInBefore = chunk && chunk.length, availOutBefore = this._chunkSize - this._offset, inOff = 0, self = this, async = typeof cb === \"function\";\n if (!async) {\n var buffers = [], nread = 0, error;\n this.on(\"error\", function(er) {\n error = er;\n }), assert(this._handle, \"zlib binding closed\");\n do\n var res = this._handle.writeSync(flushFlag, chunk, inOff, availInBefore, this._buffer, this._offset, availOutBefore);\n while (!this._hadError && callback(res[0], res[1]));\n if (this._hadError)\n throw error;\n if (nread >= kMaxLength)\n _close(this), @throwRangeError(kRangeErrorMessage);\n var buf = Buffer2.concat(buffers, nread);\n return _close(this), buf;\n }\n assert(this._handle, \"zlib binding closed\");\n var req = this._handle.write(flushFlag, chunk, inOff, availInBefore, this._buffer, this._offset, availOutBefore);\n req.buffer = chunk, req.callback = callback;\n function callback(availInAfter, availOutAfter) {\n if (this)\n this.buffer = null, this.callback = null;\n if (self._hadError)\n return;\n var have = availOutBefore - availOutAfter;\n if (assert(have >= 0, \"have should not go down\"), have > 0) {\n var out = self._buffer.slice(self._offset, self._offset + have);\n if (self._offset += have, async)\n self.push(out);\n else\n buffers.push(out), nread += out.length;\n }\n if (availOutAfter === 0 || self._offset >= self._chunkSize)\n availOutBefore = self._chunkSize, self._offset = 0, self._buffer = Buffer2.allocUnsafe(self._chunkSize);\n if (availOutAfter === 0) {\n if (inOff += availInBefore - availInAfter, availInBefore = availInAfter, !async)\n return !0;\n var newReq = self._handle.write(flushFlag, chunk, inOff, availInBefore, self._buffer, self._offset, self._chunkSize);\n newReq.callback = callback, newReq.buffer = chunk;\n return;\n }\n if (!async)\n return !1;\n cb();\n }\n }, util.inherits(Deflate, Zlib), util.inherits(Inflate, Zlib), util.inherits(Gzip, Zlib), util.inherits(Gunzip, Zlib), util.inherits(DeflateRaw, Zlib), util.inherits(InflateRaw, Zlib), util.inherits(Unzip, Zlib);\n }\n});\nreturn require_lib()})\n"); -// - -// -static constexpr ASCIILiteral ThirdpartyDepdCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/thirdparty/depd.ts\nvar wrapfunction = function(fn, message) {\n if (typeof fn !== \"function\")\n @throwTypeError(\"argument fn must be a function\");\n return fn;\n}, wrapproperty = function(obj, prop, message) {\n if (!obj || typeof obj !== \"object\" && typeof obj !== \"function\")\n @throwTypeError(\"argument obj must be object\");\n var descriptor = Object.getOwnPropertyDescriptor(obj, prop);\n if (!descriptor)\n @throwTypeError(\"must call property on owner object\");\n if (!descriptor.configurable)\n @throwTypeError(\"property must be configurable\");\n}, $;\n$ = function depd(namespace) {\n if (!namespace)\n @throwTypeError(\"argument namespace is required\");\n function deprecate(message) {\n }\n return deprecate._file = void 0, deprecate._ignored = !0, deprecate._namespace = namespace, deprecate._traced = !1, deprecate._warned = Object.create(null), deprecate.function = wrapfunction, deprecate.property = wrapproperty, deprecate;\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral ThirdpartyDetectLibcCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/thirdparty/detect-libc.ts\nvar family = function() {\n return @Promise.resolve(familySync());\n}, familySync = function() {\n return null;\n}, version = function() {\n return @Promise.resolve(versionSync());\n}, versionSync = function() {\n return null;\n}, isNonGlibcLinuxSync = function() {\n return !1;\n}, isNonGlibcLinux = function() {\n return @Promise.resolve(isNonGlibcLinuxSync());\n}, $, GLIBC = \"glibc\", MUSL = \"musl\";\n$ = {\n GLIBC,\n MUSL,\n family,\n familySync,\n isNonGlibcLinux,\n isNonGlibcLinuxSync,\n version,\n versionSync\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral ThirdpartyDetectLibcLinuxCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/thirdparty/detect-libc.linux.ts\nvar family = function() {\n return @Promise.resolve(familySync());\n}, familySync = function() {\n return GLIBC;\n}, version = function() {\n return @Promise.resolve(versionSync());\n}, versionSync = function() {\n return \"2.29\";\n}, isNonGlibcLinuxSync = function() {\n return !1;\n}, isNonGlibcLinux = function() {\n return @Promise.resolve(isNonGlibcLinuxSync());\n}, $, GLIBC = \"glibc\", MUSL = \"musl\";\n$ = {\n GLIBC,\n MUSL,\n family,\n familySync,\n isNonGlibcLinux,\n isNonGlibcLinuxSync,\n version,\n versionSync\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral ThirdpartyIsomorphicFetchCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/thirdparty/isomorphic-fetch.ts\nvar bunFetch = Bun.fetch, fetch = (...args) => bunFetch(...args);\nfetch.default = fetch;\nfetch.fetch = fetch;\nreturn fetch})\n"); -// - -// -static constexpr ASCIILiteral ThirdpartyNodeFetchCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/thirdparty/node-fetch.ts\nasync function fetch(url, init) {\n let body = init\?.body;\n if (body) {\n const chunks = [];\n if (body instanceof Readable) {\n for await (let chunk of body)\n chunks.push(chunk);\n init = { ...init, body: new Blob(chunks) };\n }\n }\n const response = await nativeFetch(url, init);\n return Object.setPrototypeOf(response, Response.prototype), response;\n}\nvar blobFrom = function(path, options) {\n return @Promise.resolve(Bun.file(path, options));\n}, blobFromSync = function(path, options) {\n return Bun.file(path, options);\n}, isRedirect = function(code) {\n return code === 301 || code === 302 || code === 303 || code === 307 || code === 308;\n}, $, { Headers, Request, Response: WebResponse, Blob, File = Blob, FormData } = globalThis, nativeFetch = Bun.fetch, { Readable } = @getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39);\n\nclass Response extends WebResponse {\n constructor() {\n super(...arguments);\n }\n _body;\n get body() {\n return this._body \?\? (this._body = Readable.fromWeb(super.body));\n }\n}\n\nclass AbortError extends DOMException {\n constructor(message) {\n super(message, \"AbortError\");\n }\n}\n\nclass FetchBaseError extends Error {\n type;\n constructor(message, type) {\n super(message);\n this.type = type;\n }\n}\n\nclass FetchError extends FetchBaseError {\n constructor(message, type, systemError) {\n super(message, type);\n this.code = systemError\?.code;\n }\n}\nvar fileFrom = blobFrom, fileFromSync = blobFromSync;\n$ = Object.assign(fetch, {\n AbortError,\n Blob,\n FetchBaseError,\n FetchError,\n File,\n FormData,\n Headers,\n Request,\n Response,\n blobFrom,\n blobFromSync,\n fileFrom,\n fileFromSync,\n isRedirect,\n fetch,\n default: fetch\n});\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral ThirdpartyUndiciCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/thirdparty/undici.ts\nvar notImplemented = function() {\n throw new Error(\"Not implemented in bun\");\n};\nasync function request(url, options = {\n method: \"GET\",\n signal: null,\n headers: null,\n query: null,\n reset: !1,\n throwOnError: !1,\n body: null\n}) {\n let {\n method = \"GET\",\n headers: inputHeaders,\n query,\n signal,\n reset = !1,\n throwOnError = !1,\n body: inputBody,\n maxRedirections\n } = options;\n if (typeof url === \"string\") {\n if (query)\n url = new URL(url);\n } else if (typeof url === \"object\" && url !== null) {\n if (!(url instanceof URL))\n throw new Error(\"not implemented\");\n } else\n @throwTypeError(\"url must be a string, URL, or UrlObject\");\n if (typeof url === \"string\" && query)\n url = new URL(url);\n if (typeof url === \"object\" && url !== null && query) {\n if (query)\n url.search = new URLSearchParams(query).toString();\n }\n if (method = method && typeof method === \"string\" \? method.toUpperCase() : null, inputBody && (method === \"GET\" || method === \"HEAD\"))\n throw new Error(\"Body not allowed for GET or HEAD requests\");\n if (inputBody && inputBody.read && inputBody instanceof Readable) {\n let data = \"\";\n inputBody.setEncoding(\"utf8\");\n for await (let chunk of stream)\n data += chunk;\n inputBody = (new TextEncoder()).encode(data);\n }\n if (maxRedirections !== @undefined && Number.isNaN(maxRedirections))\n throw new Error(\"maxRedirections must be a number if defined\");\n if (signal && !(signal instanceof @AbortSignal))\n throw new Error(\"signal must be an instance of AbortSignal\");\n let resp;\n const {\n status: statusCode,\n headers,\n trailers\n } = resp = await fetch(url, {\n signal,\n mode: \"cors\",\n method,\n headers: inputHeaders || kEmptyObject,\n body: inputBody,\n redirect: maxRedirections === \"undefined\" || maxRedirections > 0 \? \"follow\" : \"manual\",\n keepalive: !reset\n });\n if (throwOnError && statusCode >= 400 && statusCode < 600)\n throw new Error(`Request failed with status code ${statusCode}`);\n const body = resp.body \? new BodyReadable(resp) : null;\n return { statusCode, headers: headers.toJSON(), body, trailers, opaque: kEmptyObject, context: kEmptyObject };\n}\nvar stream = function() {\n throw new Error(\"Not implemented in bun\");\n}, pipeline = function() {\n throw new Error(\"Not implemented in bun\");\n}, connect = function() {\n throw new Error(\"Not implemented in bun\");\n}, upgrade = function() {\n throw new Error(\"Not implemented in bun\");\n}, mockErrors = function() {\n throw new Error(\"Not implemented in bun\");\n}, Undici = function() {\n throw new Error(\"Not implemented in bun\");\n}, $, EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20), StreamModule = @getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39), { Readable } = StreamModule, { _ReadableFromWebForUndici: ReadableFromWeb } = StreamModule[Symbol.for(\"::bunternal::\")], ObjectCreate = Object.create, kEmptyObject = ObjectCreate(null), fetch = Bun.fetch, Response = globalThis.Response, Headers = globalThis.Headers, Request = globalThis.Request, URLSearchParams = globalThis.URLSearchParams, URL = globalThis.URL;\n\nclass File extends Blob {\n constructor() {\n super(...arguments);\n }\n}\n\nclass FileReader extends EventTarget {\n constructor() {\n throw new Error(\"Not implemented yet!\");\n }\n}\nvar FormData = globalThis.FormData;\n\nclass BodyReadable extends ReadableFromWeb {\n #response;\n #bodyUsed;\n constructor(response, options = {}) {\n var { body } = response;\n if (!body)\n throw new Error(\"Response body is null\");\n super(options, body);\n this.#response = response, this.#bodyUsed = response.bodyUsed;\n }\n get bodyUsed() {\n return this.#bodyUsed;\n }\n #consume() {\n if (this.#bodyUsed)\n @throwTypeError(\"unusable\");\n this.#bodyUsed = !0;\n }\n async arrayBuffer() {\n return this.#consume(), await this.#response.arrayBuffer();\n }\n async blob() {\n return this.#consume(), await this.#response.blob();\n }\n async formData() {\n return this.#consume(), await this.#response.formData();\n }\n async json() {\n return this.#consume(), await this.#response.json();\n }\n async text() {\n return this.#consume(), await this.#response.text();\n }\n}\n\nclass MockClient {\n constructor() {\n throw new Error(\"Not implemented in bun\");\n }\n}\n\nclass MockPool {\n constructor() {\n throw new Error(\"Not implemented in bun\");\n }\n}\n\nclass MockAgent {\n constructor() {\n throw new Error(\"Not implemented in bun\");\n }\n}\n\nclass Dispatcher extends EventEmitter {\n constructor() {\n super(...arguments);\n }\n}\n\nclass Agent extends Dispatcher {\n constructor() {\n super(...arguments);\n }\n}\n\nclass Pool extends Dispatcher {\n constructor() {\n super(...arguments);\n }\n request() {\n throw new Error(\"Not implemented in bun\");\n }\n}\n\nclass BalancedPool extends Dispatcher {\n constructor() {\n super(...arguments);\n }\n}\n\nclass Client extends Dispatcher {\n constructor() {\n super(...arguments);\n }\n request() {\n throw new Error(\"Not implemented in bun\");\n }\n}\nUndici.Dispatcher = Dispatcher;\nUndici.Pool = Pool;\nUndici.BalancedPool = BalancedPool;\nUndici.Client = Client;\nUndici.Agent = Agent;\nUndici.buildConnector = Undici.errors = Undici.setGlobalDispatcher = Undici.getGlobalDispatcher = Undici.request = Undici.stream = Undici.pipeline = Undici.connect = Undici.upgrade = Undici.MockClient = Undici.MockPool = Undici.MockAgent = Undici.mockErrors = notImplemented;\nUndici.fetch = fetch;\n$ = {\n fetch,\n Response,\n Headers,\n Request,\n URLSearchParams,\n URL,\n File,\n FileReader,\n FormData,\n request,\n stream,\n pipeline,\n connect,\n upgrade,\n MockClient,\n MockPool,\n MockAgent,\n mockErrors,\n Dispatcher,\n Pool,\n BalancedPool,\n Client,\n Agent,\n Undici\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral ThirdpartyVercelFetchCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/thirdparty/vercel_fetch.ts\nvar $;\n$ = (wrapper = Bun.fetch) => {\n async function vercelFetch(url, opts = {}) {\n if (opts.body && typeof opts.body === \"object\" && (!(\"buffer\" in opts.body) || typeof opts.body.buffer !== \"object\" || !(opts.body.buffer instanceof @ArrayBuffer))) {\n if (opts.body = JSON.stringify(opts.body), !opts.headers)\n opts.headers = new Headers;\n opts.headers.set(\"Content-Type\", \"application/json\");\n }\n try {\n return await wrapper(url, opts);\n } catch (err) {\n if (typeof err === \"string\")\n err = new Error(err);\n throw err.url = url, err.opts = opts, err;\n }\n }\n return vercelFetch.default = vercelFetch, vercelFetch;\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral ThirdpartyWSCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/thirdparty/ws.ts\nvar emitWarning = function(type, message) {\n if (emittedWarnings.has(type))\n return;\n emittedWarnings.add(type), console.warn(\"[bun] Warning:\", message);\n}, subprotocolParse = function(header) {\n const protocols = new Set;\n let start = -1, end = -1, i = 0;\n for (i;i < header.length; i++) {\n const code = header.charCodeAt(i);\n if (end === -1 && wsTokenChars[code] === 1) {\n if (start === -1)\n start = i;\n } else if (i !== 0 && (code === 32 || code === 9)) {\n if (end === -1 && start !== -1)\n end = i;\n } else if (code === 44) {\n if (start === -1)\n throw new SyntaxError(`Unexpected character at index ${i}`);\n if (end === -1)\n end = i;\n const protocol2 = header.slice(start, end);\n if (protocols.has(protocol2))\n throw new SyntaxError(`The \"${protocol2}\" subprotocol is duplicated`);\n protocols.add(protocol2), start = end = -1;\n } else\n throw new SyntaxError(`Unexpected character at index ${i}`);\n }\n if (start === -1 || end !== -1)\n throw new SyntaxError(\"Unexpected end of input\");\n const protocol = header.slice(start, i);\n if (protocols.has(protocol))\n throw new SyntaxError(`The \"${protocol}\" subprotocol is duplicated`);\n return protocols.add(protocol), protocols;\n}, wsEmitClose = function(server) {\n server._state = CLOSED, server.emit(\"close\");\n}, abortHandshake = function(response, code, message, headers) {\n message = message || http.STATUS_CODES[code], headers = {\n Connection: \"close\",\n \"Content-Type\": \"text/html\",\n \"Content-Length\": @Buffer.byteLength(message),\n ...headers\n }, response.writeHead(code, headers), response.write(message), response.end();\n}, abortHandshakeOrEmitwsClientError = function(server, req, response, socket, code, message) {\n if (server.listenerCount(\"wsClientError\")) {\n const err = new Error(message);\n Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError), server.emit(\"wsClientError\", err, socket, req);\n } else\n abortHandshake(response, code, message);\n}, $, EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20), http = @getInternalField(@internalModuleRegistry, 23) || @createInternalModuleById(23), kBunInternals = Symbol.for(\"::bunternal::\"), readyStates = [\"CONNECTING\", \"OPEN\", \"CLOSING\", \"CLOSED\"], encoder = new TextEncoder, eventIds = {\n open: 1,\n close: 2,\n message: 3,\n error: 4,\n ping: 5,\n pong: 6\n}, emittedWarnings = new Set;\n\nclass BunWebSocket extends EventEmitter {\n static CONNECTING = 0;\n static OPEN = 1;\n static CLOSING = 2;\n static CLOSED = 3;\n #ws;\n #paused = !1;\n #fragments = !1;\n #binaryType = \"nodebuffer\";\n #eventId = 0;\n constructor(url, protocols, options) {\n super();\n let ws = this.#ws = new WebSocket(url, protocols);\n ws.binaryType = \"nodebuffer\";\n }\n on(event, listener) {\n if (event === \"unexpected-response\" || event === \"upgrade\" || event === \"redirect\")\n emitWarning(event, \"ws.WebSocket '\" + event + \"' event is not implemented in bun\");\n const mask = 1 << eventIds[event];\n if (mask && (this.#eventId & mask) !== mask) {\n if (this.#eventId |= mask, event === \"open\")\n this.#ws.addEventListener(\"open\", () => {\n this.emit(\"open\");\n });\n else if (event === \"close\")\n this.#ws.addEventListener(\"close\", ({ code, reason, wasClean }) => {\n this.emit(\"close\", code, reason, wasClean);\n });\n else if (event === \"message\")\n this.#ws.addEventListener(\"message\", ({ data }) => {\n const isBinary = typeof data !== \"string\";\n if (isBinary)\n this.emit(\"message\", this.#fragments \? [data] : data, isBinary);\n else {\n let encoded = encoder.encode(data);\n if (this.#binaryType !== \"arraybuffer\")\n encoded = @Buffer.from(encoded.buffer, encoded.byteOffset, encoded.byteLength);\n this.emit(\"message\", this.#fragments \? [encoded] : encoded, isBinary);\n }\n });\n else if (event === \"error\")\n this.#ws.addEventListener(\"error\", (err) => {\n this.emit(\"error\", err);\n });\n else if (event === \"ping\")\n this.#ws.addEventListener(\"ping\", ({ data }) => {\n this.emit(\"ping\", data);\n });\n else if (event === \"pong\")\n this.#ws.addEventListener(\"pong\", ({ data }) => {\n this.emit(\"pong\", data);\n });\n }\n return super.on(event, listener);\n }\n send(data, opts, cb) {\n try {\n this.#ws.send(data, opts\?.compress);\n } catch (error) {\n typeof cb === \"function\" && cb(error);\n return;\n }\n typeof cb === \"function\" && cb();\n }\n close(code, reason) {\n this.#ws.close(code, reason);\n }\n terminate() {\n this.#ws.terminate();\n }\n get url() {\n return this.#ws.url;\n }\n get readyState() {\n return this.#ws.readyState;\n }\n get binaryType() {\n return this.#binaryType;\n }\n set binaryType(value) {\n if (value === \"nodebuffer\" || value === \"arraybuffer\")\n this.#ws.binaryType = this.#binaryType = value, this.#fragments = !1;\n else if (value === \"fragments\")\n this.#ws.binaryType = \"nodebuffer\", this.#binaryType = \"fragments\", this.#fragments = !0;\n else\n throw new Error(`Invalid binaryType: ${value}`);\n }\n get protocol() {\n return this.#ws.protocol;\n }\n get extensions() {\n return this.#ws.extensions;\n }\n addEventListener(type, listener, options) {\n this.#ws.addEventListener(type, listener, options);\n }\n removeEventListener(type, listener) {\n this.#ws.removeEventListener(type, listener);\n }\n get onopen() {\n return this.#ws.onopen;\n }\n set onopen(value) {\n this.#ws.onopen = value;\n }\n get onerror() {\n return this.#ws.onerror;\n }\n set onerror(value) {\n this.#ws.onerror = value;\n }\n get onclose() {\n return this.#ws.onclose;\n }\n set onclose(value) {\n this.#ws.onclose = value;\n }\n get onmessage() {\n return this.#ws.onmessage;\n }\n set onmessage(value) {\n this.#ws.onmessage = value;\n }\n get bufferedAmount() {\n return this.#ws.bufferedAmount;\n }\n get isPaused() {\n return this.#paused;\n }\n ping(data, mask, cb) {\n if (typeof data === \"function\")\n cb = data, data = mask = @undefined;\n else if (typeof mask === \"function\")\n cb = mask, mask = @undefined;\n if (typeof data === \"number\")\n data = data.toString();\n try {\n this.#ws.ping(data);\n } catch (error) {\n typeof cb === \"function\" && cb(error);\n return;\n }\n typeof cb === \"function\" && cb();\n }\n pong(data, mask, cb) {\n if (typeof data === \"function\")\n cb = data, data = mask = @undefined;\n else if (typeof mask === \"function\")\n cb = mask, mask = @undefined;\n if (typeof data === \"number\")\n data = data.toString();\n try {\n this.#ws.pong(data);\n } catch (error) {\n typeof cb === \"function\" && cb(error);\n return;\n }\n typeof cb === \"function\" && cb();\n }\n pause() {\n switch (this.readyState) {\n case WebSocket.CONNECTING:\n case WebSocket.CLOSED:\n return;\n }\n this.#paused = !0, emitWarning(\"pause()\", \"ws.WebSocket.pause() is not implemented in bun\");\n }\n resume() {\n switch (this.readyState) {\n case WebSocket.CONNECTING:\n case WebSocket.CLOSED:\n return;\n }\n this.#paused = !1, emitWarning(\"resume()\", \"ws.WebSocket.resume() is not implemented in bun\");\n }\n}\nObject.defineProperty(BunWebSocket, \"name\", { value: \"WebSocket\" });\nvar wsKeyRegex = /^[+/0-9A-Za-z]{22}==$/, wsTokenChars = [\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 1,\n 1,\n 1,\n 1,\n 1,\n 0,\n 0,\n 1,\n 1,\n 0,\n 1,\n 1,\n 0,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 0,\n 0,\n 0,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 0,\n 1,\n 0,\n 1,\n 0\n], RUNNING = 0, CLOSING = 1, CLOSED = 2;\n\nclass BunWebSocketMocked extends EventEmitter {\n #ws;\n #state;\n #enquedMessages = [];\n #url;\n #protocol;\n #extensions;\n #bufferedAmount = 0;\n #binaryType = \"arraybuffer\";\n #onclose;\n #onerror;\n #onmessage;\n #onopen;\n constructor(url, protocol, extensions, binaryType) {\n super();\n if (this.#ws = null, this.#state = 0, this.#url = url, this.#bufferedAmount = 0, binaryType = binaryType || \"arraybuffer\", binaryType !== \"nodebuffer\" && binaryType !== \"blob\" && binaryType !== \"arraybuffer\")\n @throwTypeError(\"binaryType must be either 'blob', 'arraybuffer' or 'nodebuffer'\");\n this.#binaryType = binaryType, this.#protocol = protocol, this.#extensions = extensions;\n const message = this.#message.bind(this), open = this.#open.bind(this), close = this.#close.bind(this), drain = this.#drain.bind(this);\n this[kBunInternals] = {\n message,\n open,\n close,\n drain\n };\n }\n #message(ws, message) {\n this.#ws = ws;\n let isBinary = !1;\n if (typeof message === \"string\")\n if (this.#binaryType === \"arraybuffer\")\n message = encoder.encode(message).buffer;\n else if (this.#binaryType === \"blob\")\n message = new Blob([message], { type: \"text/plain\" });\n else\n message = @Buffer.from(message);\n else if (isBinary = !0, this.#binaryType !== \"nodebuffer\") {\n if (this.#binaryType === \"arraybuffer\")\n message = new @Uint8Array(message);\n else if (this.#binaryType === \"blob\")\n message = new Blob([message]);\n }\n this.emit(\"message\", message, isBinary);\n }\n #open(ws) {\n this.#ws = ws, this.#state = 1, this.emit(\"open\", this), this.#drain(ws);\n }\n #close(ws, code, reason) {\n this.#state = 3, this.#ws = null, this.emit(\"close\", code, reason);\n }\n #drain(ws) {\n const chunk = this.#enquedMessages[0];\n if (chunk) {\n const [data, compress, cb] = chunk;\n if (ws.send(data, compress) == -1)\n return;\n typeof cb === \"function\" && cb(), this.#bufferedAmount -= chunk.length, this.#enquedMessages.shift();\n }\n }\n send(data, opts, cb) {\n if (this.#state === 1) {\n const compress = opts\?.compress;\n if (this.#ws.send(data, compress) == -1) {\n this.#enquedMessages.push([data, compress, cb]), this.#bufferedAmount += data.length;\n return;\n }\n typeof cb === \"function\" && cb();\n } else if (this.#state === 0)\n this.#enquedMessages.push([data, opts\?.compress, cb]), this.#bufferedAmount += data.length;\n }\n close(code, reason) {\n if (this.#state === 1)\n this.#state = 2, this.#ws.close(code, reason);\n }\n get binaryType() {\n return this.#binaryType;\n }\n set binaryType(type) {\n if (type !== \"nodebuffer\" && type !== \"blob\" && type !== \"arraybuffer\")\n @throwTypeError(\"binaryType must be either 'blob', 'arraybuffer' or 'nodebuffer'\");\n this.#binaryType = type;\n }\n get readyState() {\n return this.#state;\n }\n get url() {\n return this.#url;\n }\n get protocol() {\n return this.#protocol;\n }\n get extensions() {\n return this.#extensions;\n }\n get bufferedAmount() {\n return this.#bufferedAmount \?\? 0;\n }\n setSocket(socket, head, options) {\n throw new Error(\"Not implemented\");\n }\n set onclose(cb) {\n if (this.#onclose)\n this.removeListener(\"close\", this.#onclose);\n this.on(\"close\", cb), this.#onclose = cb;\n }\n set onerror(cb) {\n if (this.#onerror)\n this.removeListener(\"error\", this.#onerror);\n this.on(\"error\", cb), this.#onerror = cb;\n }\n set onmessage(cb) {\n if (this.#onmessage)\n this.removeListener(\"message\", this.#onmessage);\n this.on(\"message\", cb), this.#onmessage = cb;\n }\n set onopen(cb) {\n if (this.#onopen)\n this.removeListener(\"open\", this.#onopen);\n this.on(\"open\", cb), this.#onopen = cb;\n }\n get onclose() {\n return this.#onclose;\n }\n get onerror() {\n return this.#onerror;\n }\n get onmessage() {\n return this.#onmessage;\n }\n get onopen() {\n return this.#onopen;\n }\n addEventListener(type, listener, options) {\n if (type === \"message\") {\n const l = (data) => listener({ data });\n l.listener = listener, this.on(type, l);\n return;\n }\n this.on(type, listener);\n }\n removeEventListener(type, listener) {\n this.off(type, listener);\n }\n}\n\nclass WebSocketServer extends EventEmitter {\n _server;\n options;\n clients;\n _shouldEmitClose;\n _state;\n _removeListeners;\n constructor(options, callback) {\n super();\n if (options = {\n maxPayload: 104857600,\n skipUTF8Validation: !1,\n perMessageDeflate: !1,\n handleProtocols: null,\n clientTracking: !0,\n verifyClient: null,\n noServer: !1,\n backlog: null,\n server: null,\n host: null,\n path: null,\n port: null,\n ...options\n }, options.port == null && !options.server && !options.noServer || options.port != null && (options.server || options.noServer) || options.server && options.noServer)\n @throwTypeError('One and only one of the \"port\", \"server\", or \"noServer\" options must be specified');\n if (options.port != null)\n this._server = http.createServer((req, res) => {\n const body = http.STATUS_CODES[426];\n res.writeHead(426, {\n \"Content-Length\": body.length,\n \"Content-Type\": \"text/plain\"\n }), res.end(body);\n }), this._server.listen(options.port, options.host, options.backlog, callback);\n else if (options.server)\n this._server = options.server;\n if (this._server) {\n const emitConnection = this.emit.bind(this, \"connection\"), emitListening = this.emit.bind(this, \"listening\"), emitError = this.emit.bind(this, \"error\"), doUpgrade = (req, socket, head) => {\n this.handleUpgrade(req, socket, head, emitConnection);\n };\n this._server.on(\"listening\", emitListening), this._server.on(\"error\", emitError), this._server.on(\"upgrade\", doUpgrade), this._removeListeners = () => {\n this._server.removeListener(\"upgrade\", doUpgrade), this._server.removeListener(\"listening\", emitListening), this._server.removeListener(\"error\", emitError);\n };\n }\n if (options.perMessageDeflate === !0)\n options.perMessageDeflate = {};\n if (options.clientTracking)\n this.clients = new Set, this._shouldEmitClose = !1;\n this.options = options, this._state = RUNNING;\n }\n address() {\n if (this.options.noServer)\n throw new Error('The server is operating in \"noServer\" mode');\n if (!this._server)\n return null;\n return this._server.address();\n }\n close(cb) {\n if (this._state === CLOSED) {\n if (cb)\n this.once(\"close\", () => {\n cb(new Error(\"The server is not running\"));\n });\n process.nextTick((server) => {\n server._state = CLOSED, server.emit(\"close\");\n }, this);\n return;\n }\n if (cb)\n this.once(\"close\", cb);\n if (this._state === CLOSING)\n return;\n if (this._state = CLOSING, this.options.noServer || this.options.server) {\n if (this._server)\n this._removeListeners(), this._removeListeners = this._server = null;\n if (this.clients)\n if (!this.clients.size)\n process.nextTick((server) => {\n server._state = CLOSED, server.emit(\"close\");\n }, this);\n else\n this._shouldEmitClose = !0;\n else\n process.nextTick((server) => {\n server._state = CLOSED, server.emit(\"close\");\n }, this);\n } else {\n const server = this._server;\n this._removeListeners(), this._removeListeners = this._server = null, server.close(() => {\n this._state = CLOSED, this.emit(\"close\");\n });\n }\n }\n shouldHandle(req) {\n if (this.options.path) {\n const index = req.url.indexOf(\"\?\");\n if ((index !== -1 \? req.url.slice(0, index) : req.url) !== this.options.path)\n return !1;\n }\n return !0;\n }\n completeUpgrade(extensions, key, protocols, request, socket, head, cb) {\n const [server, response, req] = socket[kBunInternals];\n if (this._state > RUNNING)\n return abortHandshake(response, 503);\n let protocol = \"\";\n if (protocols.size)\n protocol = this.options.handleProtocols \? this.options.handleProtocols(protocols, request) : protocols.values().next().value;\n const ws = new BunWebSocketMocked(request.url, protocol, extensions, \"nodebuffer\"), headers = [\"HTTP/1.1 101 Switching Protocols\", \"Upgrade: websocket\", \"Connection: Upgrade\"];\n if (this.emit(\"headers\", headers, request), server.upgrade(req, {\n data: ws[kBunInternals]\n })) {\n if (response._reply(@undefined), this.clients)\n this.clients.add(ws), ws.on(\"close\", () => {\n if (this.clients.delete(ws), this._shouldEmitClose && !this.clients.size)\n process.nextTick(wsEmitClose, this);\n });\n cb(ws, request);\n } else\n abortHandshake(response, 500);\n }\n handleUpgrade(req, socket, head, cb) {\n const [_, response] = socket[kBunInternals], key = req.headers[\"sec-websocket-key\"], version = +req.headers[\"sec-websocket-version\"];\n if (req.method !== \"GET\") {\n abortHandshakeOrEmitwsClientError(this, req, response, socket, 405, \"Invalid HTTP method\");\n return;\n }\n if (req.headers.upgrade.toLowerCase() !== \"websocket\") {\n abortHandshakeOrEmitwsClientError(this, req, response, socket, 400, \"Invalid Upgrade header\");\n return;\n }\n if (!key || !wsKeyRegex.test(key)) {\n abortHandshakeOrEmitwsClientError(this, req, response, socket, 400, \"Missing or invalid Sec-WebSocket-Key header\");\n return;\n }\n if (version !== 8 && version !== 13) {\n abortHandshakeOrEmitwsClientError(this, req, response, socket, 400, \"Missing or invalid Sec-WebSocket-Version header\");\n return;\n }\n if (!this.shouldHandle(req)) {\n abortHandshake(response, 400);\n return;\n }\n const secWebSocketProtocol = req.headers[\"sec-websocket-protocol\"];\n let protocols = new Set;\n if (secWebSocketProtocol !== @undefined)\n try {\n protocols = subprotocolParse(secWebSocketProtocol);\n } catch (err) {\n abortHandshakeOrEmitwsClientError(this, req, response, socket, 400, \"Invalid Sec-WebSocket-Protocol header\");\n return;\n }\n const extensions = {};\n if (this.options.verifyClient) {\n const info = {\n origin: req.headers[`${version === 8 \? \"sec-websocket-origin\" : \"origin\"}`],\n secure: !!(req.socket.authorized || req.socket.encrypted),\n req\n };\n if (this.options.verifyClient.length === 2) {\n this.options.verifyClient(info, (verified, code, message, headers) => {\n if (!verified)\n return abortHandshake(response, code || 401, message, headers);\n this.completeUpgrade(extensions, key, protocols, req, socket, head, cb);\n });\n return;\n }\n if (!this.options.verifyClient(info))\n return abortHandshake(response, 401);\n }\n this.completeUpgrade(extensions, key, protocols, req, socket, head, cb);\n }\n}\nObject.defineProperty(BunWebSocket, \"CONNECTING\", {\n enumerable: !0,\n value: readyStates.indexOf(\"CONNECTING\")\n});\nObject.defineProperty(BunWebSocket.prototype, \"CONNECTING\", {\n enumerable: !0,\n value: readyStates.indexOf(\"CONNECTING\")\n});\nObject.defineProperty(BunWebSocket, \"OPEN\", {\n enumerable: !0,\n value: readyStates.indexOf(\"OPEN\")\n});\nObject.defineProperty(BunWebSocket.prototype, \"OPEN\", {\n enumerable: !0,\n value: readyStates.indexOf(\"OPEN\")\n});\nObject.defineProperty(BunWebSocket, \"CLOSING\", {\n enumerable: !0,\n value: readyStates.indexOf(\"CLOSING\")\n});\nObject.defineProperty(BunWebSocket.prototype, \"CLOSING\", {\n enumerable: !0,\n value: readyStates.indexOf(\"CLOSING\")\n});\nObject.defineProperty(BunWebSocket, \"CLOSED\", {\n enumerable: !0,\n value: readyStates.indexOf(\"CLOSED\")\n});\nObject.defineProperty(BunWebSocket.prototype, \"CLOSED\", {\n enumerable: !0,\n value: readyStates.indexOf(\"CLOSED\")\n});\n\nclass Sender {\n constructor() {\n throw new Error(\"Not supported yet in Bun\");\n }\n}\n\nclass Receiver {\n constructor() {\n throw new Error(\"Not supported yet in Bun\");\n }\n}\nvar createWebSocketStream = (ws) => {\n throw new Error(\"Not supported yet in Bun\");\n};\n$ = Object.assign(BunWebSocket, {\n createWebSocketStream,\n Receiver,\n Sender,\n WebSocket: BunWebSocket,\n Server: WebSocketServer,\n WebSocketServer\n});\nreturn $})\n"); -// - - #else - // Not 100% accurate, but basically inlining linux on non-windows non-mac platforms. - // -static constexpr ASCIILiteral BunFFICode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/bun/ffi.ts\nvar FFIBuilder = function(params, returnType, functionToCall, name) {\n const hasReturnType = typeof FFIType[returnType] === \"number\" && FFIType[returnType] !== FFIType.void;\n var paramNames = new @Array(params.length), args = new @Array(params.length);\n for (let i = 0;i < params.length; i++) {\n paramNames[i] = `p${i}`;\n const wrapper = ffiWrappers[FFIType[params[i]]];\n if (wrapper)\n args[i] = `(val=>${wrapper})(p${i})`;\n else\n @throwTypeError(`Unsupported type ${params[i]}. Must be one of: ${Object.keys(FFIType).sort().join(\", \")}`);\n }\n var code = `functionToCall(${args.join(\", \")})`;\n if (hasReturnType)\n if (FFIType[returnType] === FFIType.cstring)\n code = `return new __GlobalBunCString(${code})`;\n else\n code = `return ${code}`;\n var func = new Function(\"functionToCall\", ...paramNames, code);\n Object.defineProperty(func, \"name\", {\n value: name\n });\n var wrap;\n switch (paramNames.length) {\n case 0:\n wrap = () => func(functionToCall);\n break;\n case 1:\n wrap = (arg1) => func(functionToCall, arg1);\n break;\n case 2:\n wrap = (arg1, arg2) => func(functionToCall, arg1, arg2);\n break;\n case 3:\n wrap = (arg1, arg2, arg3) => func(functionToCall, arg1, arg2, arg3);\n break;\n case 4:\n wrap = (arg1, arg2, arg3, arg4) => func(functionToCall, arg1, arg2, arg3, arg4);\n break;\n case 5:\n wrap = (arg1, arg2, arg3, arg4, arg5) => func(functionToCall, arg1, arg2, arg3, arg4, arg5);\n break;\n case 6:\n wrap = (arg1, arg2, arg3, arg4, arg5, arg6) => func(functionToCall, arg1, arg2, arg3, arg4, arg5, arg6);\n break;\n case 7:\n wrap = (arg1, arg2, arg3, arg4, arg5, arg6, arg7) => func(functionToCall, arg1, arg2, arg3, arg4, arg5, arg6, arg7);\n break;\n case 8:\n wrap = (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) => func(functionToCall, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);\n break;\n case 9:\n wrap = (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) => func(functionToCall, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);\n break;\n default: {\n wrap = (...args2) => func(functionToCall, ...args2);\n break;\n }\n }\n return wrap.native = functionToCall, wrap.ptr = functionToCall.ptr, wrap;\n}, dlopen = function(path, options) {\n const result = nativeDLOpen(path, options);\n if (result instanceof Error)\n throw result;\n for (let key in result.symbols) {\n var symbol = result.symbols[key];\n if (options[key]\?.args\?.length || FFIType[options[key]\?.returns] === FFIType.cstring)\n result.symbols[key] = FFIBuilder(options[key].args \?\? [], options[key].returns \?\? FFIType.void, symbol, path.includes(\"/\") \? `${key} (${path.split(\"/\").pop()})` : `${key} (${path})`);\n else\n result.symbols[key].native = result.symbols[key];\n }\n return result.close = result.close.bind(result), result;\n}, linkSymbols = function(options) {\n const result = nativeLinkSymbols(options);\n for (let key in result.symbols) {\n var symbol = result.symbols[key];\n if (options[key]\?.args\?.length || FFIType[options[key]\?.returns] === FFIType.cstring)\n result.symbols[key] = FFIBuilder(options[key].args \?\? [], options[key].returns \?\? FFIType.void, symbol, key);\n else\n result.symbols[key].native = result.symbols[key];\n }\n return result;\n}, onCloseCFunction = function(close) {\n close();\n}, CFunction = function(options) {\n const identifier = `CFunction${cFunctionI++}`;\n var result = linkSymbols({\n [identifier]: options\n }), hasClosed = !1, close = result.close.bind(result);\n return result.symbols[identifier].close = () => {\n if (hasClosed || !close)\n return;\n hasClosed = !0, close(), close = @undefined;\n }, cFunctionRegistry ||= new FinalizationRegistry(onCloseCFunction), cFunctionRegistry.register(result.symbols[identifier], result.symbols[identifier].close), result.symbols[identifier];\n}, $, FFIType = {\n \"0\": 0,\n \"1\": 1,\n \"2\": 2,\n \"3\": 3,\n \"4\": 4,\n \"5\": 5,\n \"6\": 6,\n \"7\": 7,\n \"8\": 8,\n \"9\": 9,\n \"10\": 10,\n \"11\": 11,\n \"12\": 12,\n \"13\": 13,\n \"14\": 14,\n \"15\": 15,\n \"16\": 16,\n \"17\": 17,\n bool: 11,\n c_int: 5,\n c_uint: 6,\n char: 0,\n \"char*\": 12,\n double: 9,\n f32: 10,\n f64: 9,\n float: 10,\n i16: 3,\n i32: 5,\n i64: 7,\n i8: 1,\n int: 5,\n int16_t: 3,\n int32_t: 5,\n int64_t: 7,\n int8_t: 1,\n isize: 7,\n u16: 4,\n u32: 6,\n u64: 8,\n u8: 2,\n uint16_t: 4,\n uint32_t: 6,\n uint64_t: 8,\n uint8_t: 2,\n usize: 8,\n \"void*\": 12,\n ptr: 12,\n pointer: 12,\n void: 13,\n cstring: 14,\n i64_fast: 15,\n u64_fast: 16,\n function: 17,\n callback: 17,\n fn: 17\n};\nvar ffi = globalThis.Bun.FFI, ptr = (arg1, arg2) => typeof arg2 === \"undefined\" \? ffi.ptr(arg1) : ffi.ptr(arg1, arg2), toBuffer = ffi.toBuffer, toArrayBuffer = ffi.toArrayBuffer, viewSource = ffi.viewSource, BunCString = ffi.CString, nativeLinkSymbols = ffi.linkSymbols, nativeDLOpen = ffi.dlopen, nativeCallback = ffi.callback, closeCallback = ffi.closeCallback;\ndelete ffi.callback;\ndelete ffi.closeCallback;\n\nclass JSCallback {\n constructor(cb, options) {\n const { ctx, ptr: ptr2 } = nativeCallback(options, cb);\n this.#ctx = ctx, this.ptr = ptr2, this.#threadsafe = !!options\?.threadsafe;\n }\n ptr;\n #ctx;\n #threadsafe;\n get threadsafe() {\n return this.#threadsafe;\n }\n [Symbol.toPrimitive]() {\n const { ptr: ptr2 } = this;\n return typeof ptr2 === \"number\" \? ptr2 : 0;\n }\n close() {\n const ctx = this.#ctx;\n if (this.ptr = null, this.#ctx = null, ctx)\n closeCallback(ctx);\n }\n}\n\nclass CString extends @String {\n constructor(ptr2, byteOffset, byteLength) {\n super(ptr2 \? typeof byteLength === \"number\" && Number.isSafeInteger(byteLength) \? BunCString(ptr2, byteOffset || 0, byteLength) : BunCString(ptr2) : \"\");\n if (this.ptr = typeof ptr2 === \"number\" \? ptr2 : 0, typeof byteOffset !== \"undefined\")\n this.byteOffset = byteOffset;\n if (typeof byteLength !== \"undefined\")\n this.byteLength = byteLength;\n }\n ptr;\n byteOffset;\n byteLength;\n #cachedArrayBuffer;\n get arrayBuffer() {\n if (this.#cachedArrayBuffer)\n return this.#cachedArrayBuffer;\n if (!this.ptr)\n return this.#cachedArrayBuffer = new @ArrayBuffer(0);\n return this.#cachedArrayBuffer = toArrayBuffer(this.ptr, this.byteOffset, this.byteLength);\n }\n}\nObject.defineProperty(globalThis, \"__GlobalBunCString\", {\n value: CString,\n enumerable: !1,\n configurable: !1\n});\nvar ffiWrappers = new @Array(18), char = \"val|0\";\nffiWrappers.fill(char);\nffiWrappers[FFIType.uint8_t] = \"val<0\?0:val>=255\?255:val|0\";\nffiWrappers[FFIType.int16_t] = \"val<=-32768\?-32768:val>=32768\?32768:val|0\";\nffiWrappers[FFIType.uint16_t] = \"val<=0\?0:val>=65536\?65536:val|0\";\nffiWrappers[FFIType.int32_t] = \"val|0\";\nffiWrappers[FFIType.uint32_t] = \"val<=0\?0:val>=0xffffffff\?0xffffffff:+val||0\";\nffiWrappers[FFIType.i64_fast] = `{\n if (typeof val === \"bigint\") {\n if (val <= BigInt(Number.MAX_SAFE_INTEGER) && val >= BigInt(-Number.MAX_SAFE_INTEGER)) {\n return Number(val).valueOf() || 0;\n }\n\n return val;\n }\n\n return !val \? 0 : +val || 0;\n}`;\nffiWrappers[FFIType.i64_fast] = `{\n if (typeof val === \"bigint\") {\n if (val <= BigInt(Number.MAX_SAFE_INTEGER) && val >= BigInt(-Number.MAX_SAFE_INTEGER)) {\n return Number(val).valueOf() || 0;\n }\n\n return val;\n }\n\n return !val \? 0 : +val || 0;\n}`;\nffiWrappers[FFIType.u64_fast] = `{\n if (typeof val === \"bigint\") {\n if (val <= BigInt(Number.MAX_SAFE_INTEGER) && val >= 0) {\n return Number(val).valueOf() || 0;\n }\n\n return val;\n }\n\n return !val \? 0 : +val || 0;\n}`;\nffiWrappers[FFIType.int64_t] = `{\n if (typeof val === \"bigint\") {\n return val;\n }\n\n if (typeof val === \"number\") {\n return BigInt(val || 0);\n }\n\n return BigInt(+val || 0);\n}`;\nffiWrappers[FFIType.uint64_t] = `{\n if (typeof val === \"bigint\") {\n return val;\n }\n\n if (typeof val === \"number\") {\n return val <= 0 \? BigInt(0) : BigInt(val || 0);\n }\n\n return BigInt(+val || 0);\n}`;\nffiWrappers[FFIType.u64_fast] = `{\n if (typeof val === \"bigint\") {\n if (val <= BigInt(Number.MAX_SAFE_INTEGER) && val >= BigInt(0)) return Number(val);\n return val;\n }\n\n return typeof val === \"number\" \? (val <= 0 \? 0 : +val || 0) : +val || 0;\n}`;\nffiWrappers[FFIType.uint16_t] = `{\n const ret = (typeof val === \"bigint\" \? Number(val) : val) | 0;\n return ret <= 0 \? 0 : ret > 0xffff \? 0xffff : ret;\n}`;\nffiWrappers[FFIType.double] = `{\n if (typeof val === \"bigint\") {\n if (val.valueOf() < BigInt(Number.MAX_VALUE)) {\n return Math.abs(Number(val).valueOf()) + 0.00000000000001 - 0.00000000000001;\n }\n }\n\n if (!val) {\n return 0 + 0.00000000000001 - 0.00000000000001;\n }\n\n return val + 0.00000000000001 - 0.00000000000001;\n}`;\nffiWrappers[FFIType.float] = ffiWrappers[10] = `{\n return Math.fround(val);\n}`;\nffiWrappers[FFIType.bool] = `{\n return !!val;\n}`;\nObject.defineProperty(globalThis, \"__GlobalBunFFIPtrFunctionForWrapper\", {\n value: ptr,\n enumerable: !1,\n configurable: !0\n});\nffiWrappers[FFIType.cstring] = ffiWrappers[FFIType.pointer] = `{\n if (typeof val === \"number\") return val;\n if (!val) {\n return null;\n }\n\n if (ArrayBuffer.isView(val) || val instanceof ArrayBuffer) {\n return __GlobalBunFFIPtrFunctionForWrapper(val);\n }\n\n if (typeof val === \"string\") {\n throw new TypeError(\"To convert a string to a pointer, encode it as a buffer\");\n }\n\n throw new TypeError(\\`Unable to convert \\${ val } to a pointer\\`);\n}`;\nffiWrappers[FFIType.function] = `{\n if (typeof val === \"number\") {\n return val;\n }\n\n if (typeof val === \"bigint\") {\n return Number(val);\n }\n\n var ptr = val && val.ptr;\n\n if (!ptr) {\n throw new TypeError(\"Expected function to be a JSCallback or a number\");\n }\n\n return ptr;\n}`;\nvar native = {\n dlopen: nativeDLOpen,\n callback: () => {\n throw new Error(\"Deprecated. Use new JSCallback(options, fn) instead\");\n }\n}, cFunctionI = 0, cFunctionRegistry, read = ffi.read;\n$ = {\n CFunction,\n CString,\n FFIType,\n JSCallback,\n dlopen,\n linkSymbols,\n native,\n ptr,\n read,\n suffix: \"so\",\n toArrayBuffer,\n toBuffer,\n viewSource\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral BunSqliteCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/bun/sqlite.ts\nvar $, defineProperties = Object.defineProperties, toStringTag = Symbol.toStringTag, isArray = @Array.isArray, isTypedArray = @ArrayBuffer.isView, constants = {\n SQLITE_OPEN_READONLY: 1,\n SQLITE_OPEN_READWRITE: 2,\n SQLITE_OPEN_CREATE: 4,\n SQLITE_OPEN_DELETEONCLOSE: 8,\n SQLITE_OPEN_EXCLUSIVE: 16,\n SQLITE_OPEN_AUTOPROXY: 32,\n SQLITE_OPEN_URI: 64,\n SQLITE_OPEN_MEMORY: 128,\n SQLITE_OPEN_MAIN_DB: 256,\n SQLITE_OPEN_TEMP_DB: 512,\n SQLITE_OPEN_TRANSIENT_DB: 1024,\n SQLITE_OPEN_MAIN_JOURNAL: 2048,\n SQLITE_OPEN_TEMP_JOURNAL: 4096,\n SQLITE_OPEN_SUBJOURNAL: 8192,\n SQLITE_OPEN_SUPER_JOURNAL: 16384,\n SQLITE_OPEN_NOMUTEX: 32768,\n SQLITE_OPEN_FULLMUTEX: 65536,\n SQLITE_OPEN_SHAREDCACHE: 131072,\n SQLITE_OPEN_PRIVATECACHE: 262144,\n SQLITE_OPEN_WAL: 524288,\n SQLITE_OPEN_NOFOLLOW: 16777216,\n SQLITE_OPEN_EXRESCODE: 33554432,\n SQLITE_PREPARE_PERSISTENT: 1,\n SQLITE_PREPARE_NORMALIZE: 2,\n SQLITE_PREPARE_NO_VTAB: 4\n}, SQL, controllers;\n\nclass Statement {\n constructor(raw) {\n switch (this.#raw = raw, raw.paramsCount) {\n case 0: {\n this.get = this.#getNoArgs, this.all = this.#allNoArgs, this.values = this.#valuesNoArgs, this.run = this.#runNoArgs;\n break;\n }\n default: {\n this.get = this.#get, this.all = this.#all, this.values = this.#values, this.run = this.#run;\n break;\n }\n }\n }\n #raw;\n get;\n all;\n values;\n run;\n isFinalized = !1;\n toJSON() {\n return {\n sql: this.native.toString(),\n isFinalized: this.isFinalized,\n paramsCount: this.paramsCount,\n columnNames: this.columnNames\n };\n }\n get [toStringTag]() {\n return `\"${this.native.toString()}\"`;\n }\n toString() {\n return this.native.toString();\n }\n get native() {\n return this.#raw;\n }\n #getNoArgs() {\n return this.#raw.get();\n }\n #allNoArgs() {\n return this.#raw.all();\n }\n #valuesNoArgs() {\n return this.#raw.values();\n }\n #runNoArgs() {\n this.#raw.run();\n }\n #get(...args) {\n if (args.length === 0)\n return this.#getNoArgs();\n var arg0 = args[0];\n return !isArray(arg0) && (!arg0 || typeof arg0 !== \"object\" || isTypedArray(arg0)) \? this.#raw.get(args) : this.#raw.get(...args);\n }\n #all(...args) {\n if (args.length === 0)\n return this.#allNoArgs();\n var arg0 = args[0];\n return !isArray(arg0) && (!arg0 || typeof arg0 !== \"object\" || isTypedArray(arg0)) \? this.#raw.all(args) : this.#raw.all(...args);\n }\n #values(...args) {\n if (args.length === 0)\n return this.#valuesNoArgs();\n var arg0 = args[0];\n return !isArray(arg0) && (!arg0 || typeof arg0 !== \"object\" || isTypedArray(arg0)) \? this.#raw.values(args) : this.#raw.values(...args);\n }\n #run(...args) {\n if (args.length === 0)\n return this.#runNoArgs();\n var arg0 = args[0];\n !isArray(arg0) && (!arg0 || typeof arg0 !== \"object\" || isTypedArray(arg0)) \? this.#raw.run(args) : this.#raw.run(...args);\n }\n get columnNames() {\n return this.#raw.columns;\n }\n get paramsCount() {\n return this.#raw.paramsCount;\n }\n finalize(...args) {\n return this.isFinalized = !0, this.#raw.finalize(...args);\n }\n}\nvar cachedCount = Symbol.for(\"Bun.Database.cache.count\");\n\nclass Database {\n constructor(filenameGiven, options) {\n if (typeof filenameGiven === \"undefined\")\n ;\n else if (typeof filenameGiven !== \"string\") {\n if (isTypedArray(filenameGiven)) {\n this.#handle = Database.#deserialize(filenameGiven, typeof options === \"object\" && options \? !!options.readonly : ((options | 0) & constants.SQLITE_OPEN_READONLY) != 0), this.filename = \":memory:\";\n return;\n }\n @throwTypeError(`Expected 'filename' to be a string, got '${typeof filenameGiven}'`);\n }\n var filename = typeof filenameGiven === \"string\" \? filenameGiven.trim() : \":memory:\", flags = constants.SQLITE_OPEN_READWRITE | constants.SQLITE_OPEN_CREATE;\n if (typeof options === \"object\" && options) {\n if (flags = 0, options.readonly)\n flags = constants.SQLITE_OPEN_READONLY;\n if (\"readOnly\" in options)\n @throwTypeError('Misspelled option \"readOnly\" should be \"readonly\"');\n if (options.create)\n flags = constants.SQLITE_OPEN_READWRITE | constants.SQLITE_OPEN_CREATE;\n if (options.readwrite)\n flags |= constants.SQLITE_OPEN_READWRITE;\n } else if (typeof options === \"number\")\n flags = options;\n const anonymous = filename === \"\" || filename === \":memory:\";\n if (anonymous && (flags & constants.SQLITE_OPEN_READONLY) !== 0)\n throw new Error(\"Cannot open an anonymous database in read-only mode.\");\n if (!SQL)\n SQL = @lazy(\"sqlite\");\n this.#handle = SQL.open(anonymous \? \":memory:\" : filename, flags), this.filename = filename;\n }\n #handle;\n #cachedQueriesKeys = [];\n #cachedQueriesLengths = [];\n #cachedQueriesValues = [];\n filename;\n get handle() {\n return this.#handle;\n }\n get inTransaction() {\n return SQL.isInTransaction(this.#handle);\n }\n static open(filename, options) {\n return new Database(filename, options);\n }\n loadExtension(name, entryPoint) {\n return SQL.loadExtension(this.#handle, name, entryPoint);\n }\n serialize(optionalName) {\n return SQL.serialize(this.#handle, optionalName || \"main\");\n }\n static #deserialize(serialized, isReadOnly = !1) {\n if (!SQL)\n SQL = @lazy(\"sqlite\");\n return SQL.deserialize(serialized, isReadOnly);\n }\n static deserialize(serialized, isReadOnly = !1) {\n return new Database(serialized, isReadOnly \? constants.SQLITE_OPEN_READONLY : 0);\n }\n static setCustomSQLite(path) {\n if (!SQL)\n SQL = @lazy(\"sqlite\");\n return SQL.setCustomSQLite(path);\n }\n close() {\n return this.clearQueryCache(), SQL.close(this.#handle);\n }\n clearQueryCache() {\n for (let item of this.#cachedQueriesValues)\n item.finalize();\n this.#cachedQueriesKeys.length = 0, this.#cachedQueriesValues.length = 0, this.#cachedQueriesLengths.length = 0;\n }\n run(query, ...params) {\n if (params.length === 0) {\n SQL.run(this.#handle, query);\n return;\n }\n var arg0 = params[0];\n return !isArray(arg0) && (!arg0 || typeof arg0 !== \"object\" || isTypedArray(arg0)) \? SQL.run(this.#handle, query, params) : SQL.run(this.#handle, query, ...params);\n }\n prepare(query, params, flags) {\n return new Statement(SQL.prepare(this.#handle, query, params, flags || 0));\n }\n static MAX_QUERY_CACHE_SIZE = 20;\n get [cachedCount]() {\n return this.#cachedQueriesKeys.length;\n }\n query(query) {\n if (typeof query !== \"string\")\n @throwTypeError(`Expected 'query' to be a string, got '${typeof query}'`);\n if (query.length === 0)\n throw new Error(\"SQL query cannot be empty.\");\n const willCache = this.#cachedQueriesKeys.length < Database.MAX_QUERY_CACHE_SIZE;\n var index = this.#cachedQueriesLengths.indexOf(query.length);\n while (index !== -1) {\n if (this.#cachedQueriesKeys[index] !== query) {\n index = this.#cachedQueriesLengths.indexOf(query.length, index + 1);\n continue;\n }\n var stmt = this.#cachedQueriesValues[index];\n if (stmt.isFinalized)\n return this.#cachedQueriesValues[index] = this.prepare(query, @undefined, willCache \? constants.SQLITE_PREPARE_PERSISTENT : 0);\n return stmt;\n }\n var stmt = this.prepare(query, @undefined, willCache \? constants.SQLITE_PREPARE_PERSISTENT : 0);\n if (willCache)\n this.#cachedQueriesKeys.push(query), this.#cachedQueriesLengths.push(query.length), this.#cachedQueriesValues.push(stmt);\n return stmt;\n }\n transaction(fn, self) {\n if (typeof fn !== \"function\")\n @throwTypeError(\"Expected first argument to be a function\");\n const db = this, controller = getController(db, self), properties = {\n default: { value: wrapTransaction(fn, db, controller.default) },\n deferred: { value: wrapTransaction(fn, db, controller.deferred) },\n immediate: {\n value: wrapTransaction(fn, db, controller.immediate)\n },\n exclusive: {\n value: wrapTransaction(fn, db, controller.exclusive)\n },\n database: { value: this, enumerable: !0 }\n };\n return defineProperties(properties.default.value, properties), defineProperties(properties.deferred.value, properties), defineProperties(properties.immediate.value, properties), defineProperties(properties.exclusive.value, properties), properties.default.value;\n }\n}\nDatabase.prototype.exec = Database.prototype.run;\nvar getController = (db, self) => {\n let controller = (controllers ||= new WeakMap).get(db);\n if (!controller) {\n const shared = {\n commit: db.prepare(\"COMMIT\", @undefined, 0),\n rollback: db.prepare(\"ROLLBACK\", @undefined, 0),\n savepoint: db.prepare(\"SAVEPOINT `\\t_bs3.\\t`\", @undefined, 0),\n release: db.prepare(\"RELEASE `\\t_bs3.\\t`\", @undefined, 0),\n rollbackTo: db.prepare(\"ROLLBACK TO `\\t_bs3.\\t`\", @undefined, 0)\n };\n controllers.set(db, controller = {\n default: Object.assign({ begin: db.prepare(\"BEGIN\", @undefined, 0) }, shared),\n deferred: Object.assign({ begin: db.prepare(\"BEGIN DEFERRED\", @undefined, 0) }, shared),\n immediate: Object.assign({ begin: db.prepare(\"BEGIN IMMEDIATE\", @undefined, 0) }, shared),\n exclusive: Object.assign({ begin: db.prepare(\"BEGIN EXCLUSIVE\", @undefined, 0) }, shared)\n });\n }\n return controller;\n}, wrapTransaction = (fn, db, { begin, commit, rollback, savepoint, release, rollbackTo }) => function transaction(...args) {\n let before, after, undo;\n if (db.inTransaction)\n before = savepoint, after = release, undo = rollbackTo;\n else\n before = begin, after = commit, undo = rollback;\n try {\n before.run();\n const result = fn.@apply(this, args);\n return after.run(), result;\n } catch (ex) {\n if (db.inTransaction) {\n if (undo.run(), undo !== rollback)\n after.run();\n }\n throw ex;\n }\n};\n$ = {\n __esModule: !0,\n Database,\n Statement,\n constants,\n default: Database\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral InternalDebuggerCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/internal/debugger.ts\nvar versionInfo = function() {\n return {\n \"Protocol-Version\": \"1.3\",\n Browser: \"Bun\",\n \"User-Agent\": navigator.userAgent,\n \"WebKit-Version\": process.versions.webkit,\n \"Bun-Version\": Bun.version,\n \"Bun-Revision\": Bun.revision\n };\n}, webSocketWriter = function(ws) {\n return {\n write: (message) => !!ws.sendText(message),\n close: () => ws.close()\n };\n}, socketWriter = function(socket) {\n return {\n write: (message) => !!socket.write(message),\n close: () => socket.end()\n };\n}, bufferedWriter = function(writer) {\n let draining = !1, pendingMessages = [];\n return {\n write: (message) => {\n if (draining || !writer.write(message))\n pendingMessages.push(message);\n return !0;\n },\n drain: () => {\n draining = !0;\n try {\n for (let i = 0;i < pendingMessages.length; i++)\n if (!writer.write(pendingMessages[i])) {\n pendingMessages = pendingMessages.slice(i);\n return;\n }\n } finally {\n draining = !1;\n }\n },\n close: () => {\n writer.close(), pendingMessages.length = 0;\n }\n };\n}, parseUrl = function(url) {\n try {\n if (!url)\n return new URL(randomId(), `ws://${defaultHostname}:${defaultPort}/`);\n else if (url.startsWith(\"/\"))\n return new URL(url, `ws://${defaultHostname}:${defaultPort}/`);\n else if (/^[a-z+]+:\\/\\//i.test(url))\n return new URL(url);\n else if (/^\\d+$/.test(url))\n return new URL(randomId(), `ws://${defaultHostname}:${url}/`);\n else if (!url.includes(\"/\") && url.includes(\":\"))\n return new URL(randomId(), `ws://${url}/`);\n else if (!url.includes(\":\")) {\n const [hostname, pathname] = url.split(\"/\", 2);\n return new URL(`ws://${hostname}:${defaultPort}/${pathname}`);\n } else\n return new URL(randomId(), `ws://${url}`);\n } catch {\n @throwTypeError(`Invalid hostname or URL: '${url}'`);\n }\n}, randomId = function() {\n return Math.random().toString(36).slice(2);\n}, dim = function(string) {\n if (enableANSIColors)\n return `\\x1B[2m${string}\\x1B[22m`;\n return string;\n}, link = function(url) {\n if (enableANSIColors)\n return `\\x1B[1m\\x1B]8;;${url}\\x1B\\\\${url}\\x1B]8;;\\x1B\\\\\\x1B[22m`;\n return url;\n}, reset = function() {\n if (enableANSIColors)\n return \"\\x1B[49m\";\n return \"\";\n}, notify = function(unix) {\n Bun.connect({\n unix,\n socket: {\n open: (socket) => {\n socket.end(\"1\");\n },\n data: () => {\n }\n }\n }).finally(() => {\n });\n}, exit = function(...args) {\n console.error(...args), process.exit(1);\n}, $;\n$ = function(executionContextId, url, createBackend, send, close) {\n let debug;\n try {\n debug = new Debugger(executionContextId, url, createBackend, send, close);\n } catch (error) {\n exit(\"Failed to start inspector:\\n\", error);\n }\n const { protocol, href, host, pathname } = debug.url;\n if (!protocol.includes(\"unix\")) {\n if (console.log(dim(\"--------------------- Bun Inspector ---------------------\"), reset()), console.log(`Listening:\\n ${dim(href)}`), protocol.includes(\"ws\"))\n console.log(`Inspect in browser:\\n ${link(`https://debug.bun.sh/#${host}${pathname}`)}`);\n console.log(dim(\"--------------------- Bun Inspector ---------------------\"), reset());\n }\n const unix = process.env.BUN_INSPECT_NOTIFY;\n if (unix) {\n const { protocol: protocol2, pathname: pathname2 } = parseUrl(unix);\n if (protocol2 === \"unix:\")\n notify(pathname2);\n }\n};\n\nclass Debugger {\n #url;\n #createBackend;\n constructor(executionContextId, url, createBackend, send, close) {\n this.#url = parseUrl(url), this.#createBackend = (refEventLoop, receive) => {\n const backend = createBackend(executionContextId, refEventLoop, receive);\n return {\n write: (message) => {\n return send.@call(backend, message), !0;\n },\n close: () => close.@call(backend)\n };\n }, this.#listen();\n }\n get url() {\n return this.#url;\n }\n #listen() {\n const { protocol, hostname, port, pathname } = this.#url;\n if (protocol === \"ws:\" || protocol === \"ws+tcp:\") {\n const server = Bun.serve({\n hostname,\n port,\n fetch: this.#fetch.bind(this),\n websocket: this.#websocket\n });\n this.#url.hostname = server.hostname, this.#url.port = `${server.port}`;\n return;\n }\n if (protocol === \"ws+unix:\") {\n Bun.serve({\n unix: pathname,\n fetch: this.#fetch.bind(this),\n websocket: this.#websocket\n });\n return;\n }\n @throwTypeError(`Unsupported protocol: '${protocol}' (expected 'ws:', 'ws+unix:', or 'unix:')`);\n }\n get #websocket() {\n return {\n idleTimeout: 0,\n closeOnBackpressureLimit: !1,\n open: (ws) => this.#open(ws, webSocketWriter(ws)),\n message: (ws, message) => {\n if (typeof message === \"string\")\n this.#message(ws, message);\n else\n this.#error(ws, new Error(`Unexpected binary message: ${message.toString()}`));\n },\n drain: (ws) => this.#drain(ws),\n close: (ws) => this.#close(ws)\n };\n }\n #fetch(request, server) {\n const { method, url, headers } = request, { pathname } = new URL(url);\n if (method !== \"GET\")\n return new Response(null, {\n status: 405\n });\n switch (pathname) {\n case \"/json/version\":\n return Response.json(versionInfo());\n case \"/json\":\n case \"/json/list\":\n }\n if (!this.#url.protocol.includes(\"unix\") && this.#url.pathname !== pathname)\n return new Response(null, {\n status: 404\n });\n const data = {\n refEventLoop: headers.get(\"Ref-Event-Loop\") === \"0\"\n };\n if (!server.upgrade(request, { data }))\n return new Response(null, {\n status: 426,\n headers: {\n Upgrade: \"websocket\"\n }\n });\n }\n get #socket() {\n return {\n open: (socket) => this.#open(socket, socketWriter(socket)),\n data: (socket, message) => this.#message(socket, message.toString()),\n drain: (socket) => this.#drain(socket),\n close: (socket) => this.#close(socket),\n error: (socket, error) => this.#error(socket, error),\n connectError: (_, error) => exit(\"Failed to start inspector:\\n\", error)\n };\n }\n #open(connection, writer) {\n const { data } = connection, { refEventLoop } = data, client = bufferedWriter(writer), backend = this.#createBackend(refEventLoop, (...messages) => {\n for (let message of messages)\n client.write(message);\n });\n data.client = client, data.backend = backend;\n }\n #message(connection, message) {\n const { data } = connection, { backend } = data;\n backend\?.write(message);\n }\n #drain(connection) {\n const { data } = connection, { client } = data;\n client\?.drain\?.();\n }\n #close(connection) {\n const { data } = connection, { backend } = data;\n backend\?.close();\n }\n #error(connection, error) {\n const { data } = connection, { backend } = data;\n console.error(error), backend\?.close();\n }\n}\nvar defaultHostname = \"localhost\", defaultPort = 6499, { enableANSIColors } = Bun;\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral InternalFSCpSyncCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/internal/fs/cp-sync.ts\nvar areIdentical = function(srcStat, destStat) {\n return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;\n}, isSrcSubdir = function(src, dest) {\n const srcArr = normalizePathToArray(src), destArr = normalizePathToArray(dest);\n return ArrayPrototypeEvery.@call(srcArr, (cur, i) => destArr[i] === cur);\n}, cpSyncFn = function(src, dest, opts) {\n const { srcStat, destStat, skipped } = checkPathsSync(src, dest, opts);\n if (skipped)\n return;\n return checkParentPathsSync(src, srcStat, dest), checkParentDir(destStat, src, dest, opts);\n}, checkPathsSync = function(src, dest, opts) {\n if (opts.filter) {\n const shouldCopy = opts.filter(src, dest);\n if (isPromise(shouldCopy))\n throw new Error(\"Expected a boolean from the filter function, but got a promise. Use `fs.promises.cp` instead.\");\n if (!shouldCopy)\n return { __proto__: null, skipped: !0 };\n }\n const { srcStat, destStat } = getStatsSync(src, dest, opts);\n if (destStat) {\n if (areIdentical(srcStat, destStat))\n throw new Error(\"src and dest cannot be the same\");\n if (srcStat.isDirectory() && !destStat.isDirectory())\n throw new Error(`cannot overwrite directory ${src} with non-directory ${dest}`);\n if (!srcStat.isDirectory() && destStat.isDirectory())\n throw new Error(`cannot overwrite non-directory ${src} with directory ${dest}`);\n }\n if (srcStat.isDirectory() && isSrcSubdir(src, dest))\n throw new Error(`cannot copy ${src} to a subdirectory of self ${dest}`);\n return { __proto__: null, srcStat, destStat, skipped: !1 };\n}, getStatsSync = function(src, dest, opts) {\n let destStat;\n const statFunc = opts.dereference \? (file) => statSync(file, { bigint: !0 }) : (file) => lstatSync(file, { bigint: !0 }), srcStat = statFunc(src);\n try {\n destStat = statFunc(dest);\n } catch (err) {\n if (err.code === \"ENOENT\")\n return { srcStat, destStat: null };\n throw err;\n }\n return { srcStat, destStat };\n}, checkParentPathsSync = function(src, srcStat, dest) {\n const srcParent = resolve(dirname(src)), destParent = resolve(dirname(dest));\n if (destParent === srcParent || destParent === parse(destParent).root)\n return;\n let destStat;\n try {\n destStat = statSync(destParent, { bigint: !0 });\n } catch (err) {\n if (err.code === \"ENOENT\")\n return;\n throw err;\n }\n if (areIdentical(srcStat, destStat))\n throw new Error(`cannot copy ${src} to a subdirectory of self ${dest}`);\n return checkParentPathsSync(src, srcStat, destParent);\n}, checkParentDir = function(destStat, src, dest, opts) {\n const destParent = dirname(dest);\n if (!existsSync(destParent))\n mkdirSync(destParent, { recursive: !0 });\n return getStats(destStat, src, dest, opts);\n}, getStats = function(destStat, src, dest, opts) {\n const srcStat = (opts.dereference \? statSync : lstatSync)(src);\n if (srcStat.isDirectory() && opts.recursive)\n return onDir(srcStat, destStat, src, dest, opts);\n else if (srcStat.isDirectory())\n throw new Error(`${src} is a directory (not copied)`);\n else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice())\n return onFile(srcStat, destStat, src, dest, opts);\n else if (srcStat.isSymbolicLink())\n return onLink(destStat, src, dest, opts);\n else if (srcStat.isSocket())\n throw new Error(`cannot copy a socket file: ${dest}`);\n else if (srcStat.isFIFO())\n throw new Error(`cannot copy a FIFO pipe: ${dest}`);\n throw new Error(`cannot copy an unknown file type: ${dest}`);\n}, onFile = function(srcStat, destStat, src, dest, opts) {\n if (!destStat)\n return copyFile(srcStat, src, dest, opts);\n return mayCopyFile(srcStat, src, dest, opts);\n}, mayCopyFile = function(srcStat, src, dest, opts) {\n if (opts.force)\n return unlinkSync(dest), copyFile(srcStat, src, dest, opts);\n else if (opts.errorOnExist)\n throw new Error(`${dest} already exists`);\n}, copyFile = function(srcStat, src, dest, opts) {\n if (copyFileSync(src, dest, opts.mode), opts.preserveTimestamps)\n handleTimestamps(srcStat.mode, src, dest);\n return setDestMode(dest, srcStat.mode);\n}, handleTimestamps = function(srcMode, src, dest) {\n if (fileIsNotWritable(srcMode))\n makeFileWritable(dest, srcMode);\n return setDestTimestamps(src, dest);\n}, fileIsNotWritable = function(srcMode) {\n return (srcMode & 128) === 0;\n}, makeFileWritable = function(dest, srcMode) {\n return setDestMode(dest, srcMode | 128);\n}, setDestMode = function(dest, srcMode) {\n return chmodSync(dest, srcMode);\n}, setDestTimestamps = function(src, dest) {\n const updatedSrcStat = statSync(src);\n return utimesSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime);\n}, onDir = function(srcStat, destStat, src, dest, opts) {\n if (!destStat)\n return mkDirAndCopy(srcStat.mode, src, dest, opts);\n return copyDir(src, dest, opts);\n}, mkDirAndCopy = function(srcMode, src, dest, opts) {\n return mkdirSync(dest), copyDir(src, dest, opts), setDestMode(dest, srcMode);\n}, copyDir = function(src, dest, opts) {\n for (let dirent of readdirSync(src, { withFileTypes: !0 })) {\n const { name } = dirent, srcItem = join(src, name), destItem = join(dest, name), { destStat, skipped } = checkPathsSync(srcItem, destItem, opts);\n if (!skipped)\n getStats(destStat, srcItem, destItem, opts);\n }\n}, onLink = function(destStat, src, dest, opts) {\n let resolvedSrc = readlinkSync(src);\n if (!opts.verbatimSymlinks && !isAbsolute(resolvedSrc))\n resolvedSrc = resolve(dirname(src), resolvedSrc);\n if (!destStat)\n return symlinkSync(resolvedSrc, dest);\n let resolvedDest;\n try {\n resolvedDest = readlinkSync(dest);\n } catch (err) {\n if (err.code === \"EINVAL\" || err.code === \"UNKNOWN\")\n return symlinkSync(resolvedSrc, dest);\n throw err;\n }\n if (!isAbsolute(resolvedDest))\n resolvedDest = resolve(dirname(dest), resolvedDest);\n if (isSrcSubdir(resolvedSrc, resolvedDest))\n throw new Error(`cannot copy ${resolvedSrc} to a subdirectory of self ${resolvedDest}`);\n if (statSync(dest).isDirectory() && isSrcSubdir(resolvedDest, resolvedSrc))\n throw new Error(`cannot overwrite ${resolvedDest} with ${resolvedSrc}`);\n return copyLink(resolvedSrc, dest);\n}, copyLink = function(resolvedSrc, dest) {\n return unlinkSync(dest), symlinkSync(resolvedSrc, dest);\n}, ArrayPrototypeEvery = @Array.prototype.every, ArrayPrototypeFilter = @Array.prototype.filter, StringPrototypeSplit = @String.prototype.split, normalizePathToArray = (path) => ArrayPrototypeFilter.@call(StringPrototypeSplit.@call(resolve(path), sep), Boolean), {\n chmodSync,\n copyFileSync,\n existsSync,\n lstatSync,\n mkdirSync,\n readdirSync,\n readlinkSync,\n statSync,\n symlinkSync,\n unlinkSync,\n utimesSync\n} = @getInternalField(@internalModuleRegistry, 21) || @createInternalModuleById(21), { dirname, isAbsolute, join, parse, resolve, sep } = @getInternalField(@internalModuleRegistry, 30) || @createInternalModuleById(30), { isPromise } = @requireNativeModule(\"util/types\");\nreturn cpSyncFn})\n"); -// - -// -static constexpr ASCIILiteral InternalFSCpCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/internal/fs/cp.ts\nasync function cpFn(src, dest, opts) {\n const stats = await checkPaths(src, dest, opts), { srcStat, destStat, skipped } = stats;\n if (skipped)\n return;\n return await checkParentPaths(src, srcStat, dest), checkParentDir(destStat, src, dest, opts);\n}\nasync function checkPaths(src, dest, opts) {\n if (opts.filter && !await opts.filter(src, dest))\n return { __proto__: null, skipped: !0 };\n const { 0: srcStat, 1: destStat } = await getStats(src, dest, opts);\n if (destStat) {\n if (areIdentical(srcStat, destStat))\n throw new Error(\"Source and destination must not be the same.\");\n if (srcStat.isDirectory() && !destStat.isDirectory())\n throw new Error(`cannot overwrite directory ${src} with non-directory ${dest}`);\n if (!srcStat.isDirectory() && destStat.isDirectory())\n throw new Error(`cannot overwrite non-directory ${src} with directory ${dest}`);\n }\n if (srcStat.isDirectory() && isSrcSubdir(src, dest))\n throw new Error(`cannot copy ${src} to a subdirectory of self ${dest}`);\n return { __proto__: null, srcStat, destStat, skipped: !1 };\n}\nvar areIdentical = function(srcStat, destStat) {\n return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;\n}, getStats = function(src, dest, opts) {\n const statFunc = opts.dereference \? (file) => stat(file, { bigint: !0 }) : (file) => lstat(file, { bigint: !0 });\n return SafePromiseAll([\n statFunc(src),\n PromisePrototypeThen.@call(statFunc(dest), @undefined, (err) => {\n if (err.code === \"ENOENT\")\n return null;\n throw err;\n })\n ]);\n};\nasync function checkParentDir(destStat, src, dest, opts) {\n const destParent = dirname(dest);\n if (await pathExists(destParent))\n return getStatsForCopy(destStat, src, dest, opts);\n return await mkdir(destParent, { recursive: !0 }), getStatsForCopy(destStat, src, dest, opts);\n}\nvar pathExists = function(dest) {\n return PromisePrototypeThen(stat(dest), () => !0, (err) => err.code === \"ENOENT\" \? !1 : PromiseReject(err));\n};\nasync function checkParentPaths(src, srcStat, dest) {\n const srcParent = resolve(dirname(src)), destParent = resolve(dirname(dest));\n if (destParent === srcParent || destParent === parse(destParent).root)\n return;\n let destStat;\n try {\n destStat = await stat(destParent, { bigint: !0 });\n } catch (err) {\n if (err.code === \"ENOENT\")\n return;\n throw err;\n }\n if (areIdentical(srcStat, destStat))\n throw new Error(`cannot copy ${src} to a subdirectory of self ${dest}`);\n return checkParentPaths(src, srcStat, destParent);\n}\nvar isSrcSubdir = function(src, dest) {\n const srcArr = normalizePathToArray(src), destArr = normalizePathToArray(dest);\n return ArrayPrototypeEvery.@call(srcArr, (cur, i) => destArr[i] === cur);\n};\nasync function getStatsForCopy(destStat, src, dest, opts) {\n const srcStat = await (opts.dereference \? stat : lstat)(src);\n if (srcStat.isDirectory() && opts.recursive)\n return onDir(srcStat, destStat, src, dest, opts);\n else if (srcStat.isDirectory())\n throw new Error(`${src} is a directory (not copied)`);\n else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice())\n return onFile(srcStat, destStat, src, dest, opts);\n else if (srcStat.isSymbolicLink())\n return onLink(destStat, src, dest, opts);\n else if (srcStat.isSocket())\n throw new Error(`cannot copy a socket file: ${dest}`);\n else if (srcStat.isFIFO())\n throw new Error(`cannot copy a FIFO pipe: ${dest}`);\n throw new Error(`cannot copy an unknown file type: ${dest}`);\n}\nvar onFile = function(srcStat, destStat, src, dest, opts) {\n if (!destStat)\n return _copyFile(srcStat, src, dest, opts);\n return mayCopyFile(srcStat, src, dest, opts);\n};\nasync function mayCopyFile(srcStat, src, dest, opts) {\n if (opts.force)\n return await unlink(dest), _copyFile(srcStat, src, dest, opts);\n else if (opts.errorOnExist)\n throw new Error(`${dest} already exists`);\n}\nasync function _copyFile(srcStat, src, dest, opts) {\n if (await copyFile(src, dest, opts.mode), opts.preserveTimestamps)\n return handleTimestampsAndMode(srcStat.mode, src, dest);\n return setDestMode(dest, srcStat.mode);\n}\nasync function handleTimestampsAndMode(srcMode, src, dest) {\n if (fileIsNotWritable(srcMode))\n return await makeFileWritable(dest, srcMode), setDestTimestampsAndMode(srcMode, src, dest);\n return setDestTimestampsAndMode(srcMode, src, dest);\n}\nvar fileIsNotWritable = function(srcMode) {\n return (srcMode & 128) === 0;\n}, makeFileWritable = function(dest, srcMode) {\n return setDestMode(dest, srcMode | 128);\n};\nasync function setDestTimestampsAndMode(srcMode, src, dest) {\n return await setDestTimestamps(src, dest), setDestMode(dest, srcMode);\n}\nvar setDestMode = function(dest, srcMode) {\n return chmod(dest, srcMode);\n};\nasync function setDestTimestamps(src, dest) {\n const updatedSrcStat = await stat(src);\n return utimes(dest, updatedSrcStat.atime, updatedSrcStat.mtime);\n}\nvar onDir = function(srcStat, destStat, src, dest, opts) {\n if (!destStat)\n return mkDirAndCopy(srcStat.mode, src, dest, opts);\n return copyDir(src, dest, opts);\n};\nasync function mkDirAndCopy(srcMode, src, dest, opts) {\n return await mkdir(dest), await copyDir(src, dest, opts), setDestMode(dest, srcMode);\n}\nasync function copyDir(src, dest, opts) {\n const dir = await opendir(src);\n for await (let { name } of dir) {\n const srcItem = join(src, name), destItem = join(dest, name), { destStat, skipped } = await checkPaths(srcItem, destItem, opts);\n if (!skipped)\n await getStatsForCopy(destStat, srcItem, destItem, opts);\n }\n}\nasync function onLink(destStat, src, dest, opts) {\n let resolvedSrc = await readlink(src);\n if (!opts.verbatimSymlinks && !isAbsolute(resolvedSrc))\n resolvedSrc = resolve(dirname(src), resolvedSrc);\n if (!destStat)\n return symlink(resolvedSrc, dest);\n let resolvedDest;\n try {\n resolvedDest = await readlink(dest);\n } catch (err) {\n if (err.code === \"EINVAL\" || err.code === \"UNKNOWN\")\n return symlink(resolvedSrc, dest);\n throw err;\n }\n if (!isAbsolute(resolvedDest))\n resolvedDest = resolve(dirname(dest), resolvedDest);\n if (isSrcSubdir(resolvedSrc, resolvedDest))\n throw new Error(`cannot copy ${resolvedSrc} to a subdirectory of self ${resolvedDest}`);\n if ((await stat(src)).isDirectory() && isSrcSubdir(resolvedDest, resolvedSrc))\n throw new Error(`cannot overwrite ${resolvedDest} with ${resolvedSrc}`);\n return copyLink(resolvedSrc, dest);\n}\nasync function copyLink(resolvedSrc, dest) {\n return await unlink(dest), symlink(resolvedSrc, dest);\n}\nvar { chmod, copyFile, lstat, mkdir, opendir, readlink, stat, symlink, unlink, utimes } = @getInternalField(@internalModuleRegistry, 22) || @createInternalModuleById(22), { dirname, isAbsolute, join, parse, resolve, sep } = @getInternalField(@internalModuleRegistry, 30) || @createInternalModuleById(30), SafePromiseAll = @Promise.all, PromisePrototypeThen = @Promise.prototype.then, PromiseReject = @Promise.reject, ArrayPrototypeFilter = @Array.prototype.filter, StringPrototypeSplit = @String.prototype.split, ArrayPrototypeEvery = @Array.prototype.every, normalizePathToArray = (path) => ArrayPrototypeFilter.@call(StringPrototypeSplit(resolve(path), sep), Boolean);\nreturn cpFn})\n"); -// - -// -static constexpr ASCIILiteral InternalPrimordialsCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/internal/primordials.ts\nvar getGetter = function(cls, getter) {\n return FunctionPrototypeCall.bind(cls.prototype.__lookupGetter__(getter));\n}, uncurryThis = function(func) {\n return FunctionPrototypeCall.bind(func);\n}, ErrorCaptureStackTrace = function(targetObject) {\n const stack = new Error().stack;\n targetObject.stack = stack.replace(/.*\\n.*/, \"$1\");\n}, $, createSafeIterator = (factory, next) => {\n\n class SafeIterator {\n constructor(iterable) {\n this._iterator = factory(iterable);\n }\n next() {\n return next(this._iterator);\n }\n [Symbol.iterator]() {\n return this;\n }\n }\n return Object.setPrototypeOf(SafeIterator.prototype, null), Object.freeze(SafeIterator.prototype), Object.freeze(SafeIterator), SafeIterator;\n}, FunctionPrototypeCall = @getByIdDirect(Function.prototype, \"call\"), copyProps = (src, dest) => {\n ArrayPrototypeForEach(Reflect.ownKeys(src), (key) => {\n if (!Reflect.getOwnPropertyDescriptor(dest, key))\n Reflect.defineProperty(dest, key, Reflect.getOwnPropertyDescriptor(src, key));\n });\n}, makeSafe = (unsafe, safe) => {\n if (Symbol.iterator in unsafe.prototype) {\n const dummy = new unsafe;\n let next;\n ArrayPrototypeForEach(Reflect.ownKeys(unsafe.prototype), (key) => {\n if (!Reflect.getOwnPropertyDescriptor(safe.prototype, key)) {\n const desc = Reflect.getOwnPropertyDescriptor(unsafe.prototype, key);\n if (typeof desc.value === \"function\" && desc.value.length === 0 && (Symbol.iterator in (desc.value.@call(dummy) || {}))) {\n const createIterator = uncurryThis(desc.value);\n next \?\?= uncurryThis(createIterator(dummy).next);\n const SafeIterator = createSafeIterator(createIterator, next);\n desc.value = function() {\n return new SafeIterator(this);\n };\n }\n Reflect.defineProperty(safe.prototype, key, desc);\n }\n });\n } else\n copyProps(unsafe.prototype, safe.prototype);\n return copyProps(unsafe, safe), Object.setPrototypeOf(safe.prototype, null), Object.freeze(safe.prototype), Object.freeze(safe), safe;\n}, StringIterator = uncurryThis(@String.prototype[Symbol.iterator]), StringIteratorPrototype = Reflect.getPrototypeOf(StringIterator(\"\")), ArrayPrototypeForEach = uncurryThis(@Array.prototype.forEach), arrayProtoPush = @Array.prototype.push;\n$ = {\n makeSafe,\n Array: @Array,\n ArrayFrom: @Array.from,\n ArrayIsArray: @Array.isArray,\n ArrayPrototypeFlat: uncurryThis(@Array.prototype.flat),\n ArrayPrototypeFilter: uncurryThis(@Array.prototype.filter),\n ArrayPrototypeForEach,\n ArrayPrototypeIncludes: uncurryThis(@Array.prototype.includes),\n ArrayPrototypeIndexOf: uncurryThis(@Array.prototype.indexOf),\n ArrayPrototypeJoin: uncurryThis(@Array.prototype.join),\n ArrayPrototypeMap: uncurryThis(@Array.prototype.map),\n ArrayPrototypePop: uncurryThis(@Array.prototype.pop),\n ArrayPrototypePush: uncurryThis(arrayProtoPush),\n ArrayPrototypePushApply: (a, b) => arrayProtoPush.@apply(a, b),\n ArrayPrototypeSlice: uncurryThis(@Array.prototype.slice),\n ArrayPrototypeSort: uncurryThis(@Array.prototype.sort),\n ArrayPrototypeSplice: uncurryThis(@Array.prototype.splice),\n ArrayPrototypeUnshift: uncurryThis(@Array.prototype.unshift),\n BigIntPrototypeValueOf: uncurryThis(BigInt.prototype.valueOf),\n BooleanPrototypeValueOf: uncurryThis(Boolean.prototype.valueOf),\n DatePrototypeGetTime: uncurryThis(Date.prototype.getTime),\n DatePrototypeToISOString: uncurryThis(Date.prototype.toISOString),\n DatePrototypeToString: uncurryThis(Date.prototype.toString),\n ErrorCaptureStackTrace,\n ErrorPrototypeToString: uncurryThis(Error.prototype.toString),\n FunctionPrototypeToString: uncurryThis(Function.prototype.toString),\n JSONStringify: JSON.stringify,\n MapPrototypeGetSize: getGetter(Map, \"size\"),\n MapPrototypeEntries: uncurryThis(Map.prototype.entries),\n MapPrototypeValues: uncurryThis(Map.prototype.values),\n MapPrototypeKeys: uncurryThis(Map.prototype.keys),\n MathFloor: Math.floor,\n MathMax: Math.max,\n MathMin: Math.min,\n MathRound: Math.round,\n MathSqrt: Math.sqrt,\n MathTrunc: Math.trunc,\n Number,\n NumberIsFinite: Number.isFinite,\n NumberIsNaN: Number.isNaN,\n NumberParseFloat: Number.parseFloat,\n NumberParseInt: Number.parseInt,\n NumberPrototypeToString: uncurryThis(Number.prototype.toString),\n NumberPrototypeValueOf: uncurryThis(Number.prototype.valueOf),\n Object,\n ObjectAssign: Object.assign,\n ObjectCreate: Object.create,\n ObjectDefineProperty: Object.defineProperty,\n ObjectEntries: Object.entries,\n ObjectGetOwnPropertyDescriptor: Object.getOwnPropertyDescriptor,\n ObjectGetOwnPropertyDescriptors: Object.getOwnPropertyDescriptors,\n ObjectGetOwnPropertyNames: Object.getOwnPropertyNames,\n ObjectGetOwnPropertySymbols: Object.getOwnPropertySymbols,\n ObjectGetPrototypeOf: Object.getPrototypeOf,\n ObjectIs: Object.is,\n ObjectKeys: Object.keys,\n ObjectPrototypeHasOwnProperty: uncurryThis(Object.prototype.hasOwnProperty),\n ObjectPrototypePropertyIsEnumerable: uncurryThis(Object.prototype.propertyIsEnumerable),\n ObjectPrototypeToString: uncurryThis(Object.prototype.toString),\n ObjectSeal: Object.seal,\n ObjectSetPrototypeOf: Object.setPrototypeOf,\n ReflectApply: @getByIdDirect(Reflect, \"apply\"),\n ReflectOwnKeys: Reflect.ownKeys,\n RegExp: @RegExp,\n RegExpPrototypeExec: uncurryThis(@RegExp.prototype.exec),\n RegExpPrototypeSymbolReplace: uncurryThis(@RegExp.prototype[Symbol.replace]),\n RegExpPrototypeSymbolSplit: uncurryThis(@RegExp.prototype[Symbol.split]),\n RegExpPrototypeTest: uncurryThis(@RegExp.prototype.test),\n RegExpPrototypeToString: uncurryThis(@RegExp.prototype.toString),\n SafeStringIterator: createSafeIterator(StringIterator, uncurryThis(StringIteratorPrototype.next)),\n SafeMap: makeSafe(Map, class SafeMap extends Map {\n constructor(i) {\n super(i);\n }\n }),\n SafeSet: makeSafe(Set, class SafeSet extends Set {\n constructor(i) {\n super(i);\n }\n }),\n SetPrototypeGetSize: getGetter(Set, \"size\"),\n SetPrototypeEntries: uncurryThis(Set.prototype.entries),\n SetPrototypeValues: uncurryThis(Set.prototype.values),\n String: @String,\n StringPrototypeCharCodeAt: uncurryThis(@String.prototype.charCodeAt),\n StringPrototypeCodePointAt: uncurryThis(@String.prototype.codePointAt),\n StringPrototypeEndsWith: uncurryThis(@String.prototype.endsWith),\n StringPrototypeIncludes: uncurryThis(@String.prototype.includes),\n StringPrototypeIndexOf: uncurryThis(@String.prototype.indexOf),\n StringPrototypeLastIndexOf: uncurryThis(@String.prototype.lastIndexOf),\n StringPrototypeMatch: uncurryThis(@String.prototype.match),\n StringPrototypeNormalize: uncurryThis(@String.prototype.normalize),\n StringPrototypePadEnd: uncurryThis(@String.prototype.padEnd),\n StringPrototypePadStart: uncurryThis(@String.prototype.padStart),\n StringPrototypeRepeat: uncurryThis(@String.prototype.repeat),\n StringPrototypeReplace: uncurryThis(@String.prototype.replace),\n StringPrototypeReplaceAll: uncurryThis(@String.prototype.replaceAll),\n StringPrototypeSlice: uncurryThis(@String.prototype.slice),\n StringPrototypeSplit: uncurryThis(@String.prototype.split),\n StringPrototypeStartsWith: uncurryThis(@String.prototype.startsWith),\n StringPrototypeToLowerCase: uncurryThis(@String.prototype.toLowerCase),\n StringPrototypeTrim: uncurryThis(@String.prototype.trim),\n StringPrototypeValueOf: uncurryThis(@String.prototype.valueOf),\n SymbolPrototypeToString: uncurryThis(Symbol.prototype.toString),\n SymbolPrototypeValueOf: uncurryThis(Symbol.prototype.valueOf),\n FunctionPrototypeToString: uncurryThis(Function.prototype.toString),\n FunctionPrototypeBind: uncurryThis(Function.prototype.bind),\n SymbolIterator: Symbol.iterator,\n SymbolFor: Symbol.for,\n SymbolToStringTag: Symbol.toStringTag,\n TypedArrayPrototypeGetLength: getGetter(@Uint8Array, \"length\"),\n TypedArrayPrototypeGetSymbolToStringTag: getGetter(@Uint8Array, Symbol.toStringTag),\n Uint8ClampedArray,\n Uint8Array: @Uint8Array,\n Uint16Array,\n Uint32Array,\n Int8Array,\n Int16Array,\n Int32Array,\n Float32Array,\n Float64Array,\n BigUint64Array,\n BigInt64Array,\n uncurryThis\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral InternalSharedCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/internal/shared.ts\nvar throwNotImplemented = function(feature, issue) {\n throw hideFromStack(throwNotImplemented), new NotImplementedError(feature, issue);\n}, hideFromStack = function(...fns) {\n for (let fn of fns)\n Object.defineProperty(fn, \"name\", {\n value: \"::bunternal::\"\n });\n}, $;\n\nclass NotImplementedError extends Error {\n code;\n constructor(feature, issue) {\n super(feature + \" is not yet implemented in Bun.\" + (issue \? \" Track the status & thumbs up the issue: https://github.com/oven-sh/bun/issues/\" + issue : \"\"));\n this.name = \"NotImplementedError\", this.code = \"ERR_NOT_IMPLEMENTED\", hideFromStack(NotImplementedError);\n }\n}\n$ = {\n NotImplementedError,\n throwNotImplemented,\n hideFromStack\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral InternalUtilInspectCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/internal/util/inspect.ts\nvar vmSafeInstanceof = function(val, ctor) {\n if (val instanceof ctor)\n return !0;\n while (val) {\n if (typeof val !== \"object\")\n return !1;\n if (ctor.name === internalGetConstructorName(val))\n return !0;\n val = ObjectGetPrototypeOf(val);\n }\n return !1;\n}, checkBox = function(ctor) {\n return (val) => {\n if (!vmSafeInstanceof(val, ctor))\n return !1;\n try {\n ctor.prototype.valueOf.@call(val);\n } catch {\n return !1;\n }\n return !0;\n };\n}, assert = function(p, message) {\n if (!p)\n throw new AssertionError(message);\n}, getUserOptions = function(ctx, isCrossContext) {\n const ret = {\n stylize: ctx.stylize,\n showHidden: ctx.showHidden,\n depth: ctx.depth,\n colors: ctx.colors,\n customInspect: ctx.customInspect,\n showProxy: ctx.showProxy,\n maxArrayLength: ctx.maxArrayLength,\n maxStringLength: ctx.maxStringLength,\n breakLength: ctx.breakLength,\n compact: ctx.compact,\n sorted: ctx.sorted,\n getters: ctx.getters,\n numericSeparator: ctx.numericSeparator,\n ...ctx.userOptions\n };\n if (isCrossContext) {\n ObjectSetPrototypeOf(ret, null);\n for (let key of ObjectKeys(ret))\n if ((typeof ret[key] === \"object\" || typeof ret[key] === \"function\") && ret[key] !== null)\n delete ret[key];\n ret.stylize = ObjectSetPrototypeOf((value, flavour) => {\n let stylized;\n try {\n stylized = `${ctx.stylize(value, flavour)}`;\n } catch {\n }\n if (typeof stylized !== \"string\")\n return value;\n return stylized;\n }, null);\n }\n return ret;\n}, inspect = function(value, opts) {\n const ctx = {\n budget: {},\n indentationLvl: 0,\n seen: [],\n currentDepth: 0,\n stylize: stylizeNoColor,\n showHidden: inspectDefaultOptions.showHidden,\n depth: inspectDefaultOptions.depth,\n colors: inspectDefaultOptions.colors,\n customInspect: inspectDefaultOptions.customInspect,\n showProxy: inspectDefaultOptions.showProxy,\n maxArrayLength: inspectDefaultOptions.maxArrayLength,\n maxStringLength: inspectDefaultOptions.maxStringLength,\n breakLength: inspectDefaultOptions.breakLength,\n compact: inspectDefaultOptions.compact,\n sorted: inspectDefaultOptions.sorted,\n getters: inspectDefaultOptions.getters,\n numericSeparator: inspectDefaultOptions.numericSeparator\n };\n if (arguments.length > 1) {\n if (arguments.length > 2) {\n if (arguments[2] !== @undefined)\n ctx.depth = arguments[2];\n if (arguments.length > 3 && arguments[3] !== @undefined)\n ctx.colors = arguments[3];\n }\n if (typeof opts === \"boolean\")\n ctx.showHidden = opts;\n else if (opts) {\n const optKeys = ObjectKeys(opts);\n for (let i = 0;i < optKeys.length; ++i) {\n const key = optKeys[i];\n if (ObjectPrototypeHasOwnProperty(inspectDefaultOptions, key) || key === \"stylize\")\n ctx[key] = opts[key];\n else if (ctx.userOptions === @undefined)\n ctx.userOptions = opts;\n }\n }\n }\n if (ctx.colors)\n ctx.stylize = stylizeWithColor;\n if (ctx.maxArrayLength === null)\n ctx.maxArrayLength = @Infinity;\n if (ctx.maxStringLength === null)\n ctx.maxStringLength = @Infinity;\n return formatValue(ctx, value, 0);\n}, defineColorAlias = function(target, alias) {\n ObjectDefineProperty(inspect.colors, alias, {\n __proto__: null,\n get() {\n return this[target];\n },\n set(value) {\n this[target] = value;\n },\n configurable: !0,\n enumerable: !1\n });\n}, addQuotes = function(str, quotes) {\n if (quotes === -1)\n return `\"${str}\"`;\n if (quotes === -2)\n return `\\`${str}\\``;\n return `'${str}'`;\n}, escapeFn = function(str) {\n const charCode = StringPrototypeCharCodeAt(str);\n return meta.length > charCode \? meta[charCode] : `\\\\u${NumberPrototypeToString(charCode, 16)}`;\n}, strEscape = function(str) {\n let escapeTest = strEscapeSequencesRegExp, escapeReplace = strEscapeSequencesReplacer, singleQuote = 39;\n if (StringPrototypeIncludes(str, \"'\")) {\n if (!StringPrototypeIncludes(str, '\"'))\n singleQuote = -1;\n else if (!StringPrototypeIncludes(str, \"`\") && !StringPrototypeIncludes(str, \"${\"))\n singleQuote = -2;\n if (singleQuote !== 39)\n escapeTest = strEscapeSequencesRegExpSingle, escapeReplace = strEscapeSequencesReplacerSingle;\n }\n if (str.length < 5000 && RegExpPrototypeExec(escapeTest, str) === null)\n return addQuotes(str, singleQuote);\n if (str.length > 100)\n return str = RegExpPrototypeSymbolReplace(escapeReplace, str, escapeFn), addQuotes(str, singleQuote);\n let result = \"\", last = 0;\n for (let i = 0;i < str.length; i++) {\n const point = StringPrototypeCharCodeAt(str, i);\n if (point === singleQuote || point === 92 || point < 32 || point > 126 && point < 160) {\n if (last === i)\n result += meta[point];\n else\n result += `${StringPrototypeSlice(str, last, i)}${meta[point]}`;\n last = i + 1;\n } else if (point >= 55296 && point <= 57343) {\n if (point <= 56319 && i + 1 < str.length) {\n const point2 = StringPrototypeCharCodeAt(str, i + 1);\n if (point2 >= 56320 && point2 <= 57343) {\n i++;\n continue;\n }\n }\n result += `${StringPrototypeSlice(str, last, i)}\\\\u${NumberPrototypeToString(point, 16)}`, last = i + 1;\n }\n }\n if (last !== str.length)\n result += StringPrototypeSlice(str, last);\n return addQuotes(result, singleQuote);\n}, stylizeWithColor = function(str, styleType) {\n const style = inspect.styles[styleType];\n if (style !== @undefined) {\n const color = inspect.colors[style];\n if (color !== @undefined)\n return `\\x1B[${color[0]}m${str}\\x1B[${color[1]}m`;\n }\n return str;\n}, stylizeNoColor = function(str) {\n return str;\n}, getEmptyFormatArray = function() {\n return [];\n}, isInstanceof = function(object, proto) {\n try {\n return object instanceof proto;\n } catch {\n return !1;\n }\n}, getConstructorName = function(obj, ctx, recurseTimes, protoProps) {\n let firstProto;\n const tmp = obj;\n while (obj || isUndetectableObject(obj)) {\n const descriptor = ObjectGetOwnPropertyDescriptor(obj, \"constructor\");\n if (descriptor !== @undefined && typeof descriptor.value === \"function\" && descriptor.value.name !== \"\" && isInstanceof(tmp, descriptor.value)) {\n if (protoProps !== @undefined && (firstProto !== obj || !builtInObjects.has(descriptor.value.name)))\n addPrototypeProperties(ctx, tmp, firstProto || tmp, recurseTimes, protoProps);\n return String(descriptor.value.name);\n }\n if (obj = ObjectGetPrototypeOf(obj), firstProto === @undefined)\n firstProto = obj;\n }\n if (firstProto === null)\n return null;\n const res = internalGetConstructorName(tmp);\n if (recurseTimes > ctx.depth && ctx.depth !== null)\n return `${res} `;\n const protoConstr = getConstructorName(firstProto, ctx, recurseTimes + 1, protoProps);\n if (protoConstr === null)\n return `${res} <${inspect(firstProto, {\n ...ctx,\n customInspect: !1,\n depth: -1\n })}>`;\n return `${res} <${protoConstr}>`;\n}, addPrototypeProperties = function(ctx, main, obj, recurseTimes, output) {\n let depth = 0, keys, keySet;\n do {\n if (depth !== 0 || main === obj) {\n if (obj = ObjectGetPrototypeOf(obj), obj === null)\n return;\n const descriptor = ObjectGetOwnPropertyDescriptor(obj, \"constructor\");\n if (descriptor !== @undefined && typeof descriptor.value === \"function\" && builtInObjects.has(descriptor.value.name))\n return;\n }\n if (depth === 0)\n keySet = new SafeSet;\n else\n ArrayPrototypeForEach(keys, (key) => keySet.add(key));\n keys = ReflectOwnKeys(obj), ArrayPrototypePush(ctx.seen, main);\n for (let key of keys) {\n if (key === \"constructor\" || ObjectPrototypeHasOwnProperty(main, key) || depth !== 0 && keySet.has(key))\n continue;\n const desc = ObjectGetOwnPropertyDescriptor(obj, key);\n if (typeof desc.value === \"function\")\n continue;\n const value = formatProperty(ctx, obj, recurseTimes, key, kObjectType, desc, main);\n if (ctx.colors)\n ArrayPrototypePush(output, `\\x1B[2m${value}\\x1B[22m`);\n else\n ArrayPrototypePush(output, value);\n }\n ArrayPrototypePop(ctx.seen);\n } while (++depth !== 3);\n}, getPrefix = function(constructor, tag, fallback, size = \"\") {\n if (constructor === null) {\n if (tag !== \"\" && fallback !== tag)\n return `[${fallback}${size}: null prototype] [${tag}] `;\n return `[${fallback}${size}: null prototype] `;\n }\n if (tag !== \"\" && constructor !== tag)\n return `${constructor}${size} [${tag}] `;\n return `${constructor}${size} `;\n}, getKeys = function(value, showHidden) {\n let keys;\n const symbols = ObjectGetOwnPropertySymbols(value);\n if (showHidden) {\n if (keys = ObjectGetOwnPropertyNames(value), symbols.length !== 0)\n ArrayPrototypePushApply(keys, symbols);\n } else {\n try {\n keys = ObjectKeys(value);\n } catch (err) {\n assert(isNativeError(err) && err.name === \"ReferenceError\" && isModuleNamespaceObject(value)), keys = ObjectGetOwnPropertyNames(value);\n }\n if (symbols.length !== 0)\n ArrayPrototypePushApply(keys, ArrayPrototypeFilter(symbols, (key) => ObjectPrototypePropertyIsEnumerable(value, key)));\n }\n return keys;\n}, getCtxStyle = function(value, constructor, tag) {\n let fallback = \"\";\n if (constructor === null) {\n if (fallback = internalGetConstructorName(value), fallback === tag)\n fallback = \"Object\";\n }\n return getPrefix(constructor, tag, fallback);\n}, formatProxy = function(ctx, proxy, recurseTimes) {\n if (recurseTimes > ctx.depth && ctx.depth !== null)\n return ctx.stylize(\"Proxy [Array]\", \"special\");\n recurseTimes += 1, ctx.indentationLvl += 2;\n const res = [formatValue(ctx, proxy[0], recurseTimes), formatValue(ctx, proxy[1], recurseTimes)];\n return ctx.indentationLvl -= 2, reduceToSingleString(ctx, res, \"\", [\"Proxy [\", \"]\"], kArrayExtrasType, recurseTimes);\n}, formatValue = function(ctx, value, recurseTimes, typedArray) {\n if (typeof value !== \"object\" && typeof value !== \"function\" && !isUndetectableObject(value))\n return formatPrimitive(ctx.stylize, value, ctx);\n if (value === null)\n return ctx.stylize(\"null\", \"null\");\n const context = value, proxy = getProxyDetails(value, !!ctx.showProxy);\n if (proxy !== @undefined) {\n if (proxy === null || proxy[0] === null)\n return ctx.stylize(\"\", \"special\");\n if (ctx.showProxy)\n return formatProxy(ctx, proxy, recurseTimes);\n value = proxy;\n }\n if (ctx.customInspect) {\n const maybeCustom = value[customInspectSymbol];\n if (typeof maybeCustom === \"function\" && maybeCustom !== inspect && !(value.constructor && value.constructor.prototype === value)) {\n const depth = ctx.depth === null \? null : ctx.depth - recurseTimes, isCrossContext = proxy !== @undefined || !(context instanceof Object), ret = maybeCustom.@call(context, depth, getUserOptions(ctx, isCrossContext), inspect);\n if (ret !== context) {\n if (typeof ret !== \"string\")\n return formatValue(ctx, ret, recurseTimes);\n return StringPrototypeReplaceAll(ret, \"\\n\", `\\n${StringPrototypeRepeat(\" \", ctx.indentationLvl)}`);\n }\n }\n }\n if (ctx.seen.includes(value)) {\n let index = 1;\n if (ctx.circular === @undefined)\n ctx.circular = new SafeMap, ctx.circular.set(value, index);\n else if (index = ctx.circular.get(value), index === @undefined)\n index = ctx.circular.size + 1, ctx.circular.set(value, index);\n return ctx.stylize(`[Circular *${index}]`, \"special\");\n }\n return formatRaw(ctx, value, recurseTimes, typedArray);\n}, formatRaw = function(ctx, value, recurseTimes, typedArray) {\n let keys, protoProps;\n if (ctx.showHidden && (recurseTimes <= ctx.depth || ctx.depth === null))\n protoProps = [];\n const constructor = getConstructorName(value, ctx, recurseTimes, protoProps);\n if (protoProps !== @undefined && protoProps.length === 0)\n protoProps = @undefined;\n let tag = value[SymbolToStringTag];\n if (typeof tag !== \"string\" || tag !== \"\" && (ctx.showHidden \? ObjectPrototypeHasOwnProperty : ObjectPrototypePropertyIsEnumerable)(value, SymbolToStringTag))\n tag = \"\";\n let base = \"\", formatter = getEmptyFormatArray, braces, noIterator = !0, i = 0;\n const filter = ctx.showHidden \? 0 : 2;\n let extrasType = kObjectType;\n if ((SymbolIterator in value) || constructor === null)\n if (noIterator = !1, ArrayIsArray(value)) {\n const prefix = constructor !== \"Array\" || tag !== \"\" \? getPrefix(constructor, tag, \"Array\", `(${value.length})`) : \"\";\n if (keys = getOwnNonIndexProperties(value, filter), braces = [`${prefix}[`, \"]\"], value.length === 0 && keys.length === 0 && protoProps === @undefined)\n return `${braces[0]}]`;\n extrasType = kArrayExtrasType, formatter = formatArray;\n } else if (isSet(value)) {\n const size = SetPrototypeGetSize(value), prefix = getPrefix(constructor, tag, \"Set\", `(${size})`);\n if (keys = getKeys(value, ctx.showHidden), formatter = constructor !== null \? FunctionPrototypeBind(formatSet, null, value) : FunctionPrototypeBind(formatSet, null, SetPrototypeValues(value)), size === 0 && keys.length === 0 && protoProps === @undefined)\n return `${prefix}{}`;\n braces = [`${prefix}{`, \"}\"];\n } else if (isMap(value)) {\n const size = MapPrototypeGetSize(value), prefix = getPrefix(constructor, tag, \"Map\", `(${size})`);\n if (keys = getKeys(value, ctx.showHidden), formatter = constructor !== null \? FunctionPrototypeBind(formatMap, null, value) : FunctionPrototypeBind(formatMap, null, MapPrototypeEntries(value)), size === 0 && keys.length === 0 && protoProps === @undefined)\n return `${prefix}{}`;\n braces = [`${prefix}{`, \"}\"];\n } else if (isTypedArray(value)) {\n keys = getOwnNonIndexProperties(value, filter);\n let bound = value, fallback = \"\";\n if (constructor === null)\n fallback = TypedArrayPrototypeGetSymbolToStringTag(value), bound = new primordials[fallback](value);\n const size = TypedArrayPrototypeGetLength(value);\n if (braces = [`${getPrefix(constructor, tag, fallback, `(${size})`)}[`, \"]\"], value.length === 0 && keys.length === 0 && !ctx.showHidden)\n return `${braces[0]}]`;\n formatter = FunctionPrototypeBind(formatTypedArray, null, bound, size), extrasType = kArrayExtrasType;\n } else if (isMapIterator(value))\n keys = getKeys(value, ctx.showHidden), braces = getIteratorBraces(\"Map\", tag), formatter = FunctionPrototypeBind(formatIterator, null, braces);\n else if (isSetIterator(value))\n keys = getKeys(value, ctx.showHidden), braces = getIteratorBraces(\"Set\", tag), formatter = FunctionPrototypeBind(formatIterator, null, braces);\n else\n noIterator = !0;\n if (noIterator)\n if (keys = getKeys(value, ctx.showHidden), braces = [\"{\", \"}\"], constructor === \"Object\") {\n if (isArgumentsObject(value))\n braces[0] = \"[Arguments] {\";\n else if (tag !== \"\")\n braces[0] = `${getPrefix(constructor, tag, \"Object\")}{`;\n if (keys.length === 0 && protoProps === @undefined)\n return `${braces[0]}}`;\n } else if (typeof value === \"function\") {\n if (base = getFunctionBase(value, constructor, tag), keys.length === 0 && protoProps === @undefined)\n return ctx.stylize(base, \"special\");\n } else if (isRegExp(value)) {\n base = RegExpPrototypeToString(constructor !== null \? value : new RegExp(value));\n const prefix = getPrefix(constructor, tag, \"RegExp\");\n if (prefix !== \"RegExp \")\n base = `${prefix}${base}`;\n if (keys.length === 0 && protoProps === @undefined || recurseTimes > ctx.depth && ctx.depth !== null)\n return ctx.stylize(base, \"regexp\");\n } else if (isDate(value)) {\n base = NumberIsNaN(DatePrototypeGetTime(value)) \? DatePrototypeToString(value) : DatePrototypeToISOString(value);\n const prefix = getPrefix(constructor, tag, \"Date\");\n if (prefix !== \"Date \")\n base = `${prefix}${base}`;\n if (keys.length === 0 && protoProps === @undefined)\n return ctx.stylize(base, \"date\");\n } else if (value instanceof Error) {\n if (base = formatError(value, constructor, tag, ctx, keys), keys.length === 0 && protoProps === @undefined)\n return base;\n } else if (isAnyArrayBuffer(value)) {\n const arrayType = isArrayBuffer(value) \? \"ArrayBuffer\" : \"SharedArrayBuffer\", prefix = getPrefix(constructor, tag, arrayType);\n if (typedArray === @undefined)\n formatter = formatArrayBuffer;\n else if (keys.length === 0 && protoProps === @undefined)\n return prefix + `{ byteLength: ${formatNumber(ctx.stylize, value.byteLength, !1)} }`;\n braces[0] = `${prefix}{`, ArrayPrototypeUnshift(keys, \"byteLength\");\n } else if (isDataView(value))\n braces[0] = `${getPrefix(constructor, tag, \"DataView\")}{`, ArrayPrototypeUnshift(keys, \"byteLength\", \"byteOffset\", \"buffer\");\n else if (isPromise(value))\n braces[0] = `${getPrefix(constructor, tag, \"Promise\")}{`, formatter = formatPromise;\n else if (isWeakSet(value))\n braces[0] = `${getPrefix(constructor, tag, \"WeakSet\")}{`, formatter = ctx.showHidden \? formatWeakSet : formatWeakCollection;\n else if (isWeakMap(value))\n braces[0] = `${getPrefix(constructor, tag, \"WeakMap\")}{`, formatter = ctx.showHidden \? formatWeakMap : formatWeakCollection;\n else if (isModuleNamespaceObject(value))\n braces[0] = `${getPrefix(constructor, tag, \"Module\")}{`, formatter = formatNamespaceObject.bind(null, keys);\n else if (isBoxedPrimitive(value)) {\n if (base = getBoxedBase(value, ctx, keys, constructor, tag), keys.length === 0 && protoProps === @undefined)\n return base;\n } else {\n if (keys.length === 0 && protoProps === @undefined) {\n if (isExternal(value))\n return ctx.stylize(\"[External: 0]\", \"special\");\n return `${getCtxStyle(value, constructor, tag)}{}`;\n }\n braces[0] = `${getCtxStyle(value, constructor, tag)}{`;\n }\n if (recurseTimes > ctx.depth && ctx.depth !== null) {\n let constructorName = StringPrototypeSlice(getCtxStyle(value, constructor, tag), 0, -1);\n if (constructor !== null)\n constructorName = `[${constructorName}]`;\n return ctx.stylize(constructorName, \"special\");\n }\n recurseTimes += 1, ctx.seen.push(value), ctx.currentDepth = recurseTimes;\n let output;\n const indentationLvl = ctx.indentationLvl;\n try {\n if (ctx.currentDepth > 1000)\n @throwRangeError(ERROR_STACK_OVERFLOW_MSG);\n output = formatter(ctx, value, recurseTimes);\n for (i = 0;i < keys.length; i++)\n ArrayPrototypePush(output, formatProperty(ctx, value, recurseTimes, keys[i], extrasType));\n if (protoProps !== @undefined)\n ArrayPrototypePushApply(output, protoProps);\n } catch (err) {\n if (err instanceof RangeError && err.message === ERROR_STACK_OVERFLOW_MSG) {\n const constructorName = StringPrototypeSlice(getCtxStyle(value, constructor, tag), 0, -1);\n return ctx.seen.pop(), ctx.indentationLvl = indentationLvl, ctx.stylize(`[${constructorName}: Inspection interrupted prematurely. Maximum call stack size exceeded.]`, \"special\");\n }\n throw new AssertionError(\"handleMaxCallStackSize assertion failed: \" + String(err), !0);\n }\n if (ctx.circular !== @undefined) {\n const index = ctx.circular.get(value);\n if (index !== @undefined)\n if (ctx.seenRefs \?\?= new Set, !ctx.seenRefs.has(index)) {\n ctx.seenRefs.add(index);\n const reference = ctx.stylize(``, \"special\");\n if (ctx.compact !== !0)\n base = base === \"\" \? reference : `${reference} ${base}`;\n else\n braces[0] = `${reference} ${braces[0]}`;\n } else {\n //! this is a non-standard behavior compared to Node's implementation\n return ctx.stylize(`[Circular *${index}]`, \"special\");\n }\n }\n if (ctx.seen.pop(), ctx.sorted) {\n const comparator = ctx.sorted === !0 \? @undefined : ctx.sorted;\n if (extrasType === kObjectType)\n ArrayPrototypeSort(output, comparator);\n else if (keys.length > 1) {\n const sorted = ArrayPrototypeSort(ArrayPrototypeSlice(output, output.length - keys.length), comparator);\n ArrayPrototypeUnshift(sorted, output, output.length - keys.length, keys.length), ReflectApply(ArrayPrototypeSplice, null, sorted);\n }\n }\n const res = reduceToSingleString(ctx, output, base, braces, extrasType, recurseTimes, value), newLength = (ctx.budget[ctx.indentationLvl] || 0) + res.length;\n if (ctx.budget[ctx.indentationLvl] = newLength, newLength > 134217728)\n ctx.depth = -1;\n return res;\n}, getIteratorBraces = function(type, tag) {\n if (tag !== `${type} Iterator`) {\n if (tag !== \"\")\n tag += \"] [\";\n tag += `${type} Iterator`;\n }\n return [`[${tag}] {`, \"}\"];\n}, getBoxedBase = function(value, ctx, keys, constructor, tag) {\n let fn, type;\n if (isNumberObject(value))\n fn = NumberPrototypeValueOf, type = \"Number\";\n else if (isStringObject(value))\n fn = StringPrototypeValueOf, type = \"String\", keys.splice(0, value.length);\n else if (isBooleanObject(value))\n fn = BooleanPrototypeValueOf, type = \"Boolean\";\n else if (isBigIntObject(value))\n fn = BigIntPrototypeValueOf, type = \"BigInt\";\n else\n fn = SymbolPrototypeValueOf, type = \"Symbol\";\n let base = `[${type}`;\n if (type !== constructor)\n if (constructor === null)\n base += \" (null prototype)\";\n else\n base += ` (${constructor})`;\n if (base += `: ${formatPrimitive(stylizeNoColor, fn(value), ctx)}]`, tag !== \"\" && tag !== constructor)\n base += ` [${tag}]`;\n if (keys.length !== 0 || ctx.stylize === stylizeNoColor)\n return base;\n return ctx.stylize(base, StringPrototypeToLowerCase(type));\n}, getClassBase = function(value, constructor, tag) {\n let base = `class ${ObjectPrototypeHasOwnProperty(value, \"name\") && value.name || \"(anonymous)\"}`;\n if (constructor !== \"Function\" && constructor !== null)\n base += ` [${constructor}]`;\n if (tag !== \"\" && constructor !== tag)\n base += ` [${tag}]`;\n if (constructor !== null) {\n const superName = ObjectGetPrototypeOf(value).name;\n if (superName)\n base += ` extends ${superName}`;\n } else\n base += \" extends [null prototype]\";\n return `[${base}]`;\n}, getFunctionBase = function(value, constructor, tag) {\n const stringified = FunctionPrototypeToString(value);\n if (StringPrototypeStartsWith(stringified, \"class\") && StringPrototypeEndsWith(stringified, \"}\")) {\n const slice = StringPrototypeSlice(stringified, 5, -1), bracketIndex = StringPrototypeIndexOf(slice, \"{\");\n if (bracketIndex !== -1 && (!StringPrototypeIncludes(StringPrototypeSlice(slice, 0, bracketIndex), \"(\") || RegExpPrototypeExec(classRegExp, RegExpPrototypeSymbolReplace(stripCommentsRegExp, slice)) !== null))\n return getClassBase(value, constructor, tag);\n }\n let type = \"Function\";\n if (isGeneratorFunction(value))\n type = `Generator${type}`;\n if (isAsyncFunction(value))\n type = `Async${type}`;\n let base = `[${type}`;\n if (constructor === null)\n base += \" (null prototype)\";\n if (value.name === \"\")\n base += \" (anonymous)\";\n else\n base += `: ${value.name}`;\n if (base += \"]\", constructor !== type && constructor !== null)\n base += ` ${constructor}`;\n if (tag !== \"\" && constructor !== tag)\n base += ` [${tag}]`;\n return base;\n}, identicalSequenceRange = function(a, b) {\n for (let i = 0;i < a.length - 3; i++) {\n const pos = b.indexOf(a[i]);\n if (pos !== -1) {\n const rest = b.length - pos;\n if (rest > 3) {\n let len = 1;\n const maxLen = MathMin(a.length - i, rest);\n while (maxLen > len && a[i + len] === b[pos + len])\n len++;\n if (len > 3)\n return { len, offset: i };\n }\n }\n }\n return { len: 0, offset: 0 };\n}, getStackString = function(error) {\n return error.stack \? String(error.stack) : ErrorPrototypeToString(error);\n}, getStackFrames = function(ctx, err, stack) {\n const frames = StringPrototypeSplit(stack, \"\\n\");\n let cause;\n try {\n ({ cause } = err);\n } catch {\n }\n if (cause != null && cause instanceof Error) {\n const causeStack = getStackString(cause), causeStackStart = StringPrototypeIndexOf(causeStack, \"\\n at\");\n if (causeStackStart !== -1) {\n const causeFrames = StringPrototypeSplit(StringPrototypeSlice(causeStack, causeStackStart + 1), \"\\n\"), { len, offset } = identicalSequenceRange(frames, causeFrames);\n if (len > 0) {\n const skipped = len - 2, msg = ` ... ${skipped} lines matching cause stack trace ...`;\n frames.splice(offset + 1, skipped, ctx.stylize(msg, \"undefined\"));\n }\n }\n }\n return frames;\n}, improveStack = function(stack, constructor, name, tag) {\n let len = name.length;\n if (constructor === null || StringPrototypeEndsWith(name, \"Error\") && StringPrototypeStartsWith(stack, name) && (stack.length === len || stack[len] === \":\" || stack[len] === \"\\n\")) {\n let fallback = \"Error\";\n if (constructor === null) {\n const start = RegExpPrototypeExec(/^([A-Z][a-z_ A-Z0-9[\\]()-]+)(\?::|\\n {4}at)/, stack) || RegExpPrototypeExec(/^([a-z_A-Z0-9-]*Error)$/, stack);\n fallback = start && start[1] || \"\", len = fallback.length, fallback = fallback || \"Error\";\n }\n const prefix = StringPrototypeSlice(getPrefix(constructor, tag, fallback), 0, -1);\n if (name !== prefix)\n if (StringPrototypeIncludes(prefix, name))\n if (len === 0)\n stack = `${prefix}: ${stack}`;\n else\n stack = `${prefix}${StringPrototypeSlice(stack, len)}`;\n else\n stack = `${prefix} [${name}]${StringPrototypeSlice(stack, len)}`;\n }\n return stack;\n}, removeDuplicateErrorKeys = function(ctx, keys, err, stack) {\n if (!ctx.showHidden && keys.length !== 0)\n for (let name of [\"name\", \"message\", \"stack\"]) {\n const index = ArrayPrototypeIndexOf(keys, name);\n if (index !== -1 && StringPrototypeIncludes(stack, err[name]))\n ArrayPrototypeSplice(keys, index, 1);\n }\n}, markNodeModules = function(ctx, line) {\n let tempLine = \"\", nodeModule, pos = 0;\n while ((nodeModule = nodeModulesRegExp.exec(line)) !== null)\n tempLine += StringPrototypeSlice(line, pos, nodeModule.index + 14), tempLine += ctx.stylize(nodeModule[1], \"module\"), pos = nodeModule.index + nodeModule[0].length;\n if (pos !== 0)\n line = tempLine + StringPrototypeSlice(line, pos);\n return line;\n}, markCwd = function(ctx, line, workingDirectory) {\n let cwdStartPos = StringPrototypeIndexOf(line, workingDirectory), tempLine = \"\", cwdLength = workingDirectory.length;\n if (cwdStartPos !== -1) {\n if (StringPrototypeSlice(line, cwdStartPos - 7, cwdStartPos) === \"file://\")\n cwdLength += 7, cwdStartPos -= 7;\n const start = line[cwdStartPos - 1] === \"(\" \? cwdStartPos - 1 : cwdStartPos, end = start !== cwdStartPos && StringPrototypeEndsWith(line, \")\") \? -1 : line.length, workingDirectoryEndPos = cwdStartPos + cwdLength + 1, cwdSlice = StringPrototypeSlice(line, start, workingDirectoryEndPos);\n if (tempLine += StringPrototypeSlice(line, 0, start), tempLine += ctx.stylize(cwdSlice, \"undefined\"), tempLine += StringPrototypeSlice(line, workingDirectoryEndPos, end), end === -1)\n tempLine += ctx.stylize(\")\", \"undefined\");\n } else\n tempLine += line;\n return tempLine;\n}, safeGetCWD = function() {\n let workingDirectory;\n try {\n workingDirectory = process.cwd();\n } catch {\n return;\n }\n return workingDirectory;\n}, formatError = function(err, constructor, tag, ctx, keys) {\n const name = err.name != null \? String(err.name) : \"Error\";\n let stack = getStackString(err);\n //! temp fix for Bun losing the error name from inherited errors + extraneous \": \" with no message\n if (stack = stack.replace(/^Error: /, `${name}${err.message \? \": \" : \"\"}`), removeDuplicateErrorKeys(ctx, keys, err, stack), (\"cause\" in err) && (keys.length === 0 || !ArrayPrototypeIncludes(keys, \"cause\")))\n ArrayPrototypePush(keys, \"cause\");\n if (ArrayIsArray(err.errors) && (keys.length === 0 || !ArrayPrototypeIncludes(keys, \"errors\")))\n ArrayPrototypePush(keys, \"errors\");\n stack = improveStack(stack, constructor, name, tag);\n let pos = err.message && StringPrototypeIndexOf(stack, err.message) || -1;\n if (pos !== -1)\n pos += err.message.length;\n const stackStart = StringPrototypeIndexOf(stack, \"\\n at\", pos);\n if (stackStart === -1)\n stack = `[${stack}]`;\n else {\n let newStack = StringPrototypeSlice(stack, 0, stackStart);\n const stackFramePart = StringPrototypeSlice(stack, stackStart + 1), lines = getStackFrames(ctx, err, stackFramePart);\n if (ctx.colors) {\n const workingDirectory = safeGetCWD();\n let esmWorkingDirectory;\n for (let line of lines) {\n const core = RegExpPrototypeExec(coreModuleRegExp, line);\n if (core !== null && (StringPrototypeStartsWith(core[1], \"internal/\") || ArrayPrototypeIncludes(@requireNativeModule(\"module\").builtinModules, core[1])))\n newStack += `\\n${ctx.stylize(line, \"undefined\")}`;\n else {\n if (newStack += \"\\n\", line = markNodeModules(ctx, line), workingDirectory !== @undefined) {\n let newLine = markCwd(ctx, line, workingDirectory);\n if (newLine === line)\n esmWorkingDirectory \?\?= pathToFileURL(workingDirectory), newLine = markCwd(ctx, line, esmWorkingDirectory);\n line = newLine;\n }\n newStack += line;\n }\n }\n } else\n newStack += `\\n${ArrayPrototypeJoin(lines, \"\\n\")}`;\n stack = newStack;\n }\n if (ctx.indentationLvl !== 0) {\n const indentation = StringPrototypeRepeat(\" \", ctx.indentationLvl);\n stack = StringPrototypeReplaceAll(stack, \"\\n\", `\\n${indentation}`);\n }\n return stack;\n}, groupArrayElements = function(ctx, output, value) {\n let totalLength = 0, maxLength = 0, i = 0, outputLength = output.length;\n if (ctx.maxArrayLength < output.length)\n outputLength--;\n const separatorSpace = 2, dataLen = new Array(outputLength);\n for (;i < outputLength; i++) {\n const len = getStringWidth(output[i], ctx.colors);\n if (dataLen[i] = len, totalLength += len + separatorSpace, maxLength < len)\n maxLength = len;\n }\n const actualMax = maxLength + separatorSpace;\n if (actualMax * 3 + ctx.indentationLvl < ctx.breakLength && (totalLength / actualMax > 5 || maxLength <= 6)) {\n const averageBias = MathSqrt(actualMax - totalLength / output.length), biasedMax = MathMax(actualMax - 3 - averageBias, 1), columns = MathMin(MathRound(MathSqrt(2.5 * biasedMax * outputLength) / biasedMax), MathFloor((ctx.breakLength - ctx.indentationLvl) / actualMax), ctx.compact * 4, 15);\n if (columns <= 1)\n return output;\n const tmp = [], maxLineLength = [];\n for (let i2 = 0;i2 < columns; i2++) {\n let lineMaxLength = 0;\n for (let j = i2;j < output.length; j += columns)\n if (dataLen[j] > lineMaxLength)\n lineMaxLength = dataLen[j];\n lineMaxLength += separatorSpace, maxLineLength[i2] = lineMaxLength;\n }\n let order = StringPrototypePadStart;\n if (value !== @undefined) {\n for (let i2 = 0;i2 < output.length; i2++)\n if (typeof value[i2] !== \"number\" && typeof value[i2] !== \"bigint\") {\n order = StringPrototypePadEnd;\n break;\n }\n }\n for (let i2 = 0;i2 < outputLength; i2 += columns) {\n const max = MathMin(i2 + columns, outputLength);\n let str = \"\", j = i2;\n for (;j < max - 1; j++) {\n const padding = maxLineLength[j - i2] + output[j].length - dataLen[j];\n str += order(`${output[j]}, `, padding, \" \");\n }\n if (order === StringPrototypePadStart) {\n const padding = maxLineLength[j - i2] + output[j].length - dataLen[j] - separatorSpace;\n str += StringPrototypePadStart(output[j], padding, \" \");\n } else\n str += output[j];\n ArrayPrototypePush(tmp, str);\n }\n if (ctx.maxArrayLength < output.length)\n ArrayPrototypePush(tmp, output[outputLength]);\n output = tmp;\n }\n return output;\n}, addNumericSeparator = function(integerString) {\n let result = \"\", i = integerString.length;\n const start = StringPrototypeStartsWith(integerString, \"-\") \? 1 : 0;\n for (;i >= start + 4; i -= 3)\n result = `_${StringPrototypeSlice(integerString, i - 3, i)}${result}`;\n return i === integerString.length \? integerString : `${StringPrototypeSlice(integerString, 0, i)}${result}`;\n}, addNumericSeparatorEnd = function(integerString) {\n let result = \"\", i = 0;\n for (;i < integerString.length - 3; i += 3)\n result += `${StringPrototypeSlice(integerString, i, i + 3)}_`;\n return i === 0 \? integerString : `${result}${StringPrototypeSlice(integerString, i)}`;\n}, formatNumber = function(fn, number, numericSeparator) {\n if (!numericSeparator) {\n if (ObjectIs(number, -0))\n return fn(\"-0\", \"number\");\n return fn(`${number}`, \"number\");\n }\n const integer = MathTrunc(number), string = String(integer);\n if (integer === number) {\n if (!NumberIsFinite(number) || StringPrototypeIncludes(string, \"e\"))\n return fn(string, \"number\");\n return fn(`${addNumericSeparator(string)}`, \"number\");\n }\n if (NumberIsNaN(number))\n return fn(string, \"number\");\n return fn(`${addNumericSeparator(string)}.${addNumericSeparatorEnd(StringPrototypeSlice(String(number), string.length + 1))}`, \"number\");\n}, formatBigInt = function(fn, bigint, numericSeparator) {\n const string = String(bigint);\n if (!numericSeparator)\n return fn(`${string}n`, \"bigint\");\n return fn(`${addNumericSeparator(string)}n`, \"bigint\");\n}, formatPrimitive = function(fn, value, ctx) {\n if (typeof value === \"string\") {\n let trailer = \"\";\n if (value.length > ctx.maxStringLength) {\n const remaining = value.length - ctx.maxStringLength;\n value = StringPrototypeSlice(value, 0, ctx.maxStringLength), trailer = `... ${remaining} more character${remaining > 1 \? \"s\" : \"\"}`;\n }\n if (ctx.compact !== !0 && value.length > kMinLineLength && value.length > ctx.breakLength - ctx.indentationLvl - 4)\n return ArrayPrototypeJoin(ArrayPrototypeMap(extractedSplitNewLines(value), (line) => fn(strEscape(line), \"string\")), ` +\\n${StringPrototypeRepeat(\" \", ctx.indentationLvl + 2)}`) + trailer;\n return fn(strEscape(value), \"string\") + trailer;\n }\n if (typeof value === \"number\")\n return formatNumber(fn, value, ctx.numericSeparator);\n if (typeof value === \"bigint\")\n return formatBigInt(fn, value, ctx.numericSeparator);\n if (typeof value === \"boolean\")\n return fn(`${value}`, \"boolean\");\n if (typeof value === \"undefined\")\n return fn(\"undefined\", \"undefined\");\n return fn(SymbolPrototypeToString(value), \"symbol\");\n}, formatNamespaceObject = function(keys, ctx, value, recurseTimes) {\n const output = new Array(keys.length);\n for (let i = 0;i < keys.length; i++)\n try {\n output[i] = formatProperty(ctx, value, recurseTimes, keys[i], kObjectType);\n } catch (err) {\n assert(isNativeError(err) && err.name === \"ReferenceError\");\n const tmp = { [keys[i]]: \"\" };\n output[i] = formatProperty(ctx, tmp, recurseTimes, keys[i], kObjectType);\n const pos = StringPrototypeLastIndexOf(output[i], \" \");\n output[i] = StringPrototypeSlice(output[i], 0, pos + 1) + ctx.stylize(\"\", \"special\");\n }\n return keys.length = 0, output;\n}, formatSpecialArray = function(ctx, value, recurseTimes, maxLength, output, i) {\n const keys = ObjectKeys(value);\n let index = i;\n for (;i < keys.length && output.length < maxLength; i++) {\n const key = keys[i], tmp = +key;\n if (tmp > 4294967294)\n break;\n if (`${index}` !== key) {\n if (RegExpPrototypeExec(numberRegExp, key) === null)\n break;\n const emptyItems = tmp - index, ending = emptyItems > 1 \? \"s\" : \"\", message = `<${emptyItems} empty item${ending}>`;\n if (ArrayPrototypePush(output, ctx.stylize(message, \"undefined\")), index = tmp, output.length === maxLength)\n break;\n }\n ArrayPrototypePush(output, formatProperty(ctx, value, recurseTimes, key, kArrayType)), index++;\n }\n const remaining = value.length - index;\n if (output.length !== maxLength) {\n if (remaining > 0) {\n const ending = remaining > 1 \? \"s\" : \"\", message = `<${remaining} empty item${ending}>`;\n ArrayPrototypePush(output, ctx.stylize(message, \"undefined\"));\n }\n } else if (remaining > 0)\n ArrayPrototypePush(output, remainingText(remaining));\n return output;\n}, hexSlice = function(buf, start = 0, end) {\n return ArrayPrototypeJoin(ArrayPrototypeMap(buf.slice(start, end), (x) => (\"00\" + x.toString(16)).slice(-2)), \"\");\n}, formatArrayBuffer = function(ctx, value) {\n let buffer;\n try {\n buffer = new Uint8Array(value);\n } catch {\n return [ctx.stylize(\"(detached)\", \"special\")];\n }\n let str = StringPrototypeTrim(RegExpPrototypeSymbolReplace(/(.{2})/g, hexSlice(buffer, 0, MathMin(ctx.maxArrayLength, buffer.length)), \"$1 \"));\n const remaining = buffer.length - ctx.maxArrayLength;\n if (remaining > 0)\n str += ` ... ${remaining} more byte${remaining > 1 \? \"s\" : \"\"}`;\n return [`${ctx.stylize(\"[Uint8Contents]\", \"special\")}: <${str}>`];\n}, formatArray = function(ctx, value, recurseTimes) {\n const valLen = value.length, len = MathMin(MathMax(0, ctx.maxArrayLength), valLen), remaining = valLen - len, output = [];\n for (let i = 0;i < len; i++) {\n if (!ObjectPrototypeHasOwnProperty(value, i))\n return formatSpecialArray(ctx, value, recurseTimes, len, output, i);\n ArrayPrototypePush(output, formatProperty(ctx, value, recurseTimes, i, kArrayType));\n }\n if (remaining > 0)\n ArrayPrototypePush(output, remainingText(remaining));\n return output;\n}, formatTypedArray = function(value, length, ctx, ignored, recurseTimes) {\n const maxLength = MathMin(MathMax(0, ctx.maxArrayLength), length), remaining = value.length - maxLength, output = new Array(maxLength), elementFormatter = value.length > 0 && typeof value[0] === \"number\" \? formatNumber : formatBigInt;\n for (let i = 0;i < maxLength; ++i)\n output[i] = elementFormatter(ctx.stylize, value[i], ctx.numericSeparator);\n if (remaining > 0)\n output[maxLength] = remainingText(remaining);\n if (ctx.showHidden) {\n ctx.indentationLvl += 2;\n for (let key of [\"BYTES_PER_ELEMENT\", \"length\", \"byteLength\", \"byteOffset\", \"buffer\"]) {\n const str = formatValue(ctx, value[key], recurseTimes, !0);\n ArrayPrototypePush(output, `[${key}]: ${str}`);\n }\n ctx.indentationLvl -= 2;\n }\n return output;\n}, formatSet = function(value, ctx, ignored, recurseTimes) {\n const length = value.size, maxLength = MathMin(MathMax(0, ctx.maxArrayLength), length), remaining = length - maxLength, output = [];\n ctx.indentationLvl += 2;\n let i = 0;\n for (let v of value) {\n if (i >= maxLength)\n break;\n ArrayPrototypePush(output, formatValue(ctx, v, recurseTimes)), i++;\n }\n if (remaining > 0)\n ArrayPrototypePush(output, remainingText(remaining));\n return ctx.indentationLvl -= 2, output;\n}, formatMap = function(value, ctx, ignored, recurseTimes) {\n const length = value.size, maxLength = MathMin(MathMax(0, ctx.maxArrayLength), length), remaining = length - maxLength, output = [];\n ctx.indentationLvl += 2;\n let i = 0;\n for (let { 0: k, 1: v } of value) {\n if (i >= maxLength)\n break;\n ArrayPrototypePush(output, `${formatValue(ctx, k, recurseTimes)} => ${formatValue(ctx, v, recurseTimes)}`), i++;\n }\n if (remaining > 0)\n ArrayPrototypePush(output, remainingText(remaining));\n return ctx.indentationLvl -= 2, output;\n}, formatSetIterInner = function(ctx, recurseTimes, entries, state) {\n const maxArrayLength = MathMax(ctx.maxArrayLength, 0), maxLength = MathMin(maxArrayLength, entries.length), output = new Array(maxLength);\n ctx.indentationLvl += 2;\n for (let i = 0;i < maxLength; i++)\n output[i] = formatValue(ctx, entries[i], recurseTimes);\n if (ctx.indentationLvl -= 2, state === kWeak && !ctx.sorted)\n ArrayPrototypeSort(output);\n const remaining = entries.length - maxLength;\n if (remaining > 0)\n ArrayPrototypePush(output, remainingText(remaining));\n return output;\n}, formatMapIterInner = function(ctx, recurseTimes, entries, state) {\n const maxArrayLength = MathMax(ctx.maxArrayLength, 0), len = entries.length / 2, remaining = len - maxArrayLength, maxLength = MathMin(maxArrayLength, len), output = new Array(maxLength);\n let i = 0;\n if (ctx.indentationLvl += 2, state === kWeak) {\n for (;i < maxLength; i++) {\n const pos = i * 2;\n output[i] = `${formatValue(ctx, entries[pos], recurseTimes)} => ${formatValue(ctx, entries[pos + 1], recurseTimes)}`;\n }\n if (!ctx.sorted)\n ArrayPrototypeSort(output);\n } else\n for (;i < maxLength; i++) {\n const pos = i * 2, res = [formatValue(ctx, entries[pos], recurseTimes), formatValue(ctx, entries[pos + 1], recurseTimes)];\n output[i] = reduceToSingleString(ctx, res, \"\", [\"[\", \"]\"], kArrayExtrasType, recurseTimes);\n }\n if (ctx.indentationLvl -= 2, remaining > 0)\n ArrayPrototypePush(output, remainingText(remaining));\n return output;\n}, formatWeakCollection = function(ctx) {\n return [ctx.stylize(\"\", \"special\")];\n}, formatWeakSet = function(ctx, value, recurseTimes) {\n const entries = previewEntries(value);\n return formatSetIterInner(ctx, recurseTimes, entries, kWeak);\n}, formatWeakMap = function(ctx, value, recurseTimes) {\n const entries = previewEntries(value);\n return formatMapIterInner(ctx, recurseTimes, entries, kWeak);\n}, formatIterator = function(braces, ctx, value, recurseTimes) {\n const { 0: entries, 1: isKeyValue } = previewEntries(value, !0);\n if (isKeyValue)\n return braces[0] = RegExpPrototypeSymbolReplace(/ Iterator] {$/, braces[0], \" Entries] {\"), formatMapIterInner(ctx, recurseTimes, entries, kMapEntries);\n return formatSetIterInner(ctx, recurseTimes, entries, kIterator);\n}, formatPromise = function(ctx, value, recurseTimes) {\n let output;\n const { 0: state, 1: result } = getPromiseDetails(value);\n if (state === kPending)\n output = [ctx.stylize(\"\", \"special\")];\n else {\n ctx.indentationLvl += 2;\n const str = formatValue(ctx, result, recurseTimes);\n ctx.indentationLvl -= 2, output = [state === kRejected \? `${ctx.stylize(\"\", \"special\")} ${str}` : str];\n }\n return output;\n}, formatProperty = function(ctx, value, recurseTimes, key, type, desc, original = value) {\n let name, str, extra = \" \";\n if (desc ||= ObjectGetOwnPropertyDescriptor(value, key) || { value: value[key], enumerable: !0 }, desc.value !== @undefined) {\n const diff = ctx.compact !== !0 || type !== kObjectType \? 2 : 3;\n if (ctx.indentationLvl += diff, str = formatValue(ctx, desc.value, recurseTimes), diff === 3 && ctx.breakLength < getStringWidth(str, ctx.colors))\n extra = `\\n${StringPrototypeRepeat(\" \", ctx.indentationLvl)}`;\n ctx.indentationLvl -= diff;\n } else if (desc.get !== @undefined) {\n const label = desc.set !== @undefined \? \"Getter/Setter\" : \"Getter\", s = ctx.stylize;\n if (ctx.getters && (ctx.getters === !0 || ctx.getters === \"get\" && desc.set === @undefined || ctx.getters === \"set\" && desc.set !== @undefined))\n try {\n const tmp = desc.get.@call(original);\n if (ctx.indentationLvl += 2, tmp === null)\n str = `${s(`[${label}:`, \"special\")} ${s(\"null\", \"null\")}${s(\"]\", \"special\")}`;\n else if (typeof tmp === \"object\")\n str = `${s(`[${label}]`, \"special\")} ${formatValue(ctx, tmp, recurseTimes)}`;\n else {\n const primitive = formatPrimitive(s, tmp, ctx);\n str = `${s(`[${label}:`, \"special\")} ${primitive}${s(\"]\", \"special\")}`;\n }\n ctx.indentationLvl -= 2;\n } catch (err) {\n const message = ``;\n str = `${s(`[${label}:`, \"special\")} ${message}${s(\"]\", \"special\")}`;\n }\n else\n str = ctx.stylize(`[${label}]`, \"special\");\n } else if (desc.set !== @undefined)\n str = ctx.stylize(\"[Setter]\", \"special\");\n else\n str = ctx.stylize(\"undefined\", \"undefined\");\n if (type === kArrayType)\n return str;\n if (typeof key === \"symbol\") {\n const tmp = RegExpPrototypeSymbolReplace(strEscapeSequencesReplacer, SymbolPrototypeToString(key), escapeFn);\n name = `[${ctx.stylize(tmp, \"symbol\")}]`;\n } else if (key === \"__proto__\")\n name = \"['__proto__']\";\n else if (desc.enumerable === !1)\n name = `[${RegExpPrototypeSymbolReplace(strEscapeSequencesReplacer, key, escapeFn)}]`;\n else if (RegExpPrototypeExec(keyStrRegExp, key) !== null)\n name = ctx.stylize(key, \"name\");\n else\n name = ctx.stylize(strEscape(key), \"string\");\n return `${name}:${extra}${str}`;\n}, isBelowBreakLength = function(ctx, output, start, base) {\n let totalLength = output.length + start;\n if (totalLength + output.length > ctx.breakLength)\n return !1;\n for (let i = 0;i < output.length; i++) {\n if (ctx.colors)\n totalLength += StringPrototypeReplaceAll(output[i], /\\u001B\\[\\d\\d\?m/g, \"\").length;\n else\n totalLength += output[i].length;\n if (totalLength > ctx.breakLength)\n return !1;\n }\n return base === \"\" || !StringPrototypeIncludes(base, \"\\n\");\n}, reduceToSingleString = function(ctx, output, base, braces, extrasType, recurseTimes, value) {\n if (ctx.compact !== !0) {\n if (typeof ctx.compact === \"number\" && ctx.compact >= 1) {\n const entries = output.length;\n if (extrasType === kArrayExtrasType && entries > 6)\n output = groupArrayElements(ctx, output, value);\n if (ctx.currentDepth - recurseTimes < ctx.compact && entries === output.length) {\n const start = output.length + ctx.indentationLvl + braces[0].length + base.length + 10;\n if (isBelowBreakLength(ctx, output, start, base)) {\n const joinedOutput = ArrayPrototypeJoin(output, \", \");\n if (!StringPrototypeIncludes(joinedOutput, \"\\n\"))\n return `${base \? `${base} ` : \"\"}${braces[0]} ${joinedOutput}` + ` ${braces[1]}`;\n }\n }\n }\n const indentation2 = `\\n${StringPrototypeRepeat(\" \", ctx.indentationLvl)}`;\n return `${base \? `${base} ` : \"\"}${braces[0]}${indentation2} ` + `${ArrayPrototypeJoin(output, `,${indentation2} `)}${indentation2}${braces[1]}`;\n }\n if (isBelowBreakLength(ctx, output, 0, base))\n return `${braces[0]}${base \? ` ${base}` : \"\"} ${ArrayPrototypeJoin(output, \", \")} ` + braces[1];\n const indentation = StringPrototypeRepeat(\" \", ctx.indentationLvl), ln = base === \"\" && braces[0].length === 1 \? \" \" : `${base \? ` ${base}` : \"\"}\\n${indentation} `;\n return `${braces[0]}${ln}${ArrayPrototypeJoin(output, `,\\n${indentation} `)} ${braces[1]}`;\n}, hasBuiltInToString = function(value) {\n const proxyTarget = getProxyDetails(value, !1);\n if (proxyTarget !== @undefined) {\n if (proxyTarget === null)\n return !0;\n value = proxyTarget;\n }\n if (typeof value.toString !== \"function\")\n return !0;\n if (ObjectPrototypeHasOwnProperty(value, \"toString\"))\n return !1;\n let pointer = value;\n do\n pointer = ObjectGetPrototypeOf(pointer);\n while (!ObjectPrototypeHasOwnProperty(pointer, \"toString\"));\n const descriptor = ObjectGetOwnPropertyDescriptor(pointer, \"constructor\");\n return descriptor !== @undefined && typeof descriptor.value === \"function\" && builtInObjects.has(descriptor.value.name);\n}, tryStringify = function(arg) {\n try {\n return JSONStringify(arg);\n } catch (err) {\n if (!CIRCULAR_ERROR_MESSAGE)\n try {\n const a = {};\n a.a = a, JSONStringify(a);\n } catch (circularError) {\n CIRCULAR_ERROR_MESSAGE = firstErrorLine(circularError);\n }\n if (err.name === \"TypeError\" && firstErrorLine(err) === CIRCULAR_ERROR_MESSAGE)\n return \"[Circular]\";\n throw err;\n }\n}, format = function(...args) {\n return formatWithOptionsInternal(@undefined, args);\n}, formatWithOptions = function(inspectOptions, ...args) {\n return validateObject(inspectOptions, \"inspectOptions\", { allowArray: !0 }), formatWithOptionsInternal(inspectOptions, args);\n}, formatNumberNoColor = function(number, options) {\n return formatNumber(stylizeNoColor, number, options\?.numericSeparator \?\? inspectDefaultOptions.numericSeparator);\n}, formatBigIntNoColor = function(bigint, options) {\n return formatBigInt(stylizeNoColor, bigint, options\?.numericSeparator \?\? inspectDefaultOptions.numericSeparator);\n}, formatWithOptionsInternal = function(inspectOptions, args) {\n const first = args[0];\n let a = 0, str = \"\", join = \"\";\n if (typeof first === \"string\") {\n if (args.length === 1)\n return first;\n let tempStr, lastPos = 0;\n for (let i = 0;i < first.length - 1; i++)\n if (StringPrototypeCharCodeAt(first, i) === 37) {\n const nextChar = StringPrototypeCharCodeAt(first, ++i);\n if (a + 1 !== args.length) {\n switch (nextChar) {\n case 115: {\n const tempArg = args[++a];\n if (typeof tempArg === \"number\")\n tempStr = formatNumberNoColor(tempArg, inspectOptions);\n else if (typeof tempArg === \"bigint\")\n tempStr = formatBigIntNoColor(tempArg, inspectOptions);\n else if (typeof tempArg !== \"object\" || tempArg === null || !hasBuiltInToString(tempArg))\n tempStr = String(tempArg);\n else\n tempStr = inspect(tempArg, {\n ...inspectOptions,\n compact: 3,\n colors: !1,\n depth: 0\n });\n break;\n }\n case 106:\n tempStr = tryStringify(args[++a]);\n break;\n case 100: {\n const tempNum = args[++a];\n if (typeof tempNum === \"bigint\")\n tempStr = formatBigIntNoColor(tempNum, inspectOptions);\n else if (typeof tempNum === \"symbol\")\n tempStr = \"NaN\";\n else\n tempStr = formatNumberNoColor(Number(tempNum), inspectOptions);\n break;\n }\n case 79:\n tempStr = inspect(args[++a], inspectOptions);\n break;\n case 111:\n tempStr = inspect(args[++a], {\n ...inspectOptions,\n showHidden: !0,\n showProxy: !0,\n depth: 4\n });\n break;\n case 105: {\n const tempInteger = args[++a];\n if (typeof tempInteger === \"bigint\")\n tempStr = formatBigIntNoColor(tempInteger, inspectOptions);\n else if (typeof tempInteger === \"symbol\")\n tempStr = \"NaN\";\n else\n tempStr = formatNumberNoColor(NumberParseInt(tempInteger), inspectOptions);\n break;\n }\n case 102: {\n const tempFloat = args[++a];\n if (typeof tempFloat === \"symbol\")\n tempStr = \"NaN\";\n else\n tempStr = formatNumberNoColor(NumberParseFloat(tempFloat), inspectOptions);\n break;\n }\n case 99:\n a += 1, tempStr = \"\";\n break;\n case 37:\n str += StringPrototypeSlice(first, lastPos, i), lastPos = i + 1;\n continue;\n default:\n continue;\n }\n if (lastPos !== i - 1)\n str += StringPrototypeSlice(first, lastPos, i - 1);\n str += tempStr, lastPos = i + 1;\n } else if (nextChar === 37)\n str += StringPrototypeSlice(first, lastPos, i), lastPos = i + 1;\n }\n if (lastPos !== 0) {\n if (a++, join = \" \", lastPos < first.length)\n str += StringPrototypeSlice(first, lastPos);\n }\n }\n while (a < args.length) {\n const value = args[a];\n str += join, str += typeof value !== \"string\" \? inspect(value, inspectOptions) : value, join = \" \", a++;\n }\n return str;\n}, isZeroWidthCodePoint = function(code) {\n return code <= 31 || code >= 127 && code <= 159 || code >= 768 && code <= 879 || code >= 8203 && code <= 8207 || code >= 8400 && code <= 8447 || code >= 65024 && code <= 65039 || code >= 65056 && code <= 65071 || code >= 917760 && code <= 917999;\n}, stripVTControlCharacters = function(str) {\n if (typeof str !== \"string\")\n throw new codes.ERR_INVALID_ARG_TYPE(\"str\", \"string\", str);\n return RegExpPrototypeSymbolReplace(ansi, str, \"\");\n}, getOwnNonIndexProperties = function(a, filter = 2) {\n const desc = ObjectGetOwnPropertyDescriptors(a), ret = [];\n for (let [k, v] of ObjectEntries(desc))\n if (!RegExpPrototypeTest(/^(0|[1-9][0-9]*)$/, k) || NumberParseInt(k, 10) >= 4294967295)\n if (filter === 2 && !v.enumerable)\n continue;\n else\n ArrayPrototypePush(ret, k);\n for (let s of ObjectGetOwnPropertySymbols(a)) {\n const v = ObjectGetOwnPropertyDescriptor(a, s);\n if (filter === 2 && !v.enumerable)\n continue;\n ArrayPrototypePush(ret, s);\n }\n return ret;\n}, getPromiseDetails = function(promise) {\n const state = @getPromiseInternalField(promise, @promiseFieldFlags) & @promiseStateMask;\n if (state !== @promiseStatePending)\n return [\n state === @promiseStateRejected \? kRejected : kFulfilled,\n @getPromiseInternalField(promise, @promiseFieldReactionsOrResult)\n ];\n return [kPending, @undefined];\n}, getProxyDetails = function(proxy, withHandler = !0) {\n if (!@isProxyObject(proxy))\n return @undefined;\n const handler = @getProxyInternalField(proxy, @proxyFieldHandler), target = handler === null \? null : @getProxyInternalField(proxy, @proxyFieldTarget);\n if (withHandler)\n return [target, handler];\n else\n return target;\n}, previewEntries = function(val, isIterator = !1) {\n if (isIterator) {\n const iteratedObject = @getInternalField(val, 1), kind = @getInternalField(val, 2), isEntries = kind === 2;\n if (@isMap(iteratedObject))\n if (isEntries)\n return [ArrayPrototypeFlat(ArrayFrom(iteratedObject)), !0];\n else if (kind === 1)\n return [ArrayFrom(MapPrototypeValues(iteratedObject)), !1];\n else\n return [ArrayFrom(MapPrototypeKeys(iteratedObject)), !1];\n else if (@isSet(iteratedObject))\n if (isEntries)\n return [ArrayPrototypeFlat(ArrayFrom(SetPrototypeEntries(iteratedObject))), !0];\n else\n return [ArrayFrom(iteratedObject), !1];\n else\n throw new Error(\"previewEntries(): Invalid iterator received\");\n }\n if (isWeakMap(val))\n return [];\n if (isWeakSet(val))\n return [];\n else\n throw new Error(\"previewEntries(): Invalid object received\");\n}, internalGetConstructorName = function(val) {\n if (!val || typeof val !== \"object\")\n throw new Error(\"Invalid object\");\n if (val.constructor\?.name)\n return val.constructor.name;\n const str = ObjectPrototypeToString(val), m = StringPrototypeMatch(str, /^\\[object ([^\\]]+)\\]/);\n return m \? m[1] : \"Object\";\n}, $, { pathToFileURL } = @getInternalField(@internalModuleRegistry, 47) || @createInternalModuleById(47), primordials = @getInternalField(@internalModuleRegistry, 5) || @createInternalModuleById(5), {\n Array,\n ArrayFrom,\n ArrayIsArray,\n ArrayPrototypeFilter,\n ArrayPrototypeFlat,\n ArrayPrototypeForEach,\n ArrayPrototypeIncludes,\n ArrayPrototypeIndexOf,\n ArrayPrototypeJoin,\n ArrayPrototypeMap,\n ArrayPrototypePop,\n ArrayPrototypePush,\n ArrayPrototypePushApply,\n ArrayPrototypeSlice,\n ArrayPrototypeSplice,\n ArrayPrototypeSort,\n ArrayPrototypeUnshift,\n BigIntPrototypeValueOf,\n BooleanPrototypeValueOf,\n DatePrototypeGetTime,\n DatePrototypeToISOString,\n DatePrototypeToString,\n ErrorCaptureStackTrace,\n ErrorPrototypeToString,\n FunctionPrototypeBind,\n FunctionPrototypeToString,\n JSONStringify,\n MapPrototypeGetSize,\n MapPrototypeEntries,\n MapPrototypeValues,\n MapPrototypeKeys,\n MathFloor,\n MathMax,\n MathMin,\n MathRound,\n MathSqrt,\n MathTrunc,\n Number,\n NumberIsFinite,\n NumberIsNaN,\n NumberParseFloat,\n NumberParseInt,\n NumberPrototypeToString,\n NumberPrototypeValueOf,\n Object,\n ObjectAssign,\n ObjectDefineProperty,\n ObjectEntries,\n ObjectGetOwnPropertyDescriptor,\n ObjectGetOwnPropertyDescriptors,\n ObjectGetOwnPropertyNames,\n ObjectGetOwnPropertySymbols,\n ObjectGetPrototypeOf,\n ObjectIs,\n ObjectKeys,\n ObjectPrototypeHasOwnProperty,\n ObjectPrototypePropertyIsEnumerable,\n ObjectPrototypeToString,\n ObjectSeal,\n ObjectSetPrototypeOf,\n ReflectApply,\n ReflectOwnKeys,\n RegExp,\n RegExpPrototypeExec,\n RegExpPrototypeSymbolReplace,\n RegExpPrototypeSymbolSplit,\n RegExpPrototypeTest,\n RegExpPrototypeToString,\n SafeStringIterator,\n SafeMap,\n SafeSet,\n SetPrototypeEntries,\n SetPrototypeGetSize,\n SetPrototypeValues,\n String,\n StringPrototypeCharCodeAt,\n StringPrototypeCodePointAt,\n StringPrototypeIncludes,\n StringPrototypeIndexOf,\n StringPrototypeLastIndexOf,\n StringPrototypeMatch,\n StringPrototypeNormalize,\n StringPrototypePadEnd,\n StringPrototypePadStart,\n StringPrototypeRepeat,\n StringPrototypeReplaceAll,\n StringPrototypeSlice,\n StringPrototypeSplit,\n StringPrototypeEndsWith,\n StringPrototypeStartsWith,\n StringPrototypeToLowerCase,\n StringPrototypeTrim,\n StringPrototypeValueOf,\n SymbolPrototypeToString,\n SymbolPrototypeValueOf,\n SymbolIterator,\n SymbolToStringTag,\n TypedArrayPrototypeGetLength,\n TypedArrayPrototypeGetSymbolToStringTag,\n Uint8Array\n} = primordials, customInspectSymbol = Symbol.for(\"nodejs.util.inspect.custom\"), kPending = Symbol(\"kPending\"), kFulfilled = Symbol(\"kFulfilled\"), kRejected = Symbol(\"kRejected\");\nvar isAsyncFunction = (v) => typeof v === \"function\" && StringPrototypeStartsWith(FunctionPrototypeToString(v), \"async\"), isGeneratorFunction = (v) => typeof v === \"function\" && StringPrototypeMatch(FunctionPrototypeToString(v), /^(async\\s+)\?function *\\*/), isBigIntObject = checkBox(BigInt), isSymbolObject = checkBox(Symbol), {\n isAnyArrayBuffer,\n isArrayBuffer,\n isArgumentsObject,\n isBoxedPrimitive: _native_isBoxedPrimitive,\n isDataView,\n isExternal,\n isMap,\n isMapIterator,\n isModuleNamespaceObject,\n isNativeError,\n isPromise,\n isSet,\n isSetIterator,\n isWeakMap,\n isWeakSet,\n isRegExp,\n isDate,\n isTypedArray,\n isStringObject,\n isNumberObject,\n isBooleanObject\n} = @requireNativeModule(\"util/types\");\n//! The native versions of the commented out functions are currently buggy, so we use the polyfills above for now.\n//! temp workaround to apply is{BigInt,Symbol}Object fix\nvar isBoxedPrimitive = (val) => isBigIntObject(val) || isSymbolObject(val) || _native_isBoxedPrimitive(val);\n\nclass AssertionError extends Error {\n constructor(message, isForced = !1) {\n super(message);\n this.name = \"AssertionError\", this.code = \"ERR_ASSERTION\", this.operator = \"==\", this.generatedMessage = !isForced, this.actual = isForced && @undefined, this.expected = !isForced || @undefined;\n }\n}\nvar codes = {};\n{\n const kTypes = [\n \"string\",\n \"function\",\n \"number\",\n \"object\",\n \"Function\",\n \"Object\",\n \"boolean\",\n \"bigint\",\n \"symbol\"\n ], classRegExp = /^([A-Z][a-z0-9]*)+$/, messages = new SafeMap;\n messages.set(\"ERR_INVALID_ARG_TYPE\", (name, expected, actual) => {\n if (assert(typeof name === \"string\", \"'name' must be a string\"), !ArrayIsArray(expected))\n expected = [expected];\n let msg = \"The \";\n if (StringPrototypeEndsWith(name, \" argument\"))\n msg += `${name} `;\n else\n msg += `\"${name}\" ${StringPrototypeIncludes(name, \".\") \? \"property\" : \"argument\"} `;\n msg += \"must be \";\n const types = [], instances = [], other = [];\n for (let value of expected)\n if (assert(typeof value === \"string\", \"All expected entries have to be of type string\"), ArrayPrototypeIncludes(kTypes, value))\n ArrayPrototypePush(types, StringPrototypeToLowerCase(value));\n else if (RegExpPrototypeTest(classRegExp, value))\n ArrayPrototypePush(instances, value);\n else\n assert(value !== \"object\", 'The value \"object\" should be written as \"Object\"'), ArrayPrototypePush(other, value);\n if (instances.length > 0) {\n const pos = ArrayPrototypeIndexOf(types, \"object\");\n if (pos !== -1)\n ArrayPrototypeSplice(types, pos, 1), ArrayPrototypePush(instances, \"Object\");\n }\n if (types.length > 0) {\n if (types.length > 2)\n msg += `one of type ${ArrayPrototypeJoin(types, \", \")}, or ${ArrayPrototypePop(types)}`;\n else if (types.length === 2)\n msg += `one of type ${types[0]} or ${types[1]}`;\n else\n msg += `of type ${types[0]}`;\n if (instances.length > 0 || other.length > 0)\n msg += \" or \";\n }\n if (instances.length > 0) {\n if (instances.length > 2)\n msg += `an instance of ${ArrayPrototypeJoin(instances, \", \")}, or ${ArrayPrototypePop(instances)}`;\n else\n msg += `an instance of ${instances[0]}` + (instances.length === 2 \? ` or ${instances[1]}` : \"\");\n if (other.length > 0)\n msg += \" or \";\n }\n if (other.length > 0)\n if (other.length > 2) {\n const last = ArrayPrototypePop(other);\n msg += `one of ${ArrayPrototypeJoin(other, \", \")}, or ${last}`;\n } else if (other.length === 2)\n msg += `one of ${other[0]} or ${other[1]}`;\n else {\n if (StringPrototypeToLowerCase(other[0]) !== other[0])\n msg += \"an \";\n msg += `${other[0]}`;\n }\n if (actual == null)\n msg += `. Received ${actual}`;\n else if (typeof actual === \"function\" && actual.name)\n msg += `. Received function ${actual.name}`;\n else if (typeof actual === \"object\")\n if (actual.constructor && actual.constructor.name)\n msg += `. Received an instance of ${actual.constructor.name}`;\n else\n msg += `. Received ${inspect(actual, { depth: -1 })}`;\n else {\n let inspected = inspect(actual, { colors: !1 });\n if (inspected.length > 25)\n inspected = `${StringPrototypeSlice(inspected, 0, 25)}...`;\n msg += `. Received type ${typeof actual} (${inspected})`;\n }\n return msg;\n }), codes[\"ERR_INVALID_ARG_TYPE\"] = function NodeError(...args) {\n const limit = Error.stackTraceLimit;\n Error.stackTraceLimit = 0;\n const error = @makeTypeError();\n Error.stackTraceLimit = limit;\n const msg = messages.get(\"ERR_INVALID_ARG_TYPE\");\n assert(typeof msg === \"function\"), assert(msg.length <= args.length, `Code: ERR_INVALID_ARG_TYPE; The provided arguments length (${args.length}) does not match the required ones (${msg.length}).`);\n const message = ReflectApply(msg, error, args);\n ObjectDefineProperty(error, \"message\", { value: message, enumerable: !1, writable: !0, configurable: !0 }), ObjectDefineProperty(error, \"toString\", {\n value() {\n return `${this.name} [ERR_INVALID_ARG_TYPE]: ${this.message}`;\n },\n enumerable: !1,\n writable: !0,\n configurable: !0\n });\n let err = error;\n const userStackTraceLimit = Error.stackTraceLimit;\n return Error.stackTraceLimit = @Infinity, ErrorCaptureStackTrace(err), Error.stackTraceLimit = userStackTraceLimit, err.name = `${TypeError.name} [ERR_INVALID_ARG_TYPE]`, err.stack, delete err.name, error.code = \"ERR_INVALID_ARG_TYPE\", error;\n };\n}\nvar validateObject = (value, name, allowArray = !1) => {\n if (value === null || !allowArray && ArrayIsArray(value) || typeof value !== \"object\" && typeof value !== \"function\")\n throw new codes.ERR_INVALID_ARG_TYPE(name, \"Object\", value);\n}, builtInObjects = new SafeSet(ArrayPrototypeFilter(ObjectGetOwnPropertyNames(globalThis), (e) => RegExpPrototypeExec(/^[A-Z][a-zA-Z0-9]+$/, e) !== null)), isUndetectableObject = (v) => typeof v === \"undefined\" && v !== @undefined, ERROR_STACK_OVERFLOW_MSG = \"Maximum call stack size exceeded.\", inspectDefaultOptions = ObjectSeal({\n showHidden: !1,\n depth: 2,\n colors: !1,\n customInspect: !0,\n showProxy: !1,\n maxArrayLength: 100,\n maxStringLength: 1e4,\n breakLength: 80,\n compact: 3,\n sorted: !1,\n getters: !1,\n numericSeparator: !1\n}), inspectReplDefaults = ObjectSeal({\n ...inspectDefaultOptions,\n colors: Bun.enableANSIColors,\n showProxy: !0\n}), kObjectType = 0, kArrayType = 1, kArrayExtrasType = 2, strEscapeSequencesRegExp, strEscapeSequencesReplacer, strEscapeSequencesRegExpSingle, strEscapeSequencesReplacerSingle, extractedSplitNewLines;\ntry {\n strEscapeSequencesRegExp = new RegExp(\"[\\\\x00-\\\\x1f\\\\x27\\\\x5c\\\\x7f-\\\\x9f]|[\\\\ud800-\\\\udbff](\?![\\\\udc00-\\\\udfff])|(\? RegExpPrototypeSymbolSplit(extractedNewLineRe, value);\n} catch {\n strEscapeSequencesRegExp = /[\\x00-\\x1f\\x27\\x5c\\x7f-\\x9f]/, strEscapeSequencesReplacer = /[\\x00-\\x1f\\x27\\x5c\\x7f-\\x9f]/g, strEscapeSequencesRegExpSingle = /[\\x00-\\x1f\\x5c\\x7f-\\x9f]/, strEscapeSequencesReplacerSingle = /[\\x00-\\x1f\\x5c\\x7f-\\x9f]/g, extractedSplitNewLines = (value) => {\n const lines = RegExpPrototypeSymbolSplit(/\\n/, value), last = ArrayPrototypePop(lines), nlLines = ArrayPrototypeMap(lines, (line) => line + \"\\n\");\n if (last !== \"\")\n nlLines.push(last);\n return nlLines;\n };\n}\nvar keyStrRegExp = /^[a-zA-Z_][a-zA-Z_0-9]*$/, numberRegExp = /^(0|[1-9][0-9]*)$/, coreModuleRegExp = /^ {4}at (\?:[^/\\\\(]+ \\(|)node:(.+):\\d+:\\d+\\)\?$/, nodeModulesRegExp = /[/\\\\]node_modules[/\\\\](.+\?)(\?=[/\\\\])/g, classRegExp = /^(\\s+[^(]*\?)\\s*{/, stripCommentsRegExp = /(\\/\\/.*\?\\n)|(\\/\\*(.|\\n)*\?\\*\\/)/g, kMinLineLength = 16, kWeak = 0, kIterator = 1, kMapEntries = 2, meta = [\n \"\\\\x00\",\n \"\\\\x01\",\n \"\\\\x02\",\n \"\\\\x03\",\n \"\\\\x04\",\n \"\\\\x05\",\n \"\\\\x06\",\n \"\\\\x07\",\n \"\\\\b\",\n \"\\\\t\",\n \"\\\\n\",\n \"\\\\x0B\",\n \"\\\\f\",\n \"\\\\r\",\n \"\\\\x0E\",\n \"\\\\x0F\",\n \"\\\\x10\",\n \"\\\\x11\",\n \"\\\\x12\",\n \"\\\\x13\",\n \"\\\\x14\",\n \"\\\\x15\",\n \"\\\\x16\",\n \"\\\\x17\",\n \"\\\\x18\",\n \"\\\\x19\",\n \"\\\\x1A\",\n \"\\\\x1B\",\n \"\\\\x1C\",\n \"\\\\x1D\",\n \"\\\\x1E\",\n \"\\\\x1F\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\\\\'\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\\\\\\\\\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\\\\x7F\",\n \"\\\\x80\",\n \"\\\\x81\",\n \"\\\\x82\",\n \"\\\\x83\",\n \"\\\\x84\",\n \"\\\\x85\",\n \"\\\\x86\",\n \"\\\\x87\",\n \"\\\\x88\",\n \"\\\\x89\",\n \"\\\\x8A\",\n \"\\\\x8B\",\n \"\\\\x8C\",\n \"\\\\x8D\",\n \"\\\\x8E\",\n \"\\\\x8F\",\n \"\\\\x90\",\n \"\\\\x91\",\n \"\\\\x92\",\n \"\\\\x93\",\n \"\\\\x94\",\n \"\\\\x95\",\n \"\\\\x96\",\n \"\\\\x97\",\n \"\\\\x98\",\n \"\\\\x99\",\n \"\\\\x9A\",\n \"\\\\x9B\",\n \"\\\\x9C\",\n \"\\\\x9D\",\n \"\\\\x9E\",\n \"\\\\x9F\"\n], getStringWidth;\ninspect.custom = customInspectSymbol;\nObjectDefineProperty(inspect, \"defaultOptions\", {\n __proto__: null,\n get() {\n return inspectDefaultOptions;\n },\n set(options) {\n return validateObject(options, \"options\"), ObjectAssign(inspectDefaultOptions, options);\n }\n});\nObjectDefineProperty(inspect, \"replDefaults\", {\n __proto__: null,\n get() {\n return inspectReplDefaults;\n },\n set(options) {\n return validateObject(options, \"options\"), ObjectAssign(inspectReplDefaults, options);\n }\n});\nvar defaultFG = 39, defaultBG = 49;\ninspect.colors = {\n __proto__: null,\n reset: [0, 0],\n bold: [1, 22],\n dim: [2, 22],\n italic: [3, 23],\n underline: [4, 24],\n blink: [5, 25],\n inverse: [7, 27],\n hidden: [8, 28],\n strikethrough: [9, 29],\n doubleunderline: [21, 24],\n black: [30, defaultFG],\n red: [31, defaultFG],\n green: [32, defaultFG],\n yellow: [33, defaultFG],\n blue: [34, defaultFG],\n magenta: [35, defaultFG],\n cyan: [36, defaultFG],\n white: [37, defaultFG],\n bgBlack: [40, defaultBG],\n bgRed: [41, defaultBG],\n bgGreen: [42, defaultBG],\n bgYellow: [43, defaultBG],\n bgBlue: [44, defaultBG],\n bgMagenta: [45, defaultBG],\n bgCyan: [46, defaultBG],\n bgWhite: [47, defaultBG],\n framed: [51, 54],\n overlined: [53, 55],\n gray: [90, defaultFG],\n redBright: [91, defaultFG],\n greenBright: [92, defaultFG],\n yellowBright: [93, defaultFG],\n blueBright: [94, defaultFG],\n magentaBright: [95, defaultFG],\n cyanBright: [96, defaultFG],\n whiteBright: [97, defaultFG],\n bgGray: [100, defaultBG],\n bgRedBright: [101, defaultBG],\n bgGreenBright: [102, defaultBG],\n bgYellowBright: [103, defaultBG],\n bgBlueBright: [104, defaultBG],\n bgMagentaBright: [105, defaultBG],\n bgCyanBright: [106, defaultBG],\n bgWhiteBright: [107, defaultBG]\n};\ndefineColorAlias(\"gray\", \"grey\");\ndefineColorAlias(\"gray\", \"blackBright\");\ndefineColorAlias(\"bgGray\", \"bgGrey\");\ndefineColorAlias(\"bgGray\", \"bgBlackBright\");\ndefineColorAlias(\"dim\", \"faint\");\ndefineColorAlias(\"strikethrough\", \"crossedout\");\ndefineColorAlias(\"strikethrough\", \"strikeThrough\");\ndefineColorAlias(\"strikethrough\", \"crossedOut\");\ndefineColorAlias(\"hidden\", \"conceal\");\ndefineColorAlias(\"inverse\", \"swapColors\");\ndefineColorAlias(\"inverse\", \"swapcolors\");\ndefineColorAlias(\"doubleunderline\", \"doubleUnderline\");\ninspect.styles = {\n __proto__: null,\n special: \"cyan\",\n number: \"yellow\",\n bigint: \"yellow\",\n boolean: \"yellow\",\n undefined: \"grey\",\n null: \"bold\",\n string: \"green\",\n symbol: \"green\",\n date: \"magenta\",\n regexp: \"red\",\n module: \"underline\"\n};\nvar remainingText = (remaining) => `... ${remaining} more item${remaining > 1 \? \"s\" : \"\"}`, firstErrorLine = (error) => StringPrototypeSplit(error.message, \"\\n\", 1)[0], CIRCULAR_ERROR_MESSAGE;\n{\n getStringWidth = function getStringWidth(str, removeControlChars = !0) {\n let width = 0;\n if (removeControlChars)\n str = stripVTControlCharacters(str);\n str = StringPrototypeNormalize(str, \"NFC\");\n for (let char of new SafeStringIterator(str)) {\n const code = StringPrototypeCodePointAt(char, 0);\n if (isFullWidthCodePoint(code))\n width += 2;\n else if (!isZeroWidthCodePoint(code))\n width++;\n }\n return width;\n };\n const isFullWidthCodePoint = (code) => {\n return code >= 4352 && (code <= 4447 || code === 9001 || code === 9002 || code >= 11904 && code <= 12871 && code !== 12351 || code >= 12880 && code <= 19903 || code >= 19968 && code <= 42182 || code >= 43360 && code <= 43388 || code >= 44032 && code <= 55203 || code >= 63744 && code <= 64255 || code >= 65040 && code <= 65049 || code >= 65072 && code <= 65131 || code >= 65281 && code <= 65376 || code >= 65504 && code <= 65510 || code >= 110592 && code <= 110593 || code >= 127488 && code <= 127569 || code >= 127744 && code <= 128591 || code >= 131072 && code <= 262141);\n };\n}\nvar ansiPattern = \"[\\\\u001B\\\\u009B][[\\\\]()#;\?]*(\?:(\?:(\?:(\?:;[-a-zA-Z\\\\d\\\\/#&.:=\?%@~_]+)*|[a-zA-Z\\\\d]+(\?:;[-a-zA-Z\\\\d\\\\/#&.:=\?%@~_]*)*)\?\\\\u0007)|(\?:(\?:\\\\d{1,4}(\?:;\\\\d{0,4})*)\?[\\\\dA-PR-TZcf-ntqry=><~]))\", ansi = new RegExp(ansiPattern, \"g\");\n$ = {\n inspect,\n format,\n formatWithOptions,\n stripVTControlCharacters\n};\n//! non-standard properties, should these be kept\? (not currently exposed)\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeAssertCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/assert.ts\nvar CallTracker = function() {\n throw new Error(\"CallTracker is not supported yet\");\n}, util = @getInternalField(@internalModuleRegistry, 48) || @createInternalModuleById(48), isDeepEqual = Bun.deepEquals, __commonJS = (cb, mod) => function() {\n return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n}, require_errors = __commonJS({\n \"assert/build/internal/errors.js\"(exports, module2) {\n function _typeof(obj) {\n return typeof Symbol == \"function\" && typeof Symbol.iterator == \"symbol\" \? _typeof = function(obj2) {\n return typeof obj2;\n } : _typeof = function(obj2) {\n return obj2 && typeof Symbol == \"function\" && obj2.constructor === Symbol && obj2 !== Symbol.prototype \? \"symbol\" : typeof obj2;\n }, _typeof(obj);\n }\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor))\n @throwTypeError(\"Cannot call a class as a function\");\n }\n function _possibleConstructorReturn(self, call) {\n return call && (_typeof(call) === \"object\" || typeof call == \"function\") \? call : _assertThisInitialized(self);\n }\n function _assertThisInitialized(self) {\n if (self === void 0)\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n return self;\n }\n function _getPrototypeOf(o) {\n return _getPrototypeOf = Object.setPrototypeOf \? Object.getPrototypeOf : function(o2) {\n return o2.__proto__ || Object.getPrototypeOf(o2);\n }, _getPrototypeOf(o);\n }\n function _inherits(subClass, superClass) {\n if (typeof superClass != \"function\" && superClass !== null)\n @throwTypeError(\"Super expression must either be null or a function\");\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: { value: subClass, writable: !0, configurable: !0 }\n }), superClass && _setPrototypeOf(subClass, superClass);\n }\n function _setPrototypeOf(o, p) {\n return _setPrototypeOf = Object.setPrototypeOf || function(o2, p2) {\n return o2.__proto__ = p2, o2;\n }, _setPrototypeOf(o, p);\n }\n var codes = {}, assert, util2;\n function createErrorType(code, message, Base) {\n Base || (Base = Error);\n function getMessage(arg1, arg2, arg3) {\n return typeof message == \"string\" \? message : message(arg1, arg2, arg3);\n }\n var NodeError = function(_Base) {\n _inherits(NodeError2, _Base);\n function NodeError2(arg1, arg2, arg3) {\n var _this;\n return _classCallCheck(this, NodeError2), _this = _possibleConstructorReturn(this, _getPrototypeOf(NodeError2).@call(this, getMessage(arg1, arg2, arg3))), _this.code = code, _this;\n }\n return NodeError2;\n }(Base);\n codes[code] = NodeError;\n }\n function oneOf(expected, thing) {\n if (@Array.isArray(expected)) {\n var len = expected.length;\n return expected = expected.map(function(i) {\n return @String(i);\n }), len > 2 \? \"one of \".concat(thing, \" \").concat(expected.slice(0, len - 1).join(\", \"), \", or \") + expected[len - 1] : len === 2 \? \"one of \".concat(thing, \" \").concat(expected[0], \" or \").concat(expected[1]) : \"of \".concat(thing, \" \").concat(expected[0]);\n } else\n return \"of \".concat(thing, \" \").concat(@String(expected));\n }\n function startsWith(str, search, pos) {\n return str.substr(!pos || pos < 0 \? 0 : +pos, search.length) === search;\n }\n function endsWith(str, search, this_len) {\n return (this_len === void 0 || this_len > str.length) && (this_len = str.length), str.substring(this_len - search.length, this_len) === search;\n }\n function includes(str, search, start) {\n return typeof start != \"number\" && (start = 0), start + search.length > str.length \? !1 : str.indexOf(search, start) !== -1;\n }\n createErrorType(\"ERR_AMBIGUOUS_ARGUMENT\", 'The \"%s\" argument is ambiguous. %s', TypeError), createErrorType(\"ERR_INVALID_ARG_TYPE\", function(name, expected, actual) {\n assert === void 0 && (assert = require_assert()), assert(typeof name == \"string\", \"'name' must be a string\");\n var determiner;\n typeof expected == \"string\" && startsWith(expected, \"not \") \? (determiner = \"must not be\", expected = expected.replace(/^not /, \"\")) : determiner = \"must be\";\n var msg;\n if (endsWith(name, \" argument\"))\n msg = \"The \".concat(name, \" \").concat(determiner, \" \").concat(oneOf(expected, \"type\"));\n else {\n var type = includes(name, \".\") \? \"property\" : \"argument\";\n msg = 'The \"'.concat(name, '\" ').concat(type, \" \").concat(determiner, \" \").concat(oneOf(expected, \"type\"));\n }\n return msg += \". Received type \".concat(_typeof(actual)), msg;\n }, TypeError), createErrorType(\"ERR_INVALID_ARG_VALUE\", function(name, value) {\n var reason = arguments.length > 2 && arguments[2] !== void 0 \? arguments[2] : \"is invalid\", inspected = util2.inspect(value);\n return inspected.length > 128 && (inspected = \"\".concat(inspected.slice(0, 128), \"...\")), \"The argument '\".concat(name, \"' \").concat(reason, \". Received \").concat(inspected);\n }, TypeError, RangeError), createErrorType(\"ERR_INVALID_RETURN_VALUE\", function(input, name, value) {\n var type;\n return value && value.constructor && value.constructor.name \? type = \"instance of \".concat(value.constructor.name) : type = \"type \".concat(_typeof(value)), \"Expected \".concat(input, ' to be returned from the \"').concat(name, '\"') + \" function but got \".concat(type, \".\");\n }, TypeError), createErrorType(\"ERR_MISSING_ARGS\", function() {\n for (var _len = arguments.length, args = new @Array(_len), _key = 0;_key < _len; _key++)\n args[_key] = arguments[_key];\n assert === void 0 && (assert = require_assert()), assert(args.length > 0, \"At least one arg needs to be specified\");\n var msg = \"The \", len = args.length;\n switch (args = args.map(function(a) {\n return '\"'.concat(a, '\"');\n }), len) {\n case 1:\n msg += \"\".concat(args[0], \" argument\");\n break;\n case 2:\n msg += \"\".concat(args[0], \" and \").concat(args[1], \" arguments\");\n break;\n default:\n msg += args.slice(0, len - 1).join(\", \"), msg += \", and \".concat(args[len - 1], \" arguments\");\n break;\n }\n return \"\".concat(msg, \" must be specified\");\n }, TypeError), module2.exports.codes = codes;\n }\n}), require_assertion_error = __commonJS({\n \"assert/build/internal/assert/assertion_error.js\"(exports, module2) {\n function _objectSpread(target) {\n for (var i = 1;i < arguments.length; i++) {\n var source = arguments[i] != null \? arguments[i] : {}, ownKeys = Object.keys(source);\n typeof Object.getOwnPropertySymbols == \"function\" && (ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }))), ownKeys.forEach(function(key) {\n _defineProperty(target, key, source[key]);\n });\n }\n return target;\n }\n function _defineProperty(obj, key, value) {\n return (key in obj) \? Object.defineProperty(obj, key, {\n value,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : obj[key] = value, obj;\n }\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor))\n @throwTypeError(\"Cannot call a class as a function\");\n }\n function _defineProperties(target, props) {\n for (var i = 0;i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, (\"value\" in descriptor) && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n function _createClass(Constructor, protoProps, staticProps) {\n return protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), Constructor;\n }\n function _possibleConstructorReturn(self, call) {\n return call && (_typeof(call) === \"object\" || typeof call == \"function\") \? call : _assertThisInitialized(self);\n }\n function _assertThisInitialized(self) {\n if (self === void 0)\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n return self;\n }\n function _inherits(subClass, superClass) {\n if (typeof superClass != \"function\" && superClass !== null)\n @throwTypeError(\"Super expression must either be null or a function\");\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: { value: subClass, writable: !0, configurable: !0 }\n }), superClass && _setPrototypeOf(subClass, superClass);\n }\n function _wrapNativeSuper(Class) {\n var _cache = typeof Map == \"function\" \? new Map : void 0;\n return _wrapNativeSuper = function(Class2) {\n if (Class2 === null || !_isNativeFunction(Class2))\n return Class2;\n if (typeof Class2 != \"function\")\n @throwTypeError(\"Super expression must either be null or a function\");\n if (typeof _cache != \"undefined\") {\n if (_cache.has(Class2))\n return _cache.get(Class2);\n _cache.set(Class2, Wrapper);\n }\n function Wrapper() {\n return _construct(Class2, arguments, _getPrototypeOf(this).constructor);\n }\n return Wrapper.prototype = Object.create(Class2.prototype, {\n constructor: {\n value: Wrapper,\n enumerable: !1,\n writable: !0,\n configurable: !0\n }\n }), _setPrototypeOf(Wrapper, Class2);\n }, _wrapNativeSuper(Class);\n }\n function isNativeReflectConstruct() {\n if (typeof Reflect == \"undefined\" || !Reflect.construct || Reflect.construct.sham)\n return !1;\n if (typeof Proxy == \"function\")\n return !0;\n try {\n return Date.prototype.toString.@call(Reflect.construct(Date, [], function() {\n })), !0;\n } catch {\n return !1;\n }\n }\n function _construct(Parent, args, Class) {\n return isNativeReflectConstruct() \? _construct = Reflect.construct : _construct = function(Parent2, args2, Class2) {\n var a = [null];\n a.push.@apply(a, args2);\n var Constructor = Function.bind.@apply(Parent2, a), instance = new Constructor;\n return Class2 && _setPrototypeOf(instance, Class2.prototype), instance;\n }, _construct.@apply(null, arguments);\n }\n function _isNativeFunction(fn) {\n return Function.toString.@call(fn).indexOf(\"[native code]\") !== -1;\n }\n function _setPrototypeOf(o, p) {\n return _setPrototypeOf = Object.setPrototypeOf || function(o2, p2) {\n return o2.__proto__ = p2, o2;\n }, _setPrototypeOf(o, p);\n }\n function _getPrototypeOf(o) {\n return _getPrototypeOf = Object.setPrototypeOf \? Object.getPrototypeOf : function(o2) {\n return o2.__proto__ || Object.getPrototypeOf(o2);\n }, _getPrototypeOf(o);\n }\n function _typeof(obj) {\n return typeof Symbol == \"function\" && typeof Symbol.iterator == \"symbol\" \? _typeof = function(obj2) {\n return typeof obj2;\n } : _typeof = function(obj2) {\n return obj2 && typeof Symbol == \"function\" && obj2.constructor === Symbol && obj2 !== Symbol.prototype \? \"symbol\" : typeof obj2;\n }, _typeof(obj);\n }\n var inspect = util.inspect, _require2 = require_errors(), ERR_INVALID_ARG_TYPE = _require2.codes.ERR_INVALID_ARG_TYPE;\n function endsWith(str, search, this_len) {\n return (this_len === void 0 || this_len > str.length) && (this_len = str.length), str.substring(this_len - search.length, this_len) === search;\n }\n function repeat(str, count) {\n if (count = Math.floor(count), str.length == 0 || count == 0)\n return \"\";\n var maxCount = str.length * count;\n for (count = Math.floor(Math.log(count) / Math.log(2));count; )\n str += str, count--;\n return str += str.substring(0, maxCount - str.length), str;\n }\n var blue = \"\", green = \"\", red = \"\", white = \"\", kReadableOperator = {\n deepStrictEqual: \"Expected values to be strictly deep-equal:\",\n strictEqual: \"Expected values to be strictly equal:\",\n strictEqualObject: 'Expected \"actual\" to be reference-equal to \"expected\":',\n deepEqual: \"Expected values to be loosely deep-equal:\",\n equal: \"Expected values to be loosely equal:\",\n notDeepStrictEqual: 'Expected \"actual\" not to be strictly deep-equal to:',\n notStrictEqual: 'Expected \"actual\" to be strictly unequal to:',\n notStrictEqualObject: 'Expected \"actual\" not to be reference-equal to \"expected\":',\n notDeepEqual: 'Expected \"actual\" not to be loosely deep-equal to:',\n notEqual: 'Expected \"actual\" to be loosely unequal to:',\n notIdentical: \"Values identical but not reference-equal:\"\n }, kMaxShortLength = 10;\n function copyError(source) {\n var keys = Object.keys(source), target = Object.create(Object.getPrototypeOf(source));\n return keys.forEach(function(key) {\n target[key] = source[key];\n }), Object.defineProperty(target, \"message\", {\n value: source.message\n }), target;\n }\n function inspectValue(val) {\n return inspect(val, {\n compact: !1,\n customInspect: !1,\n depth: 1000,\n maxArrayLength: Infinity,\n showHidden: !1,\n breakLength: Infinity,\n showProxy: !1,\n sorted: !0,\n getters: !0\n });\n }\n function createErrDiff(actual, expected, operator) {\n var other = \"\", res = \"\", lastPos = 0, end = \"\", skipped = !1, actualInspected = inspectValue(actual), actualLines = actualInspected.split(`\n`), expectedLines = inspectValue(expected).split(`\n`), i = 0, indicator = \"\";\n if (operator === \"strictEqual\" && _typeof(actual) === \"object\" && _typeof(expected) === \"object\" && actual !== null && expected !== null && (operator = \"strictEqualObject\"), actualLines.length === 1 && expectedLines.length === 1 && actualLines[0] !== expectedLines[0]) {\n var inputLength = actualLines[0].length + expectedLines[0].length;\n if (inputLength <= kMaxShortLength) {\n if ((_typeof(actual) !== \"object\" || actual === null) && (_typeof(expected) !== \"object\" || expected === null) && (actual !== 0 || expected !== 0))\n return \"\".concat(kReadableOperator[operator], `\n\n`) + \"\".concat(actualLines[0], \" !== \").concat(expectedLines[0], `\n`);\n } else if (operator !== \"strictEqualObject\") {\n var maxLength = process.stderr && process.stderr.isTTY \? process.stderr.columns : 80;\n if (inputLength < maxLength) {\n for (;actualLines[0][i] === expectedLines[0][i]; )\n i++;\n i > 2 && (indicator = `\n `.concat(repeat(\" \", i), \"^\"), i = 0);\n }\n }\n }\n for (var a = actualLines[actualLines.length - 1], b = expectedLines[expectedLines.length - 1];a === b && (i++ < 2 \? end = `\n `.concat(a).concat(end) : other = a, actualLines.pop(), expectedLines.pop(), !(actualLines.length === 0 || expectedLines.length === 0)); )\n a = actualLines[actualLines.length - 1], b = expectedLines[expectedLines.length - 1];\n var maxLines = Math.max(actualLines.length, expectedLines.length);\n if (maxLines === 0) {\n var _actualLines = actualInspected.split(`\n`);\n if (_actualLines.length > 30)\n for (_actualLines[26] = \"\".concat(blue, \"...\").concat(white);_actualLines.length > 27; )\n _actualLines.pop();\n return \"\".concat(kReadableOperator.notIdentical, `\n\n`).concat(_actualLines.join(`\n`), `\n`);\n }\n i > 3 && (end = `\n`.concat(blue, \"...\").concat(white).concat(end), skipped = !0), other !== \"\" && (end = `\n `.concat(other).concat(end), other = \"\");\n var printedLines = 0, msg = kReadableOperator[operator] + `\n`.concat(green, \"+ actual\").concat(white, \" \").concat(red, \"- expected\").concat(white), skippedMsg = \" \".concat(blue, \"...\").concat(white, \" Lines skipped\");\n for (i = 0;i < maxLines; i++) {\n var cur = i - lastPos;\n if (actualLines.length < i + 1)\n cur > 1 && i > 2 && (cur > 4 \? (res += `\n`.concat(blue, \"...\").concat(white), skipped = !0) : cur > 3 && (res += `\n `.concat(expectedLines[i - 2]), printedLines++), res += `\n `.concat(expectedLines[i - 1]), printedLines++), lastPos = i, other += `\n`.concat(red, \"-\").concat(white, \" \").concat(expectedLines[i]), printedLines++;\n else if (expectedLines.length < i + 1)\n cur > 1 && i > 2 && (cur > 4 \? (res += `\n`.concat(blue, \"...\").concat(white), skipped = !0) : cur > 3 && (res += `\n `.concat(actualLines[i - 2]), printedLines++), res += `\n `.concat(actualLines[i - 1]), printedLines++), lastPos = i, res += `\n`.concat(green, \"+\").concat(white, \" \").concat(actualLines[i]), printedLines++;\n else {\n var expectedLine = expectedLines[i], actualLine = actualLines[i], divergingLines = actualLine !== expectedLine && (!endsWith(actualLine, \",\") || actualLine.slice(0, -1) !== expectedLine);\n divergingLines && endsWith(expectedLine, \",\") && expectedLine.slice(0, -1) === actualLine && (divergingLines = !1, actualLine += \",\"), divergingLines \? (cur > 1 && i > 2 && (cur > 4 \? (res += `\n`.concat(blue, \"...\").concat(white), skipped = !0) : cur > 3 && (res += `\n `.concat(actualLines[i - 2]), printedLines++), res += `\n `.concat(actualLines[i - 1]), printedLines++), lastPos = i, res += `\n`.concat(green, \"+\").concat(white, \" \").concat(actualLine), other += `\n`.concat(red, \"-\").concat(white, \" \").concat(expectedLine), printedLines += 2) : (res += other, other = \"\", (cur === 1 || i === 0) && (res += `\n `.concat(actualLine), printedLines++));\n }\n if (printedLines > 20 && i < maxLines - 2)\n return \"\".concat(msg).concat(skippedMsg, `\n`).concat(res, `\n`).concat(blue, \"...\").concat(white).concat(other, `\n`) + \"\".concat(blue, \"...\").concat(white);\n }\n return \"\".concat(msg).concat(skipped \? skippedMsg : \"\", `\n`).concat(res).concat(other).concat(end).concat(indicator);\n }\n var AssertionError = function(_Error) {\n function AssertionError2(options) {\n var _this;\n if (_classCallCheck(this, AssertionError2), _typeof(options) !== \"object\" || options === null)\n throw new ERR_INVALID_ARG_TYPE(\"options\", \"Object\", options);\n var { message, operator, stackStartFn, actual, expected } = options, limit = Error.stackTraceLimit;\n if (Error.stackTraceLimit = 0, message != null)\n _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).@call(this, @String(message)));\n else if (process.stderr && process.stderr.isTTY && (process.stderr && process.stderr.getColorDepth && process.stderr.getColorDepth() !== 1 \? (blue = \"\", green = \"\", white = \"\", red = \"\") : (blue = \"\", green = \"\", white = \"\", red = \"\")), _typeof(actual) === \"object\" && actual !== null && _typeof(expected) === \"object\" && expected !== null && (\"stack\" in actual) && actual instanceof Error && (\"stack\" in expected) && expected instanceof Error && (actual = copyError(actual), expected = copyError(expected)), operator === \"deepStrictEqual\" || operator === \"strictEqual\")\n _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).@call(this, createErrDiff(actual, expected, operator)));\n else if (operator === \"notDeepStrictEqual\" || operator === \"notStrictEqual\") {\n var base = kReadableOperator[operator], res = inspectValue(actual).split(`\n`);\n if (operator === \"notStrictEqual\" && _typeof(actual) === \"object\" && actual !== null && (base = kReadableOperator.notStrictEqualObject), res.length > 30)\n for (res[26] = \"\".concat(blue, \"...\").concat(white);res.length > 27; )\n res.pop();\n res.length === 1 \? _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).@call(this, \"\".concat(base, \" \").concat(res[0]))) : _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).@call(this, \"\".concat(base, `\n\n`).concat(res.join(`\n`), `\n`)));\n } else {\n var _res = inspectValue(actual), other = \"\", knownOperators = kReadableOperator[operator];\n operator === \"notDeepEqual\" || operator === \"notEqual\" \? (_res = \"\".concat(kReadableOperator[operator], `\n\n`).concat(_res), _res.length > 1024 && (_res = \"\".concat(_res.slice(0, 1021), \"...\"))) : (other = \"\".concat(inspectValue(expected)), _res.length > 512 && (_res = \"\".concat(_res.slice(0, 509), \"...\")), other.length > 512 && (other = \"\".concat(other.slice(0, 509), \"...\")), operator === \"deepEqual\" || operator === \"equal\" \? _res = \"\".concat(knownOperators, `\n\n`).concat(_res, `\n\nshould equal\n\n`) : other = \" \".concat(operator, \" \").concat(other)), _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).@call(this, \"\".concat(_res).concat(other)));\n }\n return Error.stackTraceLimit = limit, _this.generatedMessage = !message, Object.defineProperty(_assertThisInitialized(_this), \"name\", {\n value: \"AssertionError [ERR_ASSERTION]\",\n enumerable: !1,\n writable: !0,\n configurable: !0\n }), _this.code = \"ERR_ASSERTION\", _this.actual = actual, _this.expected = expected, _this.operator = operator, Error.captureStackTrace && Error.captureStackTrace(_assertThisInitialized(_this), stackStartFn), _this.stack, _this.name = \"AssertionError\", _possibleConstructorReturn(_this);\n }\n return AssertionError2.prototype = {}, _inherits(AssertionError2, _Error), _createClass(AssertionError2, [\n {\n key: \"toString\",\n value: function() {\n return \"\".concat(this.name, \" [\").concat(this.code, \"]: \").concat(this.message);\n }\n },\n {\n key: inspect.custom,\n value: function(recurseTimes, ctx) {\n return inspect(this, _objectSpread({}, ctx, {\n customInspect: !1,\n depth: 0\n }));\n }\n }\n ]), AssertionError2;\n }(_wrapNativeSuper(Error));\n module2.exports = AssertionError;\n }\n}), require_assert = __commonJS({\n \"assert/build/assert.js\"(exports, module2) {\n function _typeof(obj) {\n return typeof Symbol == \"function\" && typeof Symbol.iterator == \"symbol\" \? _typeof = function(obj2) {\n return typeof obj2;\n } : _typeof = function(obj2) {\n return obj2 && typeof Symbol == \"function\" && obj2.constructor === Symbol && obj2 !== Symbol.prototype \? \"symbol\" : typeof obj2;\n }, _typeof(obj);\n }\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor))\n @throwTypeError(\"Cannot call a class as a function\");\n }\n var _require = require_errors(), _require$codes = _require.codes, ERR_AMBIGUOUS_ARGUMENT = _require$codes.ERR_AMBIGUOUS_ARGUMENT, ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_VALUE = _require$codes.ERR_INVALID_ARG_VALUE, ERR_INVALID_RETURN_VALUE = _require$codes.ERR_INVALID_RETURN_VALUE, ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, AssertionError = require_assertion_error(), _require2 = util, inspect = _require2.inspect, _require$types = util.types, isPromise = _require$types.isPromise, isRegExp = _require$types.isRegExp, objectAssign = Object.assign, objectIs = Object.is, errorCache = new Map, warned = !1, assert = module2.exports = ok, NO_EXCEPTION_SENTINEL = {};\n function innerFail(obj) {\n throw obj.message instanceof Error \? obj.message : new AssertionError(obj);\n }\n function fail(actual, expected, message, operator, stackStartFn) {\n var argsLen = arguments.length, internalMessage;\n if (argsLen === 0)\n internalMessage = \"Failed\";\n else if (argsLen === 1)\n message = actual, actual = void 0;\n else {\n if (warned === !1) {\n warned = !0;\n var warn = process.emitWarning \? process.emitWarning : console.warn.bind(console);\n warn(\"assert.fail() with more than one argument is deprecated. Please use assert.strictEqual() instead or only pass a message.\", \"DeprecationWarning\", \"DEP0094\");\n }\n argsLen === 2 && (operator = \"!=\");\n }\n if (message instanceof Error)\n throw message;\n var errArgs = {\n actual,\n expected,\n operator: operator === void 0 \? \"fail\" : operator,\n stackStartFn: stackStartFn || fail\n };\n message !== void 0 && (errArgs.message = message);\n var err = new AssertionError(errArgs);\n throw internalMessage && (err.message = internalMessage, err.generatedMessage = !0), err;\n }\n assert.fail = fail, assert.AssertionError = AssertionError;\n function innerOk(fn, argLen, value, message) {\n if (!value) {\n var generatedMessage = !1;\n if (argLen === 0)\n generatedMessage = !0, message = \"No value argument passed to `assert.ok()`\";\n else if (message instanceof Error)\n throw message;\n var err = new AssertionError({\n actual: value,\n expected: !0,\n message,\n operator: \"==\",\n stackStartFn: fn\n });\n throw err.generatedMessage = generatedMessage, err;\n }\n }\n function ok() {\n for (var _len = arguments.length, args = new @Array(_len), _key = 0;_key < _len; _key++)\n args[_key] = arguments[_key];\n innerOk.@apply(void 0, [ok, args.length].concat(args));\n }\n assert.ok = ok, assert.equal = function equal(actual, expected, message) {\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n actual != expected && innerFail({\n actual,\n expected,\n message,\n operator: \"==\",\n stackStartFn: equal\n });\n }, assert.notEqual = function notEqual(actual, expected, message) {\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n actual == expected && innerFail({\n actual,\n expected,\n message,\n operator: \"!=\",\n stackStartFn: notEqual\n });\n }, assert.deepEqual = function deepEqual(actual, expected, message) {\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n isDeepEqual(actual, expected, !1) || innerFail({\n actual,\n expected,\n message,\n operator: \"deepEqual\",\n stackStartFn: deepEqual\n });\n }, assert.notDeepEqual = function notDeepEqual(actual, expected, message) {\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n isDeepEqual(actual, expected, !1) && innerFail({\n actual,\n expected,\n message,\n operator: \"notDeepEqual\",\n stackStartFn: notDeepEqual\n });\n }, assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n isDeepEqual(actual, expected, !0) || innerFail({\n actual,\n expected,\n message,\n operator: \"deepStrictEqual\",\n stackStartFn: deepStrictEqual\n });\n }, assert.notDeepStrictEqual = notDeepStrictEqual;\n function notDeepStrictEqual(actual, expected, message) {\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n isDeepEqual(actual, expected, !0) && innerFail({\n actual,\n expected,\n message,\n operator: \"notDeepStrictEqual\",\n stackStartFn: notDeepStrictEqual\n });\n }\n assert.strictEqual = function strictEqual(actual, expected, message) {\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n objectIs(actual, expected) || innerFail({\n actual,\n expected,\n message,\n operator: \"strictEqual\",\n stackStartFn: strictEqual\n });\n }, assert.notStrictEqual = function notStrictEqual(actual, expected, message) {\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n objectIs(actual, expected) && innerFail({\n actual,\n expected,\n message,\n operator: \"notStrictEqual\",\n stackStartFn: notStrictEqual\n });\n }, assert.match = function match(actual, expected, message) {\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n if (!isRegExp(expected))\n throw new ERR_INVALID_ARG_TYPE(\"expected\", \"RegExp\", expected);\n expected.test(actual) || innerFail({\n actual,\n expected,\n message,\n operator: \"match\",\n stackStartFn: match\n });\n };\n var Comparison = function Comparison2(obj, keys, actual) {\n var _this = this;\n _classCallCheck(this, Comparison2), keys.forEach(function(key) {\n (key in obj) && (actual !== void 0 && typeof actual[key] == \"string\" && isRegExp(obj[key]) && obj[key].test(actual[key]) \? _this[key] = actual[key] : _this[key] = obj[key]);\n });\n };\n function compareExceptionKey(actual, expected, key, message, keys, fn) {\n if (!(key in actual) || !isDeepEqual(actual[key], expected[key], !0)) {\n if (!message) {\n var a = new Comparison(actual, keys), b = new Comparison(expected, keys, actual), err = new AssertionError({\n actual: a,\n expected: b,\n operator: \"deepStrictEqual\",\n stackStartFn: fn\n });\n throw err.actual = actual, err.expected = expected, err.operator = fn.name, err;\n }\n innerFail({\n actual,\n expected,\n message,\n operator: fn.name,\n stackStartFn: fn\n });\n }\n }\n function expectedException(actual, expected, msg, fn) {\n if (typeof expected != \"function\") {\n if (isRegExp(expected))\n return expected.test(actual);\n if (arguments.length === 2)\n throw new ERR_INVALID_ARG_TYPE(\"expected\", [\"Function\", \"RegExp\"], expected);\n if (_typeof(actual) !== \"object\" || actual === null) {\n var err = new AssertionError({\n actual,\n expected,\n message: msg,\n operator: \"deepStrictEqual\",\n stackStartFn: fn\n });\n throw err.operator = fn.name, err;\n }\n var keys = Object.keys(expected);\n if (expected instanceof Error)\n keys.push(\"name\", \"message\");\n else if (keys.length === 0)\n throw new ERR_INVALID_ARG_VALUE(\"error\", expected, \"may not be an empty object\");\n return keys.forEach(function(key) {\n return typeof actual[key] == \"string\" && isRegExp(expected[key]) && expected[key].test(actual[key]) || compareExceptionKey(actual, expected, key, msg, keys, fn);\n }), !0;\n }\n return expected.prototype !== void 0 && actual instanceof expected \? !0 : Error.isPrototypeOf(expected) \? !1 : expected.@call({}, actual) === !0;\n }\n function getActual(fn) {\n if (typeof fn != \"function\")\n throw new ERR_INVALID_ARG_TYPE(\"fn\", \"Function\", fn);\n try {\n fn();\n } catch (e) {\n return e;\n }\n return NO_EXCEPTION_SENTINEL;\n }\n function checkIsPromise(obj) {\n return isPromise(obj) || obj !== null && _typeof(obj) === \"object\" && typeof obj.then == \"function\" && typeof obj.catch == \"function\";\n }\n function waitForActual(promiseFn) {\n return @Promise.resolve().then(function() {\n var resultPromise;\n if (typeof promiseFn == \"function\") {\n if (resultPromise = promiseFn(), !checkIsPromise(resultPromise))\n throw new ERR_INVALID_RETURN_VALUE(\"instance of Promise\", \"promiseFn\", resultPromise);\n } else if (checkIsPromise(promiseFn))\n resultPromise = promiseFn;\n else\n throw new ERR_INVALID_ARG_TYPE(\"promiseFn\", [\"Function\", \"Promise\"], promiseFn);\n return @Promise.resolve().then(function() {\n return resultPromise;\n }).then(function() {\n return NO_EXCEPTION_SENTINEL;\n }).catch(function(e) {\n return e;\n });\n });\n }\n function expectsError(stackStartFn, actual, error, message) {\n if (typeof error == \"string\") {\n if (arguments.length === 4)\n throw new ERR_INVALID_ARG_TYPE(\"error\", [\"Object\", \"Error\", \"Function\", \"RegExp\"], error);\n if (_typeof(actual) === \"object\" && actual !== null) {\n if (actual.message === error)\n throw new ERR_AMBIGUOUS_ARGUMENT(\"error/message\", 'The error message \"'.concat(actual.message, '\" is identical to the message.'));\n } else if (actual === error)\n throw new ERR_AMBIGUOUS_ARGUMENT(\"error/message\", 'The error \"'.concat(actual, '\" is identical to the message.'));\n message = error, error = void 0;\n } else if (error != null && _typeof(error) !== \"object\" && typeof error != \"function\")\n throw new ERR_INVALID_ARG_TYPE(\"error\", [\"Object\", \"Error\", \"Function\", \"RegExp\"], error);\n if (actual === NO_EXCEPTION_SENTINEL) {\n var details = \"\";\n error && error.name && (details += \" (\".concat(error.name, \")\")), details += message \? \": \".concat(message) : \".\";\n var fnType = stackStartFn.name === \"rejects\" \? \"rejection\" : \"exception\";\n innerFail({\n actual: void 0,\n expected: error,\n operator: stackStartFn.name,\n message: \"Missing expected \".concat(fnType).concat(details),\n stackStartFn\n });\n }\n if (error && !expectedException(actual, error, message, stackStartFn))\n throw actual;\n }\n function expectsNoError(stackStartFn, actual, error, message) {\n if (actual !== NO_EXCEPTION_SENTINEL) {\n if (typeof error == \"string\" && (message = error, error = void 0), !error || expectedException(actual, error)) {\n var details = message \? \": \".concat(message) : \".\", fnType = stackStartFn.name === \"doesNotReject\" \? \"rejection\" : \"exception\";\n innerFail({\n actual,\n expected: error,\n operator: stackStartFn.name,\n message: \"Got unwanted \".concat(fnType).concat(details, `\n`) + 'Actual message: \"'.concat(actual && actual.message, '\"'),\n stackStartFn\n });\n }\n throw actual;\n }\n }\n assert.throws = function throws(promiseFn) {\n for (var _len2 = arguments.length, args = new @Array(_len2 > 1 \? _len2 - 1 : 0), _key2 = 1;_key2 < _len2; _key2++)\n args[_key2 - 1] = arguments[_key2];\n expectsError.@apply(void 0, [throws, getActual(promiseFn)].concat(args));\n }, assert.rejects = function rejects(promiseFn) {\n for (var _len3 = arguments.length, args = new @Array(_len3 > 1 \? _len3 - 1 : 0), _key3 = 1;_key3 < _len3; _key3++)\n args[_key3 - 1] = arguments[_key3];\n return waitForActual(promiseFn).then(function(result) {\n return expectsError.@apply(void 0, [rejects, result].concat(args));\n });\n }, assert.doesNotThrow = function doesNotThrow(fn) {\n for (var _len4 = arguments.length, args = new @Array(_len4 > 1 \? _len4 - 1 : 0), _key4 = 1;_key4 < _len4; _key4++)\n args[_key4 - 1] = arguments[_key4];\n expectsNoError.@apply(void 0, [doesNotThrow, getActual(fn)].concat(args));\n }, assert.doesNotReject = function doesNotReject(fn) {\n for (var _len5 = arguments.length, args = new @Array(_len5 > 1 \? _len5 - 1 : 0), _key5 = 1;_key5 < _len5; _key5++)\n args[_key5 - 1] = arguments[_key5];\n return waitForActual(fn).then(function(result) {\n return expectsNoError.@apply(void 0, [doesNotReject, result].concat(args));\n });\n }, assert.ifError = function ifError(err) {\n if (err != null) {\n var message = \"ifError got unwanted exception: \";\n _typeof(err) === \"object\" && typeof err.message == \"string\" \? err.message.length === 0 && err.constructor \? message += err.constructor.name : message += err.message : message += inspect(err);\n var newErr = new AssertionError({\n actual: err,\n expected: null,\n operator: \"ifError\",\n message,\n stackStartFn: ifError\n }), origStack = err.stack;\n if (typeof origStack == \"string\") {\n var tmp2 = origStack.split(`\n`);\n tmp2.shift();\n for (var tmp1 = newErr.stack.split(`\n`), i = 0;i < tmp2.length; i++) {\n var pos = tmp1.indexOf(tmp2[i]);\n if (pos !== -1) {\n tmp1 = tmp1.slice(0, pos);\n break;\n }\n }\n newErr.stack = \"\".concat(tmp1.join(`\n`), `\n`).concat(tmp2.join(`\n`));\n }\n throw newErr;\n }\n };\n function strict() {\n for (var _len6 = arguments.length, args = new @Array(_len6), _key6 = 0;_key6 < _len6; _key6++)\n args[_key6] = arguments[_key6];\n innerOk.@apply(void 0, [strict, args.length].concat(args));\n }\n assert.strict = objectAssign(strict, assert, {\n equal: assert.strictEqual,\n deepEqual: assert.deepStrictEqual,\n notEqual: assert.notStrictEqual,\n notDeepEqual: assert.notDeepStrictEqual\n }), assert.strict.strict = assert.strict;\n }\n}), assert_module = require_assert();\nassert_module.CallTracker = CallTracker;\nreturn assert_module})\n"); -// - -// -static constexpr ASCIILiteral NodeAssertStrictCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/assert.strict.ts\nreturn (@getInternalField(@internalModuleRegistry, 8) || @createInternalModuleById(8)).strict})\n"); -// - -// -static constexpr ASCIILiteral NodeAsyncHooksCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/async_hooks.ts\nvar get = function() {\n return @getInternalField(@asyncContext, 0);\n}, set = function(contextValue) {\n return @putInternalField(@asyncContext, 0, contextValue);\n}, createWarning = function(message) {\n let warned = !1;\n var wrapped = function() {\n if (warned)\n return;\n if (new Error().stack.includes(\"zx/build/core.js\"))\n return;\n warned = !0, console.warn(\"[bun] Warning:\", message);\n };\n return wrapped;\n}, createHook = function(callbacks) {\n return {\n enable: createHookNotImpl,\n disable: createHookNotImpl\n };\n}, executionAsyncId = function() {\n return executionAsyncIdNotImpl(), 0;\n}, triggerAsyncId = function() {\n return 0;\n}, executionAsyncResource = function() {\n return executionAsyncResourceWarning(), process.stdin;\n}, $, { cleanupLater, setAsyncHooksEnabled } = @lazy(\"async_hooks\");\n\nclass AsyncLocalStorage {\n #disableCalled = !1;\n constructor() {\n setAsyncHooksEnabled(!0);\n }\n static bind(fn, ...args) {\n return this.snapshot().bind(null, fn, ...args);\n }\n static snapshot() {\n var context = get();\n return (fn, ...args) => {\n var prev = get();\n set(context);\n try {\n return fn(...args);\n } catch (error) {\n throw error;\n } finally {\n set(prev);\n }\n };\n }\n enterWith(store) {\n cleanupLater();\n var context = get();\n if (!context) {\n set([this, store]);\n return;\n }\n var { length } = context;\n for (var i = 0;i < length; i += 2)\n if (context[i] === this) {\n const clone = context.slice();\n clone[i + 1] = store, set(clone);\n return;\n }\n set(context.concat(this, store));\n }\n exit(cb, ...args) {\n return this.run(@undefined, cb, ...args);\n }\n run(store_value, callback, ...args) {\n var context = get(), hasPrevious = !1, previous_value, i = 0, contextWasAlreadyInit = !context;\n if (contextWasAlreadyInit)\n set(context = [this, store_value]);\n else {\n if (context = context.slice(), i = context.indexOf(this), i > -1)\n hasPrevious = !0, previous_value = context[i + 1], context[i + 1] = store_value;\n else\n i = context.length, context.push(this, store_value);\n set(context);\n }\n try {\n return callback(...args);\n } catch (e) {\n throw e;\n } finally {\n if (!this.#disableCalled) {\n var context2 = get();\n if (context2 === context && contextWasAlreadyInit)\n set(@undefined);\n else if (context2 = context2.slice(), hasPrevious)\n context2[i + 1] = previous_value, set(context2);\n else\n context2.splice(i, 2), set(context2.length \? context2 : @undefined);\n }\n }\n }\n disable() {\n if (!this.#disableCalled) {\n var context = get();\n if (context) {\n var { length } = context;\n for (var i = 0;i < length; i += 2)\n if (context[i] === this) {\n context.splice(i, 2), set(context.length \? context : @undefined);\n break;\n }\n }\n this.#disableCalled = !0;\n }\n }\n getStore() {\n var context = get();\n if (!context)\n return;\n var { length } = context;\n for (var i = 0;i < length; i += 2)\n if (context[i] === this)\n return context[i + 1];\n }\n}\n\nclass AsyncResource {\n type;\n #snapshot;\n constructor(type, options) {\n if (typeof type !== \"string\")\n @throwTypeError('The \"type\" argument must be of type string. Received type ' + typeof type);\n setAsyncHooksEnabled(!0), this.type = type, this.#snapshot = get();\n }\n emitBefore() {\n return !0;\n }\n emitAfter() {\n return !0;\n }\n asyncId() {\n return 0;\n }\n triggerAsyncId() {\n return 0;\n }\n emitDestroy() {\n }\n runInAsyncScope(fn, thisArg, ...args) {\n var prev = get();\n set(this.#snapshot);\n try {\n return fn.@apply(thisArg, args);\n } catch (error) {\n throw error;\n } finally {\n set(prev);\n }\n }\n bind(fn, thisArg) {\n return this.runInAsyncScope.bind(this, fn, thisArg \?\? this);\n }\n static bind(fn, type, thisArg) {\n return type = type || fn.name, new AsyncResource(type || \"bound-anonymous-fn\").bind(fn, thisArg);\n }\n}\nvar createHookNotImpl = createWarning(\"async_hooks.createHook is not implemented in Bun. Hooks can still be created but will never be called.\"), executionAsyncIdNotImpl = createWarning(\"async_hooks.executionAsyncId/triggerAsyncId are not implemented in Bun. It will return 0 every time.\"), executionAsyncResourceWarning = createWarning(\"async_hooks.executionAsyncResource is not implemented in Bun. It returns a reference to process.stdin every time.\"), asyncWrapProviders = {\n NONE: 0,\n DIRHANDLE: 1,\n DNSCHANNEL: 2,\n ELDHISTOGRAM: 3,\n FILEHANDLE: 4,\n FILEHANDLECLOSEREQ: 5,\n FIXEDSIZEBLOBCOPY: 6,\n FSEVENTWRAP: 7,\n FSREQCALLBACK: 8,\n FSREQPROMISE: 9,\n GETADDRINFOREQWRAP: 10,\n GETNAMEINFOREQWRAP: 11,\n HEAPSNAPSHOT: 12,\n HTTP2SESSION: 13,\n HTTP2STREAM: 14,\n HTTP2PING: 15,\n HTTP2SETTINGS: 16,\n HTTPINCOMINGMESSAGE: 17,\n HTTPCLIENTREQUEST: 18,\n JSSTREAM: 19,\n JSUDPWRAP: 20,\n MESSAGEPORT: 21,\n PIPECONNECTWRAP: 22,\n PIPESERVERWRAP: 23,\n PIPEWRAP: 24,\n PROCESSWRAP: 25,\n PROMISE: 26,\n QUERYWRAP: 27,\n SHUTDOWNWRAP: 28,\n SIGNALWRAP: 29,\n STATWATCHER: 30,\n STREAMPIPE: 31,\n TCPCONNECTWRAP: 32,\n TCPSERVERWRAP: 33,\n TCPWRAP: 34,\n TTYWRAP: 35,\n UDPSENDWRAP: 36,\n UDPWRAP: 37,\n SIGINTWATCHDOG: 38,\n WORKER: 39,\n WORKERHEAPSNAPSHOT: 40,\n WRITEWRAP: 41,\n ZLIB: 42,\n CHECKPRIMEREQUEST: 43,\n PBKDF2REQUEST: 44,\n KEYPAIRGENREQUEST: 45,\n KEYGENREQUEST: 46,\n KEYEXPORTREQUEST: 47,\n CIPHERREQUEST: 48,\n DERIVEBITSREQUEST: 49,\n HASHREQUEST: 50,\n RANDOMBYTESREQUEST: 51,\n RANDOMPRIMEREQUEST: 52,\n SCRYPTREQUEST: 53,\n SIGNREQUEST: 54,\n TLSWRAP: 55,\n VERIFYREQUEST: 56,\n INSPECTORJSBINDING: 57\n};\n$ = {\n AsyncLocalStorage,\n createHook,\n executionAsyncId,\n triggerAsyncId,\n executionAsyncResource,\n asyncWrapProviders,\n AsyncResource\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeChildProcessCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/child_process.ts\nvar spawn = function(file, args, options) {\n options = normalizeSpawnArguments(file, args, options), validateTimeout(options.timeout), validateAbortSignal(options.signal, \"options.signal\");\n const killSignal2 = sanitizeKillSignal(options.killSignal), child = new ChildProcess;\n if (child.spawn(options), options.timeout > 0) {\n let timeoutId = setTimeout(() => {\n if (timeoutId) {\n try {\n child.kill(killSignal2);\n } catch (err) {\n child.emit(\"error\", err);\n }\n timeoutId = null;\n }\n });\n child.once(\"exit\", () => {\n if (timeoutId)\n clearTimeout(timeoutId), timeoutId = null;\n });\n }\n if (options.signal) {\n let onAbortListener2 = function() {\n abortChildProcess(child, killSignal2, options.signal.reason);\n };\n var onAbortListener = onAbortListener2;\n const signal = options.signal;\n if (signal.aborted)\n process.nextTick(onAbortListener2);\n else\n signal.addEventListener(\"abort\", onAbortListener2, { once: !0 }), child.once(\"exit\", () => signal.removeEventListener(\"abort\", onAbortListener2));\n }\n return child;\n}, execFile = function(file, args, options, callback) {\n ({ file, args, options, callback } = normalizeExecFileArgs(file, args, options, callback)), options = {\n encoding: \"utf8\",\n timeout: 0,\n maxBuffer: MAX_BUFFER,\n killSignal: \"SIGTERM\",\n cwd: null,\n env: null,\n shell: !1,\n ...options\n };\n const maxBuffer = options.maxBuffer;\n validateTimeout(options.timeout), validateMaxBuffer(maxBuffer), options.killSignal = sanitizeKillSignal(options.killSignal);\n const child = spawn(file, args, {\n cwd: options.cwd,\n env: options.env,\n shell: options.shell,\n signal: options.signal\n });\n let encoding;\n const _stdout = [], _stderr = [];\n if (options.encoding !== \"buffer\" && BufferIsEncoding(options.encoding))\n encoding = options.encoding;\n else\n encoding = null;\n let stdoutLen = 0, stderrLen = 0, killed = !1, exited = !1, timeoutId, encodedStdoutLen, encodedStderrLen, ex = null, cmd = file;\n function exitHandler(code, signal) {\n if (exited)\n return;\n if (exited = !0, timeoutId)\n clearTimeout(timeoutId), timeoutId = null;\n if (!callback)\n return;\n const readableEncoding = child\?.stdout\?.readableEncoding;\n let stdout, stderr;\n if (encoding || child.stdout && readableEncoding)\n stdout = ArrayPrototypeJoin.@call(_stdout, \"\");\n else\n stdout = BufferConcat(_stdout);\n if (encoding || child.stderr && readableEncoding)\n stderr = ArrayPrototypeJoin.@call(_stderr, \"\");\n else\n stderr = BufferConcat(_stderr);\n if (!ex && code === 0 && signal === null) {\n callback(null, stdout, stderr);\n return;\n }\n if (args\?.length)\n cmd += ` ${ArrayPrototypeJoin.@call(args, \" \")}`;\n if (!ex) {\n let message = `Command failed: ${cmd}`;\n if (stderr)\n message += `\\n${stderr}`;\n ex = genericNodeError(message, {\n code,\n killed: child.killed || killed,\n signal\n });\n }\n ex.cmd = cmd, callback(ex, stdout, stderr);\n }\n function errorHandler(e) {\n if (ex = e, child.stdout)\n child.stdout.destroy();\n if (child.stderr)\n child.stderr.destroy();\n exitHandler();\n }\n function kill() {\n if (child.stdout)\n child.stdout.destroy();\n if (child.stderr)\n child.stderr.destroy();\n killed = !0;\n try {\n child.kill(options.killSignal);\n } catch (e) {\n ex = e, exitHandler();\n }\n }\n if (options.timeout > 0)\n timeoutId = setTimeout(function delayedKill() {\n kill(), timeoutId = null;\n }, options.timeout);\n if (child.stdout) {\n if (encoding)\n child.stdout.setEncoding(encoding);\n child.stdout.on(\"data\", maxBuffer === @Infinity \? function onUnlimitedSizeBufferedData(chunk) {\n ArrayPrototypePush.@call(_stdout, chunk);\n } : encoding \? function onChildStdoutEncoded(chunk) {\n if (stdoutLen += chunk.length, stdoutLen * 4 > maxBuffer) {\n const encoding2 = child.stdout.readableEncoding, actualLen = @Buffer.byteLength(chunk, encoding2);\n if (encodedStdoutLen === @undefined)\n for (let i = 0;i < _stdout.length; i++)\n encodedStdoutLen += @Buffer.byteLength(_stdout[i], encoding2);\n else\n encodedStdoutLen += actualLen;\n const truncatedLen = maxBuffer - (encodedStdoutLen - actualLen);\n ArrayPrototypePush.@call(_stdout, StringPrototypeSlice.@apply(chunk, 0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stdout\"), kill();\n } else\n ArrayPrototypePush.@call(_stdout, chunk);\n } : function onChildStdoutRaw(chunk) {\n if (stdoutLen += chunk.length, stdoutLen > maxBuffer) {\n const truncatedLen = maxBuffer - (stdoutLen - chunk.length);\n ArrayPrototypePush.@call(_stdout, chunk.slice(0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stdout\"), kill();\n } else\n ArrayPrototypePush.@call(_stdout, chunk);\n });\n }\n if (child.stderr) {\n if (encoding)\n child.stderr.setEncoding(encoding);\n child.stderr.on(\"data\", maxBuffer === @Infinity \? function onUnlimitedSizeBufferedData(chunk) {\n ArrayPrototypePush.@call(_stderr, chunk);\n } : encoding \? function onChildStderrEncoded(chunk) {\n if (stderrLen += chunk.length, stderrLen * 4 > maxBuffer) {\n const encoding2 = child.stderr.readableEncoding, actualLen = @Buffer.byteLength(chunk, encoding2);\n if (encodedStderrLen === @undefined)\n for (let i = 0;i < _stderr.length; i++)\n encodedStderrLen += @Buffer.byteLength(_stderr[i], encoding2);\n else\n encodedStderrLen += actualLen;\n const truncatedLen = maxBuffer - (encodedStderrLen - actualLen);\n ArrayPrototypePush.@call(_stderr, StringPrototypeSlice.@call(chunk, 0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stderr\"), kill();\n } else\n ArrayPrototypePush.@call(_stderr, chunk);\n } : function onChildStderrRaw(chunk) {\n if (stderrLen += chunk.length, stderrLen > maxBuffer) {\n const truncatedLen = maxBuffer - (stderrLen - chunk.length);\n ArrayPrototypePush.@call(_stderr, StringPrototypeSlice.@call(chunk, 0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stderr\"), kill();\n } else\n ArrayPrototypePush.@call(_stderr, chunk);\n });\n }\n return child.addListener(\"close\", exitHandler), child.addListener(\"error\", errorHandler), child;\n}, exec = function(command, options, callback) {\n const opts = normalizeExecArgs(command, options, callback);\n return execFile(opts.file, opts.options, opts.callback);\n}, spawnSync = function(file, args, options) {\n options = {\n maxBuffer: MAX_BUFFER,\n ...normalizeSpawnArguments(file, args, options)\n };\n const { maxBuffer, encoding } = options;\n validateTimeout(options.timeout), validateMaxBuffer(maxBuffer), options.killSignal = sanitizeKillSignal(options.killSignal);\n const stdio = options.stdio || \"pipe\", bunStdio = getBunStdioFromOptions(stdio);\n var { input } = options;\n if (input)\n if (ArrayBufferIsView(input))\n bunStdio[0] = input;\n else if (typeof input === \"string\")\n bunStdio[0] = @Buffer.from(input, encoding || \"utf8\");\n else\n throw new ERR_INVALID_ARG_TYPE(\"options.stdio[0]\", [\"Buffer\", \"TypedArray\", \"DataView\", \"string\"], input);\n const { stdout, stderr, success, exitCode } = Bun.spawnSync({\n cmd: options.args,\n env: options.env || @undefined,\n cwd: options.cwd || @undefined,\n stdin: bunStdio[0],\n stdout: bunStdio[1],\n stderr: bunStdio[2]\n }), result = {\n signal: null,\n status: exitCode,\n output: [null, stdout, stderr]\n };\n if (stdout && encoding && encoding !== \"buffer\")\n result.output[1] = result.output[1]\?.toString(encoding);\n if (stderr && encoding && encoding !== \"buffer\")\n result.output[2] = result.output[2]\?.toString(encoding);\n if (result.stdout = result.output[1], result.stderr = result.output[2], !success)\n result.error = new SystemError(result.output[2], options.file, \"spawnSync\", -1, result.status), result.error.spawnargs = ArrayPrototypeSlice.@call(options.args, 1);\n return result;\n}, execFileSync = function(file, args, options) {\n ({ file, args, options } = normalizeExecFileArgs(file, args, options));\n const ret = spawnSync(file, args, options), errArgs = [options.argv0 || file];\n ArrayPrototypePush.@apply(errArgs, args);\n const err = checkExecSyncError(ret, errArgs);\n if (err)\n throw err;\n return ret.stdout;\n}, execSync = function(command, options) {\n const opts = normalizeExecArgs(command, options, null), ret = spawnSync(opts.file, opts.options), err = checkExecSyncError(ret, @undefined, command);\n if (err)\n throw err;\n return ret.stdout;\n}, stdioStringToArray = function(stdio, channel) {\n const options = [];\n switch (stdio) {\n case \"ignore\":\n case \"overlapped\":\n case \"pipe\":\n ArrayPrototypePush.@call(options, stdio, stdio, stdio);\n break;\n case \"inherit\":\n ArrayPrototypePush.@call(options, 0, 1, 2);\n break;\n default:\n throw new ERR_INVALID_ARG_VALUE(\"stdio\", stdio);\n }\n if (channel)\n ArrayPrototypePush.@call(options, channel);\n return options;\n}, fork = function(modulePath, args = [], options) {\n modulePath = getValidatedPath(modulePath, \"modulePath\");\n let execArgv;\n if (args == null)\n args = [];\n else if (typeof args === \"object\" && !ArrayIsArray(args))\n options = args, args = [];\n else\n validateArray(args, \"args\");\n if (options != null)\n validateObject(options, \"options\");\n if (options = { __proto__: null, ...options, shell: !1 }, options.execPath = options.execPath || process.execPath, validateArgumentNullCheck(options.execPath, \"options.execPath\"), args = [modulePath, ...args], typeof options.stdio === \"string\")\n options.stdio = stdioStringToArray(options.stdio, \"ipc\");\n else if (!ArrayIsArray(options.stdio))\n options.stdio = stdioStringToArray(options.silent \? \"pipe\" : \"inherit\", \"ipc\");\n else if (!ArrayPrototypeIncludes.@call(options.stdio, \"ipc\"))\n throw new ERR_CHILD_PROCESS_IPC_REQUIRED(\"options.stdio\");\n return spawn(options.execPath, args, options);\n}, convertToValidSignal = function(signal) {\n if (typeof signal === \"number\" && getSignalsToNamesMapping()[signal])\n return signal;\n if (typeof signal === \"string\") {\n const signalName = signals[StringPrototypeToUpperCase.@call(signal)];\n if (signalName)\n return signalName;\n }\n throw new ERR_UNKNOWN_SIGNAL(signal);\n}, sanitizeKillSignal = function(killSignal2) {\n if (typeof killSignal2 === \"string\" || typeof killSignal2 === \"number\")\n return convertToValidSignal(killSignal2);\n else if (killSignal2 != null)\n throw new ERR_INVALID_ARG_TYPE(\"options.killSignal\", [\"string\", \"number\"], killSignal2);\n}, getSignalsToNamesMapping = function() {\n if (signalsToNamesMapping !== @undefined)\n return signalsToNamesMapping;\n signalsToNamesMapping = ObjectCreate(null);\n for (let key in signals)\n signalsToNamesMapping[signals[key]] = key;\n return signalsToNamesMapping;\n}, normalizeExecFileArgs = function(file, args, options, callback) {\n if (ArrayIsArray(args))\n args = ArrayPrototypeSlice.@call(args);\n else if (args != null && typeof args === \"object\")\n callback = options, options = args, args = null;\n else if (typeof args === \"function\")\n callback = args, options = null, args = null;\n if (args == null)\n args = [];\n if (typeof options === \"function\")\n callback = options;\n else if (options != null)\n validateObject(options, \"options\");\n if (options == null)\n options = kEmptyObject;\n if (callback != null)\n validateFunction(callback, \"callback\");\n if (options.argv0 != null)\n validateString(options.argv0, \"options.argv0\"), validateArgumentNullCheck(options.argv0, \"options.argv0\");\n return { file, args, options, callback };\n}, normalizeExecArgs = function(command, options, callback) {\n if (validateString(command, \"command\"), validateArgumentNullCheck(command, \"command\"), typeof options === \"function\")\n callback = options, options = @undefined;\n return options = { ...options }, options.shell = typeof options.shell === \"string\" \? options.shell : !0, {\n file: command,\n options,\n callback\n };\n}, normalizeSpawnArguments = function(file, args, options) {\n if (validateString(file, \"file\"), validateArgumentNullCheck(file, \"file\"), file.length === 0)\n throw new ERR_INVALID_ARG_VALUE(\"file\", file, \"cannot be empty\");\n if (ArrayIsArray(args))\n args = ArrayPrototypeSlice.@call(args);\n else if (args == null)\n args = [];\n else if (typeof args !== \"object\")\n throw new ERR_INVALID_ARG_TYPE(\"args\", \"object\", args);\n else\n options = args, args = [];\n if (validateArgumentsNullCheck(args, \"args\"), options === @undefined)\n options = {};\n else\n validateObject(options, \"options\");\n let cwd = options.cwd;\n if (cwd != null)\n cwd = getValidatedPath(cwd, \"options.cwd\");\n var detached = !1;\n const { detached: detachedOption } = options;\n if (detachedOption != null)\n detached = !!detachedOption;\n if (options.shell != null && typeof options.shell !== \"boolean\" && typeof options.shell !== \"string\")\n throw new ERR_INVALID_ARG_TYPE(\"options.shell\", [\"boolean\", \"string\"], options.shell);\n if (options.argv0 != null)\n validateString(options.argv0, \"options.argv0\"), validateArgumentNullCheck(options.argv0, \"options.argv0\");\n if (options.shell) {\n validateArgumentNullCheck(options.shell, \"options.shell\");\n const command = ArrayPrototypeJoin.@call([file, ...args], \" \");\n if (typeof options.shell === \"string\")\n file = options.shell;\n else\n file = \"sh\";\n args = [\"-c\", command];\n }\n if (typeof options.argv0 === \"string\")\n ArrayPrototypeUnshift.@call(args, options.argv0);\n else\n ArrayPrototypeUnshift.@call(args, file);\n const envPairs = options.env || process.env;\n return { ...options, detached, file, args, cwd, envPairs };\n}, checkExecSyncError = function(ret, args, cmd) {\n let err;\n if (ret.error)\n err = ret.error, ObjectAssign(err, ret);\n else if (ret.status !== 0) {\n let msg = \"Command failed: \";\n if (msg += cmd || ArrayPrototypeJoin.@call(args, \" \"), ret.stderr && ret.stderr.length > 0)\n msg += `\\n${ret.stderr.toString()}`;\n err = genericNodeError(msg, ret);\n }\n return err;\n}, nodeToBun = function(item) {\n if (typeof item === \"number\")\n return item;\n else {\n const result = nodeToBunLookup[item];\n if (result === @undefined)\n throw new Error(`Invalid stdio option \"${item}\"`);\n return result;\n }\n}, fdToStdioName = function(fd) {\n switch (fd) {\n case 0:\n return \"stdin\";\n case 1:\n return \"stdout\";\n case 2:\n return \"stderr\";\n default:\n return null;\n }\n}, getBunStdioFromOptions = function(stdio) {\n return normalizeStdio(stdio).map((item) => nodeToBun(item));\n}, normalizeStdio = function(stdio) {\n if (typeof stdio === \"string\")\n switch (stdio) {\n case \"ignore\":\n return [\"ignore\", \"ignore\", \"ignore\"];\n case \"pipe\":\n return [\"pipe\", \"pipe\", \"pipe\"];\n case \"inherit\":\n return [\"inherit\", \"inherit\", \"inherit\"];\n default:\n throw new ERR_INVALID_OPT_VALUE(\"stdio\", stdio);\n }\n else if (ArrayIsArray(stdio)) {\n let processedStdio;\n if (stdio.length === 0)\n processedStdio = [\"pipe\", \"pipe\", \"pipe\"];\n else if (stdio.length === 1)\n processedStdio = [stdio[0], \"pipe\", \"pipe\"];\n else if (stdio.length === 2)\n processedStdio = [stdio[0], stdio[1], \"pipe\"];\n else if (stdio.length >= 3)\n processedStdio = [stdio[0], stdio[1], stdio[2]];\n return processedStdio.map((item) => !item \? \"pipe\" : item);\n } else\n throw new ERR_INVALID_OPT_VALUE(\"stdio\", stdio);\n}, flushStdio = function(subprocess) {\n const stdio = subprocess.stdio;\n if (stdio == null)\n return;\n for (let i = 0;i < stdio.length; i++) {\n const stream = stdio[i];\n if (!stream || !stream.readable)\n continue;\n stream.resume();\n }\n}, onSpawnNT = function(self) {\n self.emit(\"spawn\");\n}, abortChildProcess = function(child, killSignal2, reason) {\n if (!child)\n return;\n try {\n if (child.kill(killSignal2))\n child.emit(\"error\", new AbortError(@undefined, { cause: reason }));\n } catch (err) {\n child.emit(\"error\", err);\n }\n}, validateMaxBuffer = function(maxBuffer) {\n if (maxBuffer != null && !(typeof maxBuffer === \"number\" && maxBuffer >= 0))\n throw new ERR_OUT_OF_RANGE(\"options.maxBuffer\", \"a positive number\", maxBuffer);\n}, validateArgumentNullCheck = function(arg, propName) {\n if (typeof arg === \"string\" && StringPrototypeIncludes.@call(arg, \"\\0\"))\n throw new ERR_INVALID_ARG_VALUE(propName, arg, \"must be a string without null bytes\");\n}, validateArgumentsNullCheck = function(args, propName) {\n for (let i = 0;i < args.length; ++i)\n validateArgumentNullCheck(args[i], `${propName}[${i}]`);\n}, validateTimeout = function(timeout) {\n if (timeout != null && !(NumberIsInteger(timeout) && timeout >= 0))\n throw new ERR_OUT_OF_RANGE(\"timeout\", \"an unsigned integer\", timeout);\n};\nvar validateFunction = function(value, name) {\n if (typeof value !== \"function\")\n throw new ERR_INVALID_ARG_TYPE(name, \"Function\", value);\n}, validateString = function(value, name) {\n if (typeof value !== \"string\")\n throw new ERR_INVALID_ARG_TYPE(name, \"string\", value);\n}, nullCheck = function(path, propName, throwError = !0) {\n const pathIsString = typeof path === \"string\", pathIsUint8Array = isUint8Array(path);\n if (!pathIsString && !pathIsUint8Array || pathIsString && !StringPrototypeIncludes.@call(path, \"\\0\") || pathIsUint8Array && !Uint8ArrayPrototypeIncludes.@call(path, 0))\n return;\n const err = new ERR_INVALID_ARG_VALUE(propName, path, \"must be a string or Uint8Array without null bytes\");\n if (throwError)\n throw err;\n return err;\n}, validatePath = function(path, propName = \"path\") {\n if (typeof path !== \"string\" && !isUint8Array(path))\n throw new ERR_INVALID_ARG_TYPE(propName, [\"string\", \"Buffer\", \"URL\"], path);\n const err = nullCheck(path, propName, !1);\n if (err !== @undefined)\n throw err;\n}, getValidatedPath = function(fileURLOrPath, propName = \"path\") {\n const path = toPathIfFileURL(fileURLOrPath);\n return validatePath(path, propName), path;\n}, isUint8Array = function(value) {\n return typeof value === \"object\" && value !== null && value instanceof @Uint8Array;\n}, isURLInstance = function(fileURLOrPath) {\n return fileURLOrPath != null && fileURLOrPath.href && fileURLOrPath.origin;\n}, toPathIfFileURL = function(fileURLOrPath) {\n if (!isURLInstance(fileURLOrPath))\n return fileURLOrPath;\n return Bun.fileURLToPath(fileURLOrPath);\n}, genericNodeError = function(message, options) {\n const err = new Error(message);\n return err.code = options.code, err.killed = options.killed, err.signal = options.signal, err;\n}, ERR_OUT_OF_RANGE = function(str, range, input, replaceDefaultBoolean = !1) {\n return new RangeError(`The value of ${str} is out of range. It must be ${range}. Received ${input}`);\n}, ERR_CHILD_PROCESS_STDIO_MAXBUFFER = function(stdio) {\n return Error(`${stdio} maxBuffer length exceeded`);\n}, ERR_UNKNOWN_SIGNAL = function(name) {\n const err = @makeTypeError(`Unknown signal: ${name}`);\n return err.code = \"ERR_UNKNOWN_SIGNAL\", err;\n}, ERR_INVALID_ARG_TYPE = function(name, type, value) {\n const err = @makeTypeError(`The \"${name}\" argument must be of type ${type}. Received ${value\?.toString()}`);\n return err.code = \"ERR_INVALID_ARG_TYPE\", err;\n}, ERR_INVALID_OPT_VALUE = function(name, value) {\n return @makeTypeError(`The value \"${value}\" is invalid for option \"${name}\"`);\n}, ERR_INVALID_ARG_VALUE = function(name, value, reason) {\n return new Error(`The value \"${value}\" is invalid for argument '${name}'. Reason: ${reason}`);\n}, ERR_CHILD_PROCESS_IPC_REQUIRED = function(name) {\n const err = @makeTypeError(`Forked processes must have an IPC channel, missing value 'ipc' in ${name}`);\n return err.code = \"ERR_CHILD_PROCESS_IPC_REQUIRED\", err;\n}, $, EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20), StreamModule = @getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39), {\n constants: { signals }\n} = @getInternalField(@internalModuleRegistry, 28) || @createInternalModuleById(28), { promisify } = @getInternalField(@internalModuleRegistry, 48) || @createInternalModuleById(48), ObjectCreate = Object.create, ObjectAssign = Object.assign, ObjectDefineProperty = Object.defineProperty, BufferConcat = @Buffer.concat, BufferIsEncoding = @Buffer.isEncoding, kEmptyObject = ObjectCreate(null), ArrayPrototypePush = @Array.prototype.push, ArrayPrototypeJoin = @Array.prototype.join, ArrayPrototypeMap = @Array.prototype.map, ArrayPrototypeIncludes = @Array.prototype.includes, ArrayPrototypeSlice = @Array.prototype.slice, ArrayPrototypeUnshift = @Array.prototype.unshift, ArrayPrototypeLastIndexOf = @Array.prototype.lastIndexOf, ArrayPrototypeSplice = @Array.prototype.splice, ArrayIsArray = @Array.isArray, ArrayBufferIsView = @ArrayBuffer.isView, NumberIsInteger = Number.isInteger;\nvar StringPrototypeToUpperCase = @String.prototype.toUpperCase, StringPrototypeIncludes = @String.prototype.includes, StringPrototypeSlice = @String.prototype.slice, Uint8ArrayPrototypeIncludes = @Uint8Array.prototype.includes, MAX_BUFFER = 1048576, NativeWritable, ReadableFromWeb, customPromiseExecFunction = (orig) => {\n return (...args) => {\n let resolve, reject;\n const promise = new @Promise((res, rej) => {\n resolve = res, reject = rej;\n });\n return promise.child = orig(...args, (err, stdout, stderr) => {\n if (err !== null)\n err.stdout = stdout, err.stderr = stderr, reject(err);\n else\n resolve({ stdout, stderr });\n }), promise;\n };\n};\nObjectDefineProperty(exec, promisify.custom, {\n __proto__: null,\n enumerable: !1,\n value: customPromiseExecFunction(exec)\n});\nvar signalsToNamesMapping;\n\nclass ChildProcess extends EventEmitter {\n constructor() {\n super(...arguments);\n }\n #handle;\n #exited = !1;\n #closesNeeded = 1;\n #closesGot = 0;\n connected = !1;\n signalCode = null;\n exitCode = null;\n spawnfile;\n spawnargs;\n pid;\n channel;\n get killed() {\n if (this.#handle == null)\n return !1;\n }\n #handleOnExit(exitCode, signalCode, err) {\n if (this.#exited)\n return;\n if (signalCode)\n this.signalCode = signalCode;\n else\n this.exitCode = exitCode;\n if (this.#stdin)\n this.#stdin.destroy();\n if (this.#handle)\n this.#handle = null;\n if (exitCode < 0) {\n const err2 = new SystemError(`Spawned process exited with error code: ${exitCode}`, @undefined, \"spawn\", \"EUNKNOWN\", \"ERR_CHILD_PROCESS_UNKNOWN_ERROR\");\n if (this.spawnfile)\n err2.path = this.spawnfile;\n err2.spawnargs = ArrayPrototypeSlice.@call(this.spawnargs, 1), this.emit(\"error\", err2);\n } else\n this.emit(\"exit\", this.exitCode, this.signalCode);\n process.nextTick(flushStdio, this), this.#maybeClose(), this.#exited = !0, this.#stdioOptions = [\"destroyed\", \"destroyed\", \"destroyed\"];\n }\n #getBunSpawnIo(i, encoding) {\n NativeWritable ||= StreamModule.NativeWritable, ReadableFromWeb ||= StreamModule.Readable.fromWeb;\n const io = this.#stdioOptions[i];\n switch (i) {\n case 0:\n switch (io) {\n case \"pipe\":\n return new NativeWritable(this.#handle.stdin);\n case \"inherit\":\n return process.stdin || null;\n case \"destroyed\":\n return new ShimmedStdin;\n default:\n return null;\n }\n case 2:\n case 1:\n switch (io) {\n case \"pipe\":\n return ReadableFromWeb(this.#handle[fdToStdioName(i)], { encoding });\n case \"inherit\":\n return process[fdToStdioName(i)] || null;\n case \"destroyed\":\n return new ShimmedStdioOutStream;\n default:\n return null;\n }\n }\n }\n #stdin;\n #stdout;\n #stderr;\n #stdioObject;\n #encoding;\n #stdioOptions;\n #createStdioObject() {\n return Object.create(null, {\n 0: {\n get: () => this.stdin\n },\n 1: {\n get: () => this.stdout\n },\n 2: {\n get: () => this.stderr\n }\n });\n }\n get stdin() {\n return this.#stdin \?\?= this.#getBunSpawnIo(0, this.#encoding);\n }\n get stdout() {\n return this.#stdout \?\?= this.#getBunSpawnIo(1, this.#encoding);\n }\n get stderr() {\n return this.#stderr \?\?= this.#getBunSpawnIo(2, this.#encoding);\n }\n get stdio() {\n return this.#stdioObject \?\?= this.#createStdioObject();\n }\n spawn(options) {\n validateObject(options, \"options\"), validateString(options.file, \"options.file\");\n var file = this.spawnfile = options.file, spawnargs;\n if (options.args == null)\n spawnargs = this.spawnargs = [];\n else\n validateArray(options.args, \"options.args\"), spawnargs = this.spawnargs = options.args;\n const stdio = options.stdio || [\"pipe\", \"pipe\", \"pipe\"], bunStdio = getBunStdioFromOptions(stdio), ipc = @isArray(stdio) && stdio[3] === \"ipc\";\n var env = options.envPairs || @undefined;\n const detachedOption = options.detached;\n if (this.#encoding = options.encoding || @undefined, this.#stdioOptions = bunStdio, this.#handle = Bun.spawn({\n cmd: spawnargs,\n stdin: bunStdio[0],\n stdout: bunStdio[1],\n stderr: bunStdio[2],\n cwd: options.cwd || @undefined,\n env: env || process.env,\n detached: typeof detachedOption !== \"undefined\" \? !!detachedOption : !1,\n onExit: (handle, exitCode, signalCode, err) => {\n this.#handle = handle, this.pid = this.#handle.pid, process.nextTick((exitCode2, signalCode2, err2) => this.#handleOnExit(exitCode2, signalCode2, err2), exitCode, signalCode, err);\n },\n lazy: !0,\n ipc: ipc \? this.#emitIpcMessage.bind(this) : @undefined\n }), this.pid = this.#handle.pid, onSpawnNT(this), ipc)\n this.send = this.#send, this.disconnect = this.#disconnect;\n }\n #emitIpcMessage(message) {\n this.emit(\"message\", message);\n }\n #send(message, handle, options, callback) {\n if (typeof handle === \"function\")\n callback = handle, handle = @undefined, options = @undefined;\n else if (typeof options === \"function\")\n callback = options, options = @undefined;\n else if (options !== @undefined) {\n if (typeof options !== \"object\" || options === null)\n throw new ERR_INVALID_ARG_TYPE(\"options\", \"Object\", options);\n }\n if (!this.#handle) {\n if (callback)\n process.nextTick(callback, @makeTypeError(\"Process was closed while trying to send message\"));\n else\n this.emit(\"error\", @makeTypeError(\"Process was closed while trying to send message\"));\n return !1;\n }\n try {\n if (this.#handle.send(message), callback)\n process.nextTick(callback);\n return !0;\n } catch (error) {\n if (callback)\n process.nextTick(callback, error);\n else\n this.emit(\"error\", error);\n return !1;\n }\n }\n #disconnect() {\n if (!this.connected) {\n this.emit(\"error\", @makeTypeError(\"Process was closed while trying to send message\"));\n return;\n }\n this.connected = !1, this.#handle.disconnect();\n }\n kill(sig) {\n const signal = sig === 0 \? sig : convertToValidSignal(sig === @undefined \? \"SIGTERM\" : sig);\n if (this.#handle)\n this.#handle.kill(signal);\n return this.#maybeClose(), !0;\n }\n #maybeClose() {\n if (this.#closesGot++, this.#closesGot === this.#closesNeeded)\n this.emit(\"close\", this.exitCode, this.signalCode);\n }\n ref() {\n if (this.#handle)\n this.#handle.ref();\n }\n unref() {\n if (this.#handle)\n this.#handle.unref();\n }\n}\nvar nodeToBunLookup = {\n ignore: null,\n pipe: \"pipe\",\n overlapped: \"pipe\",\n inherit: \"inherit\"\n};\n\nclass ShimmedStdin extends EventEmitter {\n constructor() {\n super();\n }\n write() {\n return !1;\n }\n destroy() {\n }\n end() {\n }\n pipe() {\n }\n}\n\nclass ShimmedStdioOutStream extends EventEmitter {\n constructor() {\n super(...arguments);\n }\n pipe() {\n }\n}\nvar validateAbortSignal = (signal, name) => {\n if (signal !== @undefined && (signal === null || typeof signal !== \"object\" || !(\"aborted\" in signal)))\n throw new ERR_INVALID_ARG_TYPE(name, \"AbortSignal\", signal);\n};\nvar validateObject = (value, name, options = null) => {\n const allowArray = options\?.allowArray \?\? !1, allowFunction = options\?.allowFunction \?\? !1;\n if (!(options\?.nullable \?\? !1) && value === null || !allowArray && ArrayIsArray.@call(value) || typeof value !== \"object\" && (!allowFunction || typeof value !== \"function\"))\n throw new ERR_INVALID_ARG_TYPE(name, \"object\", value);\n}, validateArray = (value, name, minLength = 0) => {\n if (!ArrayIsArray(value))\n throw new ERR_INVALID_ARG_TYPE(name, \"Array\", value);\n if (value.length < minLength) {\n const reason = `must be longer than ${minLength}`;\n throw new ERR_INVALID_ARG_VALUE(name, value, reason);\n }\n}, Error = globalThis.Error, TypeError = globalThis.TypeError, RangeError = globalThis.RangeError;\n\nclass AbortError extends Error {\n code = \"ABORT_ERR\";\n name = \"AbortError\";\n constructor(message = \"The operation was aborted\", options = @undefined) {\n if (options !== @undefined && typeof options !== \"object\")\n throw new ERR_INVALID_ARG_TYPE(\"options\", \"Object\", options);\n super(message, options);\n }\n}\n\nclass SystemError extends Error {\n path;\n syscall;\n errno;\n code;\n constructor(message, path, syscall, errno, code) {\n super(message);\n this.path = path, this.syscall = syscall, this.errno = errno, this.code = code;\n }\n get name() {\n return \"SystemError\";\n }\n}\n$ = {\n ChildProcess,\n spawn,\n execFile,\n exec,\n fork,\n spawnSync,\n execFileSync,\n execSync\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeClusterCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/cluster.ts\nvar EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20), { throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6);\n\nclass Cluster extends EventEmitter {\n constructor() {\n super(...arguments);\n }\n isWorker = !1;\n isPrimary = !0;\n isMaster = !0;\n workers = {};\n settings = {};\n SCHED_NONE = 1;\n SCHED_RR = 2;\n schedulingPolicy = 2;\n Worker = function Worker() {\n throwNotImplemented(\"node:cluster Worker\", 2428);\n };\n setupPrimary() {\n throwNotImplemented(\"node:cluster\", 2428);\n }\n setupMaster() {\n throwNotImplemented(\"node:cluster\", 2428);\n }\n fork() {\n throwNotImplemented(\"node:cluster\", 2428);\n }\n disconnect() {\n throwNotImplemented(\"node:cluster\", 2428);\n }\n}\nreturn new Cluster})\n"); -// - -// -static constexpr ASCIILiteral NodeConsoleCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/console.ts\nreturn console})\n"); -// - -// -static constexpr ASCIILiteral NodeCryptoCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/crypto.ts\nvar exportIfKeyObject = function(key2) {\n if (key2 instanceof KeyObject)\n key2 = key2.export();\n else if (key2 instanceof CryptoKey)\n key2 = KeyObject.from(key2).export();\n return key2;\n}, getKeyFrom = function(key2, type) {\n if (key2 instanceof KeyObject)\n key2 = key2.export();\n else if (key2 instanceof CryptoKey)\n key2 = KeyObject.from(key2).export();\n else if (!Buffer.isBuffer(key2) && typeof key2 === \"object\") {\n if ((typeof key2.format === \"string\" || typeof key2.passphrase === \"string\") && typeof key2.key !== \"undefined\")\n key2 = type === \"public\" \? _createPublicKey(key2).export() : _createPrivateKey(key2).export();\n } else if (typeof key2 === \"string\" && type === \"public\")\n key2.indexOf(\"PRIVATE KEY-----\") !== -1 && (key2 = _createPublicKey(key2).export());\n return key2;\n}, getArrayBufferOrView = function(buffer, name, encoding) {\n if (buffer instanceof KeyObject) {\n if (buffer.type !== \"secret\") {\n const error2 = @makeTypeError(`ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE: Invalid key object type ${key.type}, expected secret`);\n throw error2.code = \"ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE\", error2;\n }\n buffer = buffer.export();\n }\n if (isAnyArrayBuffer(buffer))\n return buffer;\n if (typeof buffer === \"string\") {\n if (encoding === \"buffer\")\n encoding = \"utf8\";\n return Buffer.from(buffer, encoding);\n }\n if (!isArrayBufferView(buffer)) {\n var error = @makeTypeError(`ERR_INVALID_ARG_TYPE: The \"${name}\" argument must be of type string or an instance of ArrayBuffer, Buffer, TypedArray, or DataView. Received ` + buffer);\n throw error.code = \"ERR_INVALID_ARG_TYPE\", error;\n }\n return buffer;\n}, getCurves = function() {\n return harcoded_curves;\n}, _generateKeyPairSync = function(algorithm, options) {\n const result = generateKeyPairSync(algorithm, options);\n if (result) {\n const publicKeyEncoding = options\?.publicKeyEncoding, privateKeyEncoding = options\?.privateKeyEncoding;\n result.publicKey = publicKeyEncoding \? KeyObject.from(result.publicKey).export(publicKeyEncoding) : KeyObject.from(result.publicKey), result.privateKey = privateKeyEncoding \? KeyObject.from(result.privateKey).export(privateKeyEncoding) : KeyObject.from(result.privateKey);\n }\n return result;\n}, _createPrivateKey = function(key2) {\n if (typeof key2 === \"string\")\n return key2 = Buffer.from(key2, \"utf8\"), KeyObject.from(createPrivateKey({ key: key2, format: \"pem\" }));\n else if (isAnyArrayBuffer(key2) || isArrayBufferView(key2))\n return KeyObject.from(createPrivateKey({ key: key2, format: \"pem\" }));\n else if (typeof key2 === \"object\")\n if (key2 instanceof KeyObject || key2 instanceof CryptoKey) {\n const error2 = @makeTypeError(`ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE: Invalid key object type ${key2.type}`);\n throw error2.code = \"ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE\", error2;\n } else {\n let actual_key = key2.key;\n if (typeof actual_key === \"string\")\n actual_key = Buffer.from(actual_key, key2.encoding || \"utf8\"), key2.key = actual_key;\n else if (actual_key instanceof KeyObject || actual_key instanceof CryptoKey) {\n const error2 = @makeTypeError(`ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE: Invalid key object type ${key2.type}`);\n throw error2.code = \"ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE\", error2;\n }\n if (!isAnyArrayBuffer(actual_key) && !isArrayBufferView(actual_key) && typeof actual_key !== \"object\") {\n var error = @makeTypeError('ERR_INVALID_ARG_TYPE: The \"key\" argument must be of type string or an instance of ArrayBuffer, Buffer, TypedArray, DataView or object. Received ' + actual_key);\n throw error.code = \"ERR_INVALID_ARG_TYPE\", error;\n }\n if (!key2.format)\n key2.format = \"pem\";\n return KeyObject.from(createPrivateKey(key2));\n }\n else {\n var error = @makeTypeError('ERR_INVALID_ARG_TYPE: The \"key\" argument must be of type string or an instance of ArrayBuffer, Buffer, TypedArray, DataView or object. Received ' + key2);\n throw error.code = \"ERR_INVALID_ARG_TYPE\", error;\n }\n}, _createPublicKey = function(key2) {\n if (typeof key2 === \"string\")\n return key2 = Buffer.from(key2, \"utf8\"), KeyObject.from(createPublicKey({ key: key2, format: \"pem\" }));\n else if (isAnyArrayBuffer(key2) || isArrayBufferView(key2))\n return KeyObject.from(createPublicKey({ key: key2, format: \"pem\" }));\n else if (typeof key2 === \"object\")\n if (key2 instanceof KeyObject || key2 instanceof CryptoKey) {\n if (key2.type === \"private\")\n return KeyObject.from(createPublicKey({ key: key2[kCryptoKey] || key2, format: \"\" }));\n const error2 = @makeTypeError(`ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE: Invalid key object type ${key2.type}, expected private`);\n throw error2.code = \"ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE\", error2;\n } else {\n if (key2.passphrase) {\n let actual_key2 = key2.key;\n if (typeof actual_key2 === \"string\")\n actual_key2 = Buffer.from(actual_key2, key2.encoding || \"utf8\");\n return KeyObject.from(createPublicKey({\n key: createPrivateKey({ key: actual_key2, format: key2.format, passphrase: key2.passphrase }),\n format: \"\"\n }));\n }\n let actual_key = key2.key;\n if (typeof actual_key === \"string\")\n actual_key = Buffer.from(actual_key, key2.encoding || \"utf8\"), key2.key = actual_key;\n else if (actual_key instanceof KeyObject || actual_key instanceof CryptoKey) {\n if (actual_key.type === \"private\")\n return KeyObject.from(createPublicKey({ key: actual_key[kCryptoKey] || actual_key, format: \"\" }));\n const error2 = @makeTypeError(`ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE: Invalid key object type ${actual_key.type}, expected private`);\n throw error2.code = \"ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE\", error2;\n }\n if (!isAnyArrayBuffer(actual_key) && !isArrayBufferView(actual_key) && typeof actual_key !== \"object\") {\n var error = @makeTypeError('ERR_INVALID_ARG_TYPE: The \"key\" argument must be of type string or an instance of ArrayBuffer, Buffer, TypedArray, DataView or object. Received ' + key2);\n throw error.code = \"ERR_INVALID_ARG_TYPE\", error;\n }\n if (!key2.format)\n key2.format = \"pem\";\n return KeyObject.from(createPublicKey(key2));\n }\n else {\n var error = @makeTypeError('ERR_INVALID_ARG_TYPE: The \"key\" argument must be of type string or an instance of ArrayBuffer, Buffer, TypedArray, DataView or object. Received ' + key2);\n throw error.code = \"ERR_INVALID_ARG_TYPE\", error;\n }\n}, $, __defProp = Object.defineProperty, __getOwnPropNames = Object.getOwnPropertyNames, StreamModule = @getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39), BufferModule = @requireNativeModule(\"buffer\"), StringDecoder = @requireNativeModule(\"string_decoder\").StringDecoder, MAX_STRING_LENGTH = 536870888, Buffer = globalThis.Buffer, EMPTY_BUFFER = Buffer.alloc(0), { isAnyArrayBuffer, isArrayBufferView } = @requireNativeModule(\"util/types\"), crypto = globalThis.crypto, globalCrypto = crypto, __commonJS = (cb, mod) => function() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n}, __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: !0 });\n}, require_safe_buffer = __commonJS({\n \"node_modules/safe-buffer/index.js\"(exports, module) {\n var buffer = BufferModule, Buffer2 = buffer.Buffer;\n function copyProps(src, dst) {\n for (var key2 in src)\n dst[key2] = src[key2];\n }\n Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow \? module.exports = buffer : (copyProps(buffer, exports), exports.Buffer = SafeBuffer);\n function SafeBuffer(arg, encodingOrOffset, length) {\n return Buffer2(arg, encodingOrOffset, length);\n }\n SafeBuffer.prototype = Object.create(Buffer2.prototype), copyProps(Buffer2, SafeBuffer), SafeBuffer.from = function(arg, encodingOrOffset, length) {\n if (typeof arg == \"number\")\n @throwTypeError(\"Argument must not be a number\");\n return Buffer2(arg, encodingOrOffset, length);\n }, SafeBuffer.alloc = function(size, fill, encoding) {\n if (typeof size != \"number\")\n @throwTypeError(\"Argument must be a number\");\n var buf = Buffer2(size);\n return fill !== void 0 \? typeof encoding == \"string\" \? buf.fill(fill, encoding) : buf.fill(fill) : buf.fill(0), buf;\n }, SafeBuffer.allocUnsafe = function(size) {\n if (typeof size != \"number\")\n @throwTypeError(\"Argument must be a number\");\n return Buffer2(size);\n }, SafeBuffer.allocUnsafeSlow = function(size) {\n if (typeof size != \"number\")\n @throwTypeError(\"Argument must be a number\");\n return buffer.SlowBuffer(size);\n };\n }\n}), require_browser = __commonJS({\n \"node_modules/randombytes/browser.js\"(exports, module) {\n var MAX_BYTES = 65536, MAX_UINT32 = 4294967295;\n function oldBrowser() {\n throw new Error(`Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11`);\n }\n var Buffer2 = require_safe_buffer().Buffer, crypto2 = globalCrypto;\n crypto2 && crypto2.getRandomValues \? module.exports = randomBytes : module.exports = oldBrowser;\n function randomBytes(size, cb) {\n if (size > MAX_UINT32)\n @throwRangeError(\"requested too many random bytes\");\n var bytes = Buffer2.allocUnsafe(size);\n if (size > 0)\n if (size > MAX_BYTES)\n for (var generated = 0;generated < size; generated += MAX_BYTES)\n crypto2.getRandomValues(bytes.slice(generated, generated + MAX_BYTES));\n else\n crypto2.getRandomValues(bytes);\n return typeof cb == \"function\" \? process.nextTick(function() {\n cb(null, bytes);\n }) : bytes;\n }\n }\n}), require_inherits_browser = __commonJS({\n \"node_modules/inherits/inherits_browser.js\"(exports, module) {\n module.exports = function(ctor, superCtor) {\n superCtor && (ctor.super_ = superCtor, ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: !1,\n writable: !0,\n configurable: !0\n }\n }));\n };\n }\n}), require_hash_base = __commonJS({\n \"node_modules/hash-base/index.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer, inherits = require_inherits_browser();\n function throwIfNotStringOrBuffer(val, prefix) {\n if (!Buffer2.isBuffer(val) && typeof val != \"string\")\n @throwTypeError(prefix + \" must be a string or a buffer\");\n }\n function HashBase(blockSize) {\n StreamModule.Transform.@call(this), this._block = Buffer2.allocUnsafe(blockSize), this._blockSize = blockSize, this._blockOffset = 0, this._length = [0, 0, 0, 0], this._finalized = !1;\n }\n inherits(HashBase, StreamModule.Transform), HashBase.prototype._transform = function(chunk, encoding, callback) {\n var error = null;\n try {\n this.update(chunk, encoding);\n } catch (err) {\n error = err;\n }\n callback(error);\n }, HashBase.prototype._flush = function(callback) {\n var error = null;\n try {\n this.push(this.digest());\n } catch (err) {\n error = err;\n }\n callback(error);\n }, HashBase.prototype.update = function(data, encoding) {\n if (throwIfNotStringOrBuffer(data, \"Data\"), this._finalized)\n throw new Error(\"Digest already called\");\n Buffer2.isBuffer(data) || (data = Buffer2.from(data, encoding));\n for (var block = this._block, offset = 0;this._blockOffset + data.length - offset >= this._blockSize; ) {\n for (var i = this._blockOffset;i < this._blockSize; )\n block[i++] = data[offset++];\n this._update(), this._blockOffset = 0;\n }\n for (;offset < data.length; )\n block[this._blockOffset++] = data[offset++];\n for (var j = 0, carry = data.length * 8;carry > 0; ++j)\n this._length[j] += carry, carry = this._length[j] / 4294967296 | 0, carry > 0 && (this._length[j] -= 4294967296 * carry);\n return this;\n }, HashBase.prototype._update = function() {\n throw new Error(\"_update is not implemented\");\n }, HashBase.prototype.digest = function(encoding) {\n if (this._finalized)\n throw new Error(\"Digest already called\");\n this._finalized = !0;\n var digest = this._digest();\n encoding !== void 0 && (digest = digest.toString(encoding)), this._block.fill(0), this._blockOffset = 0;\n for (var i = 0;i < 4; ++i)\n this._length[i] = 0;\n return digest;\n }, HashBase.prototype._digest = function() {\n throw new Error(\"_digest is not implemented\");\n }, module.exports = HashBase;\n }\n}), require_md5 = __commonJS({\n \"node_modules/md5.js/index.js\"(exports, module) {\n var inherits = require_inherits_browser(), HashBase = require_hash_base(), Buffer2 = require_safe_buffer().Buffer, ARRAY16 = new @Array(16);\n function MD5() {\n HashBase.@call(this, 64), this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878;\n }\n inherits(MD5, HashBase), MD5.prototype._update = function() {\n for (var M = ARRAY16, i = 0;i < 16; ++i)\n M[i] = this._block.readInt32LE(i * 4);\n var a = this._a, b = this._b, c = this._c, d = this._d;\n a = fnF(a, b, c, d, M[0], 3614090360, 7), d = fnF(d, a, b, c, M[1], 3905402710, 12), c = fnF(c, d, a, b, M[2], 606105819, 17), b = fnF(b, c, d, a, M[3], 3250441966, 22), a = fnF(a, b, c, d, M[4], 4118548399, 7), d = fnF(d, a, b, c, M[5], 1200080426, 12), c = fnF(c, d, a, b, M[6], 2821735955, 17), b = fnF(b, c, d, a, M[7], 4249261313, 22), a = fnF(a, b, c, d, M[8], 1770035416, 7), d = fnF(d, a, b, c, M[9], 2336552879, 12), c = fnF(c, d, a, b, M[10], 4294925233, 17), b = fnF(b, c, d, a, M[11], 2304563134, 22), a = fnF(a, b, c, d, M[12], 1804603682, 7), d = fnF(d, a, b, c, M[13], 4254626195, 12), c = fnF(c, d, a, b, M[14], 2792965006, 17), b = fnF(b, c, d, a, M[15], 1236535329, 22), a = fnG(a, b, c, d, M[1], 4129170786, 5), d = fnG(d, a, b, c, M[6], 3225465664, 9), c = fnG(c, d, a, b, M[11], 643717713, 14), b = fnG(b, c, d, a, M[0], 3921069994, 20), a = fnG(a, b, c, d, M[5], 3593408605, 5), d = fnG(d, a, b, c, M[10], 38016083, 9), c = fnG(c, d, a, b, M[15], 3634488961, 14), b = fnG(b, c, d, a, M[4], 3889429448, 20), a = fnG(a, b, c, d, M[9], 568446438, 5), d = fnG(d, a, b, c, M[14], 3275163606, 9), c = fnG(c, d, a, b, M[3], 4107603335, 14), b = fnG(b, c, d, a, M[8], 1163531501, 20), a = fnG(a, b, c, d, M[13], 2850285829, 5), d = fnG(d, a, b, c, M[2], 4243563512, 9), c = fnG(c, d, a, b, M[7], 1735328473, 14), b = fnG(b, c, d, a, M[12], 2368359562, 20), a = fnH(a, b, c, d, M[5], 4294588738, 4), d = fnH(d, a, b, c, M[8], 2272392833, 11), c = fnH(c, d, a, b, M[11], 1839030562, 16), b = fnH(b, c, d, a, M[14], 4259657740, 23), a = fnH(a, b, c, d, M[1], 2763975236, 4), d = fnH(d, a, b, c, M[4], 1272893353, 11), c = fnH(c, d, a, b, M[7], 4139469664, 16), b = fnH(b, c, d, a, M[10], 3200236656, 23), a = fnH(a, b, c, d, M[13], 681279174, 4), d = fnH(d, a, b, c, M[0], 3936430074, 11), c = fnH(c, d, a, b, M[3], 3572445317, 16), b = fnH(b, c, d, a, M[6], 76029189, 23), a = fnH(a, b, c, d, M[9], 3654602809, 4), d = fnH(d, a, b, c, M[12], 3873151461, 11), c = fnH(c, d, a, b, M[15], 530742520, 16), b = fnH(b, c, d, a, M[2], 3299628645, 23), a = fnI(a, b, c, d, M[0], 4096336452, 6), d = fnI(d, a, b, c, M[7], 1126891415, 10), c = fnI(c, d, a, b, M[14], 2878612391, 15), b = fnI(b, c, d, a, M[5], 4237533241, 21), a = fnI(a, b, c, d, M[12], 1700485571, 6), d = fnI(d, a, b, c, M[3], 2399980690, 10), c = fnI(c, d, a, b, M[10], 4293915773, 15), b = fnI(b, c, d, a, M[1], 2240044497, 21), a = fnI(a, b, c, d, M[8], 1873313359, 6), d = fnI(d, a, b, c, M[15], 4264355552, 10), c = fnI(c, d, a, b, M[6], 2734768916, 15), b = fnI(b, c, d, a, M[13], 1309151649, 21), a = fnI(a, b, c, d, M[4], 4149444226, 6), d = fnI(d, a, b, c, M[11], 3174756917, 10), c = fnI(c, d, a, b, M[2], 718787259, 15), b = fnI(b, c, d, a, M[9], 3951481745, 21), this._a = this._a + a | 0, this._b = this._b + b | 0, this._c = this._c + c | 0, this._d = this._d + d | 0;\n }, MD5.prototype._digest = function() {\n this._block[this._blockOffset++] = 128, this._blockOffset > 56 && (this._block.fill(0, this._blockOffset, 64), this._update(), this._blockOffset = 0), this._block.fill(0, this._blockOffset, 56), this._block.writeUInt32LE(this._length[0], 56), this._block.writeUInt32LE(this._length[1], 60), this._update();\n var buffer = Buffer2.allocUnsafe(16);\n return buffer.writeInt32LE(this._a, 0), buffer.writeInt32LE(this._b, 4), buffer.writeInt32LE(this._c, 8), buffer.writeInt32LE(this._d, 12), buffer;\n };\n function rotl(x, n) {\n return x << n | x >>> 32 - n;\n }\n function fnF(a, b, c, d, m, k, s) {\n return rotl(a + (b & c | ~b & d) + m + k | 0, s) + b | 0;\n }\n function fnG(a, b, c, d, m, k, s) {\n return rotl(a + (b & d | c & ~d) + m + k | 0, s) + b | 0;\n }\n function fnH(a, b, c, d, m, k, s) {\n return rotl(a + (b ^ c ^ d) + m + k | 0, s) + b | 0;\n }\n function fnI(a, b, c, d, m, k, s) {\n return rotl(a + (c ^ (b | ~d)) + m + k | 0, s) + b | 0;\n }\n module.exports = MD5;\n }\n}), require_ripemd160 = __commonJS({\n \"node_modules/ripemd160/index.js\"(exports, module) {\n var Buffer2 = Buffer, inherits = require_inherits_browser(), HashBase = require_hash_base(), ARRAY16 = new @Array(16), zl = [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 7,\n 4,\n 13,\n 1,\n 10,\n 6,\n 15,\n 3,\n 12,\n 0,\n 9,\n 5,\n 2,\n 14,\n 11,\n 8,\n 3,\n 10,\n 14,\n 4,\n 9,\n 15,\n 8,\n 1,\n 2,\n 7,\n 0,\n 6,\n 13,\n 11,\n 5,\n 12,\n 1,\n 9,\n 11,\n 10,\n 0,\n 8,\n 12,\n 4,\n 13,\n 3,\n 7,\n 15,\n 14,\n 5,\n 6,\n 2,\n 4,\n 0,\n 5,\n 9,\n 7,\n 12,\n 2,\n 10,\n 14,\n 1,\n 3,\n 8,\n 11,\n 6,\n 15,\n 13\n ], zr = [\n 5,\n 14,\n 7,\n 0,\n 9,\n 2,\n 11,\n 4,\n 13,\n 6,\n 15,\n 8,\n 1,\n 10,\n 3,\n 12,\n 6,\n 11,\n 3,\n 7,\n 0,\n 13,\n 5,\n 10,\n 14,\n 15,\n 8,\n 12,\n 4,\n 9,\n 1,\n 2,\n 15,\n 5,\n 1,\n 3,\n 7,\n 14,\n 6,\n 9,\n 11,\n 8,\n 12,\n 2,\n 10,\n 0,\n 4,\n 13,\n 8,\n 6,\n 4,\n 1,\n 3,\n 11,\n 15,\n 0,\n 5,\n 12,\n 2,\n 13,\n 9,\n 7,\n 10,\n 14,\n 12,\n 15,\n 10,\n 4,\n 1,\n 5,\n 8,\n 7,\n 6,\n 2,\n 13,\n 14,\n 0,\n 3,\n 9,\n 11\n ], sl = [\n 11,\n 14,\n 15,\n 12,\n 5,\n 8,\n 7,\n 9,\n 11,\n 13,\n 14,\n 15,\n 6,\n 7,\n 9,\n 8,\n 7,\n 6,\n 8,\n 13,\n 11,\n 9,\n 7,\n 15,\n 7,\n 12,\n 15,\n 9,\n 11,\n 7,\n 13,\n 12,\n 11,\n 13,\n 6,\n 7,\n 14,\n 9,\n 13,\n 15,\n 14,\n 8,\n 13,\n 6,\n 5,\n 12,\n 7,\n 5,\n 11,\n 12,\n 14,\n 15,\n 14,\n 15,\n 9,\n 8,\n 9,\n 14,\n 5,\n 6,\n 8,\n 6,\n 5,\n 12,\n 9,\n 15,\n 5,\n 11,\n 6,\n 8,\n 13,\n 12,\n 5,\n 12,\n 13,\n 14,\n 11,\n 8,\n 5,\n 6\n ], sr = [\n 8,\n 9,\n 9,\n 11,\n 13,\n 15,\n 15,\n 5,\n 7,\n 7,\n 8,\n 11,\n 14,\n 14,\n 12,\n 6,\n 9,\n 13,\n 15,\n 7,\n 12,\n 8,\n 9,\n 11,\n 7,\n 7,\n 12,\n 7,\n 6,\n 15,\n 13,\n 11,\n 9,\n 7,\n 15,\n 11,\n 8,\n 6,\n 6,\n 14,\n 12,\n 13,\n 5,\n 14,\n 13,\n 13,\n 7,\n 5,\n 15,\n 5,\n 8,\n 11,\n 14,\n 14,\n 6,\n 14,\n 6,\n 9,\n 12,\n 9,\n 12,\n 5,\n 15,\n 8,\n 8,\n 5,\n 12,\n 9,\n 12,\n 5,\n 14,\n 6,\n 8,\n 13,\n 6,\n 5,\n 15,\n 13,\n 11,\n 11\n ], hl = [0, 1518500249, 1859775393, 2400959708, 2840853838], hr = [1352829926, 1548603684, 1836072691, 2053994217, 0];\n function RIPEMD160() {\n HashBase.@call(this, 64), this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520;\n }\n inherits(RIPEMD160, HashBase), RIPEMD160.prototype._update = function() {\n for (var words = ARRAY16, j = 0;j < 16; ++j)\n words[j] = this._block.readInt32LE(j * 4);\n for (var al = this._a | 0, bl = this._b | 0, cl = this._c | 0, dl = this._d | 0, el = this._e | 0, ar = this._a | 0, br = this._b | 0, cr = this._c | 0, dr = this._d | 0, er = this._e | 0, i = 0;i < 80; i += 1) {\n var tl, tr;\n i < 16 \? (tl = fn1(al, bl, cl, dl, el, words[zl[i]], hl[0], sl[i]), tr = fn5(ar, br, cr, dr, er, words[zr[i]], hr[0], sr[i])) : i < 32 \? (tl = fn2(al, bl, cl, dl, el, words[zl[i]], hl[1], sl[i]), tr = fn4(ar, br, cr, dr, er, words[zr[i]], hr[1], sr[i])) : i < 48 \? (tl = fn3(al, bl, cl, dl, el, words[zl[i]], hl[2], sl[i]), tr = fn3(ar, br, cr, dr, er, words[zr[i]], hr[2], sr[i])) : i < 64 \? (tl = fn4(al, bl, cl, dl, el, words[zl[i]], hl[3], sl[i]), tr = fn2(ar, br, cr, dr, er, words[zr[i]], hr[3], sr[i])) : (tl = fn5(al, bl, cl, dl, el, words[zl[i]], hl[4], sl[i]), tr = fn1(ar, br, cr, dr, er, words[zr[i]], hr[4], sr[i])), al = el, el = dl, dl = rotl(cl, 10), cl = bl, bl = tl, ar = er, er = dr, dr = rotl(cr, 10), cr = br, br = tr;\n }\n var t = this._b + cl + dr | 0;\n this._b = this._c + dl + er | 0, this._c = this._d + el + ar | 0, this._d = this._e + al + br | 0, this._e = this._a + bl + cr | 0, this._a = t;\n }, RIPEMD160.prototype._digest = function() {\n this._block[this._blockOffset++] = 128, this._blockOffset > 56 && (this._block.fill(0, this._blockOffset, 64), this._update(), this._blockOffset = 0), this._block.fill(0, this._blockOffset, 56), this._block.writeUInt32LE(this._length[0], 56), this._block.writeUInt32LE(this._length[1], 60), this._update();\n var buffer = Buffer2.alloc \? Buffer2.alloc(20) : new Buffer2(20);\n return buffer.writeInt32LE(this._a, 0), buffer.writeInt32LE(this._b, 4), buffer.writeInt32LE(this._c, 8), buffer.writeInt32LE(this._d, 12), buffer.writeInt32LE(this._e, 16), buffer;\n };\n function rotl(x, n) {\n return x << n | x >>> 32 - n;\n }\n function fn1(a, b, c, d, e, m, k, s) {\n return rotl(a + (b ^ c ^ d) + m + k | 0, s) + e | 0;\n }\n function fn2(a, b, c, d, e, m, k, s) {\n return rotl(a + (b & c | ~b & d) + m + k | 0, s) + e | 0;\n }\n function fn3(a, b, c, d, e, m, k, s) {\n return rotl(a + ((b | ~c) ^ d) + m + k | 0, s) + e | 0;\n }\n function fn4(a, b, c, d, e, m, k, s) {\n return rotl(a + (b & d | c & ~d) + m + k | 0, s) + e | 0;\n }\n function fn5(a, b, c, d, e, m, k, s) {\n return rotl(a + (b ^ (c | ~d)) + m + k | 0, s) + e | 0;\n }\n module.exports = RIPEMD160;\n }\n}), require_hash = __commonJS({\n \"node_modules/sha.js/hash.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer;\n function Hash(blockSize, finalSize) {\n this._block = Buffer2.alloc(blockSize), this._finalSize = finalSize, this._blockSize = blockSize, this._len = 0;\n }\n Hash.prototype = {}, Hash.prototype.update = function(data, enc) {\n typeof data == \"string\" && (enc = enc || \"utf8\", data = Buffer2.from(data, enc));\n for (var block = this._block, blockSize = this._blockSize, length = data.length, accum = this._len, offset = 0;offset < length; ) {\n for (var assigned = accum % blockSize, remainder = Math.min(length - offset, blockSize - assigned), i = 0;i < remainder; i++)\n block[assigned + i] = data[offset + i];\n accum += remainder, offset += remainder, accum % blockSize === 0 && this._update(block);\n }\n return this._len += length, this;\n }, Hash.prototype.digest = function(enc) {\n var rem = this._len % this._blockSize;\n this._block[rem] = 128, this._block.fill(0, rem + 1), rem >= this._finalSize && (this._update(this._block), this._block.fill(0));\n var bits = this._len * 8;\n if (bits <= 4294967295)\n this._block.writeUInt32BE(bits, this._blockSize - 4);\n else {\n var lowBits = (bits & 4294967295) >>> 0, highBits = (bits - lowBits) / 4294967296;\n this._block.writeUInt32BE(highBits, this._blockSize - 8), this._block.writeUInt32BE(lowBits, this._blockSize - 4);\n }\n this._update(this._block);\n var hash = this._hash();\n return enc \? hash.toString(enc) : hash;\n }, Hash.prototype._update = function() {\n throw new Error(\"_update must be implemented by subclass\");\n }, module.exports = Hash;\n }\n}), require_sha = __commonJS({\n \"node_modules/sha.js/sha.js\"(exports, module) {\n var inherits = require_inherits_browser(), Hash = require_hash(), Buffer2 = require_safe_buffer().Buffer, K = [1518500249, 1859775393, -1894007588, -899497514], W = new @Array(80);\n function Sha() {\n this.init(), this._w = W, Hash.@call(this, 64, 56);\n }\n inherits(Sha, Hash), Sha.prototype.init = function() {\n return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520, this;\n };\n function rotl5(num) {\n return num << 5 | num >>> 27;\n }\n function rotl30(num) {\n return num << 30 | num >>> 2;\n }\n function ft(s, b, c, d) {\n return s === 0 \? b & c | ~b & d : s === 2 \? b & c | b & d | c & d : b ^ c ^ d;\n }\n Sha.prototype._update = function(M) {\n for (var W2 = this._w, a = this._a | 0, b = this._b | 0, c = this._c | 0, d = this._d | 0, e = this._e | 0, i = 0;i < 16; ++i)\n W2[i] = M.readInt32BE(i * 4);\n for (;i < 80; ++i)\n W2[i] = W2[i - 3] ^ W2[i - 8] ^ W2[i - 14] ^ W2[i - 16];\n for (var j = 0;j < 80; ++j) {\n var s = ~~(j / 20), t = rotl5(a) + ft(s, b, c, d) + e + W2[j] + K[s] | 0;\n e = d, d = c, c = rotl30(b), b = a, a = t;\n }\n this._a = a + this._a | 0, this._b = b + this._b | 0, this._c = c + this._c | 0, this._d = d + this._d | 0, this._e = e + this._e | 0;\n }, Sha.prototype._hash = function() {\n var H = Buffer2.allocUnsafe(20);\n return H.writeInt32BE(this._a | 0, 0), H.writeInt32BE(this._b | 0, 4), H.writeInt32BE(this._c | 0, 8), H.writeInt32BE(this._d | 0, 12), H.writeInt32BE(this._e | 0, 16), H;\n }, module.exports = Sha;\n }\n}), require_sha1 = __commonJS({\n \"node_modules/sha.js/sha1.js\"(exports, module) {\n var inherits = require_inherits_browser(), Hash = require_hash(), Buffer2 = require_safe_buffer().Buffer, K = [1518500249, 1859775393, -1894007588, -899497514], W = new @Array(80);\n function Sha1() {\n this.init(), this._w = W, Hash.@call(this, 64, 56);\n }\n inherits(Sha1, Hash), Sha1.prototype.init = function() {\n return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520, this;\n };\n function rotl1(num) {\n return num << 1 | num >>> 31;\n }\n function rotl5(num) {\n return num << 5 | num >>> 27;\n }\n function rotl30(num) {\n return num << 30 | num >>> 2;\n }\n function ft(s, b, c, d) {\n return s === 0 \? b & c | ~b & d : s === 2 \? b & c | b & d | c & d : b ^ c ^ d;\n }\n Sha1.prototype._update = function(M) {\n for (var W2 = this._w, a = this._a | 0, b = this._b | 0, c = this._c | 0, d = this._d | 0, e = this._e | 0, i = 0;i < 16; ++i)\n W2[i] = M.readInt32BE(i * 4);\n for (;i < 80; ++i)\n W2[i] = rotl1(W2[i - 3] ^ W2[i - 8] ^ W2[i - 14] ^ W2[i - 16]);\n for (var j = 0;j < 80; ++j) {\n var s = ~~(j / 20), t = rotl5(a) + ft(s, b, c, d) + e + W2[j] + K[s] | 0;\n e = d, d = c, c = rotl30(b), b = a, a = t;\n }\n this._a = a + this._a | 0, this._b = b + this._b | 0, this._c = c + this._c | 0, this._d = d + this._d | 0, this._e = e + this._e | 0;\n }, Sha1.prototype._hash = function() {\n var H = Buffer2.allocUnsafe(20);\n return H.writeInt32BE(this._a | 0, 0), H.writeInt32BE(this._b | 0, 4), H.writeInt32BE(this._c | 0, 8), H.writeInt32BE(this._d | 0, 12), H.writeInt32BE(this._e | 0, 16), H;\n }, module.exports = Sha1;\n }\n}), require_sha256 = __commonJS({\n \"node_modules/sha.js/sha256.js\"(exports, module) {\n var inherits = require_inherits_browser(), Hash = require_hash(), Buffer2 = require_safe_buffer().Buffer, K = [\n 1116352408,\n 1899447441,\n 3049323471,\n 3921009573,\n 961987163,\n 1508970993,\n 2453635748,\n 2870763221,\n 3624381080,\n 310598401,\n 607225278,\n 1426881987,\n 1925078388,\n 2162078206,\n 2614888103,\n 3248222580,\n 3835390401,\n 4022224774,\n 264347078,\n 604807628,\n 770255983,\n 1249150122,\n 1555081692,\n 1996064986,\n 2554220882,\n 2821834349,\n 2952996808,\n 3210313671,\n 3336571891,\n 3584528711,\n 113926993,\n 338241895,\n 666307205,\n 773529912,\n 1294757372,\n 1396182291,\n 1695183700,\n 1986661051,\n 2177026350,\n 2456956037,\n 2730485921,\n 2820302411,\n 3259730800,\n 3345764771,\n 3516065817,\n 3600352804,\n 4094571909,\n 275423344,\n 430227734,\n 506948616,\n 659060556,\n 883997877,\n 958139571,\n 1322822218,\n 1537002063,\n 1747873779,\n 1955562222,\n 2024104815,\n 2227730452,\n 2361852424,\n 2428436474,\n 2756734187,\n 3204031479,\n 3329325298\n ], W = new @Array(64);\n function Sha256() {\n this.init(), this._w = W, Hash.@call(this, 64, 56);\n }\n inherits(Sha256, Hash), Sha256.prototype.init = function() {\n return this._a = 1779033703, this._b = 3144134277, this._c = 1013904242, this._d = 2773480762, this._e = 1359893119, this._f = 2600822924, this._g = 528734635, this._h = 1541459225, this;\n };\n function ch(x, y, z) {\n return z ^ x & (y ^ z);\n }\n function maj(x, y, z) {\n return x & y | z & (x | y);\n }\n function sigma0(x) {\n return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10);\n }\n function sigma1(x) {\n return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7);\n }\n function gamma0(x) {\n return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ x >>> 3;\n }\n function gamma1(x) {\n return (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ x >>> 10;\n }\n Sha256.prototype._update = function(M) {\n for (var W2 = this._w, a = this._a | 0, b = this._b | 0, c = this._c | 0, d = this._d | 0, e = this._e | 0, f = this._f | 0, g = this._g | 0, h = this._h | 0, i = 0;i < 16; ++i)\n W2[i] = M.readInt32BE(i * 4);\n for (;i < 64; ++i)\n W2[i] = gamma1(W2[i - 2]) + W2[i - 7] + gamma0(W2[i - 15]) + W2[i - 16] | 0;\n for (var j = 0;j < 64; ++j) {\n var T1 = h + sigma1(e) + ch(e, f, g) + K[j] + W2[j] | 0, T2 = sigma0(a) + maj(a, b, c) | 0;\n h = g, g = f, f = e, e = d + T1 | 0, d = c, c = b, b = a, a = T1 + T2 | 0;\n }\n this._a = a + this._a | 0, this._b = b + this._b | 0, this._c = c + this._c | 0, this._d = d + this._d | 0, this._e = e + this._e | 0, this._f = f + this._f | 0, this._g = g + this._g | 0, this._h = h + this._h | 0;\n }, Sha256.prototype._hash = function() {\n var H = Buffer2.allocUnsafe(32);\n return H.writeInt32BE(this._a, 0), H.writeInt32BE(this._b, 4), H.writeInt32BE(this._c, 8), H.writeInt32BE(this._d, 12), H.writeInt32BE(this._e, 16), H.writeInt32BE(this._f, 20), H.writeInt32BE(this._g, 24), H.writeInt32BE(this._h, 28), H;\n }, module.exports = Sha256;\n }\n}), require_sha224 = __commonJS({\n \"node_modules/sha.js/sha224.js\"(exports, module) {\n var inherits = require_inherits_browser(), Sha256 = require_sha256(), Hash = require_hash(), Buffer2 = require_safe_buffer().Buffer, W = new @Array(64);\n function Sha224() {\n this.init(), this._w = W, Hash.@call(this, 64, 56);\n }\n inherits(Sha224, Sha256), Sha224.prototype.init = function() {\n return this._a = 3238371032, this._b = 914150663, this._c = 812702999, this._d = 4144912697, this._e = 4290775857, this._f = 1750603025, this._g = 1694076839, this._h = 3204075428, this;\n }, Sha224.prototype._hash = function() {\n var H = Buffer2.allocUnsafe(28);\n return H.writeInt32BE(this._a, 0), H.writeInt32BE(this._b, 4), H.writeInt32BE(this._c, 8), H.writeInt32BE(this._d, 12), H.writeInt32BE(this._e, 16), H.writeInt32BE(this._f, 20), H.writeInt32BE(this._g, 24), H;\n }, module.exports = Sha224;\n }\n}), require_sha512 = __commonJS({\n \"node_modules/sha.js/sha512.js\"(exports, module) {\n var inherits = require_inherits_browser(), Hash = require_hash(), Buffer2 = require_safe_buffer().Buffer, K = [\n 1116352408,\n 3609767458,\n 1899447441,\n 602891725,\n 3049323471,\n 3964484399,\n 3921009573,\n 2173295548,\n 961987163,\n 4081628472,\n 1508970993,\n 3053834265,\n 2453635748,\n 2937671579,\n 2870763221,\n 3664609560,\n 3624381080,\n 2734883394,\n 310598401,\n 1164996542,\n 607225278,\n 1323610764,\n 1426881987,\n 3590304994,\n 1925078388,\n 4068182383,\n 2162078206,\n 991336113,\n 2614888103,\n 633803317,\n 3248222580,\n 3479774868,\n 3835390401,\n 2666613458,\n 4022224774,\n 944711139,\n 264347078,\n 2341262773,\n 604807628,\n 2007800933,\n 770255983,\n 1495990901,\n 1249150122,\n 1856431235,\n 1555081692,\n 3175218132,\n 1996064986,\n 2198950837,\n 2554220882,\n 3999719339,\n 2821834349,\n 766784016,\n 2952996808,\n 2566594879,\n 3210313671,\n 3203337956,\n 3336571891,\n 1034457026,\n 3584528711,\n 2466948901,\n 113926993,\n 3758326383,\n 338241895,\n 168717936,\n 666307205,\n 1188179964,\n 773529912,\n 1546045734,\n 1294757372,\n 1522805485,\n 1396182291,\n 2643833823,\n 1695183700,\n 2343527390,\n 1986661051,\n 1014477480,\n 2177026350,\n 1206759142,\n 2456956037,\n 344077627,\n 2730485921,\n 1290863460,\n 2820302411,\n 3158454273,\n 3259730800,\n 3505952657,\n 3345764771,\n 106217008,\n 3516065817,\n 3606008344,\n 3600352804,\n 1432725776,\n 4094571909,\n 1467031594,\n 275423344,\n 851169720,\n 430227734,\n 3100823752,\n 506948616,\n 1363258195,\n 659060556,\n 3750685593,\n 883997877,\n 3785050280,\n 958139571,\n 3318307427,\n 1322822218,\n 3812723403,\n 1537002063,\n 2003034995,\n 1747873779,\n 3602036899,\n 1955562222,\n 1575990012,\n 2024104815,\n 1125592928,\n 2227730452,\n 2716904306,\n 2361852424,\n 442776044,\n 2428436474,\n 593698344,\n 2756734187,\n 3733110249,\n 3204031479,\n 2999351573,\n 3329325298,\n 3815920427,\n 3391569614,\n 3928383900,\n 3515267271,\n 566280711,\n 3940187606,\n 3454069534,\n 4118630271,\n 4000239992,\n 116418474,\n 1914138554,\n 174292421,\n 2731055270,\n 289380356,\n 3203993006,\n 460393269,\n 320620315,\n 685471733,\n 587496836,\n 852142971,\n 1086792851,\n 1017036298,\n 365543100,\n 1126000580,\n 2618297676,\n 1288033470,\n 3409855158,\n 1501505948,\n 4234509866,\n 1607167915,\n 987167468,\n 1816402316,\n 1246189591\n ], W = new @Array(160);\n function Sha512() {\n this.init(), this._w = W, Hash.@call(this, 128, 112);\n }\n inherits(Sha512, Hash), Sha512.prototype.init = function() {\n return this._ah = 1779033703, this._bh = 3144134277, this._ch = 1013904242, this._dh = 2773480762, this._eh = 1359893119, this._fh = 2600822924, this._gh = 528734635, this._hh = 1541459225, this._al = 4089235720, this._bl = 2227873595, this._cl = 4271175723, this._dl = 1595750129, this._el = 2917565137, this._fl = 725511199, this._gl = 4215389547, this._hl = 327033209, this;\n };\n function Ch(x, y, z) {\n return z ^ x & (y ^ z);\n }\n function maj(x, y, z) {\n return x & y | z & (x | y);\n }\n function sigma0(x, xl) {\n return (x >>> 28 | xl << 4) ^ (xl >>> 2 | x << 30) ^ (xl >>> 7 | x << 25);\n }\n function sigma1(x, xl) {\n return (x >>> 14 | xl << 18) ^ (x >>> 18 | xl << 14) ^ (xl >>> 9 | x << 23);\n }\n function Gamma0(x, xl) {\n return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ x >>> 7;\n }\n function Gamma0l(x, xl) {\n return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7 | xl << 25);\n }\n function Gamma1(x, xl) {\n return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ x >>> 6;\n }\n function Gamma1l(x, xl) {\n return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6 | xl << 26);\n }\n function getCarry(a, b) {\n return a >>> 0 < b >>> 0 \? 1 : 0;\n }\n Sha512.prototype._update = function(M) {\n for (var W2 = this._w, ah = this._ah | 0, bh = this._bh | 0, ch = this._ch | 0, dh = this._dh | 0, eh = this._eh | 0, fh = this._fh | 0, gh = this._gh | 0, hh = this._hh | 0, al = this._al | 0, bl = this._bl | 0, cl = this._cl | 0, dl = this._dl | 0, el = this._el | 0, fl = this._fl | 0, gl = this._gl | 0, hl = this._hl | 0, i = 0;i < 32; i += 2)\n W2[i] = M.readInt32BE(i * 4), W2[i + 1] = M.readInt32BE(i * 4 + 4);\n for (;i < 160; i += 2) {\n var xh = W2[i - 30], xl = W2[i - 30 + 1], gamma0 = Gamma0(xh, xl), gamma0l = Gamma0l(xl, xh);\n xh = W2[i - 4], xl = W2[i - 4 + 1];\n var gamma1 = Gamma1(xh, xl), gamma1l = Gamma1l(xl, xh), Wi7h = W2[i - 14], Wi7l = W2[i - 14 + 1], Wi16h = W2[i - 32], Wi16l = W2[i - 32 + 1], Wil = gamma0l + Wi7l | 0, Wih = gamma0 + Wi7h + getCarry(Wil, gamma0l) | 0;\n Wil = Wil + gamma1l | 0, Wih = Wih + gamma1 + getCarry(Wil, gamma1l) | 0, Wil = Wil + Wi16l | 0, Wih = Wih + Wi16h + getCarry(Wil, Wi16l) | 0, W2[i] = Wih, W2[i + 1] = Wil;\n }\n for (var j = 0;j < 160; j += 2) {\n Wih = W2[j], Wil = W2[j + 1];\n var majh = maj(ah, bh, ch), majl = maj(al, bl, cl), sigma0h = sigma0(ah, al), sigma0l = sigma0(al, ah), sigma1h = sigma1(eh, el), sigma1l = sigma1(el, eh), Kih = K[j], Kil = K[j + 1], chh = Ch(eh, fh, gh), chl = Ch(el, fl, gl), t1l = hl + sigma1l | 0, t1h = hh + sigma1h + getCarry(t1l, hl) | 0;\n t1l = t1l + chl | 0, t1h = t1h + chh + getCarry(t1l, chl) | 0, t1l = t1l + Kil | 0, t1h = t1h + Kih + getCarry(t1l, Kil) | 0, t1l = t1l + Wil | 0, t1h = t1h + Wih + getCarry(t1l, Wil) | 0;\n var t2l = sigma0l + majl | 0, t2h = sigma0h + majh + getCarry(t2l, sigma0l) | 0;\n hh = gh, hl = gl, gh = fh, gl = fl, fh = eh, fl = el, el = dl + t1l | 0, eh = dh + t1h + getCarry(el, dl) | 0, dh = ch, dl = cl, ch = bh, cl = bl, bh = ah, bl = al, al = t1l + t2l | 0, ah = t1h + t2h + getCarry(al, t1l) | 0;\n }\n this._al = this._al + al | 0, this._bl = this._bl + bl | 0, this._cl = this._cl + cl | 0, this._dl = this._dl + dl | 0, this._el = this._el + el | 0, this._fl = this._fl + fl | 0, this._gl = this._gl + gl | 0, this._hl = this._hl + hl | 0, this._ah = this._ah + ah + getCarry(this._al, al) | 0, this._bh = this._bh + bh + getCarry(this._bl, bl) | 0, this._ch = this._ch + ch + getCarry(this._cl, cl) | 0, this._dh = this._dh + dh + getCarry(this._dl, dl) | 0, this._eh = this._eh + eh + getCarry(this._el, el) | 0, this._fh = this._fh + fh + getCarry(this._fl, fl) | 0, this._gh = this._gh + gh + getCarry(this._gl, gl) | 0, this._hh = this._hh + hh + getCarry(this._hl, hl) | 0;\n }, Sha512.prototype._hash = function() {\n var H = Buffer2.allocUnsafe(64);\n function writeInt64BE(h, l, offset) {\n H.writeInt32BE(h, offset), H.writeInt32BE(l, offset + 4);\n }\n return writeInt64BE(this._ah, this._al, 0), writeInt64BE(this._bh, this._bl, 8), writeInt64BE(this._ch, this._cl, 16), writeInt64BE(this._dh, this._dl, 24), writeInt64BE(this._eh, this._el, 32), writeInt64BE(this._fh, this._fl, 40), writeInt64BE(this._gh, this._gl, 48), writeInt64BE(this._hh, this._hl, 56), H;\n }, module.exports = Sha512;\n }\n}), require_sha384 = __commonJS({\n \"node_modules/sha.js/sha384.js\"(exports, module) {\n var inherits = require_inherits_browser(), SHA512 = require_sha512(), Hash = require_hash(), Buffer2 = require_safe_buffer().Buffer, W = new @Array(160);\n function Sha384() {\n this.init(), this._w = W, Hash.@call(this, 128, 112);\n }\n inherits(Sha384, SHA512), Sha384.prototype.init = function() {\n return this._ah = 3418070365, this._bh = 1654270250, this._ch = 2438529370, this._dh = 355462360, this._eh = 1731405415, this._fh = 2394180231, this._gh = 3675008525, this._hh = 1203062813, this._al = 3238371032, this._bl = 914150663, this._cl = 812702999, this._dl = 4144912697, this._el = 4290775857, this._fl = 1750603025, this._gl = 1694076839, this._hl = 3204075428, this;\n }, Sha384.prototype._hash = function() {\n var H = Buffer2.allocUnsafe(48);\n function writeInt64BE(h, l, offset) {\n H.writeInt32BE(h, offset), H.writeInt32BE(l, offset + 4);\n }\n return writeInt64BE(this._ah, this._al, 0), writeInt64BE(this._bh, this._bl, 8), writeInt64BE(this._ch, this._cl, 16), writeInt64BE(this._dh, this._dl, 24), writeInt64BE(this._eh, this._el, 32), writeInt64BE(this._fh, this._fl, 40), H;\n }, module.exports = Sha384;\n }\n}), require_sha2 = __commonJS({\n \"node_modules/sha.js/index.js\"(exports, module) {\n var exports = module.exports = function(algorithm) {\n algorithm = algorithm.toLowerCase();\n var Algorithm = exports[algorithm];\n if (!Algorithm)\n throw new Error(algorithm + \" is not supported (we accept pull requests)\");\n return new Algorithm;\n };\n exports.sha = require_sha(), exports.sha1 = require_sha1(), exports.sha224 = require_sha224(), exports.sha256 = require_sha256(), exports.sha384 = require_sha384(), exports.sha512 = require_sha512();\n }\n}), require_cipher_base = __commonJS({\n \"node_modules/cipher-base/index.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer, inherits = require_inherits_browser();\n function CipherBase(hashMode) {\n StreamModule.Transform.@call(this), this.hashMode = typeof hashMode == \"string\", this.hashMode \? this[hashMode] = this._finalOrDigest : this.final = this._finalOrDigest, this._final && (this.__final = this._final, this._final = null), this._decoder = null, this._encoding = null, this._finalized = !1;\n }\n inherits(CipherBase, StreamModule.Transform), CipherBase.prototype.update = function(data, inputEnc, outputEnc) {\n if (outputEnc === \"buffer\")\n outputEnc = @undefined;\n typeof data == \"string\" && (data = Buffer2.from(data, inputEnc));\n var outData = this._update(data);\n return this.hashMode \? this : (outputEnc && (outData = this._toString(outData, outputEnc)), outData);\n }, CipherBase.prototype.setAutoPadding = function() {\n }, CipherBase.prototype.getAuthTag = function() {\n throw new Error(\"trying to get auth tag in unsupported state\");\n }, CipherBase.prototype.setAuthTag = function() {\n throw new Error(\"trying to set auth tag in unsupported state\");\n }, CipherBase.prototype.setAAD = function() {\n throw new Error(\"trying to set aad in unsupported state\");\n }, CipherBase.prototype._transform = function(data, _, next) {\n var err;\n try {\n this.hashMode \? this._update(data) : this.push(this._update(data));\n } catch (e) {\n err = e;\n } finally {\n next(err);\n }\n }, CipherBase.prototype._flush = function(done) {\n var err;\n try {\n this.push(this.__final());\n } catch (e) {\n err = e;\n }\n done(err);\n }, CipherBase.prototype._finalOrDigest = function(outputEnc) {\n if (outputEnc === \"buffer\")\n outputEnc = @undefined;\n if (this._finalized) {\n if (!this._encoding)\n return Buffer2.alloc(0);\n return \"\";\n }\n this._finalized = !0;\n var outData = this.__final() || Buffer2.alloc(0);\n return outputEnc && (outData = this._toString(outData, outputEnc, !0)), outData;\n }, CipherBase.prototype._toString = function(value, enc, fin) {\n if (this._decoder || (this._decoder = new StringDecoder(enc), this._encoding = enc), this._encoding !== enc)\n throw new Error(\"can't switch encodings\");\n var out = this._decoder.write(value);\n return fin && (out += this._decoder.end()), out;\n }, module.exports = CipherBase;\n }\n}), require_browser2 = __commonJS({\n \"node_modules/create-hash/browser.js\"(exports, module) {\n const LazyHash = function Hash(algorithm, options) {\n this._options = options, this._hasher = new CryptoHasher(algorithm, options), this._finalized = !1;\n };\n LazyHash.prototype = Object.create(StreamModule.Transform.prototype), LazyHash.prototype.update = function update(data, encoding) {\n return this._checkFinalized(), this._hasher.update(data, encoding), this;\n }, LazyHash.prototype.digest = function update(data, encoding) {\n return this._checkFinalized(), this._finalized = !0, this._hasher.digest(data, encoding);\n }, LazyHash.prototype._checkFinalized = function _checkFinalized() {\n if (this._finalized) {\n var err = new Error(\"Digest already called\");\n throw err.code = \"ERR_CRYPTO_HASH_FINALIZED\", err;\n }\n }, LazyHash.prototype.copy = function copy() {\n const copy = Object.create(LazyHash.prototype);\n return copy._options = this._options, copy._hasher = this._hasher.copy(), copy._finalized = this._finalized, copy;\n };\n const lazyHashFullInitProto = {\n __proto__: StreamModule.Transform.prototype,\n ...LazyHash.prototype,\n _transform(data, encoding, callback) {\n this.update(data, encoding), callback && callback();\n },\n _flush(callback) {\n this.push(this.digest()), callback();\n }\n }, triggerMethods = [\n \"_events\",\n \"_eventsCount\",\n \"_final\",\n \"_maxListeners\",\n \"_maxListeners\",\n \"_read\",\n \"_undestroy\",\n \"_writableState\",\n \"_write\",\n \"_writev\",\n \"addListener\",\n \"asIndexedPairs\",\n \"closed\",\n \"compose\",\n \"constructor\",\n \"cork\",\n \"destroy\",\n \"destroyed\",\n \"drop\",\n \"emit\",\n \"end\",\n \"errored\",\n \"eventNames\",\n \"every\",\n \"filter\",\n \"find\",\n \"flatMap\",\n \"forEach\",\n \"getMaxListeners\",\n \"hasOwnProperty\",\n \"isPaused\",\n \"isPrototypeOf\",\n \"iterator\",\n \"listenerCount\",\n \"listeners\",\n \"map\",\n \"off\",\n \"on\",\n \"once\",\n \"pause\",\n \"pipe\",\n \"prependListener\",\n \"prependOnceListener\",\n \"propertyIsEnumerable\",\n \"push\",\n \"rawListeners\",\n \"read\",\n \"readable\",\n \"readableAborted\",\n \"readableBuffer\",\n \"readableDidRead\",\n \"readableEncoding\",\n \"readableEnded\",\n \"readableFlowing\",\n \"readableHighWaterMark\",\n \"readableLength\",\n \"readableObjectMode\",\n \"reduce\",\n \"removeAllListeners\",\n \"removeListener\",\n \"resume\",\n \"setDefaultEncoding\",\n \"setEncoding\",\n \"setMaxListeners\",\n \"some\",\n \"take\",\n \"toArray\",\n \"toLocaleString\",\n \"toString\",\n \"uncork\",\n \"unpipe\",\n \"unshift\",\n \"valueOf\",\n \"wrap\",\n \"writable\",\n \"writableBuffer\",\n \"writableCorked\",\n \"writableEnded\",\n \"writableFinished\",\n \"writableHighWaterMark\",\n \"writableLength\",\n \"writableNeedDrain\",\n \"writableObjectMode\",\n \"write\"\n ];\n for (let method of triggerMethods)\n Object.defineProperty(LazyHash.prototype, method, {\n get() {\n return Object.setPrototypeOf(this, lazyHashFullInitProto), StreamModule.Transform.@call(this, this._options), this[method];\n },\n enumerable: !1,\n configurable: !0\n });\n module.exports = function createHash(algorithm) {\n return new LazyHash(algorithm);\n }, module.exports.createHash = module.exports, module.exports.Hash = LazyHash;\n }\n}), require_legacy = __commonJS({\n \"node_modules/create-hmac/legacy.js\"(exports, module) {\n var inherits = require_inherits_browser(), Buffer2 = require_safe_buffer().Buffer, Base = require_cipher_base(), ZEROS = Buffer2.alloc(128), blocksize = 64;\n function Hmac(alg, key2) {\n key2 = exportIfKeyObject(key2), Base.@call(this, \"digest\"), typeof key2 == \"string\" && (key2 = Buffer2.from(key2)), this._alg = alg, this._key = key2, key2.length > blocksize \? key2 = alg(key2) : key2.length < blocksize && (key2 = Buffer2.concat([key2, ZEROS], blocksize));\n for (var ipad = this._ipad = Buffer2.allocUnsafe(blocksize), opad = this._opad = Buffer2.allocUnsafe(blocksize), i = 0;i < blocksize; i++)\n ipad[i] = key2[i] ^ 54, opad[i] = key2[i] ^ 92;\n this._hash = [ipad];\n }\n Hmac.prototype = {}, inherits(Hmac, Base), Hmac.prototype._update = function(data) {\n this._hash.push(data);\n }, Hmac.prototype._final = function() {\n var h = this._alg(Buffer2.concat(this._hash));\n return this._alg(Buffer2.concat([this._opad, h]));\n }, module.exports = Hmac;\n }\n}), require_md52 = __commonJS({\n \"node_modules/create-hash/md5.js\"(exports, module) {\n var MD5 = require_md5();\n module.exports = function(buffer) {\n return new MD5().update(buffer).digest();\n };\n }\n}), require_browser3 = __commonJS({\n \"node_modules/create-hmac/browser.js\"(exports, module) {\n var inherits = require_inherits_browser(), Legacy = require_legacy(), Base = require_cipher_base(), Buffer2 = require_safe_buffer().Buffer, md5 = require_md52(), RIPEMD160 = require_ripemd160(), sha = require_sha2(), ZEROS = Buffer2.alloc(128);\n function Hmac(alg, key2) {\n key2 = exportIfKeyObject(key2), Base.@call(this, \"digest\"), typeof key2 == \"string\" && (key2 = Buffer2.from(key2));\n var blocksize = alg === \"sha512\" || alg === \"sha384\" \? 128 : 64;\n if (this._alg = alg, this._key = key2, key2.length > blocksize) {\n var hash = alg === \"rmd160\" \? new RIPEMD160 : sha(alg);\n key2 = hash.update(key2).digest();\n } else\n key2.length < blocksize && (key2 = Buffer2.concat([key2, ZEROS], blocksize));\n for (var ipad = this._ipad = Buffer2.allocUnsafe(blocksize), opad = this._opad = Buffer2.allocUnsafe(blocksize), i = 0;i < blocksize; i++)\n ipad[i] = key2[i] ^ 54, opad[i] = key2[i] ^ 92;\n this._hash = alg === \"rmd160\" \? new RIPEMD160 : sha(alg), this._hash.update(ipad);\n }\n inherits(Hmac, Base), Hmac.prototype._update = function(data) {\n this._hash.update(data);\n }, Hmac.prototype._final = function() {\n var h = this._hash.digest(), hash = this._alg === \"rmd160\" \? new RIPEMD160 : sha(this._alg);\n return hash.update(this._opad).update(h).digest();\n }, module.exports = function(alg, key2) {\n return key2 = exportIfKeyObject(key2), alg = alg.toLowerCase(), alg === \"rmd160\" || alg === \"ripemd160\" \? new Hmac(\"rmd160\", key2) : alg === \"md5\" \? new Legacy(md5, key2) : new Hmac(alg, key2);\n };\n }\n}), require_algorithms = __commonJS({\n \"node_modules/browserify-sign/browser/algorithms.json\"(exports, module) {\n module.exports = {\n sha224WithRSAEncryption: {\n sign: \"rsa\",\n hash: \"sha224\",\n id: \"302d300d06096086480165030402040500041c\"\n },\n \"RSA-SHA224\": {\n sign: \"ecdsa/rsa\",\n hash: \"sha224\",\n id: \"302d300d06096086480165030402040500041c\"\n },\n sha256WithRSAEncryption: {\n sign: \"rsa\",\n hash: \"sha256\",\n id: \"3031300d060960864801650304020105000420\"\n },\n \"RSA-SHA256\": {\n sign: \"ecdsa/rsa\",\n hash: \"sha256\",\n id: \"3031300d060960864801650304020105000420\"\n },\n sha384WithRSAEncryption: {\n sign: \"rsa\",\n hash: \"sha384\",\n id: \"3041300d060960864801650304020205000430\"\n },\n \"RSA-SHA384\": {\n sign: \"ecdsa/rsa\",\n hash: \"sha384\",\n id: \"3041300d060960864801650304020205000430\"\n },\n sha512WithRSAEncryption: {\n sign: \"rsa\",\n hash: \"sha512\",\n id: \"3051300d060960864801650304020305000440\"\n },\n \"RSA-SHA512\": {\n sign: \"ecdsa/rsa\",\n hash: \"sha512\",\n id: \"3051300d060960864801650304020305000440\"\n },\n \"RSA-SHA1\": {\n sign: \"rsa\",\n hash: \"sha1\",\n id: \"3021300906052b0e03021a05000414\"\n },\n \"ecdsa-with-SHA1\": {\n sign: \"ecdsa\",\n hash: \"sha1\",\n id: \"\"\n },\n sha1: {\n sign: \"ecdsa/rsa\",\n hash: \"sha1\",\n id: \"\"\n },\n sha256: {\n sign: \"ecdsa/rsa\",\n hash: \"sha256\",\n id: \"\"\n },\n sha224: {\n sign: \"ecdsa/rsa\",\n hash: \"sha224\",\n id: \"\"\n },\n sha384: {\n sign: \"ecdsa/rsa\",\n hash: \"sha384\",\n id: \"\"\n },\n sha512: {\n sign: \"ecdsa/rsa\",\n hash: \"sha512\",\n id: \"\"\n },\n \"DSA-SHA\": {\n sign: \"dsa\",\n hash: \"sha1\",\n id: \"\"\n },\n \"DSA-SHA1\": {\n sign: \"dsa\",\n hash: \"sha1\",\n id: \"\"\n },\n DSA: {\n sign: \"dsa\",\n hash: \"sha1\",\n id: \"\"\n },\n \"DSA-WITH-SHA224\": {\n sign: \"dsa\",\n hash: \"sha224\",\n id: \"\"\n },\n \"DSA-SHA224\": {\n sign: \"dsa\",\n hash: \"sha224\",\n id: \"\"\n },\n \"DSA-WITH-SHA256\": {\n sign: \"dsa\",\n hash: \"sha256\",\n id: \"\"\n },\n \"DSA-SHA256\": {\n sign: \"dsa\",\n hash: \"sha256\",\n id: \"\"\n },\n \"DSA-WITH-SHA384\": {\n sign: \"dsa\",\n hash: \"sha384\",\n id: \"\"\n },\n \"DSA-SHA384\": {\n sign: \"dsa\",\n hash: \"sha384\",\n id: \"\"\n },\n \"DSA-WITH-SHA512\": {\n sign: \"dsa\",\n hash: \"sha512\",\n id: \"\"\n },\n \"DSA-SHA512\": {\n sign: \"dsa\",\n hash: \"sha512\",\n id: \"\"\n },\n \"DSA-RIPEMD160\": {\n sign: \"dsa\",\n hash: \"rmd160\",\n id: \"\"\n },\n ripemd160WithRSA: {\n sign: \"rsa\",\n hash: \"rmd160\",\n id: \"3021300906052b2403020105000414\"\n },\n \"RSA-RIPEMD160\": {\n sign: \"rsa\",\n hash: \"rmd160\",\n id: \"3021300906052b2403020105000414\"\n },\n md5WithRSAEncryption: {\n sign: \"rsa\",\n hash: \"md5\",\n id: \"3020300c06082a864886f70d020505000410\"\n },\n \"RSA-MD5\": {\n sign: \"rsa\",\n hash: \"md5\",\n id: \"3020300c06082a864886f70d020505000410\"\n }\n };\n }\n}), require_algos = __commonJS({\n \"node_modules/browserify-sign/algos.js\"(exports, module) {\n module.exports = require_algorithms();\n }\n}), require_precondition = __commonJS({\n \"node_modules/pbkdf2/lib/precondition.js\"(exports, module) {\n var MAX_ALLOC = Math.pow(2, 30) - 1;\n module.exports = function(iterations, keylen) {\n if (typeof iterations != \"number\")\n @throwTypeError(\"Iterations not a number\");\n if (iterations < 0)\n @throwTypeError(\"Bad iterations\");\n if (typeof keylen != \"number\")\n @throwTypeError(\"Key length not a number\");\n if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen)\n @throwTypeError(\"Bad key length\");\n };\n }\n}), require_default_encoding = __commonJS({\n \"node_modules/pbkdf2/lib/default-encoding.js\"(exports, module) {\n var defaultEncoding;\n global.process && global.process.browser \? defaultEncoding = \"utf-8\" : global.process && global.process.version \? (pVersionMajor = parseInt(process.version.split(\".\")[0].slice(1), 10), defaultEncoding = pVersionMajor >= 6 \? \"utf-8\" : \"binary\") : defaultEncoding = \"utf-8\";\n var pVersionMajor;\n module.exports = defaultEncoding;\n }\n}), require_to_buffer = __commonJS({\n \"node_modules/pbkdf2/lib/to-buffer.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer;\n module.exports = function(thing, encoding, name) {\n if (Buffer2.isBuffer(thing))\n return thing;\n if (typeof thing == \"string\")\n return Buffer2.from(thing, encoding);\n if (@ArrayBuffer.isView(thing))\n return Buffer2.from(thing.buffer);\n @throwTypeError(name + \" must be a string, a Buffer, a typed array or a DataView\");\n };\n }\n}), require_sync_browser = __commonJS({\n \"node_modules/pbkdf2/lib/sync-browser.js\"(exports, module) {\n var md5 = require_md52(), RIPEMD160 = require_ripemd160(), sha = require_sha2(), Buffer2 = require_safe_buffer().Buffer, checkParameters = require_precondition(), defaultEncoding = require_default_encoding(), toBuffer = require_to_buffer(), ZEROS = Buffer2.alloc(128), sizes = {\n md5: 16,\n sha1: 20,\n sha224: 28,\n sha256: 32,\n sha384: 48,\n sha512: 64,\n rmd160: 20,\n ripemd160: 20\n };\n function Hmac(alg, key2, saltLen) {\n key2 = exportIfKeyObject(key2);\n var hash = getDigest(alg), blocksize = alg === \"sha512\" || alg === \"sha384\" \? 128 : 64;\n key2.length > blocksize \? key2 = hash(key2) : key2.length < blocksize && (key2 = Buffer2.concat([key2, ZEROS], blocksize));\n for (var ipad = Buffer2.allocUnsafe(blocksize + sizes[alg]), opad = Buffer2.allocUnsafe(blocksize + sizes[alg]), i = 0;i < blocksize; i++)\n ipad[i] = key2[i] ^ 54, opad[i] = key2[i] ^ 92;\n var ipad1 = Buffer2.allocUnsafe(blocksize + saltLen + 4);\n ipad.copy(ipad1, 0, 0, blocksize), this.ipad1 = ipad1, this.ipad2 = ipad, this.opad = opad, this.alg = alg, this.blocksize = blocksize, this.hash = hash, this.size = sizes[alg];\n }\n Hmac.prototype = {}, Hmac.prototype.run = function(data, ipad) {\n data.copy(ipad, this.blocksize);\n var h = this.hash(ipad);\n return h.copy(this.opad, this.blocksize), this.hash(this.opad);\n };\n function getDigest(alg) {\n function shaFunc(data) {\n return sha(alg).update(data).digest();\n }\n function rmd160Func(data) {\n return new RIPEMD160().update(data).digest();\n }\n return alg === \"rmd160\" || alg === \"ripemd160\" \? rmd160Func : alg === \"md5\" \? md5 : shaFunc;\n }\n function pbkdf2(password, salt, iterations, keylen, digest) {\n checkParameters(iterations, keylen), password = toBuffer(password, defaultEncoding, \"Password\"), salt = toBuffer(salt, defaultEncoding, \"Salt\"), digest = digest || \"sha1\";\n var hmac = new Hmac(digest, password, salt.length), DK = Buffer2.allocUnsafe(keylen), block1 = Buffer2.allocUnsafe(salt.length + 4);\n salt.copy(block1, 0, 0, salt.length);\n for (var destPos = 0, hLen = sizes[digest], l = Math.ceil(keylen / hLen), i = 1;i <= l; i++) {\n block1.writeUInt32BE(i, salt.length);\n for (var T = hmac.run(block1, hmac.ipad1), U = T, j = 1;j < iterations; j++) {\n U = hmac.run(U, hmac.ipad2);\n for (var k = 0;k < hLen; k++)\n T[k] ^= U[k];\n }\n T.copy(DK, destPos), destPos += hLen;\n }\n return DK;\n }\n module.exports = pbkdf2;\n }\n}), require_async = __commonJS({\n \"node_modules/pbkdf2/lib/async.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer, checkParameters = require_precondition(), defaultEncoding = require_default_encoding(), sync = require_sync_browser(), toBuffer = require_to_buffer(), ZERO_BUF, subtle = globalCrypto.subtle, toBrowser = {\n sha: \"SHA-1\",\n \"sha-1\": \"SHA-1\",\n sha1: \"SHA-1\",\n sha256: \"SHA-256\",\n \"sha-256\": \"SHA-256\",\n sha384: \"SHA-384\",\n \"sha-384\": \"SHA-384\",\n \"sha-512\": \"SHA-512\",\n sha512: \"SHA-512\"\n }, checks = [];\n function checkNative(algo) {\n if (global.process && !global.process.browser || !subtle || !subtle.importKey || !subtle.deriveBits)\n return @Promise.resolve(!1);\n if (checks[algo] !== void 0)\n return checks[algo];\n ZERO_BUF = ZERO_BUF || Buffer2.alloc(8);\n var prom = browserPbkdf2(ZERO_BUF, ZERO_BUF, 10, 128, algo).then(function() {\n return !0;\n }).catch(function() {\n return !1;\n });\n return checks[algo] = prom, prom;\n }\n var nextTick;\n function getNextTick() {\n return nextTick || (global.process && global.process.nextTick \? nextTick = global.process.nextTick : global.queueMicrotask \? nextTick = global.queueMicrotask : global.setImmediate \? nextTick = global.setImmediate : nextTick = global.setTimeout, nextTick);\n }\n function browserPbkdf2(password, salt, iterations, length, algo) {\n return subtle.importKey(\"raw\", password, { name: \"PBKDF2\" }, !1, [\"deriveBits\"]).then(function(key2) {\n return subtle.deriveBits({\n name: \"PBKDF2\",\n salt,\n iterations,\n hash: {\n name: algo\n }\n }, key2, length << 3);\n }).then(function(res) {\n return Buffer2.from(res);\n });\n }\n function resolvePromise(promise, callback) {\n promise.then(function(out) {\n getNextTick()(function() {\n callback(null, out);\n });\n }, function(e) {\n getNextTick()(function() {\n callback(e);\n });\n });\n }\n module.exports = function(password, salt, iterations, keylen, digest, callback) {\n typeof digest == \"function\" && (callback = digest, digest = void 0), digest = digest || \"sha1\";\n var algo = toBrowser[digest.toLowerCase()];\n if (!algo || typeof global.Promise != \"function\") {\n getNextTick()(function() {\n var out;\n try {\n out = sync(password, salt, iterations, keylen, digest);\n } catch (e) {\n return callback(e);\n }\n callback(null, out);\n });\n return;\n }\n if (checkParameters(iterations, keylen), password = toBuffer(password, defaultEncoding, \"Password\"), salt = toBuffer(salt, defaultEncoding, \"Salt\"), typeof callback != \"function\")\n throw new Error(\"No callback provided to pbkdf2\");\n resolvePromise(checkNative(algo).then(function(resp) {\n return resp \? browserPbkdf2(password, salt, iterations, keylen, algo) : sync(password, salt, iterations, keylen, digest);\n }), callback);\n };\n }\n}), require_browser4 = __commonJS({\n \"node_modules/pbkdf2/browser.js\"(exports) {\n exports.pbkdf2 = require_async(), exports.pbkdf2Sync = require_sync_browser();\n }\n}), require_utils = __commonJS({\n \"node_modules/des.js/lib/des/utils.js\"(exports) {\n exports.readUInt32BE = function(bytes, off) {\n var res = bytes[0 + off] << 24 | bytes[1 + off] << 16 | bytes[2 + off] << 8 | bytes[3 + off];\n return res >>> 0;\n }, exports.writeUInt32BE = function(bytes, value, off) {\n bytes[0 + off] = value >>> 24, bytes[1 + off] = value >>> 16 & 255, bytes[2 + off] = value >>> 8 & 255, bytes[3 + off] = value & 255;\n }, exports.ip = function(inL, inR, out, off) {\n for (var outL = 0, outR = 0, i = 6;i >= 0; i -= 2) {\n for (var j = 0;j <= 24; j += 8)\n outL <<= 1, outL |= inR >>> j + i & 1;\n for (var j = 0;j <= 24; j += 8)\n outL <<= 1, outL |= inL >>> j + i & 1;\n }\n for (var i = 6;i >= 0; i -= 2) {\n for (var j = 1;j <= 25; j += 8)\n outR <<= 1, outR |= inR >>> j + i & 1;\n for (var j = 1;j <= 25; j += 8)\n outR <<= 1, outR |= inL >>> j + i & 1;\n }\n out[off + 0] = outL >>> 0, out[off + 1] = outR >>> 0;\n }, exports.rip = function(inL, inR, out, off) {\n for (var outL = 0, outR = 0, i = 0;i < 4; i++)\n for (var j = 24;j >= 0; j -= 8)\n outL <<= 1, outL |= inR >>> j + i & 1, outL <<= 1, outL |= inL >>> j + i & 1;\n for (var i = 4;i < 8; i++)\n for (var j = 24;j >= 0; j -= 8)\n outR <<= 1, outR |= inR >>> j + i & 1, outR <<= 1, outR |= inL >>> j + i & 1;\n out[off + 0] = outL >>> 0, out[off + 1] = outR >>> 0;\n }, exports.pc1 = function(inL, inR, out, off) {\n for (var outL = 0, outR = 0, i = 7;i >= 5; i--) {\n for (var j = 0;j <= 24; j += 8)\n outL <<= 1, outL |= inR >> j + i & 1;\n for (var j = 0;j <= 24; j += 8)\n outL <<= 1, outL |= inL >> j + i & 1;\n }\n for (var j = 0;j <= 24; j += 8)\n outL <<= 1, outL |= inR >> j + i & 1;\n for (var i = 1;i <= 3; i++) {\n for (var j = 0;j <= 24; j += 8)\n outR <<= 1, outR |= inR >> j + i & 1;\n for (var j = 0;j <= 24; j += 8)\n outR <<= 1, outR |= inL >> j + i & 1;\n }\n for (var j = 0;j <= 24; j += 8)\n outR <<= 1, outR |= inL >> j + i & 1;\n out[off + 0] = outL >>> 0, out[off + 1] = outR >>> 0;\n }, exports.r28shl = function(num, shift) {\n return num << shift & 268435455 | num >>> 28 - shift;\n };\n var pc2table = [\n 14,\n 11,\n 17,\n 4,\n 27,\n 23,\n 25,\n 0,\n 13,\n 22,\n 7,\n 18,\n 5,\n 9,\n 16,\n 24,\n 2,\n 20,\n 12,\n 21,\n 1,\n 8,\n 15,\n 26,\n 15,\n 4,\n 25,\n 19,\n 9,\n 1,\n 26,\n 16,\n 5,\n 11,\n 23,\n 8,\n 12,\n 7,\n 17,\n 0,\n 22,\n 3,\n 10,\n 14,\n 6,\n 20,\n 27,\n 24\n ];\n exports.pc2 = function(inL, inR, out, off) {\n for (var outL = 0, outR = 0, len = pc2table.length >>> 1, i = 0;i < len; i++)\n outL <<= 1, outL |= inL >>> pc2table[i] & 1;\n for (var i = len;i < pc2table.length; i++)\n outR <<= 1, outR |= inR >>> pc2table[i] & 1;\n out[off + 0] = outL >>> 0, out[off + 1] = outR >>> 0;\n }, exports.expand = function(r, out, off) {\n var outL = 0, outR = 0;\n outL = (r & 1) << 5 | r >>> 27;\n for (var i = 23;i >= 15; i -= 4)\n outL <<= 6, outL |= r >>> i & 63;\n for (var i = 11;i >= 3; i -= 4)\n outR |= r >>> i & 63, outR <<= 6;\n outR |= (r & 31) << 1 | r >>> 31, out[off + 0] = outL >>> 0, out[off + 1] = outR >>> 0;\n };\n var sTable = [\n 14,\n 0,\n 4,\n 15,\n 13,\n 7,\n 1,\n 4,\n 2,\n 14,\n 15,\n 2,\n 11,\n 13,\n 8,\n 1,\n 3,\n 10,\n 10,\n 6,\n 6,\n 12,\n 12,\n 11,\n 5,\n 9,\n 9,\n 5,\n 0,\n 3,\n 7,\n 8,\n 4,\n 15,\n 1,\n 12,\n 14,\n 8,\n 8,\n 2,\n 13,\n 4,\n 6,\n 9,\n 2,\n 1,\n 11,\n 7,\n 15,\n 5,\n 12,\n 11,\n 9,\n 3,\n 7,\n 14,\n 3,\n 10,\n 10,\n 0,\n 5,\n 6,\n 0,\n 13,\n 15,\n 3,\n 1,\n 13,\n 8,\n 4,\n 14,\n 7,\n 6,\n 15,\n 11,\n 2,\n 3,\n 8,\n 4,\n 14,\n 9,\n 12,\n 7,\n 0,\n 2,\n 1,\n 13,\n 10,\n 12,\n 6,\n 0,\n 9,\n 5,\n 11,\n 10,\n 5,\n 0,\n 13,\n 14,\n 8,\n 7,\n 10,\n 11,\n 1,\n 10,\n 3,\n 4,\n 15,\n 13,\n 4,\n 1,\n 2,\n 5,\n 11,\n 8,\n 6,\n 12,\n 7,\n 6,\n 12,\n 9,\n 0,\n 3,\n 5,\n 2,\n 14,\n 15,\n 9,\n 10,\n 13,\n 0,\n 7,\n 9,\n 0,\n 14,\n 9,\n 6,\n 3,\n 3,\n 4,\n 15,\n 6,\n 5,\n 10,\n 1,\n 2,\n 13,\n 8,\n 12,\n 5,\n 7,\n 14,\n 11,\n 12,\n 4,\n 11,\n 2,\n 15,\n 8,\n 1,\n 13,\n 1,\n 6,\n 10,\n 4,\n 13,\n 9,\n 0,\n 8,\n 6,\n 15,\n 9,\n 3,\n 8,\n 0,\n 7,\n 11,\n 4,\n 1,\n 15,\n 2,\n 14,\n 12,\n 3,\n 5,\n 11,\n 10,\n 5,\n 14,\n 2,\n 7,\n 12,\n 7,\n 13,\n 13,\n 8,\n 14,\n 11,\n 3,\n 5,\n 0,\n 6,\n 6,\n 15,\n 9,\n 0,\n 10,\n 3,\n 1,\n 4,\n 2,\n 7,\n 8,\n 2,\n 5,\n 12,\n 11,\n 1,\n 12,\n 10,\n 4,\n 14,\n 15,\n 9,\n 10,\n 3,\n 6,\n 15,\n 9,\n 0,\n 0,\n 6,\n 12,\n 10,\n 11,\n 1,\n 7,\n 13,\n 13,\n 8,\n 15,\n 9,\n 1,\n 4,\n 3,\n 5,\n 14,\n 11,\n 5,\n 12,\n 2,\n 7,\n 8,\n 2,\n 4,\n 14,\n 2,\n 14,\n 12,\n 11,\n 4,\n 2,\n 1,\n 12,\n 7,\n 4,\n 10,\n 7,\n 11,\n 13,\n 6,\n 1,\n 8,\n 5,\n 5,\n 0,\n 3,\n 15,\n 15,\n 10,\n 13,\n 3,\n 0,\n 9,\n 14,\n 8,\n 9,\n 6,\n 4,\n 11,\n 2,\n 8,\n 1,\n 12,\n 11,\n 7,\n 10,\n 1,\n 13,\n 14,\n 7,\n 2,\n 8,\n 13,\n 15,\n 6,\n 9,\n 15,\n 12,\n 0,\n 5,\n 9,\n 6,\n 10,\n 3,\n 4,\n 0,\n 5,\n 14,\n 3,\n 12,\n 10,\n 1,\n 15,\n 10,\n 4,\n 15,\n 2,\n 9,\n 7,\n 2,\n 12,\n 6,\n 9,\n 8,\n 5,\n 0,\n 6,\n 13,\n 1,\n 3,\n 13,\n 4,\n 14,\n 14,\n 0,\n 7,\n 11,\n 5,\n 3,\n 11,\n 8,\n 9,\n 4,\n 14,\n 3,\n 15,\n 2,\n 5,\n 12,\n 2,\n 9,\n 8,\n 5,\n 12,\n 15,\n 3,\n 10,\n 7,\n 11,\n 0,\n 14,\n 4,\n 1,\n 10,\n 7,\n 1,\n 6,\n 13,\n 0,\n 11,\n 8,\n 6,\n 13,\n 4,\n 13,\n 11,\n 0,\n 2,\n 11,\n 14,\n 7,\n 15,\n 4,\n 0,\n 9,\n 8,\n 1,\n 13,\n 10,\n 3,\n 14,\n 12,\n 3,\n 9,\n 5,\n 7,\n 12,\n 5,\n 2,\n 10,\n 15,\n 6,\n 8,\n 1,\n 6,\n 1,\n 6,\n 4,\n 11,\n 11,\n 13,\n 13,\n 8,\n 12,\n 1,\n 3,\n 4,\n 7,\n 10,\n 14,\n 7,\n 10,\n 9,\n 15,\n 5,\n 6,\n 0,\n 8,\n 15,\n 0,\n 14,\n 5,\n 2,\n 9,\n 3,\n 2,\n 12,\n 13,\n 1,\n 2,\n 15,\n 8,\n 13,\n 4,\n 8,\n 6,\n 10,\n 15,\n 3,\n 11,\n 7,\n 1,\n 4,\n 10,\n 12,\n 9,\n 5,\n 3,\n 6,\n 14,\n 11,\n 5,\n 0,\n 0,\n 14,\n 12,\n 9,\n 7,\n 2,\n 7,\n 2,\n 11,\n 1,\n 4,\n 14,\n 1,\n 7,\n 9,\n 4,\n 12,\n 10,\n 14,\n 8,\n 2,\n 13,\n 0,\n 15,\n 6,\n 12,\n 10,\n 9,\n 13,\n 0,\n 15,\n 3,\n 3,\n 5,\n 5,\n 6,\n 8,\n 11\n ];\n exports.substitute = function(inL, inR) {\n for (var out = 0, i = 0;i < 4; i++) {\n var b = inL >>> 18 - i * 6 & 63, sb = sTable[i * 64 + b];\n out <<= 4, out |= sb;\n }\n for (var i = 0;i < 4; i++) {\n var b = inR >>> 18 - i * 6 & 63, sb = sTable[256 + i * 64 + b];\n out <<= 4, out |= sb;\n }\n return out >>> 0;\n };\n var permuteTable = [\n 16,\n 25,\n 12,\n 11,\n 3,\n 20,\n 4,\n 15,\n 31,\n 17,\n 9,\n 6,\n 27,\n 14,\n 1,\n 22,\n 30,\n 24,\n 8,\n 18,\n 0,\n 5,\n 29,\n 23,\n 13,\n 19,\n 2,\n 26,\n 10,\n 21,\n 28,\n 7\n ];\n exports.permute = function(num) {\n for (var out = 0, i = 0;i < permuteTable.length; i++)\n out <<= 1, out |= num >>> permuteTable[i] & 1;\n return out >>> 0;\n }, exports.padSplit = function(num, size, group) {\n for (var str = num.toString(2);str.length < size; )\n str = \"0\" + str;\n for (var out = [], i = 0;i < size; i += group)\n out.push(str.slice(i, i + group));\n return out.join(\" \");\n };\n }\n}), require_minimalistic_assert = __commonJS({\n \"node_modules/minimalistic-assert/index.js\"(exports, module) {\n module.exports = assert;\n function assert(val, msg) {\n if (!val)\n throw new Error(msg || \"Assertion failed\");\n }\n assert.equal = function(l, r, msg) {\n if (l != r)\n throw new Error(msg || \"Assertion failed: \" + l + \" != \" + r);\n };\n }\n}), require_cipher = __commonJS({\n \"node_modules/des.js/lib/des/cipher.js\"(exports, module) {\n var assert = require_minimalistic_assert();\n function Cipher(options) {\n this.options = options, this.type = this.options.type, this.blockSize = 8, this._init(), this.buffer = new @Array(this.blockSize), this.bufferOff = 0;\n }\n Cipher.prototype = {}, module.exports = Cipher, Cipher.prototype._init = function() {\n }, Cipher.prototype.update = function(data) {\n return data.length === 0 \? [] : this.type === \"decrypt\" \? this._updateDecrypt(data) : this._updateEncrypt(data);\n }, Cipher.prototype._buffer = function(data, off) {\n for (var min = Math.min(this.buffer.length - this.bufferOff, data.length - off), i = 0;i < min; i++)\n this.buffer[this.bufferOff + i] = data[off + i];\n return this.bufferOff += min, min;\n }, Cipher.prototype._flushBuffer = function(out, off) {\n return this._update(this.buffer, 0, out, off), this.bufferOff = 0, this.blockSize;\n }, Cipher.prototype._updateEncrypt = function(data) {\n var inputOff = 0, outputOff = 0, count = (this.bufferOff + data.length) / this.blockSize | 0, out = new @Array(count * this.blockSize);\n this.bufferOff !== 0 && (inputOff += this._buffer(data, inputOff), this.bufferOff === this.buffer.length && (outputOff += this._flushBuffer(out, outputOff)));\n for (var max = data.length - (data.length - inputOff) % this.blockSize;inputOff < max; inputOff += this.blockSize)\n this._update(data, inputOff, out, outputOff), outputOff += this.blockSize;\n for (;inputOff < data.length; inputOff++, this.bufferOff++)\n this.buffer[this.bufferOff] = data[inputOff];\n return out;\n }, Cipher.prototype._updateDecrypt = function(data) {\n for (var inputOff = 0, outputOff = 0, count = Math.ceil((this.bufferOff + data.length) / this.blockSize) - 1, out = new @Array(count * this.blockSize);count > 0; count--)\n inputOff += this._buffer(data, inputOff), outputOff += this._flushBuffer(out, outputOff);\n return inputOff += this._buffer(data, inputOff), out;\n }, Cipher.prototype.final = function(buffer) {\n var first;\n buffer && (first = this.update(buffer));\n var last;\n return this.type === \"encrypt\" \? last = this._finalEncrypt() : last = this._finalDecrypt(), first \? first.concat(last) : last;\n }, Cipher.prototype._pad = function(buffer, off) {\n if (off === 0)\n return !1;\n for (;off < buffer.length; )\n buffer[off++] = 0;\n return !0;\n }, Cipher.prototype._finalEncrypt = function() {\n if (!this._pad(this.buffer, this.bufferOff))\n return [];\n var out = new @Array(this.blockSize);\n return this._update(this.buffer, 0, out, 0), out;\n }, Cipher.prototype._unpad = function(buffer) {\n return buffer;\n }, Cipher.prototype._finalDecrypt = function() {\n assert.equal(this.bufferOff, this.blockSize, \"Not enough data to decrypt\");\n var out = new @Array(this.blockSize);\n return this._flushBuffer(out, 0), this._unpad(out);\n };\n }\n}), require_des = __commonJS({\n \"node_modules/des.js/lib/des/des.js\"(exports, module) {\n var assert = require_minimalistic_assert(), inherits = require_inherits_browser(), utils = require_utils(), Cipher = require_cipher();\n function DESState() {\n this.tmp = new @Array(2), this.keys = null;\n }\n function DES(options) {\n Cipher.@call(this, options);\n var state = new DESState;\n this._desState = state, this.deriveKeys(state, options.key);\n }\n inherits(DES, Cipher), module.exports = DES, DES.create = function(options) {\n return new DES(options);\n };\n var shiftTable = [1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1];\n DES.prototype.deriveKeys = function(state, key2) {\n state.keys = new @Array(32), assert.equal(key2.length, this.blockSize, \"Invalid key length\");\n var kL = utils.readUInt32BE(key2, 0), kR = utils.readUInt32BE(key2, 4);\n utils.pc1(kL, kR, state.tmp, 0), kL = state.tmp[0], kR = state.tmp[1];\n for (var i = 0;i < state.keys.length; i += 2) {\n var shift = shiftTable[i >>> 1];\n kL = utils.r28shl(kL, shift), kR = utils.r28shl(kR, shift), utils.pc2(kL, kR, state.keys, i);\n }\n }, DES.prototype._update = function(inp, inOff, out, outOff) {\n var state = this._desState, l = utils.readUInt32BE(inp, inOff), r = utils.readUInt32BE(inp, inOff + 4);\n utils.ip(l, r, state.tmp, 0), l = state.tmp[0], r = state.tmp[1], this.type === \"encrypt\" \? this._encrypt(state, l, r, state.tmp, 0) : this._decrypt(state, l, r, state.tmp, 0), l = state.tmp[0], r = state.tmp[1], utils.writeUInt32BE(out, l, outOff), utils.writeUInt32BE(out, r, outOff + 4);\n }, DES.prototype._pad = function(buffer, off) {\n for (var value = buffer.length - off, i = off;i < buffer.length; i++)\n buffer[i] = value;\n return !0;\n }, DES.prototype._unpad = function(buffer) {\n for (var pad = buffer[buffer.length - 1], i = buffer.length - pad;i < buffer.length; i++)\n assert.equal(buffer[i], pad);\n return buffer.slice(0, buffer.length - pad);\n }, DES.prototype._encrypt = function(state, lStart, rStart, out, off) {\n for (var l = lStart, r = rStart, i = 0;i < state.keys.length; i += 2) {\n var keyL = state.keys[i], keyR = state.keys[i + 1];\n utils.expand(r, state.tmp, 0), keyL ^= state.tmp[0], keyR ^= state.tmp[1];\n var s = utils.substitute(keyL, keyR), f = utils.permute(s), t = r;\n r = (l ^ f) >>> 0, l = t;\n }\n utils.rip(r, l, out, off);\n }, DES.prototype._decrypt = function(state, lStart, rStart, out, off) {\n for (var l = rStart, r = lStart, i = state.keys.length - 2;i >= 0; i -= 2) {\n var keyL = state.keys[i], keyR = state.keys[i + 1];\n utils.expand(l, state.tmp, 0), keyL ^= state.tmp[0], keyR ^= state.tmp[1];\n var s = utils.substitute(keyL, keyR), f = utils.permute(s), t = l;\n l = (r ^ f) >>> 0, r = t;\n }\n utils.rip(l, r, out, off);\n };\n }\n}), require_cbc = __commonJS({\n \"node_modules/des.js/lib/des/cbc.js\"(exports) {\n var assert = require_minimalistic_assert(), inherits = require_inherits_browser(), proto = {};\n function CBCState(iv) {\n assert.equal(iv.length, 8, \"Invalid IV length\"), this.iv = new @Array(8);\n for (var i = 0;i < this.iv.length; i++)\n this.iv[i] = iv[i];\n }\n function instantiate(Base) {\n function CBC(options) {\n Base.@call(this, options), this._cbcInit();\n }\n inherits(CBC, Base);\n for (var keys = Object.keys(proto), i = 0;i < keys.length; i++) {\n var key2 = keys[i];\n CBC.prototype[key2] = proto[key2];\n }\n return CBC.create = function(options) {\n return new CBC(options);\n }, CBC;\n }\n exports.instantiate = instantiate, proto._cbcInit = function() {\n var state = new CBCState(this.options.iv);\n this._cbcState = state;\n }, proto._update = function(inp, inOff, out, outOff) {\n var state = this._cbcState, superProto = this.constructor.super_.prototype, iv = state.iv;\n if (this.type === \"encrypt\") {\n for (var i = 0;i < this.blockSize; i++)\n iv[i] ^= inp[inOff + i];\n superProto._update.@call(this, iv, 0, out, outOff);\n for (var i = 0;i < this.blockSize; i++)\n iv[i] = out[outOff + i];\n } else {\n superProto._update.@call(this, inp, inOff, out, outOff);\n for (var i = 0;i < this.blockSize; i++)\n out[outOff + i] ^= iv[i];\n for (var i = 0;i < this.blockSize; i++)\n iv[i] = inp[inOff + i];\n }\n };\n }\n}), require_ede = __commonJS({\n \"node_modules/des.js/lib/des/ede.js\"(exports, module) {\n var assert = require_minimalistic_assert(), inherits = require_inherits_browser(), Cipher = require_cipher(), DES = require_des();\n function EDEState(type, key2) {\n assert.equal(key2.length, 24, \"Invalid key length\");\n var k1 = key2.slice(0, 8), k2 = key2.slice(8, 16), k3 = key2.slice(16, 24);\n type === \"encrypt\" \? this.ciphers = [\n DES.create({ type: \"encrypt\", key: k1 }),\n DES.create({ type: \"decrypt\", key: k2 }),\n DES.create({ type: \"encrypt\", key: k3 })\n ] : this.ciphers = [\n DES.create({ type: \"decrypt\", key: k3 }),\n DES.create({ type: \"encrypt\", key: k2 }),\n DES.create({ type: \"decrypt\", key: k1 })\n ];\n }\n function EDE(options) {\n Cipher.@call(this, options);\n var state = new EDEState(this.type, this.options.key);\n this._edeState = state;\n }\n inherits(EDE, Cipher), module.exports = EDE, EDE.create = function(options) {\n return new EDE(options);\n }, EDE.prototype._update = function(inp, inOff, out, outOff) {\n var state = this._edeState;\n state.ciphers[0]._update(inp, inOff, out, outOff), state.ciphers[1]._update(out, outOff, out, outOff), state.ciphers[2]._update(out, outOff, out, outOff);\n }, EDE.prototype._pad = DES.prototype._pad, EDE.prototype._unpad = DES.prototype._unpad;\n }\n}), require_des2 = __commonJS({\n \"node_modules/des.js/lib/des.js\"(exports) {\n exports.utils = require_utils(), exports.Cipher = require_cipher(), exports.DES = require_des(), exports.CBC = require_cbc(), exports.EDE = require_ede();\n }\n}), require_browserify_des = __commonJS({\n \"node_modules/browserify-des/index.js\"(exports, module) {\n var CipherBase = require_cipher_base(), des = require_des2(), inherits = require_inherits_browser(), Buffer2 = require_safe_buffer().Buffer, modes = {\n \"des-ede3-cbc\": des.CBC.instantiate(des.EDE),\n \"des-ede3\": des.EDE,\n \"des-ede-cbc\": des.CBC.instantiate(des.EDE),\n \"des-ede\": des.EDE,\n \"des-cbc\": des.CBC.instantiate(des.DES),\n \"des-ecb\": des.DES\n };\n modes.des = modes[\"des-cbc\"], modes.des3 = modes[\"des-ede3-cbc\"], module.exports = DES, inherits(DES, CipherBase);\n function DES(opts) {\n CipherBase.@call(this);\n var modeName = opts.mode.toLowerCase(), mode = modes[modeName], type;\n opts.decrypt \? type = \"decrypt\" : type = \"encrypt\";\n var key2 = opts.key;\n Buffer2.isBuffer(key2) || (key2 = Buffer2.from(key2)), (modeName === \"des-ede\" || modeName === \"des-ede-cbc\") && (key2 = Buffer2.concat([key2, key2.slice(0, 8)]));\n var iv = opts.iv;\n Buffer2.isBuffer(iv) || (iv = Buffer2.from(iv)), this._des = mode.create({\n key: key2,\n iv,\n type\n });\n }\n DES.prototype._update = function(data) {\n return Buffer2.from(this._des.update(data));\n }, DES.prototype._final = function() {\n return Buffer2.from(this._des.final());\n };\n }\n}), require_ecb = __commonJS({\n \"node_modules/browserify-aes/modes/ecb.js\"(exports) {\n exports.encrypt = function(self2, block) {\n return self2._cipher.encryptBlock(block);\n }, exports.decrypt = function(self2, block) {\n return self2._cipher.decryptBlock(block);\n };\n }\n}), require_buffer_xor = __commonJS({\n \"node_modules/buffer-xor/index.js\"(exports, module) {\n module.exports = function(a, b) {\n for (var length = Math.min(a.length, b.length), buffer = new Buffer(length), i = 0;i < length; ++i)\n buffer[i] = a[i] ^ b[i];\n return buffer;\n };\n }\n}), require_cbc2 = __commonJS({\n \"node_modules/browserify-aes/modes/cbc.js\"(exports) {\n var xor = require_buffer_xor();\n exports.encrypt = function(self2, block) {\n var data = xor(block, self2._prev);\n return self2._prev = self2._cipher.encryptBlock(data), self2._prev;\n }, exports.decrypt = function(self2, block) {\n var pad = self2._prev;\n self2._prev = block;\n var out = self2._cipher.decryptBlock(block);\n return xor(out, pad);\n };\n }\n}), require_cfb = __commonJS({\n \"node_modules/browserify-aes/modes/cfb.js\"(exports) {\n var Buffer2 = require_safe_buffer().Buffer, xor = require_buffer_xor();\n function encryptStart(self2, data, decrypt) {\n var len = data.length, out = xor(data, self2._cache);\n return self2._cache = self2._cache.slice(len), self2._prev = Buffer2.concat([self2._prev, decrypt \? data : out]), out;\n }\n exports.encrypt = function(self2, data, decrypt) {\n for (var out = Buffer2.allocUnsafe(0), len;data.length; )\n if (self2._cache.length === 0 && (self2._cache = self2._cipher.encryptBlock(self2._prev), self2._prev = Buffer2.allocUnsafe(0)), self2._cache.length <= data.length)\n len = self2._cache.length, out = Buffer2.concat([out, encryptStart(self2, data.slice(0, len), decrypt)]), data = data.slice(len);\n else {\n out = Buffer2.concat([out, encryptStart(self2, data, decrypt)]);\n break;\n }\n return out;\n };\n }\n}), require_cfb8 = __commonJS({\n \"node_modules/browserify-aes/modes/cfb8.js\"(exports) {\n var Buffer2 = require_safe_buffer().Buffer;\n function encryptByte(self2, byteParam, decrypt) {\n var pad = self2._cipher.encryptBlock(self2._prev), out = pad[0] ^ byteParam;\n return self2._prev = Buffer2.concat([self2._prev.slice(1), Buffer2.from([decrypt \? byteParam : out])]), out;\n }\n exports.encrypt = function(self2, chunk, decrypt) {\n for (var len = chunk.length, out = Buffer2.allocUnsafe(len), i = -1;++i < len; )\n out[i] = encryptByte(self2, chunk[i], decrypt);\n return out;\n };\n }\n}), require_cfb1 = __commonJS({\n \"node_modules/browserify-aes/modes/cfb1.js\"(exports) {\n var Buffer2 = require_safe_buffer().Buffer;\n function encryptByte(self2, byteParam, decrypt) {\n for (var pad, i = -1, len = 8, out = 0, bit, value;++i < len; )\n pad = self2._cipher.encryptBlock(self2._prev), bit = byteParam & 1 << 7 - i \? 128 : 0, value = pad[0] ^ bit, out += (value & 128) >> i % 8, self2._prev = shiftIn(self2._prev, decrypt \? bit : value);\n return out;\n }\n function shiftIn(buffer, value) {\n var len = buffer.length, i = -1, out = Buffer2.allocUnsafe(buffer.length);\n for (buffer = Buffer2.concat([buffer, Buffer2.from([value])]);++i < len; )\n out[i] = buffer[i] << 1 | buffer[i + 1] >> 7;\n return out;\n }\n exports.encrypt = function(self2, chunk, decrypt) {\n for (var len = chunk.length, out = Buffer2.allocUnsafe(len), i = -1;++i < len; )\n out[i] = encryptByte(self2, chunk[i], decrypt);\n return out;\n };\n }\n}), require_ofb = __commonJS({\n \"node_modules/browserify-aes/modes/ofb.js\"(exports) {\n var xor = require_buffer_xor();\n function getBlock(self2) {\n return self2._prev = self2._cipher.encryptBlock(self2._prev), self2._prev;\n }\n exports.encrypt = function(self2, chunk) {\n for (;self2._cache.length < chunk.length; )\n self2._cache = Buffer.concat([self2._cache, getBlock(self2)]);\n var pad = self2._cache.slice(0, chunk.length);\n return self2._cache = self2._cache.slice(chunk.length), xor(chunk, pad);\n };\n }\n}), require_incr32 = __commonJS({\n \"node_modules/browserify-aes/incr32.js\"(exports, module) {\n function incr32(iv) {\n for (var len = iv.length, item;len--; )\n if (item = iv.readUInt8(len), item === 255)\n iv.writeUInt8(0, len);\n else {\n item++, iv.writeUInt8(item, len);\n break;\n }\n }\n module.exports = incr32;\n }\n}), require_ctr = __commonJS({\n \"node_modules/browserify-aes/modes/ctr.js\"(exports) {\n var xor = require_buffer_xor(), Buffer2 = require_safe_buffer().Buffer, incr32 = require_incr32();\n function getBlock(self2) {\n var out = self2._cipher.encryptBlockRaw(self2._prev);\n return incr32(self2._prev), out;\n }\n var blockSize = 16;\n exports.encrypt = function(self2, chunk) {\n var chunkNum = Math.ceil(chunk.length / blockSize), start = self2._cache.length;\n self2._cache = Buffer2.concat([self2._cache, Buffer2.allocUnsafe(chunkNum * blockSize)]);\n for (var i = 0;i < chunkNum; i++) {\n var out = getBlock(self2), offset = start + i * blockSize;\n self2._cache.writeUInt32BE(out[0], offset + 0), self2._cache.writeUInt32BE(out[1], offset + 4), self2._cache.writeUInt32BE(out[2], offset + 8), self2._cache.writeUInt32BE(out[3], offset + 12);\n }\n var pad = self2._cache.slice(0, chunk.length);\n return self2._cache = self2._cache.slice(chunk.length), xor(chunk, pad);\n };\n }\n}), require_list = __commonJS({\n \"node_modules/browserify-aes/modes/list.json\"(exports, module) {\n module.exports = {\n \"aes-128-ecb\": {\n cipher: \"AES\",\n key: 128,\n iv: 0,\n mode: \"ECB\",\n type: \"block\"\n },\n \"aes-192-ecb\": {\n cipher: \"AES\",\n key: 192,\n iv: 0,\n mode: \"ECB\",\n type: \"block\"\n },\n \"aes-256-ecb\": {\n cipher: \"AES\",\n key: 256,\n iv: 0,\n mode: \"ECB\",\n type: \"block\"\n },\n \"aes-128-cbc\": {\n cipher: \"AES\",\n key: 128,\n iv: 16,\n mode: \"CBC\",\n type: \"block\"\n },\n \"aes-192-cbc\": {\n cipher: \"AES\",\n key: 192,\n iv: 16,\n mode: \"CBC\",\n type: \"block\"\n },\n \"aes-256-cbc\": {\n cipher: \"AES\",\n key: 256,\n iv: 16,\n mode: \"CBC\",\n type: \"block\"\n },\n aes128: {\n cipher: \"AES\",\n key: 128,\n iv: 16,\n mode: \"CBC\",\n type: \"block\"\n },\n aes192: {\n cipher: \"AES\",\n key: 192,\n iv: 16,\n mode: \"CBC\",\n type: \"block\"\n },\n aes256: {\n cipher: \"AES\",\n key: 256,\n iv: 16,\n mode: \"CBC\",\n type: \"block\"\n },\n \"aes-128-cfb\": {\n cipher: \"AES\",\n key: 128,\n iv: 16,\n mode: \"CFB\",\n type: \"stream\"\n },\n \"aes-192-cfb\": {\n cipher: \"AES\",\n key: 192,\n iv: 16,\n mode: \"CFB\",\n type: \"stream\"\n },\n \"aes-256-cfb\": {\n cipher: \"AES\",\n key: 256,\n iv: 16,\n mode: \"CFB\",\n type: \"stream\"\n },\n \"aes-128-cfb8\": {\n cipher: \"AES\",\n key: 128,\n iv: 16,\n mode: \"CFB8\",\n type: \"stream\"\n },\n \"aes-192-cfb8\": {\n cipher: \"AES\",\n key: 192,\n iv: 16,\n mode: \"CFB8\",\n type: \"stream\"\n },\n \"aes-256-cfb8\": {\n cipher: \"AES\",\n key: 256,\n iv: 16,\n mode: \"CFB8\",\n type: \"stream\"\n },\n \"aes-128-cfb1\": {\n cipher: \"AES\",\n key: 128,\n iv: 16,\n mode: \"CFB1\",\n type: \"stream\"\n },\n \"aes-192-cfb1\": {\n cipher: \"AES\",\n key: 192,\n iv: 16,\n mode: \"CFB1\",\n type: \"stream\"\n },\n \"aes-256-cfb1\": {\n cipher: \"AES\",\n key: 256,\n iv: 16,\n mode: \"CFB1\",\n type: \"stream\"\n },\n \"aes-128-ofb\": {\n cipher: \"AES\",\n key: 128,\n iv: 16,\n mode: \"OFB\",\n type: \"stream\"\n },\n \"aes-192-ofb\": {\n cipher: \"AES\",\n key: 192,\n iv: 16,\n mode: \"OFB\",\n type: \"stream\"\n },\n \"aes-256-ofb\": {\n cipher: \"AES\",\n key: 256,\n iv: 16,\n mode: \"OFB\",\n type: \"stream\"\n },\n \"aes-128-ctr\": {\n cipher: \"AES\",\n key: 128,\n iv: 16,\n mode: \"CTR\",\n type: \"stream\"\n },\n \"aes-192-ctr\": {\n cipher: \"AES\",\n key: 192,\n iv: 16,\n mode: \"CTR\",\n type: \"stream\"\n },\n \"aes-256-ctr\": {\n cipher: \"AES\",\n key: 256,\n iv: 16,\n mode: \"CTR\",\n type: \"stream\"\n },\n \"aes-128-gcm\": {\n cipher: \"AES\",\n key: 128,\n iv: 12,\n mode: \"GCM\",\n type: \"auth\"\n },\n \"aes-192-gcm\": {\n cipher: \"AES\",\n key: 192,\n iv: 12,\n mode: \"GCM\",\n type: \"auth\"\n },\n \"aes-256-gcm\": {\n cipher: \"AES\",\n key: 256,\n iv: 12,\n mode: \"GCM\",\n type: \"auth\"\n }\n };\n }\n}), require_modes = __commonJS({\n \"node_modules/browserify-aes/modes/index.js\"(exports, module) {\n var modeModules = {\n ECB: require_ecb(),\n CBC: require_cbc2(),\n CFB: require_cfb(),\n CFB8: require_cfb8(),\n CFB1: require_cfb1(),\n OFB: require_ofb(),\n CTR: require_ctr(),\n GCM: require_ctr()\n }, modes = require_list();\n for (key2 in modes)\n modes[key2].module = modeModules[modes[key2].mode];\n var key2;\n module.exports = modes;\n }\n}), require_aes = __commonJS({\n \"node_modules/browserify-aes/aes.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer;\n function asUInt32Array(buf) {\n if (buf instanceof KeyObject)\n buf = buf.export();\n else if (buf instanceof CryptoKey)\n buf = KeyObject.from(buf).export();\n Buffer2.isBuffer(buf) || (buf = Buffer2.from(buf));\n for (var len = buf.length / 4 | 0, out = new @Array(len), i = 0;i < len; i++)\n out[i] = buf.readUInt32BE(i * 4);\n return out;\n }\n function scrubVec(v) {\n for (var i = 0;i < v.length; v++)\n v[i] = 0;\n }\n function cryptBlock(M, keySchedule, SUB_MIX, SBOX, nRounds) {\n for (var SUB_MIX0 = SUB_MIX[0], SUB_MIX1 = SUB_MIX[1], SUB_MIX2 = SUB_MIX[2], SUB_MIX3 = SUB_MIX[3], s0 = M[0] ^ keySchedule[0], s1 = M[1] ^ keySchedule[1], s2 = M[2] ^ keySchedule[2], s3 = M[3] ^ keySchedule[3], t0, t1, t2, t3, ksRow = 4, round = 1;round < nRounds; round++)\n t0 = SUB_MIX0[s0 >>> 24] ^ SUB_MIX1[s1 >>> 16 & 255] ^ SUB_MIX2[s2 >>> 8 & 255] ^ SUB_MIX3[s3 & 255] ^ keySchedule[ksRow++], t1 = SUB_MIX0[s1 >>> 24] ^ SUB_MIX1[s2 >>> 16 & 255] ^ SUB_MIX2[s3 >>> 8 & 255] ^ SUB_MIX3[s0 & 255] ^ keySchedule[ksRow++], t2 = SUB_MIX0[s2 >>> 24] ^ SUB_MIX1[s3 >>> 16 & 255] ^ SUB_MIX2[s0 >>> 8 & 255] ^ SUB_MIX3[s1 & 255] ^ keySchedule[ksRow++], t3 = SUB_MIX0[s3 >>> 24] ^ SUB_MIX1[s0 >>> 16 & 255] ^ SUB_MIX2[s1 >>> 8 & 255] ^ SUB_MIX3[s2 & 255] ^ keySchedule[ksRow++], s0 = t0, s1 = t1, s2 = t2, s3 = t3;\n return t0 = (SBOX[s0 >>> 24] << 24 | SBOX[s1 >>> 16 & 255] << 16 | SBOX[s2 >>> 8 & 255] << 8 | SBOX[s3 & 255]) ^ keySchedule[ksRow++], t1 = (SBOX[s1 >>> 24] << 24 | SBOX[s2 >>> 16 & 255] << 16 | SBOX[s3 >>> 8 & 255] << 8 | SBOX[s0 & 255]) ^ keySchedule[ksRow++], t2 = (SBOX[s2 >>> 24] << 24 | SBOX[s3 >>> 16 & 255] << 16 | SBOX[s0 >>> 8 & 255] << 8 | SBOX[s1 & 255]) ^ keySchedule[ksRow++], t3 = (SBOX[s3 >>> 24] << 24 | SBOX[s0 >>> 16 & 255] << 16 | SBOX[s1 >>> 8 & 255] << 8 | SBOX[s2 & 255]) ^ keySchedule[ksRow++], t0 = t0 >>> 0, t1 = t1 >>> 0, t2 = t2 >>> 0, t3 = t3 >>> 0, [t0, t1, t2, t3];\n }\n var RCON = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], G = function() {\n for (var d = new @Array(256), j = 0;j < 256; j++)\n j < 128 \? d[j] = j << 1 : d[j] = j << 1 ^ 283;\n for (var SBOX = [], INV_SBOX = [], SUB_MIX = [[], [], [], []], INV_SUB_MIX = [[], [], [], []], x = 0, xi = 0, i = 0;i < 256; ++i) {\n var sx = xi ^ xi << 1 ^ xi << 2 ^ xi << 3 ^ xi << 4;\n sx = sx >>> 8 ^ sx & 255 ^ 99, SBOX[x] = sx, INV_SBOX[sx] = x;\n var x2 = d[x], x4 = d[x2], x8 = d[x4], t = d[sx] * 257 ^ sx * 16843008;\n SUB_MIX[0][x] = t << 24 | t >>> 8, SUB_MIX[1][x] = t << 16 | t >>> 16, SUB_MIX[2][x] = t << 8 | t >>> 24, SUB_MIX[3][x] = t, t = x8 * 16843009 ^ x4 * 65537 ^ x2 * 257 ^ x * 16843008, INV_SUB_MIX[0][sx] = t << 24 | t >>> 8, INV_SUB_MIX[1][sx] = t << 16 | t >>> 16, INV_SUB_MIX[2][sx] = t << 8 | t >>> 24, INV_SUB_MIX[3][sx] = t, x === 0 \? x = xi = 1 : (x = x2 ^ d[d[d[x8 ^ x2]]], xi ^= d[d[xi]]);\n }\n return {\n SBOX,\n INV_SBOX,\n SUB_MIX,\n INV_SUB_MIX\n };\n }();\n function AES(key2) {\n this._key = asUInt32Array(key2), this._reset();\n }\n AES.prototype = {}, AES.blockSize = 16, AES.keySize = 32, AES.prototype.blockSize = AES.blockSize, AES.prototype.keySize = AES.keySize, AES.prototype._reset = function() {\n for (var keyWords = this._key, keySize = keyWords.length, nRounds = keySize + 6, ksRows = (nRounds + 1) * 4, keySchedule = [], k = 0;k < keySize; k++)\n keySchedule[k] = keyWords[k];\n for (k = keySize;k < ksRows; k++) {\n var t = keySchedule[k - 1];\n k % keySize === 0 \? (t = t << 8 | t >>> 24, t = G.SBOX[t >>> 24] << 24 | G.SBOX[t >>> 16 & 255] << 16 | G.SBOX[t >>> 8 & 255] << 8 | G.SBOX[t & 255], t ^= RCON[k / keySize | 0] << 24) : keySize > 6 && k % keySize === 4 && (t = G.SBOX[t >>> 24] << 24 | G.SBOX[t >>> 16 & 255] << 16 | G.SBOX[t >>> 8 & 255] << 8 | G.SBOX[t & 255]), keySchedule[k] = keySchedule[k - keySize] ^ t;\n }\n for (var invKeySchedule = [], ik = 0;ik < ksRows; ik++) {\n var ksR = ksRows - ik, tt = keySchedule[ksR - (ik % 4 \? 0 : 4)];\n ik < 4 || ksR <= 4 \? invKeySchedule[ik] = tt : invKeySchedule[ik] = G.INV_SUB_MIX[0][G.SBOX[tt >>> 24]] ^ G.INV_SUB_MIX[1][G.SBOX[tt >>> 16 & 255]] ^ G.INV_SUB_MIX[2][G.SBOX[tt >>> 8 & 255]] ^ G.INV_SUB_MIX[3][G.SBOX[tt & 255]];\n }\n this._nRounds = nRounds, this._keySchedule = keySchedule, this._invKeySchedule = invKeySchedule;\n }, AES.prototype.encryptBlockRaw = function(M) {\n return M = asUInt32Array(M), cryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX, this._nRounds);\n }, AES.prototype.encryptBlock = function(M) {\n var out = this.encryptBlockRaw(M), buf = Buffer2.allocUnsafe(16);\n return buf.writeUInt32BE(out[0], 0), buf.writeUInt32BE(out[1], 4), buf.writeUInt32BE(out[2], 8), buf.writeUInt32BE(out[3], 12), buf;\n }, AES.prototype.decryptBlock = function(M) {\n M = asUInt32Array(M);\n var m1 = M[1];\n M[1] = M[3], M[3] = m1;\n var out = cryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX, this._nRounds), buf = Buffer2.allocUnsafe(16);\n return buf.writeUInt32BE(out[0], 0), buf.writeUInt32BE(out[3], 4), buf.writeUInt32BE(out[2], 8), buf.writeUInt32BE(out[1], 12), buf;\n }, AES.prototype.scrub = function() {\n scrubVec(this._keySchedule), scrubVec(this._invKeySchedule), scrubVec(this._key);\n }, module.exports.AES = AES;\n }\n}), require_ghash = __commonJS({\n \"node_modules/browserify-aes/ghash.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer, ZEROES = Buffer2.alloc(16, 0);\n function toArray(buf) {\n return [buf.readUInt32BE(0), buf.readUInt32BE(4), buf.readUInt32BE(8), buf.readUInt32BE(12)];\n }\n function fromArray(out) {\n var buf = Buffer2.allocUnsafe(16);\n return buf.writeUInt32BE(out[0] >>> 0, 0), buf.writeUInt32BE(out[1] >>> 0, 4), buf.writeUInt32BE(out[2] >>> 0, 8), buf.writeUInt32BE(out[3] >>> 0, 12), buf;\n }\n function GHASH(key2) {\n this.h = key2, this.state = Buffer2.alloc(16, 0), this.cache = Buffer2.allocUnsafe(0);\n }\n GHASH.prototype = {}, GHASH.prototype.ghash = function(block) {\n for (var i = -1;++i < block.length; )\n this.state[i] ^= block[i];\n this._multiply();\n }, GHASH.prototype._multiply = function() {\n for (var Vi = toArray(this.h), Zi = [0, 0, 0, 0], j, xi, lsbVi, i = -1;++i < 128; ) {\n for (xi = (this.state[~~(i / 8)] & 1 << 7 - i % 8) !== 0, xi && (Zi[0] ^= Vi[0], Zi[1] ^= Vi[1], Zi[2] ^= Vi[2], Zi[3] ^= Vi[3]), lsbVi = (Vi[3] & 1) !== 0, j = 3;j > 0; j--)\n Vi[j] = Vi[j] >>> 1 | (Vi[j - 1] & 1) << 31;\n Vi[0] = Vi[0] >>> 1, lsbVi && (Vi[0] = Vi[0] ^ 225 << 24);\n }\n this.state = fromArray(Zi);\n }, GHASH.prototype.update = function(buf) {\n this.cache = Buffer2.concat([this.cache, buf]);\n for (var chunk;this.cache.length >= 16; )\n chunk = this.cache.slice(0, 16), this.cache = this.cache.slice(16), this.ghash(chunk);\n }, GHASH.prototype.final = function(abl, bl) {\n return this.cache.length && this.ghash(Buffer2.concat([this.cache, ZEROES], 16)), this.ghash(fromArray([0, abl, 0, bl])), this.state;\n }, module.exports = GHASH;\n }\n}), require_authCipher = __commonJS({\n \"node_modules/browserify-aes/authCipher.js\"(exports, module) {\n var aes = require_aes(), Buffer2 = require_safe_buffer().Buffer, Transform = require_cipher_base(), inherits = require_inherits_browser(), GHASH = require_ghash(), xor = require_buffer_xor(), incr32 = require_incr32();\n function xorTest(a, b) {\n var out = 0;\n a.length !== b.length && out++;\n for (var len = Math.min(a.length, b.length), i = 0;i < len; ++i)\n out += a[i] ^ b[i];\n return out;\n }\n function calcIv(self2, iv, ck) {\n if (iv.length === 12)\n return self2._finID = Buffer2.concat([iv, Buffer2.from([0, 0, 0, 1])]), Buffer2.concat([iv, Buffer2.from([0, 0, 0, 2])]);\n var ghash = new GHASH(ck), len = iv.length, toPad = len % 16;\n ghash.update(iv), toPad && (toPad = 16 - toPad, ghash.update(Buffer2.alloc(toPad, 0))), ghash.update(Buffer2.alloc(8, 0));\n var ivBits = len * 8, tail = Buffer2.alloc(8);\n tail.writeUIntBE(ivBits, 2, 6), ghash.update(tail), self2._finID = ghash.state;\n var out = Buffer2.from(self2._finID);\n return incr32(out), out;\n }\n function StreamCipher(mode, key2, iv, decrypt) {\n Transform.@call(this);\n var h = Buffer2.alloc(4, 0);\n this._cipher = new aes.AES(key2);\n var ck = this._cipher.encryptBlock(h);\n this._ghash = new GHASH(ck), iv = calcIv(this, iv, ck), this._prev = Buffer2.from(iv), this._cache = Buffer2.allocUnsafe(0), this._secCache = Buffer2.allocUnsafe(0), this._decrypt = decrypt, this._alen = 0, this._len = 0, this._mode = mode, this._authTag = null, this._called = !1;\n }\n inherits(StreamCipher, Transform), StreamCipher.prototype._update = function(chunk) {\n if (!this._called && this._alen) {\n var rump = 16 - this._alen % 16;\n rump < 16 && (rump = Buffer2.alloc(rump, 0), this._ghash.update(rump));\n }\n this._called = !0;\n var out = this._mode.encrypt(this, chunk);\n return this._decrypt \? this._ghash.update(chunk) : this._ghash.update(out), this._len += chunk.length, out;\n }, StreamCipher.prototype._final = function() {\n if (this._decrypt && !this._authTag)\n throw new Error(\"Unsupported state or unable to authenticate data\");\n var tag = xor(this._ghash.final(this._alen * 8, this._len * 8), this._cipher.encryptBlock(this._finID));\n if (this._decrypt && xorTest(tag, this._authTag))\n throw new Error(\"Unsupported state or unable to authenticate data\");\n this._authTag = tag, this._cipher.scrub();\n }, StreamCipher.prototype.getAuthTag = function() {\n if (this._decrypt || !Buffer2.isBuffer(this._authTag))\n throw new Error(\"Attempting to get auth tag in unsupported state\");\n return this._authTag;\n }, StreamCipher.prototype.setAuthTag = function(tag) {\n if (!this._decrypt)\n throw new Error(\"Attempting to set auth tag in unsupported state\");\n this._authTag = tag;\n }, StreamCipher.prototype.setAAD = function(buf) {\n if (this._called)\n throw new Error(\"Attempting to set AAD in unsupported state\");\n this._ghash.update(buf), this._alen += buf.length;\n }, module.exports = StreamCipher;\n }\n}), require_streamCipher = __commonJS({\n \"node_modules/browserify-aes/streamCipher.js\"(exports, module) {\n var aes = require_aes(), Buffer2 = require_safe_buffer().Buffer, Transform = require_cipher_base(), inherits = require_inherits_browser();\n function StreamCipher(mode, key2, iv, decrypt) {\n Transform.@call(this), this._cipher = new aes.AES(key2), this._prev = Buffer2.from(iv), this._cache = Buffer2.allocUnsafe(0), this._secCache = Buffer2.allocUnsafe(0), this._decrypt = decrypt, this._mode = mode;\n }\n inherits(StreamCipher, Transform), StreamCipher.prototype._update = function(chunk) {\n return this._mode.encrypt(this, chunk, this._decrypt);\n }, StreamCipher.prototype._final = function() {\n this._cipher.scrub();\n }, module.exports = StreamCipher;\n }\n}), require_evp_bytestokey = __commonJS({\n \"node_modules/evp_bytestokey/index.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer, MD5 = require_md5();\n function EVP_BytesToKey(password, salt, keyBits, ivLen) {\n if (Buffer2.isBuffer(password) || (password = Buffer2.from(password, \"binary\")), salt && (Buffer2.isBuffer(salt) || (salt = Buffer2.from(salt, \"binary\")), salt.length !== 8))\n @throwRangeError(\"salt should be Buffer with 8 byte length\");\n for (var keyLen = keyBits / 8, key2 = Buffer2.alloc(keyLen), iv = Buffer2.alloc(ivLen || 0), tmp = Buffer2.alloc(0);keyLen > 0 || ivLen > 0; ) {\n var hash = new MD5;\n hash.update(tmp), hash.update(password), salt && hash.update(salt), tmp = hash.digest();\n var used = 0;\n if (keyLen > 0) {\n var keyStart = key2.length - keyLen;\n used = Math.min(keyLen, tmp.length), tmp.copy(key2, keyStart, 0, used), keyLen -= used;\n }\n if (used < tmp.length && ivLen > 0) {\n var ivStart = iv.length - ivLen, length = Math.min(ivLen, tmp.length - used);\n tmp.copy(iv, ivStart, used, used + length), ivLen -= length;\n }\n }\n return tmp.fill(0), { key: key2, iv };\n }\n module.exports = EVP_BytesToKey;\n }\n}), require_encrypter = __commonJS({\n \"node_modules/browserify-aes/encrypter.js\"(exports) {\n var MODES = require_modes(), AuthCipher = require_authCipher(), Buffer2 = require_safe_buffer().Buffer, StreamCipher = require_streamCipher(), Transform = require_cipher_base(), aes = require_aes(), ebtk = require_evp_bytestokey(), inherits = require_inherits_browser();\n function Cipher(mode, key2, iv) {\n Transform.@call(this), this._cache = new Splitter, this._cipher = new aes.AES(key2), this._prev = Buffer2.from(iv), this._mode = mode, this._autopadding = !0;\n }\n inherits(Cipher, Transform), Cipher.prototype._update = function(data) {\n this._cache.add(data);\n for (var chunk, thing, out = [];chunk = this._cache.get(); )\n thing = this._mode.encrypt(this, chunk), out.push(thing);\n return Buffer2.concat(out);\n };\n var PADDING = Buffer2.alloc(16, 16);\n Cipher.prototype._final = function() {\n var chunk = this._cache.flush();\n if (this._autopadding)\n return chunk = this._mode.encrypt(this, chunk), this._cipher.scrub(), chunk;\n if (!chunk.equals(PADDING))\n throw this._cipher.scrub(), new Error(\"data not multiple of block length\");\n }, Cipher.prototype.setAutoPadding = function(setTo) {\n return this._autopadding = !!setTo, this;\n };\n function Splitter() {\n this.cache = Buffer2.allocUnsafe(0);\n }\n Splitter.prototype = {}, Splitter.prototype.add = function(data) {\n this.cache = Buffer2.concat([this.cache, data]);\n }, Splitter.prototype.get = function() {\n if (this.cache.length > 15) {\n var out = this.cache.slice(0, 16);\n return this.cache = this.cache.slice(16), out;\n }\n return null;\n }, Splitter.prototype.flush = function() {\n for (var len = 16 - this.cache.length, padBuff = Buffer2.allocUnsafe(len), i = -1;++i < len; )\n padBuff.writeUInt8(len, i);\n return Buffer2.concat([this.cache, padBuff]);\n };\n function createCipheriv(suite, password, iv) {\n var config = MODES[suite.toLowerCase()];\n if (!config)\n @throwTypeError(\"invalid suite type\");\n password = getArrayBufferOrView(password, \"password\");\n const iv_length = iv\?.length || 0, required_iv_length = config.iv || 0;\n if (iv = iv === null \? EMPTY_BUFFER : getArrayBufferOrView(iv, \"iv\"), password\?.length !== config.key / 8) {\n var error = new RangeError(\"Invalid key length\");\n throw error.code = \"ERR_CRYPTO_INVALID_KEYLEN\", error;\n }\n if (config.mode !== \"GCM\" && iv_length !== required_iv_length) {\n var error = new RangeError(\"Invalid key length\");\n throw error.code = \"ERR_CRYPTO_INVALID_KEYLEN\", error;\n }\n return config.type === \"stream\" \? new StreamCipher(config.module, password, iv) : config.type === \"auth\" \? new AuthCipher(config.module, password, iv) : new Cipher(config.module, password, iv);\n }\n function createCipher(suite, password) {\n var config = MODES[suite.toLowerCase()];\n if (!config)\n @throwTypeError(\"invalid suite type\");\n var keys = ebtk(password, !1, config.key, config.iv);\n return createCipheriv(suite, keys.key, keys.iv);\n }\n exports.createCipheriv = createCipheriv, exports.createCipher = createCipher;\n }\n}), require_decrypter = __commonJS({\n \"node_modules/browserify-aes/decrypter.js\"(exports) {\n var AuthCipher = require_authCipher(), Buffer2 = require_safe_buffer().Buffer, MODES = require_modes(), StreamCipher = require_streamCipher(), Transform = require_cipher_base(), aes = require_aes(), ebtk = require_evp_bytestokey(), inherits = require_inherits_browser();\n function Decipher(mode, key2, iv) {\n Transform.@call(this), this._cache = new Splitter, this._last = void 0, this._cipher = new aes.AES(key2), this._prev = Buffer2.from(iv), this._mode = mode, this._autopadding = !0;\n }\n inherits(Decipher, Transform), Decipher.prototype._update = function(data) {\n this._cache.add(data);\n for (var chunk, thing, out = [];chunk = this._cache.get(this._autopadding); )\n thing = this._mode.decrypt(this, chunk), out.push(thing);\n return Buffer2.concat(out);\n }, Decipher.prototype._final = function() {\n var chunk = this._cache.flush();\n if (this._autopadding)\n return unpad(this._mode.decrypt(this, chunk));\n if (chunk)\n throw new Error(\"data not multiple of block length\");\n }, Decipher.prototype.setAutoPadding = function(setTo) {\n return this._autopadding = !!setTo, this;\n };\n function Splitter() {\n this.cache = Buffer2.allocUnsafe(0);\n }\n Splitter.prototype = {}, Splitter.prototype.add = function(data) {\n this.cache = Buffer2.concat([this.cache, data]);\n }, Splitter.prototype.get = function(autoPadding) {\n var out;\n if (autoPadding) {\n if (this.cache.length > 16)\n return out = this.cache.slice(0, 16), this.cache = this.cache.slice(16), out;\n } else if (this.cache.length >= 16)\n return out = this.cache.slice(0, 16), this.cache = this.cache.slice(16), out;\n return null;\n }, Splitter.prototype.flush = function() {\n if (this.cache.length)\n return this.cache;\n };\n function unpad(last) {\n var padded = last[15];\n if (padded < 1 || padded > 16)\n throw new Error(\"unable to decrypt data\");\n for (var i = -1;++i < padded; )\n if (last[i + (16 - padded)] !== padded)\n throw new Error(\"unable to decrypt data\");\n if (padded !== 16)\n return last.slice(0, 16 - padded);\n }\n function createDecipheriv(suite, password, iv) {\n var config = MODES[suite.toLowerCase()];\n if (!config)\n @throwTypeError(\"invalid suite type\");\n password = getArrayBufferOrView(password, \"password\");\n const iv_length = iv\?.length || 0, required_iv_length = config.iv || 0;\n if (iv = iv === null \? EMPTY_BUFFER : getArrayBufferOrView(iv, \"iv\"), config.mode !== \"GCM\" && iv_length !== required_iv_length) {\n var error = new RangeError(\"Invalid key length\");\n throw error.code = \"ERR_CRYPTO_INVALID_KEYLEN\", error;\n }\n if (password.length !== config.key / 8) {\n var error = new RangeError(\"Invalid key length\");\n throw error.code = \"ERR_CRYPTO_INVALID_KEYLEN\", error;\n }\n return config.type === \"stream\" \? new StreamCipher(config.module, password, iv, !0) : config.type === \"auth\" \? new AuthCipher(config.module, password, iv, !0) : new Decipher(config.module, password, iv);\n }\n function createDecipher(suite, password) {\n var config = MODES[suite.toLowerCase()];\n if (!config)\n @throwTypeError(\"invalid suite type\");\n var keys = ebtk(password, !1, config.key, config.iv);\n return createDecipheriv(suite, keys.key, keys.iv);\n }\n exports.createDecipher = createDecipher, exports.createDecipheriv = createDecipheriv;\n }\n}), require_browser5 = __commonJS({\n \"node_modules/browserify-aes/browser.js\"(exports) {\n var ciphers = require_encrypter(), deciphers = require_decrypter(), modes = require_list();\n function getCiphers() {\n return Object.keys(modes);\n }\n exports.createCipher = exports.Cipher = ciphers.createCipher, exports.createCipheriv = exports.Cipheriv = ciphers.createCipheriv, exports.createDecipher = exports.Decipher = deciphers.createDecipher, exports.createDecipheriv = exports.Decipheriv = deciphers.createDecipheriv, exports.listCiphers = exports.getCiphers = getCiphers;\n }\n}), require_modes2 = __commonJS({\n \"node_modules/browserify-des/modes.js\"(exports) {\n exports[\"des-ecb\"] = {\n key: 8,\n iv: 0\n }, exports[\"des-cbc\"] = exports.des = {\n key: 8,\n iv: 8\n }, exports[\"des-ede3-cbc\"] = exports.des3 = {\n key: 24,\n iv: 8\n }, exports[\"des-ede3\"] = {\n key: 24,\n iv: 0\n }, exports[\"des-ede-cbc\"] = {\n key: 16,\n iv: 8\n }, exports[\"des-ede\"] = {\n key: 16,\n iv: 0\n };\n }\n}), require_browser6 = __commonJS({\n \"node_modules/browserify-cipher/browser.js\"(exports) {\n var DES = require_browserify_des(), aes = require_browser5(), aesModes = require_modes(), desModes = require_modes2(), ebtk = require_evp_bytestokey();\n function createCipher(suite, password) {\n suite = suite.toLowerCase();\n var keyLen, ivLen;\n if (aesModes[suite])\n keyLen = aesModes[suite].key, ivLen = aesModes[suite].iv;\n else if (desModes[suite])\n keyLen = desModes[suite].key * 8, ivLen = desModes[suite].iv;\n else\n @throwTypeError(\"invalid suite type\");\n var keys = ebtk(password, !1, keyLen, ivLen);\n return createCipheriv(suite, keys.key, keys.iv);\n }\n function createDecipher(suite, password) {\n suite = suite.toLowerCase();\n var keyLen, ivLen;\n if (aesModes[suite])\n keyLen = aesModes[suite].key, ivLen = aesModes[suite].iv;\n else if (desModes[suite])\n keyLen = desModes[suite].key * 8, ivLen = desModes[suite].iv;\n else\n @throwTypeError(\"invalid suite type\");\n var keys = ebtk(password, !1, keyLen, ivLen);\n return createDecipheriv(suite, keys.key, keys.iv);\n }\n function createCipheriv(suite, key2, iv) {\n if (suite = suite.toLowerCase(), aesModes[suite])\n return aes.createCipheriv(suite, key2, iv);\n if (desModes[suite])\n return new DES({ key: key2, iv, mode: suite });\n @throwTypeError(\"invalid suite type\");\n }\n function createDecipheriv(suite, key2, iv) {\n if (suite = suite.toLowerCase(), aesModes[suite])\n return aes.createDecipheriv(suite, key2, iv);\n if (desModes[suite])\n return new DES({ key: key2, iv, mode: suite, decrypt: !0 });\n @throwTypeError(\"invalid suite type\");\n }\n function getCiphers() {\n return Object.keys(desModes).concat(aes.getCiphers());\n }\n exports.createCipher = exports.Cipher = createCipher, exports.createCipheriv = exports.Cipheriv = createCipheriv, exports.createDecipher = exports.Decipher = createDecipher, exports.createDecipheriv = exports.Decipheriv = createDecipheriv, exports.listCiphers = exports.getCiphers = getCiphers;\n }\n}), require_bn = __commonJS({\n \"node_modules/diffie-hellman/node_modules/bn.js/lib/bn.js\"(exports, module) {\n (function(module2, exports2) {\n function assert(val, msg) {\n if (!val)\n throw new Error(msg || \"Assertion failed\");\n }\n function inherits(ctor, superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function() {\n };\n TempCtor.prototype = superCtor.prototype, ctor.prototype = new TempCtor, ctor.prototype.constructor = ctor;\n }\n function BN(number, base, endian) {\n if (BN.isBN(number))\n return number;\n this.negative = 0, this.words = null, this.length = 0, this.red = null, number !== null && ((base === \"le\" || base === \"be\") && (endian = base, base = 10), this._init(number || 0, base || 10, endian || \"be\"));\n }\n BN.prototype = {}, typeof module2 == \"object\" \? module2.exports = BN : exports2.BN = BN, BN.BN = BN, BN.wordSize = 26;\n var Buffer2 = Buffer;\n BN.isBN = function(num) {\n return num instanceof BN \? !0 : num !== null && typeof num == \"object\" && num.constructor.wordSize === BN.wordSize && @Array.isArray(num.words);\n }, BN.max = function(left, right) {\n return left.cmp(right) > 0 \? left : right;\n }, BN.min = function(left, right) {\n return left.cmp(right) < 0 \? left : right;\n }, BN.prototype._init = function(number, base, endian) {\n if (typeof number == \"number\")\n return this._initNumber(number, base, endian);\n if (typeof number == \"object\")\n return this._initArray(number, base, endian);\n base === \"hex\" && (base = 16), assert(base === (base | 0) && base >= 2 && base <= 36), number = number.toString().replace(/\\s+/g, \"\");\n var start = 0;\n number[0] === \"-\" && (start++, this.negative = 1), start < number.length && (base === 16 \? this._parseHex(number, start, endian) : (this._parseBase(number, base, start), endian === \"le\" && this._initArray(this.toArray(), base, endian)));\n }, BN.prototype._initNumber = function(number, base, endian) {\n number < 0 && (this.negative = 1, number = -number), number < 67108864 \? (this.words = [number & 67108863], this.length = 1) : number < 4503599627370496 \? (this.words = [number & 67108863, number / 67108864 & 67108863], this.length = 2) : (assert(number < 9007199254740992), this.words = [number & 67108863, number / 67108864 & 67108863, 1], this.length = 3), endian === \"le\" && this._initArray(this.toArray(), base, endian);\n }, BN.prototype._initArray = function(number, base, endian) {\n if (assert(typeof number.length == \"number\"), number.length <= 0)\n return this.words = [0], this.length = 1, this;\n this.length = Math.ceil(number.length / 3), this.words = new @Array(this.length);\n for (var i = 0;i < this.length; i++)\n this.words[i] = 0;\n var j, w, off = 0;\n if (endian === \"be\")\n for (i = number.length - 1, j = 0;i >= 0; i -= 3)\n w = number[i] | number[i - 1] << 8 | number[i - 2] << 16, this.words[j] |= w << off & 67108863, this.words[j + 1] = w >>> 26 - off & 67108863, off += 24, off >= 26 && (off -= 26, j++);\n else if (endian === \"le\")\n for (i = 0, j = 0;i < number.length; i += 3)\n w = number[i] | number[i + 1] << 8 | number[i + 2] << 16, this.words[j] |= w << off & 67108863, this.words[j + 1] = w >>> 26 - off & 67108863, off += 24, off >= 26 && (off -= 26, j++);\n return this.strip();\n };\n function parseHex4Bits(string, index) {\n var c = string.charCodeAt(index);\n return c >= 65 && c <= 70 \? c - 55 : c >= 97 && c <= 102 \? c - 87 : c - 48 & 15;\n }\n function parseHexByte(string, lowerBound, index) {\n var r = parseHex4Bits(string, index);\n return index - 1 >= lowerBound && (r |= parseHex4Bits(string, index - 1) << 4), r;\n }\n BN.prototype._parseHex = function(number, start, endian) {\n this.length = Math.ceil((number.length - start) / 6), this.words = new @Array(this.length);\n for (var i = 0;i < this.length; i++)\n this.words[i] = 0;\n var off = 0, j = 0, w;\n if (endian === \"be\")\n for (i = number.length - 1;i >= start; i -= 2)\n w = parseHexByte(number, start, i) << off, this.words[j] |= w & 67108863, off >= 18 \? (off -= 18, j += 1, this.words[j] |= w >>> 26) : off += 8;\n else {\n var parseLength = number.length - start;\n for (i = parseLength % 2 === 0 \? start + 1 : start;i < number.length; i += 2)\n w = parseHexByte(number, start, i) << off, this.words[j] |= w & 67108863, off >= 18 \? (off -= 18, j += 1, this.words[j] |= w >>> 26) : off += 8;\n }\n this.strip();\n };\n function parseBase(str, start, end, mul) {\n for (var r = 0, len = Math.min(str.length, end), i = start;i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n r *= mul, c >= 49 \? r += c - 49 + 10 : c >= 17 \? r += c - 17 + 10 : r += c;\n }\n return r;\n }\n BN.prototype._parseBase = function(number, base, start) {\n this.words = [0], this.length = 1;\n for (var limbLen = 0, limbPow = 1;limbPow <= 67108863; limbPow *= base)\n limbLen++;\n limbLen--, limbPow = limbPow / base | 0;\n for (var total = number.length - start, mod = total % limbLen, end = Math.min(total, total - mod) + start, word = 0, i = start;i < end; i += limbLen)\n word = parseBase(number, i, i + limbLen, base), this.imuln(limbPow), this.words[0] + word < 67108864 \? this.words[0] += word : this._iaddn(word);\n if (mod !== 0) {\n var pow = 1;\n for (word = parseBase(number, i, number.length, base), i = 0;i < mod; i++)\n pow *= base;\n this.imuln(pow), this.words[0] + word < 67108864 \? this.words[0] += word : this._iaddn(word);\n }\n this.strip();\n }, BN.prototype.copy = function(dest) {\n dest.words = new @Array(this.length);\n for (var i = 0;i < this.length; i++)\n dest.words[i] = this.words[i];\n dest.length = this.length, dest.negative = this.negative, dest.red = this.red;\n }, BN.prototype.clone = function() {\n var r = new BN(null);\n return this.copy(r), r;\n }, BN.prototype._expand = function(size) {\n for (;this.length < size; )\n this.words[this.length++] = 0;\n return this;\n }, BN.prototype.strip = function() {\n for (;this.length > 1 && this.words[this.length - 1] === 0; )\n this.length--;\n return this._normSign();\n }, BN.prototype._normSign = function() {\n return this.length === 1 && this.words[0] === 0 && (this.negative = 0), this;\n }, BN.prototype.inspect = function() {\n return (this.red \? \"\";\n };\n var zeros = [\n \"\",\n \"0\",\n \"00\",\n \"000\",\n \"0000\",\n \"00000\",\n \"000000\",\n \"0000000\",\n \"00000000\",\n \"000000000\",\n \"0000000000\",\n \"00000000000\",\n \"000000000000\",\n \"0000000000000\",\n \"00000000000000\",\n \"000000000000000\",\n \"0000000000000000\",\n \"00000000000000000\",\n \"000000000000000000\",\n \"0000000000000000000\",\n \"00000000000000000000\",\n \"000000000000000000000\",\n \"0000000000000000000000\",\n \"00000000000000000000000\",\n \"000000000000000000000000\",\n \"0000000000000000000000000\"\n ], groupSizes = [\n 0,\n 0,\n 25,\n 16,\n 12,\n 11,\n 10,\n 9,\n 8,\n 8,\n 7,\n 7,\n 7,\n 7,\n 6,\n 6,\n 6,\n 6,\n 6,\n 6,\n 6,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5\n ], groupBases = [\n 0,\n 0,\n 33554432,\n 43046721,\n 16777216,\n 48828125,\n 60466176,\n 40353607,\n 16777216,\n 43046721,\n 1e7,\n 19487171,\n 35831808,\n 62748517,\n 7529536,\n 11390625,\n 16777216,\n 24137569,\n 34012224,\n 47045881,\n 64000000,\n 4084101,\n 5153632,\n 6436343,\n 7962624,\n 9765625,\n 11881376,\n 14348907,\n 17210368,\n 20511149,\n 24300000,\n 28629151,\n 33554432,\n 39135393,\n 45435424,\n 52521875,\n 60466176\n ];\n BN.prototype.toString = function(base, padding) {\n base = base || 10, padding = padding | 0 || 1;\n var out;\n if (base === 16 || base === \"hex\") {\n out = \"\";\n for (var off = 0, carry = 0, i = 0;i < this.length; i++) {\n var w = this.words[i], word = ((w << off | carry) & 16777215).toString(16);\n carry = w >>> 24 - off & 16777215, carry !== 0 || i !== this.length - 1 \? out = zeros[6 - word.length] + word + out : out = word + out, off += 2, off >= 26 && (off -= 26, i--);\n }\n for (carry !== 0 && (out = carry.toString(16) + out);out.length % padding !== 0; )\n out = \"0\" + out;\n return this.negative !== 0 && (out = \"-\" + out), out;\n }\n if (base === (base | 0) && base >= 2 && base <= 36) {\n var groupSize = groupSizes[base], groupBase = groupBases[base];\n out = \"\";\n var c = this.clone();\n for (c.negative = 0;!c.isZero(); ) {\n var r = c.modn(groupBase).toString(base);\n c = c.idivn(groupBase), c.isZero() \? out = r + out : out = zeros[groupSize - r.length] + r + out;\n }\n for (this.isZero() && (out = \"0\" + out);out.length % padding !== 0; )\n out = \"0\" + out;\n return this.negative !== 0 && (out = \"-\" + out), out;\n }\n assert(!1, \"Base should be between 2 and 36\");\n }, BN.prototype.toNumber = function() {\n var ret = this.words[0];\n return this.length === 2 \? ret += this.words[1] * 67108864 : this.length === 3 && this.words[2] === 1 \? ret += 4503599627370496 + this.words[1] * 67108864 : this.length > 2 && assert(!1, \"Number can only safely store up to 53 bits\"), this.negative !== 0 \? -ret : ret;\n }, BN.prototype.toJSON = function() {\n return this.toString(16);\n }, BN.prototype.toBuffer = function(endian, length) {\n return assert(typeof Buffer2 < \"u\"), this.toArrayLike(Buffer2, endian, length);\n }, BN.prototype.toArray = function(endian, length) {\n return this.toArrayLike(@Array, endian, length);\n }, BN.prototype.toArrayLike = function(ArrayType, endian, length) {\n var byteLength = this.byteLength(), reqLength = length || Math.max(1, byteLength);\n assert(byteLength <= reqLength, \"byte array longer than desired length\"), assert(reqLength > 0, \"Requested array length <= 0\"), this.strip();\n var littleEndian = endian === \"le\", res = new ArrayType(reqLength), b, i, q = this.clone();\n if (littleEndian) {\n for (i = 0;!q.isZero(); i++)\n b = q.andln(255), q.iushrn(8), res[i] = b;\n for (;i < reqLength; i++)\n res[i] = 0;\n } else {\n for (i = 0;i < reqLength - byteLength; i++)\n res[i] = 0;\n for (i = 0;!q.isZero(); i++)\n b = q.andln(255), q.iushrn(8), res[reqLength - i - 1] = b;\n }\n return res;\n }, Math.clz32 \? BN.prototype._countBits = function(w) {\n return 32 - Math.clz32(w);\n } : BN.prototype._countBits = function(w) {\n var t = w, r = 0;\n return t >= 4096 && (r += 13, t >>>= 13), t >= 64 && (r += 7, t >>>= 7), t >= 8 && (r += 4, t >>>= 4), t >= 2 && (r += 2, t >>>= 2), r + t;\n }, BN.prototype._zeroBits = function(w) {\n if (w === 0)\n return 26;\n var t = w, r = 0;\n return (t & 8191) === 0 && (r += 13, t >>>= 13), (t & 127) === 0 && (r += 7, t >>>= 7), (t & 15) === 0 && (r += 4, t >>>= 4), (t & 3) === 0 && (r += 2, t >>>= 2), (t & 1) === 0 && r++, r;\n }, BN.prototype.bitLength = function() {\n var w = this.words[this.length - 1], hi = this._countBits(w);\n return (this.length - 1) * 26 + hi;\n };\n function toBitArray(num) {\n for (var w = new @Array(num.bitLength()), bit = 0;bit < w.length; bit++) {\n var off = bit / 26 | 0, wbit = bit % 26;\n w[bit] = (num.words[off] & 1 << wbit) >>> wbit;\n }\n return w;\n }\n BN.prototype.zeroBits = function() {\n if (this.isZero())\n return 0;\n for (var r = 0, i = 0;i < this.length; i++) {\n var b = this._zeroBits(this.words[i]);\n if (r += b, b !== 26)\n break;\n }\n return r;\n }, BN.prototype.byteLength = function() {\n return Math.ceil(this.bitLength() / 8);\n }, BN.prototype.toTwos = function(width) {\n return this.negative !== 0 \? this.abs().inotn(width).iaddn(1) : this.clone();\n }, BN.prototype.fromTwos = function(width) {\n return this.testn(width - 1) \? this.notn(width).iaddn(1).ineg() : this.clone();\n }, BN.prototype.isNeg = function() {\n return this.negative !== 0;\n }, BN.prototype.neg = function() {\n return this.clone().ineg();\n }, BN.prototype.ineg = function() {\n return this.isZero() || (this.negative ^= 1), this;\n }, BN.prototype.iuor = function(num) {\n for (;this.length < num.length; )\n this.words[this.length++] = 0;\n for (var i = 0;i < num.length; i++)\n this.words[i] = this.words[i] | num.words[i];\n return this.strip();\n }, BN.prototype.ior = function(num) {\n return assert((this.negative | num.negative) === 0), this.iuor(num);\n }, BN.prototype.or = function(num) {\n return this.length > num.length \? this.clone().ior(num) : num.clone().ior(this);\n }, BN.prototype.uor = function(num) {\n return this.length > num.length \? this.clone().iuor(num) : num.clone().iuor(this);\n }, BN.prototype.iuand = function(num) {\n var b;\n this.length > num.length \? b = num : b = this;\n for (var i = 0;i < b.length; i++)\n this.words[i] = this.words[i] & num.words[i];\n return this.length = b.length, this.strip();\n }, BN.prototype.iand = function(num) {\n return assert((this.negative | num.negative) === 0), this.iuand(num);\n }, BN.prototype.and = function(num) {\n return this.length > num.length \? this.clone().iand(num) : num.clone().iand(this);\n }, BN.prototype.uand = function(num) {\n return this.length > num.length \? this.clone().iuand(num) : num.clone().iuand(this);\n }, BN.prototype.iuxor = function(num) {\n var a, b;\n this.length > num.length \? (a = this, b = num) : (a = num, b = this);\n for (var i = 0;i < b.length; i++)\n this.words[i] = a.words[i] ^ b.words[i];\n if (this !== a)\n for (;i < a.length; i++)\n this.words[i] = a.words[i];\n return this.length = a.length, this.strip();\n }, BN.prototype.ixor = function(num) {\n return assert((this.negative | num.negative) === 0), this.iuxor(num);\n }, BN.prototype.xor = function(num) {\n return this.length > num.length \? this.clone().ixor(num) : num.clone().ixor(this);\n }, BN.prototype.uxor = function(num) {\n return this.length > num.length \? this.clone().iuxor(num) : num.clone().iuxor(this);\n }, BN.prototype.inotn = function(width) {\n assert(typeof width == \"number\" && width >= 0);\n var bytesNeeded = Math.ceil(width / 26) | 0, bitsLeft = width % 26;\n this._expand(bytesNeeded), bitsLeft > 0 && bytesNeeded--;\n for (var i = 0;i < bytesNeeded; i++)\n this.words[i] = ~this.words[i] & 67108863;\n return bitsLeft > 0 && (this.words[i] = ~this.words[i] & 67108863 >> 26 - bitsLeft), this.strip();\n }, BN.prototype.notn = function(width) {\n return this.clone().inotn(width);\n }, BN.prototype.setn = function(bit, val) {\n assert(typeof bit == \"number\" && bit >= 0);\n var off = bit / 26 | 0, wbit = bit % 26;\n return this._expand(off + 1), val \? this.words[off] = this.words[off] | 1 << wbit : this.words[off] = this.words[off] & ~(1 << wbit), this.strip();\n }, BN.prototype.iadd = function(num) {\n var r;\n if (this.negative !== 0 && num.negative === 0)\n return this.negative = 0, r = this.isub(num), this.negative ^= 1, this._normSign();\n if (this.negative === 0 && num.negative !== 0)\n return num.negative = 0, r = this.isub(num), num.negative = 1, r._normSign();\n var a, b;\n this.length > num.length \? (a = this, b = num) : (a = num, b = this);\n for (var carry = 0, i = 0;i < b.length; i++)\n r = (a.words[i] | 0) + (b.words[i] | 0) + carry, this.words[i] = r & 67108863, carry = r >>> 26;\n for (;carry !== 0 && i < a.length; i++)\n r = (a.words[i] | 0) + carry, this.words[i] = r & 67108863, carry = r >>> 26;\n if (this.length = a.length, carry !== 0)\n this.words[this.length] = carry, this.length++;\n else if (a !== this)\n for (;i < a.length; i++)\n this.words[i] = a.words[i];\n return this;\n }, BN.prototype.add = function(num) {\n var res;\n return num.negative !== 0 && this.negative === 0 \? (num.negative = 0, res = this.sub(num), num.negative ^= 1, res) : num.negative === 0 && this.negative !== 0 \? (this.negative = 0, res = num.sub(this), this.negative = 1, res) : this.length > num.length \? this.clone().iadd(num) : num.clone().iadd(this);\n }, BN.prototype.isub = function(num) {\n if (num.negative !== 0) {\n num.negative = 0;\n var r = this.iadd(num);\n return num.negative = 1, r._normSign();\n } else if (this.negative !== 0)\n return this.negative = 0, this.iadd(num), this.negative = 1, this._normSign();\n var cmp = this.cmp(num);\n if (cmp === 0)\n return this.negative = 0, this.length = 1, this.words[0] = 0, this;\n var a, b;\n cmp > 0 \? (a = this, b = num) : (a = num, b = this);\n for (var carry = 0, i = 0;i < b.length; i++)\n r = (a.words[i] | 0) - (b.words[i] | 0) + carry, carry = r >> 26, this.words[i] = r & 67108863;\n for (;carry !== 0 && i < a.length; i++)\n r = (a.words[i] | 0) + carry, carry = r >> 26, this.words[i] = r & 67108863;\n if (carry === 0 && i < a.length && a !== this)\n for (;i < a.length; i++)\n this.words[i] = a.words[i];\n return this.length = Math.max(this.length, i), a !== this && (this.negative = 1), this.strip();\n }, BN.prototype.sub = function(num) {\n return this.clone().isub(num);\n };\n function smallMulTo(self2, num, out) {\n out.negative = num.negative ^ self2.negative;\n var len = self2.length + num.length | 0;\n out.length = len, len = len - 1 | 0;\n var a = self2.words[0] | 0, b = num.words[0] | 0, r = a * b, lo = r & 67108863, carry = r / 67108864 | 0;\n out.words[0] = lo;\n for (var k = 1;k < len; k++) {\n for (var ncarry = carry >>> 26, rword = carry & 67108863, maxJ = Math.min(k, num.length - 1), j = Math.max(0, k - self2.length + 1);j <= maxJ; j++) {\n var i = k - j | 0;\n a = self2.words[i] | 0, b = num.words[j] | 0, r = a * b + rword, ncarry += r / 67108864 | 0, rword = r & 67108863;\n }\n out.words[k] = rword | 0, carry = ncarry | 0;\n }\n return carry !== 0 \? out.words[k] = carry | 0 : out.length--, out.strip();\n }\n var comb10MulTo = function(self2, num, out) {\n var a = self2.words, b = num.words, o = out.words, c = 0, lo, mid, hi, a0 = a[0] | 0, al0 = a0 & 8191, ah0 = a0 >>> 13, a1 = a[1] | 0, al1 = a1 & 8191, ah1 = a1 >>> 13, a2 = a[2] | 0, al2 = a2 & 8191, ah2 = a2 >>> 13, a3 = a[3] | 0, al3 = a3 & 8191, ah3 = a3 >>> 13, a4 = a[4] | 0, al4 = a4 & 8191, ah4 = a4 >>> 13, a5 = a[5] | 0, al5 = a5 & 8191, ah5 = a5 >>> 13, a6 = a[6] | 0, al6 = a6 & 8191, ah6 = a6 >>> 13, a7 = a[7] | 0, al7 = a7 & 8191, ah7 = a7 >>> 13, a8 = a[8] | 0, al8 = a8 & 8191, ah8 = a8 >>> 13, a9 = a[9] | 0, al9 = a9 & 8191, ah9 = a9 >>> 13, b0 = b[0] | 0, bl0 = b0 & 8191, bh0 = b0 >>> 13, b1 = b[1] | 0, bl1 = b1 & 8191, bh1 = b1 >>> 13, b2 = b[2] | 0, bl2 = b2 & 8191, bh2 = b2 >>> 13, b3 = b[3] | 0, bl3 = b3 & 8191, bh3 = b3 >>> 13, b4 = b[4] | 0, bl4 = b4 & 8191, bh4 = b4 >>> 13, b5 = b[5] | 0, bl5 = b5 & 8191, bh5 = b5 >>> 13, b6 = b[6] | 0, bl6 = b6 & 8191, bh6 = b6 >>> 13, b7 = b[7] | 0, bl7 = b7 & 8191, bh7 = b7 >>> 13, b8 = b[8] | 0, bl8 = b8 & 8191, bh8 = b8 >>> 13, b9 = b[9] | 0, bl9 = b9 & 8191, bh9 = b9 >>> 13;\n out.negative = self2.negative ^ num.negative, out.length = 19, lo = Math.imul(al0, bl0), mid = Math.imul(al0, bh0), mid = mid + Math.imul(ah0, bl0) | 0, hi = Math.imul(ah0, bh0);\n var w0 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w0 >>> 26) | 0, w0 &= 67108863, lo = Math.imul(al1, bl0), mid = Math.imul(al1, bh0), mid = mid + Math.imul(ah1, bl0) | 0, hi = Math.imul(ah1, bh0), lo = lo + Math.imul(al0, bl1) | 0, mid = mid + Math.imul(al0, bh1) | 0, mid = mid + Math.imul(ah0, bl1) | 0, hi = hi + Math.imul(ah0, bh1) | 0;\n var w1 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w1 >>> 26) | 0, w1 &= 67108863, lo = Math.imul(al2, bl0), mid = Math.imul(al2, bh0), mid = mid + Math.imul(ah2, bl0) | 0, hi = Math.imul(ah2, bh0), lo = lo + Math.imul(al1, bl1) | 0, mid = mid + Math.imul(al1, bh1) | 0, mid = mid + Math.imul(ah1, bl1) | 0, hi = hi + Math.imul(ah1, bh1) | 0, lo = lo + Math.imul(al0, bl2) | 0, mid = mid + Math.imul(al0, bh2) | 0, mid = mid + Math.imul(ah0, bl2) | 0, hi = hi + Math.imul(ah0, bh2) | 0;\n var w2 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w2 >>> 26) | 0, w2 &= 67108863, lo = Math.imul(al3, bl0), mid = Math.imul(al3, bh0), mid = mid + Math.imul(ah3, bl0) | 0, hi = Math.imul(ah3, bh0), lo = lo + Math.imul(al2, bl1) | 0, mid = mid + Math.imul(al2, bh1) | 0, mid = mid + Math.imul(ah2, bl1) | 0, hi = hi + Math.imul(ah2, bh1) | 0, lo = lo + Math.imul(al1, bl2) | 0, mid = mid + Math.imul(al1, bh2) | 0, mid = mid + Math.imul(ah1, bl2) | 0, hi = hi + Math.imul(ah1, bh2) | 0, lo = lo + Math.imul(al0, bl3) | 0, mid = mid + Math.imul(al0, bh3) | 0, mid = mid + Math.imul(ah0, bl3) | 0, hi = hi + Math.imul(ah0, bh3) | 0;\n var w3 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w3 >>> 26) | 0, w3 &= 67108863, lo = Math.imul(al4, bl0), mid = Math.imul(al4, bh0), mid = mid + Math.imul(ah4, bl0) | 0, hi = Math.imul(ah4, bh0), lo = lo + Math.imul(al3, bl1) | 0, mid = mid + Math.imul(al3, bh1) | 0, mid = mid + Math.imul(ah3, bl1) | 0, hi = hi + Math.imul(ah3, bh1) | 0, lo = lo + Math.imul(al2, bl2) | 0, mid = mid + Math.imul(al2, bh2) | 0, mid = mid + Math.imul(ah2, bl2) | 0, hi = hi + Math.imul(ah2, bh2) | 0, lo = lo + Math.imul(al1, bl3) | 0, mid = mid + Math.imul(al1, bh3) | 0, mid = mid + Math.imul(ah1, bl3) | 0, hi = hi + Math.imul(ah1, bh3) | 0, lo = lo + Math.imul(al0, bl4) | 0, mid = mid + Math.imul(al0, bh4) | 0, mid = mid + Math.imul(ah0, bl4) | 0, hi = hi + Math.imul(ah0, bh4) | 0;\n var w4 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w4 >>> 26) | 0, w4 &= 67108863, lo = Math.imul(al5, bl0), mid = Math.imul(al5, bh0), mid = mid + Math.imul(ah5, bl0) | 0, hi = Math.imul(ah5, bh0), lo = lo + Math.imul(al4, bl1) | 0, mid = mid + Math.imul(al4, bh1) | 0, mid = mid + Math.imul(ah4, bl1) | 0, hi = hi + Math.imul(ah4, bh1) | 0, lo = lo + Math.imul(al3, bl2) | 0, mid = mid + Math.imul(al3, bh2) | 0, mid = mid + Math.imul(ah3, bl2) | 0, hi = hi + Math.imul(ah3, bh2) | 0, lo = lo + Math.imul(al2, bl3) | 0, mid = mid + Math.imul(al2, bh3) | 0, mid = mid + Math.imul(ah2, bl3) | 0, hi = hi + Math.imul(ah2, bh3) | 0, lo = lo + Math.imul(al1, bl4) | 0, mid = mid + Math.imul(al1, bh4) | 0, mid = mid + Math.imul(ah1, bl4) | 0, hi = hi + Math.imul(ah1, bh4) | 0, lo = lo + Math.imul(al0, bl5) | 0, mid = mid + Math.imul(al0, bh5) | 0, mid = mid + Math.imul(ah0, bl5) | 0, hi = hi + Math.imul(ah0, bh5) | 0;\n var w5 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w5 >>> 26) | 0, w5 &= 67108863, lo = Math.imul(al6, bl0), mid = Math.imul(al6, bh0), mid = mid + Math.imul(ah6, bl0) | 0, hi = Math.imul(ah6, bh0), lo = lo + Math.imul(al5, bl1) | 0, mid = mid + Math.imul(al5, bh1) | 0, mid = mid + Math.imul(ah5, bl1) | 0, hi = hi + Math.imul(ah5, bh1) | 0, lo = lo + Math.imul(al4, bl2) | 0, mid = mid + Math.imul(al4, bh2) | 0, mid = mid + Math.imul(ah4, bl2) | 0, hi = hi + Math.imul(ah4, bh2) | 0, lo = lo + Math.imul(al3, bl3) | 0, mid = mid + Math.imul(al3, bh3) | 0, mid = mid + Math.imul(ah3, bl3) | 0, hi = hi + Math.imul(ah3, bh3) | 0, lo = lo + Math.imul(al2, bl4) | 0, mid = mid + Math.imul(al2, bh4) | 0, mid = mid + Math.imul(ah2, bl4) | 0, hi = hi + Math.imul(ah2, bh4) | 0, lo = lo + Math.imul(al1, bl5) | 0, mid = mid + Math.imul(al1, bh5) | 0, mid = mid + Math.imul(ah1, bl5) | 0, hi = hi + Math.imul(ah1, bh5) | 0, lo = lo + Math.imul(al0, bl6) | 0, mid = mid + Math.imul(al0, bh6) | 0, mid = mid + Math.imul(ah0, bl6) | 0, hi = hi + Math.imul(ah0, bh6) | 0;\n var w6 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w6 >>> 26) | 0, w6 &= 67108863, lo = Math.imul(al7, bl0), mid = Math.imul(al7, bh0), mid = mid + Math.imul(ah7, bl0) | 0, hi = Math.imul(ah7, bh0), lo = lo + Math.imul(al6, bl1) | 0, mid = mid + Math.imul(al6, bh1) | 0, mid = mid + Math.imul(ah6, bl1) | 0, hi = hi + Math.imul(ah6, bh1) | 0, lo = lo + Math.imul(al5, bl2) | 0, mid = mid + Math.imul(al5, bh2) | 0, mid = mid + Math.imul(ah5, bl2) | 0, hi = hi + Math.imul(ah5, bh2) | 0, lo = lo + Math.imul(al4, bl3) | 0, mid = mid + Math.imul(al4, bh3) | 0, mid = mid + Math.imul(ah4, bl3) | 0, hi = hi + Math.imul(ah4, bh3) | 0, lo = lo + Math.imul(al3, bl4) | 0, mid = mid + Math.imul(al3, bh4) | 0, mid = mid + Math.imul(ah3, bl4) | 0, hi = hi + Math.imul(ah3, bh4) | 0, lo = lo + Math.imul(al2, bl5) | 0, mid = mid + Math.imul(al2, bh5) | 0, mid = mid + Math.imul(ah2, bl5) | 0, hi = hi + Math.imul(ah2, bh5) | 0, lo = lo + Math.imul(al1, bl6) | 0, mid = mid + Math.imul(al1, bh6) | 0, mid = mid + Math.imul(ah1, bl6) | 0, hi = hi + Math.imul(ah1, bh6) | 0, lo = lo + Math.imul(al0, bl7) | 0, mid = mid + Math.imul(al0, bh7) | 0, mid = mid + Math.imul(ah0, bl7) | 0, hi = hi + Math.imul(ah0, bh7) | 0;\n var w7 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w7 >>> 26) | 0, w7 &= 67108863, lo = Math.imul(al8, bl0), mid = Math.imul(al8, bh0), mid = mid + Math.imul(ah8, bl0) | 0, hi = Math.imul(ah8, bh0), lo = lo + Math.imul(al7, bl1) | 0, mid = mid + Math.imul(al7, bh1) | 0, mid = mid + Math.imul(ah7, bl1) | 0, hi = hi + Math.imul(ah7, bh1) | 0, lo = lo + Math.imul(al6, bl2) | 0, mid = mid + Math.imul(al6, bh2) | 0, mid = mid + Math.imul(ah6, bl2) | 0, hi = hi + Math.imul(ah6, bh2) | 0, lo = lo + Math.imul(al5, bl3) | 0, mid = mid + Math.imul(al5, bh3) | 0, mid = mid + Math.imul(ah5, bl3) | 0, hi = hi + Math.imul(ah5, bh3) | 0, lo = lo + Math.imul(al4, bl4) | 0, mid = mid + Math.imul(al4, bh4) | 0, mid = mid + Math.imul(ah4, bl4) | 0, hi = hi + Math.imul(ah4, bh4) | 0, lo = lo + Math.imul(al3, bl5) | 0, mid = mid + Math.imul(al3, bh5) | 0, mid = mid + Math.imul(ah3, bl5) | 0, hi = hi + Math.imul(ah3, bh5) | 0, lo = lo + Math.imul(al2, bl6) | 0, mid = mid + Math.imul(al2, bh6) | 0, mid = mid + Math.imul(ah2, bl6) | 0, hi = hi + Math.imul(ah2, bh6) | 0, lo = lo + Math.imul(al1, bl7) | 0, mid = mid + Math.imul(al1, bh7) | 0, mid = mid + Math.imul(ah1, bl7) | 0, hi = hi + Math.imul(ah1, bh7) | 0, lo = lo + Math.imul(al0, bl8) | 0, mid = mid + Math.imul(al0, bh8) | 0, mid = mid + Math.imul(ah0, bl8) | 0, hi = hi + Math.imul(ah0, bh8) | 0;\n var w8 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w8 >>> 26) | 0, w8 &= 67108863, lo = Math.imul(al9, bl0), mid = Math.imul(al9, bh0), mid = mid + Math.imul(ah9, bl0) | 0, hi = Math.imul(ah9, bh0), lo = lo + Math.imul(al8, bl1) | 0, mid = mid + Math.imul(al8, bh1) | 0, mid = mid + Math.imul(ah8, bl1) | 0, hi = hi + Math.imul(ah8, bh1) | 0, lo = lo + Math.imul(al7, bl2) | 0, mid = mid + Math.imul(al7, bh2) | 0, mid = mid + Math.imul(ah7, bl2) | 0, hi = hi + Math.imul(ah7, bh2) | 0, lo = lo + Math.imul(al6, bl3) | 0, mid = mid + Math.imul(al6, bh3) | 0, mid = mid + Math.imul(ah6, bl3) | 0, hi = hi + Math.imul(ah6, bh3) | 0, lo = lo + Math.imul(al5, bl4) | 0, mid = mid + Math.imul(al5, bh4) | 0, mid = mid + Math.imul(ah5, bl4) | 0, hi = hi + Math.imul(ah5, bh4) | 0, lo = lo + Math.imul(al4, bl5) | 0, mid = mid + Math.imul(al4, bh5) | 0, mid = mid + Math.imul(ah4, bl5) | 0, hi = hi + Math.imul(ah4, bh5) | 0, lo = lo + Math.imul(al3, bl6) | 0, mid = mid + Math.imul(al3, bh6) | 0, mid = mid + Math.imul(ah3, bl6) | 0, hi = hi + Math.imul(ah3, bh6) | 0, lo = lo + Math.imul(al2, bl7) | 0, mid = mid + Math.imul(al2, bh7) | 0, mid = mid + Math.imul(ah2, bl7) | 0, hi = hi + Math.imul(ah2, bh7) | 0, lo = lo + Math.imul(al1, bl8) | 0, mid = mid + Math.imul(al1, bh8) | 0, mid = mid + Math.imul(ah1, bl8) | 0, hi = hi + Math.imul(ah1, bh8) | 0, lo = lo + Math.imul(al0, bl9) | 0, mid = mid + Math.imul(al0, bh9) | 0, mid = mid + Math.imul(ah0, bl9) | 0, hi = hi + Math.imul(ah0, bh9) | 0;\n var w9 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w9 >>> 26) | 0, w9 &= 67108863, lo = Math.imul(al9, bl1), mid = Math.imul(al9, bh1), mid = mid + Math.imul(ah9, bl1) | 0, hi = Math.imul(ah9, bh1), lo = lo + Math.imul(al8, bl2) | 0, mid = mid + Math.imul(al8, bh2) | 0, mid = mid + Math.imul(ah8, bl2) | 0, hi = hi + Math.imul(ah8, bh2) | 0, lo = lo + Math.imul(al7, bl3) | 0, mid = mid + Math.imul(al7, bh3) | 0, mid = mid + Math.imul(ah7, bl3) | 0, hi = hi + Math.imul(ah7, bh3) | 0, lo = lo + Math.imul(al6, bl4) | 0, mid = mid + Math.imul(al6, bh4) | 0, mid = mid + Math.imul(ah6, bl4) | 0, hi = hi + Math.imul(ah6, bh4) | 0, lo = lo + Math.imul(al5, bl5) | 0, mid = mid + Math.imul(al5, bh5) | 0, mid = mid + Math.imul(ah5, bl5) | 0, hi = hi + Math.imul(ah5, bh5) | 0, lo = lo + Math.imul(al4, bl6) | 0, mid = mid + Math.imul(al4, bh6) | 0, mid = mid + Math.imul(ah4, bl6) | 0, hi = hi + Math.imul(ah4, bh6) | 0, lo = lo + Math.imul(al3, bl7) | 0, mid = mid + Math.imul(al3, bh7) | 0, mid = mid + Math.imul(ah3, bl7) | 0, hi = hi + Math.imul(ah3, bh7) | 0, lo = lo + Math.imul(al2, bl8) | 0, mid = mid + Math.imul(al2, bh8) | 0, mid = mid + Math.imul(ah2, bl8) | 0, hi = hi + Math.imul(ah2, bh8) | 0, lo = lo + Math.imul(al1, bl9) | 0, mid = mid + Math.imul(al1, bh9) | 0, mid = mid + Math.imul(ah1, bl9) | 0, hi = hi + Math.imul(ah1, bh9) | 0;\n var w10 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w10 >>> 26) | 0, w10 &= 67108863, lo = Math.imul(al9, bl2), mid = Math.imul(al9, bh2), mid = mid + Math.imul(ah9, bl2) | 0, hi = Math.imul(ah9, bh2), lo = lo + Math.imul(al8, bl3) | 0, mid = mid + Math.imul(al8, bh3) | 0, mid = mid + Math.imul(ah8, bl3) | 0, hi = hi + Math.imul(ah8, bh3) | 0, lo = lo + Math.imul(al7, bl4) | 0, mid = mid + Math.imul(al7, bh4) | 0, mid = mid + Math.imul(ah7, bl4) | 0, hi = hi + Math.imul(ah7, bh4) | 0, lo = lo + Math.imul(al6, bl5) | 0, mid = mid + Math.imul(al6, bh5) | 0, mid = mid + Math.imul(ah6, bl5) | 0, hi = hi + Math.imul(ah6, bh5) | 0, lo = lo + Math.imul(al5, bl6) | 0, mid = mid + Math.imul(al5, bh6) | 0, mid = mid + Math.imul(ah5, bl6) | 0, hi = hi + Math.imul(ah5, bh6) | 0, lo = lo + Math.imul(al4, bl7) | 0, mid = mid + Math.imul(al4, bh7) | 0, mid = mid + Math.imul(ah4, bl7) | 0, hi = hi + Math.imul(ah4, bh7) | 0, lo = lo + Math.imul(al3, bl8) | 0, mid = mid + Math.imul(al3, bh8) | 0, mid = mid + Math.imul(ah3, bl8) | 0, hi = hi + Math.imul(ah3, bh8) | 0, lo = lo + Math.imul(al2, bl9) | 0, mid = mid + Math.imul(al2, bh9) | 0, mid = mid + Math.imul(ah2, bl9) | 0, hi = hi + Math.imul(ah2, bh9) | 0;\n var w11 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w11 >>> 26) | 0, w11 &= 67108863, lo = Math.imul(al9, bl3), mid = Math.imul(al9, bh3), mid = mid + Math.imul(ah9, bl3) | 0, hi = Math.imul(ah9, bh3), lo = lo + Math.imul(al8, bl4) | 0, mid = mid + Math.imul(al8, bh4) | 0, mid = mid + Math.imul(ah8, bl4) | 0, hi = hi + Math.imul(ah8, bh4) | 0, lo = lo + Math.imul(al7, bl5) | 0, mid = mid + Math.imul(al7, bh5) | 0, mid = mid + Math.imul(ah7, bl5) | 0, hi = hi + Math.imul(ah7, bh5) | 0, lo = lo + Math.imul(al6, bl6) | 0, mid = mid + Math.imul(al6, bh6) | 0, mid = mid + Math.imul(ah6, bl6) | 0, hi = hi + Math.imul(ah6, bh6) | 0, lo = lo + Math.imul(al5, bl7) | 0, mid = mid + Math.imul(al5, bh7) | 0, mid = mid + Math.imul(ah5, bl7) | 0, hi = hi + Math.imul(ah5, bh7) | 0, lo = lo + Math.imul(al4, bl8) | 0, mid = mid + Math.imul(al4, bh8) | 0, mid = mid + Math.imul(ah4, bl8) | 0, hi = hi + Math.imul(ah4, bh8) | 0, lo = lo + Math.imul(al3, bl9) | 0, mid = mid + Math.imul(al3, bh9) | 0, mid = mid + Math.imul(ah3, bl9) | 0, hi = hi + Math.imul(ah3, bh9) | 0;\n var w12 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w12 >>> 26) | 0, w12 &= 67108863, lo = Math.imul(al9, bl4), mid = Math.imul(al9, bh4), mid = mid + Math.imul(ah9, bl4) | 0, hi = Math.imul(ah9, bh4), lo = lo + Math.imul(al8, bl5) | 0, mid = mid + Math.imul(al8, bh5) | 0, mid = mid + Math.imul(ah8, bl5) | 0, hi = hi + Math.imul(ah8, bh5) | 0, lo = lo + Math.imul(al7, bl6) | 0, mid = mid + Math.imul(al7, bh6) | 0, mid = mid + Math.imul(ah7, bl6) | 0, hi = hi + Math.imul(ah7, bh6) | 0, lo = lo + Math.imul(al6, bl7) | 0, mid = mid + Math.imul(al6, bh7) | 0, mid = mid + Math.imul(ah6, bl7) | 0, hi = hi + Math.imul(ah6, bh7) | 0, lo = lo + Math.imul(al5, bl8) | 0, mid = mid + Math.imul(al5, bh8) | 0, mid = mid + Math.imul(ah5, bl8) | 0, hi = hi + Math.imul(ah5, bh8) | 0, lo = lo + Math.imul(al4, bl9) | 0, mid = mid + Math.imul(al4, bh9) | 0, mid = mid + Math.imul(ah4, bl9) | 0, hi = hi + Math.imul(ah4, bh9) | 0;\n var w13 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w13 >>> 26) | 0, w13 &= 67108863, lo = Math.imul(al9, bl5), mid = Math.imul(al9, bh5), mid = mid + Math.imul(ah9, bl5) | 0, hi = Math.imul(ah9, bh5), lo = lo + Math.imul(al8, bl6) | 0, mid = mid + Math.imul(al8, bh6) | 0, mid = mid + Math.imul(ah8, bl6) | 0, hi = hi + Math.imul(ah8, bh6) | 0, lo = lo + Math.imul(al7, bl7) | 0, mid = mid + Math.imul(al7, bh7) | 0, mid = mid + Math.imul(ah7, bl7) | 0, hi = hi + Math.imul(ah7, bh7) | 0, lo = lo + Math.imul(al6, bl8) | 0, mid = mid + Math.imul(al6, bh8) | 0, mid = mid + Math.imul(ah6, bl8) | 0, hi = hi + Math.imul(ah6, bh8) | 0, lo = lo + Math.imul(al5, bl9) | 0, mid = mid + Math.imul(al5, bh9) | 0, mid = mid + Math.imul(ah5, bl9) | 0, hi = hi + Math.imul(ah5, bh9) | 0;\n var w14 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w14 >>> 26) | 0, w14 &= 67108863, lo = Math.imul(al9, bl6), mid = Math.imul(al9, bh6), mid = mid + Math.imul(ah9, bl6) | 0, hi = Math.imul(ah9, bh6), lo = lo + Math.imul(al8, bl7) | 0, mid = mid + Math.imul(al8, bh7) | 0, mid = mid + Math.imul(ah8, bl7) | 0, hi = hi + Math.imul(ah8, bh7) | 0, lo = lo + Math.imul(al7, bl8) | 0, mid = mid + Math.imul(al7, bh8) | 0, mid = mid + Math.imul(ah7, bl8) | 0, hi = hi + Math.imul(ah7, bh8) | 0, lo = lo + Math.imul(al6, bl9) | 0, mid = mid + Math.imul(al6, bh9) | 0, mid = mid + Math.imul(ah6, bl9) | 0, hi = hi + Math.imul(ah6, bh9) | 0;\n var w15 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w15 >>> 26) | 0, w15 &= 67108863, lo = Math.imul(al9, bl7), mid = Math.imul(al9, bh7), mid = mid + Math.imul(ah9, bl7) | 0, hi = Math.imul(ah9, bh7), lo = lo + Math.imul(al8, bl8) | 0, mid = mid + Math.imul(al8, bh8) | 0, mid = mid + Math.imul(ah8, bl8) | 0, hi = hi + Math.imul(ah8, bh8) | 0, lo = lo + Math.imul(al7, bl9) | 0, mid = mid + Math.imul(al7, bh9) | 0, mid = mid + Math.imul(ah7, bl9) | 0, hi = hi + Math.imul(ah7, bh9) | 0;\n var w16 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w16 >>> 26) | 0, w16 &= 67108863, lo = Math.imul(al9, bl8), mid = Math.imul(al9, bh8), mid = mid + Math.imul(ah9, bl8) | 0, hi = Math.imul(ah9, bh8), lo = lo + Math.imul(al8, bl9) | 0, mid = mid + Math.imul(al8, bh9) | 0, mid = mid + Math.imul(ah8, bl9) | 0, hi = hi + Math.imul(ah8, bh9) | 0;\n var w17 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w17 >>> 26) | 0, w17 &= 67108863, lo = Math.imul(al9, bl9), mid = Math.imul(al9, bh9), mid = mid + Math.imul(ah9, bl9) | 0, hi = Math.imul(ah9, bh9);\n var w18 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n return c = (hi + (mid >>> 13) | 0) + (w18 >>> 26) | 0, w18 &= 67108863, o[0] = w0, o[1] = w1, o[2] = w2, o[3] = w3, o[4] = w4, o[5] = w5, o[6] = w6, o[7] = w7, o[8] = w8, o[9] = w9, o[10] = w10, o[11] = w11, o[12] = w12, o[13] = w13, o[14] = w14, o[15] = w15, o[16] = w16, o[17] = w17, o[18] = w18, c !== 0 && (o[19] = c, out.length++), out;\n };\n Math.imul || (comb10MulTo = smallMulTo);\n function bigMulTo(self2, num, out) {\n out.negative = num.negative ^ self2.negative, out.length = self2.length + num.length;\n for (var carry = 0, hncarry = 0, k = 0;k < out.length - 1; k++) {\n var ncarry = hncarry;\n hncarry = 0;\n for (var rword = carry & 67108863, maxJ = Math.min(k, num.length - 1), j = Math.max(0, k - self2.length + 1);j <= maxJ; j++) {\n var i = k - j, a = self2.words[i] | 0, b = num.words[j] | 0, r = a * b, lo = r & 67108863;\n ncarry = ncarry + (r / 67108864 | 0) | 0, lo = lo + rword | 0, rword = lo & 67108863, ncarry = ncarry + (lo >>> 26) | 0, hncarry += ncarry >>> 26, ncarry &= 67108863;\n }\n out.words[k] = rword, carry = ncarry, ncarry = hncarry;\n }\n return carry !== 0 \? out.words[k] = carry : out.length--, out.strip();\n }\n function jumboMulTo(self2, num, out) {\n var fftm = new FFTM;\n return fftm.mulp(self2, num, out);\n }\n BN.prototype.mulTo = function(num, out) {\n var res, len = this.length + num.length;\n return this.length === 10 && num.length === 10 \? res = comb10MulTo(this, num, out) : len < 63 \? res = smallMulTo(this, num, out) : len < 1024 \? res = bigMulTo(this, num, out) : res = jumboMulTo(this, num, out), res;\n };\n function FFTM(x, y) {\n this.x = x, this.y = y;\n }\n FFTM.prototype = {}, FFTM.prototype.makeRBT = function(N) {\n for (var t = new @Array(N), l = BN.prototype._countBits(N) - 1, i = 0;i < N; i++)\n t[i] = this.revBin(i, l, N);\n return t;\n }, FFTM.prototype.revBin = function(x, l, N) {\n if (x === 0 || x === N - 1)\n return x;\n for (var rb = 0, i = 0;i < l; i++)\n rb |= (x & 1) << l - i - 1, x >>= 1;\n return rb;\n }, FFTM.prototype.permute = function(rbt, rws, iws, rtws, itws, N) {\n for (var i = 0;i < N; i++)\n rtws[i] = rws[rbt[i]], itws[i] = iws[rbt[i]];\n }, FFTM.prototype.transform = function(rws, iws, rtws, itws, N, rbt) {\n this.permute(rbt, rws, iws, rtws, itws, N);\n for (var s = 1;s < N; s <<= 1)\n for (var l = s << 1, rtwdf = Math.cos(2 * Math.PI / l), itwdf = Math.sin(2 * Math.PI / l), p = 0;p < N; p += l)\n for (var rtwdf_ = rtwdf, itwdf_ = itwdf, j = 0;j < s; j++) {\n var re = rtws[p + j], ie = itws[p + j], ro = rtws[p + j + s], io = itws[p + j + s], rx = rtwdf_ * ro - itwdf_ * io;\n io = rtwdf_ * io + itwdf_ * ro, ro = rx, rtws[p + j] = re + ro, itws[p + j] = ie + io, rtws[p + j + s] = re - ro, itws[p + j + s] = ie - io, j !== l && (rx = rtwdf * rtwdf_ - itwdf * itwdf_, itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_, rtwdf_ = rx);\n }\n }, FFTM.prototype.guessLen13b = function(n, m) {\n var N = Math.max(m, n) | 1, odd = N & 1, i = 0;\n for (N = N / 2 | 0;N; N = N >>> 1)\n i++;\n return 1 << i + 1 + odd;\n }, FFTM.prototype.conjugate = function(rws, iws, N) {\n if (!(N <= 1))\n for (var i = 0;i < N / 2; i++) {\n var t = rws[i];\n rws[i] = rws[N - i - 1], rws[N - i - 1] = t, t = iws[i], iws[i] = -iws[N - i - 1], iws[N - i - 1] = -t;\n }\n }, FFTM.prototype.normalize13b = function(ws, N) {\n for (var carry = 0, i = 0;i < N / 2; i++) {\n var w = Math.round(ws[2 * i + 1] / N) * 8192 + Math.round(ws[2 * i] / N) + carry;\n ws[i] = w & 67108863, w < 67108864 \? carry = 0 : carry = w / 67108864 | 0;\n }\n return ws;\n }, FFTM.prototype.convert13b = function(ws, len, rws, N) {\n for (var carry = 0, i = 0;i < len; i++)\n carry = carry + (ws[i] | 0), rws[2 * i] = carry & 8191, carry = carry >>> 13, rws[2 * i + 1] = carry & 8191, carry = carry >>> 13;\n for (i = 2 * len;i < N; ++i)\n rws[i] = 0;\n assert(carry === 0), assert((carry & -8192) === 0);\n }, FFTM.prototype.stub = function(N) {\n for (var ph = new @Array(N), i = 0;i < N; i++)\n ph[i] = 0;\n return ph;\n }, FFTM.prototype.mulp = function(x, y, out) {\n var N = 2 * this.guessLen13b(x.length, y.length), rbt = this.makeRBT(N), _ = this.stub(N), rws = new @Array(N), rwst = new @Array(N), iwst = new @Array(N), nrws = new @Array(N), nrwst = new @Array(N), niwst = new @Array(N), rmws = out.words;\n rmws.length = N, this.convert13b(x.words, x.length, rws, N), this.convert13b(y.words, y.length, nrws, N), this.transform(rws, _, rwst, iwst, N, rbt), this.transform(nrws, _, nrwst, niwst, N, rbt);\n for (var i = 0;i < N; i++) {\n var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];\n iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i], rwst[i] = rx;\n }\n return this.conjugate(rwst, iwst, N), this.transform(rwst, iwst, rmws, _, N, rbt), this.conjugate(rmws, _, N), this.normalize13b(rmws, N), out.negative = x.negative ^ y.negative, out.length = x.length + y.length, out.strip();\n }, BN.prototype.mul = function(num) {\n var out = new BN(null);\n return out.words = new @Array(this.length + num.length), this.mulTo(num, out);\n }, BN.prototype.mulf = function(num) {\n var out = new BN(null);\n return out.words = new @Array(this.length + num.length), jumboMulTo(this, num, out);\n }, BN.prototype.imul = function(num) {\n return this.clone().mulTo(num, this);\n }, BN.prototype.imuln = function(num) {\n assert(typeof num == \"number\"), assert(num < 67108864);\n for (var carry = 0, i = 0;i < this.length; i++) {\n var w = (this.words[i] | 0) * num, lo = (w & 67108863) + (carry & 67108863);\n carry >>= 26, carry += w / 67108864 | 0, carry += lo >>> 26, this.words[i] = lo & 67108863;\n }\n return carry !== 0 && (this.words[i] = carry, this.length++), this;\n }, BN.prototype.muln = function(num) {\n return this.clone().imuln(num);\n }, BN.prototype.sqr = function() {\n return this.mul(this);\n }, BN.prototype.isqr = function() {\n return this.imul(this.clone());\n }, BN.prototype.pow = function(num) {\n var w = toBitArray(num);\n if (w.length === 0)\n return new BN(1);\n for (var res = this, i = 0;i < w.length && w[i] === 0; i++, res = res.sqr())\n ;\n if (++i < w.length)\n for (var q = res.sqr();i < w.length; i++, q = q.sqr())\n w[i] !== 0 && (res = res.mul(q));\n return res;\n }, BN.prototype.iushln = function(bits) {\n assert(typeof bits == \"number\" && bits >= 0);\n var r = bits % 26, s = (bits - r) / 26, carryMask = 67108863 >>> 26 - r << 26 - r, i;\n if (r !== 0) {\n var carry = 0;\n for (i = 0;i < this.length; i++) {\n var newCarry = this.words[i] & carryMask, c = (this.words[i] | 0) - newCarry << r;\n this.words[i] = c | carry, carry = newCarry >>> 26 - r;\n }\n carry && (this.words[i] = carry, this.length++);\n }\n if (s !== 0) {\n for (i = this.length - 1;i >= 0; i--)\n this.words[i + s] = this.words[i];\n for (i = 0;i < s; i++)\n this.words[i] = 0;\n this.length += s;\n }\n return this.strip();\n }, BN.prototype.ishln = function(bits) {\n return assert(this.negative === 0), this.iushln(bits);\n }, BN.prototype.iushrn = function(bits, hint, extended) {\n assert(typeof bits == \"number\" && bits >= 0);\n var h;\n hint \? h = (hint - hint % 26) / 26 : h = 0;\n var r = bits % 26, s = Math.min((bits - r) / 26, this.length), mask = 67108863 ^ 67108863 >>> r << r, maskedWords = extended;\n if (h -= s, h = Math.max(0, h), maskedWords) {\n for (var i = 0;i < s; i++)\n maskedWords.words[i] = this.words[i];\n maskedWords.length = s;\n }\n if (s !== 0)\n if (this.length > s)\n for (this.length -= s, i = 0;i < this.length; i++)\n this.words[i] = this.words[i + s];\n else\n this.words[0] = 0, this.length = 1;\n var carry = 0;\n for (i = this.length - 1;i >= 0 && (carry !== 0 || i >= h); i--) {\n var word = this.words[i] | 0;\n this.words[i] = carry << 26 - r | word >>> r, carry = word & mask;\n }\n return maskedWords && carry !== 0 && (maskedWords.words[maskedWords.length++] = carry), this.length === 0 && (this.words[0] = 0, this.length = 1), this.strip();\n }, BN.prototype.ishrn = function(bits, hint, extended) {\n return assert(this.negative === 0), this.iushrn(bits, hint, extended);\n }, BN.prototype.shln = function(bits) {\n return this.clone().ishln(bits);\n }, BN.prototype.ushln = function(bits) {\n return this.clone().iushln(bits);\n }, BN.prototype.shrn = function(bits) {\n return this.clone().ishrn(bits);\n }, BN.prototype.ushrn = function(bits) {\n return this.clone().iushrn(bits);\n }, BN.prototype.testn = function(bit) {\n assert(typeof bit == \"number\" && bit >= 0);\n var r = bit % 26, s = (bit - r) / 26, q = 1 << r;\n if (this.length <= s)\n return !1;\n var w = this.words[s];\n return !!(w & q);\n }, BN.prototype.imaskn = function(bits) {\n assert(typeof bits == \"number\" && bits >= 0);\n var r = bits % 26, s = (bits - r) / 26;\n if (assert(this.negative === 0, \"imaskn works only with positive numbers\"), this.length <= s)\n return this;\n if (r !== 0 && s++, this.length = Math.min(s, this.length), r !== 0) {\n var mask = 67108863 ^ 67108863 >>> r << r;\n this.words[this.length - 1] &= mask;\n }\n return this.strip();\n }, BN.prototype.maskn = function(bits) {\n return this.clone().imaskn(bits);\n }, BN.prototype.iaddn = function(num) {\n return assert(typeof num == \"number\"), assert(num < 67108864), num < 0 \? this.isubn(-num) : this.negative !== 0 \? this.length === 1 && (this.words[0] | 0) < num \? (this.words[0] = num - (this.words[0] | 0), this.negative = 0, this) : (this.negative = 0, this.isubn(num), this.negative = 1, this) : this._iaddn(num);\n }, BN.prototype._iaddn = function(num) {\n this.words[0] += num;\n for (var i = 0;i < this.length && this.words[i] >= 67108864; i++)\n this.words[i] -= 67108864, i === this.length - 1 \? this.words[i + 1] = 1 : this.words[i + 1]++;\n return this.length = Math.max(this.length, i + 1), this;\n }, BN.prototype.isubn = function(num) {\n if (assert(typeof num == \"number\"), assert(num < 67108864), num < 0)\n return this.iaddn(-num);\n if (this.negative !== 0)\n return this.negative = 0, this.iaddn(num), this.negative = 1, this;\n if (this.words[0] -= num, this.length === 1 && this.words[0] < 0)\n this.words[0] = -this.words[0], this.negative = 1;\n else\n for (var i = 0;i < this.length && this.words[i] < 0; i++)\n this.words[i] += 67108864, this.words[i + 1] -= 1;\n return this.strip();\n }, BN.prototype.addn = function(num) {\n return this.clone().iaddn(num);\n }, BN.prototype.subn = function(num) {\n return this.clone().isubn(num);\n }, BN.prototype.iabs = function() {\n return this.negative = 0, this;\n }, BN.prototype.abs = function() {\n return this.clone().iabs();\n }, BN.prototype._ishlnsubmul = function(num, mul, shift) {\n var len = num.length + shift, i;\n this._expand(len);\n var w, carry = 0;\n for (i = 0;i < num.length; i++) {\n w = (this.words[i + shift] | 0) + carry;\n var right = (num.words[i] | 0) * mul;\n w -= right & 67108863, carry = (w >> 26) - (right / 67108864 | 0), this.words[i + shift] = w & 67108863;\n }\n for (;i < this.length - shift; i++)\n w = (this.words[i + shift] | 0) + carry, carry = w >> 26, this.words[i + shift] = w & 67108863;\n if (carry === 0)\n return this.strip();\n for (assert(carry === -1), carry = 0, i = 0;i < this.length; i++)\n w = -(this.words[i] | 0) + carry, carry = w >> 26, this.words[i] = w & 67108863;\n return this.negative = 1, this.strip();\n }, BN.prototype._wordDiv = function(num, mode) {\n var shift = this.length - num.length, a = this.clone(), b = num, bhi = b.words[b.length - 1] | 0, bhiBits = this._countBits(bhi);\n shift = 26 - bhiBits, shift !== 0 && (b = b.ushln(shift), a.iushln(shift), bhi = b.words[b.length - 1] | 0);\n var m = a.length - b.length, q;\n if (mode !== \"mod\") {\n q = new BN(null), q.length = m + 1, q.words = new @Array(q.length);\n for (var i = 0;i < q.length; i++)\n q.words[i] = 0;\n }\n var diff = a.clone()._ishlnsubmul(b, 1, m);\n diff.negative === 0 && (a = diff, q && (q.words[m] = 1));\n for (var j = m - 1;j >= 0; j--) {\n var qj = (a.words[b.length + j] | 0) * 67108864 + (a.words[b.length + j - 1] | 0);\n for (qj = Math.min(qj / bhi | 0, 67108863), a._ishlnsubmul(b, qj, j);a.negative !== 0; )\n qj--, a.negative = 0, a._ishlnsubmul(b, 1, j), a.isZero() || (a.negative ^= 1);\n q && (q.words[j] = qj);\n }\n return q && q.strip(), a.strip(), mode !== \"div\" && shift !== 0 && a.iushrn(shift), {\n div: q || null,\n mod: a\n };\n }, BN.prototype.divmod = function(num, mode, positive) {\n if (assert(!num.isZero()), this.isZero())\n return {\n div: new BN(0),\n mod: new BN(0)\n };\n var div, mod, res;\n return this.negative !== 0 && num.negative === 0 \? (res = this.neg().divmod(num, mode), mode !== \"mod\" && (div = res.div.neg()), mode !== \"div\" && (mod = res.mod.neg(), positive && mod.negative !== 0 && mod.iadd(num)), {\n div,\n mod\n }) : this.negative === 0 && num.negative !== 0 \? (res = this.divmod(num.neg(), mode), mode !== \"mod\" && (div = res.div.neg()), {\n div,\n mod: res.mod\n }) : (this.negative & num.negative) !== 0 \? (res = this.neg().divmod(num.neg(), mode), mode !== \"div\" && (mod = res.mod.neg(), positive && mod.negative !== 0 && mod.isub(num)), {\n div: res.div,\n mod\n }) : num.length > this.length || this.cmp(num) < 0 \? {\n div: new BN(0),\n mod: this\n } : num.length === 1 \? mode === \"div\" \? {\n div: this.divn(num.words[0]),\n mod: null\n } : mode === \"mod\" \? {\n div: null,\n mod: new BN(this.modn(num.words[0]))\n } : {\n div: this.divn(num.words[0]),\n mod: new BN(this.modn(num.words[0]))\n } : this._wordDiv(num, mode);\n }, BN.prototype.div = function(num) {\n return this.divmod(num, \"div\", !1).div;\n }, BN.prototype.mod = function(num) {\n return this.divmod(num, \"mod\", !1).mod;\n }, BN.prototype.umod = function(num) {\n return this.divmod(num, \"mod\", !0).mod;\n }, BN.prototype.divRound = function(num) {\n var dm = this.divmod(num);\n if (dm.mod.isZero())\n return dm.div;\n var mod = dm.div.negative !== 0 \? dm.mod.isub(num) : dm.mod, half = num.ushrn(1), r2 = num.andln(1), cmp = mod.cmp(half);\n return cmp < 0 || r2 === 1 && cmp === 0 \? dm.div : dm.div.negative !== 0 \? dm.div.isubn(1) : dm.div.iaddn(1);\n }, BN.prototype.modn = function(num) {\n assert(num <= 67108863);\n for (var p = (1 << 26) % num, acc = 0, i = this.length - 1;i >= 0; i--)\n acc = (p * acc + (this.words[i] | 0)) % num;\n return acc;\n }, BN.prototype.idivn = function(num) {\n assert(num <= 67108863);\n for (var carry = 0, i = this.length - 1;i >= 0; i--) {\n var w = (this.words[i] | 0) + carry * 67108864;\n this.words[i] = w / num | 0, carry = w % num;\n }\n return this.strip();\n }, BN.prototype.divn = function(num) {\n return this.clone().idivn(num);\n }, BN.prototype.egcd = function(p) {\n assert(p.negative === 0), assert(!p.isZero());\n var x = this, y = p.clone();\n x.negative !== 0 \? x = x.umod(p) : x = x.clone();\n for (var A = new BN(1), B = new BN(0), C = new BN(0), D = new BN(1), g = 0;x.isEven() && y.isEven(); )\n x.iushrn(1), y.iushrn(1), ++g;\n for (var yp = y.clone(), xp = x.clone();!x.isZero(); ) {\n for (var i = 0, im = 1;(x.words[0] & im) === 0 && i < 26; ++i, im <<= 1)\n ;\n if (i > 0)\n for (x.iushrn(i);i-- > 0; )\n (A.isOdd() || B.isOdd()) && (A.iadd(yp), B.isub(xp)), A.iushrn(1), B.iushrn(1);\n for (var j = 0, jm = 1;(y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1)\n ;\n if (j > 0)\n for (y.iushrn(j);j-- > 0; )\n (C.isOdd() || D.isOdd()) && (C.iadd(yp), D.isub(xp)), C.iushrn(1), D.iushrn(1);\n x.cmp(y) >= 0 \? (x.isub(y), A.isub(C), B.isub(D)) : (y.isub(x), C.isub(A), D.isub(B));\n }\n return {\n a: C,\n b: D,\n gcd: y.iushln(g)\n };\n }, BN.prototype._invmp = function(p) {\n assert(p.negative === 0), assert(!p.isZero());\n var a = this, b = p.clone();\n a.negative !== 0 \? a = a.umod(p) : a = a.clone();\n for (var x1 = new BN(1), x2 = new BN(0), delta = b.clone();a.cmpn(1) > 0 && b.cmpn(1) > 0; ) {\n for (var i = 0, im = 1;(a.words[0] & im) === 0 && i < 26; ++i, im <<= 1)\n ;\n if (i > 0)\n for (a.iushrn(i);i-- > 0; )\n x1.isOdd() && x1.iadd(delta), x1.iushrn(1);\n for (var j = 0, jm = 1;(b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1)\n ;\n if (j > 0)\n for (b.iushrn(j);j-- > 0; )\n x2.isOdd() && x2.iadd(delta), x2.iushrn(1);\n a.cmp(b) >= 0 \? (a.isub(b), x1.isub(x2)) : (b.isub(a), x2.isub(x1));\n }\n var res;\n return a.cmpn(1) === 0 \? res = x1 : res = x2, res.cmpn(0) < 0 && res.iadd(p), res;\n }, BN.prototype.gcd = function(num) {\n if (this.isZero())\n return num.abs();\n if (num.isZero())\n return this.abs();\n var a = this.clone(), b = num.clone();\n a.negative = 0, b.negative = 0;\n for (var shift = 0;a.isEven() && b.isEven(); shift++)\n a.iushrn(1), b.iushrn(1);\n do {\n for (;a.isEven(); )\n a.iushrn(1);\n for (;b.isEven(); )\n b.iushrn(1);\n var r = a.cmp(b);\n if (r < 0) {\n var t = a;\n a = b, b = t;\n } else if (r === 0 || b.cmpn(1) === 0)\n break;\n a.isub(b);\n } while (!0);\n return b.iushln(shift);\n }, BN.prototype.invm = function(num) {\n return this.egcd(num).a.umod(num);\n }, BN.prototype.isEven = function() {\n return (this.words[0] & 1) === 0;\n }, BN.prototype.isOdd = function() {\n return (this.words[0] & 1) === 1;\n }, BN.prototype.andln = function(num) {\n return this.words[0] & num;\n }, BN.prototype.bincn = function(bit) {\n assert(typeof bit == \"number\");\n var r = bit % 26, s = (bit - r) / 26, q = 1 << r;\n if (this.length <= s)\n return this._expand(s + 1), this.words[s] |= q, this;\n for (var carry = q, i = s;carry !== 0 && i < this.length; i++) {\n var w = this.words[i] | 0;\n w += carry, carry = w >>> 26, w &= 67108863, this.words[i] = w;\n }\n return carry !== 0 && (this.words[i] = carry, this.length++), this;\n }, BN.prototype.isZero = function() {\n return this.length === 1 && this.words[0] === 0;\n }, BN.prototype.cmpn = function(num) {\n var negative = num < 0;\n if (this.negative !== 0 && !negative)\n return -1;\n if (this.negative === 0 && negative)\n return 1;\n this.strip();\n var res;\n if (this.length > 1)\n res = 1;\n else {\n negative && (num = -num), assert(num <= 67108863, \"Number is too big\");\n var w = this.words[0] | 0;\n res = w === num \? 0 : w < num \? -1 : 1;\n }\n return this.negative !== 0 \? -res | 0 : res;\n }, BN.prototype.cmp = function(num) {\n if (this.negative !== 0 && num.negative === 0)\n return -1;\n if (this.negative === 0 && num.negative !== 0)\n return 1;\n var res = this.ucmp(num);\n return this.negative !== 0 \? -res | 0 : res;\n }, BN.prototype.ucmp = function(num) {\n if (this.length > num.length)\n return 1;\n if (this.length < num.length)\n return -1;\n for (var res = 0, i = this.length - 1;i >= 0; i--) {\n var a = this.words[i] | 0, b = num.words[i] | 0;\n if (a !== b) {\n a < b \? res = -1 : a > b && (res = 1);\n break;\n }\n }\n return res;\n }, BN.prototype.gtn = function(num) {\n return this.cmpn(num) === 1;\n }, BN.prototype.gt = function(num) {\n return this.cmp(num) === 1;\n }, BN.prototype.gten = function(num) {\n return this.cmpn(num) >= 0;\n }, BN.prototype.gte = function(num) {\n return this.cmp(num) >= 0;\n }, BN.prototype.ltn = function(num) {\n return this.cmpn(num) === -1;\n }, BN.prototype.lt = function(num) {\n return this.cmp(num) === -1;\n }, BN.prototype.lten = function(num) {\n return this.cmpn(num) <= 0;\n }, BN.prototype.lte = function(num) {\n return this.cmp(num) <= 0;\n }, BN.prototype.eqn = function(num) {\n return this.cmpn(num) === 0;\n }, BN.prototype.eq = function(num) {\n return this.cmp(num) === 0;\n }, BN.red = function(num) {\n return new Red(num);\n }, BN.prototype.toRed = function(ctx) {\n return assert(!this.red, \"Already a number in reduction context\"), assert(this.negative === 0, \"red works only with positives\"), ctx.convertTo(this)._forceRed(ctx);\n }, BN.prototype.fromRed = function() {\n return assert(this.red, \"fromRed works only with numbers in reduction context\"), this.red.convertFrom(this);\n }, BN.prototype._forceRed = function(ctx) {\n return this.red = ctx, this;\n }, BN.prototype.forceRed = function(ctx) {\n return assert(!this.red, \"Already a number in reduction context\"), this._forceRed(ctx);\n }, BN.prototype.redAdd = function(num) {\n return assert(this.red, \"redAdd works only with red numbers\"), this.red.add(this, num);\n }, BN.prototype.redIAdd = function(num) {\n return assert(this.red, \"redIAdd works only with red numbers\"), this.red.iadd(this, num);\n }, BN.prototype.redSub = function(num) {\n return assert(this.red, \"redSub works only with red numbers\"), this.red.sub(this, num);\n }, BN.prototype.redISub = function(num) {\n return assert(this.red, \"redISub works only with red numbers\"), this.red.isub(this, num);\n }, BN.prototype.redShl = function(num) {\n return assert(this.red, \"redShl works only with red numbers\"), this.red.shl(this, num);\n }, BN.prototype.redMul = function(num) {\n return assert(this.red, \"redMul works only with red numbers\"), this.red._verify2(this, num), this.red.mul(this, num);\n }, BN.prototype.redIMul = function(num) {\n return assert(this.red, \"redMul works only with red numbers\"), this.red._verify2(this, num), this.red.imul(this, num);\n }, BN.prototype.redSqr = function() {\n return assert(this.red, \"redSqr works only with red numbers\"), this.red._verify1(this), this.red.sqr(this);\n }, BN.prototype.redISqr = function() {\n return assert(this.red, \"redISqr works only with red numbers\"), this.red._verify1(this), this.red.isqr(this);\n }, BN.prototype.redSqrt = function() {\n return assert(this.red, \"redSqrt works only with red numbers\"), this.red._verify1(this), this.red.sqrt(this);\n }, BN.prototype.redInvm = function() {\n return assert(this.red, \"redInvm works only with red numbers\"), this.red._verify1(this), this.red.invm(this);\n }, BN.prototype.redNeg = function() {\n return assert(this.red, \"redNeg works only with red numbers\"), this.red._verify1(this), this.red.neg(this);\n }, BN.prototype.redPow = function(num) {\n return assert(this.red && !num.red, \"redPow(normalNum)\"), this.red._verify1(this), this.red.pow(this, num);\n };\n var primes = {\n k256: null,\n p224: null,\n p192: null,\n p25519: null\n };\n function MPrime(name, p) {\n this.name = name, this.p = new BN(p, 16), this.n = this.p.bitLength(), this.k = new BN(1).iushln(this.n).isub(this.p), this.tmp = this._tmp();\n }\n MPrime.prototype = {}, MPrime.prototype._tmp = function() {\n var tmp = new BN(null);\n return tmp.words = new @Array(Math.ceil(this.n / 13)), tmp;\n }, MPrime.prototype.ireduce = function(num) {\n var r = num, rlen;\n do\n this.split(r, this.tmp), r = this.imulK(r), r = r.iadd(this.tmp), rlen = r.bitLength();\n while (rlen > this.n);\n var cmp = rlen < this.n \? -1 : r.ucmp(this.p);\n return cmp === 0 \? (r.words[0] = 0, r.length = 1) : cmp > 0 \? r.isub(this.p) : r.strip !== void 0 \? r.strip() : r._strip(), r;\n }, MPrime.prototype.split = function(input, out) {\n input.iushrn(this.n, 0, out);\n }, MPrime.prototype.imulK = function(num) {\n return num.imul(this.k);\n };\n function K256() {\n MPrime.@call(this, \"k256\", \"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f\");\n }\n inherits(K256, MPrime), K256.prototype.split = function(input, output) {\n for (var mask = 4194303, outLen = Math.min(input.length, 9), i = 0;i < outLen; i++)\n output.words[i] = input.words[i];\n if (output.length = outLen, input.length <= 9) {\n input.words[0] = 0, input.length = 1;\n return;\n }\n var prev = input.words[9];\n for (output.words[output.length++] = prev & mask, i = 10;i < input.length; i++) {\n var next = input.words[i] | 0;\n input.words[i - 10] = (next & mask) << 4 | prev >>> 22, prev = next;\n }\n prev >>>= 22, input.words[i - 10] = prev, prev === 0 && input.length > 10 \? input.length -= 10 : input.length -= 9;\n }, K256.prototype.imulK = function(num) {\n num.words[num.length] = 0, num.words[num.length + 1] = 0, num.length += 2;\n for (var lo = 0, i = 0;i < num.length; i++) {\n var w = num.words[i] | 0;\n lo += w * 977, num.words[i] = lo & 67108863, lo = w * 64 + (lo / 67108864 | 0);\n }\n return num.words[num.length - 1] === 0 && (num.length--, num.words[num.length - 1] === 0 && num.length--), num;\n };\n function P224() {\n MPrime.@call(this, \"p224\", \"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001\");\n }\n inherits(P224, MPrime);\n function P192() {\n MPrime.@call(this, \"p192\", \"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff\");\n }\n inherits(P192, MPrime);\n function P25519() {\n MPrime.@call(this, \"25519\", \"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed\");\n }\n inherits(P25519, MPrime), P25519.prototype.imulK = function(num) {\n for (var carry = 0, i = 0;i < num.length; i++) {\n var hi = (num.words[i] | 0) * 19 + carry, lo = hi & 67108863;\n hi >>>= 26, num.words[i] = lo, carry = hi;\n }\n return carry !== 0 && (num.words[num.length++] = carry), num;\n }, BN._prime = function(name) {\n if (primes[name])\n return primes[name];\n var prime2;\n if (name === \"k256\")\n prime2 = new K256;\n else if (name === \"p224\")\n prime2 = new P224;\n else if (name === \"p192\")\n prime2 = new P192;\n else if (name === \"p25519\")\n prime2 = new P25519;\n else\n throw new Error(\"Unknown prime \" + name);\n return primes[name] = prime2, prime2;\n };\n function Red(m) {\n if (typeof m == \"string\") {\n var prime = BN._prime(m);\n this.m = prime.p, this.prime = prime;\n } else\n assert(m.gtn(1), \"modulus must be greater than 1\"), this.m = m, this.prime = null;\n }\n Red.prototype = {}, Red.prototype._verify1 = function(a) {\n assert(a.negative === 0, \"red works only with positives\"), assert(a.red, \"red works only with red numbers\");\n }, Red.prototype._verify2 = function(a, b) {\n assert((a.negative | b.negative) === 0, \"red works only with positives\"), assert(a.red && a.red === b.red, \"red works only with red numbers\");\n }, Red.prototype.imod = function(a) {\n return this.prime \? this.prime.ireduce(a)._forceRed(this) : a.umod(this.m)._forceRed(this);\n }, Red.prototype.neg = function(a) {\n return a.isZero() \? a.clone() : this.m.sub(a)._forceRed(this);\n }, Red.prototype.add = function(a, b) {\n this._verify2(a, b);\n var res = a.add(b);\n return res.cmp(this.m) >= 0 && res.isub(this.m), res._forceRed(this);\n }, Red.prototype.iadd = function(a, b) {\n this._verify2(a, b);\n var res = a.iadd(b);\n return res.cmp(this.m) >= 0 && res.isub(this.m), res;\n }, Red.prototype.sub = function(a, b) {\n this._verify2(a, b);\n var res = a.sub(b);\n return res.cmpn(0) < 0 && res.iadd(this.m), res._forceRed(this);\n }, Red.prototype.isub = function(a, b) {\n this._verify2(a, b);\n var res = a.isub(b);\n return res.cmpn(0) < 0 && res.iadd(this.m), res;\n }, Red.prototype.shl = function(a, num) {\n return this._verify1(a), this.imod(a.ushln(num));\n }, Red.prototype.imul = function(a, b) {\n return this._verify2(a, b), this.imod(a.imul(b));\n }, Red.prototype.mul = function(a, b) {\n return this._verify2(a, b), this.imod(a.mul(b));\n }, Red.prototype.isqr = function(a) {\n return this.imul(a, a.clone());\n }, Red.prototype.sqr = function(a) {\n return this.mul(a, a);\n }, Red.prototype.sqrt = function(a) {\n if (a.isZero())\n return a.clone();\n var mod3 = this.m.andln(3);\n if (assert(mod3 % 2 === 1), mod3 === 3) {\n var pow = this.m.add(new BN(1)).iushrn(2);\n return this.pow(a, pow);\n }\n for (var q = this.m.subn(1), s = 0;!q.isZero() && q.andln(1) === 0; )\n s++, q.iushrn(1);\n assert(!q.isZero());\n var one = new BN(1).toRed(this), nOne = one.redNeg(), lpow = this.m.subn(1).iushrn(1), z = this.m.bitLength();\n for (z = new BN(2 * z * z).toRed(this);this.pow(z, lpow).cmp(nOne) !== 0; )\n z.redIAdd(nOne);\n for (var c = this.pow(z, q), r = this.pow(a, q.addn(1).iushrn(1)), t = this.pow(a, q), m = s;t.cmp(one) !== 0; ) {\n for (var tmp = t, i = 0;tmp.cmp(one) !== 0; i++)\n tmp = tmp.redSqr();\n assert(i < m);\n var b = this.pow(c, new BN(1).iushln(m - i - 1));\n r = r.redMul(b), c = b.redSqr(), t = t.redMul(c), m = i;\n }\n return r;\n }, Red.prototype.invm = function(a) {\n var inv = a._invmp(this.m);\n return inv.negative !== 0 \? (inv.negative = 0, this.imod(inv).redNeg()) : this.imod(inv);\n }, Red.prototype.pow = function(a, num) {\n if (num.isZero())\n return new BN(1).toRed(this);\n if (num.cmpn(1) === 0)\n return a.clone();\n var windowSize = 4, wnd = new @Array(1 << windowSize);\n wnd[0] = new BN(1).toRed(this), wnd[1] = a;\n for (var i = 2;i < wnd.length; i++)\n wnd[i] = this.mul(wnd[i - 1], a);\n var res = wnd[0], current = 0, currentLen = 0, start = num.bitLength() % 26;\n for (start === 0 && (start = 26), i = num.length - 1;i >= 0; i--) {\n for (var word = num.words[i], j = start - 1;j >= 0; j--) {\n var bit = word >> j & 1;\n if (res !== wnd[0] && (res = this.sqr(res)), bit === 0 && current === 0) {\n currentLen = 0;\n continue;\n }\n current <<= 1, current |= bit, currentLen++, !(currentLen !== windowSize && (i !== 0 || j !== 0)) && (res = this.mul(res, wnd[current]), currentLen = 0, current = 0);\n }\n start = 26;\n }\n return res;\n }, Red.prototype.convertTo = function(num) {\n var r = num.umod(this.m);\n return r === num \? r.clone() : r;\n }, Red.prototype.convertFrom = function(num) {\n var res = num.clone();\n return res.red = null, res;\n }, BN.mont = function(num) {\n return new Mont(num);\n };\n function Mont(m) {\n Red.@call(this, m), this.shift = this.m.bitLength(), this.shift % 26 !== 0 && (this.shift += 26 - this.shift % 26), this.r = new BN(1).iushln(this.shift), this.r2 = this.imod(this.r.sqr()), this.rinv = this.r._invmp(this.m), this.minv = this.rinv.mul(this.r).isubn(1).div(this.m), this.minv = this.minv.umod(this.r), this.minv = this.r.sub(this.minv);\n }\n inherits(Mont, Red), Mont.prototype.convertTo = function(num) {\n return this.imod(num.ushln(this.shift));\n }, Mont.prototype.convertFrom = function(num) {\n var r = this.imod(num.mul(this.rinv));\n return r.red = null, r;\n }, Mont.prototype.imul = function(a, b) {\n if (a.isZero() || b.isZero())\n return a.words[0] = 0, a.length = 1, a;\n var t = a.imul(b), c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), u = t.isub(c).iushrn(this.shift), res = u;\n return u.cmp(this.m) >= 0 \? res = u.isub(this.m) : u.cmpn(0) < 0 && (res = u.iadd(this.m)), res._forceRed(this);\n }, Mont.prototype.mul = function(a, b) {\n if (a.isZero() || b.isZero())\n return new BN(0)._forceRed(this);\n var t = a.mul(b), c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), u = t.isub(c).iushrn(this.shift), res = u;\n return u.cmp(this.m) >= 0 \? res = u.isub(this.m) : u.cmpn(0) < 0 && (res = u.iadd(this.m)), res._forceRed(this);\n }, Mont.prototype.invm = function(a) {\n var res = this.imod(a._invmp(this.m).mul(this.r2));\n return res._forceRed(this);\n };\n })(typeof module > \"u\" || module, exports);\n }\n}), require_bn2 = require_bn, require_brorand = __commonJS({\n \"node_modules/brorand/index.js\"(exports, module) {\n var r;\n module.exports = function(len) {\n return r || (r = new Rand(null)), r.generate(len);\n };\n function Rand(rand) {\n this.rand = rand;\n }\n Rand.prototype = {}, module.exports.Rand = Rand, Rand.prototype.generate = function(len) {\n return this._rand(len);\n }, Rand.prototype._rand = function(n) {\n var out = new Buffer(n);\n return crypto.getRandomValues(out), out;\n };\n }\n}), require_mr = __commonJS({\n \"node_modules/miller-rabin/lib/mr.js\"(exports, module) {\n var bn = require_bn2(), brorand = require_brorand();\n function MillerRabin(rand) {\n this.rand = rand || new brorand.Rand;\n }\n module.exports = MillerRabin, MillerRabin.create = function(rand) {\n return new MillerRabin(rand);\n }, MillerRabin.prototype = {}, MillerRabin.prototype._randbelow = function(n) {\n var len = n.bitLength(), min_bytes = Math.ceil(len / 8);\n do\n var a = new bn(this.rand.generate(min_bytes));\n while (a.cmp(n) >= 0);\n return a;\n }, MillerRabin.prototype._randrange = function(start, stop) {\n var size = stop.sub(start);\n return start.add(this._randbelow(size));\n }, MillerRabin.prototype.test = function(n, k, cb) {\n var len = n.bitLength(), red = bn.mont(n), rone = new bn(1).toRed(red);\n k || (k = Math.max(1, len / 48 | 0));\n for (var n1 = n.subn(1), s = 0;!n1.testn(s); s++)\n ;\n for (var d = n.shrn(s), rn1 = n1.toRed(red), prime = !0;k > 0; k--) {\n var a = this._randrange(new bn(2), n1);\n cb && cb(a);\n var x = a.toRed(red).redPow(d);\n if (!(x.cmp(rone) === 0 || x.cmp(rn1) === 0)) {\n for (var i = 1;i < s; i++) {\n if (x = x.redSqr(), x.cmp(rone) === 0)\n return !1;\n if (x.cmp(rn1) === 0)\n break;\n }\n if (i === s)\n return !1;\n }\n }\n return prime;\n }, MillerRabin.prototype.getDivisor = function(n, k) {\n var len = n.bitLength(), red = bn.mont(n), rone = new bn(1).toRed(red);\n k || (k = Math.max(1, len / 48 | 0));\n for (var n1 = n.subn(1), s = 0;!n1.testn(s); s++)\n ;\n for (var d = n.shrn(s), rn1 = n1.toRed(red);k > 0; k--) {\n var a = this._randrange(new bn(2), n1), g = n.gcd(a);\n if (g.cmpn(1) !== 0)\n return g;\n var x = a.toRed(red).redPow(d);\n if (!(x.cmp(rone) === 0 || x.cmp(rn1) === 0)) {\n for (var i = 1;i < s; i++) {\n if (x = x.redSqr(), x.cmp(rone) === 0)\n return x.fromRed().subn(1).gcd(n);\n if (x.cmp(rn1) === 0)\n break;\n }\n if (i === s)\n return x = x.redSqr(), x.fromRed().subn(1).gcd(n);\n }\n }\n return !1;\n };\n }\n}), require_generatePrime = __commonJS({\n \"node_modules/diffie-hellman/lib/generatePrime.js\"(exports, module) {\n var randomBytes = require_browser();\n module.exports = findPrime, findPrime.simpleSieve = simpleSieve, findPrime.fermatTest = fermatTest;\n var BN = require_bn(), TWENTYFOUR = new BN(24), MillerRabin = require_mr(), millerRabin = new MillerRabin, ONE = new BN(1), TWO = new BN(2), FIVE = new BN(5), SIXTEEN = new BN(16), EIGHT = new BN(8), TEN = new BN(10), THREE = new BN(3), SEVEN = new BN(7), ELEVEN = new BN(11), FOUR = new BN(4), TWELVE = new BN(12), primes = null;\n function _getPrimes() {\n if (primes !== null)\n return primes;\n var limit = 1048576, res = [];\n res[0] = 2;\n for (var i = 1, k = 3;k < limit; k += 2) {\n for (var sqrt = Math.ceil(Math.sqrt(k)), j = 0;j < i && res[j] <= sqrt && k % res[j] !== 0; j++)\n ;\n i !== j && res[j] <= sqrt || (res[i++] = k);\n }\n return primes = res, res;\n }\n function simpleSieve(p) {\n for (var primes2 = _getPrimes(), i = 0;i < primes2.length; i++)\n if (p.modn(primes2[i]) === 0)\n return p.cmpn(primes2[i]) === 0;\n return !0;\n }\n function fermatTest(p) {\n var red = BN.mont(p);\n return TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1) === 0;\n }\n function findPrime(bits, gen) {\n if (bits < 16)\n return gen === 2 || gen === 5 \? new BN([140, 123]) : new BN([140, 39]);\n gen = new BN(gen);\n for (var num, n2;; ) {\n for (num = new BN(randomBytes(Math.ceil(bits / 8)));num.bitLength() > bits; )\n num.ishrn(1);\n if (num.isEven() && num.iadd(ONE), num.testn(1) || num.iadd(TWO), gen.cmp(TWO)) {\n if (!gen.cmp(FIVE))\n for (;num.mod(TEN).cmp(THREE); )\n num.iadd(FOUR);\n } else\n for (;num.mod(TWENTYFOUR).cmp(ELEVEN); )\n num.iadd(FOUR);\n if (n2 = num.shrn(1), simpleSieve(n2) && simpleSieve(num) && fermatTest(n2) && fermatTest(num) && millerRabin.test(n2) && millerRabin.test(num))\n return num;\n }\n }\n }\n}), require_primes = __commonJS({\n \"node_modules/diffie-hellman/lib/primes.json\"(exports, module) {\n module.exports = {\n modp1: {\n gen: \"02\",\n prime: \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff\"\n },\n modp2: {\n gen: \"02\",\n prime: \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff\"\n },\n modp5: {\n gen: \"02\",\n prime: \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff\"\n },\n modp14: {\n gen: \"02\",\n prime: \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff\"\n },\n modp15: {\n gen: \"02\",\n prime: \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff\"\n },\n modp16: {\n gen: \"02\",\n prime: \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff\"\n },\n modp17: {\n gen: \"02\",\n prime: \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff\"\n },\n modp18: {\n gen: \"02\",\n prime: \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff\"\n }\n };\n }\n}), require_dh = __commonJS({\n \"node_modules/diffie-hellman/lib/dh.js\"(exports, module) {\n var BN = require_bn(), MillerRabin = require_mr(), millerRabin = new MillerRabin, TWENTYFOUR = new BN(24), ELEVEN = new BN(11), TEN = new BN(10), THREE = new BN(3), SEVEN = new BN(7), primes = require_generatePrime(), randomBytes = require_browser();\n module.exports = DH;\n function setPublicKey(pub, enc) {\n return enc = enc || \"utf8\", Buffer.isBuffer(pub) || (pub = new Buffer(pub, enc)), this._pub = new BN(pub), this;\n }\n function setPrivateKey(priv, enc) {\n return enc = enc || \"utf8\", Buffer.isBuffer(priv) || (priv = new Buffer(priv, enc)), this._priv = new BN(priv), this;\n }\n var primeCache = {};\n function checkPrime(prime, generator) {\n var gen = generator.toString(\"hex\"), hex = [gen, prime.toString(16)].join(\"_\");\n if (hex in primeCache)\n return primeCache[hex];\n var error = 0;\n if (prime.isEven() || !primes.simpleSieve || !primes.fermatTest(prime) || !millerRabin.test(prime))\n return error += 1, gen === \"02\" || gen === \"05\" \? error += 8 : error += 4, primeCache[hex] = error, error;\n millerRabin.test(prime.shrn(1)) || (error += 2);\n var rem;\n switch (gen) {\n case \"02\":\n prime.mod(TWENTYFOUR).cmp(ELEVEN) && (error += 8);\n break;\n case \"05\":\n rem = prime.mod(TEN), rem.cmp(THREE) && rem.cmp(SEVEN) && (error += 8);\n break;\n default:\n error += 4;\n }\n return primeCache[hex] = error, error;\n }\n function DH(prime, generator, malleable) {\n this.setGenerator(generator), this.__prime = new BN(prime), this._prime = BN.mont(this.__prime), this._primeLen = prime.length, this._pub = void 0, this._priv = void 0, this._primeCode = void 0, malleable \? (this.setPublicKey = setPublicKey, this.setPrivateKey = setPrivateKey) : this._primeCode = 8;\n }\n DH.prototype = {}, Object.defineProperty(DH.prototype, \"verifyError\", {\n enumerable: !0,\n get: function() {\n return typeof this._primeCode != \"number\" && (this._primeCode = checkPrime(this.__prime, this.__gen)), this._primeCode;\n }\n }), DH.prototype.generateKeys = function() {\n return this._priv || (this._priv = new BN(randomBytes(this._primeLen))), this._pub = this._gen.toRed(this._prime).redPow(this._priv).fromRed(), this.getPublicKey();\n }, DH.prototype.computeSecret = function(other) {\n other = new BN(other), other = other.toRed(this._prime);\n var secret = other.redPow(this._priv).fromRed(), out = new Buffer(secret.toArray()), prime = this.getPrime();\n if (out.length < prime.length) {\n var front = new Buffer(prime.length - out.length);\n front.fill(0), out = Buffer.concat([front, out]);\n }\n return out;\n }, DH.prototype.getPublicKey = function(enc) {\n return formatReturnValue(this._pub, enc);\n }, DH.prototype.getPrivateKey = function(enc) {\n return formatReturnValue(this._priv, enc);\n }, DH.prototype.getPrime = function(enc) {\n return formatReturnValue(this.__prime, enc);\n }, DH.prototype.getGenerator = function(enc) {\n return formatReturnValue(this._gen, enc);\n }, DH.prototype.setGenerator = function(gen, enc) {\n return enc = enc || \"utf8\", Buffer.isBuffer(gen) || (gen = new Buffer(gen, enc)), this.__gen = gen, this._gen = new BN(gen), this;\n };\n function formatReturnValue(bn, enc) {\n var buf = new Buffer(bn.toArray());\n return enc \? buf.toString(enc) : buf;\n }\n }\n}), require_browser7 = __commonJS({\n \"node_modules/diffie-hellman/browser.js\"(exports) {\n var generatePrime = require_generatePrime(), primes = require_primes(), DH = require_dh();\n function getDiffieHellman(mod) {\n var prime = new Buffer(primes[mod].prime, \"hex\"), gen = new Buffer(primes[mod].gen, \"hex\");\n return new DH(prime, gen);\n }\n var ENCODINGS = {\n binary: !0,\n hex: !0,\n base64: !0\n };\n function createDiffieHellman(prime, enc, generator, genc) {\n return Buffer.isBuffer(enc) || ENCODINGS[enc] === void 0 \? createDiffieHellman(prime, \"binary\", enc, generator) : (enc = enc || \"binary\", genc = genc || \"binary\", generator = generator || new Buffer([2]), Buffer.isBuffer(generator) || (generator = new Buffer(generator, genc)), typeof prime == \"number\" \? new DH(generatePrime(prime, generator), generator, !0) : (Buffer.isBuffer(prime) || (prime = new Buffer(prime, enc)), new DH(prime, generator, !0)));\n }\n exports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffieHellman = getDiffieHellman, exports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman;\n }\n}), require_bn3 = require_bn, require_browserify_rsa = __commonJS({\n \"node_modules/browserify-rsa/index.js\"(exports, module) {\n var BN = require_bn3(), randomBytes = require_browser();\n function blind(priv) {\n var r = getr(priv), blinder = r.toRed(BN.mont(priv.modulus)).redPow(new BN(priv.publicExponent)).fromRed();\n return { blinder, unblinder: r.invm(priv.modulus) };\n }\n function getr(priv) {\n var len = priv.modulus.byteLength(), r;\n do\n r = new BN(randomBytes(len));\n while (r.cmp(priv.modulus) >= 0 || !r.umod(priv.prime1) || !r.umod(priv.prime2));\n return r;\n }\n function crt(msg, priv) {\n var blinds = blind(priv), len = priv.modulus.byteLength(), blinded = new BN(msg).mul(blinds.blinder).umod(priv.modulus), c1 = blinded.toRed(BN.mont(priv.prime1)), c2 = blinded.toRed(BN.mont(priv.prime2)), qinv = priv.coefficient, p = priv.prime1, q = priv.prime2, m1 = c1.redPow(priv.exponent1).fromRed(), m2 = c2.redPow(priv.exponent2).fromRed(), h = m1.isub(m2).imul(qinv).umod(p).imul(q);\n return m2.iadd(h).imul(blinds.unblinder).umod(priv.modulus).toArrayLike(Buffer, \"be\", len);\n }\n crt.getr = getr, module.exports = crt;\n }\n}), require_package = __commonJS({\n \"node_modules/elliptic/package.json\"(exports, module) {\n module.exports = {\n name: \"elliptic\",\n version: \"6.5.4\",\n description: \"EC cryptography\",\n main: \"lib/elliptic.js\",\n files: [\"lib\"],\n scripts: {\n lint: \"eslint lib test\",\n \"lint:fix\": \"npm run lint -- --fix\",\n unit: \"istanbul test _mocha --reporter=spec test/index.js\",\n test: \"npm run lint && npm run unit\",\n version: \"grunt dist && git add dist/\"\n },\n repository: {\n type: \"git\",\n url: \"git@github.com:indutny/elliptic\"\n },\n keywords: [\"EC\", \"Elliptic\", \"curve\", \"Cryptography\"],\n author: \"Fedor Indutny \",\n license: \"MIT\",\n bugs: {\n url: \"https://github.com/indutny/elliptic/issues\"\n },\n homepage: \"https://github.com/indutny/elliptic\",\n devDependencies: {\n brfs: \"^2.0.2\",\n coveralls: \"^3.1.0\",\n eslint: \"^7.6.0\",\n grunt: \"^1.2.1\",\n \"grunt-browserify\": \"^5.3.0\",\n \"grunt-cli\": \"^1.3.2\",\n \"grunt-contrib-connect\": \"^3.0.0\",\n \"grunt-contrib-copy\": \"^1.0.0\",\n \"grunt-contrib-uglify\": \"^5.0.0\",\n \"grunt-mocha-istanbul\": \"^5.0.2\",\n \"grunt-saucelabs\": \"^9.0.1\",\n istanbul: \"^0.4.5\",\n mocha: \"^8.0.1\"\n },\n dependencies: {\n \"bn.js\": \"^4.11.9\",\n brorand: \"^1.1.0\",\n \"hash.js\": \"^1.0.0\",\n \"hmac-drbg\": \"^1.0.1\",\n inherits: \"^2.0.4\",\n \"minimalistic-assert\": \"^1.0.1\",\n \"minimalistic-crypto-utils\": \"^1.0.1\"\n }\n };\n }\n}), require_bn4 = require_bn, require_utils2 = __commonJS({\n \"node_modules/minimalistic-crypto-utils/lib/utils.js\"(exports) {\n var utils = exports;\n function toArray(msg, enc) {\n if (@Array.isArray(msg))\n return msg.slice();\n if (!msg)\n return [];\n var res = [];\n if (typeof msg != \"string\") {\n for (var i = 0;i < msg.length; i++)\n res[i] = msg[i] | 0;\n return res;\n }\n if (enc === \"hex\") {\n msg = msg.replace(/[^a-z0-9]+/gi, \"\"), msg.length % 2 !== 0 && (msg = \"0\" + msg);\n for (var i = 0;i < msg.length; i += 2)\n res.push(parseInt(msg[i] + msg[i + 1], 16));\n } else\n for (var i = 0;i < msg.length; i++) {\n var c = msg.charCodeAt(i), hi = c >> 8, lo = c & 255;\n hi \? res.push(hi, lo) : res.push(lo);\n }\n return res;\n }\n utils.toArray = toArray;\n function zero2(word) {\n return word.length === 1 \? \"0\" + word : word;\n }\n utils.zero2 = zero2;\n function toHex(msg) {\n for (var res = \"\", i = 0;i < msg.length; i++)\n res += zero2(msg[i].toString(16));\n return res;\n }\n utils.toHex = toHex, utils.encode = function(arr, enc) {\n return enc === \"hex\" \? toHex(arr) : arr;\n };\n }\n}), require_utils3 = __commonJS({\n \"node_modules/elliptic/lib/elliptic/utils.js\"(exports) {\n var utils = exports, BN = require_bn4(), minAssert = require_minimalistic_assert(), minUtils = require_utils2();\n utils.assert = minAssert, utils.toArray = minUtils.toArray, utils.zero2 = minUtils.zero2, utils.toHex = minUtils.toHex, utils.encode = minUtils.encode;\n function getNAF(num, w, bits) {\n var naf = new @Array(Math.max(num.bitLength(), bits) + 1);\n naf.fill(0);\n for (var ws = 1 << w + 1, k = num.clone(), i = 0;i < naf.length; i++) {\n var z, mod = k.andln(ws - 1);\n k.isOdd() \? (mod > (ws >> 1) - 1 \? z = (ws >> 1) - mod : z = mod, k.isubn(z)) : z = 0, naf[i] = z, k.iushrn(1);\n }\n return naf;\n }\n utils.getNAF = getNAF;\n function getJSF(k1, k2) {\n var jsf = [[], []];\n k1 = k1.clone(), k2 = k2.clone();\n for (var d1 = 0, d2 = 0, m8;k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0; ) {\n var m14 = k1.andln(3) + d1 & 3, m24 = k2.andln(3) + d2 & 3;\n m14 === 3 && (m14 = -1), m24 === 3 && (m24 = -1);\n var u1;\n (m14 & 1) === 0 \? u1 = 0 : (m8 = k1.andln(7) + d1 & 7, (m8 === 3 || m8 === 5) && m24 === 2 \? u1 = -m14 : u1 = m14), jsf[0].push(u1);\n var u2;\n (m24 & 1) === 0 \? u2 = 0 : (m8 = k2.andln(7) + d2 & 7, (m8 === 3 || m8 === 5) && m14 === 2 \? u2 = -m24 : u2 = m24), jsf[1].push(u2), 2 * d1 === u1 + 1 && (d1 = 1 - d1), 2 * d2 === u2 + 1 && (d2 = 1 - d2), k1.iushrn(1), k2.iushrn(1);\n }\n return jsf;\n }\n utils.getJSF = getJSF;\n function cachedProperty(obj, name, computer) {\n var key2 = \"_\" + name;\n obj.prototype[name] = function() {\n return this[key2] !== void 0 \? this[key2] : this[key2] = computer.@call(this);\n };\n }\n utils.cachedProperty = cachedProperty;\n function parseBytes(bytes) {\n if (bytes instanceof KeyObject)\n bytes = bytes.export();\n else if (bytes instanceof CryptoKey)\n bytes = KeyObject.from(bytes).export();\n return typeof bytes == \"string\" \? utils.toArray(bytes, \"hex\") : bytes;\n }\n utils.parseBytes = parseBytes;\n function intFromLE(bytes) {\n return new BN(bytes, \"hex\", \"le\");\n }\n utils.intFromLE = intFromLE;\n }\n}), require_base = __commonJS({\n \"node_modules/elliptic/lib/elliptic/curve/base.js\"(exports, module) {\n var BN = require_bn4(), utils = require_utils3(), getNAF = utils.getNAF, getJSF = utils.getJSF, assert = utils.assert;\n function BaseCurve(type, conf) {\n this.type = type, this.p = new BN(conf.p, 16), this.red = conf.prime \? BN.red(conf.prime) : BN.mont(this.p), this.zero = new BN(0).toRed(this.red), this.one = new BN(1).toRed(this.red), this.two = new BN(2).toRed(this.red), this.n = conf.n && new BN(conf.n, 16), this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed), this._wnafT1 = new @Array(4), this._wnafT2 = new @Array(4), this._wnafT3 = new @Array(4), this._wnafT4 = new @Array(4), this._bitLength = this.n \? this.n.bitLength() : 0;\n var adjustCount = this.n && this.p.div(this.n);\n !adjustCount || adjustCount.cmpn(100) > 0 \? this.redN = null : (this._maxwellTrick = !0, this.redN = this.n.toRed(this.red));\n }\n module.exports = BaseCurve, BaseCurve.prototype = {}, BaseCurve.prototype.point = function() {\n throw new Error(\"Not implemented\");\n }, BaseCurve.prototype.validate = function() {\n throw new Error(\"Not implemented\");\n }, BaseCurve.prototype._fixedNafMul = function(p, k) {\n assert(p.precomputed);\n var doubles = p._getDoubles(), naf = getNAF(k, 1, this._bitLength), I = (1 << doubles.step + 1) - (doubles.step % 2 === 0 \? 2 : 1);\n I /= 3;\n var repr = [], j, nafW;\n for (j = 0;j < naf.length; j += doubles.step) {\n nafW = 0;\n for (var l = j + doubles.step - 1;l >= j; l--)\n nafW = (nafW << 1) + naf[l];\n repr.push(nafW);\n }\n for (var a = this.jpoint(null, null, null), b = this.jpoint(null, null, null), i = I;i > 0; i--) {\n for (j = 0;j < repr.length; j++)\n nafW = repr[j], nafW === i \? b = b.mixedAdd(doubles.points[j]) : nafW === -i && (b = b.mixedAdd(doubles.points[j].neg()));\n a = a.add(b);\n }\n return a.toP();\n }, BaseCurve.prototype._wnafMul = function(p, k) {\n var w = 4, nafPoints = p._getNAFPoints(w);\n w = nafPoints.wnd;\n for (var wnd = nafPoints.points, naf = getNAF(k, w, this._bitLength), acc = this.jpoint(null, null, null), i = naf.length - 1;i >= 0; i--) {\n for (var l = 0;i >= 0 && naf[i] === 0; i--)\n l++;\n if (i >= 0 && l++, acc = acc.dblp(l), i < 0)\n break;\n var z = naf[i];\n assert(z !== 0), p.type === \"affine\" \? z > 0 \? acc = acc.mixedAdd(wnd[z - 1 >> 1]) : acc = acc.mixedAdd(wnd[-z - 1 >> 1].neg()) : z > 0 \? acc = acc.add(wnd[z - 1 >> 1]) : acc = acc.add(wnd[-z - 1 >> 1].neg());\n }\n return p.type === \"affine\" \? acc.toP() : acc;\n }, BaseCurve.prototype._wnafMulAdd = function(defW, points, coeffs, len, jacobianResult) {\n var wndWidth = this._wnafT1, wnd = this._wnafT2, naf = this._wnafT3, max = 0, i, j, p;\n for (i = 0;i < len; i++) {\n p = points[i];\n var nafPoints = p._getNAFPoints(defW);\n wndWidth[i] = nafPoints.wnd, wnd[i] = nafPoints.points;\n }\n for (i = len - 1;i >= 1; i -= 2) {\n var a = i - 1, b = i;\n if (wndWidth[a] !== 1 || wndWidth[b] !== 1) {\n naf[a] = getNAF(coeffs[a], wndWidth[a], this._bitLength), naf[b] = getNAF(coeffs[b], wndWidth[b], this._bitLength), max = Math.max(naf[a].length, max), max = Math.max(naf[b].length, max);\n continue;\n }\n var comb = [points[a], null, null, points[b]];\n points[a].y.cmp(points[b].y) === 0 \? (comb[1] = points[a].add(points[b]), comb[2] = points[a].toJ().mixedAdd(points[b].neg())) : points[a].y.cmp(points[b].y.redNeg()) === 0 \? (comb[1] = points[a].toJ().mixedAdd(points[b]), comb[2] = points[a].add(points[b].neg())) : (comb[1] = points[a].toJ().mixedAdd(points[b]), comb[2] = points[a].toJ().mixedAdd(points[b].neg()));\n var index = [-3, -1, -5, -7, 0, 7, 5, 1, 3], jsf = getJSF(coeffs[a], coeffs[b]);\n for (max = Math.max(jsf[0].length, max), naf[a] = new @Array(max), naf[b] = new @Array(max), j = 0;j < max; j++) {\n var ja = jsf[0][j] | 0, jb = jsf[1][j] | 0;\n naf[a][j] = index[(ja + 1) * 3 + (jb + 1)], naf[b][j] = 0, wnd[a] = comb;\n }\n }\n var acc = this.jpoint(null, null, null), tmp = this._wnafT4;\n for (i = max;i >= 0; i--) {\n for (var k = 0;i >= 0; ) {\n var zero = !0;\n for (j = 0;j < len; j++)\n tmp[j] = naf[j][i] | 0, tmp[j] !== 0 && (zero = !1);\n if (!zero)\n break;\n k++, i--;\n }\n if (i >= 0 && k++, acc = acc.dblp(k), i < 0)\n break;\n for (j = 0;j < len; j++) {\n var z = tmp[j];\n z !== 0 && (z > 0 \? p = wnd[j][z - 1 >> 1] : z < 0 && (p = wnd[j][-z - 1 >> 1].neg()), p.type === \"affine\" \? acc = acc.mixedAdd(p) : acc = acc.add(p));\n }\n }\n for (i = 0;i < len; i++)\n wnd[i] = null;\n return jacobianResult \? acc : acc.toP();\n };\n function BasePoint(curve, type) {\n this.curve = curve, this.type = type, this.precomputed = null;\n }\n BasePoint.prototype = {}, BaseCurve.BasePoint = BasePoint, BasePoint.prototype.eq = function() {\n throw new Error(\"Not implemented\");\n }, BasePoint.prototype.validate = function() {\n return this.curve.validate(this);\n }, BaseCurve.prototype.decodePoint = function(bytes, enc) {\n bytes = utils.toArray(bytes, enc);\n var len = this.p.byteLength();\n if ((bytes[0] === 4 || bytes[0] === 6 || bytes[0] === 7) && bytes.length - 1 === 2 * len) {\n bytes[0] === 6 \? assert(bytes[bytes.length - 1] % 2 === 0) : bytes[0] === 7 && assert(bytes[bytes.length - 1] % 2 === 1);\n var res = this.point(bytes.slice(1, 1 + len), bytes.slice(1 + len, 1 + 2 * len));\n return res;\n } else if ((bytes[0] === 2 || bytes[0] === 3) && bytes.length - 1 === len)\n return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 3);\n throw new Error(\"Unknown point format\");\n }, BasePoint.prototype.encodeCompressed = function(enc) {\n return this.encode(enc, !0);\n }, BasePoint.prototype._encode = function(compact) {\n var len = this.curve.p.byteLength(), x = this.getX().toArray(\"be\", len);\n return compact \? [this.getY().isEven() \? 2 : 3].concat(x) : [4].concat(x, this.getY().toArray(\"be\", len));\n }, BasePoint.prototype.encode = function(enc, compact) {\n return utils.encode(this._encode(compact), enc);\n }, BasePoint.prototype.precompute = function(power) {\n if (this.precomputed)\n return this;\n var precomputed = {\n doubles: null,\n naf: null,\n beta: null\n };\n return precomputed.naf = this._getNAFPoints(8), precomputed.doubles = this._getDoubles(4, power), precomputed.beta = this._getBeta(), this.precomputed = precomputed, this;\n }, BasePoint.prototype._hasDoubles = function(k) {\n if (!this.precomputed)\n return !1;\n var doubles = this.precomputed.doubles;\n return doubles \? doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step) : !1;\n }, BasePoint.prototype._getDoubles = function(step, power) {\n if (this.precomputed && this.precomputed.doubles)\n return this.precomputed.doubles;\n for (var doubles = [this], acc = this, i = 0;i < power; i += step) {\n for (var j = 0;j < step; j++)\n acc = acc.dbl();\n doubles.push(acc);\n }\n return {\n step,\n points: doubles\n };\n }, BasePoint.prototype._getNAFPoints = function(wnd) {\n if (this.precomputed && this.precomputed.naf)\n return this.precomputed.naf;\n for (var res = [this], max = (1 << wnd) - 1, dbl = max === 1 \? null : this.dbl(), i = 1;i < max; i++)\n res[i] = res[i - 1].add(dbl);\n return {\n wnd,\n points: res\n };\n }, BasePoint.prototype._getBeta = function() {\n return null;\n }, BasePoint.prototype.dblp = function(k) {\n for (var r = this, i = 0;i < k; i++)\n r = r.dbl();\n return r;\n };\n }\n}), require_short = __commonJS({\n \"node_modules/elliptic/lib/elliptic/curve/short.js\"(exports, module) {\n var utils = require_utils3(), BN = require_bn4(), inherits = require_inherits_browser(), Base = require_base(), assert = utils.assert;\n function ShortCurve(conf) {\n Base.@call(this, \"short\", conf), this.a = new BN(conf.a, 16).toRed(this.red), this.b = new BN(conf.b, 16).toRed(this.red), this.tinv = this.two.redInvm(), this.zeroA = this.a.fromRed().cmpn(0) === 0, this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0, this.endo = this._getEndomorphism(conf), this._endoWnafT1 = new @Array(4), this._endoWnafT2 = new @Array(4);\n }\n inherits(ShortCurve, Base), module.exports = ShortCurve, ShortCurve.prototype._getEndomorphism = function(conf) {\n if (!(!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)) {\n var beta, lambda;\n if (conf.beta)\n beta = new BN(conf.beta, 16).toRed(this.red);\n else {\n var betas = this._getEndoRoots(this.p);\n beta = betas[0].cmp(betas[1]) < 0 \? betas[0] : betas[1], beta = beta.toRed(this.red);\n }\n if (conf.lambda)\n lambda = new BN(conf.lambda, 16);\n else {\n var lambdas = this._getEndoRoots(this.n);\n this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0 \? lambda = lambdas[0] : (lambda = lambdas[1], assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0));\n }\n var basis;\n return conf.basis \? basis = conf.basis.map(function(vec) {\n return {\n a: new BN(vec.a, 16),\n b: new BN(vec.b, 16)\n };\n }) : basis = this._getEndoBasis(lambda), {\n beta,\n lambda,\n basis\n };\n }\n }, ShortCurve.prototype._getEndoRoots = function(num) {\n var red = num === this.p \? this.red : BN.mont(num), tinv = new BN(2).toRed(red).redInvm(), ntinv = tinv.redNeg(), s = new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv), l1 = ntinv.redAdd(s).fromRed(), l2 = ntinv.redSub(s).fromRed();\n return [l1, l2];\n }, ShortCurve.prototype._getEndoBasis = function(lambda) {\n for (var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), u = lambda, v = this.n.clone(), x1 = new BN(1), y1 = new BN(0), x2 = new BN(0), y2 = new BN(1), a0, b0, a1, b1, a2, b2, prevR, i = 0, r, x;u.cmpn(0) !== 0; ) {\n var q = v.div(u);\n r = v.sub(q.mul(u)), x = x2.sub(q.mul(x1));\n var y = y2.sub(q.mul(y1));\n if (!a1 && r.cmp(aprxSqrt) < 0)\n a0 = prevR.neg(), b0 = x1, a1 = r.neg(), b1 = x;\n else if (a1 && ++i === 2)\n break;\n prevR = r, v = u, u = r, x2 = x1, x1 = x, y2 = y1, y1 = y;\n }\n a2 = r.neg(), b2 = x;\n var len1 = a1.sqr().add(b1.sqr()), len2 = a2.sqr().add(b2.sqr());\n return len2.cmp(len1) >= 0 && (a2 = a0, b2 = b0), a1.negative && (a1 = a1.neg(), b1 = b1.neg()), a2.negative && (a2 = a2.neg(), b2 = b2.neg()), [\n { a: a1, b: b1 },\n { a: a2, b: b2 }\n ];\n }, ShortCurve.prototype._endoSplit = function(k) {\n var basis = this.endo.basis, v1 = basis[0], v2 = basis[1], c1 = v2.b.mul(k).divRound(this.n), c2 = v1.b.neg().mul(k).divRound(this.n), p1 = c1.mul(v1.a), p2 = c2.mul(v2.a), q1 = c1.mul(v1.b), q2 = c2.mul(v2.b), k1 = k.sub(p1).sub(p2), k2 = q1.add(q2).neg();\n return { k1, k2 };\n }, ShortCurve.prototype.pointFromX = function(x, odd) {\n x = new BN(x, 16), x.red || (x = x.toRed(this.red));\n var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b), y = y2.redSqrt();\n if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)\n throw new Error(\"invalid point\");\n var isOdd = y.fromRed().isOdd();\n return (odd && !isOdd || !odd && isOdd) && (y = y.redNeg()), this.point(x, y);\n }, ShortCurve.prototype.validate = function(point) {\n if (point.inf)\n return !0;\n var { x, y } = point, ax = this.a.redMul(x), rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);\n return y.redSqr().redISub(rhs).cmpn(0) === 0;\n }, ShortCurve.prototype._endoWnafMulAdd = function(points, coeffs, jacobianResult) {\n for (var npoints = this._endoWnafT1, ncoeffs = this._endoWnafT2, i = 0;i < points.length; i++) {\n var split = this._endoSplit(coeffs[i]), p = points[i], beta = p._getBeta();\n split.k1.negative && (split.k1.ineg(), p = p.neg(!0)), split.k2.negative && (split.k2.ineg(), beta = beta.neg(!0)), npoints[i * 2] = p, npoints[i * 2 + 1] = beta, ncoeffs[i * 2] = split.k1, ncoeffs[i * 2 + 1] = split.k2;\n }\n for (var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult), j = 0;j < i * 2; j++)\n npoints[j] = null, ncoeffs[j] = null;\n return res;\n };\n function Point(curve, x, y, isRed) {\n Base.BasePoint.@call(this, curve, \"affine\"), x === null && y === null \? (this.x = null, this.y = null, this.inf = !0) : (this.x = new BN(x, 16), this.y = new BN(y, 16), isRed && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1);\n }\n inherits(Point, Base.BasePoint), ShortCurve.prototype.point = function(x, y, isRed) {\n return new Point(this, x, y, isRed);\n }, ShortCurve.prototype.pointFromJSON = function(obj, red) {\n return Point.fromJSON(this, obj, red);\n }, Point.prototype._getBeta = function() {\n if (this.curve.endo) {\n var pre = this.precomputed;\n if (pre && pre.beta)\n return pre.beta;\n var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y);\n if (pre) {\n var curve = this.curve, endoMul = function(p) {\n return curve.point(p.x.redMul(curve.endo.beta), p.y);\n };\n pre.beta = beta, beta.precomputed = {\n beta: null,\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: pre.naf.points.map(endoMul)\n },\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: pre.doubles.points.map(endoMul)\n }\n };\n }\n return beta;\n }\n }, Point.prototype.toJSON = function() {\n return this.precomputed \? [\n this.x,\n this.y,\n this.precomputed && {\n doubles: this.precomputed.doubles && {\n step: this.precomputed.doubles.step,\n points: this.precomputed.doubles.points.slice(1)\n },\n naf: this.precomputed.naf && {\n wnd: this.precomputed.naf.wnd,\n points: this.precomputed.naf.points.slice(1)\n }\n }\n ] : [this.x, this.y];\n }, Point.fromJSON = function(curve, obj, red) {\n typeof obj == \"string\" && (obj = JSON.parse(obj));\n var res = curve.point(obj[0], obj[1], red);\n if (!obj[2])\n return res;\n function obj2point(obj2) {\n return curve.point(obj2[0], obj2[1], red);\n }\n var pre = obj[2];\n return res.precomputed = {\n beta: null,\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: [res].concat(pre.doubles.points.map(obj2point))\n },\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: [res].concat(pre.naf.points.map(obj2point))\n }\n }, res;\n }, Point.prototype.inspect = function() {\n return this.isInfinity() \? \"\" : \"\";\n }, Point.prototype.isInfinity = function() {\n return this.inf;\n }, Point.prototype.add = function(p) {\n if (this.inf)\n return p;\n if (p.inf)\n return this;\n if (this.eq(p))\n return this.dbl();\n if (this.neg().eq(p))\n return this.curve.point(null, null);\n if (this.x.cmp(p.x) === 0)\n return this.curve.point(null, null);\n var c = this.y.redSub(p.y);\n c.cmpn(0) !== 0 && (c = c.redMul(this.x.redSub(p.x).redInvm()));\n var nx = c.redSqr().redISub(this.x).redISub(p.x), ny = c.redMul(this.x.redSub(nx)).redISub(this.y);\n return this.curve.point(nx, ny);\n }, Point.prototype.dbl = function() {\n if (this.inf)\n return this;\n var ys1 = this.y.redAdd(this.y);\n if (ys1.cmpn(0) === 0)\n return this.curve.point(null, null);\n var a = this.curve.a, x2 = this.x.redSqr(), dyinv = ys1.redInvm(), c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv), nx = c.redSqr().redISub(this.x.redAdd(this.x)), ny = c.redMul(this.x.redSub(nx)).redISub(this.y);\n return this.curve.point(nx, ny);\n }, Point.prototype.getX = function() {\n return this.x.fromRed();\n }, Point.prototype.getY = function() {\n return this.y.fromRed();\n }, Point.prototype.mul = function(k) {\n return k = new BN(k, 16), this.isInfinity() \? this : this._hasDoubles(k) \? this.curve._fixedNafMul(this, k) : this.curve.endo \? this.curve._endoWnafMulAdd([this], [k]) : this.curve._wnafMul(this, k);\n }, Point.prototype.mulAdd = function(k1, p2, k2) {\n var points = [this, p2], coeffs = [k1, k2];\n return this.curve.endo \? this.curve._endoWnafMulAdd(points, coeffs) : this.curve._wnafMulAdd(1, points, coeffs, 2);\n }, Point.prototype.jmulAdd = function(k1, p2, k2) {\n var points = [this, p2], coeffs = [k1, k2];\n return this.curve.endo \? this.curve._endoWnafMulAdd(points, coeffs, !0) : this.curve._wnafMulAdd(1, points, coeffs, 2, !0);\n }, Point.prototype.eq = function(p) {\n return this === p || this.inf === p.inf && (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0);\n }, Point.prototype.neg = function(_precompute) {\n if (this.inf)\n return this;\n var res = this.curve.point(this.x, this.y.redNeg());\n if (_precompute && this.precomputed) {\n var pre = this.precomputed, negate = function(p) {\n return p.neg();\n };\n res.precomputed = {\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: pre.naf.points.map(negate)\n },\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: pre.doubles.points.map(negate)\n }\n };\n }\n return res;\n }, Point.prototype.toJ = function() {\n if (this.inf)\n return this.curve.jpoint(null, null, null);\n var res = this.curve.jpoint(this.x, this.y, this.curve.one);\n return res;\n };\n function JPoint(curve, x, y, z) {\n Base.BasePoint.@call(this, curve, \"jacobian\"), x === null && y === null && z === null \? (this.x = this.curve.one, this.y = this.curve.one, this.z = new BN(0)) : (this.x = new BN(x, 16), this.y = new BN(y, 16), this.z = new BN(z, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one;\n }\n inherits(JPoint, Base.BasePoint), ShortCurve.prototype.jpoint = function(x, y, z) {\n return new JPoint(this, x, y, z);\n }, JPoint.prototype.toP = function() {\n if (this.isInfinity())\n return this.curve.point(null, null);\n var zinv = this.z.redInvm(), zinv2 = zinv.redSqr(), ax = this.x.redMul(zinv2), ay = this.y.redMul(zinv2).redMul(zinv);\n return this.curve.point(ax, ay);\n }, JPoint.prototype.neg = function() {\n return this.curve.jpoint(this.x, this.y.redNeg(), this.z);\n }, JPoint.prototype.add = function(p) {\n if (this.isInfinity())\n return p;\n if (p.isInfinity())\n return this;\n var pz2 = p.z.redSqr(), z2 = this.z.redSqr(), u1 = this.x.redMul(pz2), u2 = p.x.redMul(z2), s1 = this.y.redMul(pz2.redMul(p.z)), s2 = p.y.redMul(z2.redMul(this.z)), h = u1.redSub(u2), r = s1.redSub(s2);\n if (h.cmpn(0) === 0)\n return r.cmpn(0) !== 0 \? this.curve.jpoint(null, null, null) : this.dbl();\n var h2 = h.redSqr(), h3 = h2.redMul(h), v = u1.redMul(h2), nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v), ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)), nz = this.z.redMul(p.z).redMul(h);\n return this.curve.jpoint(nx, ny, nz);\n }, JPoint.prototype.mixedAdd = function(p) {\n if (this.isInfinity())\n return p.toJ();\n if (p.isInfinity())\n return this;\n var z2 = this.z.redSqr(), u1 = this.x, u2 = p.x.redMul(z2), s1 = this.y, s2 = p.y.redMul(z2).redMul(this.z), h = u1.redSub(u2), r = s1.redSub(s2);\n if (h.cmpn(0) === 0)\n return r.cmpn(0) !== 0 \? this.curve.jpoint(null, null, null) : this.dbl();\n var h2 = h.redSqr(), h3 = h2.redMul(h), v = u1.redMul(h2), nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v), ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)), nz = this.z.redMul(h);\n return this.curve.jpoint(nx, ny, nz);\n }, JPoint.prototype.dblp = function(pow) {\n if (pow === 0)\n return this;\n if (this.isInfinity())\n return this;\n if (!pow)\n return this.dbl();\n var i;\n if (this.curve.zeroA || this.curve.threeA) {\n var r = this;\n for (i = 0;i < pow; i++)\n r = r.dbl();\n return r;\n }\n var a = this.curve.a, tinv = this.curve.tinv, jx = this.x, jy = this.y, jz = this.z, jz4 = jz.redSqr().redSqr(), jyd = jy.redAdd(jy);\n for (i = 0;i < pow; i++) {\n var jx2 = jx.redSqr(), jyd2 = jyd.redSqr(), jyd4 = jyd2.redSqr(), c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)), t1 = jx.redMul(jyd2), nx = c.redSqr().redISub(t1.redAdd(t1)), t2 = t1.redISub(nx), dny = c.redMul(t2);\n dny = dny.redIAdd(dny).redISub(jyd4);\n var nz = jyd.redMul(jz);\n i + 1 < pow && (jz4 = jz4.redMul(jyd4)), jx = nx, jz = nz, jyd = dny;\n }\n return this.curve.jpoint(jx, jyd.redMul(tinv), jz);\n }, JPoint.prototype.dbl = function() {\n return this.isInfinity() \? this : this.curve.zeroA \? this._zeroDbl() : this.curve.threeA \? this._threeDbl() : this._dbl();\n }, JPoint.prototype._zeroDbl = function() {\n var nx, ny, nz;\n if (this.zOne) {\n var xx = this.x.redSqr(), yy = this.y.redSqr(), yyyy = yy.redSqr(), s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n s = s.redIAdd(s);\n var m = xx.redAdd(xx).redIAdd(xx), t = m.redSqr().redISub(s).redISub(s), yyyy8 = yyyy.redIAdd(yyyy);\n yyyy8 = yyyy8.redIAdd(yyyy8), yyyy8 = yyyy8.redIAdd(yyyy8), nx = t, ny = m.redMul(s.redISub(t)).redISub(yyyy8), nz = this.y.redAdd(this.y);\n } else {\n var a = this.x.redSqr(), b = this.y.redSqr(), c = b.redSqr(), d = this.x.redAdd(b).redSqr().redISub(a).redISub(c);\n d = d.redIAdd(d);\n var e = a.redAdd(a).redIAdd(a), f = e.redSqr(), c8 = c.redIAdd(c);\n c8 = c8.redIAdd(c8), c8 = c8.redIAdd(c8), nx = f.redISub(d).redISub(d), ny = e.redMul(d.redISub(nx)).redISub(c8), nz = this.y.redMul(this.z), nz = nz.redIAdd(nz);\n }\n return this.curve.jpoint(nx, ny, nz);\n }, JPoint.prototype._threeDbl = function() {\n var nx, ny, nz;\n if (this.zOne) {\n var xx = this.x.redSqr(), yy = this.y.redSqr(), yyyy = yy.redSqr(), s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n s = s.redIAdd(s);\n var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a), t = m.redSqr().redISub(s).redISub(s);\n nx = t;\n var yyyy8 = yyyy.redIAdd(yyyy);\n yyyy8 = yyyy8.redIAdd(yyyy8), yyyy8 = yyyy8.redIAdd(yyyy8), ny = m.redMul(s.redISub(t)).redISub(yyyy8), nz = this.y.redAdd(this.y);\n } else {\n var delta = this.z.redSqr(), gamma = this.y.redSqr(), beta = this.x.redMul(gamma), alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta));\n alpha = alpha.redAdd(alpha).redIAdd(alpha);\n var beta4 = beta.redIAdd(beta);\n beta4 = beta4.redIAdd(beta4);\n var beta8 = beta4.redAdd(beta4);\n nx = alpha.redSqr().redISub(beta8), nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta);\n var ggamma8 = gamma.redSqr();\n ggamma8 = ggamma8.redIAdd(ggamma8), ggamma8 = ggamma8.redIAdd(ggamma8), ggamma8 = ggamma8.redIAdd(ggamma8), ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8);\n }\n return this.curve.jpoint(nx, ny, nz);\n }, JPoint.prototype._dbl = function() {\n var a = this.curve.a, jx = this.x, jy = this.y, jz = this.z, jz4 = jz.redSqr().redSqr(), jx2 = jx.redSqr(), jy2 = jy.redSqr(), c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)), jxd4 = jx.redAdd(jx);\n jxd4 = jxd4.redIAdd(jxd4);\n var t1 = jxd4.redMul(jy2), nx = c.redSqr().redISub(t1.redAdd(t1)), t2 = t1.redISub(nx), jyd8 = jy2.redSqr();\n jyd8 = jyd8.redIAdd(jyd8), jyd8 = jyd8.redIAdd(jyd8), jyd8 = jyd8.redIAdd(jyd8);\n var ny = c.redMul(t2).redISub(jyd8), nz = jy.redAdd(jy).redMul(jz);\n return this.curve.jpoint(nx, ny, nz);\n }, JPoint.prototype.trpl = function() {\n if (!this.curve.zeroA)\n return this.dbl().add(this);\n var xx = this.x.redSqr(), yy = this.y.redSqr(), zz = this.z.redSqr(), yyyy = yy.redSqr(), m = xx.redAdd(xx).redIAdd(xx), mm = m.redSqr(), e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n e = e.redIAdd(e), e = e.redAdd(e).redIAdd(e), e = e.redISub(mm);\n var ee = e.redSqr(), t = yyyy.redIAdd(yyyy);\n t = t.redIAdd(t), t = t.redIAdd(t), t = t.redIAdd(t);\n var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t), yyu4 = yy.redMul(u);\n yyu4 = yyu4.redIAdd(yyu4), yyu4 = yyu4.redIAdd(yyu4);\n var nx = this.x.redMul(ee).redISub(yyu4);\n nx = nx.redIAdd(nx), nx = nx.redIAdd(nx);\n var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee)));\n ny = ny.redIAdd(ny), ny = ny.redIAdd(ny), ny = ny.redIAdd(ny);\n var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee);\n return this.curve.jpoint(nx, ny, nz);\n }, JPoint.prototype.mul = function(k, kbase) {\n return k = new BN(k, kbase), this.curve._wnafMul(this, k);\n }, JPoint.prototype.eq = function(p) {\n if (p.type === \"affine\")\n return this.eq(p.toJ());\n if (this === p)\n return !0;\n var z2 = this.z.redSqr(), pz2 = p.z.redSqr();\n if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0)\n return !1;\n var z3 = z2.redMul(this.z), pz3 = pz2.redMul(p.z);\n return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0;\n }, JPoint.prototype.eqXToP = function(x) {\n var zs = this.z.redSqr(), rx = x.toRed(this.curve.red).redMul(zs);\n if (this.x.cmp(rx) === 0)\n return !0;\n for (var xc = x.clone(), t = this.curve.redN.redMul(zs);; ) {\n if (xc.iadd(this.curve.n), xc.cmp(this.curve.p) >= 0)\n return !1;\n if (rx.redIAdd(t), this.x.cmp(rx) === 0)\n return !0;\n }\n }, JPoint.prototype.inspect = function() {\n return this.isInfinity() \? \"\" : \"\";\n }, JPoint.prototype.isInfinity = function() {\n return this.z.cmpn(0) === 0;\n };\n }\n}), require_mont = __commonJS({\n \"node_modules/elliptic/lib/elliptic/curve/mont.js\"(exports, module) {\n var BN = require_bn4(), inherits = require_inherits_browser(), Base = require_base(), utils = require_utils3();\n function MontCurve(conf) {\n Base.@call(this, \"mont\", conf), this.a = new BN(conf.a, 16).toRed(this.red), this.b = new BN(conf.b, 16).toRed(this.red), this.i4 = new BN(4).toRed(this.red).redInvm(), this.two = new BN(2).toRed(this.red), this.a24 = this.i4.redMul(this.a.redAdd(this.two));\n }\n inherits(MontCurve, Base), module.exports = MontCurve, MontCurve.prototype.validate = function(point) {\n var x = point.normalize().x, x2 = x.redSqr(), rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x), y = rhs.redSqrt();\n return y.redSqr().cmp(rhs) === 0;\n };\n function Point(curve, x, z) {\n Base.BasePoint.@call(this, curve, \"projective\"), x === null && z === null \? (this.x = this.curve.one, this.z = this.curve.zero) : (this.x = new BN(x, 16), this.z = new BN(z, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)));\n }\n inherits(Point, Base.BasePoint), MontCurve.prototype.decodePoint = function(bytes, enc) {\n return this.point(utils.toArray(bytes, enc), 1);\n }, MontCurve.prototype.point = function(x, z) {\n return new Point(this, x, z);\n }, MontCurve.prototype.pointFromJSON = function(obj) {\n return Point.fromJSON(this, obj);\n }, Point.prototype.precompute = function() {\n }, Point.prototype._encode = function() {\n return this.getX().toArray(\"be\", this.curve.p.byteLength());\n }, Point.fromJSON = function(curve, obj) {\n return new Point(curve, obj[0], obj[1] || curve.one);\n }, Point.prototype.inspect = function() {\n return this.isInfinity() \? \"\" : \"\";\n }, Point.prototype.isInfinity = function() {\n return this.z.cmpn(0) === 0;\n }, Point.prototype.dbl = function() {\n var a = this.x.redAdd(this.z), aa = a.redSqr(), b = this.x.redSub(this.z), bb = b.redSqr(), c = aa.redSub(bb), nx = aa.redMul(bb), nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c)));\n return this.curve.point(nx, nz);\n }, Point.prototype.add = function() {\n throw new Error(\"Not supported on Montgomery curve\");\n }, Point.prototype.diffAdd = function(p, diff) {\n var a = this.x.redAdd(this.z), b = this.x.redSub(this.z), c = p.x.redAdd(p.z), d = p.x.redSub(p.z), da = d.redMul(a), cb = c.redMul(b), nx = diff.z.redMul(da.redAdd(cb).redSqr()), nz = diff.x.redMul(da.redISub(cb).redSqr());\n return this.curve.point(nx, nz);\n }, Point.prototype.mul = function(k) {\n for (var t = k.clone(), a = this, b = this.curve.point(null, null), c = this, bits = [];t.cmpn(0) !== 0; t.iushrn(1))\n bits.push(t.andln(1));\n for (var i = bits.length - 1;i >= 0; i--)\n bits[i] === 0 \? (a = a.diffAdd(b, c), b = b.dbl()) : (b = a.diffAdd(b, c), a = a.dbl());\n return b;\n }, Point.prototype.mulAdd = function() {\n throw new Error(\"Not supported on Montgomery curve\");\n }, Point.prototype.jumlAdd = function() {\n throw new Error(\"Not supported on Montgomery curve\");\n }, Point.prototype.eq = function(other) {\n return this.getX().cmp(other.getX()) === 0;\n }, Point.prototype.normalize = function() {\n return this.x = this.x.redMul(this.z.redInvm()), this.z = this.curve.one, this;\n }, Point.prototype.getX = function() {\n return this.normalize(), this.x.fromRed();\n };\n }\n}), require_edwards = __commonJS({\n \"node_modules/elliptic/lib/elliptic/curve/edwards.js\"(exports, module) {\n var utils = require_utils3(), BN = require_bn4(), inherits = require_inherits_browser(), Base = require_base(), assert = utils.assert;\n function EdwardsCurve(conf) {\n this.twisted = (conf.a | 0) !== 1, this.mOneA = this.twisted && (conf.a | 0) === -1, this.extended = this.mOneA, Base.@call(this, \"edwards\", conf), this.a = new BN(conf.a, 16).umod(this.red.m), this.a = this.a.toRed(this.red), this.c = new BN(conf.c, 16).toRed(this.red), this.c2 = this.c.redSqr(), this.d = new BN(conf.d, 16).toRed(this.red), this.dd = this.d.redAdd(this.d), assert(!this.twisted || this.c.fromRed().cmpn(1) === 0), this.oneC = (conf.c | 0) === 1;\n }\n inherits(EdwardsCurve, Base), module.exports = EdwardsCurve, EdwardsCurve.prototype._mulA = function(num) {\n return this.mOneA \? num.redNeg() : this.a.redMul(num);\n }, EdwardsCurve.prototype._mulC = function(num) {\n return this.oneC \? num : this.c.redMul(num);\n }, EdwardsCurve.prototype.jpoint = function(x, y, z, t) {\n return this.point(x, y, z, t);\n }, EdwardsCurve.prototype.pointFromX = function(x, odd) {\n x = new BN(x, 16), x.red || (x = x.toRed(this.red));\n var x2 = x.redSqr(), rhs = this.c2.redSub(this.a.redMul(x2)), lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2)), y2 = rhs.redMul(lhs.redInvm()), y = y2.redSqrt();\n if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)\n throw new Error(\"invalid point\");\n var isOdd = y.fromRed().isOdd();\n return (odd && !isOdd || !odd && isOdd) && (y = y.redNeg()), this.point(x, y);\n }, EdwardsCurve.prototype.pointFromY = function(y, odd) {\n y = new BN(y, 16), y.red || (y = y.toRed(this.red));\n var y2 = y.redSqr(), lhs = y2.redSub(this.c2), rhs = y2.redMul(this.d).redMul(this.c2).redSub(this.a), x2 = lhs.redMul(rhs.redInvm());\n if (x2.cmp(this.zero) === 0) {\n if (odd)\n throw new Error(\"invalid point\");\n return this.point(this.zero, y);\n }\n var x = x2.redSqrt();\n if (x.redSqr().redSub(x2).cmp(this.zero) !== 0)\n throw new Error(\"invalid point\");\n return x.fromRed().isOdd() !== odd && (x = x.redNeg()), this.point(x, y);\n }, EdwardsCurve.prototype.validate = function(point) {\n if (point.isInfinity())\n return !0;\n point.normalize();\n var x2 = point.x.redSqr(), y2 = point.y.redSqr(), lhs = x2.redMul(this.a).redAdd(y2), rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2)));\n return lhs.cmp(rhs) === 0;\n };\n function Point(curve, x, y, z, t) {\n Base.BasePoint.@call(this, curve, \"projective\"), x === null && y === null && z === null \? (this.x = this.curve.zero, this.y = this.curve.one, this.z = this.curve.one, this.t = this.curve.zero, this.zOne = !0) : (this.x = new BN(x, 16), this.y = new BN(y, 16), this.z = z \? new BN(z, 16) : this.curve.one, this.t = t && new BN(t, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.t && !this.t.red && (this.t = this.t.toRed(this.curve.red)), this.zOne = this.z === this.curve.one, this.curve.extended && !this.t && (this.t = this.x.redMul(this.y), this.zOne || (this.t = this.t.redMul(this.z.redInvm()))));\n }\n inherits(Point, Base.BasePoint), EdwardsCurve.prototype.pointFromJSON = function(obj) {\n return Point.fromJSON(this, obj);\n }, EdwardsCurve.prototype.point = function(x, y, z, t) {\n return new Point(this, x, y, z, t);\n }, Point.fromJSON = function(curve, obj) {\n return new Point(curve, obj[0], obj[1], obj[2]);\n }, Point.prototype.inspect = function() {\n return this.isInfinity() \? \"\" : \"\";\n }, Point.prototype.isInfinity = function() {\n return this.x.cmpn(0) === 0 && (this.y.cmp(this.z) === 0 || this.zOne && this.y.cmp(this.curve.c) === 0);\n }, Point.prototype._extDbl = function() {\n var a = this.x.redSqr(), b = this.y.redSqr(), c = this.z.redSqr();\n c = c.redIAdd(c);\n var d = this.curve._mulA(a), e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b), g = d.redAdd(b), f = g.redSub(c), h = d.redSub(b), nx = e.redMul(f), ny = g.redMul(h), nt = e.redMul(h), nz = f.redMul(g);\n return this.curve.point(nx, ny, nz, nt);\n }, Point.prototype._projDbl = function() {\n var b = this.x.redAdd(this.y).redSqr(), c = this.x.redSqr(), d = this.y.redSqr(), nx, ny, nz, e, h, j;\n if (this.curve.twisted) {\n e = this.curve._mulA(c);\n var f = e.redAdd(d);\n this.zOne \? (nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two)), ny = f.redMul(e.redSub(d)), nz = f.redSqr().redSub(f).redSub(f)) : (h = this.z.redSqr(), j = f.redSub(h).redISub(h), nx = b.redSub(c).redISub(d).redMul(j), ny = f.redMul(e.redSub(d)), nz = f.redMul(j));\n } else\n e = c.redAdd(d), h = this.curve._mulC(this.z).redSqr(), j = e.redSub(h).redSub(h), nx = this.curve._mulC(b.redISub(e)).redMul(j), ny = this.curve._mulC(e).redMul(c.redISub(d)), nz = e.redMul(j);\n return this.curve.point(nx, ny, nz);\n }, Point.prototype.dbl = function() {\n return this.isInfinity() \? this : this.curve.extended \? this._extDbl() : this._projDbl();\n }, Point.prototype._extAdd = function(p) {\n var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x)), b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x)), c = this.t.redMul(this.curve.dd).redMul(p.t), d = this.z.redMul(p.z.redAdd(p.z)), e = b.redSub(a), f = d.redSub(c), g = d.redAdd(c), h = b.redAdd(a), nx = e.redMul(f), ny = g.redMul(h), nt = e.redMul(h), nz = f.redMul(g);\n return this.curve.point(nx, ny, nz, nt);\n }, Point.prototype._projAdd = function(p) {\n var a = this.z.redMul(p.z), b = a.redSqr(), c = this.x.redMul(p.x), d = this.y.redMul(p.y), e = this.curve.d.redMul(c).redMul(d), f = b.redSub(e), g = b.redAdd(e), tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d), nx = a.redMul(f).redMul(tmp), ny, nz;\n return this.curve.twisted \? (ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c))), nz = f.redMul(g)) : (ny = a.redMul(g).redMul(d.redSub(c)), nz = this.curve._mulC(f).redMul(g)), this.curve.point(nx, ny, nz);\n }, Point.prototype.add = function(p) {\n return this.isInfinity() \? p : p.isInfinity() \? this : this.curve.extended \? this._extAdd(p) : this._projAdd(p);\n }, Point.prototype.mul = function(k) {\n return this._hasDoubles(k) \? this.curve._fixedNafMul(this, k) : this.curve._wnafMul(this, k);\n }, Point.prototype.mulAdd = function(k1, p, k2) {\n return this.curve._wnafMulAdd(1, [this, p], [k1, k2], 2, !1);\n }, Point.prototype.jmulAdd = function(k1, p, k2) {\n return this.curve._wnafMulAdd(1, [this, p], [k1, k2], 2, !0);\n }, Point.prototype.normalize = function() {\n if (this.zOne)\n return this;\n var zi = this.z.redInvm();\n return this.x = this.x.redMul(zi), this.y = this.y.redMul(zi), this.t && (this.t = this.t.redMul(zi)), this.z = this.curve.one, this.zOne = !0, this;\n }, Point.prototype.neg = function() {\n return this.curve.point(this.x.redNeg(), this.y, this.z, this.t && this.t.redNeg());\n }, Point.prototype.getX = function() {\n return this.normalize(), this.x.fromRed();\n }, Point.prototype.getY = function() {\n return this.normalize(), this.y.fromRed();\n }, Point.prototype.eq = function(other) {\n return this === other || this.getX().cmp(other.getX()) === 0 && this.getY().cmp(other.getY()) === 0;\n }, Point.prototype.eqXToP = function(x) {\n var rx = x.toRed(this.curve.red).redMul(this.z);\n if (this.x.cmp(rx) === 0)\n return !0;\n for (var xc = x.clone(), t = this.curve.redN.redMul(this.z);; ) {\n if (xc.iadd(this.curve.n), xc.cmp(this.curve.p) >= 0)\n return !1;\n if (rx.redIAdd(t), this.x.cmp(rx) === 0)\n return !0;\n }\n }, Point.prototype.toP = Point.prototype.normalize, Point.prototype.mixedAdd = Point.prototype.add;\n }\n}), require_curve = __commonJS({\n \"node_modules/elliptic/lib/elliptic/curve/index.js\"(exports) {\n var curve = exports;\n curve.base = require_base(), curve.short = require_short(), curve.mont = require_mont(), curve.edwards = require_edwards();\n }\n}), require_utils4 = __commonJS({\n \"node_modules/hash.js/lib/hash/utils.js\"(exports) {\n var assert = require_minimalistic_assert(), inherits = require_inherits_browser();\n exports.inherits = inherits;\n function isSurrogatePair(msg, i) {\n return (msg.charCodeAt(i) & 64512) !== 55296 || i < 0 || i + 1 >= msg.length \? !1 : (msg.charCodeAt(i + 1) & 64512) === 56320;\n }\n function toArray(msg, enc) {\n if (@Array.isArray(msg))\n return msg.slice();\n if (!msg)\n return [];\n var res = [];\n if (typeof msg == \"string\")\n if (enc) {\n if (enc === \"hex\")\n for (msg = msg.replace(/[^a-z0-9]+/gi, \"\"), msg.length % 2 !== 0 && (msg = \"0\" + msg), i = 0;i < msg.length; i += 2)\n res.push(parseInt(msg[i] + msg[i + 1], 16));\n } else\n for (var p = 0, i = 0;i < msg.length; i++) {\n var c = msg.charCodeAt(i);\n c < 128 \? res[p++] = c : c < 2048 \? (res[p++] = c >> 6 | 192, res[p++] = c & 63 | 128) : isSurrogatePair(msg, i) \? (c = 65536 + ((c & 1023) << 10) + (msg.charCodeAt(++i) & 1023), res[p++] = c >> 18 | 240, res[p++] = c >> 12 & 63 | 128, res[p++] = c >> 6 & 63 | 128, res[p++] = c & 63 | 128) : (res[p++] = c >> 12 | 224, res[p++] = c >> 6 & 63 | 128, res[p++] = c & 63 | 128);\n }\n else\n for (i = 0;i < msg.length; i++)\n res[i] = msg[i] | 0;\n return res;\n }\n exports.toArray = toArray;\n function toHex(msg) {\n for (var res = \"\", i = 0;i < msg.length; i++)\n res += zero2(msg[i].toString(16));\n return res;\n }\n exports.toHex = toHex;\n function htonl(w) {\n var res = w >>> 24 | w >>> 8 & 65280 | w << 8 & 16711680 | (w & 255) << 24;\n return res >>> 0;\n }\n exports.htonl = htonl;\n function toHex32(msg, endian) {\n for (var res = \"\", i = 0;i < msg.length; i++) {\n var w = msg[i];\n endian === \"little\" && (w = htonl(w)), res += zero8(w.toString(16));\n }\n return res;\n }\n exports.toHex32 = toHex32;\n function zero2(word) {\n return word.length === 1 \? \"0\" + word : word;\n }\n exports.zero2 = zero2;\n function zero8(word) {\n return word.length === 7 \? \"0\" + word : word.length === 6 \? \"00\" + word : word.length === 5 \? \"000\" + word : word.length === 4 \? \"0000\" + word : word.length === 3 \? \"00000\" + word : word.length === 2 \? \"000000\" + word : word.length === 1 \? \"0000000\" + word : word;\n }\n exports.zero8 = zero8;\n function join32(msg, start, end, endian) {\n var len = end - start;\n assert(len % 4 === 0);\n for (var res = new @Array(len / 4), i = 0, k = start;i < res.length; i++, k += 4) {\n var w;\n endian === \"big\" \? w = msg[k] << 24 | msg[k + 1] << 16 | msg[k + 2] << 8 | msg[k + 3] : w = msg[k + 3] << 24 | msg[k + 2] << 16 | msg[k + 1] << 8 | msg[k], res[i] = w >>> 0;\n }\n return res;\n }\n exports.join32 = join32;\n function split32(msg, endian) {\n for (var res = new @Array(msg.length * 4), i = 0, k = 0;i < msg.length; i++, k += 4) {\n var m = msg[i];\n endian === \"big\" \? (res[k] = m >>> 24, res[k + 1] = m >>> 16 & 255, res[k + 2] = m >>> 8 & 255, res[k + 3] = m & 255) : (res[k + 3] = m >>> 24, res[k + 2] = m >>> 16 & 255, res[k + 1] = m >>> 8 & 255, res[k] = m & 255);\n }\n return res;\n }\n exports.split32 = split32;\n function rotr32(w, b) {\n return w >>> b | w << 32 - b;\n }\n exports.rotr32 = rotr32;\n function rotl32(w, b) {\n return w << b | w >>> 32 - b;\n }\n exports.rotl32 = rotl32;\n function sum32(a, b) {\n return a + b >>> 0;\n }\n exports.sum32 = sum32;\n function sum32_3(a, b, c) {\n return a + b + c >>> 0;\n }\n exports.sum32_3 = sum32_3;\n function sum32_4(a, b, c, d) {\n return a + b + c + d >>> 0;\n }\n exports.sum32_4 = sum32_4;\n function sum32_5(a, b, c, d, e) {\n return a + b + c + d + e >>> 0;\n }\n exports.sum32_5 = sum32_5;\n function sum64(buf, pos, ah, al) {\n var bh = buf[pos], bl = buf[pos + 1], lo = al + bl >>> 0, hi = (lo < al \? 1 : 0) + ah + bh;\n buf[pos] = hi >>> 0, buf[pos + 1] = lo;\n }\n exports.sum64 = sum64;\n function sum64_hi(ah, al, bh, bl) {\n var lo = al + bl >>> 0, hi = (lo < al \? 1 : 0) + ah + bh;\n return hi >>> 0;\n }\n exports.sum64_hi = sum64_hi;\n function sum64_lo(ah, al, bh, bl) {\n var lo = al + bl;\n return lo >>> 0;\n }\n exports.sum64_lo = sum64_lo;\n function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) {\n var carry = 0, lo = al;\n lo = lo + bl >>> 0, carry += lo < al \? 1 : 0, lo = lo + cl >>> 0, carry += lo < cl \? 1 : 0, lo = lo + dl >>> 0, carry += lo < dl \? 1 : 0;\n var hi = ah + bh + ch + dh + carry;\n return hi >>> 0;\n }\n exports.sum64_4_hi = sum64_4_hi;\n function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) {\n var lo = al + bl + cl + dl;\n return lo >>> 0;\n }\n exports.sum64_4_lo = sum64_4_lo;\n function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {\n var carry = 0, lo = al;\n lo = lo + bl >>> 0, carry += lo < al \? 1 : 0, lo = lo + cl >>> 0, carry += lo < cl \? 1 : 0, lo = lo + dl >>> 0, carry += lo < dl \? 1 : 0, lo = lo + el >>> 0, carry += lo < el \? 1 : 0;\n var hi = ah + bh + ch + dh + eh + carry;\n return hi >>> 0;\n }\n exports.sum64_5_hi = sum64_5_hi;\n function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {\n var lo = al + bl + cl + dl + el;\n return lo >>> 0;\n }\n exports.sum64_5_lo = sum64_5_lo;\n function rotr64_hi(ah, al, num) {\n var r = al << 32 - num | ah >>> num;\n return r >>> 0;\n }\n exports.rotr64_hi = rotr64_hi;\n function rotr64_lo(ah, al, num) {\n var r = ah << 32 - num | al >>> num;\n return r >>> 0;\n }\n exports.rotr64_lo = rotr64_lo;\n function shr64_hi(ah, al, num) {\n return ah >>> num;\n }\n exports.shr64_hi = shr64_hi;\n function shr64_lo(ah, al, num) {\n var r = ah << 32 - num | al >>> num;\n return r >>> 0;\n }\n exports.shr64_lo = shr64_lo;\n }\n}), require_common = __commonJS({\n \"node_modules/hash.js/lib/hash/common.js\"(exports) {\n var utils = require_utils4(), assert = require_minimalistic_assert();\n function BlockHash() {\n this.pending = null, this.pendingTotal = 0, this.blockSize = this.constructor.blockSize, this.outSize = this.constructor.outSize, this.hmacStrength = this.constructor.hmacStrength, this.padLength = this.constructor.padLength / 8, this.endian = \"big\", this._delta8 = this.blockSize / 8, this._delta32 = this.blockSize / 32;\n }\n BlockHash.prototype = {}, exports.BlockHash = BlockHash, BlockHash.prototype.update = function(msg, enc) {\n if (msg = utils.toArray(msg, enc), this.pending \? this.pending = this.pending.concat(msg) : this.pending = msg, this.pendingTotal += msg.length, this.pending.length >= this._delta8) {\n msg = this.pending;\n var r = msg.length % this._delta8;\n this.pending = msg.slice(msg.length - r, msg.length), this.pending.length === 0 && (this.pending = null), msg = utils.join32(msg, 0, msg.length - r, this.endian);\n for (var i = 0;i < msg.length; i += this._delta32)\n this._update(msg, i, i + this._delta32);\n }\n return this;\n }, BlockHash.prototype.digest = function(enc) {\n return this.update(this._pad()), assert(this.pending === null), this._digest(enc);\n }, BlockHash.prototype._pad = function() {\n var len = this.pendingTotal, bytes = this._delta8, k = bytes - (len + this.padLength) % bytes, res = new @Array(k + this.padLength);\n res[0] = 128;\n for (var i = 1;i < k; i++)\n res[i] = 0;\n if (len <<= 3, this.endian === \"big\") {\n for (var t = 8;t < this.padLength; t++)\n res[i++] = 0;\n res[i++] = 0, res[i++] = 0, res[i++] = 0, res[i++] = 0, res[i++] = len >>> 24 & 255, res[i++] = len >>> 16 & 255, res[i++] = len >>> 8 & 255, res[i++] = len & 255;\n } else\n for (res[i++] = len & 255, res[i++] = len >>> 8 & 255, res[i++] = len >>> 16 & 255, res[i++] = len >>> 24 & 255, res[i++] = 0, res[i++] = 0, res[i++] = 0, res[i++] = 0, t = 8;t < this.padLength; t++)\n res[i++] = 0;\n return res;\n };\n }\n}), require_common2 = __commonJS({\n \"node_modules/hash.js/lib/hash/sha/common.js\"(exports) {\n var utils = require_utils4(), rotr32 = utils.rotr32;\n function ft_1(s, x, y, z) {\n if (s === 0)\n return ch32(x, y, z);\n if (s === 1 || s === 3)\n return p32(x, y, z);\n if (s === 2)\n return maj32(x, y, z);\n }\n exports.ft_1 = ft_1;\n function ch32(x, y, z) {\n return x & y ^ ~x & z;\n }\n exports.ch32 = ch32;\n function maj32(x, y, z) {\n return x & y ^ x & z ^ y & z;\n }\n exports.maj32 = maj32;\n function p32(x, y, z) {\n return x ^ y ^ z;\n }\n exports.p32 = p32;\n function s0_256(x) {\n return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);\n }\n exports.s0_256 = s0_256;\n function s1_256(x) {\n return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);\n }\n exports.s1_256 = s1_256;\n function g0_256(x) {\n return rotr32(x, 7) ^ rotr32(x, 18) ^ x >>> 3;\n }\n exports.g0_256 = g0_256;\n function g1_256(x) {\n return rotr32(x, 17) ^ rotr32(x, 19) ^ x >>> 10;\n }\n exports.g1_256 = g1_256;\n }\n}), require__ = __commonJS({\n \"node_modules/hash.js/lib/hash/sha/1.js\"(exports, module) {\n var utils = require_utils4(), common = require_common(), shaCommon = require_common2(), rotl32 = utils.rotl32, sum32 = utils.sum32, sum32_5 = utils.sum32_5, ft_1 = shaCommon.ft_1, BlockHash = common.BlockHash, sha1_K = [1518500249, 1859775393, 2400959708, 3395469782];\n function SHA1() {\n if (!(this instanceof SHA1))\n return new SHA1;\n BlockHash.@call(this), this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.W = new @Array(80);\n }\n utils.inherits(SHA1, BlockHash), module.exports = SHA1, SHA1.blockSize = 512, SHA1.outSize = 160, SHA1.hmacStrength = 80, SHA1.padLength = 64, SHA1.prototype._update = function(msg, start) {\n for (var W = this.W, i = 0;i < 16; i++)\n W[i] = msg[start + i];\n for (;i < W.length; i++)\n W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);\n var a = this.h[0], b = this.h[1], c = this.h[2], d = this.h[3], e = this.h[4];\n for (i = 0;i < W.length; i++) {\n var s = ~~(i / 20), t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]);\n e = d, d = c, c = rotl32(b, 30), b = a, a = t;\n }\n this.h[0] = sum32(this.h[0], a), this.h[1] = sum32(this.h[1], b), this.h[2] = sum32(this.h[2], c), this.h[3] = sum32(this.h[3], d), this.h[4] = sum32(this.h[4], e);\n }, SHA1.prototype._digest = function(enc) {\n return enc === \"hex\" \? utils.toHex32(this.h, \"big\") : utils.split32(this.h, \"big\");\n };\n }\n}), require__2 = __commonJS({\n \"node_modules/hash.js/lib/hash/sha/256.js\"(exports, module) {\n var utils = require_utils4(), common = require_common(), shaCommon = require_common2(), assert = require_minimalistic_assert(), sum32 = utils.sum32, sum32_4 = utils.sum32_4, sum32_5 = utils.sum32_5, ch32 = shaCommon.ch32, maj32 = shaCommon.maj32, s0_256 = shaCommon.s0_256, s1_256 = shaCommon.s1_256, g0_256 = shaCommon.g0_256, g1_256 = shaCommon.g1_256, BlockHash = common.BlockHash, sha256_K = [\n 1116352408,\n 1899447441,\n 3049323471,\n 3921009573,\n 961987163,\n 1508970993,\n 2453635748,\n 2870763221,\n 3624381080,\n 310598401,\n 607225278,\n 1426881987,\n 1925078388,\n 2162078206,\n 2614888103,\n 3248222580,\n 3835390401,\n 4022224774,\n 264347078,\n 604807628,\n 770255983,\n 1249150122,\n 1555081692,\n 1996064986,\n 2554220882,\n 2821834349,\n 2952996808,\n 3210313671,\n 3336571891,\n 3584528711,\n 113926993,\n 338241895,\n 666307205,\n 773529912,\n 1294757372,\n 1396182291,\n 1695183700,\n 1986661051,\n 2177026350,\n 2456956037,\n 2730485921,\n 2820302411,\n 3259730800,\n 3345764771,\n 3516065817,\n 3600352804,\n 4094571909,\n 275423344,\n 430227734,\n 506948616,\n 659060556,\n 883997877,\n 958139571,\n 1322822218,\n 1537002063,\n 1747873779,\n 1955562222,\n 2024104815,\n 2227730452,\n 2361852424,\n 2428436474,\n 2756734187,\n 3204031479,\n 3329325298\n ];\n function SHA256() {\n if (!(this instanceof SHA256))\n return new SHA256;\n BlockHash.@call(this), this.h = [1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225], this.k = sha256_K, this.W = new @Array(64);\n }\n utils.inherits(SHA256, BlockHash), module.exports = SHA256, SHA256.blockSize = 512, SHA256.outSize = 256, SHA256.hmacStrength = 192, SHA256.padLength = 64, SHA256.prototype._update = function(msg, start) {\n for (var W = this.W, i = 0;i < 16; i++)\n W[i] = msg[start + i];\n for (;i < W.length; i++)\n W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]);\n var a = this.h[0], b = this.h[1], c = this.h[2], d = this.h[3], e = this.h[4], f = this.h[5], g = this.h[6], h = this.h[7];\n for (assert(this.k.length === W.length), i = 0;i < W.length; i++) {\n var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]), T2 = sum32(s0_256(a), maj32(a, b, c));\n h = g, g = f, f = e, e = sum32(d, T1), d = c, c = b, b = a, a = sum32(T1, T2);\n }\n this.h[0] = sum32(this.h[0], a), this.h[1] = sum32(this.h[1], b), this.h[2] = sum32(this.h[2], c), this.h[3] = sum32(this.h[3], d), this.h[4] = sum32(this.h[4], e), this.h[5] = sum32(this.h[5], f), this.h[6] = sum32(this.h[6], g), this.h[7] = sum32(this.h[7], h);\n }, SHA256.prototype._digest = function(enc) {\n return enc === \"hex\" \? utils.toHex32(this.h, \"big\") : utils.split32(this.h, \"big\");\n };\n }\n}), require__3 = __commonJS({\n \"node_modules/hash.js/lib/hash/sha/224.js\"(exports, module) {\n var utils = require_utils4(), SHA256 = require__2();\n function SHA224() {\n if (!(this instanceof SHA224))\n return new SHA224;\n SHA256.@call(this), this.h = [3238371032, 914150663, 812702999, 4144912697, 4290775857, 1750603025, 1694076839, 3204075428];\n }\n utils.inherits(SHA224, SHA256), module.exports = SHA224, SHA224.blockSize = 512, SHA224.outSize = 224, SHA224.hmacStrength = 192, SHA224.padLength = 64, SHA224.prototype._digest = function(enc) {\n return enc === \"hex\" \? utils.toHex32(this.h.slice(0, 7), \"big\") : utils.split32(this.h.slice(0, 7), \"big\");\n };\n }\n}), require__4 = __commonJS({\n \"node_modules/hash.js/lib/hash/sha/512.js\"(exports, module) {\n var utils = require_utils4(), common = require_common(), assert = require_minimalistic_assert(), rotr64_hi = utils.rotr64_hi, rotr64_lo = utils.rotr64_lo, shr64_hi = utils.shr64_hi, shr64_lo = utils.shr64_lo, sum64 = utils.sum64, sum64_hi = utils.sum64_hi, sum64_lo = utils.sum64_lo, sum64_4_hi = utils.sum64_4_hi, sum64_4_lo = utils.sum64_4_lo, sum64_5_hi = utils.sum64_5_hi, sum64_5_lo = utils.sum64_5_lo, BlockHash = common.BlockHash, sha512_K = [\n 1116352408,\n 3609767458,\n 1899447441,\n 602891725,\n 3049323471,\n 3964484399,\n 3921009573,\n 2173295548,\n 961987163,\n 4081628472,\n 1508970993,\n 3053834265,\n 2453635748,\n 2937671579,\n 2870763221,\n 3664609560,\n 3624381080,\n 2734883394,\n 310598401,\n 1164996542,\n 607225278,\n 1323610764,\n 1426881987,\n 3590304994,\n 1925078388,\n 4068182383,\n 2162078206,\n 991336113,\n 2614888103,\n 633803317,\n 3248222580,\n 3479774868,\n 3835390401,\n 2666613458,\n 4022224774,\n 944711139,\n 264347078,\n 2341262773,\n 604807628,\n 2007800933,\n 770255983,\n 1495990901,\n 1249150122,\n 1856431235,\n 1555081692,\n 3175218132,\n 1996064986,\n 2198950837,\n 2554220882,\n 3999719339,\n 2821834349,\n 766784016,\n 2952996808,\n 2566594879,\n 3210313671,\n 3203337956,\n 3336571891,\n 1034457026,\n 3584528711,\n 2466948901,\n 113926993,\n 3758326383,\n 338241895,\n 168717936,\n 666307205,\n 1188179964,\n 773529912,\n 1546045734,\n 1294757372,\n 1522805485,\n 1396182291,\n 2643833823,\n 1695183700,\n 2343527390,\n 1986661051,\n 1014477480,\n 2177026350,\n 1206759142,\n 2456956037,\n 344077627,\n 2730485921,\n 1290863460,\n 2820302411,\n 3158454273,\n 3259730800,\n 3505952657,\n 3345764771,\n 106217008,\n 3516065817,\n 3606008344,\n 3600352804,\n 1432725776,\n 4094571909,\n 1467031594,\n 275423344,\n 851169720,\n 430227734,\n 3100823752,\n 506948616,\n 1363258195,\n 659060556,\n 3750685593,\n 883997877,\n 3785050280,\n 958139571,\n 3318307427,\n 1322822218,\n 3812723403,\n 1537002063,\n 2003034995,\n 1747873779,\n 3602036899,\n 1955562222,\n 1575990012,\n 2024104815,\n 1125592928,\n 2227730452,\n 2716904306,\n 2361852424,\n 442776044,\n 2428436474,\n 593698344,\n 2756734187,\n 3733110249,\n 3204031479,\n 2999351573,\n 3329325298,\n 3815920427,\n 3391569614,\n 3928383900,\n 3515267271,\n 566280711,\n 3940187606,\n 3454069534,\n 4118630271,\n 4000239992,\n 116418474,\n 1914138554,\n 174292421,\n 2731055270,\n 289380356,\n 3203993006,\n 460393269,\n 320620315,\n 685471733,\n 587496836,\n 852142971,\n 1086792851,\n 1017036298,\n 365543100,\n 1126000580,\n 2618297676,\n 1288033470,\n 3409855158,\n 1501505948,\n 4234509866,\n 1607167915,\n 987167468,\n 1816402316,\n 1246189591\n ];\n function SHA512() {\n if (!(this instanceof SHA512))\n return new SHA512;\n BlockHash.@call(this), this.h = [\n 1779033703,\n 4089235720,\n 3144134277,\n 2227873595,\n 1013904242,\n 4271175723,\n 2773480762,\n 1595750129,\n 1359893119,\n 2917565137,\n 2600822924,\n 725511199,\n 528734635,\n 4215389547,\n 1541459225,\n 327033209\n ], this.k = sha512_K, this.W = new @Array(160);\n }\n utils.inherits(SHA512, BlockHash), module.exports = SHA512, SHA512.blockSize = 1024, SHA512.outSize = 512, SHA512.hmacStrength = 192, SHA512.padLength = 128, SHA512.prototype._prepareBlock = function(msg, start) {\n for (var W = this.W, i = 0;i < 32; i++)\n W[i] = msg[start + i];\n for (;i < W.length; i += 2) {\n var c0_hi = g1_512_hi(W[i - 4], W[i - 3]), c0_lo = g1_512_lo(W[i - 4], W[i - 3]), c1_hi = W[i - 14], c1_lo = W[i - 13], c2_hi = g0_512_hi(W[i - 30], W[i - 29]), c2_lo = g0_512_lo(W[i - 30], W[i - 29]), c3_hi = W[i - 32], c3_lo = W[i - 31];\n W[i] = sum64_4_hi(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo), W[i + 1] = sum64_4_lo(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo);\n }\n }, SHA512.prototype._update = function(msg, start) {\n this._prepareBlock(msg, start);\n var W = this.W, ah = this.h[0], al = this.h[1], bh = this.h[2], bl = this.h[3], ch = this.h[4], cl = this.h[5], dh = this.h[6], dl = this.h[7], eh = this.h[8], el = this.h[9], fh = this.h[10], fl = this.h[11], gh = this.h[12], gl = this.h[13], hh = this.h[14], hl = this.h[15];\n assert(this.k.length === W.length);\n for (var i = 0;i < W.length; i += 2) {\n var c0_hi = hh, c0_lo = hl, c1_hi = s1_512_hi(eh, el), c1_lo = s1_512_lo(eh, el), c2_hi = ch64_hi(eh, el, fh, fl, gh, gl), c2_lo = ch64_lo(eh, el, fh, fl, gh, gl), c3_hi = this.k[i], c3_lo = this.k[i + 1], c4_hi = W[i], c4_lo = W[i + 1], T1_hi = sum64_5_hi(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo, c4_hi, c4_lo), T1_lo = sum64_5_lo(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo, c4_hi, c4_lo);\n c0_hi = s0_512_hi(ah, al), c0_lo = s0_512_lo(ah, al), c1_hi = maj64_hi(ah, al, bh, bl, ch, cl), c1_lo = maj64_lo(ah, al, bh, bl, ch, cl);\n var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo), T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo);\n hh = gh, hl = gl, gh = fh, gl = fl, fh = eh, fl = el, eh = sum64_hi(dh, dl, T1_hi, T1_lo), el = sum64_lo(dl, dl, T1_hi, T1_lo), dh = ch, dl = cl, ch = bh, cl = bl, bh = ah, bl = al, ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo), al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo);\n }\n sum64(this.h, 0, ah, al), sum64(this.h, 2, bh, bl), sum64(this.h, 4, ch, cl), sum64(this.h, 6, dh, dl), sum64(this.h, 8, eh, el), sum64(this.h, 10, fh, fl), sum64(this.h, 12, gh, gl), sum64(this.h, 14, hh, hl);\n }, SHA512.prototype._digest = function(enc) {\n return enc === \"hex\" \? utils.toHex32(this.h, \"big\") : utils.split32(this.h, \"big\");\n };\n function ch64_hi(xh, xl, yh, yl, zh) {\n var r = xh & yh ^ ~xh & zh;\n return r < 0 && (r += 4294967296), r;\n }\n function ch64_lo(xh, xl, yh, yl, zh, zl) {\n var r = xl & yl ^ ~xl & zl;\n return r < 0 && (r += 4294967296), r;\n }\n function maj64_hi(xh, xl, yh, yl, zh) {\n var r = xh & yh ^ xh & zh ^ yh & zh;\n return r < 0 && (r += 4294967296), r;\n }\n function maj64_lo(xh, xl, yh, yl, zh, zl) {\n var r = xl & yl ^ xl & zl ^ yl & zl;\n return r < 0 && (r += 4294967296), r;\n }\n function s0_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 28), c1_hi = rotr64_hi(xl, xh, 2), c2_hi = rotr64_hi(xl, xh, 7), r = c0_hi ^ c1_hi ^ c2_hi;\n return r < 0 && (r += 4294967296), r;\n }\n function s0_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 28), c1_lo = rotr64_lo(xl, xh, 2), c2_lo = rotr64_lo(xl, xh, 7), r = c0_lo ^ c1_lo ^ c2_lo;\n return r < 0 && (r += 4294967296), r;\n }\n function s1_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 14), c1_hi = rotr64_hi(xh, xl, 18), c2_hi = rotr64_hi(xl, xh, 9), r = c0_hi ^ c1_hi ^ c2_hi;\n return r < 0 && (r += 4294967296), r;\n }\n function s1_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 14), c1_lo = rotr64_lo(xh, xl, 18), c2_lo = rotr64_lo(xl, xh, 9), r = c0_lo ^ c1_lo ^ c2_lo;\n return r < 0 && (r += 4294967296), r;\n }\n function g0_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 1), c1_hi = rotr64_hi(xh, xl, 8), c2_hi = shr64_hi(xh, xl, 7), r = c0_hi ^ c1_hi ^ c2_hi;\n return r < 0 && (r += 4294967296), r;\n }\n function g0_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 1), c1_lo = rotr64_lo(xh, xl, 8), c2_lo = shr64_lo(xh, xl, 7), r = c0_lo ^ c1_lo ^ c2_lo;\n return r < 0 && (r += 4294967296), r;\n }\n function g1_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 19), c1_hi = rotr64_hi(xl, xh, 29), c2_hi = shr64_hi(xh, xl, 6), r = c0_hi ^ c1_hi ^ c2_hi;\n return r < 0 && (r += 4294967296), r;\n }\n function g1_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 19), c1_lo = rotr64_lo(xl, xh, 29), c2_lo = shr64_lo(xh, xl, 6), r = c0_lo ^ c1_lo ^ c2_lo;\n return r < 0 && (r += 4294967296), r;\n }\n }\n}), require__5 = __commonJS({\n \"node_modules/hash.js/lib/hash/sha/384.js\"(exports, module) {\n var utils = require_utils4(), SHA512 = require__4();\n function SHA384() {\n if (!(this instanceof SHA384))\n return new SHA384;\n SHA512.@call(this), this.h = [\n 3418070365,\n 3238371032,\n 1654270250,\n 914150663,\n 2438529370,\n 812702999,\n 355462360,\n 4144912697,\n 1731405415,\n 4290775857,\n 2394180231,\n 1750603025,\n 3675008525,\n 1694076839,\n 1203062813,\n 3204075428\n ];\n }\n utils.inherits(SHA384, SHA512), module.exports = SHA384, SHA384.blockSize = 1024, SHA384.outSize = 384, SHA384.hmacStrength = 192, SHA384.padLength = 128, SHA384.prototype._digest = function(enc) {\n return enc === \"hex\" \? utils.toHex32(this.h.slice(0, 12), \"big\") : utils.split32(this.h.slice(0, 12), \"big\");\n };\n }\n}), require_sha3 = __commonJS({\n \"node_modules/hash.js/lib/hash/sha.js\"(exports) {\n exports.sha1 = require__(), exports.sha224 = require__3(), exports.sha256 = require__2(), exports.sha384 = require__5(), exports.sha512 = require__4();\n }\n}), require_ripemd = __commonJS({\n \"node_modules/hash.js/lib/hash/ripemd.js\"(exports) {\n var utils = require_utils4(), common = require_common(), rotl32 = utils.rotl32, sum32 = utils.sum32, sum32_3 = utils.sum32_3, sum32_4 = utils.sum32_4, BlockHash = common.BlockHash;\n function RIPEMD160() {\n if (!(this instanceof RIPEMD160))\n return new RIPEMD160;\n BlockHash.@call(this), this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.endian = \"little\";\n }\n utils.inherits(RIPEMD160, BlockHash), exports.ripemd160 = RIPEMD160, RIPEMD160.blockSize = 512, RIPEMD160.outSize = 160, RIPEMD160.hmacStrength = 192, RIPEMD160.padLength = 64, RIPEMD160.prototype._update = function(msg, start) {\n for (var A = this.h[0], B = this.h[1], C = this.h[2], D = this.h[3], E = this.h[4], Ah = A, Bh = B, Ch = C, Dh = D, Eh = E, j = 0;j < 80; j++) {\n var T = sum32(rotl32(sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)), s[j]), E);\n A = E, E = D, D = rotl32(C, 10), C = B, B = T, T = sum32(rotl32(sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)), sh[j]), Eh), Ah = Eh, Eh = Dh, Dh = rotl32(Ch, 10), Ch = Bh, Bh = T;\n }\n T = sum32_3(this.h[1], C, Dh), this.h[1] = sum32_3(this.h[2], D, Eh), this.h[2] = sum32_3(this.h[3], E, Ah), this.h[3] = sum32_3(this.h[4], A, Bh), this.h[4] = sum32_3(this.h[0], B, Ch), this.h[0] = T;\n }, RIPEMD160.prototype._digest = function(enc) {\n return enc === \"hex\" \? utils.toHex32(this.h, \"little\") : utils.split32(this.h, \"little\");\n };\n function f(j, x, y, z) {\n return j <= 15 \? x ^ y ^ z : j <= 31 \? x & y | ~x & z : j <= 47 \? (x | ~y) ^ z : j <= 63 \? x & z | y & ~z : x ^ (y | ~z);\n }\n function K(j) {\n return j <= 15 \? 0 : j <= 31 \? 1518500249 : j <= 47 \? 1859775393 : j <= 63 \? 2400959708 : 2840853838;\n }\n function Kh(j) {\n return j <= 15 \? 1352829926 : j <= 31 \? 1548603684 : j <= 47 \? 1836072691 : j <= 63 \? 2053994217 : 0;\n }\n var r = [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 7,\n 4,\n 13,\n 1,\n 10,\n 6,\n 15,\n 3,\n 12,\n 0,\n 9,\n 5,\n 2,\n 14,\n 11,\n 8,\n 3,\n 10,\n 14,\n 4,\n 9,\n 15,\n 8,\n 1,\n 2,\n 7,\n 0,\n 6,\n 13,\n 11,\n 5,\n 12,\n 1,\n 9,\n 11,\n 10,\n 0,\n 8,\n 12,\n 4,\n 13,\n 3,\n 7,\n 15,\n 14,\n 5,\n 6,\n 2,\n 4,\n 0,\n 5,\n 9,\n 7,\n 12,\n 2,\n 10,\n 14,\n 1,\n 3,\n 8,\n 11,\n 6,\n 15,\n 13\n ], rh = [\n 5,\n 14,\n 7,\n 0,\n 9,\n 2,\n 11,\n 4,\n 13,\n 6,\n 15,\n 8,\n 1,\n 10,\n 3,\n 12,\n 6,\n 11,\n 3,\n 7,\n 0,\n 13,\n 5,\n 10,\n 14,\n 15,\n 8,\n 12,\n 4,\n 9,\n 1,\n 2,\n 15,\n 5,\n 1,\n 3,\n 7,\n 14,\n 6,\n 9,\n 11,\n 8,\n 12,\n 2,\n 10,\n 0,\n 4,\n 13,\n 8,\n 6,\n 4,\n 1,\n 3,\n 11,\n 15,\n 0,\n 5,\n 12,\n 2,\n 13,\n 9,\n 7,\n 10,\n 14,\n 12,\n 15,\n 10,\n 4,\n 1,\n 5,\n 8,\n 7,\n 6,\n 2,\n 13,\n 14,\n 0,\n 3,\n 9,\n 11\n ], s = [\n 11,\n 14,\n 15,\n 12,\n 5,\n 8,\n 7,\n 9,\n 11,\n 13,\n 14,\n 15,\n 6,\n 7,\n 9,\n 8,\n 7,\n 6,\n 8,\n 13,\n 11,\n 9,\n 7,\n 15,\n 7,\n 12,\n 15,\n 9,\n 11,\n 7,\n 13,\n 12,\n 11,\n 13,\n 6,\n 7,\n 14,\n 9,\n 13,\n 15,\n 14,\n 8,\n 13,\n 6,\n 5,\n 12,\n 7,\n 5,\n 11,\n 12,\n 14,\n 15,\n 14,\n 15,\n 9,\n 8,\n 9,\n 14,\n 5,\n 6,\n 8,\n 6,\n 5,\n 12,\n 9,\n 15,\n 5,\n 11,\n 6,\n 8,\n 13,\n 12,\n 5,\n 12,\n 13,\n 14,\n 11,\n 8,\n 5,\n 6\n ], sh = [\n 8,\n 9,\n 9,\n 11,\n 13,\n 15,\n 15,\n 5,\n 7,\n 7,\n 8,\n 11,\n 14,\n 14,\n 12,\n 6,\n 9,\n 13,\n 15,\n 7,\n 12,\n 8,\n 9,\n 11,\n 7,\n 7,\n 12,\n 7,\n 6,\n 15,\n 13,\n 11,\n 9,\n 7,\n 15,\n 11,\n 8,\n 6,\n 6,\n 14,\n 12,\n 13,\n 5,\n 14,\n 13,\n 13,\n 7,\n 5,\n 15,\n 5,\n 8,\n 11,\n 14,\n 14,\n 6,\n 14,\n 6,\n 9,\n 12,\n 9,\n 12,\n 5,\n 15,\n 8,\n 8,\n 5,\n 12,\n 9,\n 12,\n 5,\n 14,\n 6,\n 8,\n 13,\n 6,\n 5,\n 15,\n 13,\n 11,\n 11\n ];\n }\n}), require_hmac = __commonJS({\n \"node_modules/hash.js/lib/hash/hmac.js\"(exports, module) {\n var utils = require_utils4(), assert = require_minimalistic_assert();\n function Hmac(hash, key2, enc) {\n if (key2 = exportIfKeyObject(key2), !(this instanceof Hmac))\n return new Hmac(hash, key2, enc);\n this.Hash = hash, this.blockSize = hash.blockSize / 8, this.outSize = hash.outSize / 8, this.inner = null, this.outer = null, this._init(utils.toArray(key2, enc));\n }\n Hmac.prototype = {}, module.exports = Hmac, Hmac.prototype._init = function(key2) {\n key2.length > this.blockSize && (key2 = new this.Hash().update(key2).digest()), assert(key2.length <= this.blockSize);\n for (var i = key2.length;i < this.blockSize; i++)\n key2.push(0);\n for (i = 0;i < key2.length; i++)\n key2[i] ^= 54;\n for (this.inner = new this.Hash().update(key2), i = 0;i < key2.length; i++)\n key2[i] ^= 106;\n this.outer = new this.Hash().update(key2);\n }, Hmac.prototype.update = function(msg, enc) {\n return this.inner.update(msg, enc), this;\n }, Hmac.prototype.digest = function(enc) {\n return this.outer.update(this.inner.digest()), this.outer.digest(enc);\n };\n }\n}), require_hash2 = __commonJS({\n \"node_modules/hash.js/lib/hash.js\"(exports) {\n var hash = exports;\n hash.utils = require_utils4(), hash.common = require_common(), hash.sha = require_sha3(), hash.ripemd = require_ripemd(), hash.hmac = require_hmac(), hash.sha1 = hash.sha.sha1, hash.sha256 = hash.sha.sha256, hash.sha224 = hash.sha.sha224, hash.sha384 = hash.sha.sha384, hash.sha512 = hash.sha.sha512, hash.ripemd160 = hash.ripemd.ripemd160;\n }\n}), require_secp256k1 = __commonJS({\n \"node_modules/elliptic/lib/elliptic/precomputed/secp256k1.js\"(exports, module) {\n module.exports = {\n doubles: {\n step: 4,\n points: [\n [\n \"e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a\",\n \"f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821\"\n ],\n [\n \"8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508\",\n \"11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf\"\n ],\n [\n \"175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739\",\n \"d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695\"\n ],\n [\n \"363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640\",\n \"4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9\"\n ],\n [\n \"8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c\",\n \"4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36\"\n ],\n [\n \"723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda\",\n \"96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f\"\n ],\n [\n \"eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa\",\n \"5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999\"\n ],\n [\n \"100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0\",\n \"cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09\"\n ],\n [\n \"e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d\",\n \"9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d\"\n ],\n [\n \"feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d\",\n \"e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088\"\n ],\n [\n \"da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1\",\n \"9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d\"\n ],\n [\n \"53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0\",\n \"5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8\"\n ],\n [\n \"8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047\",\n \"10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a\"\n ],\n [\n \"385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862\",\n \"283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453\"\n ],\n [\n \"6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7\",\n \"7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160\"\n ],\n [\n \"3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd\",\n \"56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0\"\n ],\n [\n \"85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83\",\n \"7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6\"\n ],\n [\n \"948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a\",\n \"53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589\"\n ],\n [\n \"6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8\",\n \"bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17\"\n ],\n [\n \"e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d\",\n \"4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda\"\n ],\n [\n \"e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725\",\n \"7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd\"\n ],\n [\n \"213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754\",\n \"4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2\"\n ],\n [\n \"4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c\",\n \"17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6\"\n ],\n [\n \"fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6\",\n \"6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f\"\n ],\n [\n \"76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39\",\n \"c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01\"\n ],\n [\n \"c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891\",\n \"893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3\"\n ],\n [\n \"d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b\",\n \"febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f\"\n ],\n [\n \"b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03\",\n \"2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7\"\n ],\n [\n \"e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d\",\n \"eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78\"\n ],\n [\n \"a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070\",\n \"7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1\"\n ],\n [\n \"90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4\",\n \"e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150\"\n ],\n [\n \"8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da\",\n \"662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82\"\n ],\n [\n \"e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11\",\n \"1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc\"\n ],\n [\n \"8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e\",\n \"efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b\"\n ],\n [\n \"e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41\",\n \"2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51\"\n ],\n [\n \"b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef\",\n \"67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45\"\n ],\n [\n \"d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8\",\n \"db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120\"\n ],\n [\n \"324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d\",\n \"648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84\"\n ],\n [\n \"4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96\",\n \"35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d\"\n ],\n [\n \"9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd\",\n \"ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d\"\n ],\n [\n \"6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5\",\n \"9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8\"\n ],\n [\n \"a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266\",\n \"40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8\"\n ],\n [\n \"7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71\",\n \"34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac\"\n ],\n [\n \"928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac\",\n \"c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f\"\n ],\n [\n \"85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751\",\n \"1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962\"\n ],\n [\n \"ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e\",\n \"493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907\"\n ],\n [\n \"827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241\",\n \"c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec\"\n ],\n [\n \"eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3\",\n \"be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d\"\n ],\n [\n \"e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f\",\n \"4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414\"\n ],\n [\n \"1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19\",\n \"aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd\"\n ],\n [\n \"146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be\",\n \"b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0\"\n ],\n [\n \"fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9\",\n \"6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811\"\n ],\n [\n \"da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2\",\n \"8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1\"\n ],\n [\n \"a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13\",\n \"7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c\"\n ],\n [\n \"174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c\",\n \"ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73\"\n ],\n [\n \"959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba\",\n \"2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd\"\n ],\n [\n \"d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151\",\n \"e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405\"\n ],\n [\n \"64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073\",\n \"d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589\"\n ],\n [\n \"8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458\",\n \"38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e\"\n ],\n [\n \"13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b\",\n \"69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27\"\n ],\n [\n \"bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366\",\n \"d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1\"\n ],\n [\n \"8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa\",\n \"40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482\"\n ],\n [\n \"8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0\",\n \"620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945\"\n ],\n [\n \"dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787\",\n \"7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573\"\n ],\n [\n \"f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e\",\n \"ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82\"\n ]\n ]\n },\n naf: {\n wnd: 7,\n points: [\n [\n \"f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9\",\n \"388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672\"\n ],\n [\n \"2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4\",\n \"d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6\"\n ],\n [\n \"5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc\",\n \"6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da\"\n ],\n [\n \"acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe\",\n \"cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37\"\n ],\n [\n \"774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb\",\n \"d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b\"\n ],\n [\n \"f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8\",\n \"ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81\"\n ],\n [\n \"d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e\",\n \"581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58\"\n ],\n [\n \"defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34\",\n \"4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77\"\n ],\n [\n \"2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c\",\n \"85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a\"\n ],\n [\n \"352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5\",\n \"321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c\"\n ],\n [\n \"2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f\",\n \"2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67\"\n ],\n [\n \"9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714\",\n \"73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402\"\n ],\n [\n \"daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729\",\n \"a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55\"\n ],\n [\n \"c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db\",\n \"2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482\"\n ],\n [\n \"6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4\",\n \"e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82\"\n ],\n [\n \"1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5\",\n \"b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396\"\n ],\n [\n \"605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479\",\n \"2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49\"\n ],\n [\n \"62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d\",\n \"80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf\"\n ],\n [\n \"80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f\",\n \"1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a\"\n ],\n [\n \"7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb\",\n \"d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7\"\n ],\n [\n \"d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9\",\n \"eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933\"\n ],\n [\n \"49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963\",\n \"758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a\"\n ],\n [\n \"77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74\",\n \"958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6\"\n ],\n [\n \"f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530\",\n \"e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37\"\n ],\n [\n \"463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b\",\n \"5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e\"\n ],\n [\n \"f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247\",\n \"cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6\"\n ],\n [\n \"caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1\",\n \"cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476\"\n ],\n [\n \"2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120\",\n \"4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40\"\n ],\n [\n \"7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435\",\n \"91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61\"\n ],\n [\n \"754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18\",\n \"673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683\"\n ],\n [\n \"e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8\",\n \"59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5\"\n ],\n [\n \"186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb\",\n \"3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b\"\n ],\n [\n \"df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f\",\n \"55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417\"\n ],\n [\n \"5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143\",\n \"efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868\"\n ],\n [\n \"290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba\",\n \"e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a\"\n ],\n [\n \"af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45\",\n \"f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6\"\n ],\n [\n \"766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a\",\n \"744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996\"\n ],\n [\n \"59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e\",\n \"c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e\"\n ],\n [\n \"f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8\",\n \"e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d\"\n ],\n [\n \"7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c\",\n \"30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2\"\n ],\n [\n \"948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519\",\n \"e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e\"\n ],\n [\n \"7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab\",\n \"100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437\"\n ],\n [\n \"3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca\",\n \"ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311\"\n ],\n [\n \"d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf\",\n \"8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4\"\n ],\n [\n \"1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610\",\n \"68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575\"\n ],\n [\n \"733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4\",\n \"f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d\"\n ],\n [\n \"15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c\",\n \"d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d\"\n ],\n [\n \"a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940\",\n \"edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629\"\n ],\n [\n \"e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980\",\n \"a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06\"\n ],\n [\n \"311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3\",\n \"66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374\"\n ],\n [\n \"34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf\",\n \"9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee\"\n ],\n [\n \"f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63\",\n \"4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1\"\n ],\n [\n \"d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448\",\n \"fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b\"\n ],\n [\n \"32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf\",\n \"5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661\"\n ],\n [\n \"7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5\",\n \"8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6\"\n ],\n [\n \"ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6\",\n \"8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e\"\n ],\n [\n \"16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5\",\n \"5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d\"\n ],\n [\n \"eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99\",\n \"f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc\"\n ],\n [\n \"78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51\",\n \"f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4\"\n ],\n [\n \"494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5\",\n \"42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c\"\n ],\n [\n \"a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5\",\n \"204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b\"\n ],\n [\n \"c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997\",\n \"4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913\"\n ],\n [\n \"841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881\",\n \"73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154\"\n ],\n [\n \"5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5\",\n \"39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865\"\n ],\n [\n \"36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66\",\n \"d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc\"\n ],\n [\n \"336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726\",\n \"ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224\"\n ],\n [\n \"8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede\",\n \"6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e\"\n ],\n [\n \"1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94\",\n \"60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6\"\n ],\n [\n \"85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31\",\n \"3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511\"\n ],\n [\n \"29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51\",\n \"b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b\"\n ],\n [\n \"a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252\",\n \"ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2\"\n ],\n [\n \"4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5\",\n \"cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c\"\n ],\n [\n \"d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b\",\n \"6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3\"\n ],\n [\n \"ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4\",\n \"322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d\"\n ],\n [\n \"af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f\",\n \"6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700\"\n ],\n [\n \"e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889\",\n \"2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4\"\n ],\n [\n \"591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246\",\n \"b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196\"\n ],\n [\n \"11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984\",\n \"998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4\"\n ],\n [\n \"3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a\",\n \"b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257\"\n ],\n [\n \"cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030\",\n \"bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13\"\n ],\n [\n \"c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197\",\n \"6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096\"\n ],\n [\n \"c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593\",\n \"c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38\"\n ],\n [\n \"a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef\",\n \"21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f\"\n ],\n [\n \"347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38\",\n \"60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448\"\n ],\n [\n \"da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a\",\n \"49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a\"\n ],\n [\n \"c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111\",\n \"5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4\"\n ],\n [\n \"4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502\",\n \"7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437\"\n ],\n [\n \"3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea\",\n \"be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7\"\n ],\n [\n \"cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26\",\n \"8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d\"\n ],\n [\n \"b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986\",\n \"39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a\"\n ],\n [\n \"d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e\",\n \"62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54\"\n ],\n [\n \"48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4\",\n \"25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77\"\n ],\n [\n \"dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda\",\n \"ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517\"\n ],\n [\n \"6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859\",\n \"cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10\"\n ],\n [\n \"e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f\",\n \"f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125\"\n ],\n [\n \"eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c\",\n \"6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e\"\n ],\n [\n \"13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942\",\n \"fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1\"\n ],\n [\n \"ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a\",\n \"1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2\"\n ],\n [\n \"b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80\",\n \"5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423\"\n ],\n [\n \"ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d\",\n \"438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8\"\n ],\n [\n \"8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1\",\n \"cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758\"\n ],\n [\n \"52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63\",\n \"c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375\"\n ],\n [\n \"e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352\",\n \"6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d\"\n ],\n [\n \"7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193\",\n \"ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec\"\n ],\n [\n \"5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00\",\n \"9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0\"\n ],\n [\n \"32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58\",\n \"ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c\"\n ],\n [\n \"e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7\",\n \"d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4\"\n ],\n [\n \"8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8\",\n \"c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f\"\n ],\n [\n \"4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e\",\n \"67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649\"\n ],\n [\n \"3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d\",\n \"cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826\"\n ],\n [\n \"674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b\",\n \"299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5\"\n ],\n [\n \"d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f\",\n \"f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87\"\n ],\n [\n \"30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6\",\n \"462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b\"\n ],\n [\n \"be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297\",\n \"62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc\"\n ],\n [\n \"93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a\",\n \"7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c\"\n ],\n [\n \"b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c\",\n \"ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f\"\n ],\n [\n \"d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52\",\n \"4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a\"\n ],\n [\n \"d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb\",\n \"bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46\"\n ],\n [\n \"463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065\",\n \"bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f\"\n ],\n [\n \"7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917\",\n \"603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03\"\n ],\n [\n \"74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9\",\n \"cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08\"\n ],\n [\n \"30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3\",\n \"553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8\"\n ],\n [\n \"9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57\",\n \"712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373\"\n ],\n [\n \"176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66\",\n \"ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3\"\n ],\n [\n \"75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8\",\n \"9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8\"\n ],\n [\n \"809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721\",\n \"9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1\"\n ],\n [\n \"1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180\",\n \"4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9\"\n ]\n ]\n }\n };\n }\n}), require_curves = __commonJS({\n \"node_modules/elliptic/lib/elliptic/curves.js\"(exports) {\n var curves = exports, hash = require_hash2(), curve = require_curve(), utils = require_utils3(), assert = utils.assert;\n function PresetCurve(options) {\n options.type === \"short\" \? this.curve = new curve.short(options) : options.type === \"edwards\" \? this.curve = new curve.edwards(options) : this.curve = new curve.mont(options), this.g = this.curve.g, this.n = this.curve.n, this.hash = options.hash, assert(this.g.validate(), \"Invalid curve\"), assert(this.g.mul(this.n).isInfinity(), \"Invalid curve, G*N != O\");\n }\n PresetCurve.prototype = {}, curves.PresetCurve = PresetCurve;\n function defineCurve(name, options) {\n Object.defineProperty(curves, name, {\n configurable: !0,\n enumerable: !0,\n get: function() {\n var curve2 = new PresetCurve(options);\n return Object.defineProperty(curves, name, {\n configurable: !0,\n enumerable: !0,\n value: curve2\n }), curve2;\n }\n });\n }\n defineCurve(\"p192\", {\n type: \"short\",\n prime: \"p192\",\n p: \"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff\",\n a: \"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc\",\n b: \"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1\",\n n: \"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831\",\n hash: hash.sha256,\n gRed: !1,\n g: [\n \"188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012\",\n \"07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811\"\n ]\n }), defineCurve(\"p224\", {\n type: \"short\",\n prime: \"p224\",\n p: \"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001\",\n a: \"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe\",\n b: \"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4\",\n n: \"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d\",\n hash: hash.sha256,\n gRed: !1,\n g: [\n \"b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21\",\n \"bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34\"\n ]\n }), defineCurve(\"p256\", {\n type: \"short\",\n prime: null,\n p: \"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff\",\n a: \"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc\",\n b: \"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b\",\n n: \"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551\",\n hash: hash.sha256,\n gRed: !1,\n g: [\n \"6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296\",\n \"4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5\"\n ]\n }), defineCurve(\"p384\", {\n type: \"short\",\n prime: null,\n p: \"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff\",\n a: \"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc\",\n b: \"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef\",\n n: \"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973\",\n hash: hash.sha384,\n gRed: !1,\n g: [\n \"aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7\",\n \"3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f\"\n ]\n }), defineCurve(\"p521\", {\n type: \"short\",\n prime: null,\n p: \"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff\",\n a: \"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc\",\n b: \"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00\",\n n: \"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409\",\n hash: hash.sha512,\n gRed: !1,\n g: [\n \"000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66\",\n \"00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650\"\n ]\n }), defineCurve(\"curve25519\", {\n type: \"mont\",\n prime: \"p25519\",\n p: \"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed\",\n a: \"76d06\",\n b: \"1\",\n n: \"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed\",\n hash: hash.sha256,\n gRed: !1,\n g: [\"9\"]\n }), defineCurve(\"ed25519\", {\n type: \"edwards\",\n prime: \"p25519\",\n p: \"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed\",\n a: \"-1\",\n c: \"1\",\n d: \"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3\",\n n: \"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed\",\n hash: hash.sha256,\n gRed: !1,\n g: [\n \"216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a\",\n \"6666666666666666666666666666666666666666666666666666666666666658\"\n ]\n });\n var pre;\n try {\n pre = require_secp256k1();\n } catch {\n pre = void 0;\n }\n defineCurve(\"secp256k1\", {\n type: \"short\",\n prime: \"k256\",\n p: \"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f\",\n a: \"0\",\n b: \"7\",\n n: \"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141\",\n h: \"1\",\n hash: hash.sha256,\n beta: \"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee\",\n lambda: \"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72\",\n basis: [\n {\n a: \"3086d221a7d46bcde86c90e49284eb15\",\n b: \"-e4437ed6010e88286f547fa90abfe4c3\"\n },\n {\n a: \"114ca50f7a8e2f3f657c1108d9d44cfd8\",\n b: \"3086d221a7d46bcde86c90e49284eb15\"\n }\n ],\n gRed: !1,\n g: [\n \"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798\",\n \"483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8\",\n pre\n ]\n });\n }\n}), require_hmac_drbg = __commonJS({\n \"node_modules/hmac-drbg/lib/hmac-drbg.js\"(exports, module) {\n var hash = require_hash2(), utils = require_utils2(), assert = require_minimalistic_assert();\n function HmacDRBG(options) {\n if (!(this instanceof HmacDRBG))\n return new HmacDRBG(options);\n this.hash = options.hash, this.predResist = !!options.predResist, this.outLen = this.hash.outSize, this.minEntropy = options.minEntropy || this.hash.hmacStrength, this._reseed = null, this.reseedInterval = null, this.K = null, this.V = null;\n var entropy = utils.toArray(options.entropy, options.entropyEnc || \"hex\"), nonce = utils.toArray(options.nonce, options.nonceEnc || \"hex\"), pers = utils.toArray(options.pers, options.persEnc || \"hex\");\n assert(entropy.length >= this.minEntropy / 8, \"Not enough entropy. Minimum is: \" + this.minEntropy + \" bits\"), this._init(entropy, nonce, pers);\n }\n HmacDRBG.prototype = {}, module.exports = HmacDRBG, HmacDRBG.prototype._init = function(entropy, nonce, pers) {\n var seed = entropy.concat(nonce).concat(pers);\n this.K = new @Array(this.outLen / 8), this.V = new @Array(this.outLen / 8);\n for (var i = 0;i < this.V.length; i++)\n this.K[i] = 0, this.V[i] = 1;\n this._update(seed), this._reseed = 1, this.reseedInterval = 281474976710656;\n }, HmacDRBG.prototype._hmac = function() {\n return new hash.hmac(this.hash, this.K);\n }, HmacDRBG.prototype._update = function(seed) {\n var kmac = this._hmac().update(this.V).update([0]);\n seed && (kmac = kmac.update(seed)), this.K = kmac.digest(), this.V = this._hmac().update(this.V).digest(), seed && (this.K = this._hmac().update(this.V).update([1]).update(seed).digest(), this.V = this._hmac().update(this.V).digest());\n }, HmacDRBG.prototype.reseed = function(entropy, entropyEnc, add, addEnc) {\n typeof entropyEnc != \"string\" && (addEnc = add, add = entropyEnc, entropyEnc = null), entropy = utils.toArray(entropy, entropyEnc), add = utils.toArray(add, addEnc), assert(entropy.length >= this.minEntropy / 8, \"Not enough entropy. Minimum is: \" + this.minEntropy + \" bits\"), this._update(entropy.concat(add || [])), this._reseed = 1;\n }, HmacDRBG.prototype.generate = function(len, enc, add, addEnc) {\n if (this._reseed > this.reseedInterval)\n throw new Error(\"Reseed is required\");\n typeof enc != \"string\" && (addEnc = add, add = enc, enc = null), add && (add = utils.toArray(add, addEnc || \"hex\"), this._update(add));\n for (var temp = [];temp.length < len; )\n this.V = this._hmac().update(this.V).digest(), temp = temp.concat(this.V);\n var res = temp.slice(0, len);\n return this._update(add), this._reseed++, utils.encode(res, enc);\n };\n }\n}), require_key = __commonJS({\n \"node_modules/elliptic/lib/elliptic/ec/key.js\"(exports, module) {\n var BN = require_bn4(), utils = require_utils3(), assert = utils.assert;\n function KeyPair(ec, options) {\n this.ec = ec, this.priv = null, this.pub = null, options.priv && this._importPrivate(options.priv, options.privEnc), options.pub && this._importPublic(options.pub, options.pubEnc);\n }\n KeyPair.prototype = {}, module.exports = KeyPair, KeyPair.fromPublic = function(ec, pub, enc) {\n return pub instanceof KeyPair \? pub : new KeyPair(ec, {\n pub,\n pubEnc: enc\n });\n }, KeyPair.fromPrivate = function(ec, priv, enc) {\n return priv instanceof KeyPair \? priv : new KeyPair(ec, {\n priv,\n privEnc: enc\n });\n }, KeyPair.prototype.validate = function() {\n var pub = this.getPublic();\n return pub.isInfinity() \? { result: !1, reason: \"Invalid public key\" } : pub.validate() \? pub.mul(this.ec.curve.n).isInfinity() \? { result: !0, reason: null } : { result: !1, reason: \"Public key * N != O\" } : { result: !1, reason: \"Public key is not a point\" };\n }, KeyPair.prototype.getPublic = function(compact, enc) {\n return typeof compact == \"string\" && (enc = compact, compact = null), this.pub || (this.pub = this.ec.g.mul(this.priv)), enc \? this.pub.encode(enc, compact) : this.pub;\n }, KeyPair.prototype.getPrivate = function(enc) {\n return enc === \"hex\" \? this.priv.toString(16, 2) : this.priv;\n }, KeyPair.prototype._importPrivate = function(key2, enc) {\n this.priv = new BN(key2, enc || 16), this.priv = this.priv.umod(this.ec.curve.n);\n }, KeyPair.prototype._importPublic = function(key2, enc) {\n if (key2.x || key2.y) {\n this.ec.curve.type === \"mont\" \? assert(key2.x, \"Need x coordinate\") : (this.ec.curve.type === \"short\" || this.ec.curve.type === \"edwards\") && assert(key2.x && key2.y, \"Need both x and y coordinate\"), this.pub = this.ec.curve.point(key2.x, key2.y);\n return;\n }\n this.pub = this.ec.curve.decodePoint(key2, enc);\n }, KeyPair.prototype.derive = function(pub) {\n return pub.validate() || assert(pub.validate(), \"public point not validated\"), pub.mul(this.priv).getX();\n }, KeyPair.prototype.sign = function(msg, enc, options) {\n return this.ec.sign(msg, this, enc, options);\n }, KeyPair.prototype.verify = function(msg, signature) {\n return this.ec.verify(msg, signature, this);\n }, KeyPair.prototype.inspect = function() {\n return \"\";\n };\n }\n}), require_signature = __commonJS({\n \"node_modules/elliptic/lib/elliptic/ec/signature.js\"(exports, module) {\n var BN = require_bn4(), utils = require_utils3(), assert = utils.assert;\n function Signature(options, enc) {\n if (options instanceof Signature)\n return options;\n this._importDER(options, enc) || (assert(options.r && options.s, \"Signature without r or s\"), this.r = new BN(options.r, 16), this.s = new BN(options.s, 16), options.recoveryParam === void 0 \? this.recoveryParam = null : this.recoveryParam = options.recoveryParam);\n }\n Signature.prototype = {}, module.exports = Signature;\n function Position() {\n this.place = 0;\n }\n function getLength(buf, p) {\n var initial = buf[p.place++];\n if (!(initial & 128))\n return initial;\n var octetLen = initial & 15;\n if (octetLen === 0 || octetLen > 4)\n return !1;\n for (var val = 0, i = 0, off = p.place;i < octetLen; i++, off++)\n val <<= 8, val |= buf[off], val >>>= 0;\n return val <= 127 \? !1 : (p.place = off, val);\n }\n function rmPadding(buf) {\n for (var i = 0, len = buf.length - 1;!buf[i] && !(buf[i + 1] & 128) && i < len; )\n i++;\n return i === 0 \? buf : buf.slice(i);\n }\n Signature.prototype._importDER = function(data, enc) {\n data = utils.toArray(data, enc);\n var p = new Position;\n if (data[p.place++] !== 48)\n return !1;\n var len = getLength(data, p);\n if (len === !1 || len + p.place !== data.length || data[p.place++] !== 2)\n return !1;\n var rlen = getLength(data, p);\n if (rlen === !1)\n return !1;\n var r = data.slice(p.place, rlen + p.place);\n if (p.place += rlen, data[p.place++] !== 2)\n return !1;\n var slen = getLength(data, p);\n if (slen === !1 || data.length !== slen + p.place)\n return !1;\n var s = data.slice(p.place, slen + p.place);\n if (r[0] === 0)\n if (r[1] & 128)\n r = r.slice(1);\n else\n return !1;\n if (s[0] === 0)\n if (s[1] & 128)\n s = s.slice(1);\n else\n return !1;\n return this.r = new BN(r), this.s = new BN(s), this.recoveryParam = null, !0;\n };\n function constructLength(arr, len) {\n if (len < 128) {\n arr.push(len);\n return;\n }\n var octets = 1 + (Math.log(len) / Math.LN2 >>> 3);\n for (arr.push(octets | 128);--octets; )\n arr.push(len >>> (octets << 3) & 255);\n arr.push(len);\n }\n Signature.prototype.toDER = function(enc) {\n var r = this.r.toArray(), s = this.s.toArray();\n for (r[0] & 128 && (r = [0].concat(r)), s[0] & 128 && (s = [0].concat(s)), r = rmPadding(r), s = rmPadding(s);!s[0] && !(s[1] & 128); )\n s = s.slice(1);\n var arr = [2];\n constructLength(arr, r.length), arr = arr.concat(r), arr.push(2), constructLength(arr, s.length);\n var backHalf = arr.concat(s), res = [48];\n return constructLength(res, backHalf.length), res = res.concat(backHalf), utils.encode(res, enc);\n };\n }\n}), require_ec = __commonJS({\n \"node_modules/elliptic/lib/elliptic/ec/index.js\"(exports, module) {\n var BN = require_bn4(), HmacDRBG = require_hmac_drbg(), utils = require_utils3(), curves = require_curves(), rand = require_brorand(), assert = utils.assert, KeyPair = require_key(), Signature = require_signature();\n function EC(options) {\n if (!(this instanceof EC))\n return new EC(options);\n typeof options == \"string\" && (assert(Object.prototype.hasOwnProperty.@call(curves, options), \"Unknown curve \" + options), options = curves[options]), options instanceof curves.PresetCurve && (options = { curve: options }), this.curve = options.curve.curve, this.n = this.curve.n, this.nh = this.n.ushrn(1), this.g = this.curve.g, this.g = options.curve.g, this.g.precompute(options.curve.n.bitLength() + 1), this.hash = options.hash || options.curve.hash;\n }\n EC.prototype = {}, module.exports = EC, EC.prototype.keyPair = function(options) {\n return new KeyPair(this, options);\n }, EC.prototype.keyFromPrivate = function(priv, enc) {\n return KeyPair.fromPrivate(this, priv, enc);\n }, EC.prototype.keyFromPublic = function(pub, enc) {\n return KeyPair.fromPublic(this, pub, enc);\n }, EC.prototype.genKeyPair = function(options) {\n options || (options = {});\n for (var drbg = new HmacDRBG({\n hash: this.hash,\n pers: options.pers,\n persEnc: options.persEnc || \"utf8\",\n entropy: options.entropy || rand(this.hash.hmacStrength),\n entropyEnc: options.entropy && options.entropyEnc || \"utf8\",\n nonce: this.n.toArray()\n }), bytes = this.n.byteLength(), ns2 = this.n.sub(new BN(2));; ) {\n var priv = new BN(drbg.generate(bytes));\n if (!(priv.cmp(ns2) > 0))\n return priv.iaddn(1), this.keyFromPrivate(priv);\n }\n }, EC.prototype._truncateToN = function(msg, truncOnly) {\n var delta = msg.byteLength() * 8 - this.n.bitLength();\n return delta > 0 && (msg = msg.ushrn(delta)), !truncOnly && msg.cmp(this.n) >= 0 \? msg.sub(this.n) : msg;\n }, EC.prototype.sign = function(msg, key2, enc, options) {\n typeof enc == \"object\" && (options = enc, enc = null), options || (options = {}), key2 = this.keyFromPrivate(key2, enc), msg = this._truncateToN(new BN(msg, 16));\n for (var bytes = this.n.byteLength(), bkey = key2.getPrivate().toArray(\"be\", bytes), nonce = msg.toArray(\"be\", bytes), drbg = new HmacDRBG({\n hash: this.hash,\n entropy: bkey,\n nonce,\n pers: options.pers,\n persEnc: options.persEnc || \"utf8\"\n }), ns1 = this.n.sub(new BN(1)), iter = 0;; iter++) {\n var k = options.k \? options.k(iter) : new BN(drbg.generate(this.n.byteLength()));\n if (k = this._truncateToN(k, !0), !(k.cmpn(1) <= 0 || k.cmp(ns1) >= 0)) {\n var kp = this.g.mul(k);\n if (!kp.isInfinity()) {\n var kpX = kp.getX(), r = kpX.umod(this.n);\n if (r.cmpn(0) !== 0) {\n var s = k.invm(this.n).mul(r.mul(key2.getPrivate()).iadd(msg));\n if (s = s.umod(this.n), s.cmpn(0) !== 0) {\n var recoveryParam = (kp.getY().isOdd() \? 1 : 0) | (kpX.cmp(r) !== 0 \? 2 : 0);\n return options.canonical && s.cmp(this.nh) > 0 && (s = this.n.sub(s), recoveryParam ^= 1), new Signature({ r, s, recoveryParam });\n }\n }\n }\n }\n }\n }, EC.prototype.verify = function(msg, signature, key2, enc) {\n msg = this._truncateToN(new BN(msg, 16)), key2 = this.keyFromPublic(key2, enc), signature = new Signature(signature, \"hex\");\n var { r, s } = signature;\n if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0 || s.cmpn(1) < 0 || s.cmp(this.n) >= 0)\n return !1;\n var sinv = s.invm(this.n), u1 = sinv.mul(msg).umod(this.n), u2 = sinv.mul(r).umod(this.n), p;\n return this.curve._maxwellTrick \? (p = this.g.jmulAdd(u1, key2.getPublic(), u2), p.isInfinity() \? !1 : p.eqXToP(r)) : (p = this.g.mulAdd(u1, key2.getPublic(), u2), p.isInfinity() \? !1 : p.getX().umod(this.n).cmp(r) === 0);\n }, EC.prototype.recoverPubKey = function(msg, signature, j, enc) {\n assert((3 & j) === j, \"The recovery param is more than two bits\"), signature = new Signature(signature, enc);\n var n = this.n, e = new BN(msg), r = signature.r, s = signature.s, isYOdd = j & 1, isSecondKey = j >> 1;\n if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey)\n throw new Error(\"Unable to find sencond key candinate\");\n isSecondKey \? r = this.curve.pointFromX(r.add(this.curve.n), isYOdd) : r = this.curve.pointFromX(r, isYOdd);\n var rInv = signature.r.invm(n), s1 = n.sub(e).mul(rInv).umod(n), s2 = s.mul(rInv).umod(n);\n return this.g.mulAdd(s1, r, s2);\n }, EC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) {\n if (signature = new Signature(signature, enc), signature.recoveryParam !== null)\n return signature.recoveryParam;\n for (var i = 0;i < 4; i++) {\n var Qprime;\n try {\n Qprime = this.recoverPubKey(e, signature, i);\n } catch {\n continue;\n }\n if (Qprime.eq(Q))\n return i;\n }\n throw new Error(\"Unable to find valid recovery factor\");\n };\n }\n}), require_key2 = __commonJS({\n \"node_modules/elliptic/lib/elliptic/eddsa/key.js\"(exports, module) {\n var utils = require_utils3(), assert = utils.assert, parseBytes = utils.parseBytes, cachedProperty = utils.cachedProperty;\n function KeyPair(eddsa, params) {\n this.eddsa = eddsa, this._secret = parseBytes(params.secret), eddsa.isPoint(params.pub) \? this._pub = params.pub : this._pubBytes = parseBytes(params.pub);\n }\n KeyPair.prototype = {}, KeyPair.fromPublic = function(eddsa, pub) {\n return pub instanceof KeyPair \? pub : new KeyPair(eddsa, { pub });\n }, KeyPair.fromSecret = function(eddsa, secret) {\n return secret instanceof KeyPair \? secret : new KeyPair(eddsa, { secret });\n }, KeyPair.prototype.secret = function() {\n return this._secret;\n }, cachedProperty(KeyPair, \"pubBytes\", function() {\n return this.eddsa.encodePoint(this.pub());\n }), cachedProperty(KeyPair, \"pub\", function() {\n return this._pubBytes \? this.eddsa.decodePoint(this._pubBytes) : this.eddsa.g.mul(this.priv());\n }), cachedProperty(KeyPair, \"privBytes\", function() {\n var eddsa = this.eddsa, hash = this.hash(), lastIx = eddsa.encodingLength - 1, a = hash.slice(0, eddsa.encodingLength);\n return a[0] &= 248, a[lastIx] &= 127, a[lastIx] |= 64, a;\n }), cachedProperty(KeyPair, \"priv\", function() {\n return this.eddsa.decodeInt(this.privBytes());\n }), cachedProperty(KeyPair, \"hash\", function() {\n return this.eddsa.hash().update(this.secret()).digest();\n }), cachedProperty(KeyPair, \"messagePrefix\", function() {\n return this.hash().slice(this.eddsa.encodingLength);\n }), KeyPair.prototype.sign = function(message) {\n return assert(this._secret, \"KeyPair can only verify\"), this.eddsa.sign(message, this);\n }, KeyPair.prototype.verify = function(message, sig) {\n return this.eddsa.verify(message, sig, this);\n }, KeyPair.prototype.getSecret = function(enc) {\n return assert(this._secret, \"KeyPair is public only\"), utils.encode(this.secret(), enc);\n }, KeyPair.prototype.getPublic = function(enc) {\n return utils.encode(this.pubBytes(), enc);\n }, module.exports = KeyPair;\n }\n}), require_signature2 = __commonJS({\n \"node_modules/elliptic/lib/elliptic/eddsa/signature.js\"(exports, module) {\n var BN = require_bn4(), utils = require_utils3(), assert = utils.assert, cachedProperty = utils.cachedProperty, parseBytes = utils.parseBytes;\n function Signature(eddsa, sig) {\n this.eddsa = eddsa, typeof sig != \"object\" && (sig = parseBytes(sig)), @Array.isArray(sig) && (sig = {\n R: sig.slice(0, eddsa.encodingLength),\n S: sig.slice(eddsa.encodingLength)\n }), assert(sig.R && sig.S, \"Signature without R or S\"), eddsa.isPoint(sig.R) && (this._R = sig.R), sig.S instanceof BN && (this._S = sig.S), this._Rencoded = @Array.isArray(sig.R) \? sig.R : sig.Rencoded, this._Sencoded = @Array.isArray(sig.S) \? sig.S : sig.Sencoded;\n }\n Signature.prototype = {}, cachedProperty(Signature, \"S\", function() {\n return this.eddsa.decodeInt(this.Sencoded());\n }), cachedProperty(Signature, \"R\", function() {\n return this.eddsa.decodePoint(this.Rencoded());\n }), cachedProperty(Signature, \"Rencoded\", function() {\n return this.eddsa.encodePoint(this.R());\n }), cachedProperty(Signature, \"Sencoded\", function() {\n return this.eddsa.encodeInt(this.S());\n }), Signature.prototype.toBytes = function() {\n return this.Rencoded().concat(this.Sencoded());\n }, Signature.prototype.toHex = function() {\n return utils.encode(this.toBytes(), \"hex\").toUpperCase();\n }, module.exports = Signature;\n }\n}), require_eddsa = __commonJS({\n \"node_modules/elliptic/lib/elliptic/eddsa/index.js\"(exports, module) {\n var hash = require_hash2(), curves = require_curves(), utils = require_utils3(), assert = utils.assert, parseBytes = utils.parseBytes, KeyPair = require_key2(), Signature = require_signature2();\n function EDDSA(curve) {\n if (assert(curve === \"ed25519\", \"only tested with ed25519 so far\"), !(this instanceof EDDSA))\n return new EDDSA(curve);\n curve = curves[curve].curve, this.curve = curve, this.g = curve.g, this.g.precompute(curve.n.bitLength() + 1), this.pointClass = curve.point().constructor, this.encodingLength = Math.ceil(curve.n.bitLength() / 8), this.hash = hash.sha512;\n }\n EDDSA.prototype = {}, module.exports = EDDSA, EDDSA.prototype.sign = function(message, secret) {\n message = parseBytes(message);\n var key2 = this.keyFromSecret(secret), r = this.hashInt(key2.messagePrefix(), message), R = this.g.mul(r), Rencoded = this.encodePoint(R), s_ = this.hashInt(Rencoded, key2.pubBytes(), message).mul(key2.priv()), S = r.add(s_).umod(this.curve.n);\n return this.makeSignature({ R, S, Rencoded });\n }, EDDSA.prototype.verify = function(message, sig, pub) {\n message = parseBytes(message), sig = this.makeSignature(sig);\n var key2 = this.keyFromPublic(pub), h = this.hashInt(sig.Rencoded(), key2.pubBytes(), message), SG = this.g.mul(sig.S()), RplusAh = sig.R().add(key2.pub().mul(h));\n return RplusAh.eq(SG);\n }, EDDSA.prototype.hashInt = function() {\n for (var hash2 = this.hash(), i = 0;i < arguments.length; i++)\n hash2.update(arguments[i]);\n return utils.intFromLE(hash2.digest()).umod(this.curve.n);\n }, EDDSA.prototype.keyFromPublic = function(pub) {\n return KeyPair.fromPublic(this, pub);\n }, EDDSA.prototype.keyFromSecret = function(secret) {\n return KeyPair.fromSecret(this, secret);\n }, EDDSA.prototype.makeSignature = function(sig) {\n return sig instanceof Signature \? sig : new Signature(this, sig);\n }, EDDSA.prototype.encodePoint = function(point) {\n var enc = point.getY().toArray(\"le\", this.encodingLength);\n return enc[this.encodingLength - 1] |= point.getX().isOdd() \? 128 : 0, enc;\n }, EDDSA.prototype.decodePoint = function(bytes) {\n bytes = utils.parseBytes(bytes);\n var lastIx = bytes.length - 1, normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & -129), xIsOdd = (bytes[lastIx] & 128) !== 0, y = utils.intFromLE(normed);\n return this.curve.pointFromY(y, xIsOdd);\n }, EDDSA.prototype.encodeInt = function(num) {\n return num.toArray(\"le\", this.encodingLength);\n }, EDDSA.prototype.decodeInt = function(bytes) {\n return utils.intFromLE(bytes);\n }, EDDSA.prototype.isPoint = function(val) {\n return val instanceof this.pointClass;\n };\n }\n}), require_elliptic = __commonJS({\n \"node_modules/elliptic/lib/elliptic.js\"(exports) {\n var elliptic = exports;\n elliptic.version = require_package().version, elliptic.utils = require_utils3(), elliptic.rand = require_brorand(), elliptic.curve = require_curve(), elliptic.curves = require_curves(), elliptic.ec = require_ec(), elliptic.eddsa = require_eddsa();\n }\n}), require_bn5 = require_bn, require_safer = __commonJS({\n \"node_modules/safer-buffer/safer.js\"(exports, module) {\n var buffer = BufferModule, Buffer2 = Buffer, safer = {}, key2;\n for (key2 in buffer)\n !buffer.hasOwnProperty(key2) || key2 === \"SlowBuffer\" || key2 === \"Buffer\" || (safer[key2] = buffer[key2]);\n var Safer = safer.Buffer = {};\n for (key2 in Buffer2)\n !Buffer2.hasOwnProperty(key2) || key2 === \"allocUnsafe\" || key2 === \"allocUnsafeSlow\" || (Safer[key2] = Buffer2[key2]);\n if (safer.Buffer.prototype = Buffer2.prototype, (!Safer.from || Safer.from === @Uint8Array.from) && (Safer.from = function(value, encodingOrOffset, length) {\n if (typeof value == \"number\")\n @throwTypeError('The \"value\" argument must not be of type number. Received type ' + typeof value);\n if (value && typeof value.length > \"u\")\n @throwTypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \" + typeof value);\n return Buffer2(value, encodingOrOffset, length);\n }), Safer.alloc || (Safer.alloc = function(size, fill, encoding) {\n if (typeof size != \"number\")\n @throwTypeError('The \"size\" argument must be of type number. Received type ' + typeof size);\n if (size < 0 || size >= 2 * (1 << 30))\n @throwRangeError('The value \"' + size + '\" is invalid for option \"size\"');\n var buf = Buffer2(size);\n return !fill || fill.length === 0 \? buf.fill(0) : typeof encoding == \"string\" \? buf.fill(fill, encoding) : buf.fill(fill), buf;\n }), !safer.kStringMaxLength)\n try {\n safer.kStringMaxLength = MAX_STRING_LENGTH;\n } catch {\n }\n safer.constants || (safer.constants = {\n MAX_LENGTH: safer.kMaxLength\n }, safer.kStringMaxLength && (safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength)), module.exports = safer;\n }\n}), require_reporter = __commonJS({\n \"node_modules/asn1.js/lib/asn1/base/reporter.js\"(exports) {\n var inherits = require_inherits_browser();\n function Reporter(options) {\n this._reporterState = {\n obj: null,\n path: [],\n options: options || {},\n errors: []\n };\n }\n Reporter.prototype = {}, exports.Reporter = Reporter, Reporter.prototype.isError = function(obj) {\n return obj instanceof ReporterError;\n }, Reporter.prototype.save = function() {\n let state = this._reporterState;\n return { obj: state.obj, pathLen: state.path.length };\n }, Reporter.prototype.restore = function(data) {\n let state = this._reporterState;\n state.obj = data.obj, state.path = state.path.slice(0, data.pathLen);\n }, Reporter.prototype.enterKey = function(key2) {\n return this._reporterState.path.push(key2);\n }, Reporter.prototype.exitKey = function(index) {\n let state = this._reporterState;\n state.path = state.path.slice(0, index - 1);\n }, Reporter.prototype.leaveKey = function(index, key2, value) {\n let state = this._reporterState;\n this.exitKey(index), state.obj !== null && (state.obj[key2] = value);\n }, Reporter.prototype.path = function() {\n return this._reporterState.path.join(\"/\");\n }, Reporter.prototype.enterObject = function() {\n let state = this._reporterState, prev = state.obj;\n return state.obj = {}, prev;\n }, Reporter.prototype.leaveObject = function(prev) {\n let state = this._reporterState, now = state.obj;\n return state.obj = prev, now;\n }, Reporter.prototype.error = function(msg) {\n let err, state = this._reporterState, inherited = msg instanceof ReporterError;\n if (inherited \? err = msg : err = new ReporterError(state.path.map(function(elem) {\n return \"[\" + JSON.stringify(elem) + \"]\";\n }).join(\"\"), msg.message || msg, msg.stack), !state.options.partial)\n throw err;\n return inherited || state.errors.push(err), err;\n }, Reporter.prototype.wrapResult = function(result) {\n let state = this._reporterState;\n return state.options.partial \? {\n result: this.isError(result) \? null : result,\n errors: state.errors\n } : result;\n };\n function ReporterError(path, msg) {\n this.path = path, this.rethrow(msg);\n }\n inherits(ReporterError, Error), ReporterError.prototype.rethrow = function(msg) {\n if (this.message = msg + \" at: \" + (this.path || \"(shallow)\"), Error.captureStackTrace && Error.captureStackTrace(this, ReporterError), !this.stack)\n try {\n throw new Error(this.message);\n } catch (e) {\n this.stack = e.stack;\n }\n return this;\n };\n }\n}), require_buffer = __commonJS({\n \"node_modules/asn1.js/lib/asn1/base/buffer.js\"(exports) {\n var inherits = require_inherits_browser(), Reporter = require_reporter().Reporter, Buffer2 = require_safer().Buffer;\n function DecoderBuffer(base, options) {\n if (Reporter.@call(this, options), !Buffer2.isBuffer(base)) {\n this.error(\"Input not Buffer\");\n return;\n }\n this.base = base, this.offset = 0, this.length = base.length;\n }\n inherits(DecoderBuffer, Reporter), exports.DecoderBuffer = DecoderBuffer, DecoderBuffer.isDecoderBuffer = function(data) {\n return data instanceof DecoderBuffer \? !0 : typeof data == \"object\" && Buffer2.isBuffer(data.base) && data.constructor.name === \"DecoderBuffer\" && typeof data.offset == \"number\" && typeof data.length == \"number\" && typeof data.save == \"function\" && typeof data.restore == \"function\" && typeof data.isEmpty == \"function\" && typeof data.readUInt8 == \"function\" && typeof data.skip == \"function\" && typeof data.raw == \"function\";\n }, DecoderBuffer.prototype.save = function() {\n return {\n offset: this.offset,\n reporter: Reporter.prototype.save.@call(this)\n };\n }, DecoderBuffer.prototype.restore = function(save) {\n let res = new DecoderBuffer(this.base);\n return res.offset = save.offset, res.length = this.offset, this.offset = save.offset, Reporter.prototype.restore.@call(this, save.reporter), res;\n }, DecoderBuffer.prototype.isEmpty = function() {\n return this.offset === this.length;\n }, DecoderBuffer.prototype.readUInt8 = function(fail) {\n return this.offset + 1 <= this.length \? this.base.readUInt8(this.offset++, !0) : this.error(fail || \"DecoderBuffer overrun\");\n }, DecoderBuffer.prototype.skip = function(bytes, fail) {\n if (!(this.offset + bytes <= this.length))\n return this.error(fail || \"DecoderBuffer overrun\");\n let res = new DecoderBuffer(this.base);\n return res._reporterState = this._reporterState, res.offset = this.offset, res.length = this.offset + bytes, this.offset += bytes, res;\n }, DecoderBuffer.prototype.raw = function(save) {\n return this.base.slice(save \? save.offset : this.offset, this.length);\n };\n function EncoderBuffer(value, reporter) {\n if (@Array.isArray(value))\n this.length = 0, this.value = value.map(function(item) {\n return EncoderBuffer.isEncoderBuffer(item) || (item = new EncoderBuffer(item, reporter)), this.length += item.length, item;\n }, this);\n else if (typeof value == \"number\") {\n if (!(0 <= value && value <= 255))\n return reporter.error(\"non-byte EncoderBuffer value\");\n this.value = value, this.length = 1;\n } else if (typeof value == \"string\")\n this.value = value, this.length = Buffer2.byteLength(value);\n else if (Buffer2.isBuffer(value))\n this.value = value, this.length = value.length;\n else\n return reporter.error(\"Unsupported type: \" + typeof value);\n }\n EncoderBuffer.prototype = {}, exports.EncoderBuffer = EncoderBuffer, EncoderBuffer.isEncoderBuffer = function(data) {\n return data instanceof EncoderBuffer \? !0 : typeof data == \"object\" && data.constructor.name === \"EncoderBuffer\" && typeof data.length == \"number\" && typeof data.join == \"function\";\n }, EncoderBuffer.prototype.join = function(out, offset) {\n return out || (out = Buffer2.alloc(this.length)), offset || (offset = 0), this.length === 0 || (@Array.isArray(this.value) \? this.value.forEach(function(item) {\n item.join(out, offset), offset += item.length;\n }) : (typeof this.value == \"number\" \? out[offset] = this.value : typeof this.value == \"string\" \? out.write(this.value, offset) : Buffer2.isBuffer(this.value) && this.value.copy(out, offset), offset += this.length)), out;\n };\n }\n}), require_node = __commonJS({\n \"node_modules/asn1.js/lib/asn1/base/node.js\"(exports, module) {\n var Reporter = require_reporter().Reporter, EncoderBuffer = require_buffer().EncoderBuffer, DecoderBuffer = require_buffer().DecoderBuffer, assert = require_minimalistic_assert(), tags = [\n \"seq\",\n \"seqof\",\n \"set\",\n \"setof\",\n \"objid\",\n \"bool\",\n \"gentime\",\n \"utctime\",\n \"null_\",\n \"enum\",\n \"int\",\n \"objDesc\",\n \"bitstr\",\n \"bmpstr\",\n \"charstr\",\n \"genstr\",\n \"graphstr\",\n \"ia5str\",\n \"iso646str\",\n \"numstr\",\n \"octstr\",\n \"printstr\",\n \"t61str\",\n \"unistr\",\n \"utf8str\",\n \"videostr\"\n ], methods = [\"key\", \"obj\", \"use\", \"optional\", \"explicit\", \"implicit\", \"def\", \"choice\", \"any\", \"contains\"].concat(tags), overrided = [\n \"_peekTag\",\n \"_decodeTag\",\n \"_use\",\n \"_decodeStr\",\n \"_decodeObjid\",\n \"_decodeTime\",\n \"_decodeNull\",\n \"_decodeInt\",\n \"_decodeBool\",\n \"_decodeList\",\n \"_encodeComposite\",\n \"_encodeStr\",\n \"_encodeObjid\",\n \"_encodeTime\",\n \"_encodeNull\",\n \"_encodeInt\",\n \"_encodeBool\"\n ];\n function Node(enc, parent, name) {\n let state = {};\n this._baseState = state, state.name = name, state.enc = enc, state.parent = parent || null, state.children = null, state.tag = null, state.args = null, state.reverseArgs = null, state.choice = null, state.optional = !1, state.any = !1, state.obj = !1, state.use = null, state.useDecoder = null, state.key = null, state.default = null, state.explicit = null, state.implicit = null, state.contains = null, state.parent || (state.children = [], this._wrap());\n }\n Node.prototype = {}, module.exports = Node;\n var stateProps = [\n \"enc\",\n \"parent\",\n \"children\",\n \"tag\",\n \"args\",\n \"reverseArgs\",\n \"choice\",\n \"optional\",\n \"any\",\n \"obj\",\n \"use\",\n \"alteredUse\",\n \"key\",\n \"default\",\n \"explicit\",\n \"implicit\",\n \"contains\"\n ];\n Node.prototype.clone = function() {\n let state = this._baseState, cstate = {};\n stateProps.forEach(function(prop) {\n cstate[prop] = state[prop];\n });\n let res = new this.constructor(cstate.parent);\n return res._baseState = cstate, res;\n }, Node.prototype._wrap = function() {\n let state = this._baseState;\n methods.forEach(function(method) {\n this[method] = function() {\n let clone = new this.constructor(this);\n return state.children.push(clone), clone[method].@apply(clone, arguments);\n };\n }, this);\n }, Node.prototype._init = function(body) {\n let state = this._baseState;\n assert(state.parent === null), body.@call(this), state.children = state.children.filter(function(child) {\n return child._baseState.parent === this;\n }, this), assert.equal(state.children.length, 1, \"Root node can have only one child\");\n }, Node.prototype._useArgs = function(args) {\n let state = this._baseState, children = args.filter(function(arg) {\n return arg instanceof this.constructor;\n }, this);\n args = args.filter(function(arg) {\n return !(arg instanceof this.constructor);\n }, this), children.length !== 0 && (assert(state.children === null), state.children = children, children.forEach(function(child) {\n child._baseState.parent = this;\n }, this)), args.length !== 0 && (assert(state.args === null), state.args = args, state.reverseArgs = args.map(function(arg) {\n if (typeof arg != \"object\" || arg.constructor !== Object)\n return arg;\n let res = {};\n return Object.keys(arg).forEach(function(key2) {\n key2 == (key2 | 0) && (key2 |= 0);\n let value = arg[key2];\n res[value] = key2;\n }), res;\n }));\n }, overrided.forEach(function(method) {\n Node.prototype[method] = function() {\n let state = this._baseState;\n throw new Error(method + \" not implemented for encoding: \" + state.enc);\n };\n }), tags.forEach(function(tag) {\n Node.prototype[tag] = function() {\n let state = this._baseState, args = @Array.prototype.slice.@call(arguments);\n return assert(state.tag === null), state.tag = tag, this._useArgs(args), this;\n };\n }), Node.prototype.use = function(item) {\n assert(item);\n let state = this._baseState;\n return assert(state.use === null), state.use = item, this;\n }, Node.prototype.optional = function() {\n let state = this._baseState;\n return state.optional = !0, this;\n }, Node.prototype.def = function(val) {\n let state = this._baseState;\n return assert(state.default === null), state.default = val, state.optional = !0, this;\n }, Node.prototype.explicit = function(num) {\n let state = this._baseState;\n return assert(state.explicit === null && state.implicit === null), state.explicit = num, this;\n }, Node.prototype.implicit = function(num) {\n let state = this._baseState;\n return assert(state.explicit === null && state.implicit === null), state.implicit = num, this;\n }, Node.prototype.obj = function() {\n let state = this._baseState, args = @Array.prototype.slice.@call(arguments);\n return state.obj = !0, args.length !== 0 && this._useArgs(args), this;\n }, Node.prototype.key = function(newKey) {\n let state = this._baseState;\n return assert(state.key === null), state.key = newKey, this;\n }, Node.prototype.any = function() {\n let state = this._baseState;\n return state.any = !0, this;\n }, Node.prototype.choice = function(obj) {\n let state = this._baseState;\n return assert(state.choice === null), state.choice = obj, this._useArgs(Object.keys(obj).map(function(key2) {\n return obj[key2];\n })), this;\n }, Node.prototype.contains = function(item) {\n let state = this._baseState;\n return assert(state.use === null), state.contains = item, this;\n }, Node.prototype._decode = function(input, options) {\n let state = this._baseState;\n if (state.parent === null)\n return input.wrapResult(state.children[0]._decode(input, options));\n let result = state.default, present = !0, prevKey = null;\n if (state.key !== null && (prevKey = input.enterKey(state.key)), state.optional) {\n let tag = null;\n if (state.explicit !== null \? tag = state.explicit : state.implicit !== null \? tag = state.implicit : state.tag !== null && (tag = state.tag), tag === null && !state.any) {\n let save = input.save();\n try {\n state.choice === null \? this._decodeGeneric(state.tag, input, options) : this._decodeChoice(input, options), present = !0;\n } catch {\n present = !1;\n }\n input.restore(save);\n } else if (present = this._peekTag(input, tag, state.any), input.isError(present))\n return present;\n }\n let prevObj;\n if (state.obj && present && (prevObj = input.enterObject()), present) {\n if (state.explicit !== null) {\n let explicit = this._decodeTag(input, state.explicit);\n if (input.isError(explicit))\n return explicit;\n input = explicit;\n }\n let start = input.offset;\n if (state.use === null && state.choice === null) {\n let save;\n state.any && (save = input.save());\n let body = this._decodeTag(input, state.implicit !== null \? state.implicit : state.tag, state.any);\n if (input.isError(body))\n return body;\n state.any \? result = input.raw(save) : input = body;\n }\n if (options && options.track && state.tag !== null && options.track(input.path(), start, input.length, \"tagged\"), options && options.track && state.tag !== null && options.track(input.path(), input.offset, input.length, \"content\"), state.any || (state.choice === null \? result = this._decodeGeneric(state.tag, input, options) : result = this._decodeChoice(input, options)), input.isError(result))\n return result;\n if (!state.any && state.choice === null && state.children !== null && state.children.forEach(function(child) {\n child._decode(input, options);\n }), state.contains && (state.tag === \"octstr\" || state.tag === \"bitstr\")) {\n let data = new DecoderBuffer(result);\n result = this._getUse(state.contains, input._reporterState.obj)._decode(data, options);\n }\n }\n return state.obj && present && (result = input.leaveObject(prevObj)), state.key !== null && (result !== null || present === !0) \? input.leaveKey(prevKey, state.key, result) : prevKey !== null && input.exitKey(prevKey), result;\n }, Node.prototype._decodeGeneric = function(tag, input, options) {\n let state = this._baseState;\n return tag === \"seq\" || tag === \"set\" \? null : tag === \"seqof\" || tag === \"setof\" \? this._decodeList(input, tag, state.args[0], options) : /str$/.test(tag) \? this._decodeStr(input, tag, options) : tag === \"objid\" && state.args \? this._decodeObjid(input, state.args[0], state.args[1], options) : tag === \"objid\" \? this._decodeObjid(input, null, null, options) : tag === \"gentime\" || tag === \"utctime\" \? this._decodeTime(input, tag, options) : tag === \"null_\" \? this._decodeNull(input, options) : tag === \"bool\" \? this._decodeBool(input, options) : tag === \"objDesc\" \? this._decodeStr(input, tag, options) : tag === \"int\" || tag === \"enum\" \? this._decodeInt(input, state.args && state.args[0], options) : state.use !== null \? this._getUse(state.use, input._reporterState.obj)._decode(input, options) : input.error(\"unknown tag: \" + tag);\n }, Node.prototype._getUse = function(entity, obj) {\n let state = this._baseState;\n return state.useDecoder = this._use(entity, obj), assert(state.useDecoder._baseState.parent === null), state.useDecoder = state.useDecoder._baseState.children[0], state.implicit !== state.useDecoder._baseState.implicit && (state.useDecoder = state.useDecoder.clone(), state.useDecoder._baseState.implicit = state.implicit), state.useDecoder;\n }, Node.prototype._decodeChoice = function(input, options) {\n let state = this._baseState, result = null, match = !1;\n return Object.keys(state.choice).some(function(key2) {\n let save = input.save(), node = state.choice[key2];\n try {\n let value = node._decode(input, options);\n if (input.isError(value))\n return !1;\n result = { type: key2, value }, match = !0;\n } catch {\n return input.restore(save), !1;\n }\n return !0;\n }, this), match \? result : input.error(\"Choice not matched\");\n }, Node.prototype._createEncoderBuffer = function(data) {\n return new EncoderBuffer(data, this.reporter);\n }, Node.prototype._encode = function(data, reporter, parent) {\n let state = this._baseState;\n if (state.default !== null && state.default === data)\n return;\n let result = this._encodeValue(data, reporter, parent);\n if (result !== void 0 && !this._skipDefault(result, reporter, parent))\n return result;\n }, Node.prototype._encodeValue = function(data, reporter, parent) {\n let state = this._baseState;\n if (state.parent === null)\n return state.children[0]._encode(data, reporter || new Reporter);\n let result = null;\n if (this.reporter = reporter, state.optional && data === void 0)\n if (state.default !== null)\n data = state.default;\n else\n return;\n let content = null, primitive = !1;\n if (state.any)\n result = this._createEncoderBuffer(data);\n else if (state.choice)\n result = this._encodeChoice(data, reporter);\n else if (state.contains)\n content = this._getUse(state.contains, parent)._encode(data, reporter), primitive = !0;\n else if (state.children)\n content = state.children.map(function(child) {\n if (child._baseState.tag === \"null_\")\n return child._encode(null, reporter, data);\n if (child._baseState.key === null)\n return reporter.error(\"Child should have a key\");\n let prevKey = reporter.enterKey(child._baseState.key);\n if (typeof data != \"object\")\n return reporter.error(\"Child expected, but input is not object\");\n let res = child._encode(data[child._baseState.key], reporter, data);\n return reporter.leaveKey(prevKey), res;\n }, this).filter(function(child) {\n return child;\n }), content = this._createEncoderBuffer(content);\n else if (state.tag === \"seqof\" || state.tag === \"setof\") {\n if (!(state.args && state.args.length === 1))\n return reporter.error(\"Too many args for : \" + state.tag);\n if (!@Array.isArray(data))\n return reporter.error(\"seqof/setof, but data is not Array\");\n let child = this.clone();\n child._baseState.implicit = null, content = this._createEncoderBuffer(data.map(function(item) {\n let state2 = this._baseState;\n return this._getUse(state2.args[0], data)._encode(item, reporter);\n }, child));\n } else\n state.use !== null \? result = this._getUse(state.use, parent)._encode(data, reporter) : (content = this._encodePrimitive(state.tag, data), primitive = !0);\n if (!state.any && state.choice === null) {\n let tag = state.implicit !== null \? state.implicit : state.tag, cls = state.implicit === null \? \"universal\" : \"context\";\n tag === null \? state.use === null && reporter.error(\"Tag could be omitted only for .use()\") : state.use === null && (result = this._encodeComposite(tag, primitive, cls, content));\n }\n return state.explicit !== null && (result = this._encodeComposite(state.explicit, !1, \"context\", result)), result;\n }, Node.prototype._encodeChoice = function(data, reporter) {\n let state = this._baseState, node = state.choice[data.type];\n return node || assert(!1, data.type + \" not found in \" + JSON.stringify(Object.keys(state.choice))), node._encode(data.value, reporter);\n }, Node.prototype._encodePrimitive = function(tag, data) {\n let state = this._baseState;\n if (/str$/.test(tag))\n return this._encodeStr(data, tag);\n if (tag === \"objid\" && state.args)\n return this._encodeObjid(data, state.reverseArgs[0], state.args[1]);\n if (tag === \"objid\")\n return this._encodeObjid(data, null, null);\n if (tag === \"gentime\" || tag === \"utctime\")\n return this._encodeTime(data, tag);\n if (tag === \"null_\")\n return this._encodeNull();\n if (tag === \"int\" || tag === \"enum\")\n return this._encodeInt(data, state.args && state.reverseArgs[0]);\n if (tag === \"bool\")\n return this._encodeBool(data);\n if (tag === \"objDesc\")\n return this._encodeStr(data, tag);\n throw new Error(\"Unsupported tag: \" + tag);\n }, Node.prototype._isNumstr = function(str) {\n return /^[0-9 ]*$/.test(str);\n }, Node.prototype._isPrintstr = function(str) {\n return /^[A-Za-z0-9 '()+,-./:=\?]*$/.test(str);\n };\n }\n}), require_der = __commonJS({\n \"node_modules/asn1.js/lib/asn1/constants/der.js\"(exports) {\n function reverse(map) {\n let res = {};\n return Object.keys(map).forEach(function(key2) {\n (key2 | 0) == key2 && (key2 = key2 | 0);\n let value = map[key2];\n res[value] = key2;\n }), res;\n }\n exports.tagClass = {\n 0: \"universal\",\n 1: \"application\",\n 2: \"context\",\n 3: \"private\"\n }, exports.tagClassByName = reverse(exports.tagClass), exports.tag = {\n 0: \"end\",\n 1: \"bool\",\n 2: \"int\",\n 3: \"bitstr\",\n 4: \"octstr\",\n 5: \"null_\",\n 6: \"objid\",\n 7: \"objDesc\",\n 8: \"external\",\n 9: \"real\",\n 10: \"enum\",\n 11: \"embed\",\n 12: \"utf8str\",\n 13: \"relativeOid\",\n 16: \"seq\",\n 17: \"set\",\n 18: \"numstr\",\n 19: \"printstr\",\n 20: \"t61str\",\n 21: \"videostr\",\n 22: \"ia5str\",\n 23: \"utctime\",\n 24: \"gentime\",\n 25: \"graphstr\",\n 26: \"iso646str\",\n 27: \"genstr\",\n 28: \"unistr\",\n 29: \"charstr\",\n 30: \"bmpstr\"\n }, exports.tagByName = reverse(exports.tag);\n }\n}), require_der2 = __commonJS({\n \"node_modules/asn1.js/lib/asn1/encoders/der.js\"(exports, module) {\n var inherits = require_inherits_browser(), Buffer2 = require_safer().Buffer, Node = require_node(), der = require_der();\n function DEREncoder(entity) {\n this.enc = \"der\", this.name = entity.name, this.entity = entity, this.tree = new DERNode, this.tree._init(entity.body);\n }\n DEREncoder.prototype = {}, module.exports = DEREncoder, DEREncoder.prototype.encode = function(data, reporter) {\n return this.tree._encode(data, reporter).join();\n };\n function DERNode(parent) {\n Node.@call(this, \"der\", parent);\n }\n inherits(DERNode, Node), DERNode.prototype._encodeComposite = function(tag, primitive, cls, content) {\n let encodedTag = encodeTag(tag, primitive, cls, this.reporter);\n if (content.length < 128) {\n let header2 = Buffer2.alloc(2);\n return header2[0] = encodedTag, header2[1] = content.length, this._createEncoderBuffer([header2, content]);\n }\n let lenOctets = 1;\n for (let i = content.length;i >= 256; i >>= 8)\n lenOctets++;\n let header = Buffer2.alloc(2 + lenOctets);\n header[0] = encodedTag, header[1] = 128 | lenOctets;\n for (let i = 1 + lenOctets, j = content.length;j > 0; i--, j >>= 8)\n header[i] = j & 255;\n return this._createEncoderBuffer([header, content]);\n }, DERNode.prototype._encodeStr = function(str, tag) {\n if (tag === \"bitstr\")\n return this._createEncoderBuffer([str.unused | 0, str.data]);\n if (tag === \"bmpstr\") {\n let buf = Buffer2.alloc(str.length * 2);\n for (let i = 0;i < str.length; i++)\n buf.writeUInt16BE(str.charCodeAt(i), i * 2);\n return this._createEncoderBuffer(buf);\n } else\n return tag === \"numstr\" \? this._isNumstr(str) \? this._createEncoderBuffer(str) : this.reporter.error(\"Encoding of string type: numstr supports only digits and space\") : tag === \"printstr\" \? this._isPrintstr(str) \? this._createEncoderBuffer(str) : this.reporter.error(\"Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark\") : /str$/.test(tag) \? this._createEncoderBuffer(str) : tag === \"objDesc\" \? this._createEncoderBuffer(str) : this.reporter.error(\"Encoding of string type: \" + tag + \" unsupported\");\n }, DERNode.prototype._encodeObjid = function(id, values, relative) {\n if (typeof id == \"string\") {\n if (!values)\n return this.reporter.error(\"string objid given, but no values map found\");\n if (!values.hasOwnProperty(id))\n return this.reporter.error(\"objid not found in values map\");\n id = values[id].split(/[\\s.]+/g);\n for (let i = 0;i < id.length; i++)\n id[i] |= 0;\n } else if (@Array.isArray(id)) {\n id = id.slice();\n for (let i = 0;i < id.length; i++)\n id[i] |= 0;\n }\n if (!@Array.isArray(id))\n return this.reporter.error(\"objid() should be either array or string, got: \" + JSON.stringify(id));\n if (!relative) {\n if (id[1] >= 40)\n return this.reporter.error(\"Second objid identifier OOB\");\n id.splice(0, 2, id[0] * 40 + id[1]);\n }\n let size = 0;\n for (let i = 0;i < id.length; i++) {\n let ident = id[i];\n for (size++;ident >= 128; ident >>= 7)\n size++;\n }\n let objid = Buffer2.alloc(size), offset = objid.length - 1;\n for (let i = id.length - 1;i >= 0; i--) {\n let ident = id[i];\n for (objid[offset--] = ident & 127;(ident >>= 7) > 0; )\n objid[offset--] = 128 | ident & 127;\n }\n return this._createEncoderBuffer(objid);\n };\n function two(num) {\n return num < 10 \? \"0\" + num : num;\n }\n DERNode.prototype._encodeTime = function(time, tag) {\n let str, date = new Date(time);\n return tag === \"gentime\" \? str = [\n two(date.getUTCFullYear()),\n two(date.getUTCMonth() + 1),\n two(date.getUTCDate()),\n two(date.getUTCHours()),\n two(date.getUTCMinutes()),\n two(date.getUTCSeconds()),\n \"Z\"\n ].join(\"\") : tag === \"utctime\" \? str = [\n two(date.getUTCFullYear() % 100),\n two(date.getUTCMonth() + 1),\n two(date.getUTCDate()),\n two(date.getUTCHours()),\n two(date.getUTCMinutes()),\n two(date.getUTCSeconds()),\n \"Z\"\n ].join(\"\") : this.reporter.error(\"Encoding \" + tag + \" time is not supported yet\"), this._encodeStr(str, \"octstr\");\n }, DERNode.prototype._encodeNull = function() {\n return this._createEncoderBuffer(\"\");\n }, DERNode.prototype._encodeInt = function(num, values) {\n if (typeof num == \"string\") {\n if (!values)\n return this.reporter.error(\"String int or enum given, but no values map\");\n if (!values.hasOwnProperty(num))\n return this.reporter.error(\"Values map doesn't contain: \" + JSON.stringify(num));\n num = values[num];\n }\n if (typeof num != \"number\" && !Buffer2.isBuffer(num)) {\n let numArray = num.toArray();\n !num.sign && numArray[0] & 128 && numArray.unshift(0), num = Buffer2.from(numArray);\n }\n if (Buffer2.isBuffer(num)) {\n let size2 = num.length;\n num.length === 0 && size2++;\n let out2 = Buffer2.alloc(size2);\n return num.copy(out2), num.length === 0 && (out2[0] = 0), this._createEncoderBuffer(out2);\n }\n if (num < 128)\n return this._createEncoderBuffer(num);\n if (num < 256)\n return this._createEncoderBuffer([0, num]);\n let size = 1;\n for (let i = num;i >= 256; i >>= 8)\n size++;\n let out = new @Array(size);\n for (let i = out.length - 1;i >= 0; i--)\n out[i] = num & 255, num >>= 8;\n return out[0] & 128 && out.unshift(0), this._createEncoderBuffer(Buffer2.from(out));\n }, DERNode.prototype._encodeBool = function(value) {\n return this._createEncoderBuffer(value \? 255 : 0);\n }, DERNode.prototype._use = function(entity, obj) {\n return typeof entity == \"function\" && (entity = entity(obj)), entity._getEncoder(\"der\").tree;\n }, DERNode.prototype._skipDefault = function(dataBuffer, reporter, parent) {\n let state = this._baseState, i;\n if (state.default === null)\n return !1;\n let data = dataBuffer.join();\n if (state.defaultBuffer === void 0 && (state.defaultBuffer = this._encodeValue(state.default, reporter, parent).join()), data.length !== state.defaultBuffer.length)\n return !1;\n for (i = 0;i < data.length; i++)\n if (data[i] !== state.defaultBuffer[i])\n return !1;\n return !0;\n };\n function encodeTag(tag, primitive, cls, reporter) {\n let res;\n if (tag === \"seqof\" \? tag = \"seq\" : tag === \"setof\" && (tag = \"set\"), der.tagByName.hasOwnProperty(tag))\n res = der.tagByName[tag];\n else if (typeof tag == \"number\" && (tag | 0) === tag)\n res = tag;\n else\n return reporter.error(\"Unknown tag: \" + tag);\n return res >= 31 \? reporter.error(\"Multi-octet tag encoding unsupported\") : (primitive || (res |= 32), res |= der.tagClassByName[cls || \"universal\"] << 6, res);\n }\n }\n}), require_pem = __commonJS({\n \"node_modules/asn1.js/lib/asn1/encoders/pem.js\"(exports, module) {\n var inherits = require_inherits_browser(), DEREncoder = require_der2();\n function PEMEncoder(entity) {\n DEREncoder.@call(this, entity), this.enc = \"pem\";\n }\n inherits(PEMEncoder, DEREncoder), module.exports = PEMEncoder, PEMEncoder.prototype.encode = function(data, options) {\n let p = DEREncoder.prototype.encode.@call(this, data).toString(\"base64\"), out = [\"-----BEGIN \" + options.label + \"-----\"];\n for (let i = 0;i < p.length; i += 64)\n out.push(p.slice(i, i + 64));\n return out.push(\"-----END \" + options.label + \"-----\"), out.join(`\n`);\n };\n }\n}), require_encoders = __commonJS({\n \"node_modules/asn1.js/lib/asn1/encoders/index.js\"(exports) {\n var encoders = exports;\n encoders.der = require_der2(), encoders.pem = require_pem();\n }\n}), require_der3 = __commonJS({\n \"node_modules/asn1.js/lib/asn1/decoders/der.js\"(exports, module) {\n var inherits = require_inherits_browser(), bignum = require_bn5(), DecoderBuffer = require_buffer().DecoderBuffer, Node = require_node(), der = require_der();\n function DERDecoder(entity) {\n this.enc = \"der\", this.name = entity.name, this.entity = entity, this.tree = new DERNode, this.tree._init(entity.body);\n }\n DERDecoder.prototype = {}, module.exports = DERDecoder, DERDecoder.prototype.decode = function(data, options) {\n return DecoderBuffer.isDecoderBuffer(data) || (data = new DecoderBuffer(data, options)), this.tree._decode(data, options);\n };\n function DERNode(parent) {\n Node.@call(this, \"der\", parent);\n }\n inherits(DERNode, Node), DERNode.prototype._peekTag = function(buffer, tag, any) {\n if (buffer.isEmpty())\n return !1;\n let state = buffer.save(), decodedTag = derDecodeTag(buffer, 'Failed to peek tag: \"' + tag + '\"');\n return buffer.isError(decodedTag) \? decodedTag : (buffer.restore(state), decodedTag.tag === tag || decodedTag.tagStr === tag || decodedTag.tagStr + \"of\" === tag || any);\n }, DERNode.prototype._decodeTag = function(buffer, tag, any) {\n let decodedTag = derDecodeTag(buffer, 'Failed to decode tag of \"' + tag + '\"');\n if (buffer.isError(decodedTag))\n return decodedTag;\n let len = derDecodeLen(buffer, decodedTag.primitive, 'Failed to get length of \"' + tag + '\"');\n if (buffer.isError(len))\n return len;\n if (!any && decodedTag.tag !== tag && decodedTag.tagStr !== tag && decodedTag.tagStr + \"of\" !== tag)\n return buffer.error('Failed to match tag: \"' + tag + '\"');\n if (decodedTag.primitive || len !== null)\n return buffer.skip(len, 'Failed to match body of: \"' + tag + '\"');\n let state = buffer.save(), res = this._skipUntilEnd(buffer, 'Failed to skip indefinite length body: \"' + this.tag + '\"');\n return buffer.isError(res) \? res : (len = buffer.offset - state.offset, buffer.restore(state), buffer.skip(len, 'Failed to match body of: \"' + tag + '\"'));\n }, DERNode.prototype._skipUntilEnd = function(buffer, fail) {\n for (;; ) {\n let tag = derDecodeTag(buffer, fail);\n if (buffer.isError(tag))\n return tag;\n let len = derDecodeLen(buffer, tag.primitive, fail);\n if (buffer.isError(len))\n return len;\n let res;\n if (tag.primitive || len !== null \? res = buffer.skip(len) : res = this._skipUntilEnd(buffer, fail), buffer.isError(res))\n return res;\n if (tag.tagStr === \"end\")\n break;\n }\n }, DERNode.prototype._decodeList = function(buffer, tag, decoder, options) {\n let result = [];\n for (;!buffer.isEmpty(); ) {\n let possibleEnd = this._peekTag(buffer, \"end\");\n if (buffer.isError(possibleEnd))\n return possibleEnd;\n let res = decoder.decode(buffer, \"der\", options);\n if (buffer.isError(res) && possibleEnd)\n break;\n result.push(res);\n }\n return result;\n }, DERNode.prototype._decodeStr = function(buffer, tag) {\n if (tag === \"bitstr\") {\n let unused = buffer.readUInt8();\n return buffer.isError(unused) \? unused : { unused, data: buffer.raw() };\n } else if (tag === \"bmpstr\") {\n let raw = buffer.raw();\n if (raw.length % 2 === 1)\n return buffer.error(\"Decoding of string type: bmpstr length mismatch\");\n let str = \"\";\n for (let i = 0;i < raw.length / 2; i++)\n str += @String.fromCharCode(raw.readUInt16BE(i * 2));\n return str;\n } else if (tag === \"numstr\") {\n let numstr = buffer.raw().toString(\"ascii\");\n return this._isNumstr(numstr) \? numstr : buffer.error(\"Decoding of string type: numstr unsupported characters\");\n } else {\n if (tag === \"octstr\")\n return buffer.raw();\n if (tag === \"objDesc\")\n return buffer.raw();\n if (tag === \"printstr\") {\n let printstr = buffer.raw().toString(\"ascii\");\n return this._isPrintstr(printstr) \? printstr : buffer.error(\"Decoding of string type: printstr unsupported characters\");\n } else\n return /str$/.test(tag) \? buffer.raw().toString() : buffer.error(\"Decoding of string type: \" + tag + \" unsupported\");\n }\n }, DERNode.prototype._decodeObjid = function(buffer, values, relative) {\n let result, identifiers = [], ident = 0, subident = 0;\n for (;!buffer.isEmpty(); )\n subident = buffer.readUInt8(), ident <<= 7, ident |= subident & 127, (subident & 128) === 0 && (identifiers.push(ident), ident = 0);\n subident & 128 && identifiers.push(ident);\n let first = identifiers[0] / 40 | 0, second = identifiers[0] % 40;\n if (relative \? result = identifiers : result = [first, second].concat(identifiers.slice(1)), values) {\n let tmp = values[result.join(\" \")];\n tmp === void 0 && (tmp = values[result.join(\".\")]), tmp !== void 0 && (result = tmp);\n }\n return result;\n }, DERNode.prototype._decodeTime = function(buffer, tag) {\n let str = buffer.raw().toString(), year, mon, day, hour, min, sec;\n if (tag === \"gentime\")\n year = str.slice(0, 4) | 0, mon = str.slice(4, 6) | 0, day = str.slice(6, 8) | 0, hour = str.slice(8, 10) | 0, min = str.slice(10, 12) | 0, sec = str.slice(12, 14) | 0;\n else if (tag === \"utctime\")\n year = str.slice(0, 2) | 0, mon = str.slice(2, 4) | 0, day = str.slice(4, 6) | 0, hour = str.slice(6, 8) | 0, min = str.slice(8, 10) | 0, sec = str.slice(10, 12) | 0, year < 70 \? year = 2000 + year : year = 1900 + year;\n else\n return buffer.error(\"Decoding \" + tag + \" time is not supported yet\");\n return Date.UTC(year, mon - 1, day, hour, min, sec, 0);\n }, DERNode.prototype._decodeNull = function() {\n return null;\n }, DERNode.prototype._decodeBool = function(buffer) {\n let res = buffer.readUInt8();\n return buffer.isError(res) \? res : res !== 0;\n }, DERNode.prototype._decodeInt = function(buffer, values) {\n let raw = buffer.raw(), res = new bignum(raw);\n return values && (res = values[res.toString(10)] || res), res;\n }, DERNode.prototype._use = function(entity, obj) {\n return typeof entity == \"function\" && (entity = entity(obj)), entity._getDecoder(\"der\").tree;\n };\n function derDecodeTag(buf, fail) {\n let tag = buf.readUInt8(fail);\n if (buf.isError(tag))\n return tag;\n let cls = der.tagClass[tag >> 6], primitive = (tag & 32) === 0;\n if ((tag & 31) === 31) {\n let oct = tag;\n for (tag = 0;(oct & 128) === 128; ) {\n if (oct = buf.readUInt8(fail), buf.isError(oct))\n return oct;\n tag <<= 7, tag |= oct & 127;\n }\n } else\n tag &= 31;\n let tagStr = der.tag[tag];\n return {\n cls,\n primitive,\n tag,\n tagStr\n };\n }\n function derDecodeLen(buf, primitive, fail) {\n let len = buf.readUInt8(fail);\n if (buf.isError(len))\n return len;\n if (!primitive && len === 128)\n return null;\n if ((len & 128) === 0)\n return len;\n let num = len & 127;\n if (num > 4)\n return buf.error(\"length octect is too long\");\n len = 0;\n for (let i = 0;i < num; i++) {\n len <<= 8;\n let j = buf.readUInt8(fail);\n if (buf.isError(j))\n return j;\n len |= j;\n }\n return len;\n }\n }\n}), require_pem2 = __commonJS({\n \"node_modules/asn1.js/lib/asn1/decoders/pem.js\"(exports, module) {\n var inherits = require_inherits_browser(), Buffer2 = require_safer().Buffer, DERDecoder = require_der3();\n function PEMDecoder(entity) {\n DERDecoder.@call(this, entity), this.enc = \"pem\";\n }\n inherits(PEMDecoder, DERDecoder), module.exports = PEMDecoder, PEMDecoder.prototype.decode = function(data, options) {\n let lines = data.toString().split(/[\\r\\n]+/g), label = options.label.toUpperCase(), re = /^-----(BEGIN|END) ([^-]+)-----$/, start = -1, end = -1;\n for (let i = 0;i < lines.length; i++) {\n let match = lines[i].match(re);\n if (match !== null && match[2] === label)\n if (start === -1) {\n if (match[1] !== \"BEGIN\")\n break;\n start = i;\n } else {\n if (match[1] !== \"END\")\n break;\n end = i;\n break;\n }\n }\n if (start === -1 || end === -1)\n throw new Error(\"PEM section not found for: \" + label);\n let base64 = lines.slice(start + 1, end).join(\"\");\n base64.replace(/[^a-z0-9+/=]+/gi, \"\");\n let input = Buffer2.from(base64, \"base64\");\n return DERDecoder.prototype.decode.@call(this, input, options);\n };\n }\n}), require_decoders = __commonJS({\n \"node_modules/asn1.js/lib/asn1/decoders/index.js\"(exports) {\n var decoders = exports;\n decoders.der = require_der3(), decoders.pem = require_pem2();\n }\n}), require_api = __commonJS({\n \"node_modules/asn1.js/lib/asn1/api.js\"(exports) {\n var encoders = require_encoders(), decoders = require_decoders(), inherits = require_inherits_browser(), api = exports;\n api.define = function(name, body) {\n return new Entity(name, body);\n };\n function Entity(name, body) {\n this.name = name, this.body = body, this.decoders = {}, this.encoders = {};\n }\n Entity.prototype = {}, Entity.prototype._createNamed = function(Base) {\n let name = this.name;\n function Generated(entity) {\n this._initNamed(entity, name);\n }\n return inherits(Generated, Base), Generated.prototype._initNamed = function(entity, name2) {\n Base.@call(this, entity, name2);\n }, new Generated(this);\n }, Entity.prototype._getDecoder = function(enc) {\n return enc = enc || \"der\", this.decoders.hasOwnProperty(enc) || (this.decoders[enc] = this._createNamed(decoders[enc])), this.decoders[enc];\n }, Entity.prototype.decode = function(data, enc, options) {\n return this._getDecoder(enc).decode(data, options);\n }, Entity.prototype._getEncoder = function(enc) {\n return enc = enc || \"der\", this.encoders.hasOwnProperty(enc) || (this.encoders[enc] = this._createNamed(encoders[enc])), this.encoders[enc];\n }, Entity.prototype.encode = function(data, enc, reporter) {\n return this._getEncoder(enc).encode(data, reporter);\n };\n }\n}), require_base2 = __commonJS({\n \"node_modules/asn1.js/lib/asn1/base/index.js\"(exports) {\n var base = exports;\n base.Reporter = require_reporter().Reporter, base.DecoderBuffer = require_buffer().DecoderBuffer, base.EncoderBuffer = require_buffer().EncoderBuffer, base.Node = require_node();\n }\n}), require_constants = __commonJS({\n \"node_modules/asn1.js/lib/asn1/constants/index.js\"(exports) {\n var constants = exports;\n constants._reverse = function(map) {\n let res = {};\n return Object.keys(map).forEach(function(key2) {\n (key2 | 0) == key2 && (key2 = key2 | 0);\n let value = map[key2];\n res[value] = key2;\n }), res;\n }, constants.der = require_der();\n }\n}), require_asn1 = __commonJS({\n \"node_modules/asn1.js/lib/asn1.js\"(exports) {\n var asn1 = exports;\n asn1.bignum = require_bn5(), asn1.define = require_api().define, asn1.base = require_base2(), asn1.constants = require_constants(), asn1.decoders = require_decoders(), asn1.encoders = require_encoders();\n }\n}), require_certificate = __commonJS({\n \"node_modules/parse-asn1/certificate.js\"(exports, module) {\n var asn = require_asn1(), Time = asn.define(\"Time\", function() {\n this.choice({\n utcTime: this.utctime(),\n generalTime: this.gentime()\n });\n }), AttributeTypeValue = asn.define(\"AttributeTypeValue\", function() {\n this.seq().obj(this.key(\"type\").objid(), this.key(\"value\").any());\n }), AlgorithmIdentifier = asn.define(\"AlgorithmIdentifier\", function() {\n this.seq().obj(this.key(\"algorithm\").objid(), this.key(\"parameters\").optional(), this.key(\"curve\").objid().optional());\n }), SubjectPublicKeyInfo = asn.define(\"SubjectPublicKeyInfo\", function() {\n this.seq().obj(this.key(\"algorithm\").use(AlgorithmIdentifier), this.key(\"subjectPublicKey\").bitstr());\n }), RelativeDistinguishedName = asn.define(\"RelativeDistinguishedName\", function() {\n this.setof(AttributeTypeValue);\n }), RDNSequence = asn.define(\"RDNSequence\", function() {\n this.seqof(RelativeDistinguishedName);\n }), Name = asn.define(\"Name\", function() {\n this.choice({\n rdnSequence: this.use(RDNSequence)\n });\n }), Validity = asn.define(\"Validity\", function() {\n this.seq().obj(this.key(\"notBefore\").use(Time), this.key(\"notAfter\").use(Time));\n }), Extension = asn.define(\"Extension\", function() {\n this.seq().obj(this.key(\"extnID\").objid(), this.key(\"critical\").bool().def(!1), this.key(\"extnValue\").octstr());\n }), TBSCertificate = asn.define(\"TBSCertificate\", function() {\n this.seq().obj(this.key(\"version\").explicit(0).int().optional(), this.key(\"serialNumber\").int(), this.key(\"signature\").use(AlgorithmIdentifier), this.key(\"issuer\").use(Name), this.key(\"validity\").use(Validity), this.key(\"subject\").use(Name), this.key(\"subjectPublicKeyInfo\").use(SubjectPublicKeyInfo), this.key(\"issuerUniqueID\").implicit(1).bitstr().optional(), this.key(\"subjectUniqueID\").implicit(2).bitstr().optional(), this.key(\"extensions\").explicit(3).seqof(Extension).optional());\n }), X509Certificate = asn.define(\"X509Certificate\", function() {\n this.seq().obj(this.key(\"tbsCertificate\").use(TBSCertificate), this.key(\"signatureAlgorithm\").use(AlgorithmIdentifier), this.key(\"signatureValue\").bitstr());\n });\n module.exports = X509Certificate;\n }\n}), require_asn12 = __commonJS({\n \"node_modules/parse-asn1/asn1.js\"(exports) {\n var asn1 = require_asn1();\n exports.certificate = require_certificate();\n var RSAPrivateKey = asn1.define(\"RSAPrivateKey\", function() {\n this.seq().obj(this.key(\"version\").int(), this.key(\"modulus\").int(), this.key(\"publicExponent\").int(), this.key(\"privateExponent\").int(), this.key(\"prime1\").int(), this.key(\"prime2\").int(), this.key(\"exponent1\").int(), this.key(\"exponent2\").int(), this.key(\"coefficient\").int());\n });\n exports.RSAPrivateKey = RSAPrivateKey;\n var RSAPublicKey = asn1.define(\"RSAPublicKey\", function() {\n this.seq().obj(this.key(\"modulus\").int(), this.key(\"publicExponent\").int());\n });\n exports.RSAPublicKey = RSAPublicKey;\n var PublicKey = asn1.define(\"SubjectPublicKeyInfo\", function() {\n this.seq().obj(this.key(\"algorithm\").use(AlgorithmIdentifier), this.key(\"subjectPublicKey\").bitstr());\n });\n exports.PublicKey = PublicKey;\n var AlgorithmIdentifier = asn1.define(\"AlgorithmIdentifier\", function() {\n this.seq().obj(this.key(\"algorithm\").objid(), this.key(\"none\").null_().optional(), this.key(\"curve\").objid().optional(), this.key(\"params\").seq().obj(this.key(\"p\").int(), this.key(\"q\").int(), this.key(\"g\").int()).optional());\n }), PrivateKeyInfo = asn1.define(\"PrivateKeyInfo\", function() {\n this.seq().obj(this.key(\"version\").int(), this.key(\"algorithm\").use(AlgorithmIdentifier), this.key(\"subjectPrivateKey\").octstr());\n });\n exports.PrivateKey = PrivateKeyInfo;\n var EncryptedPrivateKeyInfo = asn1.define(\"EncryptedPrivateKeyInfo\", function() {\n this.seq().obj(this.key(\"algorithm\").seq().obj(this.key(\"id\").objid(), this.key(\"decrypt\").seq().obj(this.key(\"kde\").seq().obj(this.key(\"id\").objid(), this.key(\"kdeparams\").seq().obj(this.key(\"salt\").octstr(), this.key(\"iters\").int())), this.key(\"cipher\").seq().obj(this.key(\"algo\").objid(), this.key(\"iv\").octstr()))), this.key(\"subjectPrivateKey\").octstr());\n });\n exports.EncryptedPrivateKey = EncryptedPrivateKeyInfo;\n var DSAPrivateKey = asn1.define(\"DSAPrivateKey\", function() {\n this.seq().obj(this.key(\"version\").int(), this.key(\"p\").int(), this.key(\"q\").int(), this.key(\"g\").int(), this.key(\"pub_key\").int(), this.key(\"priv_key\").int());\n });\n exports.DSAPrivateKey = DSAPrivateKey, exports.DSAparam = asn1.define(\"DSAparam\", function() {\n this.int();\n });\n var ECPrivateKey = asn1.define(\"ECPrivateKey\", function() {\n this.seq().obj(this.key(\"version\").int(), this.key(\"privateKey\").octstr(), this.key(\"parameters\").optional().explicit(0).use(ECParameters), this.key(\"publicKey\").optional().explicit(1).bitstr());\n });\n exports.ECPrivateKey = ECPrivateKey;\n var ECParameters = asn1.define(\"ECParameters\", function() {\n this.choice({\n namedCurve: this.objid()\n });\n });\n exports.signature = asn1.define(\"signature\", function() {\n this.seq().obj(this.key(\"r\").int(), this.key(\"s\").int());\n });\n }\n}), require_aesid = __commonJS({\n \"node_modules/parse-asn1/aesid.json\"(exports, module) {\n module.exports = {\n \"2.16.840.1.101.3.4.1.1\": \"aes-128-ecb\",\n \"2.16.840.1.101.3.4.1.2\": \"aes-128-cbc\",\n \"2.16.840.1.101.3.4.1.3\": \"aes-128-ofb\",\n \"2.16.840.1.101.3.4.1.4\": \"aes-128-cfb\",\n \"2.16.840.1.101.3.4.1.21\": \"aes-192-ecb\",\n \"2.16.840.1.101.3.4.1.22\": \"aes-192-cbc\",\n \"2.16.840.1.101.3.4.1.23\": \"aes-192-ofb\",\n \"2.16.840.1.101.3.4.1.24\": \"aes-192-cfb\",\n \"2.16.840.1.101.3.4.1.41\": \"aes-256-ecb\",\n \"2.16.840.1.101.3.4.1.42\": \"aes-256-cbc\",\n \"2.16.840.1.101.3.4.1.43\": \"aes-256-ofb\",\n \"2.16.840.1.101.3.4.1.44\": \"aes-256-cfb\"\n };\n }\n}), require_fixProc = __commonJS({\n \"node_modules/parse-asn1/fixProc.js\"(exports, module) {\n var findProc = /Proc-Type: 4,ENCRYPTED[\\n\\r]+DEK-Info: AES-((\?:128)|(\?:192)|(\?:256))-CBC,([0-9A-H]+)[\\n\\r]+([0-9A-z\\n\\r+/=]+)[\\n\\r]+/m, startRegex = /^-----BEGIN ((\?:.*\? KEY)|CERTIFICATE)-----/m, fullRegex = /^-----BEGIN ((\?:.*\? KEY)|CERTIFICATE)-----([0-9A-z\\n\\r+/=]+)-----END \\1-----$/m, evp = require_evp_bytestokey(), ciphers = require_browser5(), Buffer2 = require_safe_buffer().Buffer;\n module.exports = function(okey, password) {\n var key2 = okey.toString(), match = key2.match(findProc), decrypted;\n if (match) {\n var suite = \"aes\" + match[1], iv = Buffer2.from(match[2], \"hex\"), cipherText = Buffer2.from(match[3].replace(/[\\r\\n]/g, \"\"), \"base64\"), cipherKey = evp(password, iv.slice(0, 8), parseInt(match[1], 10)).key, out = [], cipher = ciphers.createDecipheriv(suite, cipherKey, iv);\n out.push(cipher.update(cipherText)), out.push(cipher.final()), decrypted = Buffer2.concat(out);\n } else {\n var match2 = key2.match(fullRegex);\n decrypted = Buffer2.from(match2[2].replace(/[\\r\\n]/g, \"\"), \"base64\");\n }\n var tag = key2.match(startRegex)[1];\n return {\n tag,\n data: decrypted\n };\n };\n }\n}), require_parse_asn1 = __commonJS({\n \"node_modules/parse-asn1/index.js\"(exports, module) {\n var asn1 = require_asn12(), aesid = require_aesid(), fixProc = require_fixProc(), ciphers = require_browser5(), compat = require_browser4(), Buffer2 = require_safe_buffer().Buffer;\n module.exports = parseKeys;\n function parseKeys(buffer) {\n var password;\n if (buffer instanceof KeyObject)\n buffer = buffer.export();\n else if (buffer instanceof CryptoKey)\n buffer = KeyObject.from(buffer).export();\n else if (typeof buffer == \"object\" && !Buffer2.isBuffer(buffer)) {\n if (password = buffer.passphrase, buffer = buffer.key, buffer instanceof KeyObject) {\n var options;\n switch (buffer.type) {\n case \"secret\":\n options = {\n format: \"buffer\"\n };\n break;\n case \"public\":\n options = {\n format: \"pem\",\n type: \"spki\",\n passphrase: password\n };\n break;\n case \"private\":\n options = {\n format: \"pem\",\n type: \"pkcs8\",\n passphrase: password\n };\n break;\n }\n buffer = buffer.export(options);\n } else if (buffer instanceof CryptoKey) {\n var options;\n switch (buffer.type) {\n case \"secret\":\n options = {\n format: \"buffer\"\n };\n break;\n case \"public\":\n options = {\n format: \"pem\",\n type: \"spki\",\n passphrase: password\n };\n break;\n case \"private\":\n options = {\n format: \"pem\",\n type: \"pkcs8\",\n passphrase: password\n };\n break;\n }\n buffer = KeyObject.from(buffer).export(options);\n }\n }\n typeof buffer == \"string\" && (buffer = Buffer2.from(buffer));\n var stripped = fixProc(buffer, password), type = stripped.tag, data = stripped.data, subtype, ndata;\n switch (type) {\n case \"CERTIFICATE\":\n ndata = asn1.certificate.decode(data, \"der\").tbsCertificate.subjectPublicKeyInfo;\n case \"PUBLIC KEY\":\n switch (ndata || (ndata = asn1.PublicKey.decode(data, \"der\")), subtype = ndata.algorithm.algorithm.join(\".\"), subtype) {\n case \"1.2.840.113549.1.1.1\":\n return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, \"der\");\n case \"1.2.840.10045.2.1\":\n return ndata.subjectPrivateKey = ndata.subjectPublicKey, {\n type: \"ec\",\n data: ndata\n };\n case \"1.2.840.10040.4.1\":\n return ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, \"der\"), {\n type: \"dsa\",\n data: ndata.algorithm.params\n };\n default:\n throw new Error(\"unknown key id \" + subtype);\n }\n case \"ENCRYPTED PRIVATE KEY\":\n data = asn1.EncryptedPrivateKey.decode(data, \"der\"), data = decrypt(data, password);\n case \"PRIVATE KEY\":\n switch (ndata = asn1.PrivateKey.decode(data, \"der\"), subtype = ndata.algorithm.algorithm.join(\".\"), subtype) {\n case \"1.2.840.113549.1.1.1\":\n return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, \"der\");\n case \"1.2.840.10045.2.1\":\n return {\n curve: ndata.algorithm.curve,\n privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, \"der\").privateKey\n };\n case \"1.2.840.10040.4.1\":\n return ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, \"der\"), {\n type: \"dsa\",\n params: ndata.algorithm.params\n };\n default:\n throw new Error(\"unknown key id \" + subtype);\n }\n case \"RSA PUBLIC KEY\":\n return asn1.RSAPublicKey.decode(data, \"der\");\n case \"RSA PRIVATE KEY\":\n return asn1.RSAPrivateKey.decode(data, \"der\");\n case \"DSA PRIVATE KEY\":\n return {\n type: \"dsa\",\n params: asn1.DSAPrivateKey.decode(data, \"der\")\n };\n case \"EC PRIVATE KEY\":\n return data = asn1.ECPrivateKey.decode(data, \"der\"), {\n curve: data.parameters.value,\n privateKey: data.privateKey\n };\n default:\n throw new Error(\"unknown key type \" + type);\n }\n }\n parseKeys.signature = asn1.signature;\n function decrypt(data, password) {\n var salt = data.algorithm.decrypt.kde.kdeparams.salt, iters = parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(), 10), algo = aesid[data.algorithm.decrypt.cipher.algo.join(\".\")], iv = data.algorithm.decrypt.cipher.iv, cipherText = data.subjectPrivateKey, keylen = parseInt(algo.split(\"-\")[1], 10) / 8, key2 = compat.pbkdf2Sync(password, salt, iters, keylen, \"sha1\"), cipher = ciphers.createDecipheriv(algo, key2, iv), out = [];\n return out.push(cipher.update(cipherText)), out.push(cipher.final()), Buffer2.concat(out);\n }\n }\n}), require_curves2 = __commonJS({\n \"node_modules/browserify-sign/browser/curves.json\"(exports, module) {\n module.exports = {\n \"1.3.132.0.10\": \"secp256k1\",\n \"1.3.132.0.33\": \"p224\",\n \"1.2.840.10045.3.1.1\": \"p192\",\n \"1.2.840.10045.3.1.7\": \"p256\",\n \"1.3.132.0.34\": \"p384\",\n \"1.3.132.0.35\": \"p521\"\n };\n }\n}), require_sign = __commonJS({\n \"node_modules/browserify-sign/browser/sign.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer, createHmac = require_browser3(), crt = require_browserify_rsa(), EC = require_elliptic().ec, BN = require_bn3(), parseKeys = require_parse_asn1(), curves = require_curves2();\n function sign(hash, key2, hashType, signType, tag) {\n var priv = parseKeys(getKeyFrom(key2, \"private\"));\n if (priv.curve) {\n if (signType !== \"ecdsa\" && signType !== \"ecdsa/rsa\")\n throw new Error(\"wrong private key type\");\n return ecSign(hash, priv);\n } else if (priv.type === \"dsa\") {\n if (signType !== \"dsa\")\n throw new Error(\"wrong private key type\");\n return dsaSign(hash, priv, hashType);\n } else if (signType !== \"rsa\" && signType !== \"ecdsa/rsa\")\n throw new Error(\"wrong private key type\");\n hash = Buffer2.concat([tag, hash]);\n for (var len = priv.modulus.byteLength(), pad = [0, 1];hash.length + pad.length + 1 < len; )\n pad.push(255);\n pad.push(0);\n for (var i = -1;++i < hash.length; )\n pad.push(hash[i]);\n var out = crt(pad, priv);\n return out;\n }\n function ecSign(hash, priv) {\n var curveId = curves[priv.curve.join(\".\")];\n if (!curveId)\n throw new Error(\"unknown curve \" + priv.curve.join(\".\"));\n var curve = new EC(curveId), key2 = curve.keyFromPrivate(priv.privateKey), out = key2.sign(hash);\n return Buffer2.from(out.toDER());\n }\n function dsaSign(hash, priv, algo) {\n for (var x = priv.params.priv_key, p = priv.params.p, q = priv.params.q, g = priv.params.g, r = new BN(0), k, H = bits2int(hash, q).mod(q), s = !1, kv = getKey(x, q, hash, algo);s === !1; )\n k = makeKey(q, kv, algo), r = makeR(g, k, p, q), s = k.invm(q).imul(H.add(x.mul(r))).mod(q), s.cmpn(0) === 0 && (s = !1, r = new BN(0));\n return toDER(r, s);\n }\n function toDER(r, s) {\n r = r.toArray(), s = s.toArray(), r[0] & 128 && (r = [0].concat(r)), s[0] & 128 && (s = [0].concat(s));\n var total = r.length + s.length + 4, res = [48, total, 2, r.length];\n return res = res.concat(r, [2, s.length], s), Buffer2.from(res);\n }\n function getKey(x, q, hash, algo) {\n if (x = Buffer2.from(x.toArray()), x.length < q.byteLength()) {\n var zeros = Buffer2.alloc(q.byteLength() - x.length);\n x = Buffer2.concat([zeros, x]);\n }\n var hlen = hash.length, hbits = bits2octets(hash, q), v = Buffer2.alloc(hlen);\n v.fill(1);\n var k = Buffer2.alloc(hlen);\n return k = createHmac(algo, k).update(v).update(Buffer2.from([0])).update(x).update(hbits).digest(), v = createHmac(algo, k).update(v).digest(), k = createHmac(algo, k).update(v).update(Buffer2.from([1])).update(x).update(hbits).digest(), v = createHmac(algo, k).update(v).digest(), { k, v };\n }\n function bits2int(obits, q) {\n var bits = new BN(obits), shift = (obits.length << 3) - q.bitLength();\n return shift > 0 && bits.ishrn(shift), bits;\n }\n function bits2octets(bits, q) {\n bits = bits2int(bits, q), bits = bits.mod(q);\n var out = Buffer2.from(bits.toArray());\n if (out.length < q.byteLength()) {\n var zeros = Buffer2.alloc(q.byteLength() - out.length);\n out = Buffer2.concat([zeros, out]);\n }\n return out;\n }\n function makeKey(q, kv, algo) {\n var t, k;\n do {\n for (t = Buffer2.alloc(0);t.length * 8 < q.bitLength(); )\n kv.v = createHmac(algo, kv.k).update(kv.v).digest(), t = Buffer2.concat([t, kv.v]);\n k = bits2int(t, q), kv.k = createHmac(algo, kv.k).update(kv.v).update(Buffer2.from([0])).digest(), kv.v = createHmac(algo, kv.k).update(kv.v).digest();\n } while (k.cmp(q) !== -1);\n return k;\n }\n function makeR(g, k, p, q) {\n return g.toRed(BN.mont(p)).redPow(k).fromRed().mod(q);\n }\n module.exports = sign, module.exports.getKey = getKey, module.exports.makeKey = makeKey;\n }\n}), require_verify = __commonJS({\n \"node_modules/browserify-sign/browser/verify.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer, BN = require_bn3(), EC = require_elliptic().ec, parseKeys = require_parse_asn1(), curves = require_curves2();\n function verify(sig, hash, key2, signType, tag) {\n var pub = parseKeys(getKeyFrom(key2, \"public\"));\n if (pub.type === \"ec\") {\n if (signType !== \"ecdsa\" && signType !== \"ecdsa/rsa\")\n throw new Error(\"wrong public key type\");\n return ecVerify(sig, hash, pub);\n } else if (pub.type === \"dsa\") {\n if (signType !== \"dsa\")\n throw new Error(\"wrong public key type\");\n return dsaVerify(sig, hash, pub);\n } else if (signType !== \"rsa\" && signType !== \"ecdsa/rsa\")\n throw new Error(\"wrong public key type\");\n hash = Buffer2.concat([tag, hash]);\n for (var len = pub.modulus.byteLength(), pad = [1], padNum = 0;hash.length + pad.length + 2 < len; )\n pad.push(255), padNum++;\n pad.push(0);\n for (var i = -1;++i < hash.length; )\n pad.push(hash[i]);\n pad = Buffer2.from(pad);\n var red = BN.mont(pub.modulus);\n sig = new BN(sig).toRed(red), sig = sig.redPow(new BN(pub.publicExponent)), sig = Buffer2.from(sig.fromRed().toArray());\n var out = padNum < 8 \? 1 : 0;\n for (len = Math.min(sig.length, pad.length), sig.length !== pad.length && (out = 1), i = -1;++i < len; )\n out |= sig[i] ^ pad[i];\n return out === 0;\n }\n function ecVerify(sig, hash, pub) {\n var curveId = curves[pub.data.algorithm.curve.join(\".\")];\n if (!curveId)\n throw new Error(\"unknown curve \" + pub.data.algorithm.curve.join(\".\"));\n var curve = new EC(curveId), pubkey = pub.data.subjectPrivateKey.data;\n return curve.verify(hash, sig, pubkey);\n }\n function dsaVerify(sig, hash, pub) {\n var p = pub.data.p, q = pub.data.q, g = pub.data.g, y = pub.data.pub_key, unpacked = parseKeys.signature.decode(sig, \"der\"), s = unpacked.s, r = unpacked.r;\n checkValue(s, q), checkValue(r, q);\n var montp = BN.mont(p), w = s.invm(q), v = g.toRed(montp).redPow(new BN(hash).mul(w).mod(q)).fromRed().mul(y.toRed(montp).redPow(r.mul(w).mod(q)).fromRed()).mod(p).mod(q);\n return v.cmp(r) === 0;\n }\n function checkValue(b, q) {\n if (b.cmpn(0) <= 0)\n throw new Error(\"invalid sig\");\n if (b.cmp(q) >= q)\n throw new Error(\"invalid sig\");\n }\n module.exports = verify;\n }\n}), require_browser8 = __commonJS({\n \"node_modules/browserify-sign/browser/index.js\"(exports, module) {\n var Buffer2 = require_safe_buffer().Buffer, createHash = require_browser2(), inherits = require_inherits_browser(), sign = require_sign(), verify = require_verify(), algorithms = require_algorithms();\n Object.keys(algorithms).forEach(function(key2) {\n algorithms[key2].id = Buffer2.from(algorithms[key2].id, \"hex\"), algorithms[key2.toLowerCase()] = algorithms[key2];\n });\n function Sign(algorithm) {\n if (typeof algorithm === \"string\")\n algorithm = algorithm.toLowerCase();\n StreamModule.Writable.@call(this);\n var data = algorithms[algorithm];\n if (!data)\n throw new Error(\"Unknown message digest\");\n this._hashType = data.hash, this._hash = createHash(data.hash), this._tag = data.id, this._signType = data.sign;\n }\n inherits(Sign, StreamModule.Writable), Sign.prototype._write = function(data, _, done) {\n this._hash.update(data), done();\n }, Sign.prototype.update = function(data, enc) {\n return typeof data == \"string\" && (data = Buffer2.from(data, enc)), this._hash.update(data), this;\n }, Sign.prototype.sign = function(key2, enc) {\n this.end();\n var hash = this._hash.digest(), sig = sign(hash, key2, this._hashType, this._signType, this._tag);\n return enc \? sig.toString(enc) : sig;\n };\n function Verify(algorithm) {\n if (StreamModule.Writable.@call(this), typeof algorithm === \"string\")\n algorithm = algorithm.toLowerCase();\n var data = algorithms[algorithm];\n if (!data)\n throw new Error(\"Unknown message digest\");\n this._hash = createHash(data.hash), this._tag = data.id, this._signType = data.sign;\n }\n inherits(Verify, StreamModule.Writable), Verify.prototype._write = function(data, _, done) {\n this._hash.update(data), done();\n }, Verify.prototype.update = function(data, enc) {\n return typeof data == \"string\" && (data = Buffer2.from(data, enc)), this._hash.update(data), this;\n }, Verify.prototype.verify = function(key2, sig, enc) {\n typeof sig == \"string\" && (sig = Buffer2.from(sig, enc)), this.end();\n var hash = this._hash.digest();\n return verify(sig, hash, key2, this._signType, this._tag);\n };\n function createSign(algorithm) {\n return new Sign(algorithm);\n }\n function createVerify(algorithm) {\n return new Verify(algorithm);\n }\n module.exports = {\n Sign: createSign,\n Verify: createVerify,\n createSign,\n createVerify\n };\n }\n}), require_bn6 = require_bn, require_browser9 = __commonJS({\n \"node_modules/create-ecdh/browser.js\"(exports, module) {\n var elliptic = require_elliptic(), BN = require_bn6();\n module.exports = function(curve) {\n return new ECDH(curve);\n };\n var aliases = {\n secp256k1: {\n name: \"secp256k1\",\n byteLength: 32\n },\n secp224r1: {\n name: \"p224\",\n byteLength: 28\n },\n prime256v1: {\n name: \"p256\",\n byteLength: 32\n },\n prime192v1: {\n name: \"p192\",\n byteLength: 24\n },\n ed25519: {\n name: \"ed25519\",\n byteLength: 32\n },\n secp384r1: {\n name: \"p384\",\n byteLength: 48\n },\n secp521r1: {\n name: \"p521\",\n byteLength: 66\n }\n };\n aliases.p224 = aliases.secp224r1, aliases.p256 = aliases.secp256r1 = aliases.prime256v1, aliases.p192 = aliases.secp192r1 = aliases.prime192v1, aliases.p384 = aliases.secp384r1, aliases.p521 = aliases.secp521r1;\n function ECDH(curve) {\n this.curveType = aliases[curve], this.curveType || (this.curveType = {\n name: curve\n }), this.curve = new elliptic.ec(this.curveType.name), this.keys = void 0;\n }\n ECDH.prototype = {}, ECDH.prototype.generateKeys = function(enc, format) {\n return this.keys = this.curve.genKeyPair(), this.getPublicKey(enc, format);\n }, ECDH.prototype.computeSecret = function(other, inenc, enc) {\n inenc = inenc || \"utf8\", Buffer.isBuffer(other) || (other = new Buffer(other, inenc));\n var otherPub = this.curve.keyFromPublic(other).getPublic(), out = otherPub.mul(this.keys.getPrivate()).getX();\n return formatReturnValue(out, enc, this.curveType.byteLength);\n }, ECDH.prototype.getPublicKey = function(enc, format) {\n var key2 = this.keys.getPublic(format === \"compressed\", !0);\n return format === \"hybrid\" && (key2[key2.length - 1] % 2 \? key2[0] = 7 : key2[0] = 6), formatReturnValue(key2, enc);\n }, ECDH.prototype.getPrivateKey = function(enc) {\n return formatReturnValue(this.keys.getPrivate(), enc);\n }, ECDH.prototype.setPublicKey = function(pub, enc) {\n return enc = enc || \"utf8\", Buffer.isBuffer(pub) || (pub = new Buffer(pub, enc)), this.keys._importPublic(pub), this;\n }, ECDH.prototype.setPrivateKey = function(priv, enc) {\n enc = enc || \"utf8\", Buffer.isBuffer(priv) || (priv = new Buffer(priv, enc));\n var _priv = new BN(priv);\n return _priv = _priv.toString(16), this.keys = this.curve.genKeyPair(), this.keys._importPrivate(_priv), this;\n };\n function formatReturnValue(bn, enc, len) {\n @Array.isArray(bn) || (bn = bn.toArray());\n var buf = new Buffer(bn);\n if (len && buf.length < len) {\n var zeros = new Buffer(len - buf.length);\n zeros.fill(0), buf = Buffer.concat([zeros, buf]);\n }\n return enc \? buf.toString(enc) : buf;\n }\n }\n}), require_mgf = __commonJS({\n \"node_modules/public-encrypt/mgf.js\"(exports, module) {\n var createHash = require_browser2(), Buffer2 = require_safe_buffer().Buffer;\n module.exports = function(seed, len) {\n for (var t = Buffer2.alloc(0), i = 0, c;t.length < len; )\n c = i2ops(i++), t = Buffer2.concat([t, createHash(\"sha1\").update(seed).update(c).digest()]);\n return t.slice(0, len);\n };\n function i2ops(c) {\n var out = Buffer2.allocUnsafe(4);\n return out.writeUInt32BE(c, 0), out;\n }\n }\n}), require_xor = __commonJS({\n \"node_modules/public-encrypt/xor.js\"(exports, module) {\n module.exports = function(a, b) {\n for (var len = a.length, i = -1;++i < len; )\n a[i] ^= b[i];\n return a;\n };\n }\n}), require_bn7 = require_bn, { CryptoHasher } = globalThis.Bun, require_withPublic = __commonJS({\n \"node_modules/public-encrypt/withPublic.js\"(exports, module) {\n var BN = require_bn7(), Buffer2 = require_safe_buffer().Buffer;\n function withPublic(paddedMsg, key2) {\n return Buffer2.from(paddedMsg.toRed(BN.mont(key2.modulus)).redPow(new BN(key2.publicExponent)).fromRed().toArray());\n }\n module.exports = withPublic;\n }\n}), require_publicEncrypt = __commonJS({\n \"node_modules/public-encrypt/publicEncrypt.js\"(exports, module) {\n var parseKeys = require_parse_asn1(), randomBytes = require_browser(), createHash = require_browser2(), mgf = require_mgf(), xor = require_xor(), BN = require_bn7(), withPublic = require_withPublic(), crt = require_browserify_rsa(), Buffer2 = require_safe_buffer().Buffer;\n module.exports = function(publicKey, msg, reverse) {\n var padding;\n publicKey.padding \? padding = publicKey.padding : reverse \? padding = 1 : padding = 4;\n var key2 = parseKeys(publicKey), paddedMsg;\n if (padding === 4)\n paddedMsg = oaep(key2, msg);\n else if (padding === 1)\n paddedMsg = pkcs1(key2, msg, reverse);\n else if (padding === 3) {\n if (paddedMsg = new BN(msg), paddedMsg.cmp(key2.modulus) >= 0)\n throw new Error(\"data too long for modulus\");\n } else\n throw new Error(\"unknown padding\");\n return reverse \? crt(paddedMsg, key2) : withPublic(paddedMsg, key2);\n };\n function oaep(key2, msg) {\n var k = key2.modulus.byteLength(), mLen = msg.length, iHash = createHash(\"sha1\").update(Buffer2.alloc(0)).digest(), hLen = iHash.length, hLen2 = 2 * hLen;\n if (mLen > k - hLen2 - 2)\n throw new Error(\"message too long\");\n var ps = Buffer2.alloc(k - mLen - hLen2 - 2), dblen = k - hLen - 1, seed = randomBytes(hLen), maskedDb = xor(Buffer2.concat([iHash, ps, Buffer2.alloc(1, 1), msg], dblen), mgf(seed, dblen)), maskedSeed = xor(seed, mgf(maskedDb, hLen));\n return new BN(Buffer2.concat([Buffer2.alloc(1), maskedSeed, maskedDb], k));\n }\n function pkcs1(key2, msg, reverse) {\n var mLen = msg.length, k = key2.modulus.byteLength();\n if (mLen > k - 11)\n throw new Error(\"message too long\");\n var ps;\n return reverse \? ps = Buffer2.alloc(k - mLen - 3, 255) : ps = nonZero(k - mLen - 3), new BN(Buffer2.concat([Buffer2.from([0, reverse \? 1 : 2]), ps, Buffer2.alloc(1), msg], k));\n }\n function nonZero(len) {\n for (var out = Buffer2.allocUnsafe(len), i = 0, cache = randomBytes(len * 2), cur = 0, num;i < len; )\n cur === cache.length && (cache = randomBytes(len * 2), cur = 0), num = cache[cur++], num && (out[i++] = num);\n return out;\n }\n }\n}), require_privateDecrypt = __commonJS({\n \"node_modules/public-encrypt/privateDecrypt.js\"(exports, module) {\n var parseKeys = require_parse_asn1(), mgf = require_mgf(), xor = require_xor(), BN = require_bn7(), crt = require_browserify_rsa(), createHash = require_browser2(), withPublic = require_withPublic(), Buffer2 = require_safe_buffer().Buffer;\n module.exports = function(privateKey, enc, reverse) {\n var padding;\n privateKey.padding \? padding = privateKey.padding : reverse \? padding = 1 : padding = 4;\n var key2 = parseKeys(privateKey), k = key2.modulus.byteLength();\n if (enc.length > k || new BN(enc).cmp(key2.modulus) >= 0)\n throw new Error(\"decryption error\");\n var msg;\n reverse \? msg = withPublic(new BN(enc), key2) : msg = crt(enc, key2);\n var zBuffer = Buffer2.alloc(k - msg.length);\n if (msg = Buffer2.concat([zBuffer, msg], k), padding === 4)\n return oaep(key2, msg);\n if (padding === 1)\n return pkcs1(key2, msg, reverse);\n if (padding === 3)\n return msg;\n throw new Error(\"unknown padding\");\n };\n function oaep(key2, msg) {\n var k = key2.modulus.byteLength(), iHash = createHash(\"sha1\").update(Buffer2.alloc(0)).digest(), hLen = iHash.length;\n if (msg[0] !== 0)\n throw new Error(\"decryption error\");\n var maskedSeed = msg.slice(1, hLen + 1), maskedDb = msg.slice(hLen + 1), seed = xor(maskedSeed, mgf(maskedDb, hLen)), db = xor(maskedDb, mgf(seed, k - hLen - 1));\n if (compare(iHash, db.slice(0, hLen)))\n throw new Error(\"decryption error\");\n for (var i = hLen;db[i] === 0; )\n i++;\n if (db[i++] !== 1)\n throw new Error(\"decryption error\");\n return db.slice(i);\n }\n function pkcs1(key2, msg, reverse) {\n for (var p1 = msg.slice(0, 2), i = 2, status = 0;msg[i++] !== 0; )\n if (i >= msg.length) {\n status++;\n break;\n }\n var ps = msg.slice(2, i - 1);\n if ((p1.toString(\"hex\") !== \"0002\" && !reverse || p1.toString(\"hex\") !== \"0001\" && reverse) && status++, ps.length < 8 && status++, status)\n throw new Error(\"decryption error\");\n return msg.slice(i);\n }\n function compare(a, b) {\n a = Buffer2.from(a), b = Buffer2.from(b);\n var dif = 0, len = a.length;\n a.length !== b.length && (dif++, len = Math.min(a.length, b.length));\n for (var i = -1;++i < len; )\n dif += a[i] ^ b[i];\n return dif;\n }\n }\n}), require_browser10 = __commonJS({\n \"node_modules/public-encrypt/browser.js\"(exports) {\n var publicEncrypt = require_publicEncrypt();\n exports.publicEncrypt = function(key2, buf, options) {\n return publicEncrypt(getKeyFrom(key2, \"public\"), buf, options);\n };\n var privateDecrypt = require_privateDecrypt();\n exports.privateDecrypt = function(key2, buf, options) {\n return privateDecrypt(getKeyFrom(key2, \"private\"), buf, options);\n }, exports.privateEncrypt = function(key2, buf) {\n return publicEncrypt(getKeyFrom(key2, \"private\"), buf, !0);\n }, exports.publicDecrypt = function(key2, buf) {\n return privateDecrypt(getKeyFrom(key2, \"public\"), buf, !0);\n };\n }\n}), require_browser11 = __commonJS({\n \"node_modules/randomfill/browser.js\"(exports) {\n var safeBuffer = require_safe_buffer(), randombytes = require_browser(), Buffer2 = safeBuffer.Buffer, kBufferMaxLength = safeBuffer.kMaxLength, kMaxUint32 = Math.pow(2, 32) - 1;\n function assertOffset(offset, length) {\n if (typeof offset != \"number\" || offset !== offset)\n @throwTypeError(\"offset must be a number\");\n if (offset > kMaxUint32 || offset < 0)\n @throwTypeError(\"offset must be a uint32\");\n if (offset > kBufferMaxLength || offset > length)\n @throwRangeError(\"offset out of range\");\n }\n function assertSize(size, offset, length) {\n if (typeof size != \"number\" || size !== size)\n @throwTypeError(\"size must be a number\");\n if (size > kMaxUint32 || size < 0)\n @throwTypeError(\"size must be a uint32\");\n if (size + offset > length || size > kBufferMaxLength)\n @throwRangeError(\"buffer too small\");\n }\n exports.randomFill = randomFill, exports.randomFillSync = randomFillSync;\n function randomFill(buf, offset, size, cb) {\n if (!Buffer2.isBuffer(buf) && !(buf instanceof global.Uint8Array))\n @throwTypeError('\"buf\" argument must be a Buffer or Uint8Array');\n if (typeof offset == \"function\")\n cb = offset, offset = 0, size = buf.length;\n else if (typeof size == \"function\")\n cb = size, size = buf.length - offset;\n else if (typeof cb != \"function\")\n @throwTypeError('\"cb\" argument must be a function');\n return assertOffset(offset, buf.length), assertSize(size, offset, buf.length), actualFill(buf, offset, size, cb);\n }\n function actualFill(buf, offset, size, cb) {\n if (cb) {\n randombytes(size, function(err, bytes2) {\n if (err)\n return cb(err);\n bytes2.copy(buf, offset), cb(null, buf);\n });\n return;\n }\n var bytes = randombytes(size);\n return bytes.copy(buf, offset), buf;\n }\n function randomFillSync(buf, offset, size) {\n if (typeof offset > \"u\" && (offset = 0), !Buffer2.isBuffer(buf) && !(buf instanceof global.Uint8Array))\n @throwTypeError('\"buf\" argument must be a Buffer or Uint8Array');\n return assertOffset(offset, buf.length), size === void 0 && (size = buf.length - offset), assertSize(size, offset, buf.length), actualFill(buf, offset, size);\n }\n }\n}), require_crypto_browserify2 = __commonJS({\n \"node_modules/crypto-browserify/index.js\"(exports) {\n exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = require_browser(), exports.createHash = require_browser2(), exports.Hash = exports.createHash.Hash, exports.createHmac = exports.Hmac = require_browser3();\n var algos = require_algos(), algoKeys = Object.keys(algos), hashes = [\"sha1\", \"sha224\", \"sha256\", \"sha384\", \"sha512\", \"md5\", \"rmd160\"].concat(algoKeys);\n exports.getHashes = function() {\n return hashes;\n };\n var p = require_browser4();\n exports.pbkdf2 = p.pbkdf2, exports.pbkdf2Sync = p.pbkdf2Sync;\n var aes = require_browser6();\n exports.Cipher = aes.Cipher, exports.createCipher = aes.createCipher, exports.Cipheriv = aes.Cipheriv, exports.createCipheriv = aes.createCipheriv, exports.Decipher = aes.Decipher, exports.createDecipher = aes.createDecipher, exports.Decipheriv = aes.Decipheriv, exports.createDecipheriv = aes.createDecipheriv, exports.getCiphers = aes.getCiphers, exports.listCiphers = aes.listCiphers;\n var dh = require_browser7();\n exports.DiffieHellmanGroup = dh.DiffieHellmanGroup, exports.createDiffieHellmanGroup = dh.createDiffieHellmanGroup, exports.getDiffieHellman = dh.getDiffieHellman, exports.createDiffieHellman = dh.createDiffieHellman, exports.DiffieHellman = dh.DiffieHellman;\n var sign = require_browser8();\n exports.createSign = sign.createSign, exports.Sign = sign.Sign, exports.createVerify = sign.createVerify, exports.Verify = sign.Verify, exports.createECDH = require_browser9();\n var publicEncrypt = require_browser10();\n exports.publicEncrypt = publicEncrypt.publicEncrypt, exports.privateEncrypt = publicEncrypt.privateEncrypt, exports.publicDecrypt = publicEncrypt.publicDecrypt, exports.privateDecrypt = publicEncrypt.privateDecrypt, exports.getRandomValues = (values) => crypto.getRandomValues(values);\n var rf = require_browser11();\n exports.randomFill = rf.randomFill, exports.randomFillSync = rf.randomFillSync, exports.createCredentials = function() {\n throw new Error([\n \"sorry, createCredentials is not implemented yet\",\n \"we accept pull requests\",\n \"https://github.com/crypto-browserify/crypto-browserify\"\n ].join(`\n`));\n }, exports.constants = @processBindingConstants.crypto;\n }\n}), crypto_exports = require_crypto_browserify2(), DEFAULT_ENCODING = \"buffer\", getRandomValues = (array) => crypto.getRandomValues(array), randomUUID = () => crypto.randomUUID(), randomInt = (...args) => crypto.randomInt(...args), timingSafeEqual = \"timingSafeEqual\" in crypto \? (a, b) => {\n let { byteLength: byteLengthA } = a, { byteLength: byteLengthB } = b;\n if (typeof byteLengthA != \"number\" || typeof byteLengthB != \"number\")\n @throwTypeError(\"Input must be an array buffer view\");\n if (byteLengthA !== byteLengthB)\n @throwRangeError(\"Input buffers must have the same length\");\n return crypto.timingSafeEqual(a, b);\n} : void 0, scryptSync = \"scryptSync\" in crypto \? (password, salt, keylen, options) => {\n let res = crypto.scryptSync(password, salt, keylen, options);\n return DEFAULT_ENCODING !== \"buffer\" \? new Buffer(res).toString(DEFAULT_ENCODING) : new Buffer(res);\n} : void 0, scrypt = \"scryptSync\" in crypto \? function(password, salt, keylen, options, callback) {\n if (typeof options == \"function\" && (callback = options, options = void 0), typeof callback != \"function\") {\n var err = @makeTypeError(\"callback must be a function\");\n throw err.code = \"ERR_INVALID_CALLBACK\", err;\n }\n try {\n let result = crypto.scryptSync(password, salt, keylen, options);\n process.nextTick(callback, null, DEFAULT_ENCODING !== \"buffer\" \? new Buffer(result).toString(DEFAULT_ENCODING) : new Buffer(result));\n } catch (err2) {\n throw err2;\n }\n} : void 0;\ntimingSafeEqual && (Object.defineProperty(timingSafeEqual, \"name\", {\n value: \"::bunternal::\"\n}), Object.defineProperty(scrypt, \"name\", {\n value: \"::bunternal::\"\n}), Object.defineProperty(scryptSync, \"name\", {\n value: \"::bunternal::\"\n}));\nvar harcoded_curves = [\n \"p192\",\n \"p224\",\n \"p256\",\n \"p384\",\n \"p521\",\n \"curve25519\",\n \"ed25519\",\n \"secp256k1\",\n \"secp224r1\",\n \"prime256v1\",\n \"prime192v1\",\n \"ed25519\",\n \"secp384r1\",\n \"secp521r1\"\n], {\n symmetricKeySize,\n asymmetricKeyDetails,\n asymmetricKeyType,\n equals,\n exports,\n createSecretKey,\n createPublicKey,\n createPrivateKey,\n generateKeySync,\n generateKeyPairSync\n} = @lazy(\"internal/crypto\"), kCryptoKey = Symbol.for(\"::bunKeyObjectCryptoKey::\");\n\nclass KeyObject {\n [kCryptoKey];\n constructor(key2) {\n if (typeof key2 !== \"object\")\n @throwTypeError('The \"key\" argument must be an instance of CryptoKey.');\n this[kCryptoKey] = key2;\n }\n toString() {\n return \"[object KeyObject]\";\n }\n static from(key2) {\n if (key2 instanceof KeyObject)\n key2 = key2[kCryptoKey];\n return new KeyObject(key2);\n }\n get asymmetricKeyDetails() {\n return asymmetricKeyDetails(this[kCryptoKey]);\n }\n get symmetricKeySize() {\n return symmetricKeySize(this[kCryptoKey]);\n }\n get asymmetricKeyType() {\n return asymmetricKeyType(this[kCryptoKey]);\n }\n [\"export\"](options) {\n switch (arguments.length) {\n case 0:\n switch (this.type) {\n case \"secret\":\n options = {\n format: \"buffer\"\n };\n break;\n case \"public\":\n options = {\n format: \"pem\",\n type: \"spki\"\n };\n break;\n case \"private\":\n options = {\n format: \"pem\",\n type: \"pkcs8\"\n };\n break;\n }\n break;\n case 1:\n if (typeof options === \"object\" && !options.format)\n switch (this.type) {\n case \"secret\":\n options.format = \"buffer\";\n break;\n default:\n options.format = \"pem\";\n break;\n }\n }\n return exports(this[kCryptoKey], options);\n }\n equals(otherKey) {\n if (!(otherKey instanceof KeyObject))\n @throwTypeError(\"otherKey must be a KeyObject\");\n return equals(this[kCryptoKey], otherKey[kCryptoKey]);\n }\n get type() {\n return this[kCryptoKey].type;\n }\n}\ncrypto_exports.generateKeySync = function(algorithm, options) {\n return KeyObject.from(generateKeySync(algorithm, options\?.length));\n};\ncrypto_exports.generateKey = function(algorithm, options, callback) {\n try {\n const key2 = KeyObject.from(generateKeySync(algorithm, options\?.length));\n typeof callback === \"function\" && callback(null, KeyObject.from(key2));\n } catch (err) {\n typeof callback === \"function\" && callback(err);\n }\n};\ncrypto_exports.generateKeyPairSync = _generateKeyPairSync;\ncrypto_exports.generateKeyPair = function(algorithm, options, callback) {\n try {\n const result = _generateKeyPairSync(algorithm, options);\n typeof callback === \"function\" && callback(null, result.publicKey, result.privateKey);\n } catch (err) {\n typeof callback === \"function\" && callback(err);\n }\n};\ncrypto_exports.createSecretKey = function(key2, encoding) {\n if (key2 instanceof KeyObject || key2 instanceof CryptoKey) {\n if (key2.type !== \"secret\") {\n const error = @makeTypeError(`ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE: Invalid key object type ${key2.type}, expected secret`);\n throw error.code = \"ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE\", error;\n }\n return KeyObject.from(key2);\n }\n const buffer = getArrayBufferOrView(key2, encoding || \"utf8\");\n return KeyObject.from(createSecretKey(buffer));\n};\ncrypto_exports.createPrivateKey = _createPrivateKey;\ncrypto_exports.createPublicKey = _createPublicKey;\ncrypto_exports.KeyObject = KeyObject;\nvar _createSign = crypto_exports.createSign;\ncrypto_exports.sign = function(algorithm, data, key2, encoding, callback) {\n if (typeof callback === \"function\")\n try {\n const result = _createSign(algorithm).update(data, encoding).sign(key2, encoding);\n callback(null, result);\n } catch (err) {\n callback(err);\n }\n else\n return _createSign(algorithm).update(data, encoding).sign(key2, encoding);\n};\nvar _createVerify = crypto_exports.createVerify;\ncrypto_exports.verify = function(algorithm, data, key2, signature, callback) {\n if (typeof callback === \"function\")\n try {\n const result = _createVerify(algorithm).update(data).verify(key2, signature);\n callback(null, result);\n } catch (err) {\n callback(err);\n }\n else\n return _createVerify(algorithm).update(data).verify(key2, signature);\n};\nvar webcrypto = crypto;\n__export(crypto_exports, {\n DEFAULT_ENCODING: () => DEFAULT_ENCODING,\n getRandomValues: () => getRandomValues,\n randomUUID: () => randomUUID,\n randomInt: () => randomInt,\n getCurves: () => getCurves,\n scrypt: () => scrypt,\n scryptSync: () => scryptSync,\n timingSafeEqual: () => timingSafeEqual,\n webcrypto: () => webcrypto,\n subtle: () => webcrypto.subtle\n});\n$ = crypto_exports;\n/*! safe-buffer. MIT License. Feross Aboukhadijeh */\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeDgramCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/dgram.ts\nvar createSocket = function() {\n throwNotImplemented(\"node:dgram createSocket\", 1630);\n}, Socket = function() {\n throwNotImplemented(\"node:dgram Socket\", 1630);\n}, _createSocketHandle = function() {\n throwNotImplemented(\"node:dgram _createSocketHandle\", 1630);\n}, $, { hideFromStack, throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6);\n$ = {\n createSocket,\n Socket,\n _createSocketHandle\n};\nhideFromStack(createSocket, Socket, _createSocketHandle);\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeDiagnosticsChannelCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/diagnostics_channel.ts\nvar markActive = function(channel) {\n ObjectSetPrototypeOf(channel, ActiveChannel.prototype), channel._subscribers = [], channel._stores = new SafeMap;\n}, maybeMarkInactive = function(channel) {\n if (!channel._subscribers.length && !channel._stores.size)\n ObjectSetPrototypeOf(channel, Channel.prototype), channel._subscribers = @undefined, channel._stores = @undefined;\n}, defaultTransform = function(data) {\n return data;\n}, wrapStoreRun = function(store, data, next, transform = defaultTransform) {\n return () => {\n let context;\n try {\n context = transform(data);\n } catch (err) {\n return process.nextTick(() => reportError(err)), next();\n }\n return store.run(context, next);\n };\n}, channel = function(name) {\n const channel2 = channels.get(name);\n if (channel2)\n return channel2;\n if (typeof name !== \"string\" && typeof name !== \"symbol\")\n throw new ERR_INVALID_ARG_TYPE(\"channel\", [\"string\", \"symbol\"], name);\n return new Channel(name);\n}, subscribe = function(name, subscription) {\n return channel(name).subscribe(subscription);\n}, unsubscribe = function(name, subscription) {\n return channel(name).unsubscribe(subscription);\n}, hasSubscribers = function(name) {\n const channel2 = channels.get(name);\n if (!channel2)\n return !1;\n return channel2.hasSubscribers;\n}, assertChannel = function(value, name) {\n if (!(value instanceof Channel))\n throw new ERR_INVALID_ARG_TYPE(name, [\"Channel\"], value);\n}, tracingChannel = function(nameOrChannels) {\n return new TracingChannel(nameOrChannels);\n}, validateFunction = function(callable, field) {\n if (typeof callable !== \"function\")\n throw new ERR_INVALID_ARG_TYPE(field, \"Function\", callable);\n return callable;\n}, $, SafeMap = Map, SafeFinalizationRegistry = FinalizationRegistry, ArrayPrototypeAt = (array, index) => array[index], ArrayPrototypeIndexOf = (array, value) => array.indexOf(value), ArrayPrototypePush = (array, value) => array.push(value), ArrayPrototypeSplice = (array, start, deleteCount) => array.splice(start, deleteCount), ObjectGetPrototypeOf = Object.getPrototypeOf, ObjectSetPrototypeOf = Object.setPrototypeOf, SymbolHasInstance = Symbol.hasInstance, ReflectApply = @getByIdDirect(Reflect, \"apply\"), PromiseResolve = @Promise.resolve, PromiseReject = @Promise.reject, PromisePrototypeThen = (promise, onFulfilled, onRejected) => promise.then(onFulfilled, onRejected);\n\nclass WeakReference extends WeakRef {\n constructor() {\n super(...arguments);\n }\n #refs = 0;\n get() {\n return this.deref();\n }\n incRef() {\n return ++this.#refs;\n }\n decRef() {\n return --this.#refs;\n }\n}\n\nclass WeakRefMap extends SafeMap {\n constructor() {\n super(...arguments);\n }\n #finalizers = new SafeFinalizationRegistry((key) => {\n this.delete(key);\n });\n set(key, value) {\n return this.#finalizers.register(value, key), super.set(key, new WeakReference(value));\n }\n get(key) {\n return super.get(key)\?.get();\n }\n incRef(key) {\n return super.get(key)\?.incRef();\n }\n decRef(key) {\n return super.get(key)\?.decRef();\n }\n}\n\nclass ActiveChannel {\n subscribe(subscription) {\n validateFunction(subscription, \"subscription\"), ArrayPrototypePush(this._subscribers, subscription), channels.incRef(this.name);\n }\n unsubscribe(subscription) {\n const index = ArrayPrototypeIndexOf(this._subscribers, subscription);\n if (index === -1)\n return !1;\n return ArrayPrototypeSplice(this._subscribers, index, 1), channels.decRef(this.name), maybeMarkInactive(this), !0;\n }\n bindStore(store, transform) {\n if (!this._stores.has(store))\n channels.incRef(this.name);\n this._stores.set(store, transform);\n }\n unbindStore(store) {\n if (!this._stores.has(store))\n return !1;\n return this._stores.delete(store), channels.decRef(this.name), maybeMarkInactive(this), !0;\n }\n get hasSubscribers() {\n return !0;\n }\n publish(data) {\n for (let i = 0;i < (this._subscribers\?.length || 0); i++)\n try {\n const onMessage = this._subscribers[i];\n onMessage(data, this.name);\n } catch (err) {\n process.nextTick(() => reportError(err));\n }\n }\n runStores(data, fn, thisArg, ...args) {\n let run = () => {\n return this.publish(data), ReflectApply(fn, thisArg, args);\n };\n for (let entry of this._stores.entries()) {\n const store = entry[0], transform = entry[1];\n run = wrapStoreRun(store, data, run, transform);\n }\n return run();\n }\n}\n\nclass Channel {\n constructor(name) {\n this._subscribers = @undefined, this._stores = @undefined, this.name = name, channels.set(name, this);\n }\n static [SymbolHasInstance](instance) {\n const prototype = ObjectGetPrototypeOf(instance);\n return prototype === Channel.prototype || prototype === ActiveChannel.prototype;\n }\n subscribe(subscription) {\n markActive(this), this.subscribe(subscription);\n }\n unsubscribe() {\n return !1;\n }\n bindStore(store, transform) {\n markActive(this), this.bindStore(store, transform);\n }\n unbindStore() {\n return !1;\n }\n get hasSubscribers() {\n return !1;\n }\n publish() {\n }\n runStores(data, fn, thisArg, ...args) {\n return ReflectApply(fn, thisArg, args);\n }\n}\nvar channels = new WeakRefMap, traceEvents = [\"start\", \"end\", \"asyncStart\", \"asyncEnd\", \"error\"];\n\nclass TracingChannel {\n constructor(nameOrChannels) {\n if (typeof nameOrChannels === \"string\")\n this.start = channel(`tracing:${nameOrChannels}:start`), this.end = channel(`tracing:${nameOrChannels}:end`), this.asyncStart = channel(`tracing:${nameOrChannels}:asyncStart`), this.asyncEnd = channel(`tracing:${nameOrChannels}:asyncEnd`), this.error = channel(`tracing:${nameOrChannels}:error`);\n else if (typeof nameOrChannels === \"object\") {\n const { start, end, asyncStart, asyncEnd, error } = nameOrChannels;\n assertChannel(start, \"nameOrChannels.start\"), assertChannel(end, \"nameOrChannels.end\"), assertChannel(asyncStart, \"nameOrChannels.asyncStart\"), assertChannel(asyncEnd, \"nameOrChannels.asyncEnd\"), assertChannel(error, \"nameOrChannels.error\"), this.start = start, this.end = end, this.asyncStart = asyncStart, this.asyncEnd = asyncEnd, this.error = error;\n } else\n throw new ERR_INVALID_ARG_TYPE(\"nameOrChannels\", [\"string\", \"object\", \"Channel\"], nameOrChannels);\n }\n subscribe(handlers) {\n for (let name of traceEvents) {\n if (!handlers[name])\n continue;\n this[name]\?.subscribe(handlers[name]);\n }\n }\n unsubscribe(handlers) {\n let done = !0;\n for (let name of traceEvents) {\n if (!handlers[name])\n continue;\n if (!this[name]\?.unsubscribe(handlers[name]))\n done = !1;\n }\n return done;\n }\n traceSync(fn, context = {}, thisArg, ...args) {\n const { start, end, error } = this;\n return start.runStores(context, () => {\n try {\n const result = ReflectApply(fn, thisArg, args);\n return context.result = result, result;\n } catch (err) {\n throw context.error = err, error.publish(context), err;\n } finally {\n end.publish(context);\n }\n });\n }\n tracePromise(fn, context = {}, thisArg, ...args) {\n const { start, end, asyncStart, asyncEnd, error } = this;\n function reject(err) {\n return context.error = err, error.publish(context), asyncStart.publish(context), asyncEnd.publish(context), PromiseReject(err);\n }\n function resolve(result) {\n return context.result = result, asyncStart.publish(context), asyncEnd.publish(context), result;\n }\n return start.runStores(context, () => {\n try {\n let promise = ReflectApply(fn, thisArg, args);\n if (!(promise instanceof @Promise))\n promise = PromiseResolve(promise);\n return PromisePrototypeThen(promise, resolve, reject);\n } catch (err) {\n throw context.error = err, error.publish(context), err;\n } finally {\n end.publish(context);\n }\n });\n }\n traceCallback(fn, position = -1, context = {}, thisArg, ...args) {\n const { start, end, asyncStart, asyncEnd, error } = this;\n function wrappedCallback(err, res) {\n if (err)\n context.error = err, error.publish(context);\n else\n context.result = res;\n asyncStart.runStores(context, () => {\n try {\n if (callback)\n return ReflectApply(callback, this, arguments);\n } finally {\n asyncEnd.publish(context);\n }\n });\n }\n const callback = ArrayPrototypeAt(args, position);\n if (typeof callback !== \"function\")\n throw new ERR_INVALID_ARG_TYPE(\"callback\", [\"function\"], callback);\n return ArrayPrototypeSplice(args, position, 1, wrappedCallback), start.runStores(context, () => {\n try {\n return ReflectApply(fn, thisArg, args);\n } catch (err) {\n throw context.error = err, error.publish(context), err;\n } finally {\n end.publish(context);\n }\n });\n }\n}\n\nclass ERR_INVALID_ARG_TYPE extends TypeError {\n constructor(name, expected, actual) {\n super(`The ${name} argument must be of type ${expected}. Received type ${typeof actual}`);\n this.code = \"ERR_INVALID_ARG_TYPE\";\n }\n}\n$ = {\n channel,\n hasSubscribers,\n subscribe,\n tracingChannel,\n unsubscribe,\n Channel\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeDNSCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/dns.ts\nvar getServers = function() {\n return dns.getServers();\n}, lookup = function(domain, options, callback) {\n if (typeof options == \"function\")\n callback = options;\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n if (typeof options == \"number\")\n options = { family: options };\n if (domain !== domain || typeof domain !== \"number\" && !domain) {\n console.warn(`DeprecationWarning: The provided hostname \"${@String(domain)}\" is not a valid hostname, and is supported in the dns module solely for compatibility.`), callback(null, null, 4);\n return;\n }\n dns.lookup(domain, options).then((res) => {\n if (res.sort((a, b) => a.family - b.family), options\?.all)\n callback(null, res.map(mapLookupAll));\n else {\n const [{ address, family }] = res;\n callback(null, address, family);\n }\n }, (error) => {\n callback(error);\n });\n}, resolveSrv = function(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveSrv(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, resolveTxt = function(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveTxt(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, resolveSoa = function(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveSoa(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, resolveNaptr = function(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveNaptr(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, resolveMx = function(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveMx(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, resolveCaa = function(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveCaa(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, resolveNs = function(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveNs(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, resolvePtr = function(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolvePtr(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, resolveCname = function(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveCname(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, lookupService = function(address, port, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.lookupService(address, port, callback).then((results) => {\n callback(null, ...results);\n }, (error) => {\n callback(error);\n });\n}, reverse = function(ip, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.reverse(ip, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n}, resolve = function(hostname, rrtype, callback) {\n if (typeof rrtype == \"function\")\n callback = rrtype;\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolve(hostname).then((results) => {\n switch (rrtype\?.toLowerCase()) {\n case \"a\":\n case \"aaaa\":\n callback(null, hostname, results.map(({ address }) => address));\n break;\n default:\n callback(null, results);\n break;\n }\n }, (error) => {\n callback(error);\n });\n}, Resolver = function(options) {\n return new InternalResolver(options);\n}, setDefaultResultOrder = function() {\n}, setServers = function() {\n}, $, dns = Bun.dns, InternalResolver = class Resolver2 {\n constructor(options) {\n }\n cancel() {\n }\n getServers() {\n return [];\n }\n resolve(hostname, rrtype, callback) {\n if (typeof rrtype == \"function\")\n callback = rrtype, rrtype = null;\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolve(hostname).then((results) => {\n switch (rrtype\?.toLowerCase()) {\n case \"a\":\n case \"aaaa\":\n callback(null, hostname, results.map(mapResolveX));\n break;\n default:\n callback(null, results);\n break;\n }\n }, (error) => {\n callback(error);\n });\n }\n resolve4(hostname, options, callback) {\n if (typeof options == \"function\")\n callback = options, options = null;\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.lookup(hostname, { family: 4 }).then((addresses) => {\n callback(null, options\?.ttl \? addresses : addresses.map(mapResolveX));\n }, (error) => {\n callback(error);\n });\n }\n resolve6(hostname, options, callback) {\n if (typeof options == \"function\")\n callback = options, options = null;\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.lookup(hostname, { family: 6 }).then((addresses) => {\n callback(null, options\?.ttl \? addresses : addresses.map(({ address }) => address));\n }, (error) => {\n callback(error);\n });\n }\n resolveAny(hostname, callback) {\n callback(null, []);\n }\n resolveCname(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveCname(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n resolveMx(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveMx(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n resolveNaptr(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveNaptr(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n resolveNs(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveNs(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n resolvePtr(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolvePtr(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n resolveSrv(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveSrv(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n resolveCaa(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveCaa(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n resolveTxt(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveTxt(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n resolveSoa(hostname, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.resolveSoa(hostname, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n reverse(ip, callback) {\n if (typeof callback != \"function\")\n @throwTypeError(\"callback must be a function\");\n dns.reverse(ip, callback).then((results) => {\n callback(null, results);\n }, (error) => {\n callback(error);\n });\n }\n setServers(servers) {\n }\n};\nResolver.prototype = {};\nObject.setPrototypeOf(Resolver.prototype, InternalResolver.prototype);\nObject.setPrototypeOf(Resolver, InternalResolver);\nvar {\n resolve,\n resolve4,\n resolve6,\n resolveAny,\n resolveCname,\n resolveCaa,\n resolveMx,\n resolveNaptr,\n resolveNs,\n resolvePtr,\n resolveSoa,\n resolveSrv,\n reverse,\n resolveTxt\n} = InternalResolver.prototype, promisifyLookup = (res) => {\n res.sort((a, b) => a.family - b.family);\n const [{ address, family }] = res;\n return { address, family };\n}, mapLookupAll = (res) => {\n const { address, family } = res;\n return { address, family };\n}, promisifyLookupAll = (res) => {\n return res.sort((a, b) => a.family - b.family), res.map(mapLookupAll);\n}, mapResolveX = (a) => a.address, promisifyResolveX = (res) => {\n return res\?.map(mapResolveX);\n}, promises = {\n lookup(domain, options) {\n if (options\?.all)\n return dns.lookup(domain, options).then(promisifyLookupAll);\n return dns.lookup(domain, options).then(promisifyLookup);\n },\n lookupService(address, port) {\n return dns.lookupService(address, port);\n },\n resolve(hostname, rrtype) {\n if (typeof rrtype !== \"string\")\n rrtype = null;\n switch (rrtype\?.toLowerCase()) {\n case \"a\":\n case \"aaaa\":\n return dns.resolve(hostname, rrtype).then(promisifyLookup);\n default:\n return dns.resolve(hostname, rrtype);\n }\n },\n resolve4(hostname, options) {\n if (options\?.ttl)\n return dns.lookup(hostname, { family: 4 });\n return dns.lookup(hostname, { family: 4 }).then(promisifyResolveX);\n },\n resolve6(hostname, options) {\n if (options\?.ttl)\n return dns.lookup(hostname, { family: 6 });\n return dns.lookup(hostname, { family: 6 }).then(promisifyResolveX);\n },\n resolveSrv(hostname) {\n return dns.resolveSrv(hostname);\n },\n resolveTxt(hostname) {\n return dns.resolveTxt(hostname);\n },\n resolveSoa(hostname) {\n return dns.resolveSoa(hostname);\n },\n resolveNaptr(hostname) {\n return dns.resolveNaptr(hostname);\n },\n resolveMx(hostname) {\n return dns.resolveMx(hostname);\n },\n resolveCaa(hostname) {\n return dns.resolveCaa(hostname);\n },\n resolveNs(hostname) {\n return dns.resolveNs(hostname);\n },\n resolvePtr(hostname) {\n return dns.resolvePtr(hostname);\n },\n resolveCname(hostname) {\n return dns.resolveCname(hostname);\n },\n reverse(ip) {\n return dns.reverse(ip);\n },\n Resolver: class Resolver3 {\n constructor(options) {\n }\n cancel() {\n }\n getServers() {\n return [];\n }\n resolve(hostname, rrtype) {\n if (typeof rrtype !== \"string\")\n rrtype = null;\n switch (rrtype\?.toLowerCase()) {\n case \"a\":\n case \"aaaa\":\n return dns.resolve(hostname, rrtype).then(promisifyLookup);\n default:\n return dns.resolve(hostname, rrtype);\n }\n }\n resolve4(hostname, options) {\n if (options\?.ttl)\n return dns.lookup(hostname, { family: 4 });\n return dns.lookup(hostname, { family: 4 }).then(promisifyResolveX);\n }\n resolve6(hostname, options) {\n if (options\?.ttl)\n return dns.lookup(hostname, { family: 6 });\n return dns.lookup(hostname, { family: 6 }).then(promisifyResolveX);\n }\n resolveAny(hostname) {\n return @Promise.resolve([]);\n }\n resolveCname(hostname) {\n return dns.resolveCname(hostname);\n }\n resolveMx(hostname) {\n return dns.resolveMx(hostname);\n }\n resolveNaptr(hostname) {\n return dns.resolveNaptr(hostname);\n }\n resolveNs(hostname) {\n return dns.resolveNs(hostname);\n }\n resolvePtr(hostname) {\n return dns.resolvePtr(hostname);\n }\n resolveSoa(hostname) {\n return dns.resolveSoa(hostname);\n }\n resolveSrv(hostname) {\n return dns.resolveSrv(hostname);\n }\n resolveCaa(hostname) {\n return dns.resolveCaa(hostname);\n }\n resolveTxt(hostname) {\n return dns.resolveTxt(hostname);\n }\n reverse(ip) {\n return dns.reverse(ip);\n }\n setServers(servers) {\n }\n }\n};\nfor (let key of [\"resolveAny\"])\n promises[key] = () => @Promise.resolve(@undefined);\n$ = {\n ADDRCONFIG: 0,\n ALL: 1,\n V4MAPPED: 2,\n NODATA: \"DNS_ENODATA\",\n FORMERR: \"DNS_EFORMERR\",\n SERVFAIL: \"DNS_ESERVFAIL\",\n NOTFOUND: \"DNS_ENOTFOUND\",\n NOTIMP: \"DNS_ENOTIMP\",\n REFUSED: \"DNS_EREFUSED\",\n BADQUERY: \"DNS_EBADQUERY\",\n BADNAME: \"DNS_EBADNAME\",\n BADFAMILY: \"DNS_EBADFAMILY\",\n BADRESP: \"DNS_EBADRESP\",\n CONNREFUSED: \"DNS_ECONNREFUSED\",\n TIMEOUT: \"DNS_ETIMEOUT\",\n EOF: \"DNS_EEOF\",\n FILE: \"DNS_EFILE\",\n NOMEM: \"DNS_ENOMEM\",\n DESTRUCTION: \"DNS_EDESTRUCTION\",\n BADSTR: \"DNS_EBADSTR\",\n BADFLAGS: \"DNS_EBADFLAGS\",\n NONAME: \"DNS_ENONAME\",\n BADHINTS: \"DNS_EBADHINTS\",\n NOTINITIALIZED: \"DNS_ENOTINITIALIZED\",\n LOADIPHLPAPI: \"DNS_ELOADIPHLPAPI\",\n ADDRGETNETWORKPARAMS: \"DNS_EADDRGETNETWORKPARAMS\",\n CANCELLED: \"DNS_ECANCELLED\",\n lookup,\n lookupService,\n Resolver,\n setServers,\n setDefaultResultOrder,\n resolve,\n reverse,\n resolve4,\n resolve6,\n resolveAny,\n resolveCname,\n resolveCaa,\n resolveMx,\n resolveNs,\n resolvePtr,\n resolveSoa,\n resolveSrv,\n resolveTxt,\n resolveNaptr,\n promises,\n getServers\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeDNSPromisesCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/dns.promises.ts\nreturn (@getInternalField(@internalModuleRegistry, 17) || @createInternalModuleById(17)).promises})\n"); -// - -// -static constexpr ASCIILiteral NodeDomainCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/domain.ts\nvar EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20), domain = {};\ndomain.createDomain = domain.create = function() {\n var d = new EventEmitter;\n function emitError(e) {\n d.emit(\"error\", e);\n }\n return d.add = function(emitter) {\n emitter.on(\"error\", emitError);\n }, d.remove = function(emitter) {\n emitter.removeListener(\"error\", emitError);\n }, d.bind = function(fn) {\n return function() {\n var args = @Array.prototype.slice.@call(arguments);\n try {\n fn.@apply(null, args);\n } catch (err) {\n emitError(err);\n }\n };\n }, d.intercept = function(fn) {\n return function(err) {\n if (err)\n emitError(err);\n else {\n var args = @Array.prototype.slice.@call(arguments, 1);\n try {\n fn.@apply(null, args);\n } catch (err2) {\n emitError(err2);\n }\n }\n };\n }, d.run = function(fn) {\n try {\n fn();\n } catch (err) {\n emitError(err);\n }\n return this;\n }, d.dispose = function() {\n return this.removeAllListeners(), this;\n }, d.enter = d.exit = function() {\n return this;\n }, d;\n};\nreturn domain})\n"); -// - -// -static constexpr ASCIILiteral NodeEventsCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/events.ts\nvar emitError = function(emitter, args) {\n var { _events: events } = emitter;\n if (args[0] \?\?= new Error(\"Unhandled error.\"), !events)\n throw args[0];\n var errorMonitor = events[kErrorMonitor];\n if (errorMonitor)\n for (var handler of ArrayPrototypeSlice.@call(errorMonitor))\n handler.@apply(emitter, args);\n var handlers = events.error;\n if (!handlers)\n throw args[0];\n for (var handler of ArrayPrototypeSlice.@call(handlers))\n handler.@apply(emitter, args);\n return !0;\n}, addCatch = function(emitter, promise, type, args) {\n promise.then(@undefined, function(err) {\n process.nextTick(emitUnhandledRejectionOrErr, emitter, err, type, args);\n });\n}, emitUnhandledRejectionOrErr = function(emitter, err, type, args) {\n if (typeof emitter[kRejection] === \"function\")\n emitter[kRejection](err, type, ...args);\n else\n try {\n emitter[kCapture] = !1, emitter.emit(\"error\", err);\n } finally {\n emitter[kCapture] = !0;\n }\n}, overflowWarning = function(emitter, type, handlers) {\n handlers.warned = !0;\n const warn = new Error(`Possible EventEmitter memory leak detected. ${handlers.length} ${@String(type)} listeners ` + `added to [${emitter.constructor.name}]. Use emitter.setMaxListeners() to increase limit`);\n warn.name = \"MaxListenersExceededWarning\", warn.emitter = emitter, warn.type = type, warn.count = handlers.length, process.emitWarning(warn);\n}, onceWrapper = function(type, listener, ...args) {\n this.removeListener(type, listener), listener.@apply(this, args);\n}, once = function(emitter, type, options) {\n var signal = options\?.signal;\n if (validateAbortSignal(signal, \"options.signal\"), signal\?.aborted)\n throw new AbortError(@undefined, { cause: signal\?.reason });\n return new @Promise((resolve, reject) => {\n const errorListener = (err) => {\n if (emitter.removeListener(type, resolver), signal != null)\n eventTargetAgnosticRemoveListener(signal, \"abort\", abortListener);\n reject(err);\n }, resolver = (...args) => {\n if (typeof emitter.removeListener === \"function\")\n emitter.removeListener(\"error\", errorListener);\n if (signal != null)\n eventTargetAgnosticRemoveListener(signal, \"abort\", abortListener);\n resolve(args);\n };\n if (eventTargetAgnosticAddListener(emitter, type, resolver, { once: !0 }), type !== \"error\" && typeof emitter.once === \"function\")\n emitter.once(\"error\", errorListener);\n function abortListener() {\n eventTargetAgnosticRemoveListener(emitter, type, resolver), eventTargetAgnosticRemoveListener(emitter, \"error\", errorListener), reject(new AbortError(@undefined, { cause: signal\?.reason }));\n }\n if (signal != null)\n eventTargetAgnosticAddListener(signal, \"abort\", abortListener, { once: !0 });\n });\n}, on = function(emitter, type, options) {\n var { signal, close, highWatermark = Number.MAX_SAFE_INTEGER, lowWatermark = 1 } = options || {};\n throwNotImplemented(\"events.on\", 2679);\n}, getEventListeners = function(emitter, type) {\n if (emitter instanceof EventTarget)\n throwNotImplemented(\"getEventListeners with an EventTarget\", 2678);\n return emitter.listeners(type);\n}, setMaxListeners = function(n, ...eventTargets) {\n validateNumber(n, \"setMaxListeners\", 0);\n var length;\n if (eventTargets && (length = eventTargets.length))\n for (let i = 0;i < length; i++)\n eventTargets[i].setMaxListeners(n);\n else\n defaultMaxListeners = n;\n}, listenerCount = function(emitter, type) {\n return emitter.listenerCount(type);\n}, eventTargetAgnosticRemoveListener = function(emitter, name, listener, flags) {\n if (typeof emitter.removeListener === \"function\")\n emitter.removeListener(name, listener);\n else\n emitter.removeEventListener(name, listener, flags);\n}, eventTargetAgnosticAddListener = function(emitter, name, listener, flags) {\n if (typeof emitter.on === \"function\")\n if (flags.once)\n emitter.once(name, listener);\n else\n emitter.on(name, listener);\n else\n emitter.addEventListener(name, listener, flags);\n}, ERR_INVALID_ARG_TYPE = function(name, type, value) {\n const err = @makeTypeError(`The \"${name}\" argument must be of type ${type}. Received ${value}`);\n return err.code = \"ERR_INVALID_ARG_TYPE\", err;\n}, ERR_OUT_OF_RANGE = function(name, range, value) {\n const err = new RangeError(`The \"${name}\" argument is out of range. It must be ${range}. Received ${value}`);\n return err.code = \"ERR_OUT_OF_RANGE\", err;\n}, validateAbortSignal = function(signal, name) {\n if (signal !== @undefined && (signal === null || typeof signal !== \"object\" || !(\"aborted\" in signal)))\n throw new ERR_INVALID_ARG_TYPE(name, \"AbortSignal\", signal);\n}, validateNumber = function(value, name, min = @undefined, max) {\n if (typeof value !== \"number\")\n throw new ERR_INVALID_ARG_TYPE(name, \"number\", value);\n if (min != null && value < min || max != null && value > max || (min != null || max != null) && Number.isNaN(value))\n throw new ERR_OUT_OF_RANGE(name, `${min != null \? `>= ${min}` : \"\"}${min != null && max != null \? \" && \" : \"\"}${max != null \? `<= ${max}` : \"\"}`, value);\n}, checkListener = function(listener) {\n if (typeof listener !== \"function\")\n @throwTypeError(\"The listener must be a function\");\n}, { throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6), SymbolFor = Symbol.for, kCapture = Symbol(\"kCapture\"), kErrorMonitor = SymbolFor(\"events.errorMonitor\"), kMaxEventTargetListeners = Symbol(\"events.maxEventTargetListeners\"), kMaxEventTargetListenersWarned = Symbol(\"events.maxEventTargetListenersWarned\"), kWatermarkData = SymbolFor(\"nodejs.watermarkData\"), kRejection = SymbolFor(\"nodejs.rejection\"), captureRejectionSymbol = SymbolFor(\"nodejs.rejection\"), ArrayPrototypeSlice = @Array.prototype.slice, defaultMaxListeners = 10, EventEmitter = function EventEmitter2(opts) {\n if (this._events === @undefined || this._events === this.__proto__._events)\n this._events = { __proto__: null }, this._eventsCount = 0;\n if (this._maxListeners \?\?= @undefined, this[kCapture] = opts\?.captureRejections \? Boolean(opts\?.captureRejections) : EventEmitterPrototype[kCapture])\n this.emit = emitWithRejectionCapture;\n}, EventEmitterPrototype = EventEmitter.prototype = {};\nEventEmitterPrototype._events = @undefined;\nEventEmitterPrototype._eventsCount = 0;\nEventEmitterPrototype._maxListeners = @undefined;\nEventEmitterPrototype.setMaxListeners = function setMaxListeners2(n) {\n return validateNumber(n, \"setMaxListeners\", 0), this._maxListeners = n, this;\n};\nEventEmitterPrototype.constructor = EventEmitter;\nEventEmitterPrototype.getMaxListeners = function getMaxListeners() {\n return this._maxListeners \?\? defaultMaxListeners;\n};\nvar emitWithoutRejectionCapture = function emit(type, ...args) {\n if (type === \"error\")\n return emitError(this, args);\n var { _events: events } = this;\n if (events === @undefined)\n return !1;\n var handlers = events[type];\n if (handlers === @undefined)\n return !1;\n const maybeClonedHandlers = handlers.length > 1 \? handlers.slice() : handlers;\n for (let i = 0, { length } = maybeClonedHandlers;i < length; i++) {\n const handler = maybeClonedHandlers[i];\n switch (args.length) {\n case 0:\n handler.@call(this);\n break;\n case 1:\n handler.@call(this, args[0]);\n break;\n case 2:\n handler.@call(this, args[0], args[1]);\n break;\n case 3:\n handler.@call(this, args[0], args[1], args[2]);\n break;\n default:\n handler.@apply(this, args);\n break;\n }\n }\n return !0;\n}, emitWithRejectionCapture = function emit2(type, ...args) {\n if (type === \"error\")\n return emitError(this, args);\n var { _events: events } = this;\n if (events === @undefined)\n return !1;\n var handlers = events[type];\n if (handlers === @undefined)\n return !1;\n const maybeClonedHandlers = handlers.length > 1 \? handlers.slice() : handlers;\n for (let i = 0, { length } = maybeClonedHandlers;i < length; i++) {\n const handler = maybeClonedHandlers[i];\n let result;\n switch (args.length) {\n case 0:\n result = handler.@call(this);\n break;\n case 1:\n result = handler.@call(this, args[0]);\n break;\n case 2:\n result = handler.@call(this, args[0], args[1]);\n break;\n case 3:\n result = handler.@call(this, args[0], args[1], args[2]);\n break;\n default:\n result = handler.@apply(this, args);\n break;\n }\n if (result !== @undefined && @isPromise(result))\n addCatch(this, result, type, args);\n }\n return !0;\n};\nEventEmitterPrototype.emit = emitWithoutRejectionCapture;\nEventEmitterPrototype.addListener = function addListener(type, fn) {\n checkListener(fn);\n var events = this._events;\n if (!events)\n events = this._events = { __proto__: null }, this._eventsCount = 0;\n else if (events.newListener)\n this.emit(\"newListener\", type, fn.listener \?\? fn);\n var handlers = events[type];\n if (!handlers)\n events[type] = [fn], this._eventsCount++;\n else {\n handlers.push(fn);\n var m = this._maxListeners \?\? defaultMaxListeners;\n if (m > 0 && handlers.length > m && !handlers.warned)\n overflowWarning(this, type, handlers);\n }\n return this;\n};\nEventEmitterPrototype.on = EventEmitterPrototype.addListener;\nEventEmitterPrototype.prependListener = function prependListener(type, fn) {\n checkListener(fn);\n var events = this._events;\n if (!events)\n events = this._events = { __proto__: null }, this._eventsCount = 0;\n else if (events.newListener)\n this.emit(\"newListener\", type, fn.listener \?\? fn);\n var handlers = events[type];\n if (!handlers)\n events[type] = [fn], this._eventsCount++;\n else {\n handlers.unshift(fn);\n var m = this._maxListeners \?\? defaultMaxListeners;\n if (m > 0 && handlers.length > m && !handlers.warned)\n overflowWarning(this, type, handlers);\n }\n return this;\n};\nEventEmitterPrototype.once = function once2(type, fn) {\n checkListener(fn);\n const bound = onceWrapper.bind(this, type, fn);\n return bound.listener = fn, this.addListener(type, bound), this;\n};\nEventEmitterPrototype.prependOnceListener = function prependOnceListener(type, fn) {\n checkListener(fn);\n const bound = onceWrapper.bind(this, type, fn);\n return bound.listener = fn, this.prependListener(type, bound), this;\n};\nEventEmitterPrototype.removeListener = function removeListener(type, fn) {\n checkListener(fn);\n var { _events: events } = this;\n if (!events)\n return this;\n var handlers = events[type];\n if (!handlers)\n return this;\n var length = handlers.length;\n let position = -1;\n for (let i = length - 1;i >= 0; i--)\n if (handlers[i] === fn || handlers[i].listener === fn) {\n position = i;\n break;\n }\n if (position < 0)\n return this;\n if (position === 0)\n handlers.shift();\n else\n handlers.splice(position, 1);\n if (handlers.length === 0)\n delete events[type], this._eventsCount--;\n return this;\n};\nEventEmitterPrototype.off = EventEmitterPrototype.removeListener;\nEventEmitterPrototype.removeAllListeners = function removeAllListeners(type) {\n var { _events: events } = this;\n if (type && events) {\n if (events[type])\n delete events[type], this._eventsCount--;\n } else\n this._events = { __proto__: null };\n return this;\n};\nEventEmitterPrototype.listeners = function listeners(type) {\n var { _events: events } = this;\n if (!events)\n return [];\n var handlers = events[type];\n if (!handlers)\n return [];\n return handlers.map((x) => x.listener \?\? x);\n};\nEventEmitterPrototype.rawListeners = function rawListeners(type) {\n var { _events } = this;\n if (!_events)\n return [];\n var handlers = _events[type];\n if (!handlers)\n return [];\n return handlers.slice();\n};\nEventEmitterPrototype.listenerCount = function listenerCount2(type) {\n var { _events: events } = this;\n if (!events)\n return 0;\n return events[type]\?.length \?\? 0;\n};\nEventEmitterPrototype.eventNames = function eventNames() {\n return this._eventsCount > 0 \? Reflect.ownKeys(this._events) : [];\n};\nEventEmitterPrototype[kCapture] = !1;\n\nclass AbortError extends Error {\n constructor(message = \"The operation was aborted\", options = @undefined) {\n if (options !== @undefined && typeof options !== \"object\")\n throw new codes.ERR_INVALID_ARG_TYPE(\"options\", \"Object\", options);\n super(message, options);\n this.code = \"ABORT_ERR\", this.name = \"AbortError\";\n }\n}\nvar AsyncResource = null;\n\nclass EventEmitterAsyncResource extends EventEmitter {\n triggerAsyncId;\n asyncResource;\n constructor(options) {\n if (!AsyncResource)\n AsyncResource = (@getInternalField(@internalModuleRegistry, 10) || @createInternalModuleById(10)).AsyncResource;\n var { captureRejections = !1, triggerAsyncId, name = new.target.name, requireManualDestroy } = options || {};\n super({ captureRejections });\n this.triggerAsyncId = triggerAsyncId \?\? 0, this.asyncResource = new AsyncResource(name, { triggerAsyncId, requireManualDestroy });\n }\n emit(...args) {\n this.asyncResource.runInAsyncScope(() => super.emit(...args));\n }\n emitDestroy() {\n this.asyncResource.emitDestroy();\n }\n}\nObject.defineProperties(EventEmitter, {\n captureRejections: {\n get() {\n return EventEmitterPrototype[kCapture];\n },\n set(value) {\n validateBoolean(value, \"EventEmitter.captureRejections\"), EventEmitterPrototype[kCapture] = value;\n },\n enumerable: !0\n },\n defaultMaxListeners: {\n enumerable: !0,\n get: () => {\n return defaultMaxListeners;\n },\n set: (arg) => {\n validateNumber(arg, \"defaultMaxListeners\", 0), defaultMaxListeners = arg;\n }\n },\n kMaxEventTargetListeners: {\n value: kMaxEventTargetListeners,\n enumerable: !1,\n configurable: !1,\n writable: !1\n },\n kMaxEventTargetListenersWarned: {\n value: kMaxEventTargetListenersWarned,\n enumerable: !1,\n configurable: !1,\n writable: !1\n }\n});\nObject.assign(EventEmitter, {\n once,\n on,\n getEventListeners,\n setMaxListeners,\n EventEmitter,\n usingDomains: !1,\n captureRejectionSymbol,\n EventEmitterAsyncResource,\n errorMonitor: kErrorMonitor,\n setMaxListeners,\n init: EventEmitter,\n listenerCount\n});\nreturn EventEmitter})\n"); -// - -// -static constexpr ASCIILiteral NodeFSCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/fs.ts\nvar getValidatedPath = function(p) {\n if (p instanceof URL)\n return Bun.fileURLToPath(p);\n if (typeof p !== \"string\")\n @throwTypeError(\"Path must be a string or URL.\");\n return (_pathModule \?\?= @getInternalField(@internalModuleRegistry, 30) || @createInternalModuleById(30)).resolve(p);\n}, watchFile = function(filename, options, listener) {\n if (filename = getValidatedPath(filename), typeof options === \"function\")\n listener = options, options = {};\n if (typeof listener !== \"function\")\n @throwTypeError(\"listener must be a function\");\n var stat = statWatchers.get(filename);\n if (!stat)\n stat = new StatWatcher(filename, options), statWatchers.set(filename, stat);\n return stat.addListener(\"change\", listener), stat;\n}, unwatchFile = function(filename, listener) {\n filename = getValidatedPath(filename);\n var stat = statWatchers.get(filename);\n if (!stat)\n return;\n if (listener) {\n if (stat.removeListener(\"change\", listener), stat.listenerCount(\"change\") !== 0)\n return;\n } else\n stat.removeAllListeners(\"change\");\n stat.stop(), statWatchers.delete(filename);\n}, callbackify = function(fsFunction, args) {\n const callback = args[args.length - 1];\n try {\n var result = fsFunction.@apply(fs, args.slice(0, args.length - 1));\n result.then((...args2) => callback(null, ...args2), (err) => callback(err));\n } catch (e) {\n if (typeof callback === \"function\")\n callback(e);\n else\n throw e;\n }\n}, createReadStream = function(path, options) {\n return new ReadStream(path, options);\n}, WriteStream_handleWrite = function(er, bytes) {\n if (er)\n return WriteStream_errorOrDestroy.@call(this, er);\n this.bytesWritten += bytes;\n}, WriteStream_internalClose = function(err, cb) {\n this[_writeStreamPathFastPathSymbol] = !1;\n var fd = this.fd;\n this[_fs].close(fd, (er) => {\n this.fd = null, cb(err || er);\n });\n}, WriteStream_errorOrDestroy = function(err) {\n var {\n _readableState: r = { destroyed: !1, autoDestroy: !1 },\n _writableState: w = { destroyed: !1, autoDestroy: !1 }\n } = this;\n if (w\?.destroyed || r\?.destroyed)\n return this;\n if (r\?.autoDestroy || w\?.autoDestroy)\n this.destroy(err);\n else if (err)\n this.emit(\"error\", err);\n}, createWriteStream = function(path, options) {\n return new WriteStream(path, options);\n}, cpSync = function(src, dest, options) {\n if (!options)\n return fs.cpSync(src, dest);\n if (typeof options !== \"object\")\n @throwTypeError(\"options must be an object\");\n if (options.dereference || options.filter || options.preserveTimestamps || options.verbatimSymlinks) {\n if (!lazy_cpSync)\n lazy_cpSync = @getInternalField(@internalModuleRegistry, 3) || @createInternalModuleById(3);\n return lazy_cpSync(src, dest, options);\n }\n return fs.cpSync(src, dest, options.recursive, options.errorOnExist, options.force \?\? !0, options.mode);\n}, cp = function(src, dest, options, callback) {\n if (typeof options === \"function\")\n callback = options, options = @undefined;\n promises.cp(src, dest, options).then(() => callback(), callback);\n}, _toUnixTimestamp = function(time, name = \"time\") {\n if (typeof time === \"string\" && +time == time)\n return +time;\n if (NumberIsFinite(time)) {\n if (time < 0)\n return DateNow() / 1000;\n return time;\n }\n if (isDate(time))\n return DatePrototypeGetTime(time) / 1000;\n @throwTypeError(`Expected ${name} to be a number or Date`);\n}, $, ReadStream, WriteStream, EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20), promises = @getInternalField(@internalModuleRegistry, 22) || @createInternalModuleById(22), Stream = @getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39), { isArrayBufferView } = @requireNativeModule(\"util/types\"), _writeStreamPathFastPathSymbol = Symbol.for(\"Bun.NodeWriteStreamFastPath\"), _fs = Symbol.for(\"#fs\"), constants = @processBindingConstants.fs, fs = Bun.fs();\n\nclass FSWatcher extends EventEmitter {\n #watcher;\n #listener;\n constructor(path, options, listener) {\n super();\n if (typeof options === \"function\")\n listener = options, options = {};\n else if (typeof options === \"string\")\n options = { encoding: options };\n if (typeof listener !== \"function\")\n listener = () => {\n };\n this.#listener = listener;\n try {\n this.#watcher = fs.watch(path, options || {}, this.#onEvent.bind(this));\n } catch (e) {\n if (!e.message\?.startsWith(\"FileNotFound\"))\n throw e;\n const notFound = new Error(`ENOENT: no such file or directory, watch '${path}'`);\n throw notFound.code = \"ENOENT\", notFound.errno = -2, notFound.path = path, notFound.syscall = \"watch\", notFound.filename = path, notFound;\n }\n }\n #onEvent(eventType, filenameOrError) {\n if (eventType === \"error\" || eventType === \"close\")\n this.emit(eventType, filenameOrError);\n else\n this.emit(\"change\", eventType, filenameOrError), this.#listener(eventType, filenameOrError);\n }\n close() {\n this.#watcher\?.close(), this.#watcher = null;\n }\n ref() {\n this.#watcher\?.ref();\n }\n unref() {\n this.#watcher\?.unref();\n }\n start() {\n }\n}\n\nclass StatWatcher extends EventEmitter {\n constructor(path, options) {\n super();\n this._handle = fs.watchFile(path, options, this.#onChange.bind(this));\n }\n #onChange(curr, prev) {\n this.emit(\"change\", curr, prev);\n }\n start() {\n }\n stop() {\n this._handle\?.close(), this._handle = null;\n }\n ref() {\n this._handle\?.ref();\n }\n unref() {\n this._handle\?.unref();\n }\n}\nvar access = function access2(...args) {\n callbackify(fs.access, args);\n}, appendFile = function appendFile2(...args) {\n callbackify(fs.appendFile, args);\n}, close = function close2(...args) {\n callbackify(fs.close, args);\n}, rm = function rm2(...args) {\n callbackify(fs.rm, args);\n}, rmdir = function rmdir2(...args) {\n callbackify(fs.rmdir, args);\n}, copyFile = function copyFile2(...args) {\n const callback = args[args.length - 1];\n if (typeof callback !== \"function\") {\n const err = @makeTypeError(\"Callback must be a function\");\n throw err.code = \"ERR_INVALID_ARG_TYPE\", err;\n }\n fs.copyFile(...args).then((result) => callback(null, result), callback);\n}, exists = function exists2(path, callback) {\n if (typeof callback !== \"function\") {\n const err = @makeTypeError(\"Callback must be a function\");\n throw err.code = \"ERR_INVALID_ARG_TYPE\", err;\n }\n try {\n fs.exists.@apply(fs, [path]).then((existed) => callback(existed), (_) => callback(!1));\n } catch (e) {\n callback(!1);\n }\n}, chown = function chown2(...args) {\n callbackify(fs.chown, args);\n}, chmod = function chmod2(...args) {\n callbackify(fs.chmod, args);\n}, fchmod = function fchmod2(...args) {\n callbackify(fs.fchmod, args);\n}, fchown = function fchown2(...args) {\n callbackify(fs.fchown, args);\n}, fstat = function fstat2(...args) {\n callbackify(fs.fstat, args);\n}, fsync = function fsync2(...args) {\n callbackify(fs.fsync, args);\n}, ftruncate = function ftruncate2(...args) {\n callbackify(fs.ftruncate, args);\n}, futimes = function futimes2(...args) {\n callbackify(fs.futimes, args);\n}, lchmod = function lchmod2(...args) {\n callbackify(fs.lchmod, args);\n}, lchown = function lchown2(...args) {\n callbackify(fs.lchown, args);\n}, link = function link2(...args) {\n callbackify(fs.link, args);\n}, mkdir = function mkdir2(...args) {\n callbackify(fs.mkdir, args);\n}, mkdtemp = function mkdtemp2(...args) {\n callbackify(fs.mkdtemp, args);\n}, open = function open2(...args) {\n callbackify(fs.open, args);\n}, read = function read2(fd, buffer, offsetOrOptions, length, position, callback) {\n let offset = offsetOrOptions, params = null;\n if (arguments.length <= 4) {\n if (arguments.length === 4)\n callback = length, params = offsetOrOptions;\n else if (arguments.length === 3) {\n if (!isArrayBufferView(buffer))\n params = buffer, { buffer = @Buffer.alloc(16384) } = params \?\? {};\n callback = offsetOrOptions;\n } else\n callback = buffer, buffer = @Buffer.alloc(16384);\n ({ offset = 0, length = buffer\?.byteLength - offset, position = null } = params \?\? {});\n }\n queueMicrotask(() => {\n try {\n var bytesRead = fs.readSync(fd, buffer, offset, length, position);\n } catch (e) {\n callback(e);\n }\n callback(null, bytesRead, buffer);\n });\n}, write = function write2(...args) {\n callbackify(fs.write, args);\n}, readdir = function readdir2(...args) {\n const callback = args[args.length - 1];\n if (typeof callback !== \"function\")\n @throwTypeError(\"Callback must be a function\");\n fs.readdir(...args).then((result) => callback(null, result), callback);\n}, readFile = function readFile2(...args) {\n const callback = args[args.length - 1];\n if (typeof callback !== \"function\")\n @throwTypeError(\"Callback must be a function\");\n fs.readFile(...args).then((result) => callback(null, result), callback);\n}, writeFile = function writeFile2(...args) {\n callbackify(fs.writeFile, args);\n}, readlink = function readlink2(...args) {\n callbackify(fs.readlink, args);\n}, realpath = function realpath2(...args) {\n const callback = args[args.length - 1];\n if (typeof callback !== \"function\")\n @throwTypeError(\"Callback must be a function\");\n fs.realpath(...args).then((result) => callback(null, result), callback);\n}, rename = function rename2(...args) {\n callbackify(fs.rename, args);\n}, lstat = function lstat2(...args) {\n const callback = args[args.length - 1];\n if (typeof callback !== \"function\")\n @throwTypeError(\"Callback must be a function\");\n fs.lstat(...args).then((result) => callback(null, result), callback);\n}, stat = function stat2(...args) {\n const callback = args[args.length - 1];\n if (typeof callback !== \"function\")\n @throwTypeError(\"Callback must be a function\");\n fs.stat(...args).then((result) => callback(null, result), callback);\n}, symlink = function symlink2(...args) {\n callbackify(fs.symlink, args);\n}, truncate = function truncate2(...args) {\n callbackify(fs.truncate, args);\n}, unlink = function unlink2(...args) {\n callbackify(fs.unlink, args);\n}, utimes = function utimes2(...args) {\n callbackify(fs.utimes, args);\n}, lutimes = function lutimes2(...args) {\n callbackify(fs.lutimes, args);\n}, accessSync = fs.accessSync.bind(fs), appendFileSync = fs.appendFileSync.bind(fs), closeSync = fs.closeSync.bind(fs), copyFileSync = fs.copyFileSync.bind(fs), existsSync = fs.existsSync.bind(fs), chownSync = fs.chownSync.bind(fs), chmodSync = fs.chmodSync.bind(fs), fchmodSync = fs.fchmodSync.bind(fs), fchownSync = fs.fchownSync.bind(fs), fstatSync = fs.fstatSync.bind(fs), fsyncSync = fs.fsyncSync.bind(fs), ftruncateSync = fs.ftruncateSync.bind(fs), futimesSync = fs.futimesSync.bind(fs), lchmodSync = fs.lchmodSync.bind(fs), lchownSync = fs.lchownSync.bind(fs), linkSync = fs.linkSync.bind(fs), lstatSync = fs.lstatSync.bind(fs), mkdirSync = fs.mkdirSync.bind(fs), mkdtempSync = fs.mkdtempSync.bind(fs), openSync = fs.openSync.bind(fs), readSync = fs.readSync.bind(fs), writeSync = fs.writeSync.bind(fs), readdirSync = fs.readdirSync.bind(fs), readFileSync = fs.readFileSync.bind(fs), writeFileSync = fs.writeFileSync.bind(fs), readlinkSync = fs.readlinkSync.bind(fs), realpathSync = fs.realpathSync.bind(fs), renameSync = fs.renameSync.bind(fs), statSync = fs.statSync.bind(fs), symlinkSync = fs.symlinkSync.bind(fs), truncateSync = fs.truncateSync.bind(fs), unlinkSync = fs.unlinkSync.bind(fs), utimesSync = fs.utimesSync.bind(fs), lutimesSync = fs.lutimesSync.bind(fs), rmSync = fs.rmSync.bind(fs), rmdirSync = fs.rmdirSync.bind(fs), writev = (fd, buffers, position, callback) => {\n if (typeof position === \"function\")\n callback = position, position = null;\n queueMicrotask(() => {\n try {\n var written = fs.writevSync(fd, buffers, position);\n } catch (e) {\n callback(e);\n }\n callback(null, written, buffers);\n });\n}, writevSync = fs.writevSync.bind(fs), readv = (fd, buffers, position, callback) => {\n if (typeof position === \"function\")\n callback = position, position = null;\n queueMicrotask(() => {\n try {\n var written = fs.readvSync(fd, buffers, position);\n } catch (e) {\n callback(e);\n }\n callback(null, written, buffers);\n });\n}, readvSync = fs.readvSync.bind(fs), Dirent = fs.Dirent, Stats = fs.Stats, watch = function watch2(path, options, listener) {\n return new FSWatcher(path, options, listener);\n}, statWatchers = new Map, _pathModule, readStreamPathFastPathSymbol = Symbol.for(\"Bun.Node.readStreamPathFastPath\"), readStreamSymbol = Symbol.for(\"Bun.NodeReadStream\"), readStreamPathOrFdSymbol = Symbol.for(\"Bun.NodeReadStreamPathOrFd\"), writeStreamSymbol = Symbol.for(\"Bun.NodeWriteStream\"), writeStreamPathFastPathSymbol = Symbol.for(\"Bun.NodeWriteStreamFastPath\"), writeStreamPathFastPathCallSymbol = Symbol.for(\"Bun.NodeWriteStreamFastPathCall\"), kIoDone = Symbol.for(\"kIoDone\"), defaultReadStreamOptions = {\n file: @undefined,\n fd: null,\n flags: \"r\",\n encoding: @undefined,\n mode: 438,\n autoClose: !0,\n emitClose: !0,\n start: 0,\n end: @Infinity,\n highWaterMark: 65536,\n fs: {\n read,\n open: (path, flags, mode, cb) => {\n var fd;\n try {\n fd = openSync(path, flags, mode);\n } catch (e) {\n cb(e);\n return;\n }\n cb(null, fd);\n },\n openSync,\n close\n },\n autoDestroy: !0\n}, ReadStreamClass;\nReadStream = function(InternalReadStream) {\n ReadStreamClass = InternalReadStream, Object.defineProperty(ReadStreamClass.prototype, Symbol.toStringTag, {\n value: \"ReadStream\",\n enumerable: !1\n });\n function ReadStream3(path, options) {\n return new InternalReadStream(path, options);\n }\n return ReadStream3.prototype = InternalReadStream.prototype, Object.defineProperty(ReadStream3, Symbol.hasInstance, {\n value(instance) {\n return instance instanceof InternalReadStream;\n }\n });\n}(class ReadStream2 extends Stream._getNativeReadableStreamPrototype(2, Stream.Readable) {\n constructor(pathOrFd, options = defaultReadStreamOptions) {\n if (typeof options !== \"object\" || !options)\n @throwTypeError(\"Expected options to be an object\");\n var {\n flags = defaultReadStreamOptions.flags,\n encoding = defaultReadStreamOptions.encoding,\n mode = defaultReadStreamOptions.mode,\n autoClose = defaultReadStreamOptions.autoClose,\n emitClose = defaultReadStreamOptions.emitClose,\n start = defaultReadStreamOptions.start,\n end = defaultReadStreamOptions.end,\n autoDestroy = defaultReadStreamOptions.autoClose,\n fs: fs2 = defaultReadStreamOptions.fs,\n highWaterMark = defaultReadStreamOptions.highWaterMark,\n fd = defaultReadStreamOptions.fd\n } = options;\n if (pathOrFd\?.constructor\?.name === \"URL\")\n pathOrFd = Bun.fileURLToPath(pathOrFd);\n var tempThis = {};\n if (fd != null) {\n if (typeof fd !== \"number\")\n @throwTypeError(\"Expected options.fd to be a number\");\n tempThis.fd = tempThis[readStreamPathOrFdSymbol] = fd, tempThis.autoClose = !1;\n } else if (typeof pathOrFd === \"string\") {\n if (pathOrFd.startsWith(\"file://\"))\n pathOrFd = Bun.fileURLToPath(pathOrFd);\n if (pathOrFd.length === 0)\n @throwTypeError(\"Expected path to be a non-empty string\");\n tempThis.path = tempThis.file = tempThis[readStreamPathOrFdSymbol] = pathOrFd;\n } else if (typeof pathOrFd === \"number\") {\n if (pathOrFd |= 0, pathOrFd < 0)\n @throwTypeError(\"Expected fd to be a positive integer\");\n tempThis.fd = tempThis[readStreamPathOrFdSymbol] = pathOrFd, tempThis.autoClose = !1;\n } else\n @throwTypeError(\"Expected a path or file descriptor\");\n if (tempThis.fd === @undefined)\n tempThis.fd = fs2.openSync(pathOrFd, flags, mode);\n var fileRef = Bun.file(tempThis.fd), stream = fileRef.stream(), native = @direct(stream);\n if (!native)\n throw new Error(\"no native readable stream\");\n var { stream: ptr } = native;\n super(ptr, {\n ...options,\n encoding,\n autoDestroy,\n autoClose,\n emitClose,\n highWaterMark\n });\n if (Object.assign(this, tempThis), this.#fileRef = fileRef, this.end = end, this._read = this.#internalRead, this.start = start, this.flags = flags, this.mode = mode, this.emitClose = emitClose, this[readStreamPathFastPathSymbol] = start === 0 && end === @Infinity && autoClose && fs2 === defaultReadStreamOptions.fs && (encoding === \"buffer\" || encoding === \"binary\" || encoding == null || encoding === \"utf-8\" || encoding === \"utf8\"), this._readableState.autoClose = autoDestroy = autoClose, this._readableState.highWaterMark = highWaterMark, start !== @undefined)\n this.pos = start;\n }\n #fileRef;\n #fs;\n file;\n path;\n fd = null;\n flags;\n mode;\n start;\n end;\n pos;\n bytesRead = 0;\n #fileSize = -1;\n _read;\n [readStreamSymbol] = !0;\n [readStreamPathOrFdSymbol];\n [readStreamPathFastPathSymbol];\n _construct(callback) {\n if (super._construct)\n super._construct(callback);\n else\n callback();\n this.emit(\"open\", this.fd), this.emit(\"ready\");\n }\n _destroy(err, cb) {\n super._destroy(err, cb);\n try {\n var fd = this.fd;\n if (this[readStreamPathFastPathSymbol] = !1, !fd)\n cb(err);\n else\n this.#fs.close(fd, (er) => {\n cb(er || err);\n }), this.fd = null;\n } catch (e) {\n throw e;\n }\n }\n close(cb) {\n if (typeof cb === \"function\")\n Stream.eos(this, cb);\n this.destroy();\n }\n push(chunk) {\n var bytesRead = chunk\?.length \?\? 0;\n if (bytesRead > 0) {\n this.bytesRead += bytesRead;\n var currPos = this.pos;\n if (currPos !== @undefined) {\n if (this.bytesRead < currPos)\n return !0;\n if (currPos === this.start) {\n var n = this.bytesRead - currPos;\n chunk = chunk.slice(-n);\n var [_, ...rest] = arguments;\n if (this.pos = this.bytesRead, this.end !== @undefined && this.bytesRead > this.end)\n chunk = chunk.slice(0, this.end - this.start + 1);\n return super.push(chunk, ...rest);\n }\n var end = this.end;\n if (end !== @undefined && this.bytesRead > end) {\n chunk = chunk.slice(0, end - currPos + 1);\n var [_, ...rest] = arguments;\n return this.pos = this.bytesRead, super.push(chunk, ...rest);\n }\n this.pos = this.bytesRead;\n }\n }\n return super.push(...arguments);\n }\n #internalRead(n) {\n var { pos, end, bytesRead, fd, encoding } = this;\n if (n = pos !== @undefined \? Math.min(end - pos + 1, n) : Math.min(end - bytesRead + 1, n), n <= 0) {\n this.push(null);\n return;\n }\n if (this.#fileSize === -1 && bytesRead === 0 && pos === @undefined) {\n var stat3 = fstatSync(fd);\n if (this.#fileSize = stat3.size, this.#fileSize > 0 && n > this.#fileSize)\n n = this.#fileSize + 1;\n }\n this[kIoDone] = !1;\n var res = super._read(n);\n if (@isPromise(res)) {\n var then = res\?.then;\n if (then && @isCallable(then))\n res.then(() => {\n if (this[kIoDone] = !0, this.destroyed)\n this.emit(kIoDone);\n }, (er) => {\n this[kIoDone] = !0, this.#errorOrDestroy(er);\n });\n } else if (this[kIoDone] = !0, this.destroyed)\n this.emit(kIoDone), this.#errorOrDestroy(new Error(\"ERR_STREAM_PREMATURE_CLOSE\"));\n }\n #errorOrDestroy(err, sync = null) {\n var {\n _readableState: r = { destroyed: !1, autoDestroy: !1 },\n _writableState: w = { destroyed: !1, autoDestroy: !1 }\n } = this;\n if (w\?.destroyed || r\?.destroyed)\n return this;\n if (r\?.autoDestroy || w\?.autoDestroy)\n this.destroy(err);\n else if (err)\n this.emit(\"error\", err);\n }\n pause() {\n return this[readStreamPathFastPathSymbol] = !1, super.pause();\n }\n resume() {\n return this[readStreamPathFastPathSymbol] = !1, super.resume();\n }\n unshift(...args) {\n return this[readStreamPathFastPathSymbol] = !1, super.unshift(...args);\n }\n pipe(dest, pipeOpts) {\n if (this[readStreamPathFastPathSymbol] && (pipeOpts\?.end \?\? !0) && this._readableState\?.pipes\?.length === 0) {\n if ((writeStreamPathFastPathSymbol in dest) && dest[writeStreamPathFastPathSymbol]) {\n if (dest[writeStreamPathFastPathCallSymbol](this, pipeOpts))\n return this;\n }\n }\n return this[readStreamPathFastPathSymbol] = !1, super.pipe(dest, pipeOpts);\n }\n});\nvar defaultWriteStreamOptions = {\n fd: null,\n start: @undefined,\n pos: @undefined,\n encoding: @undefined,\n flags: \"w\",\n mode: 438,\n fs: {\n write,\n close,\n open,\n openSync\n }\n}, WriteStreamClass = WriteStream = function WriteStream2(path, options = defaultWriteStreamOptions) {\n if (!(this instanceof WriteStream2))\n return new WriteStream2(path, options);\n if (!options)\n @throwTypeError(\"Expected options to be an object\");\n var {\n fs: fs2 = defaultWriteStreamOptions.fs,\n start = defaultWriteStreamOptions.start,\n flags = defaultWriteStreamOptions.flags,\n mode = defaultWriteStreamOptions.mode,\n autoClose = !0,\n emitClose = !1,\n autoDestroy = autoClose,\n encoding = defaultWriteStreamOptions.encoding,\n fd = defaultWriteStreamOptions.fd,\n pos = defaultWriteStreamOptions.pos\n } = options, tempThis = {};\n if (fd != null) {\n if (typeof fd !== \"number\")\n throw new Error(\"Expected options.fd to be a number\");\n tempThis.fd = fd, tempThis[_writeStreamPathFastPathSymbol] = !1;\n } else if (typeof path === \"string\") {\n if (path.length === 0)\n @throwTypeError(\"Expected a non-empty path\");\n if (path.startsWith(\"file:\"))\n path = Bun.fileURLToPath(path);\n tempThis.path = path, tempThis.fd = null, tempThis[_writeStreamPathFastPathSymbol] = autoClose && (start === @undefined || start === 0) && fs2.write === defaultWriteStreamOptions.fs.write && fs2.close === defaultWriteStreamOptions.fs.close;\n }\n if (tempThis.fd == null)\n tempThis.fd = fs2.openSync(path, flags, mode);\n if (NativeWritable.@call(this, tempThis.fd, {\n ...options,\n decodeStrings: !1,\n autoDestroy,\n emitClose,\n fd: tempThis\n }), Object.assign(this, tempThis), typeof fs2\?.write !== \"function\")\n @throwTypeError(\"Expected fs.write to be a function\");\n if (typeof fs2\?.close !== \"function\")\n @throwTypeError(\"Expected fs.close to be a function\");\n if (typeof fs2\?.open !== \"function\")\n @throwTypeError(\"Expected fs.open to be a function\");\n if (typeof path === \"object\" && path) {\n if (path instanceof URL)\n path = Bun.fileURLToPath(path);\n }\n if (typeof path !== \"string\" && typeof fd !== \"number\")\n @throwTypeError(\"Expected a path or file descriptor\");\n if (this.start = start, this[_fs] = fs2, this.flags = flags, this.mode = mode, this.bytesWritten = 0, this[writeStreamSymbol] = !0, this[kIoDone] = !1, this.start !== @undefined)\n this.pos = this.start;\n if (encoding !== defaultWriteStreamOptions.encoding) {\n if (this.setDefaultEncoding(encoding), encoding !== \"buffer\" && encoding !== \"utf8\" && encoding !== \"utf-8\" && encoding !== \"binary\")\n this[_writeStreamPathFastPathSymbol] = !1;\n }\n return this;\n}, NativeWritable = Stream.NativeWritable, WriteStreamPrototype = WriteStream.prototype = Object.create(NativeWritable.prototype);\nObject.defineProperties(WriteStreamPrototype, {\n autoClose: {\n get() {\n return this._writableState.autoDestroy;\n },\n set(val) {\n this._writableState.autoDestroy = val;\n }\n },\n pending: {\n get() {\n return this.fd === null;\n }\n }\n});\nWriteStreamPrototype.destroySoon = WriteStreamPrototype.end;\nWriteStreamPrototype.open = function open3() {\n};\nWriteStreamPrototype[writeStreamPathFastPathCallSymbol] = function WriteStreamPathFastPathCallSymbol(readStream, pipeOpts) {\n if (!this[_writeStreamPathFastPathSymbol])\n return !1;\n if (this.fd !== null)\n return this[_writeStreamPathFastPathSymbol] = !1, !1;\n return this[kIoDone] = !1, readStream[kIoDone] = !1, Bun.write(this[_writeStreamPathFastPathSymbol], readStream[readStreamPathOrFdSymbol]).then((bytesWritten) => {\n readStream[kIoDone] = this[kIoDone] = !0, this.bytesWritten += bytesWritten, readStream.bytesRead += bytesWritten, this.end(), readStream.close();\n }, (err) => {\n readStream[kIoDone] = this[kIoDone] = !0, WriteStream_errorOrDestroy.@call(this, err), readStream.emit(\"error\", err);\n });\n};\nWriteStreamPrototype.isBunFastPathEnabled = function isBunFastPathEnabled() {\n return this[_writeStreamPathFastPathSymbol];\n};\nWriteStreamPrototype.disableBunFastPath = function disableBunFastPath() {\n this[_writeStreamPathFastPathSymbol] = !1;\n};\nWriteStreamPrototype._construct = function _construct(callback) {\n if (typeof this.fd === \"number\") {\n callback();\n return;\n }\n callback(), this.emit(\"open\", this.fd), this.emit(\"ready\");\n};\nWriteStreamPrototype._destroy = function _destroy(err, cb) {\n if (this.fd === null)\n return cb(err);\n if (this[kIoDone]) {\n this.once(kIoDone, () => WriteStream_internalClose.@call(this, err, cb));\n return;\n }\n WriteStream_internalClose.@call(this, err, cb);\n};\nWriteStreamPrototype.close = function close3(cb) {\n if (cb) {\n if (this.closed) {\n process.nextTick(cb);\n return;\n }\n this.on(\"close\", cb);\n }\n if (!this.autoClose)\n this.on(\"finish\", this.destroy);\n this.end();\n};\nWriteStreamPrototype.write = function write3(chunk, encoding, cb) {\n if (encoding \?\?= this._writableState\?.defaultEncoding, this[_writeStreamPathFastPathSymbol] = !1, typeof chunk === \"string\")\n chunk = @Buffer.from(chunk, encoding);\n var native = this.pos === @undefined;\n const callback = native \? (err, bytes) => {\n if (this[kIoDone] = !1, WriteStream_handleWrite.@call(this, err, bytes), this.emit(kIoDone), cb)\n !err \? cb() : cb(err);\n } : () => {\n };\n if (this[kIoDone] = !0, this._write)\n return this._write(chunk, encoding, callback);\n else\n return NativeWritable.prototype.write.@call(this, chunk, encoding, callback, native);\n};\nWriteStreamPrototype._write = @undefined;\nWriteStreamPrototype._writev = @undefined;\nWriteStreamPrototype.end = function end(chunk, encoding, cb) {\n var native = this.pos === @undefined;\n return NativeWritable.prototype.end.@call(this, chunk, encoding, cb, native);\n};\nWriteStreamPrototype._destroy = function _destroy2(err, cb) {\n this.close(err, cb);\n};\nObject.defineProperties(fs, {\n createReadStream: {\n value: createReadStream\n },\n createWriteStream: {\n value: createWriteStream\n },\n ReadStream: {\n value: ReadStream\n },\n WriteStream: {\n value: WriteStream\n }\n});\nrealpath.native = realpath;\nrealpathSync.native = realpathSync;\nvar lazy_cpSync = null;\n$ = {\n Dirent,\n FSWatcher,\n ReadStream,\n Stats,\n WriteStream,\n _toUnixTimestamp,\n access,\n accessSync,\n appendFile,\n appendFileSync,\n chmod,\n chmodSync,\n chown,\n chownSync,\n close,\n closeSync,\n constants,\n copyFile,\n copyFileSync,\n cp,\n cpSync,\n createReadStream,\n createWriteStream,\n exists,\n existsSync,\n fchmod,\n fchmodSync,\n fchown,\n fchownSync,\n fstat,\n fstatSync,\n fsync,\n fsyncSync,\n ftruncate,\n ftruncateSync,\n futimes,\n futimesSync,\n lchmod,\n lchmodSync,\n lchown,\n lchownSync,\n link,\n linkSync,\n lstat,\n lstatSync,\n lutimes,\n lutimesSync,\n mkdir,\n mkdirSync,\n mkdtemp,\n mkdtempSync,\n open,\n openSync,\n promises,\n read,\n readFile,\n readFileSync,\n readSync,\n readdir,\n readdirSync,\n readlink,\n readlinkSync,\n readv,\n readvSync,\n realpath,\n realpathSync,\n rename,\n renameSync,\n rm,\n rmSync,\n rmdir,\n rmdirSync,\n stat,\n statSync,\n symlink,\n symlinkSync,\n truncate,\n truncateSync,\n unlink,\n unlinkSync,\n unwatchFile,\n utimes,\n utimesSync,\n watch,\n watchFile,\n write,\n writeFile,\n writeFileSync,\n writeSync,\n writev,\n writevSync,\n [Symbol.for(\"::bunternal::\")]: {\n ReadStreamClass,\n WriteStreamClass\n }\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeFSPromisesCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/fs.promises.ts\nvar watch = function(filename, options = {}) {\n if (filename instanceof URL)\n @throwTypeError(\"Watch URLs are not supported yet\");\n else if (@Buffer.isBuffer(filename))\n filename = filename.toString();\n else if (typeof filename !== \"string\")\n @throwTypeError(\"Expected path to be a string or Buffer\");\n let nextEventResolve = null;\n if (typeof options === \"string\")\n options = { encoding: options };\n const queue = @createFIFO(), watcher = fs.watch(filename, options || {}, (eventType, filename2) => {\n if (queue.push({ eventType, filename: filename2 }), nextEventResolve) {\n const resolve = nextEventResolve;\n nextEventResolve = null, resolve();\n }\n });\n return {\n [Symbol.asyncIterator]() {\n let closed = !1;\n return {\n async next() {\n while (!closed) {\n let event;\n while (event = queue.shift()) {\n if (event.eventType === \"close\")\n return closed = !0, { value: @undefined, done: !0 };\n if (event.eventType === \"error\")\n throw closed = !0, event.filename;\n return { value: event, done: !1 };\n }\n const { promise, resolve } = @Promise.withResolvers();\n nextEventResolve = resolve, await promise;\n }\n return { value: @undefined, done: !0 };\n },\n return() {\n if (!closed) {\n if (watcher.close(), closed = !0, nextEventResolve) {\n const resolve = nextEventResolve;\n nextEventResolve = null, resolve();\n }\n }\n return { value: @undefined, done: !0 };\n }\n };\n }\n };\n}, cp = function(src, dest, options) {\n if (!options)\n return fs.cp(src, dest);\n if (typeof options !== \"object\")\n @throwTypeError(\"options must be an object\");\n if (options.dereference || options.filter || options.preserveTimestamps || options.verbatimSymlinks) {\n if (!lazy_cp)\n lazy_cp = @getInternalField(@internalModuleRegistry, 3) || @createInternalModuleById(3);\n return lazy_cp(src, dest, options);\n }\n return fs.cp(src, dest, options.recursive, options.errorOnExist, options.force \?\? !0, options.mode);\n};\nasync function opendir(dir) {\n const entries = await fs.readdir(dir, { withFileTypes: !0 });\n return new Dir(entries);\n}\nvar $, constants = @processBindingConstants.fs, fs = Bun.fs();\nvar lazy_cp = null;\n\nclass Dir {\n #entries;\n constructor(e) {\n this.#entries = e;\n }\n readSync() {\n return this.#entries.shift() \?\? null;\n }\n read(c) {\n if (c)\n process.nextTick(c, null, this.readSync());\n return @Promise.resolve(this.readSync());\n }\n closeSync() {\n }\n close(c) {\n if (c)\n process.nextTick(c);\n return @Promise.resolve();\n }\n *[Symbol.asyncIterator]() {\n var next;\n while (next = this.readSync())\n yield next;\n }\n}\n$ = {\n access: fs.access.bind(fs),\n appendFile: fs.appendFile.bind(fs),\n close: fs.close.bind(fs),\n copyFile: fs.copyFile.bind(fs),\n cp,\n exists: fs.exists.bind(fs),\n chown: fs.chown.bind(fs),\n chmod: fs.chmod.bind(fs),\n fchmod: fs.fchmod.bind(fs),\n fchown: fs.fchown.bind(fs),\n fstat: fs.fstat.bind(fs),\n fsync: fs.fsync.bind(fs),\n ftruncate: fs.ftruncate.bind(fs),\n futimes: fs.futimes.bind(fs),\n lchmod: fs.lchmod.bind(fs),\n lchown: fs.lchown.bind(fs),\n link: fs.link.bind(fs),\n lstat: fs.lstat.bind(fs),\n mkdir: fs.mkdir.bind(fs),\n mkdtemp: fs.mkdtemp.bind(fs),\n open: fs.open.bind(fs),\n read: fs.read.bind(fs),\n write: fs.write.bind(fs),\n readdir: fs.readdir.bind(fs),\n readFile: fs.readFile.bind(fs),\n writeFile: fs.writeFile.bind(fs),\n readlink: fs.readlink.bind(fs),\n realpath: fs.realpath.bind(fs),\n rename: fs.rename.bind(fs),\n stat: fs.stat.bind(fs),\n symlink: fs.symlink.bind(fs),\n truncate: fs.truncate.bind(fs),\n unlink: fs.unlink.bind(fs),\n utimes: fs.utimes.bind(fs),\n lutimes: fs.lutimes.bind(fs),\n rm: fs.rm.bind(fs),\n rmdir: fs.rmdir.bind(fs),\n writev: async (fd, buffers, position) => {\n var bytesWritten = await fs.writev(fd, buffers, position);\n return {\n bytesWritten,\n buffers\n };\n },\n readv: async (fd, buffers, position) => {\n var bytesRead = await fs.readv(fd, buffers, position);\n return {\n bytesRead,\n buffers\n };\n },\n constants,\n watch,\n opendir\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeHttpCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/http.ts\nvar checkInvalidHeaderChar = function(val) {\n return RegExpPrototypeExec.@call(headerCharRegex, val) !== null;\n};\nvar isValidTLSArray = function(obj) {\n if (typeof obj === \"string\" || isTypedArray(obj) || obj instanceof @ArrayBuffer || obj instanceof Blob)\n return !0;\n if (@Array.isArray(obj)) {\n for (var i = 0;i < obj.length; i++)\n if (typeof obj !== \"string\" && !isTypedArray(obj) && !(obj instanceof @ArrayBuffer) && !(obj instanceof Blob))\n return !1;\n return !0;\n }\n}, validateMsecs = function(numberlike, field) {\n if (typeof numberlike !== \"number\" || numberlike < 0)\n throw new ERR_INVALID_ARG_TYPE(field, \"number\", numberlike);\n return numberlike;\n}, validateFunction = function(callable, field) {\n if (typeof callable !== \"function\")\n throw new ERR_INVALID_ARG_TYPE(field, \"Function\", callable);\n return callable;\n}, createServer = function(options, callback) {\n return new Server(options, callback);\n}, emitListeningNextTick = function(self, onListen, err, hostname, port) {\n if (typeof onListen === \"function\")\n try {\n onListen(err, hostname, port);\n } catch (err2) {\n self.emit(\"error\", err2);\n }\n if (self.listening = !err, err)\n self.emit(\"error\", err);\n else\n self.emit(\"listening\", hostname, port);\n}, assignHeaders = function(object, req) {\n var headers = req.headers.toJSON();\n const rawHeaders = @newArrayWithSize(req.headers.count * 2);\n var i = 0;\n for (let key in headers)\n rawHeaders[i++] = key, rawHeaders[i++] = headers[key];\n object.headers = headers, object.rawHeaders = rawHeaders;\n}, destroyBodyStreamNT = function(bodyStream) {\n bodyStream.destroy();\n}, getDefaultHTTPSAgent = function() {\n return _defaultHTTPSAgent \?\?= new Agent({ defaultPort: 443, protocol: \"https:\" });\n};\nvar urlToHttpOptions = function(url) {\n var { protocol, hostname, hash, search, pathname, href, port, username, password } = url;\n return {\n protocol,\n hostname: typeof hostname === \"string\" && StringPrototypeStartsWith.@call(hostname, \"[\") \? StringPrototypeSlice.@call(hostname, 1, -1) : hostname,\n hash,\n search,\n pathname,\n path: `${pathname || \"\"}${search || \"\"}`,\n href,\n port: port \? Number(port) : protocol === \"https:\" \? 443 : protocol === \"http:\" \? 80 : @undefined,\n auth: username || password \? `${decodeURIComponent(username)}:${decodeURIComponent(password)}` : @undefined\n };\n}, validateHost = function(host, name) {\n if (host !== null && host !== @undefined && typeof host !== \"string\")\n throw new Error(\"Invalid arg type in options\");\n return host;\n}, checkIsHttpToken = function(val) {\n return RegExpPrototypeExec.@call(tokenRegExp, val) !== null;\n};\nvar _writeHead = function(statusCode, reason, obj, response) {\n if (statusCode |= 0, statusCode < 100 || statusCode > 999)\n throw new Error(\"status code must be between 100 and 999\");\n if (typeof reason === \"string\")\n response.statusMessage = reason;\n else {\n if (!response.statusMessage)\n response.statusMessage = STATUS_CODES[statusCode] || \"unknown\";\n obj = reason;\n }\n response.statusCode = statusCode;\n {\n let k;\n if (@Array.isArray(obj)) {\n if (obj.length % 2 !== 0)\n throw new Error(\"raw headers must have an even number of elements\");\n for (let n = 0;n < obj.length; n += 2)\n if (k = obj[n + 0], k)\n response.setHeader(k, obj[n + 1]);\n } else if (obj) {\n const keys = Object.keys(obj);\n for (let i = 0;i < keys.length; i++)\n if (k = keys[i], k)\n response.setHeader(k, obj[k]);\n }\n }\n if (statusCode === 204 || statusCode === 304 || statusCode >= 100 && statusCode <= 199)\n response._hasBody = !1;\n}, request = function(url, options, cb) {\n return new ClientRequest(url, options, cb);\n}, get = function(url, options, cb) {\n const req = request(url, options, cb);\n return req.end(), req;\n}, $, EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20), { isTypedArray } = @requireNativeModule(\"util/types\"), { Duplex, Readable, Writable } = @getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39), { getHeader, setHeader } = @lazy(\"http\"), headerCharRegex = /[^\\t\\x20-\\x7e\\x80-\\xff]/, validateHeaderName = (name, label) => {\n if (typeof name !== \"string\" || !name || !checkIsHttpToken(name))\n throw new Error(\"ERR_INVALID_HTTP_TOKEN\");\n}, validateHeaderValue = (name, value) => {\n if (value === @undefined)\n throw new Error(\"ERR_HTTP_INVALID_HEADER_VALUE\");\n if (checkInvalidHeaderChar(value))\n throw new Error(\"ERR_INVALID_CHAR\");\n}, { URL } = globalThis, globalReportError = globalThis.reportError, setTimeout = globalThis.setTimeout, fetch = Bun.fetch;\nvar kEmptyObject = Object.freeze(Object.create(null)), kOutHeaders = Symbol.for(\"kOutHeaders\"), kEndCalled = Symbol.for(\"kEndCalled\"), kAbortController = Symbol.for(\"kAbortController\"), kClearTimeout = Symbol(\"kClearTimeout\"), kCorked = Symbol.for(\"kCorked\"), searchParamsSymbol = Symbol.for(\"query\"), StringPrototypeSlice = @String.prototype.slice, StringPrototypeStartsWith = @String.prototype.startsWith, StringPrototypeToUpperCase = @String.prototype.toUpperCase, ArrayIsArray = @Array.isArray, RegExpPrototypeExec = @RegExp.prototype.exec, ObjectAssign = Object.assign, INVALID_PATH_REGEX = /[^\\u0021-\\u00ff]/;\nvar _defaultHTTPSAgent, kInternalRequest = Symbol(\"kInternalRequest\"), kInternalSocketData = Symbol.for(\"::bunternal::\"), kEmptyBuffer = @Buffer.alloc(0);\n\nclass ERR_INVALID_ARG_TYPE extends TypeError {\n constructor(name, expected, actual) {\n super(`The ${name} argument must be of type ${expected}. Received type ${typeof actual}`);\n this.code = \"ERR_INVALID_ARG_TYPE\";\n }\n}\nvar FakeSocket = class Socket extends Duplex {\n [kInternalSocketData];\n bytesRead = 0;\n bytesWritten = 0;\n connecting = !1;\n timeout = 0;\n isServer = !1;\n #address;\n address() {\n var internalData;\n return this.#address \?\?= (internalData = this[kInternalSocketData])\?.[0]\?.requestIP(internalData[2]) \?\? {};\n }\n get bufferSize() {\n return this.writableLength;\n }\n connect(port, host, connectListener) {\n return this;\n }\n _destroy(err, callback) {\n }\n _final(callback) {\n }\n get localAddress() {\n return \"127.0.0.1\";\n }\n get localFamily() {\n return \"IPv4\";\n }\n get localPort() {\n return 80;\n }\n get pending() {\n return this.connecting;\n }\n _read(size) {\n }\n get readyState() {\n if (this.connecting)\n return \"opening\";\n if (this.readable)\n return this.writable \? \"open\" : \"readOnly\";\n else\n return this.writable \? \"writeOnly\" : \"closed\";\n }\n ref() {\n }\n get remoteAddress() {\n return this.address()\?.address;\n }\n set remoteAddress(val) {\n this.address().address = val;\n }\n get remotePort() {\n return this.address()\?.port;\n }\n set remotePort(val) {\n this.address().port = val;\n }\n get remoteFamily() {\n return this.address()\?.family;\n }\n set remoteFamily(val) {\n this.address().family = val;\n }\n resetAndDestroy() {\n }\n setKeepAlive(enable = !1, initialDelay = 0) {\n }\n setNoDelay(noDelay = !0) {\n return this;\n }\n setTimeout(timeout, callback) {\n return this;\n }\n unref() {\n }\n _write(chunk, encoding, callback) {\n }\n};\n\nclass Agent extends EventEmitter {\n defaultPort = 80;\n protocol = \"http:\";\n options;\n requests;\n sockets;\n freeSockets;\n keepAliveMsecs;\n keepAlive;\n maxSockets;\n maxFreeSockets;\n scheduling;\n maxTotalSockets;\n totalSocketCount;\n #fakeSocket;\n static get globalAgent() {\n return globalAgent;\n }\n static get defaultMaxSockets() {\n return @Infinity;\n }\n constructor(options = kEmptyObject) {\n super();\n if (this.options = options = { ...options, path: null }, options.noDelay === @undefined)\n options.noDelay = !0;\n this.requests = kEmptyObject, this.sockets = kEmptyObject, this.freeSockets = kEmptyObject, this.keepAliveMsecs = options.keepAliveMsecs || 1000, this.keepAlive = options.keepAlive || !1, this.maxSockets = options.maxSockets || Agent.defaultMaxSockets, this.maxFreeSockets = options.maxFreeSockets || 256, this.scheduling = options.scheduling || \"lifo\", this.maxTotalSockets = options.maxTotalSockets, this.totalSocketCount = 0, this.defaultPort = options.defaultPort || 80, this.protocol = options.protocol || \"http:\";\n }\n createConnection() {\n return this.#fakeSocket \?\?= new FakeSocket;\n }\n getName(options = kEmptyObject) {\n let name = `http:${options.host || \"localhost\"}:`;\n if (options.port)\n name += options.port;\n if (name += \":\", options.localAddress)\n name += options.localAddress;\n if (options.family === 4 || options.family === 6)\n name += `:${options.family}`;\n if (options.socketPath)\n name += `:${options.socketPath}`;\n return name;\n }\n addRequest() {\n }\n createSocket(req, options, cb) {\n cb(null, this.#fakeSocket \?\?= new FakeSocket);\n }\n removeSocket() {\n }\n keepSocketAlive() {\n return !0;\n }\n reuseSocket() {\n }\n destroy() {\n }\n}\n\nclass Server extends EventEmitter {\n #server;\n #options;\n #tls;\n #is_tls = !1;\n listening = !1;\n serverName;\n constructor(options, callback) {\n super();\n if (typeof options === \"function\")\n callback = options, options = {};\n else if (options == null || typeof options === \"object\") {\n options = { ...options }, this.#tls = null;\n let key = options.key;\n if (key) {\n if (!isValidTLSArray(key))\n @throwTypeError(\"key argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");\n this.#is_tls = !0;\n }\n let cert = options.cert;\n if (cert) {\n if (!isValidTLSArray(cert))\n @throwTypeError(\"cert argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");\n this.#is_tls = !0;\n }\n let ca = options.ca;\n if (ca) {\n if (!isValidTLSArray(ca))\n @throwTypeError(\"ca argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");\n this.#is_tls = !0;\n }\n let passphrase = options.passphrase;\n if (passphrase && typeof passphrase !== \"string\")\n @throwTypeError(\"passphrase argument must be an string\");\n let serverName = options.servername;\n if (serverName && typeof serverName !== \"string\")\n @throwTypeError(\"servername argument must be an string\");\n let secureOptions = options.secureOptions || 0;\n if (secureOptions && typeof secureOptions !== \"number\")\n @throwTypeError(\"secureOptions argument must be an number\");\n if (this.#is_tls)\n this.#tls = {\n serverName,\n key,\n cert,\n ca,\n passphrase,\n secureOptions\n };\n else\n this.#tls = null;\n } else\n throw new Error(\"bun-http-polyfill: invalid arguments\");\n if (this.#options = options, callback)\n this.on(\"request\", callback);\n }\n closeAllConnections() {\n const server = this.#server;\n if (!server)\n return;\n this.#server = @undefined, server.stop(!0), this.emit(\"close\");\n }\n closeIdleConnections() {\n }\n close(optionalCallback) {\n const server = this.#server;\n if (!server) {\n if (typeof optionalCallback === \"function\")\n process.nextTick(optionalCallback, new Error(\"Server is not running\"));\n return;\n }\n if (this.#server = @undefined, typeof optionalCallback === \"function\")\n this.once(\"close\", optionalCallback);\n server.stop(), this.emit(\"close\");\n }\n address() {\n if (!this.#server)\n return null;\n return this.#server.address;\n }\n listen(port, host, backlog, onListen) {\n const server = this;\n let socketPath;\n if (typeof port == \"string\" && !Number.isSafeInteger(Number(port)))\n socketPath = port;\n if (typeof host === \"function\")\n onListen = host, host = @undefined;\n if (typeof port === \"function\")\n onListen = port;\n else if (typeof port === \"object\") {\n if (port\?.signal\?.addEventListener(\"abort\", () => {\n this.close();\n }), host = port\?.host, port = port\?.port, typeof port\?.callback === \"function\")\n onListen = port\?.callback;\n }\n if (typeof backlog === \"function\")\n onListen = backlog;\n const ResponseClass = this.#options.ServerResponse || ServerResponse, RequestClass = this.#options.IncomingMessage || IncomingMessage;\n try {\n const tls = this.#tls;\n if (tls)\n this.serverName = tls.serverName || host || \"localhost\";\n this.#server = Bun.serve({\n tls,\n port,\n hostname: host,\n unix: socketPath,\n websocket: {\n open(ws) {\n ws.data.open(ws);\n },\n message(ws, message) {\n ws.data.message(ws, message);\n },\n close(ws, code, reason) {\n ws.data.close(ws, code, reason);\n },\n drain(ws) {\n ws.data.drain(ws);\n }\n },\n fetch(req, _server) {\n var pendingResponse, pendingError, rejectFunction, resolveFunction, reject = (err) => {\n if (pendingError)\n return;\n if (pendingError = err, rejectFunction)\n rejectFunction(err);\n }, reply = function(resp) {\n if (pendingResponse)\n return;\n if (pendingResponse = resp, resolveFunction)\n resolveFunction(resp);\n };\n const http_req = new RequestClass(req), http_res = new ResponseClass({ reply, req: http_req });\n if (http_req.socket[kInternalSocketData] = [_server, http_res, req], http_req.once(\"error\", (err) => reject(err)), http_res.once(\"error\", (err) => reject(err)), req.headers.get(\"upgrade\"))\n server.emit(\"upgrade\", http_req, http_req.socket, kEmptyBuffer);\n else\n server.emit(\"request\", http_req, http_res);\n if (pendingError)\n throw pendingError;\n if (pendingResponse)\n return pendingResponse;\n return new @Promise((resolve, reject2) => {\n resolveFunction = resolve, rejectFunction = reject2;\n });\n }\n }), setTimeout(emitListeningNextTick, 1, this, onListen, null, this.#server.hostname, this.#server.port);\n } catch (err) {\n server.emit(\"error\", err);\n }\n return this;\n }\n setTimeout(msecs, callback) {\n }\n}\nclass IncomingMessage extends Readable {\n method;\n complete;\n constructor(req, defaultIncomingOpts) {\n const method = req.method;\n super();\n const url = new URL(req.url);\n var { type = \"request\", [kInternalRequest]: nodeReq } = defaultIncomingOpts || {};\n this.#noBody = type === \"request\" \? method === \"GET\" || method === \"HEAD\" || method === \"TRACE\" || method === \"CONNECT\" || method === \"OPTIONS\" || (parseInt(req.headers.get(\"Content-Length\") || \"\") || 0) === 0 : !1, this.#req = req, this.method = method, this.#type = type, this.complete = !!this.#noBody, this.#bodyStream = @undefined;\n const socket = new FakeSocket;\n if (url.protocol === \"https:\")\n socket.encrypted = !0;\n this.#fakeSocket = socket, this.url = url.pathname + url.search, this.req = nodeReq, assignHeaders(this, req);\n }\n headers;\n rawHeaders;\n _consuming = !1;\n _dumped = !1;\n #bodyStream;\n #fakeSocket;\n #noBody = !1;\n #aborted = !1;\n #req;\n url;\n #type;\n _construct(callback) {\n if (this.#type === \"response\" || this.#noBody) {\n callback();\n return;\n }\n const contentLength = this.#req.headers.get(\"content-length\");\n if ((contentLength \? parseInt(contentLength, 10) : 0) === 0) {\n this.#noBody = !0, callback();\n return;\n }\n callback();\n }\n async#consumeStream(reader) {\n while (!0) {\n var { done, value } = await reader.readMany();\n if (this.#aborted)\n return;\n if (done) {\n this.push(null), process.nextTick(destroyBodyStreamNT, this);\n break;\n }\n for (var v of value)\n this.push(v);\n }\n }\n _read(size) {\n if (this.#noBody)\n this.push(null), this.complete = !0;\n else if (this.#bodyStream == null) {\n const reader = this.#req.body\?.getReader();\n if (!reader) {\n this.push(null);\n return;\n }\n this.#bodyStream = reader, this.#consumeStream(reader);\n }\n }\n get aborted() {\n return this.#aborted;\n }\n #abort() {\n if (this.#aborted)\n return;\n this.#aborted = !0;\n var bodyStream = this.#bodyStream;\n if (!bodyStream)\n return;\n bodyStream.cancel(), this.complete = !0, this.#bodyStream = @undefined, this.push(null);\n }\n get connection() {\n return this.#fakeSocket;\n }\n get statusCode() {\n return this.#req.status;\n }\n get statusMessage() {\n return STATUS_CODES[this.#req.status];\n }\n get httpVersion() {\n return \"1.1\";\n }\n get rawTrailers() {\n return [];\n }\n get httpVersionMajor() {\n return 1;\n }\n get httpVersionMinor() {\n return 1;\n }\n get trailers() {\n return kEmptyObject;\n }\n get socket() {\n return this.#fakeSocket \?\?= new FakeSocket;\n }\n set socket(val) {\n this.#fakeSocket = val;\n }\n setTimeout(msecs, callback) {\n throw new Error(\"not implemented\");\n }\n}\n\nclass OutgoingMessage extends Writable {\n constructor() {\n super(...arguments);\n }\n #headers;\n headersSent = !1;\n sendDate = !0;\n req;\n timeout;\n #finished = !1;\n [kEndCalled] = !1;\n #fakeSocket;\n #timeoutTimer;\n [kAbortController] = null;\n _implicitHeader() {\n }\n get headers() {\n if (!this.#headers)\n return kEmptyObject;\n return this.#headers.toJSON();\n }\n get shouldKeepAlive() {\n return !0;\n }\n get chunkedEncoding() {\n return !1;\n }\n set chunkedEncoding(value) {\n }\n set shouldKeepAlive(value) {\n }\n get useChunkedEncodingByDefault() {\n return !0;\n }\n set useChunkedEncodingByDefault(value) {\n }\n get socket() {\n return this.#fakeSocket \?\?= new FakeSocket;\n }\n set socket(val) {\n this.#fakeSocket = val;\n }\n get connection() {\n return this.socket;\n }\n get finished() {\n return this.#finished;\n }\n appendHeader(name, value) {\n var headers = this.#headers \?\?= new Headers;\n headers.append(name, value);\n }\n flushHeaders() {\n }\n getHeader(name) {\n return getHeader(this.#headers, name);\n }\n getHeaders() {\n if (!this.#headers)\n return kEmptyObject;\n return this.#headers.toJSON();\n }\n getHeaderNames() {\n var headers = this.#headers;\n if (!headers)\n return [];\n return @Array.from(headers.keys());\n }\n removeHeader(name) {\n if (!this.#headers)\n return;\n this.#headers.delete(name);\n }\n setHeader(name, value) {\n var headers = this.#headers \?\?= new Headers;\n return headers.set(name, value), this;\n }\n hasHeader(name) {\n if (!this.#headers)\n return !1;\n return this.#headers.has(name);\n }\n addTrailers(headers) {\n throw new Error(\"not implemented\");\n }\n [kClearTimeout]() {\n if (this.#timeoutTimer)\n clearTimeout(this.#timeoutTimer), this.removeAllListeners(\"timeout\"), this.#timeoutTimer = @undefined;\n }\n #onTimeout() {\n this.#timeoutTimer = @undefined, this[kAbortController]\?.abort(), this.emit(\"timeout\");\n }\n setTimeout(msecs, callback) {\n if (this.destroyed)\n return this;\n if (this.timeout = msecs = validateMsecs(msecs, \"msecs\"), clearTimeout(this.#timeoutTimer), msecs === 0) {\n if (callback !== @undefined)\n validateFunction(callback, \"callback\"), this.removeListener(\"timeout\", callback);\n this.#timeoutTimer = @undefined;\n } else if (this.#timeoutTimer = setTimeout(this.#onTimeout.bind(this), msecs).unref(), callback !== @undefined)\n validateFunction(callback, \"callback\"), this.once(\"timeout\", callback);\n return this;\n }\n}\nvar OriginalWriteHeadFn, OriginalImplicitHeadFn;\n\nclass ServerResponse extends Writable {\n constructor(c) {\n super();\n if (!c)\n c = {};\n var req = c.req || {}, reply = c.reply;\n if (this.req = req, this._reply = reply, this.sendDate = !0, this.statusCode = 200, this.headersSent = !1, this.statusMessage = @undefined, this.#controller = @undefined, this.#firstWrite = @undefined, this._writableState.decodeStrings = !1, this.#deferred = @undefined, req.method === \"HEAD\")\n this._hasBody = !1;\n }\n req;\n _reply;\n sendDate;\n statusCode;\n #headers;\n headersSent = !1;\n statusMessage;\n #controller;\n #firstWrite;\n _sent100 = !1;\n _defaultKeepAlive = !1;\n _removedConnection = !1;\n _removedContLen = !1;\n _hasBody = !0;\n #deferred = @undefined;\n #finished = !1;\n _implicitHeader() {\n this.writeHead(this.statusCode);\n }\n _write(chunk, encoding, callback) {\n if (!this.#firstWrite && !this.headersSent) {\n this.#firstWrite = chunk, callback();\n return;\n }\n this.#ensureReadableStreamController((controller) => {\n controller.write(chunk), callback();\n });\n }\n _writev(chunks, callback) {\n if (chunks.length === 1 && !this.headersSent && !this.#firstWrite) {\n this.#firstWrite = chunks[0].chunk, callback();\n return;\n }\n this.#ensureReadableStreamController((controller) => {\n for (let chunk of chunks)\n controller.write(chunk.chunk);\n callback();\n });\n }\n #ensureReadableStreamController(run) {\n var thisController = this.#controller;\n if (thisController)\n return run(thisController);\n this.headersSent = !0;\n var firstWrite = this.#firstWrite;\n this.#firstWrite = @undefined, this._reply(new Response(new @ReadableStream({\n type: \"direct\",\n pull: (controller) => {\n if (this.#controller = controller, firstWrite)\n controller.write(firstWrite);\n if (firstWrite = @undefined, run(controller), !this.#finished)\n return new @Promise((resolve) => {\n this.#deferred = resolve;\n });\n }\n }), {\n headers: this.#headers,\n status: this.statusCode,\n statusText: this.statusMessage \?\? STATUS_CODES[this.statusCode]\n }));\n }\n #drainHeadersIfObservable() {\n if (this._implicitHeader === OriginalImplicitHeadFn && this.writeHead === OriginalWriteHeadFn)\n return;\n this._implicitHeader();\n }\n _final(callback) {\n if (!this.headersSent) {\n var data = this.#firstWrite || \"\";\n this.#firstWrite = @undefined, this.#finished = !0, this.#drainHeadersIfObservable(), this._reply(new Response(data, {\n headers: this.#headers,\n status: this.statusCode,\n statusText: this.statusMessage \?\? STATUS_CODES[this.statusCode]\n })), callback && callback();\n return;\n }\n this.#finished = !0, this.#ensureReadableStreamController((controller) => {\n controller.end(), callback();\n var deferred = this.#deferred;\n if (deferred)\n this.#deferred = @undefined, deferred();\n });\n }\n writeProcessing() {\n throw new Error(\"not implemented\");\n }\n addTrailers(headers) {\n throw new Error(\"not implemented\");\n }\n assignSocket(socket) {\n throw new Error(\"not implemented\");\n }\n detachSocket(socket) {\n throw new Error(\"not implemented\");\n }\n writeContinue(callback) {\n throw new Error(\"not implemented\");\n }\n setTimeout(msecs, callback) {\n throw new Error(\"not implemented\");\n }\n get shouldKeepAlive() {\n return !0;\n }\n get chunkedEncoding() {\n return !1;\n }\n set chunkedEncoding(value) {\n }\n set shouldKeepAlive(value) {\n }\n get useChunkedEncodingByDefault() {\n return !0;\n }\n set useChunkedEncodingByDefault(value) {\n }\n appendHeader(name, value) {\n var headers = this.#headers \?\?= new Headers;\n headers.append(name, value);\n }\n flushHeaders() {\n }\n getHeader(name) {\n return getHeader(this.#headers, name);\n }\n getHeaders() {\n var headers = this.#headers;\n if (!headers)\n return kEmptyObject;\n return headers.toJSON();\n }\n getHeaderNames() {\n var headers = this.#headers;\n if (!headers)\n return [];\n return @Array.from(headers.keys());\n }\n removeHeader(name) {\n if (!this.#headers)\n return;\n this.#headers.delete(name);\n }\n setHeader(name, value) {\n var headers = this.#headers \?\?= new Headers;\n return setHeader(headers, name, value), this;\n }\n hasHeader(name) {\n if (!this.#headers)\n return !1;\n return this.#headers.has(name);\n }\n writeHead(statusCode, statusMessage, headers) {\n return _writeHead(statusCode, statusMessage, headers, this), this;\n }\n}\nOriginalWriteHeadFn = ServerResponse.prototype.writeHead;\nOriginalImplicitHeadFn = ServerResponse.prototype._implicitHeader;\n\nclass ClientRequest extends OutgoingMessage {\n #timeout;\n #res = null;\n #upgradeOrConnect = !1;\n #parser = null;\n #maxHeadersCount = null;\n #reusedSocket = !1;\n #host;\n #protocol;\n #method;\n #port;\n #useDefaultPort;\n #joinDuplicateHeaders;\n #maxHeaderSize;\n #agent = globalAgent;\n #path;\n #socketPath;\n #bodyChunks = null;\n #fetchRequest;\n #signal = null;\n [kAbortController] = null;\n #timeoutTimer = @undefined;\n #options;\n #finished;\n get path() {\n return this.#path;\n }\n get port() {\n return this.#port;\n }\n get method() {\n return this.#method;\n }\n get host() {\n return this.#host;\n }\n get protocol() {\n return this.#protocol;\n }\n _write(chunk, encoding, callback) {\n if (!this.#bodyChunks) {\n this.#bodyChunks = [chunk], callback();\n return;\n }\n this.#bodyChunks.push(chunk), callback();\n }\n _writev(chunks, callback) {\n if (!this.#bodyChunks) {\n this.#bodyChunks = chunks, callback();\n return;\n }\n this.#bodyChunks.push(...chunks), callback();\n }\n _final(callback) {\n if (this.#finished = !0, this[kAbortController] = new AbortController, this[kAbortController].signal.addEventListener(\"abort\", () => {\n this[kClearTimeout]();\n }), this.#signal\?.aborted)\n this[kAbortController].abort();\n var method = this.#method, body = this.#bodyChunks\?.length === 1 \? this.#bodyChunks[0] : @Buffer.concat(this.#bodyChunks || []);\n let url, proxy;\n if (this.#path.startsWith(\"http://\") || this.#path.startsWith(\"https://\"))\n url = this.#path, proxy = `${this.#protocol}//${this.#host}${this.#useDefaultPort \? \"\" : \":\" + this.#port}`;\n else\n url = `${this.#protocol}//${this.#host}${this.#useDefaultPort \? \"\" : \":\" + this.#port}${this.#path}`;\n try {\n this.#fetchRequest = fetch(url, {\n method,\n headers: this.getHeaders(),\n body: body && method !== \"GET\" && method !== \"HEAD\" && method !== \"OPTIONS\" \? body : @undefined,\n redirect: \"manual\",\n verbose: !1,\n signal: this[kAbortController].signal,\n proxy,\n timeout: !1,\n decompress: !1\n }).then((response) => {\n var res = this.#res = new IncomingMessage(response, {\n type: \"response\",\n [kInternalRequest]: this\n });\n this.emit(\"response\", res);\n }).catch((err) => {\n this.emit(\"error\", err);\n }).finally(() => {\n this.#fetchRequest = null, this[kClearTimeout]();\n });\n } catch (err) {\n this.emit(\"error\", err);\n } finally {\n callback();\n }\n }\n get aborted() {\n return this.#signal\?.aborted || !!this[kAbortController]\?.signal.aborted;\n }\n abort() {\n if (this.aborted)\n return;\n this[kAbortController].abort();\n }\n constructor(input, options, cb) {\n super();\n if (typeof input === \"string\") {\n const urlStr = input;\n try {\n var urlObject = new URL(urlStr);\n } catch (e) {\n @throwTypeError(`Invalid URL: ${urlStr}`);\n }\n input = urlToHttpOptions(urlObject);\n } else if (input && typeof input === \"object\" && input instanceof URL)\n input = urlToHttpOptions(input);\n else\n cb = options, options = input, input = null;\n if (typeof options === \"function\")\n cb = options, options = input || kEmptyObject;\n else\n options = ObjectAssign(input || {}, options);\n var defaultAgent = options._defaultAgent || Agent.globalAgent;\n let protocol = options.protocol;\n if (!protocol)\n if (options.port === 443)\n protocol = \"https:\";\n else\n protocol = defaultAgent.protocol || \"http:\";\n switch (this.#protocol = protocol, this.#agent\?.protocol) {\n case @undefined:\n break;\n case \"http:\":\n if (protocol === \"https:\") {\n defaultAgent = this.#agent = getDefaultHTTPSAgent();\n break;\n }\n case \"https:\":\n if (protocol === \"https\") {\n defaultAgent = this.#agent = Agent.globalAgent;\n break;\n }\n default:\n break;\n }\n if (options.path) {\n const path = @String(options.path);\n if (RegExpPrototypeExec.@call(INVALID_PATH_REGEX, path) !== null)\n throw new Error(\"Path contains unescaped characters\");\n }\n if (protocol !== \"http:\" && protocol !== \"https:\" && protocol) {\n const expectedProtocol = defaultAgent\?.protocol \?\? \"http:\";\n throw new Error(`Protocol mismatch. Expected: ${expectedProtocol}. Got: ${protocol}`);\n }\n const defaultPort = protocol === \"https:\" \? 443 : 80;\n this.#port = options.port || options.defaultPort || this.#agent\?.defaultPort || defaultPort, this.#useDefaultPort = this.#port === defaultPort;\n const host = this.#host = options.host = validateHost(options.hostname, \"hostname\") || validateHost(options.host, \"host\") || \"localhost\";\n this.#socketPath = options.socketPath;\n const signal = options.signal;\n if (signal)\n signal.addEventListener(\"abort\", () => {\n this[kAbortController]\?.abort();\n }), this.#signal = signal;\n let method = options.method;\n const methodIsString = typeof method === \"string\";\n if (method !== null && method !== @undefined && !methodIsString)\n throw new Error(\"ERR_INVALID_ARG_TYPE: options.method\");\n if (methodIsString && method) {\n if (!checkIsHttpToken(method))\n throw new Error(\"ERR_INVALID_HTTP_TOKEN: Method\");\n method = this.#method = StringPrototypeToUpperCase.@call(method);\n } else\n method = this.#method = \"GET\";\n const _maxHeaderSize = options.maxHeaderSize;\n this.#maxHeaderSize = _maxHeaderSize;\n var _joinDuplicateHeaders = options.joinDuplicateHeaders;\n if (this.#joinDuplicateHeaders = _joinDuplicateHeaders, this.#path = options.path || \"/\", cb)\n this.once(\"response\", cb);\n this.#finished = !1, this.#res = null, this.#upgradeOrConnect = !1, this.#parser = null, this.#maxHeadersCount = null, this.#reusedSocket = !1, this.#host = host, this.#protocol = protocol;\n var timeout = options.timeout;\n if (timeout !== @undefined && timeout !== 0)\n this.setTimeout(timeout, @undefined);\n if (!ArrayIsArray(headers)) {\n var headers = options.headers;\n if (headers)\n for (let key in headers)\n this.setHeader(key, headers[key]);\n var auth = options.auth;\n if (auth && !this.getHeader(\"Authorization\"))\n this.setHeader(\"Authorization\", \"Basic \" + @Buffer.from(auth).toString(\"base64\"));\n }\n var { signal: _signal, ...optsWithoutSignal } = options;\n this.#options = optsWithoutSignal;\n }\n setSocketKeepAlive(enable = !0, initialDelay = 0) {\n }\n setNoDelay(noDelay = !0) {\n }\n [kClearTimeout]() {\n if (this.#timeoutTimer)\n clearTimeout(this.#timeoutTimer), this.#timeoutTimer = @undefined, this.removeAllListeners(\"timeout\");\n }\n #onTimeout() {\n this.#timeoutTimer = @undefined, this[kAbortController]\?.abort(), this.emit(\"timeout\");\n }\n setTimeout(msecs, callback) {\n if (this.destroyed)\n return this;\n if (this.timeout = msecs = validateMsecs(msecs, \"msecs\"), clearTimeout(this.#timeoutTimer), msecs === 0) {\n if (callback !== @undefined)\n validateFunction(callback, \"callback\"), this.removeListener(\"timeout\", callback);\n this.#timeoutTimer = @undefined;\n } else if (this.#timeoutTimer = setTimeout(this.#onTimeout.bind(this), msecs).unref(), callback !== @undefined)\n validateFunction(callback, \"callback\"), this.once(\"timeout\", callback);\n return this;\n }\n}\nvar tokenRegExp = /^[\\^_`a-zA-Z\\-0-9!#$%&'*+.|~]+$/, METHODS = [\n \"ACL\",\n \"BIND\",\n \"CHECKOUT\",\n \"CONNECT\",\n \"COPY\",\n \"DELETE\",\n \"GET\",\n \"HEAD\",\n \"LINK\",\n \"LOCK\",\n \"M-SEARCH\",\n \"MERGE\",\n \"MKACTIVITY\",\n \"MKCALENDAR\",\n \"MKCOL\",\n \"MOVE\",\n \"NOTIFY\",\n \"OPTIONS\",\n \"PATCH\",\n \"POST\",\n \"PROPFIND\",\n \"PROPPATCH\",\n \"PURGE\",\n \"PUT\",\n \"REBIND\",\n \"REPORT\",\n \"SEARCH\",\n \"SOURCE\",\n \"SUBSCRIBE\",\n \"TRACE\",\n \"UNBIND\",\n \"UNLINK\",\n \"UNLOCK\",\n \"UNSUBSCRIBE\"\n], STATUS_CODES = {\n 100: \"Continue\",\n 101: \"Switching Protocols\",\n 102: \"Processing\",\n 103: \"Early Hints\",\n 200: \"OK\",\n 201: \"Created\",\n 202: \"Accepted\",\n 203: \"Non-Authoritative Information\",\n 204: \"No Content\",\n 205: \"Reset Content\",\n 206: \"Partial Content\",\n 207: \"Multi-Status\",\n 208: \"Already Reported\",\n 226: \"IM Used\",\n 300: \"Multiple Choices\",\n 301: \"Moved Permanently\",\n 302: \"Found\",\n 303: \"See Other\",\n 304: \"Not Modified\",\n 305: \"Use Proxy\",\n 307: \"Temporary Redirect\",\n 308: \"Permanent Redirect\",\n 400: \"Bad Request\",\n 401: \"Unauthorized\",\n 402: \"Payment Required\",\n 403: \"Forbidden\",\n 404: \"Not Found\",\n 405: \"Method Not Allowed\",\n 406: \"Not Acceptable\",\n 407: \"Proxy Authentication Required\",\n 408: \"Request Timeout\",\n 409: \"Conflict\",\n 410: \"Gone\",\n 411: \"Length Required\",\n 412: \"Precondition Failed\",\n 413: \"Payload Too Large\",\n 414: \"URI Too Long\",\n 415: \"Unsupported Media Type\",\n 416: \"Range Not Satisfiable\",\n 417: \"Expectation Failed\",\n 418: \"I'm a Teapot\",\n 421: \"Misdirected Request\",\n 422: \"Unprocessable Entity\",\n 423: \"Locked\",\n 424: \"Failed Dependency\",\n 425: \"Too Early\",\n 426: \"Upgrade Required\",\n 428: \"Precondition Required\",\n 429: \"Too Many Requests\",\n 431: \"Request Header Fields Too Large\",\n 451: \"Unavailable For Legal Reasons\",\n 500: \"Internal Server Error\",\n 501: \"Not Implemented\",\n 502: \"Bad Gateway\",\n 503: \"Service Unavailable\",\n 504: \"Gateway Timeout\",\n 505: \"HTTP Version Not Supported\",\n 506: \"Variant Also Negotiates\",\n 507: \"Insufficient Storage\",\n 508: \"Loop Detected\",\n 509: \"Bandwidth Limit Exceeded\",\n 510: \"Not Extended\",\n 511: \"Network Authentication Required\"\n}, globalAgent = new Agent;\n$ = {\n Agent,\n Server,\n METHODS,\n STATUS_CODES,\n createServer,\n ServerResponse,\n IncomingMessage,\n request,\n get,\n maxHeaderSize: 16384,\n validateHeaderName,\n validateHeaderValue,\n setMaxIdleHTTPParsers(max) {\n },\n globalAgent,\n ClientRequest,\n OutgoingMessage\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeHttp2Code = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/http2.ts\nvar connect = function() {\n throwNotImplemented(\"node:http2 connect\", 887);\n}, createServer = function() {\n throwNotImplemented(\"node:http2 createServer\", 887);\n}, createSecureServer = function() {\n throwNotImplemented(\"node:http2 createSecureServer\", 887);\n}, getDefaultSettings = function() {\n return {\n headerTableSize: 4096,\n enablePush: !0,\n initialWindowSize: 65535,\n maxFrameSize: 16384,\n maxConcurrentStreams: 4294967295,\n maxHeaderSize: 65535,\n maxHeaderListSize: 65535,\n enableConnectProtocol: !1\n };\n}, getPackedSettings = function() {\n return @Buffer.alloc(0);\n}, getUnpackedSettings = function() {\n return @Buffer.alloc(0);\n}, Http2ServerRequest = function() {\n throwNotImplemented(\"node:http2 Http2ServerRequest\", 887);\n}, Http2ServerResponse = function() {\n throwNotImplemented(\"node:http2 Http2ServerResponse\", 887);\n}, $, { hideFromStack, throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6), constants = {\n NGHTTP2_ERR_FRAME_SIZE_ERROR: -522,\n NGHTTP2_SESSION_SERVER: 0,\n NGHTTP2_SESSION_CLIENT: 1,\n NGHTTP2_STREAM_STATE_IDLE: 1,\n NGHTTP2_STREAM_STATE_OPEN: 2,\n NGHTTP2_STREAM_STATE_RESERVED_LOCAL: 3,\n NGHTTP2_STREAM_STATE_RESERVED_REMOTE: 4,\n NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL: 5,\n NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE: 6,\n NGHTTP2_STREAM_STATE_CLOSED: 7,\n NGHTTP2_FLAG_NONE: 0,\n NGHTTP2_FLAG_END_STREAM: 1,\n NGHTTP2_FLAG_END_HEADERS: 4,\n NGHTTP2_FLAG_ACK: 1,\n NGHTTP2_FLAG_PADDED: 8,\n NGHTTP2_FLAG_PRIORITY: 32,\n DEFAULT_SETTINGS_HEADER_TABLE_SIZE: 4096,\n DEFAULT_SETTINGS_ENABLE_PUSH: 1,\n DEFAULT_SETTINGS_MAX_CONCURRENT_STREAMS: 4294967295,\n DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE: 65535,\n DEFAULT_SETTINGS_MAX_FRAME_SIZE: 16384,\n DEFAULT_SETTINGS_MAX_HEADER_LIST_SIZE: 65535,\n DEFAULT_SETTINGS_ENABLE_CONNECT_PROTOCOL: 0,\n MAX_MAX_FRAME_SIZE: 16777215,\n MIN_MAX_FRAME_SIZE: 16384,\n MAX_INITIAL_WINDOW_SIZE: 2147483647,\n NGHTTP2_SETTINGS_HEADER_TABLE_SIZE: 1,\n NGHTTP2_SETTINGS_ENABLE_PUSH: 2,\n NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS: 3,\n NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE: 4,\n NGHTTP2_SETTINGS_MAX_FRAME_SIZE: 5,\n NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: 6,\n NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL: 8,\n PADDING_STRATEGY_NONE: 0,\n PADDING_STRATEGY_ALIGNED: 1,\n PADDING_STRATEGY_MAX: 2,\n PADDING_STRATEGY_CALLBACK: 1,\n NGHTTP2_NO_ERROR: 0,\n NGHTTP2_PROTOCOL_ERROR: 1,\n NGHTTP2_INTERNAL_ERROR: 2,\n NGHTTP2_FLOW_CONTROL_ERROR: 3,\n NGHTTP2_SETTINGS_TIMEOUT: 4,\n NGHTTP2_STREAM_CLOSED: 5,\n NGHTTP2_FRAME_SIZE_ERROR: 6,\n NGHTTP2_REFUSED_STREAM: 7,\n NGHTTP2_CANCEL: 8,\n NGHTTP2_COMPRESSION_ERROR: 9,\n NGHTTP2_CONNECT_ERROR: 10,\n NGHTTP2_ENHANCE_YOUR_CALM: 11,\n NGHTTP2_INADEQUATE_SECURITY: 12,\n NGHTTP2_HTTP_1_1_REQUIRED: 13,\n NGHTTP2_DEFAULT_WEIGHT: 16,\n HTTP2_HEADER_STATUS: \":status\",\n HTTP2_HEADER_METHOD: \":method\",\n HTTP2_HEADER_AUTHORITY: \":authority\",\n HTTP2_HEADER_SCHEME: \":scheme\",\n HTTP2_HEADER_PATH: \":path\",\n HTTP2_HEADER_PROTOCOL: \":protocol\",\n HTTP2_HEADER_ACCEPT_ENCODING: \"accept-encoding\",\n HTTP2_HEADER_ACCEPT_LANGUAGE: \"accept-language\",\n HTTP2_HEADER_ACCEPT_RANGES: \"accept-ranges\",\n HTTP2_HEADER_ACCEPT: \"accept\",\n HTTP2_HEADER_ACCESS_CONTROL_ALLOW_CREDENTIALS: \"access-control-allow-credentials\",\n HTTP2_HEADER_ACCESS_CONTROL_ALLOW_HEADERS: \"access-control-allow-headers\",\n HTTP2_HEADER_ACCESS_CONTROL_ALLOW_METHODS: \"access-control-allow-methods\",\n HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN: \"access-control-allow-origin\",\n HTTP2_HEADER_ACCESS_CONTROL_EXPOSE_HEADERS: \"access-control-expose-headers\",\n HTTP2_HEADER_ACCESS_CONTROL_REQUEST_HEADERS: \"access-control-request-headers\",\n HTTP2_HEADER_ACCESS_CONTROL_REQUEST_METHOD: \"access-control-request-method\",\n HTTP2_HEADER_AGE: \"age\",\n HTTP2_HEADER_AUTHORIZATION: \"authorization\",\n HTTP2_HEADER_CACHE_CONTROL: \"cache-control\",\n HTTP2_HEADER_CONNECTION: \"connection\",\n HTTP2_HEADER_CONTENT_DISPOSITION: \"content-disposition\",\n HTTP2_HEADER_CONTENT_ENCODING: \"content-encoding\",\n HTTP2_HEADER_CONTENT_LENGTH: \"content-length\",\n HTTP2_HEADER_CONTENT_TYPE: \"content-type\",\n HTTP2_HEADER_COOKIE: \"cookie\",\n HTTP2_HEADER_DATE: \"date\",\n HTTP2_HEADER_ETAG: \"etag\",\n HTTP2_HEADER_FORWARDED: \"forwarded\",\n HTTP2_HEADER_HOST: \"host\",\n HTTP2_HEADER_IF_MODIFIED_SINCE: \"if-modified-since\",\n HTTP2_HEADER_IF_NONE_MATCH: \"if-none-match\",\n HTTP2_HEADER_IF_RANGE: \"if-range\",\n HTTP2_HEADER_LAST_MODIFIED: \"last-modified\",\n HTTP2_HEADER_LINK: \"link\",\n HTTP2_HEADER_LOCATION: \"location\",\n HTTP2_HEADER_RANGE: \"range\",\n HTTP2_HEADER_REFERER: \"referer\",\n HTTP2_HEADER_SERVER: \"server\",\n HTTP2_HEADER_SET_COOKIE: \"set-cookie\",\n HTTP2_HEADER_STRICT_TRANSPORT_SECURITY: \"strict-transport-security\",\n HTTP2_HEADER_TRANSFER_ENCODING: \"transfer-encoding\",\n HTTP2_HEADER_TE: \"te\",\n HTTP2_HEADER_UPGRADE_INSECURE_REQUESTS: \"upgrade-insecure-requests\",\n HTTP2_HEADER_UPGRADE: \"upgrade\",\n HTTP2_HEADER_USER_AGENT: \"user-agent\",\n HTTP2_HEADER_VARY: \"vary\",\n HTTP2_HEADER_X_CONTENT_TYPE_OPTIONS: \"x-content-type-options\",\n HTTP2_HEADER_X_FRAME_OPTIONS: \"x-frame-options\",\n HTTP2_HEADER_KEEP_ALIVE: \"keep-alive\",\n HTTP2_HEADER_PROXY_CONNECTION: \"proxy-connection\",\n HTTP2_HEADER_X_XSS_PROTECTION: \"x-xss-protection\",\n HTTP2_HEADER_ALT_SVC: \"alt-svc\",\n HTTP2_HEADER_CONTENT_SECURITY_POLICY: \"content-security-policy\",\n HTTP2_HEADER_EARLY_DATA: \"early-data\",\n HTTP2_HEADER_EXPECT_CT: \"expect-ct\",\n HTTP2_HEADER_ORIGIN: \"origin\",\n HTTP2_HEADER_PURPOSE: \"purpose\",\n HTTP2_HEADER_TIMING_ALLOW_ORIGIN: \"timing-allow-origin\",\n HTTP2_HEADER_X_FORWARDED_FOR: \"x-forwarded-for\",\n HTTP2_HEADER_PRIORITY: \"priority\",\n HTTP2_HEADER_ACCEPT_CHARSET: \"accept-charset\",\n HTTP2_HEADER_ACCESS_CONTROL_MAX_AGE: \"access-control-max-age\",\n HTTP2_HEADER_ALLOW: \"allow\",\n HTTP2_HEADER_CONTENT_LANGUAGE: \"content-language\",\n HTTP2_HEADER_CONTENT_LOCATION: \"content-location\",\n HTTP2_HEADER_CONTENT_MD5: \"content-md5\",\n HTTP2_HEADER_CONTENT_RANGE: \"content-range\",\n HTTP2_HEADER_DNT: \"dnt\",\n HTTP2_HEADER_EXPECT: \"expect\",\n HTTP2_HEADER_EXPIRES: \"expires\",\n HTTP2_HEADER_FROM: \"from\",\n HTTP2_HEADER_IF_MATCH: \"if-match\",\n HTTP2_HEADER_IF_UNMODIFIED_SINCE: \"if-unmodified-since\",\n HTTP2_HEADER_MAX_FORWARDS: \"max-forwards\",\n HTTP2_HEADER_PREFER: \"prefer\",\n HTTP2_HEADER_PROXY_AUTHENTICATE: \"proxy-authenticate\",\n HTTP2_HEADER_PROXY_AUTHORIZATION: \"proxy-authorization\",\n HTTP2_HEADER_REFRESH: \"refresh\",\n HTTP2_HEADER_RETRY_AFTER: \"retry-after\",\n HTTP2_HEADER_TRAILER: \"trailer\",\n HTTP2_HEADER_TK: \"tk\",\n HTTP2_HEADER_VIA: \"via\",\n HTTP2_HEADER_WARNING: \"warning\",\n HTTP2_HEADER_WWW_AUTHENTICATE: \"www-authenticate\",\n HTTP2_HEADER_HTTP2_SETTINGS: \"http2-settings\",\n HTTP2_METHOD_ACL: \"ACL\",\n HTTP2_METHOD_BASELINE_CONTROL: \"BASELINE-CONTROL\",\n HTTP2_METHOD_BIND: \"BIND\",\n HTTP2_METHOD_CHECKIN: \"CHECKIN\",\n HTTP2_METHOD_CHECKOUT: \"CHECKOUT\",\n HTTP2_METHOD_CONNECT: \"CONNECT\",\n HTTP2_METHOD_COPY: \"COPY\",\n HTTP2_METHOD_DELETE: \"DELETE\",\n HTTP2_METHOD_GET: \"GET\",\n HTTP2_METHOD_HEAD: \"HEAD\",\n HTTP2_METHOD_LABEL: \"LABEL\",\n HTTP2_METHOD_LINK: \"LINK\",\n HTTP2_METHOD_LOCK: \"LOCK\",\n HTTP2_METHOD_MERGE: \"MERGE\",\n HTTP2_METHOD_MKACTIVITY: \"MKACTIVITY\",\n HTTP2_METHOD_MKCALENDAR: \"MKCALENDAR\",\n HTTP2_METHOD_MKCOL: \"MKCOL\",\n HTTP2_METHOD_MKREDIRECTREF: \"MKREDIRECTREF\",\n HTTP2_METHOD_MKWORKSPACE: \"MKWORKSPACE\",\n HTTP2_METHOD_MOVE: \"MOVE\",\n HTTP2_METHOD_OPTIONS: \"OPTIONS\",\n HTTP2_METHOD_ORDERPATCH: \"ORDERPATCH\",\n HTTP2_METHOD_PATCH: \"PATCH\",\n HTTP2_METHOD_POST: \"POST\",\n HTTP2_METHOD_PRI: \"PRI\",\n HTTP2_METHOD_PROPFIND: \"PROPFIND\",\n HTTP2_METHOD_PROPPATCH: \"PROPPATCH\",\n HTTP2_METHOD_PUT: \"PUT\",\n HTTP2_METHOD_REBIND: \"REBIND\",\n HTTP2_METHOD_REPORT: \"REPORT\",\n HTTP2_METHOD_SEARCH: \"SEARCH\",\n HTTP2_METHOD_TRACE: \"TRACE\",\n HTTP2_METHOD_UNBIND: \"UNBIND\",\n HTTP2_METHOD_UNCHECKOUT: \"UNCHECKOUT\",\n HTTP2_METHOD_UNLINK: \"UNLINK\",\n HTTP2_METHOD_UNLOCK: \"UNLOCK\",\n HTTP2_METHOD_UPDATE: \"UPDATE\",\n HTTP2_METHOD_UPDATEREDIRECTREF: \"UPDATEREDIRECTREF\",\n HTTP2_METHOD_VERSION_CONTROL: \"VERSION-CONTROL\",\n HTTP_STATUS_CONTINUE: 100,\n HTTP_STATUS_SWITCHING_PROTOCOLS: 101,\n HTTP_STATUS_PROCESSING: 102,\n HTTP_STATUS_EARLY_HINTS: 103,\n HTTP_STATUS_OK: 200,\n HTTP_STATUS_CREATED: 201,\n HTTP_STATUS_ACCEPTED: 202,\n HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION: 203,\n HTTP_STATUS_NO_CONTENT: 204,\n HTTP_STATUS_RESET_CONTENT: 205,\n HTTP_STATUS_PARTIAL_CONTENT: 206,\n HTTP_STATUS_MULTI_STATUS: 207,\n HTTP_STATUS_ALREADY_REPORTED: 208,\n HTTP_STATUS_IM_USED: 226,\n HTTP_STATUS_MULTIPLE_CHOICES: 300,\n HTTP_STATUS_MOVED_PERMANENTLY: 301,\n HTTP_STATUS_FOUND: 302,\n HTTP_STATUS_SEE_OTHER: 303,\n HTTP_STATUS_NOT_MODIFIED: 304,\n HTTP_STATUS_USE_PROXY: 305,\n HTTP_STATUS_TEMPORARY_REDIRECT: 307,\n HTTP_STATUS_PERMANENT_REDIRECT: 308,\n HTTP_STATUS_BAD_REQUEST: 400,\n HTTP_STATUS_UNAUTHORIZED: 401,\n HTTP_STATUS_PAYMENT_REQUIRED: 402,\n HTTP_STATUS_FORBIDDEN: 403,\n HTTP_STATUS_NOT_FOUND: 404,\n HTTP_STATUS_METHOD_NOT_ALLOWED: 405,\n HTTP_STATUS_NOT_ACCEPTABLE: 406,\n HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED: 407,\n HTTP_STATUS_REQUEST_TIMEOUT: 408,\n HTTP_STATUS_CONFLICT: 409,\n HTTP_STATUS_GONE: 410,\n HTTP_STATUS_LENGTH_REQUIRED: 411,\n HTTP_STATUS_PRECONDITION_FAILED: 412,\n HTTP_STATUS_PAYLOAD_TOO_LARGE: 413,\n HTTP_STATUS_URI_TOO_LONG: 414,\n HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE: 415,\n HTTP_STATUS_RANGE_NOT_SATISFIABLE: 416,\n HTTP_STATUS_EXPECTATION_FAILED: 417,\n HTTP_STATUS_TEAPOT: 418,\n HTTP_STATUS_MISDIRECTED_REQUEST: 421,\n HTTP_STATUS_UNPROCESSABLE_ENTITY: 422,\n HTTP_STATUS_LOCKED: 423,\n HTTP_STATUS_FAILED_DEPENDENCY: 424,\n HTTP_STATUS_TOO_EARLY: 425,\n HTTP_STATUS_UPGRADE_REQUIRED: 426,\n HTTP_STATUS_PRECONDITION_REQUIRED: 428,\n HTTP_STATUS_TOO_MANY_REQUESTS: 429,\n HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE: 431,\n HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS: 451,\n HTTP_STATUS_INTERNAL_SERVER_ERROR: 500,\n HTTP_STATUS_NOT_IMPLEMENTED: 501,\n HTTP_STATUS_BAD_GATEWAY: 502,\n HTTP_STATUS_SERVICE_UNAVAILABLE: 503,\n HTTP_STATUS_GATEWAY_TIMEOUT: 504,\n HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED: 505,\n HTTP_STATUS_VARIANT_ALSO_NEGOTIATES: 506,\n HTTP_STATUS_INSUFFICIENT_STORAGE: 507,\n HTTP_STATUS_LOOP_DETECTED: 508,\n HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED: 509,\n HTTP_STATUS_NOT_EXTENDED: 510,\n HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED: 511\n}, sensitiveHeaders = Symbol.for(\"nodejs.http2.sensitiveHeaders\");\nHttp2ServerRequest.prototype = {};\nHttp2ServerResponse.prototype = {};\n$ = {\n constants,\n createServer,\n createSecureServer,\n getDefaultSettings,\n getPackedSettings,\n getUnpackedSettings,\n sensitiveHeaders,\n Http2ServerRequest,\n Http2ServerResponse,\n connect\n};\nhideFromStack([\n Http2ServerRequest,\n Http2ServerResponse,\n connect,\n createServer,\n createSecureServer,\n getDefaultSettings,\n getPackedSettings,\n getUnpackedSettings\n]);\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeHttpsCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/https.ts\nvar request = function(input, options, cb) {\n if (input && typeof input === \"object\" && !(input instanceof URL))\n input.protocol \?\?= \"https:\";\n else if (typeof options === \"object\")\n options.protocol \?\?= \"https:\";\n return http.request(input, options, cb);\n}, get = function(input, options, cb) {\n const req = request(input, options, cb);\n return req.end(), req;\n}, $, http = @getInternalField(@internalModuleRegistry, 23) || @createInternalModuleById(23);\n$ = {\n ...http,\n get,\n request\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeInspectorCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/inspector.ts\nvar open = function() {\n throwNotImplemented(\"node:inspector open\", 2445);\n}, close = function() {\n throwNotImplemented(\"node:inspector close\", 2445);\n}, url = function() {\n throwNotImplemented(\"node:inspector url\", 2445);\n}, waitForDebugger = function() {\n throwNotImplemented(\"node:inspector waitForDebugger\", 2445);\n}, $, { hideFromStack, throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6), EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20);\n\nclass Session extends EventEmitter {\n constructor() {\n super();\n throwNotImplemented(\"node:inspector Session\", 2445);\n }\n}\nvar console = {\n ...globalThis.console,\n context: {\n console: globalThis.console\n }\n};\n$ = {\n console,\n open,\n close,\n url,\n waitForDebugger,\n Session\n};\nhideFromStack(open, close, url, waitForDebugger, Session.prototype.constructor);\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeNetCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/net.ts\nvar isIPv4 = function(s) {\n return IPv4Reg.test(s);\n}, isIPv6 = function(s) {\n return IPv6Reg.test(s);\n}, isIP = function(s) {\n if (isIPv4(s))\n return 4;\n if (isIPv6(s))\n return 6;\n return 0;\n}, closeNT = function(self) {\n self.emit(\"close\");\n}, endNT = function(socket, callback, err) {\n socket.end(), callback(err);\n}, createConnection = function(port, host, connectListener) {\n if (typeof port === \"object\")\n return new Socket(port).connect(port, host, connectListener);\n return new Socket().connect(port, host, connectListener);\n}, emitErrorNextTick = function(self, error) {\n self.emit(\"error\", error);\n}, emitErrorAndCloseNextTick = function(self, error) {\n self.emit(\"error\", error), self.emit(\"close\");\n}, emitListeningNextTick = function(self, onListen) {\n if (typeof onListen === \"function\")\n try {\n onListen();\n } catch (err) {\n self.emit(\"error\", err);\n }\n self.emit(\"listening\");\n}, createServer = function(options, connectionListener) {\n return new Server(options, connectionListener);\n}, $, { Duplex } = @getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39), EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20);\nvar IPv4Reg = new @RegExp(\"^((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$\");\nvar IPv6Reg = new @RegExp(\"^((\?:(\?:[0-9a-fA-F]{1,4}):){7}(\?:(\?:[0-9a-fA-F]{1,4})|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){6}(\?:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|:(\?:[0-9a-fA-F]{1,4})|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){5}(\?::((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,2}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){4}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,1}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,3}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){3}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,2}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,4}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){2}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,3}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,5}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){1}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,4}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,6}|:)|(\?::((\?::(\?:[0-9a-fA-F]{1,4})){0,5}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(\?::(\?:[0-9a-fA-F]{1,4})){1,7}|:)))(%[0-9a-zA-Z-.:]{1,})\?$\"), { connect: bunConnect } = Bun, { setTimeout } = globalThis, bunTlsSymbol = Symbol.for(\"::buntls::\"), bunSocketServerHandlers = Symbol.for(\"::bunsocket_serverhandlers::\"), bunSocketServerConnections = Symbol.for(\"::bunnetserverconnections::\"), bunSocketServerOptions = Symbol.for(\"::bunnetserveroptions::\"), bunSocketInternal = Symbol.for(\"::bunnetsocketinternal::\"), bunTLSConnectOptions = Symbol.for(\"::buntlsconnectoptions::\"), SocketClass, Socket = function(InternalSocket) {\n SocketClass = InternalSocket, Object.defineProperty(SocketClass.prototype, Symbol.toStringTag, {\n value: \"Socket\",\n enumerable: !1\n });\n function Socket3(options) {\n return new InternalSocket(options);\n }\n return Socket3.prototype = InternalSocket.prototype, Object.defineProperty(Socket3, Symbol.hasInstance, {\n value(instance) {\n return instance instanceof InternalSocket;\n }\n });\n}(class Socket2 extends Duplex {\n static #Handlers = {\n close: Socket2.#Close,\n data({ data: self }, buffer) {\n self.bytesRead += buffer.length;\n const queue = self.#readQueue;\n if (queue.isEmpty()) {\n if (self.push(buffer))\n return;\n }\n queue.push(buffer);\n },\n drain: Socket2.#Drain,\n end: Socket2.#Close,\n error(socket, error) {\n const self = socket.data, callback = self.#writeCallback;\n if (callback)\n self.#writeCallback = null, callback(error);\n self.emit(\"error\", error);\n },\n open(socket) {\n const self = socket.data;\n socket.timeout(self.timeout), socket.ref(), self[bunSocketInternal] = socket, self.connecting = !1;\n const options = self[bunTLSConnectOptions];\n if (options) {\n const { session } = options;\n if (session)\n self.setSession(session);\n }\n if (!self.#upgraded)\n self.emit(\"connect\", self);\n Socket2.#Drain(socket);\n },\n handshake(socket, success, verifyError) {\n const { data: self } = socket;\n self._securePending = !1, self.secureConnecting = !1, self._secureEstablished = !!success, self.emit(\"secure\", self);\n const { checkServerIdentity } = self[bunTLSConnectOptions];\n if (!verifyError && typeof checkServerIdentity === \"function\" && self.servername) {\n const cert = self.getPeerCertificate(!0);\n verifyError = checkServerIdentity(self.servername, cert);\n }\n if (self._requestCert || self._rejectUnauthorized) {\n if (verifyError) {\n if (self.authorized = !1, self.authorizationError = verifyError.code || verifyError.message, self._rejectUnauthorized) {\n self.destroy(verifyError);\n return;\n }\n }\n } else\n self.authorized = !0;\n self.emit(\"secureConnect\", verifyError);\n },\n timeout(socket) {\n const self = socket.data;\n self.emit(\"timeout\", self);\n },\n binaryType: \"buffer\"\n };\n static #Close(socket) {\n const self = socket.data;\n if (self.#closed)\n return;\n self.#closed = !0, self[bunSocketInternal] = null;\n const queue = self.#readQueue;\n if (queue.isEmpty()) {\n if (self.push(null))\n return;\n }\n queue.push(null);\n }\n static #Drain(socket) {\n const self = socket.data, callback = self.#writeCallback;\n if (callback) {\n const chunk = self.#writeChunk, written = socket.write(chunk);\n if (self.bytesWritten += written, written < chunk.length)\n self.#writeChunk = chunk.slice(written);\n else\n self.#writeCallback = null, self.#writeChunk = null, callback(null);\n }\n }\n static [bunSocketServerHandlers] = {\n data: Socket2.#Handlers.data,\n close(socket) {\n Socket2.#Handlers.close(socket), this.data[bunSocketServerConnections]--;\n },\n end(socket) {\n Socket2.#Handlers.end(socket), this.data[bunSocketServerConnections]--;\n },\n open(socket) {\n const self = this.data, options = self[bunSocketServerOptions], { pauseOnConnect, connectionListener, InternalSocketClass, requestCert, rejectUnauthorized } = options, _socket = new InternalSocketClass({});\n if (_socket.isServer = !0, _socket._requestCert = requestCert, _socket._rejectUnauthorized = rejectUnauthorized, _socket.#attach(this.localPort, socket), self.maxConnections && self[bunSocketServerConnections] >= self.maxConnections) {\n const data = {\n localAddress: _socket.localAddress,\n localPort: _socket.localPort,\n localFamily: _socket.localFamily,\n remoteAddress: _socket.remoteAddress,\n remotePort: _socket.remotePort,\n remoteFamily: _socket.remoteFamily || \"IPv4\"\n };\n socket.end(), self.emit(\"drop\", data);\n return;\n }\n if (!pauseOnConnect)\n _socket.resume();\n if (self[bunSocketServerConnections]++, typeof connectionListener == \"function\")\n if (InternalSocketClass.name === \"TLSSocket\")\n self.once(\"secureConnection\", () => connectionListener(_socket));\n else\n connectionListener(_socket);\n self.emit(\"connection\", _socket);\n },\n handshake(socket, success, verifyError) {\n const { data: self } = socket;\n if (self.emit(\"secure\", self), self._securePending = !1, self.secureConnecting = !1, self._secureEstablished = !!success, self._requestCert || self._rejectUnauthorized) {\n if (verifyError) {\n if (self.authorized = !1, self.authorizationError = verifyError.code || verifyError.message, self._rejectUnauthorized) {\n self.destroy(verifyError);\n return;\n }\n }\n } else\n self.authorized = !0;\n self.emit(\"secureConnection\", verifyError);\n },\n error(socket, error) {\n Socket2.#Handlers.error(socket, error), this.data.emit(\"error\", error);\n },\n timeout: Socket2.#Handlers.timeout,\n connectError: Socket2.#Handlers.connectError,\n drain: Socket2.#Handlers.drain,\n binaryType: \"buffer\"\n };\n bytesRead = 0;\n bytesWritten = 0;\n #closed = !1;\n connecting = !1;\n localAddress = \"127.0.0.1\";\n #readQueue = @createFIFO();\n remotePort;\n [bunSocketInternal] = null;\n [bunTLSConnectOptions] = null;\n timeout = 0;\n #writeCallback;\n #writeChunk;\n #pendingRead;\n isServer = !1;\n _handle;\n _parent;\n _parentWrap;\n #socket;\n #upgraded;\n constructor(options) {\n const { socket, signal, write, read, allowHalfOpen = !1, ...opts } = options || {};\n super({\n ...opts,\n allowHalfOpen,\n readable: !0,\n writable: !0\n });\n if (this._handle = this, this._parent = this, this._parentWrap = this, this.#pendingRead = @undefined, this.#upgraded = null, socket instanceof Socket2)\n this.#socket = socket;\n signal\?.once(\"abort\", () => this.destroy()), this.once(\"connect\", () => this.emit(\"ready\"));\n }\n address() {\n return {\n address: this.localAddress,\n family: this.localFamily,\n port: this.localPort\n };\n }\n get bufferSize() {\n return this.writableLength;\n }\n #attach(port, socket) {\n if (this.remotePort = port, socket.data = this, socket.timeout(this.timeout), socket.ref(), this[bunSocketInternal] = socket, this.connecting = !1, !this.#upgraded)\n this.emit(\"connect\", this);\n Socket2.#Drain(socket);\n }\n #closeRawConnection() {\n const connection = this.#upgraded;\n connection[bunSocketInternal] = null, connection.unref(), connection.destroy(), process.nextTick(closeNT, connection);\n }\n connect(port, host, connectListener) {\n var path, connection = this.#socket, _checkServerIdentity = @undefined;\n if (typeof port === \"string\") {\n if (path = port, port = @undefined, typeof host === \"function\")\n connectListener = host, host = @undefined;\n } else if (typeof host == \"function\") {\n if (typeof port === \"string\")\n path = port, port = @undefined;\n connectListener = host, host = @undefined;\n }\n if (typeof port == \"object\") {\n var {\n port,\n host,\n path,\n socket,\n localAddress,\n localPort,\n family,\n hints,\n lookup,\n noDelay,\n keepAlive,\n keepAliveInitialDelay,\n requestCert,\n rejectUnauthorized,\n pauseOnConnect,\n servername,\n checkServerIdentity,\n session\n } = port;\n if (_checkServerIdentity = checkServerIdentity, this.servername = servername, socket)\n connection = socket;\n }\n if (!pauseOnConnect)\n this.resume();\n this.connecting = !0, this.remotePort = port;\n const bunTLS = this[bunTlsSymbol];\n var tls = @undefined;\n if (typeof bunTLS === \"function\") {\n if (tls = bunTLS.@call(this, port, host, !0), this._requestCert = !0, this._rejectUnauthorized = rejectUnauthorized, tls) {\n if (tls.rejectUnauthorized = rejectUnauthorized, tls.requestCert = !0, tls.session = session || tls.session, this.servername = tls.servername, tls.checkServerIdentity = _checkServerIdentity || tls.checkServerIdentity, this[bunTLSConnectOptions] = tls, !connection && tls.socket)\n connection = tls.socket;\n }\n if (connection) {\n if (typeof connection !== \"object\" || !(connection instanceof Socket2) || typeof connection[bunTlsSymbol] === \"function\")\n @throwTypeError(\"socket must be an instance of net.Socket\");\n }\n if (this.authorized = !1, this.secureConnecting = !0, this._secureEstablished = !1, this._securePending = !0, connectListener)\n this.on(\"secureConnect\", connectListener);\n } else if (connectListener)\n this.on(\"connect\", connectListener);\n try {\n if (connection) {\n const socket2 = connection[bunSocketInternal];\n if (socket2) {\n this.connecting = !0, this.#upgraded = connection;\n const result = socket2.upgradeTLS({\n data: this,\n tls,\n socket: Socket2.#Handlers\n });\n if (result) {\n const [raw, tls2] = result;\n connection[bunSocketInternal] = raw, raw.timeout(raw.timeout), this.once(\"end\", this.#closeRawConnection), raw.connecting = !1, this[bunSocketInternal] = tls2;\n } else\n throw this[bunSocketInternal] = null, new Error(\"Invalid socket\");\n } else\n connection.once(\"connect\", () => {\n const socket3 = connection[bunSocketInternal];\n if (!socket3)\n return;\n this.connecting = !0, this.#upgraded = connection;\n const result = socket3.upgradeTLS({\n data: this,\n tls,\n socket: Socket2.#Handlers\n });\n if (result) {\n const [raw, tls2] = result;\n connection[bunSocketInternal] = raw, raw.timeout(raw.timeout), this.once(\"end\", this.#closeRawConnection), raw.connecting = !1, this[bunSocketInternal] = tls2;\n } else\n throw this[bunSocketInternal] = null, new Error(\"Invalid socket\");\n });\n } else if (path)\n bunConnect({\n data: this,\n unix: path,\n socket: Socket2.#Handlers,\n tls\n }).catch((error) => {\n this.emit(\"error\", error), this.emit(\"close\");\n });\n else\n bunConnect({\n data: this,\n hostname: host || \"localhost\",\n port,\n socket: Socket2.#Handlers,\n tls\n }).catch((error) => {\n this.emit(\"error\", error), this.emit(\"close\");\n });\n } catch (error) {\n process.nextTick(emitErrorAndCloseNextTick, this, error);\n }\n return this;\n }\n _destroy(err, callback) {\n const socket = this[bunSocketInternal];\n socket && process.nextTick(endNT, socket, callback, err);\n }\n _final(callback) {\n this[bunSocketInternal]\?.end(), callback(), process.nextTick(closeNT, this);\n }\n get localAddress() {\n return \"127.0.0.1\";\n }\n get localFamily() {\n return \"IPv4\";\n }\n get localPort() {\n return this[bunSocketInternal]\?.localPort;\n }\n get pending() {\n return this.connecting;\n }\n _read(size) {\n const queue = this.#readQueue;\n let chunk;\n while (chunk = queue.peek()) {\n const can_continue = !this.push(chunk);\n if (queue.shift(), !can_continue)\n break;\n }\n }\n get readyState() {\n if (this.connecting)\n return \"opening\";\n if (this.readable)\n return this.writable \? \"open\" : \"readOnly\";\n else\n return this.writable \? \"writeOnly\" : \"closed\";\n }\n ref() {\n this[bunSocketInternal]\?.ref();\n }\n get remoteAddress() {\n return this[bunSocketInternal]\?.remoteAddress;\n }\n get remoteFamily() {\n return \"IPv4\";\n }\n resetAndDestroy() {\n this[bunSocketInternal]\?.end();\n }\n setKeepAlive(enable = !1, initialDelay = 0) {\n return this;\n }\n setNoDelay(noDelay = !0) {\n return this;\n }\n setTimeout(timeout, callback) {\n if (this[bunSocketInternal]\?.timeout(timeout), this.timeout = timeout, callback)\n this.once(\"timeout\", callback);\n return this;\n }\n unref() {\n this[bunSocketInternal]\?.unref();\n }\n _write(chunk, encoding, callback) {\n if (typeof chunk == \"string\" && encoding !== \"ascii\")\n chunk = @Buffer.from(chunk, encoding);\n var written = this[bunSocketInternal]\?.write(chunk);\n if (written == chunk.length)\n callback();\n else if (this.#writeCallback)\n callback(new Error(\"overlapping _write()\"));\n else {\n if (written > 0)\n if (typeof chunk == \"string\")\n chunk = chunk.slice(written);\n else\n chunk = chunk.subarray(written);\n this.#writeCallback = callback, this.#writeChunk = chunk;\n }\n }\n}), connect = createConnection;\n\nclass Server extends EventEmitter {\n #server;\n #listening = !1;\n [bunSocketServerConnections] = 0;\n [bunSocketServerOptions];\n maxConnections = 0;\n constructor(options, connectionListener) {\n super();\n if (typeof options === \"function\")\n connectionListener = options, options = {};\n else if (options == null || typeof options === \"object\")\n options = { ...options };\n else\n throw new Error(\"bun-net-polyfill: invalid arguments\");\n const { maxConnections } = options;\n this.maxConnections = Number.isSafeInteger(maxConnections) && maxConnections > 0 \? maxConnections : 0, options.connectionListener = connectionListener, this[bunSocketServerOptions] = options;\n }\n ref() {\n return this.#server\?.ref(), this;\n }\n unref() {\n return this.#server\?.unref(), this;\n }\n close(callback) {\n if (this.#server) {\n if (this.#server.stop(!0), this.#server = null, this.#listening = !1, this[bunSocketServerConnections] = 0, this.emit(\"close\"), typeof callback === \"function\")\n callback();\n return this;\n }\n if (typeof callback === \"function\") {\n const error = new Error(\"Server is not running\");\n error.code = \"ERR_SERVER_NOT_RUNNING\", callback(error);\n }\n return this;\n }\n address() {\n const server = this.#server;\n if (server) {\n const unix = server.unix;\n if (unix)\n return unix;\n let address = server.hostname;\n const type = isIP(address), port = server.port;\n if (typeof port === \"number\")\n return {\n port,\n address,\n family: type \? `IPv${type}` : @undefined\n };\n if (type)\n return {\n address,\n family: type \? `IPv${type}` : @undefined\n };\n return address;\n }\n return null;\n }\n getConnections(callback) {\n if (typeof callback === \"function\")\n callback(null, this.#server \? this[bunSocketServerConnections] : 0);\n return this;\n }\n listen(port, hostname, onListen) {\n let backlog, path, exclusive = !1;\n if (typeof port === \"string\") {\n if (Number.isSafeInteger(hostname)) {\n if (hostname > 0)\n backlog = hostname;\n } else if (typeof hostname === \"function\")\n onListen = hostname;\n path = port, hostname = @undefined, port = @undefined;\n } else {\n if (typeof hostname === \"function\")\n onListen = hostname, hostname = @undefined;\n if (typeof port === \"function\")\n onListen = port, port = 0;\n else if (typeof port === \"object\") {\n const options = port;\n options.signal\?.addEventListener(\"abort\", () => this.close()), hostname = options.host, exclusive = options.exclusive === !0;\n const path2 = options.path;\n if (port = options.port, !Number.isSafeInteger(port) || port < 0)\n if (path2)\n hostname = path2, port = @undefined;\n else {\n let message = 'The argument \\'options\\' must have the property \"port\" or \"path\"';\n try {\n message = `${message}. Received ${JSON.stringify(options)}`;\n } catch {\n }\n const error = @makeTypeError(message);\n throw error.code = \"ERR_INVALID_ARG_VALUE\", error;\n }\n else if (!Number.isSafeInteger(port) || port < 0)\n port = 0;\n if (typeof port.callback === \"function\")\n onListen = port\?.callback;\n } else if (!Number.isSafeInteger(port) || port < 0)\n port = 0;\n hostname = hostname || \"::\";\n }\n try {\n var tls = @undefined, TLSSocketClass = @undefined;\n const bunTLS = this[bunTlsSymbol], options = this[bunSocketServerOptions];\n if (typeof bunTLS === \"function\")\n [tls, TLSSocketClass] = bunTLS.@call(this, port, hostname, !1), options.servername = tls.serverName, options.InternalSocketClass = TLSSocketClass;\n else\n options.InternalSocketClass = SocketClass;\n this.#server = Bun.listen(path \? {\n exclusive,\n unix: path,\n tls,\n socket: SocketClass[bunSocketServerHandlers]\n } : {\n exclusive,\n port,\n hostname,\n tls,\n socket: SocketClass[bunSocketServerHandlers]\n }), this.#server.data = this, this.#listening = !0, setTimeout(emitListeningNextTick, 1, this, onListen);\n } catch (err) {\n this.#listening = !1, setTimeout(emitErrorNextTick, 1, this, err);\n }\n return this;\n }\n}\n$ = {\n createServer,\n Server,\n createConnection,\n connect,\n isIP,\n isIPv4,\n isIPv6,\n Socket,\n [Symbol.for(\"::bunternal::\")]: SocketClass\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeOSCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/os.ts\nvar lazyCpus = function({ cpus }) {\n return () => {\n const array = new @Array(navigator.hardwareConcurrency);\n function populate() {\n const results = cpus(), length = results.length;\n array.length = length;\n for (let i = 0;i < length; i++)\n array[i] = results[i];\n }\n for (let i = 0;i < array.length; i++) {\n const instance = {\n get model() {\n if (array[i] === instance)\n populate();\n return array[i].model;\n },\n set model(value) {\n if (array[i] === instance)\n populate();\n array[i].model = value;\n },\n get speed() {\n if (array[i] === instance)\n populate();\n return array[i].speed;\n },\n set speed(value) {\n if (array[i] === instance)\n populate();\n array[i].speed = value;\n },\n get times() {\n if (array[i] === instance)\n populate();\n return array[i].times;\n },\n set times(value) {\n if (array[i] === instance)\n populate();\n array[i].times = value;\n },\n toJSON() {\n if (array[i] === instance)\n populate();\n return array[i];\n }\n };\n array[i] = instance;\n }\n return array;\n };\n}, bound = function(obj) {\n return {\n availableParallelism: () => {\n return navigator.hardwareConcurrency;\n },\n arch: obj.arch.bind(obj),\n cpus: lazyCpus(obj),\n endianness: obj.endianness.bind(obj),\n freemem: obj.freemem.bind(obj),\n getPriority: obj.getPriority.bind(obj),\n homedir: obj.homedir.bind(obj),\n hostname: obj.hostname.bind(obj),\n loadavg: obj.loadavg.bind(obj),\n networkInterfaces: obj.networkInterfaces.bind(obj),\n platform: obj.platform.bind(obj),\n release: obj.release.bind(obj),\n setPriority: obj.setPriority.bind(obj),\n get tmpdir() {\n return tmpdir;\n },\n totalmem: obj.totalmem.bind(obj),\n type: obj.type.bind(obj),\n uptime: obj.uptime.bind(obj),\n userInfo: obj.userInfo.bind(obj),\n version: obj.version.bind(obj),\n machine: obj.machine.bind(obj),\n devNull: obj.devNull,\n EOL: obj.EOL,\n constants: @processBindingConstants.os\n };\n}, tmpdir = function() {\n var env = Bun.env;\n return tmpdir = function() {\n var path = env.TMPDIR || env.TMP || env.TEMP || \"/tmp\";\n const length = path.length;\n if (length > 1 && path[length - 1] === \"/\")\n path = path.slice(0, -1);\n return path;\n }, tmpdir();\n};\nreturn bound(Bun._Os())})\n"); -// - -// -static constexpr ASCIILiteral NodePathPosixCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/path.posix.ts\nreturn (@getInternalField(@internalModuleRegistry, 30) || @createInternalModuleById(30)).posix})\n"); -// - -// -static constexpr ASCIILiteral NodePathCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/path.ts\nvar bound = function(obj) {\n const toNamespacedPath = obj.toNamespacedPath.bind(obj);\n return {\n resolve: obj.resolve.bind(obj),\n normalize: obj.normalize.bind(obj),\n isAbsolute: obj.isAbsolute.bind(obj),\n join: obj.join.bind(obj),\n relative: obj.relative.bind(obj),\n toNamespacedPath,\n dirname: obj.dirname.bind(obj),\n basename: obj.basename.bind(obj),\n extname: obj.extname.bind(obj),\n format: obj.format.bind(obj),\n parse: obj.parse.bind(obj),\n sep: obj.sep,\n delimiter: obj.delimiter,\n win32: @undefined,\n posix: @undefined,\n _makeLong: toNamespacedPath\n };\n}, posix = bound(Bun._Path(!1)), win32 = bound(Bun._Path(!0));\nposix.win32 = win32.win32 = win32;\nposix.posix = win32.posix = posix;\nreturn posix})\n"); -// - -// -static constexpr ASCIILiteral NodePathWin32Code = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/path.win32.ts\nreturn (@getInternalField(@internalModuleRegistry, 30) || @createInternalModuleById(30)).win32})\n"); -// - -// -static constexpr ASCIILiteral NodePerfHooksCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/perf_hooks.ts\nvar $, { throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6), constants = {\n NODE_PERFORMANCE_GC_MAJOR: 4,\n NODE_PERFORMANCE_GC_MINOR: 1,\n NODE_PERFORMANCE_GC_INCREMENTAL: 8,\n NODE_PERFORMANCE_GC_WEAKCB: 16,\n NODE_PERFORMANCE_GC_FLAGS_NO: 0,\n NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: 2,\n NODE_PERFORMANCE_GC_FLAGS_FORCED: 4,\n NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING: 8,\n NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE: 16,\n NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: 32,\n NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: 64\n}, performance = globalThis.performance;\n\nclass PerformanceObserver {\n constructor() {\n throwNotImplemented(\"PerformanceObserver\");\n }\n}\n\nclass PerformanceEntry {\n constructor() {\n throwNotImplemented(\"PerformanceEntry\");\n }\n}\n$ = {\n performance,\n constants,\n PerformanceEntry,\n PerformanceObserver\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodePunycodeCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/punycode.ts\nvar error = function(type) {\n @throwRangeError(errors[type]);\n}, map = function(array, callback) {\n const result = [];\n let length = array.length;\n while (length--)\n result[length] = callback(array[length]);\n return result;\n}, mapDomain = function(domain, callback) {\n const parts = domain.split(\"@\");\n let result = \"\";\n if (parts.length > 1)\n result = parts[0] + \"@\", domain = parts[1];\n domain = domain.replace(regexSeparators, \".\");\n const labels = domain.split(\".\"), encoded = map(labels, callback).join(\".\");\n return result + encoded;\n}, ucs2decode = function(string) {\n const output = [];\n let counter = 0;\n const length = string.length;\n while (counter < length) {\n const value = string.charCodeAt(counter++);\n if (value >= 55296 && value <= 56319 && counter < length) {\n const extra = string.charCodeAt(counter++);\n if ((extra & 64512) == 56320)\n output.push(((value & 1023) << 10) + (extra & 1023) + 65536);\n else\n output.push(value), counter--;\n } else\n output.push(value);\n }\n return output;\n}, $, maxInt = 2147483647, base = 36, tMin = 1, tMax = 26, skew = 38, damp = 700, initialBias = 72, initialN = 128, delimiter = \"-\", regexPunycode = /^xn--/, regexNonASCII = /[^\\0-\\x7F]/, regexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g, errors = {\n overflow: \"Overflow: input needs wider integers to process\",\n \"not-basic\": \"Illegal input >= 0x80 (not a basic code point)\",\n \"invalid-input\": \"Invalid input\"\n}, baseMinusTMin = base - tMin, floor = Math.floor, stringFromCharCode = @String.fromCharCode, ucs2encode = (codePoints) => @String.fromCodePoint(...codePoints), basicToDigit = function(codePoint) {\n if (codePoint >= 48 && codePoint < 58)\n return 26 + (codePoint - 48);\n if (codePoint >= 65 && codePoint < 91)\n return codePoint - 65;\n if (codePoint >= 97 && codePoint < 123)\n return codePoint - 97;\n return base;\n}, digitToBasic = function(digit, flag) {\n return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n}, adapt = function(delta, numPoints, firstTime) {\n let k = 0;\n delta = firstTime \? floor(delta / damp) : delta >> 1, delta += floor(delta / numPoints);\n for (;delta > baseMinusTMin * tMax >> 1; k += base)\n delta = floor(delta / baseMinusTMin);\n return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n}, decode = function(input) {\n const output = [], inputLength = input.length;\n let i = 0, n = initialN, bias = initialBias, basic = input.lastIndexOf(delimiter);\n if (basic < 0)\n basic = 0;\n for (let j = 0;j < basic; ++j) {\n if (input.charCodeAt(j) >= 128)\n error(\"not-basic\");\n output.push(input.charCodeAt(j));\n }\n for (let index = basic > 0 \? basic + 1 : 0;index < inputLength; ) {\n const oldi = i;\n for (let w = 1, k = base;; k += base) {\n if (index >= inputLength)\n error(\"invalid-input\");\n const digit = basicToDigit(input.charCodeAt(index++));\n if (digit >= base)\n error(\"invalid-input\");\n if (digit > floor((maxInt - i) / w))\n error(\"overflow\");\n i += digit * w;\n const t = k <= bias \? tMin : k >= bias + tMax \? tMax : k - bias;\n if (digit < t)\n break;\n const baseMinusT = base - t;\n if (w > floor(maxInt / baseMinusT))\n error(\"overflow\");\n w *= baseMinusT;\n }\n const out = output.length + 1;\n if (bias = adapt(i - oldi, out, oldi == 0), floor(i / out) > maxInt - n)\n error(\"overflow\");\n n += floor(i / out), i %= out, output.splice(i++, 0, n);\n }\n return @String.fromCodePoint(...output);\n}, encode = function(input) {\n const output = [];\n input = ucs2decode(input);\n const inputLength = input.length;\n let n = initialN, delta = 0, bias = initialBias;\n for (let currentValue of input)\n if (currentValue < 128)\n output.push(stringFromCharCode(currentValue));\n const basicLength = output.length;\n let handledCPCount = basicLength;\n if (basicLength)\n output.push(delimiter);\n while (handledCPCount < inputLength) {\n let m = maxInt;\n for (let currentValue of input)\n if (currentValue >= n && currentValue < m)\n m = currentValue;\n const handledCPCountPlusOne = handledCPCount + 1;\n if (m - n > floor((maxInt - delta) / handledCPCountPlusOne))\n error(\"overflow\");\n delta += (m - n) * handledCPCountPlusOne, n = m;\n for (let currentValue of input) {\n if (currentValue < n && ++delta > maxInt)\n error(\"overflow\");\n if (currentValue === n) {\n let q = delta;\n for (let k = base;; k += base) {\n const t = k <= bias \? tMin : k >= bias + tMax \? tMax : k - bias;\n if (q < t)\n break;\n const qMinusT = q - t, baseMinusT = base - t;\n output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))), q = floor(qMinusT / baseMinusT);\n }\n output.push(stringFromCharCode(digitToBasic(q, 0))), bias = adapt(delta, handledCPCountPlusOne, handledCPCount === basicLength), delta = 0, ++handledCPCount;\n }\n }\n ++delta, ++n;\n }\n return output.join(\"\");\n}, toUnicode = function(input) {\n return mapDomain(input, function(string) {\n return regexPunycode.test(string) \? decode(string.slice(4).toLowerCase()) : string;\n });\n}, toASCII = function(input) {\n return mapDomain(input, function(string) {\n return regexNonASCII.test(string) \? \"xn--\" + encode(string) : string;\n });\n};\n$ = {\n version: \"2.1.0\",\n ucs2: {\n decode: ucs2decode,\n encode: ucs2encode\n },\n decode,\n encode,\n toASCII,\n toUnicode\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeQuerystringCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/querystring.ts\nvar __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports), Buffer = @requireNativeModule(\"buffer\").Buffer, require_object_keys = __commonJS((exports, module) => {\n var objectKeys = Object.keys || function() {\n var hasOwnProperty = Object.prototype.hasOwnProperty, hasDontEnumBug = !{ toString: null }.propertyIsEnumerable(\"toString\"), dontEnums = [\n \"toString\",\n \"toLocaleString\",\n \"valueOf\",\n \"hasOwnProperty\",\n \"isPrototypeOf\",\n \"propertyIsEnumerable\",\n \"constructor\"\n ], dontEnumsLength = dontEnums.length;\n return function(obj) {\n if (typeof obj !== \"function\" && (typeof obj !== \"object\" || obj === null))\n @throwTypeError(\"Object.keys called on non-object\");\n var result = [], prop, i;\n for (prop in obj)\n if (hasOwnProperty.@call(obj, prop))\n result.push(prop);\n if (hasDontEnumBug) {\n for (i = 0;i < dontEnumsLength; i++)\n if (hasOwnProperty.@call(obj, dontEnums[i]))\n result.push(dontEnums[i]);\n }\n return result;\n };\n }();\n module.exports = objectKeys;\n}), require_src = __commonJS((exports, module) => {\n var ParsedQueryString = function() {\n }, unescapeBuffer = function(s, decodeSpaces) {\n var out = Buffer.allocUnsafe(s.length), state = 0, n, m, hexchar, c;\n for (var inIndex = 0, outIndex = 0;; inIndex++) {\n if (inIndex < s.length)\n c = s.charCodeAt(inIndex);\n else {\n if (state > 0) {\n if (out[outIndex++] = 37, state === 2)\n out[outIndex++] = hexchar;\n }\n break;\n }\n switch (state) {\n case 0:\n switch (c) {\n case 37:\n n = 0, m = 0, state = 1;\n break;\n case 43:\n if (decodeSpaces)\n c = 32;\n default:\n out[outIndex++] = c;\n break;\n }\n break;\n case 1:\n if (hexchar = c, n = unhexTable[c], !(n >= 0)) {\n out[outIndex++] = 37, out[outIndex++] = c, state = 0;\n break;\n }\n state = 2;\n break;\n case 2:\n if (state = 0, m = unhexTable[c], !(m >= 0)) {\n out[outIndex++] = 37, out[outIndex++] = hexchar, out[outIndex++] = c;\n break;\n }\n out[outIndex++] = 16 * n + m;\n break;\n }\n }\n return out.slice(0, outIndex);\n }, qsUnescape = function(s, decodeSpaces) {\n try {\n return decodeURIComponent(s);\n } catch (e) {\n return QueryString.unescapeBuffer(s, decodeSpaces).toString();\n }\n }, qsEscape = function(str) {\n if (typeof str !== \"string\")\n if (typeof str === \"object\")\n str = @String(str);\n else\n str += \"\";\n var out = \"\", lastPos = 0;\n for (var i2 = 0;i2 < str.length; ++i2) {\n var c = str.charCodeAt(i2);\n if (c < 128) {\n if (noEscape[c] === 1)\n continue;\n if (lastPos < i2)\n out += str.slice(lastPos, i2);\n lastPos = i2 + 1, out += hexTable[c];\n continue;\n }\n if (lastPos < i2)\n out += str.slice(lastPos, i2);\n if (c < 2048) {\n lastPos = i2 + 1, out += hexTable[192 | c >> 6] + hexTable[128 | c & 63];\n continue;\n }\n if (c < 55296 || c >= 57344) {\n lastPos = i2 + 1, out += hexTable[224 | c >> 12] + hexTable[128 | c >> 6 & 63] + hexTable[128 | c & 63];\n continue;\n }\n ++i2;\n var c2;\n if (i2 < str.length)\n c2 = str.charCodeAt(i2) & 1023;\n else\n throw new URIError(\"URI malformed\");\n lastPos = i2 + 1, c = 65536 + ((c & 1023) << 10 | c2), out += hexTable[240 | c >> 18] + hexTable[128 | c >> 12 & 63] + hexTable[128 | c >> 6 & 63] + hexTable[128 | c & 63];\n }\n if (lastPos === 0)\n return str;\n if (lastPos < str.length)\n return out + str.slice(lastPos);\n return out;\n }, stringifyPrimitive = function(v) {\n if (typeof v === \"string\")\n return v;\n if (typeof v === \"number\" && @isFinite(v))\n return \"\" + v;\n if (typeof v === \"boolean\")\n return v \? \"true\" : \"false\";\n return \"\";\n }, stringify = function(obj, sep, eq, options) {\n sep = sep || \"&\", eq = eq || \"=\";\n var encode = QueryString.escape;\n if (options && typeof options.encodeURIComponent === \"function\")\n encode = options.encodeURIComponent;\n if (obj !== null && typeof obj === \"object\") {\n var keys = objectKeys(obj), len = keys.length, flast = len - 1, fields = \"\";\n for (var i2 = 0;i2 < len; ++i2) {\n var k = keys[i2], v = obj[k], ks = encode(stringifyPrimitive(k)) + eq;\n if (isArray(v)) {\n var vlen = v.length, vlast = vlen - 1;\n for (var j = 0;j < vlen; ++j)\n if (fields += ks + encode(stringifyPrimitive(v[j])), j < vlast)\n fields += sep;\n if (vlen && i2 < flast)\n fields += sep;\n } else if (fields += ks + encode(stringifyPrimitive(v)), i2 < flast)\n fields += sep;\n }\n return fields;\n }\n return \"\";\n }, charCodes = function(str) {\n if (str.length === 0)\n return [];\n if (str.length === 1)\n return [str.charCodeAt(0)];\n const ret = [];\n for (var i2 = 0;i2 < str.length; ++i2)\n ret[ret.length] = str.charCodeAt(i2);\n return ret;\n }, parse = function(qs, sep, eq, options) {\n const obj = new ParsedQueryString;\n if (typeof qs !== \"string\" || qs.length === 0)\n return obj;\n var sepCodes = !sep \? defSepCodes : charCodes(sep + \"\"), eqCodes = !eq \? defEqCodes : charCodes(eq + \"\");\n const sepLen = sepCodes.length, eqLen = eqCodes.length;\n var pairs = 1000;\n if (options && typeof options.maxKeys === \"number\")\n pairs = options.maxKeys > 0 \? options.maxKeys : -1;\n var decode = QueryString.unescape;\n if (options && typeof options.decodeURIComponent === \"function\")\n decode = options.decodeURIComponent;\n const customDecode = decode !== qsUnescape, keys = [];\n var posIdx = 0, lastPos = 0, sepIdx = 0, eqIdx = 0, key = \"\", value = \"\", keyEncoded = customDecode, valEncoded = customDecode, encodeCheck = 0;\n for (var i2 = 0;i2 < qs.length; ++i2) {\n const code = qs.charCodeAt(i2);\n if (code === sepCodes[sepIdx]) {\n if (++sepIdx === sepLen) {\n const end = i2 - sepIdx + 1;\n if (eqIdx < eqLen) {\n if (lastPos < end)\n key += qs.slice(lastPos, end);\n } else if (lastPos < end)\n value += qs.slice(lastPos, end);\n if (keyEncoded)\n key = decodeStr(key, decode);\n if (valEncoded)\n value = decodeStr(value, decode);\n if (key || value || lastPos - posIdx > sepLen || i2 === 0)\n if (indexOf(keys, key) === -1)\n obj[key] = value, keys[keys.length] = key;\n else {\n const curValue = obj[key] || \"\";\n if (curValue.pop)\n curValue[curValue.length] = value;\n else if (curValue)\n obj[key] = [curValue, value];\n }\n else if (i2 === 1)\n delete obj[key];\n if (--pairs === 0)\n break;\n keyEncoded = valEncoded = customDecode, encodeCheck = 0, key = value = \"\", posIdx = lastPos, lastPos = i2 + 1, sepIdx = eqIdx = 0;\n }\n continue;\n } else if (sepIdx = 0, !valEncoded)\n if (code === 37)\n encodeCheck = 1;\n else if (encodeCheck > 0 && (code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) {\n if (++encodeCheck === 3)\n valEncoded = !0;\n } else\n encodeCheck = 0;\n if (eqIdx < eqLen) {\n if (code === eqCodes[eqIdx]) {\n if (++eqIdx === eqLen) {\n const end = i2 - eqIdx + 1;\n if (lastPos < end)\n key += qs.slice(lastPos, end);\n encodeCheck = 0, lastPos = i2 + 1;\n }\n continue;\n } else if (eqIdx = 0, !keyEncoded)\n if (code === 37)\n encodeCheck = 1;\n else if (encodeCheck > 0 && (code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) {\n if (++encodeCheck === 3)\n keyEncoded = !0;\n } else\n encodeCheck = 0;\n }\n if (code === 43) {\n if (eqIdx < eqLen) {\n if (lastPos < i2)\n key += qs.slice(lastPos, i2);\n key += \"%20\", keyEncoded = !0;\n } else {\n if (lastPos < i2)\n value += qs.slice(lastPos, i2);\n value += \"%20\", valEncoded = !0;\n }\n lastPos = i2 + 1;\n }\n }\n if (pairs !== 0 && (lastPos < qs.length || eqIdx > 0)) {\n if (lastPos < qs.length) {\n if (eqIdx < eqLen)\n key += qs.slice(lastPos);\n else if (sepIdx < sepLen)\n value += qs.slice(lastPos);\n }\n if (keyEncoded)\n key = decodeStr(key, decode);\n if (valEncoded)\n value = decodeStr(value, decode);\n if (indexOf(keys, key) === -1)\n obj[key] = value, keys[keys.length] = key;\n else {\n const curValue = obj[key];\n if (curValue.pop)\n curValue[curValue.length] = value;\n else\n obj[key] = [curValue, value];\n }\n }\n return obj;\n }, decodeStr = function(s, decoder) {\n try {\n return decoder(s);\n } catch (e) {\n return QueryString.unescape(s, !0);\n }\n }, QueryString = module.exports = {\n unescapeBuffer,\n unescape: qsUnescape,\n escape: qsEscape,\n stringify,\n encode: stringify,\n parse,\n decode: parse\n }, objectKeys = require_object_keys(), isArray = (arg) => Object.prototype.toString.@call(arg) === \"[object Array]\", indexOf = (arr, searchElement, fromIndex) => {\n var k;\n if (arr == null)\n @throwTypeError('\"arr\" is null or not defined');\n var o = Object(arr), len = o.length >>> 0;\n if (len === 0)\n return -1;\n var n = fromIndex | 0;\n if (n >= len)\n return -1;\n k = Math.max(n >= 0 \? n : len - Math.abs(n), 0);\n while (k < len) {\n if ((k in o) && o[k] === searchElement)\n return k;\n k++;\n }\n return -1;\n };\n ParsedQueryString.prototype = Object.create \? Object.create(null) : {};\n var unhexTable = [\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1\n ], hexTable = [];\n for (i = 0;i < 256; ++i)\n hexTable[i] = \"%\" + ((i < 16 \? \"0\" : \"\") + i.toString(16)).toUpperCase();\n var i, noEscape = [\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 0,\n 1,\n 1,\n 1,\n 1,\n 0,\n 0,\n 1,\n 1,\n 0,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 0,\n 0,\n 0,\n 1,\n 0\n ], defSepCodes = [38], defEqCodes = [61];\n});\nreturn require_src()})\n"); -// - -// -static constexpr ASCIILiteral NodeReadlineCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/readline.ts\nvar stripVTControlCharacters = function(str) {\n return validateString(str, \"str\"), RegExpPrototypeSymbolReplace.@call(ansi, str, \"\");\n}, promisify = function(original) {\n if (validateFunction(original, \"original\"), original[kCustomPromisifiedSymbol]) {\n var fn = original[kCustomPromisifiedSymbol];\n return validateFunction(fn, \"util.promisify.custom\"), ObjectDefineProperty(fn, kCustomPromisifiedSymbol, {\n __proto__: null,\n value: fn,\n enumerable: !1,\n writable: !1,\n configurable: !0\n });\n }\n var argumentNames = original[kCustomPromisifyArgsSymbol];\n function fn(...args) {\n return new @Promise((resolve, reject) => {\n ArrayPrototypePush.@call(args, (err, ...values) => {\n if (err)\n return reject(err);\n if (argumentNames !== @undefined && values.length > 1) {\n var obj = {};\n for (var i2 = 0;i2 < argumentNames.length; i2++)\n obj[argumentNames[i2]] = values[i2];\n resolve(obj);\n } else\n resolve(values[0]);\n }), ReflectApply(original, this, args);\n });\n }\n ObjectSetPrototypeOf(fn, ObjectGetPrototypeOf(original)), ObjectDefineProperty(fn, kCustomPromisifiedSymbol, {\n __proto__: null,\n value: fn,\n enumerable: !1,\n writable: !1,\n configurable: !0\n });\n var descriptors = ObjectGetOwnPropertyDescriptors(original), propertiesValues = ObjectValues(descriptors);\n for (var i = 0;i < propertiesValues.length; i++)\n ObjectSetPrototypeOf(propertiesValues[i], null);\n return ObjectDefineProperties(fn, descriptors);\n}, getNodeErrorByName = function(typeName) {\n var base = errorBases[typeName];\n if (base)\n return base;\n if (!ObjectKeys(VALID_NODE_ERROR_BASES).includes(typeName))\n throw new Error(\"Invalid NodeError type\");\n var Base = VALID_NODE_ERROR_BASES[typeName];\n\n class NodeError extends Base {\n [kIsNodeError] = !0;\n code;\n constructor(msg, opts) {\n super(msg, opts);\n this.code = opts\?.code || \"ERR_GENERIC\";\n }\n toString() {\n return `${this.name} [${this.code}]: ${this.message}`;\n }\n }\n return errorBases[typeName] = NodeError, NodeError;\n}, validateFunction = function(value, name) {\n if (typeof value !== \"function\")\n throw new ERR_INVALID_ARG_TYPE(name, \"Function\", value);\n}, validateAbortSignal = function(signal, name) {\n if (signal !== @undefined && (signal === null || typeof signal !== \"object\" || !(\"aborted\" in signal)))\n throw new ERR_INVALID_ARG_TYPE(name, \"AbortSignal\", signal);\n}, validateArray = function(value, name, minLength = 0) {\n if (!ArrayIsArray(value))\n throw new ERR_INVALID_ARG_TYPE(name, \"Array\", value);\n if (value.length < minLength) {\n var reason = `must be longer than ${minLength}`;\n throw new ERR_INVALID_ARG_VALUE(name, value, reason);\n }\n}, validateString = function(value, name) {\n if (typeof value !== \"string\")\n throw new ERR_INVALID_ARG_TYPE(name, \"string\", value);\n}, validateBoolean = function(value, name) {\n if (typeof value !== \"boolean\")\n throw new ERR_INVALID_ARG_TYPE(name, \"boolean\", value);\n};\nvar validateInteger = function(value, name, min = NumberMIN_SAFE_INTEGER, max = NumberMAX_SAFE_INTEGER) {\n if (typeof value !== \"number\")\n throw new ERR_INVALID_ARG_TYPE(name, \"number\", value);\n if (!NumberIsInteger(value))\n throw new ERR_OUT_OF_RANGE(name, \"an integer\", value);\n if (value < min || value > max)\n throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);\n}, validateUint32 = function(value, name, positive = !1) {\n if (typeof value !== \"number\")\n throw new ERR_INVALID_ARG_TYPE(name, \"number\", value);\n if (!NumberIsInteger(value))\n throw new ERR_OUT_OF_RANGE(name, \"an integer\", value);\n var min = positive \? 1 : 0, max = 4294967295;\n if (value < min || value > max)\n throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);\n}, CSI = function(strings, ...args) {\n var ret = `${kEscape}[`;\n for (var n = 0;n < strings.length; n++)\n if (ret += strings[n], n < args.length)\n ret += args[n];\n return ret;\n}, charLengthLeft = function(str, i) {\n if (i <= 0)\n return 0;\n if (i > 1 && StringPrototypeCodePointAt.@call(str, i - 2) >= kUTF16SurrogateThreshold || StringPrototypeCodePointAt.@call(str, i - 1) >= kUTF16SurrogateThreshold)\n return 2;\n return 1;\n}, charLengthAt = function(str, i) {\n if (str.length <= i)\n return 1;\n return StringPrototypeCodePointAt.@call(str, i) >= kUTF16SurrogateThreshold \? 2 : 1;\n};\nfunction* emitKeys(stream) {\n while (!0) {\n var ch = yield, s = ch, escaped = !1, keySeq = null, keyName, keyCtrl2 = !1, keyMeta = !1, keyShift = !1;\n if (ch === kEscape) {\n if (escaped = !0, s += ch = yield, ch === kEscape)\n s += ch = yield;\n }\n if (escaped && (ch === \"O\" || ch === \"[\")) {\n var code = ch, modifier = 0;\n if (ch === \"O\") {\n if (s += ch = yield, ch >= \"0\" && ch <= \"9\")\n modifier = (ch >> 0) - 1, s += ch = yield;\n code += ch;\n } else if (ch === \"[\") {\n if (s += ch = yield, ch === \"[\")\n code += ch, s += ch = yield;\n var cmdStart = s.length - 1;\n if (ch >= \"0\" && ch <= \"9\") {\n if (s += ch = yield, ch >= \"0\" && ch <= \"9\")\n s += ch = yield;\n }\n if (ch === \";\") {\n if (s += ch = yield, ch >= \"0\" && ch <= \"9\")\n s += yield;\n }\n var cmd = StringPrototypeSlice.@call(s, cmdStart), match;\n if (match = RegExpPrototypeExec.@call(/^(\\d\\d\?)(;(\\d))\?([~^$])$/, cmd))\n code += match[1] + match[4], modifier = (match[3] || 1) - 1;\n else if (match = RegExpPrototypeExec.@call(/^((\\d;)\?(\\d))\?([A-Za-z])$/, cmd))\n code += match[4], modifier = (match[3] || 1) - 1;\n else\n code += cmd;\n }\n switch (keyCtrl2 = !!(modifier & 4), keyMeta = !!(modifier & 10), keyShift = !!(modifier & 1), code) {\n case \"[P\":\n keyName = \"f1\";\n break;\n case \"[Q\":\n keyName = \"f2\";\n break;\n case \"[R\":\n keyName = \"f3\";\n break;\n case \"[S\":\n keyName = \"f4\";\n break;\n case \"OP\":\n keyName = \"f1\";\n break;\n case \"OQ\":\n keyName = \"f2\";\n break;\n case \"OR\":\n keyName = \"f3\";\n break;\n case \"OS\":\n keyName = \"f4\";\n break;\n case \"[11~\":\n keyName = \"f1\";\n break;\n case \"[12~\":\n keyName = \"f2\";\n break;\n case \"[13~\":\n keyName = \"f3\";\n break;\n case \"[14~\":\n keyName = \"f4\";\n break;\n case \"[[A\":\n keyName = \"f1\";\n break;\n case \"[[B\":\n keyName = \"f2\";\n break;\n case \"[[C\":\n keyName = \"f3\";\n break;\n case \"[[D\":\n keyName = \"f4\";\n break;\n case \"[[E\":\n keyName = \"f5\";\n break;\n case \"[15~\":\n keyName = \"f5\";\n break;\n case \"[17~\":\n keyName = \"f6\";\n break;\n case \"[18~\":\n keyName = \"f7\";\n break;\n case \"[19~\":\n keyName = \"f8\";\n break;\n case \"[20~\":\n keyName = \"f9\";\n break;\n case \"[21~\":\n keyName = \"f10\";\n break;\n case \"[23~\":\n keyName = \"f11\";\n break;\n case \"[24~\":\n keyName = \"f12\";\n break;\n case \"[A\":\n keyName = \"up\";\n break;\n case \"[B\":\n keyName = \"down\";\n break;\n case \"[C\":\n keyName = \"right\";\n break;\n case \"[D\":\n keyName = \"left\";\n break;\n case \"[E\":\n keyName = \"clear\";\n break;\n case \"[F\":\n keyName = \"end\";\n break;\n case \"[H\":\n keyName = \"home\";\n break;\n case \"OA\":\n keyName = \"up\";\n break;\n case \"OB\":\n keyName = \"down\";\n break;\n case \"OC\":\n keyName = \"right\";\n break;\n case \"OD\":\n keyName = \"left\";\n break;\n case \"OE\":\n keyName = \"clear\";\n break;\n case \"OF\":\n keyName = \"end\";\n break;\n case \"OH\":\n keyName = \"home\";\n break;\n case \"[1~\":\n keyName = \"home\";\n break;\n case \"[2~\":\n keyName = \"insert\";\n break;\n case \"[3~\":\n keyName = \"delete\";\n break;\n case \"[4~\":\n keyName = \"end\";\n break;\n case \"[5~\":\n keyName = \"pageup\";\n break;\n case \"[6~\":\n keyName = \"pagedown\";\n break;\n case \"[[5~\":\n keyName = \"pageup\";\n break;\n case \"[[6~\":\n keyName = \"pagedown\";\n break;\n case \"[7~\":\n keyName = \"home\";\n break;\n case \"[8~\":\n keyName = \"end\";\n break;\n case \"[a\":\n keyName = \"up\", keyShift = !0;\n break;\n case \"[b\":\n keyName = \"down\", keyShift = !0;\n break;\n case \"[c\":\n keyName = \"right\", keyShift = !0;\n break;\n case \"[d\":\n keyName = \"left\", keyShift = !0;\n break;\n case \"[e\":\n keyName = \"clear\", keyShift = !0;\n break;\n case \"[2$\":\n keyName = \"insert\", keyShift = !0;\n break;\n case \"[3$\":\n keyName = \"delete\", keyShift = !0;\n break;\n case \"[5$\":\n keyName = \"pageup\", keyShift = !0;\n break;\n case \"[6$\":\n keyName = \"pagedown\", keyShift = !0;\n break;\n case \"[7$\":\n keyName = \"home\", keyShift = !0;\n break;\n case \"[8$\":\n keyName = \"end\", keyShift = !0;\n break;\n case \"Oa\":\n keyName = \"up\", keyCtrl2 = !0;\n break;\n case \"Ob\":\n keyName = \"down\", keyCtrl2 = !0;\n break;\n case \"Oc\":\n keyName = \"right\", keyCtrl2 = !0;\n break;\n case \"Od\":\n keyName = \"left\", keyCtrl2 = !0;\n break;\n case \"Oe\":\n keyName = \"clear\", keyCtrl2 = !0;\n break;\n case \"[2^\":\n keyName = \"insert\", keyCtrl2 = !0;\n break;\n case \"[3^\":\n keyName = \"delete\", keyCtrl2 = !0;\n break;\n case \"[5^\":\n keyName = \"pageup\", keyCtrl2 = !0;\n break;\n case \"[6^\":\n keyName = \"pagedown\", keyCtrl2 = !0;\n break;\n case \"[7^\":\n keyName = \"home\", keyCtrl2 = !0;\n break;\n case \"[8^\":\n keyName = \"end\", keyCtrl2 = !0;\n break;\n case \"[Z\":\n keyName = \"tab\", keyShift = !0;\n break;\n default:\n keyName = \"undefined\";\n break;\n }\n } else if (ch === \"\\r\")\n keyName = \"return\", keyMeta = escaped;\n else if (ch === \"\\n\")\n keyName = \"enter\", keyMeta = escaped;\n else if (ch === \"\\t\")\n keyName = \"tab\", keyMeta = escaped;\n else if (ch === \"\\b\" || ch === \"\\x7F\")\n keyName = \"backspace\", keyMeta = escaped;\n else if (ch === kEscape)\n keyName = \"escape\", keyMeta = escaped;\n else if (ch === \" \")\n keyName = \"space\", keyMeta = escaped;\n else if (!escaped && ch <= \"\\x1A\")\n keyName = StringFromCharCode(StringPrototypeCharCodeAt.@call(ch) + StringPrototypeCharCodeAt.@call(\"a\") - 1), keyCtrl2 = !0;\n else if (RegExpPrototypeExec.@call(/^[0-9A-Za-z]$/, ch) !== null)\n keyName = StringPrototypeToLowerCase.@call(ch), keyShift = RegExpPrototypeExec.@call(/^[A-Z]$/, ch) !== null, keyMeta = escaped;\n else if (escaped)\n keyName = ch.length \? @undefined : \"escape\", keyMeta = !0;\n else\n keyName = @undefined;\n if (keySeq = s, s.length !== 0 && (keyName !== @undefined || escaped))\n stream.emit(\"keypress\", escaped \? @undefined : s, {\n sequence: keySeq,\n name: keyName,\n ctrl: keyCtrl2,\n meta: keyMeta,\n shift: keyShift\n });\n else if (charLengthAt(s, 0) === s.length)\n stream.emit(\"keypress\", s, {\n sequence: keySeq,\n name: keyName,\n ctrl: keyCtrl2,\n meta: keyMeta,\n shift: keyShift\n });\n }\n}\nvar commonPrefix = function(strings) {\n if (strings.length === 0)\n return \"\";\n if (strings.length === 1)\n return strings[0];\n var sorted = ArrayPrototypeSort.@call(ArrayPrototypeSlice.@call(strings)), min = sorted[0], max = sorted[sorted.length - 1];\n for (var i = 0;i < min.length; i++)\n if (min[i] !== max[i])\n return StringPrototypeSlice.@call(min, 0, i);\n return min;\n}, cursorTo = function(stream, x, y, callback) {\n if (callback !== @undefined)\n validateFunction(callback, \"callback\");\n if (typeof y === \"function\")\n callback = y, y = @undefined;\n if (NumberIsNaN(x))\n throw new ERR_INVALID_ARG_VALUE(\"x\", x);\n if (NumberIsNaN(y))\n throw new ERR_INVALID_ARG_VALUE(\"y\", y);\n if (stream == null || typeof x !== \"number\" && typeof y !== \"number\") {\n if (typeof callback === \"function\")\n process.nextTick(callback, null);\n return !0;\n }\n if (typeof x !== \"number\")\n throw new ERR_INVALID_CURSOR_POS;\n var data = typeof y !== \"number\" \? CSI`${x + 1}G` : CSI`${y + 1};${x + 1}H`;\n return stream.write(data, callback);\n}, moveCursor = function(stream, dx, dy, callback) {\n if (callback !== @undefined)\n validateFunction(callback, \"callback\");\n if (stream == null || !(dx || dy)) {\n if (typeof callback === \"function\")\n process.nextTick(callback, null);\n return !0;\n }\n var data = \"\";\n if (dx < 0)\n data += CSI`${-dx}D`;\n else if (dx > 0)\n data += CSI`${dx}C`;\n if (dy < 0)\n data += CSI`${-dy}A`;\n else if (dy > 0)\n data += CSI`${dy}B`;\n return stream.write(data, callback);\n}, clearLine = function(stream, dir, callback) {\n if (callback !== @undefined)\n validateFunction(callback, \"callback\");\n if (stream === null || stream === @undefined) {\n if (typeof callback === \"function\")\n process.nextTick(callback, null);\n return !0;\n }\n var type = dir < 0 \? kClearToLineBeginning : dir > 0 \? kClearToLineEnd : kClearLine;\n return stream.write(type, callback);\n}, clearScreenDown = function(stream, callback) {\n if (callback !== @undefined)\n validateFunction(callback, \"callback\");\n if (stream === null || stream === @undefined) {\n if (typeof callback === \"function\")\n process.nextTick(callback, null);\n return !0;\n }\n return stream.write(kClearScreenDown, callback);\n}, emitKeypressEvents = function(stream, iface = {}) {\n if (stream[KEYPRESS_DECODER])\n return;\n stream[KEYPRESS_DECODER] = new StringDecoder(\"utf8\"), stream[ESCAPE_DECODER] = emitKeys(stream), stream[ESCAPE_DECODER].next();\n var triggerEscape = () => stream[ESCAPE_DECODER].next(\"\"), { escapeCodeTimeout = ESCAPE_CODE_TIMEOUT } = iface, timeoutId;\n function onData(input) {\n if (stream.listenerCount(\"keypress\") > 0) {\n var string = stream[KEYPRESS_DECODER].write(input);\n if (string) {\n clearTimeout(timeoutId), iface[kSawKeyPress] = charLengthAt(string, 0) === string.length, iface.isCompletionEnabled = !1;\n var length = 0;\n for (var character of new SafeStringIterator(string)) {\n if (length += character.length, length === string.length)\n iface.isCompletionEnabled = !0;\n try {\n if (stream[ESCAPE_DECODER].next(character), length === string.length && character === kEscape)\n timeoutId = setTimeout(triggerEscape, escapeCodeTimeout);\n } catch (err) {\n throw stream[ESCAPE_DECODER] = emitKeys(stream), stream[ESCAPE_DECODER].next(), err;\n }\n }\n }\n } else\n stream.removeListener(\"data\", onData), stream.on(\"newListener\", onNewListener);\n }\n function onNewListener(event) {\n if (event === \"keypress\")\n stream.on(\"data\", onData), stream.removeListener(\"newListener\", onNewListener);\n }\n if (stream.listenerCount(\"keypress\") > 0)\n stream.on(\"data\", onData);\n else\n stream.on(\"newListener\", onNewListener);\n}, onSelfCloseWithTerminal = function() {\n var input = this.input, output = this.output;\n if (!input)\n throw new Error(\"Input not set, invalid state for readline!\");\n if (input.removeListener(\"keypress\", this[kOnKeyPress]), input.removeListener(\"error\", this[kOnError]), input.removeListener(\"end\", this[kOnTermEnd]), output !== null && output !== @undefined)\n output.removeListener(\"resize\", this[kOnResize]);\n}, onSelfCloseWithoutTerminal = function() {\n var input = this.input;\n if (!input)\n throw new Error(\"Input not set, invalid state for readline!\");\n input.removeListener(\"data\", this[kOnData]), input.removeListener(\"error\", this[kOnError]), input.removeListener(\"end\", this[kOnEnd]);\n}, onError = function(err) {\n this.emit(\"error\", err);\n}, onData = function(data) {\n debug(\"onData\"), this[kNormalWrite](data);\n}, onEnd = function() {\n if (debug(\"onEnd\"), typeof this[kLine_buffer] === \"string\" && this[kLine_buffer].length > 0)\n this.emit(\"line\", this[kLine_buffer]);\n this.close();\n}, onTermEnd = function() {\n if (debug(\"onTermEnd\"), typeof this.line === \"string\" && this.line.length > 0)\n this.emit(\"line\", this.line);\n this.close();\n}, onKeyPress = function(s, key) {\n if (this[kTtyWrite](s, key), key && key.sequence) {\n var ch = StringPrototypeCodePointAt.@call(key.sequence, 0);\n if (ch >= 55296 && ch <= 57343)\n this[kRefreshLine]();\n }\n}, onResize = function() {\n this[kRefreshLine]();\n}, InterfaceConstructor = function(input, output, completer, terminal) {\n if (!(this instanceof InterfaceConstructor))\n return new InterfaceConstructor(input, output, completer, terminal);\n EventEmitter.@call(this), this[kOnSelfCloseWithoutTerminal] = onSelfCloseWithoutTerminal.bind(this), this[kOnSelfCloseWithTerminal] = onSelfCloseWithTerminal.bind(this), this[kOnError] = onError.bind(this), this[kOnData] = onData.bind(this), this[kOnEnd] = onEnd.bind(this), this[kOnTermEnd] = onTermEnd.bind(this), this[kOnKeyPress] = onKeyPress.bind(this), this[kOnResize] = onResize.bind(this), this[kSawReturnAt] = 0, this.isCompletionEnabled = !0, this[kSawKeyPress] = !1, this[kPreviousKey] = null, this.escapeCodeTimeout = ESCAPE_CODE_TIMEOUT, this.tabSize = 8;\n var history, historySize, removeHistoryDuplicates = !1, crlfDelay, prompt = \"> \", signal;\n if (input\?.input) {\n output = input.output, completer = input.completer, terminal = input.terminal, history = input.history, historySize = input.historySize, signal = input.signal;\n var tabSize = input.tabSize;\n if (tabSize !== @undefined)\n validateUint32(tabSize, \"tabSize\", !0), this.tabSize = tabSize;\n removeHistoryDuplicates = input.removeHistoryDuplicates;\n var inputPrompt = input.prompt;\n if (inputPrompt !== @undefined)\n prompt = inputPrompt;\n var inputEscapeCodeTimeout = input.escapeCodeTimeout;\n if (inputEscapeCodeTimeout !== @undefined)\n if (NumberIsFinite(inputEscapeCodeTimeout))\n this.escapeCodeTimeout = inputEscapeCodeTimeout;\n else\n throw new ERR_INVALID_ARG_VALUE(\"input.escapeCodeTimeout\", this.escapeCodeTimeout);\n if (signal)\n validateAbortSignal(signal, \"options.signal\");\n crlfDelay = input.crlfDelay, input = input.input;\n }\n if (completer !== @undefined && typeof completer !== \"function\")\n throw new ERR_INVALID_ARG_VALUE(\"completer\", completer);\n if (history === @undefined)\n history = [];\n else\n validateArray(history, \"history\");\n if (historySize === @undefined)\n historySize = kHistorySize;\n if (typeof historySize !== \"number\" || NumberIsNaN(historySize) || historySize < 0)\n throw new ERR_INVALID_ARG_VALUE(\"historySize\", historySize);\n if (terminal === @undefined && !(output === null || output === @undefined))\n terminal = !!output.isTTY;\n if (this.line = \"\", this[kSubstringSearch] = null, this.output = output, this.input = input, this[kUndoStack] = [], this[kRedoStack] = [], this.history = history, this.historySize = historySize, this[kKillRing] = [], this[kKillRingCursor] = 0, this.removeHistoryDuplicates = !!removeHistoryDuplicates, this.crlfDelay = crlfDelay \? MathMax(kMincrlfDelay, crlfDelay) : kMincrlfDelay, this.completer = completer, this.setPrompt(prompt), this.terminal = !!terminal, this[kLineObjectStream] = @undefined, input.on(\"error\", this[kOnError]), !this.terminal)\n input.on(\"data\", this[kOnData]), input.on(\"end\", this[kOnEnd]), this.once(\"close\", this[kOnSelfCloseWithoutTerminal]), this[kDecoder] = new StringDecoder(\"utf8\");\n else {\n if (emitKeypressEvents(input, this), input.on(\"keypress\", this[kOnKeyPress]), input.on(\"end\", this[kOnTermEnd]), this[kSetRawMode](!0), this.terminal = !0, this.cursor = 0, this.historyIndex = -1, output !== null && output !== @undefined)\n output.on(\"resize\", this[kOnResize]);\n this.once(\"close\", this[kOnSelfCloseWithTerminal]);\n }\n if (signal) {\n var onAborted = (() => this.close()).bind(this);\n if (signal.aborted)\n process.nextTick(onAborted);\n else\n signal.addEventListener(\"abort\", onAborted, { once: !0 }), this.once(\"close\", () => signal.removeEventListener(\"abort\", onAborted));\n }\n this.line = \"\", input.resume();\n}, Interface = function(input, output, completer, terminal) {\n if (!(this instanceof Interface))\n return new Interface(input, output, completer, terminal);\n if (input\?.input && typeof input.completer === \"function\" && input.completer.length !== 2) {\n var { completer } = input;\n input.completer = (v, cb) => cb(null, completer(v));\n } else if (typeof completer === \"function\" && completer.length !== 2) {\n var realCompleter = completer;\n completer = (v, cb) => cb(null, realCompleter(v));\n }\n InterfaceConstructor.@call(this, input, output, completer, terminal);\n}, createInterface = function(input, output, completer, terminal) {\n return new Interface(input, output, completer, terminal);\n};\nvar $, EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20), { StringDecoder } = @requireNativeModule(\"string_decoder\"), isWritable, { inspect } = Bun, debug = process.env.BUN_JS_DEBUG \? console.log : () => {\n}, SymbolAsyncIterator = Symbol.asyncIterator, SymbolIterator = Symbol.iterator, SymbolFor = Symbol.for, SymbolReplace = Symbol.replace, ArrayFrom = @Array.from, ArrayIsArray = @Array.isArray, ArrayPrototypeFilter = @Array.prototype.filter, ArrayPrototypeSort = @Array.prototype.sort, ArrayPrototypeIndexOf = @Array.prototype.indexOf, ArrayPrototypeJoin = @Array.prototype.join, ArrayPrototypeMap = @Array.prototype.map, ArrayPrototypePop = @Array.prototype.pop, ArrayPrototypePush = @Array.prototype.push, ArrayPrototypeSlice = @Array.prototype.slice, ArrayPrototypeSplice = @Array.prototype.splice, ArrayPrototypeReverse = @Array.prototype.reverse, ArrayPrototypeShift = @Array.prototype.shift, ArrayPrototypeUnshift = @Array.prototype.unshift, RegExpPrototypeExec = @RegExp.prototype.exec, RegExpPrototypeSymbolReplace = @RegExp.prototype[SymbolReplace], StringFromCharCode = @String.fromCharCode, StringPrototypeCharCodeAt = @String.prototype.charCodeAt, StringPrototypeCodePointAt = @String.prototype.codePointAt, StringPrototypeSlice = @String.prototype.slice, StringPrototypeToLowerCase = @String.prototype.toLowerCase, StringPrototypeEndsWith = @String.prototype.endsWith, StringPrototypeRepeat = @String.prototype.repeat, StringPrototypeStartsWith = @String.prototype.startsWith, StringPrototypeTrim = @String.prototype.trim, StringPrototypeNormalize = @String.prototype.normalize, NumberIsNaN = Number.isNaN, NumberIsFinite = Number.isFinite, NumberIsInteger = Number.isInteger, NumberMAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER, NumberMIN_SAFE_INTEGER = Number.MIN_SAFE_INTEGER, MathCeil = Math.ceil, MathFloor = Math.floor, MathMax = Math.max, DateNow = Date.now, FunctionPrototype = Function.prototype, StringPrototype = @String.prototype, StringPrototypeSymbolIterator = StringPrototype[SymbolIterator], StringIteratorPrototypeNext = StringPrototypeSymbolIterator.@call(\"\").next, ObjectSetPrototypeOf = Object.setPrototypeOf, ObjectDefineProperty = Object.defineProperty, ObjectDefineProperties = Object.defineProperties, ObjectFreeze = Object.freeze;\nvar { create: ObjectCreate, keys: ObjectKeys } = Object;\nvar createSafeIterator = (factory, next) => {\n class SafeIterator {\n #iterator;\n constructor(iterable) {\n this.#iterator = factory.@call(iterable);\n }\n next() {\n return next.@call(this.#iterator);\n }\n [SymbolIterator]() {\n return this;\n }\n }\n return ObjectSetPrototypeOf(SafeIterator.prototype, null), ObjectFreeze(SafeIterator.prototype), ObjectFreeze(SafeIterator), SafeIterator;\n}, SafeStringIterator = createSafeIterator(StringPrototypeSymbolIterator, StringIteratorPrototypeNext), isFullWidthCodePoint = (code) => {\n return code >= 4352 && (code <= 4447 || code === 9001 || code === 9002 || code >= 11904 && code <= 12871 && code !== 12351 || code >= 12880 && code <= 19903 || code >= 19968 && code <= 42182 || code >= 43360 && code <= 43388 || code >= 44032 && code <= 55203 || code >= 63744 && code <= 64255 || code >= 65040 && code <= 65049 || code >= 65072 && code <= 65131 || code >= 65281 && code <= 65376 || code >= 65504 && code <= 65510 || code >= 110592 && code <= 110593 || code >= 127488 && code <= 127569 || code >= 127744 && code <= 128591 || code >= 131072 && code <= 262141);\n}, isZeroWidthCodePoint = (code) => {\n return code <= 31 || code >= 127 && code <= 159 || code >= 768 && code <= 879 || code >= 8203 && code <= 8207 || code >= 8400 && code <= 8447 || code >= 65024 && code <= 65039 || code >= 65056 && code <= 65071 || code >= 917760 && code <= 917999;\n}, getStringWidth = function getStringWidth2(str, removeControlChars = !0) {\n var width = 0;\n if (removeControlChars)\n str = stripVTControlCharacters(str);\n str = StringPrototypeNormalize.@call(str, \"NFC\");\n for (var char of new SafeStringIterator(str)) {\n var code = StringPrototypeCodePointAt.@call(char, 0);\n if (isFullWidthCodePoint(code))\n width += 2;\n else if (!isZeroWidthCodePoint(code))\n width++;\n }\n return width;\n}, ansiPattern = \"[\\\\u001B\\\\u009B][[\\\\]()#;\?]*(\?:(\?:(\?:(\?:;[-a-zA-Z\\\\d\\\\/#&.:=\?%@~_]+)*|[a-zA-Z\\\\d]+(\?:;[-a-zA-Z\\\\d\\\\/#&.:=\?%@~_]*)*)\?\\\\u0007)|(\?:(\?:\\\\d{1,4}(\?:;\\\\d{0,4})*)\?[\\\\dA-PR-TZcf-ntqry=><~]))\", ansi = new @RegExp(ansiPattern, \"g\"), kCustomPromisifiedSymbol = SymbolFor(\"nodejs.util.promisify.custom\"), kCustomPromisifyArgsSymbol = Symbol(\"customPromisifyArgs\");\npromisify.custom = kCustomPromisifiedSymbol;\nvar kUTF16SurrogateThreshold = 65536, kEscape = \"\\x1B\", kSubstringSearch = Symbol(\"kSubstringSearch\"), kIsNodeError = Symbol(\"kIsNodeError\"), errorBases = {}, VALID_NODE_ERROR_BASES = {\n TypeError,\n RangeError,\n Error\n}, NodeError = getNodeErrorByName(\"Error\"), NodeTypeError = getNodeErrorByName(\"TypeError\"), NodeRangeError = getNodeErrorByName(\"RangeError\");\n\nclass ERR_INVALID_ARG_TYPE extends NodeTypeError {\n constructor(name, type, value) {\n super(`The \"${name}\" argument must be of type ${type}. Received type ${typeof value}`, {\n code: \"ERR_INVALID_ARG_TYPE\"\n });\n }\n}\n\nclass ERR_INVALID_ARG_VALUE extends NodeTypeError {\n constructor(name, value, reason = \"not specified\") {\n super(`The value \"${@String(value)}\" is invalid for argument '${name}'. Reason: ${reason}`, {\n code: \"ERR_INVALID_ARG_VALUE\"\n });\n }\n}\n\nclass ERR_INVALID_CURSOR_POS extends NodeTypeError {\n constructor() {\n super(\"Cannot set cursor row without setting its column\", {\n code: \"ERR_INVALID_CURSOR_POS\"\n });\n }\n}\n\nclass ERR_OUT_OF_RANGE extends NodeRangeError {\n constructor(name, range, received) {\n super(`The value of \"${name}\" is out of range. It must be ${range}. Received ${received}`, {\n code: \"ERR_OUT_OF_RANGE\"\n });\n }\n}\n\nclass ERR_USE_AFTER_CLOSE extends NodeError {\n constructor() {\n super(\"This socket has been ended by the other party\", {\n code: \"ERR_USE_AFTER_CLOSE\"\n });\n }\n}\n\nclass AbortError extends Error {\n code;\n constructor() {\n super(\"The operation was aborted\");\n this.code = \"ABORT_ERR\";\n }\n}\nvar kClearLine, kClearScreenDown, kClearToLineBeginning, kClearToLineEnd;\nCSI.kEscape = kEscape;\nCSI.kClearLine = kClearLine = CSI`2K`;\nCSI.kClearScreenDown = kClearScreenDown = CSI`0J`;\nCSI.kClearToLineBeginning = kClearToLineBeginning = CSI`1K`;\nCSI.kClearToLineEnd = kClearToLineEnd = CSI`0K`;\nvar KEYPRESS_DECODER = Symbol(\"keypress-decoder\"), ESCAPE_DECODER = Symbol(\"escape-decoder\"), ESCAPE_CODE_TIMEOUT = 500, kEmptyObject = ObjectFreeze(ObjectCreate(null)), kHistorySize = 30, kMaxUndoRedoStackSize = 2048, kMincrlfDelay = 100, lineEnding = /\\r\?\\n|\\r(\?!\\n)/g, kMaxLengthOfKillRing = 32, kLineObjectStream = Symbol(\"line object stream\"), kQuestionCancel = Symbol(\"kQuestionCancel\"), kQuestion = Symbol(\"kQuestion\"), kAddHistory = Symbol(\"_addHistory\"), kBeforeEdit = Symbol(\"_beforeEdit\"), kDecoder = Symbol(\"_decoder\"), kDeleteLeft = Symbol(\"_deleteLeft\"), kDeleteLineLeft = Symbol(\"_deleteLineLeft\"), kDeleteLineRight = Symbol(\"_deleteLineRight\"), kDeleteRight = Symbol(\"_deleteRight\"), kDeleteWordLeft = Symbol(\"_deleteWordLeft\"), kDeleteWordRight = Symbol(\"_deleteWordRight\"), kGetDisplayPos = Symbol(\"_getDisplayPos\"), kHistoryNext = Symbol(\"_historyNext\"), kHistoryPrev = Symbol(\"_historyPrev\"), kInsertString = Symbol(\"_insertString\"), kLine = Symbol(\"_line\"), kLine_buffer = Symbol(\"_line_buffer\"), kKillRing = Symbol(\"_killRing\"), kKillRingCursor = Symbol(\"_killRingCursor\"), kMoveCursor = Symbol(\"_moveCursor\"), kNormalWrite = Symbol(\"_normalWrite\"), kOldPrompt = Symbol(\"_oldPrompt\"), kOnLine = Symbol(\"_onLine\"), kPreviousKey = Symbol(\"_previousKey\"), kPrompt = Symbol(\"_prompt\"), kPushToKillRing = Symbol(\"_pushToKillRing\"), kPushToUndoStack = Symbol(\"_pushToUndoStack\"), kQuestionCallback = Symbol(\"_questionCallback\"), kRedo = Symbol(\"_redo\"), kRedoStack = Symbol(\"_redoStack\"), kRefreshLine = Symbol(\"_refreshLine\"), kSawKeyPress = Symbol(\"_sawKeyPress\"), kSawReturnAt = Symbol(\"_sawReturnAt\"), kSetRawMode = Symbol(\"_setRawMode\"), kTabComplete = Symbol(\"_tabComplete\"), kTabCompleter = Symbol(\"_tabCompleter\"), kTtyWrite = Symbol(\"_ttyWrite\"), kUndo = Symbol(\"_undo\"), kUndoStack = Symbol(\"_undoStack\"), kWordLeft = Symbol(\"_wordLeft\"), kWordRight = Symbol(\"_wordRight\"), kWriteToOutput = Symbol(\"_writeToOutput\"), kYank = Symbol(\"_yank\"), kYanking = Symbol(\"_yanking\"), kYankPop = Symbol(\"_yankPop\"), kFirstEventParam = Symbol(\"nodejs.kFirstEventParam\"), kOnSelfCloseWithTerminal = Symbol(\"_onSelfCloseWithTerminal\"), kOnSelfCloseWithoutTerminal = Symbol(\"_onSelfCloseWithoutTerminal\"), kOnKeyPress = Symbol(\"_onKeyPress\"), kOnError = Symbol(\"_onError\"), kOnData = Symbol(\"_onData\"), kOnEnd = Symbol(\"_onEnd\"), kOnTermEnd = Symbol(\"_onTermEnd\"), kOnResize = Symbol(\"_onResize\");\nInterfaceConstructor.prototype = {};\nObjectSetPrototypeOf(InterfaceConstructor.prototype, EventEmitter.prototype);\nvar _Interface = class Interface2 extends InterfaceConstructor {\n constructor(input, output, completer, terminal) {\n super(input, output, completer, terminal);\n }\n get columns() {\n var output = this.output;\n if (output && output.columns)\n return output.columns;\n return @Infinity;\n }\n setPrompt(prompt) {\n this[kPrompt] = prompt;\n }\n getPrompt() {\n return this[kPrompt];\n }\n [kSetRawMode](flag) {\n const mode = flag + 0, wasInRawMode = this.input.isRaw;\n var setRawMode = this.input.setRawMode;\n if (typeof setRawMode === \"function\")\n setRawMode.@call(this.input, mode);\n return wasInRawMode;\n }\n prompt(preserveCursor) {\n if (this.paused)\n this.resume();\n if (this.terminal) {\n if (!preserveCursor)\n this.cursor = 0;\n this[kRefreshLine]();\n } else\n this[kWriteToOutput](this[kPrompt]);\n }\n [kQuestion](query, cb) {\n if (this.closed)\n throw new ERR_USE_AFTER_CLOSE(\"readline\");\n if (this[kQuestionCallback])\n this.prompt();\n else\n this[kOldPrompt] = this[kPrompt], this.setPrompt(query), this[kQuestionCallback] = cb, this.prompt();\n }\n [kOnLine](line) {\n if (this[kQuestionCallback]) {\n var cb = this[kQuestionCallback];\n this[kQuestionCallback] = null, this.setPrompt(this[kOldPrompt]), cb(line);\n } else\n this.emit(\"line\", line);\n }\n [kBeforeEdit](oldText, oldCursor) {\n this[kPushToUndoStack](oldText, oldCursor);\n }\n [kQuestionCancel]() {\n if (this[kQuestionCallback])\n this[kQuestionCallback] = null, this.setPrompt(this[kOldPrompt]), this.clearLine();\n }\n [kWriteToOutput](stringToWrite) {\n if (validateString(stringToWrite, \"stringToWrite\"), this.output !== null && this.output !== @undefined)\n this.output.write(stringToWrite);\n }\n [kAddHistory]() {\n if (this.line.length === 0)\n return \"\";\n if (this.historySize === 0)\n return this.line;\n if (StringPrototypeTrim.@call(this.line).length === 0)\n return this.line;\n if (this.history.length === 0 || this.history[0] !== this.line) {\n if (this.removeHistoryDuplicates) {\n var dupIndex = ArrayPrototypeIndexOf.@call(this.history, this.line);\n if (dupIndex !== -1)\n ArrayPrototypeSplice.@call(this.history, dupIndex, 1);\n }\n if (ArrayPrototypeUnshift.@call(this.history, this.line), this.history.length > this.historySize)\n ArrayPrototypePop.@call(this.history);\n }\n this.historyIndex = -1;\n var line = this.history[0];\n return this.emit(\"history\", this.history), line;\n }\n [kRefreshLine]() {\n var line = this[kPrompt] + this.line, dispPos = this[kGetDisplayPos](line), lineCols = dispPos.cols, lineRows = dispPos.rows, cursorPos = this.getCursorPos(), prevRows = this.prevRows || 0;\n if (prevRows > 0)\n moveCursor(this.output, 0, -prevRows);\n if (cursorTo(this.output, 0), clearScreenDown(this.output), this[kWriteToOutput](line), lineCols === 0)\n this[kWriteToOutput](\" \");\n cursorTo(this.output, cursorPos.cols);\n var diff = lineRows - cursorPos.rows;\n if (diff > 0)\n moveCursor(this.output, 0, -diff);\n this.prevRows = cursorPos.rows;\n }\n close() {\n if (this.closed)\n return;\n if (this.pause(), this.terminal)\n this[kSetRawMode](!1);\n this.closed = !0, this.emit(\"close\");\n }\n pause() {\n if (this.paused)\n return;\n return this.input.pause(), this.paused = !0, this.emit(\"pause\"), this;\n }\n resume() {\n if (!this.paused)\n return;\n return this.input.resume(), this.paused = !1, this.emit(\"resume\"), this;\n }\n write(d, key) {\n if (this.paused)\n this.resume();\n if (this.terminal)\n this[kTtyWrite](d, key);\n else\n this[kNormalWrite](d);\n }\n [kNormalWrite](b) {\n if (b === @undefined)\n return;\n var string = this[kDecoder].write(b);\n if (this[kSawReturnAt] && DateNow() - this[kSawReturnAt] <= this.crlfDelay) {\n if (StringPrototypeCodePointAt.@call(string) === 10)\n string = StringPrototypeSlice.@call(string, 1);\n this[kSawReturnAt] = 0;\n }\n var newPartContainsEnding = RegExpPrototypeExec.@call(lineEnding, string);\n if (newPartContainsEnding !== null) {\n if (this[kLine_buffer])\n string = this[kLine_buffer] + string, this[kLine_buffer] = null, newPartContainsEnding = RegExpPrototypeExec.@call(lineEnding, string);\n this[kSawReturnAt] = StringPrototypeEndsWith.@call(string, \"\\r\") \? DateNow() : 0;\n var indexes = [0, newPartContainsEnding.index, lineEnding.lastIndex], nextMatch;\n while ((nextMatch = RegExpPrototypeExec.@call(lineEnding, string)) !== null)\n ArrayPrototypePush.@call(indexes, nextMatch.index, lineEnding.lastIndex);\n var lastIndex = indexes.length - 1;\n this[kLine_buffer] = StringPrototypeSlice.@call(string, indexes[lastIndex]);\n for (var i = 1;i < lastIndex; i += 2)\n this[kOnLine](StringPrototypeSlice.@call(string, indexes[i - 1], indexes[i]));\n } else if (string)\n if (this[kLine_buffer])\n this[kLine_buffer] += string;\n else\n this[kLine_buffer] = string;\n }\n [kInsertString](c) {\n if (this[kBeforeEdit](this.line, this.cursor), this.cursor < this.line.length) {\n var beg = StringPrototypeSlice.@call(this.line, 0, this.cursor), end = StringPrototypeSlice.@call(this.line, this.cursor, this.line.length);\n this.line = beg + c + end, this.cursor += c.length, this[kRefreshLine]();\n } else {\n var oldPos = this.getCursorPos();\n this.line += c, this.cursor += c.length;\n var newPos = this.getCursorPos();\n if (oldPos.rows < newPos.rows)\n this[kRefreshLine]();\n else\n this[kWriteToOutput](c);\n }\n }\n async[kTabComplete](lastKeypressWasTab) {\n this.pause();\n var string = StringPrototypeSlice.@call(this.line, 0, this.cursor), value;\n try {\n value = await this.completer(string);\n } catch (err) {\n this[kWriteToOutput](`Tab completion error: ${inspect(err)}`);\n return;\n } finally {\n this.resume();\n }\n this[kTabCompleter](lastKeypressWasTab, value);\n }\n [kTabCompleter](lastKeypressWasTab, { 0: completions, 1: completeOn }) {\n if (!completions || completions.length === 0)\n return;\n var prefix = commonPrefix(ArrayPrototypeFilter.@call(completions, (e) => e !== \"\"));\n if (StringPrototypeStartsWith.@call(prefix, completeOn) && prefix.length > completeOn.length) {\n this[kInsertString](StringPrototypeSlice.@call(prefix, completeOn.length));\n return;\n } else if (!StringPrototypeStartsWith.@call(completeOn, prefix)) {\n this.line = StringPrototypeSlice.@call(this.line, 0, this.cursor - completeOn.length) + prefix + StringPrototypeSlice.@call(this.line, this.cursor, this.line.length), this.cursor = this.cursor - completeOn.length + prefix.length, this._refreshLine();\n return;\n }\n if (!lastKeypressWasTab)\n return;\n this[kBeforeEdit](this.line, this.cursor);\n var completionsWidth = ArrayPrototypeMap.@call(completions, (e) => getStringWidth(e)), width = MathMax.@apply(completionsWidth) + 2, maxColumns = MathFloor(this.columns / width) || 1;\n if (maxColumns === @Infinity)\n maxColumns = 1;\n var output = \"\\r\\n\", lineIndex = 0, whitespace = 0;\n for (var i = 0;i < completions.length; i++) {\n var completion = completions[i];\n if (completion === \"\" || lineIndex === maxColumns)\n output += \"\\r\\n\", lineIndex = 0, whitespace = 0;\n else\n output += StringPrototypeRepeat.@call(\" \", whitespace);\n if (completion !== \"\")\n output += completion, whitespace = width - completionsWidth[i], lineIndex++;\n else\n output += \"\\r\\n\";\n }\n if (lineIndex !== 0)\n output += \"\\r\\n\\r\\n\";\n this[kWriteToOutput](output), this[kRefreshLine]();\n }\n [kWordLeft]() {\n if (this.cursor > 0) {\n var leading = StringPrototypeSlice.@call(this.line, 0, this.cursor), reversed = ArrayPrototypeJoin.@call(ArrayPrototypeReverse.@call(ArrayFrom(leading)), \"\"), match = RegExpPrototypeExec.@call(/^\\s*(\?:[^\\w\\s]+|\\w+)\?/, reversed);\n this[kMoveCursor](-match[0].length);\n }\n }\n [kWordRight]() {\n if (this.cursor < this.line.length) {\n var trailing = StringPrototypeSlice.@call(this.line, this.cursor), match = RegExpPrototypeExec.@call(/^(\?:\\s+|[^\\w\\s]+|\\w+)\\s*/, trailing);\n this[kMoveCursor](match[0].length);\n }\n }\n [kDeleteLeft]() {\n if (this.cursor > 0 && this.line.length > 0) {\n this[kBeforeEdit](this.line, this.cursor);\n var charSize = charLengthLeft(this.line, this.cursor);\n this.line = StringPrototypeSlice.@call(this.line, 0, this.cursor - charSize) + StringPrototypeSlice.@call(this.line, this.cursor, this.line.length), this.cursor -= charSize, this[kRefreshLine]();\n }\n }\n [kDeleteRight]() {\n if (this.cursor < this.line.length) {\n this[kBeforeEdit](this.line, this.cursor);\n var charSize = charLengthAt(this.line, this.cursor);\n this.line = StringPrototypeSlice.@call(this.line, 0, this.cursor) + StringPrototypeSlice.@call(this.line, this.cursor + charSize, this.line.length), this[kRefreshLine]();\n }\n }\n [kDeleteWordLeft]() {\n if (this.cursor > 0) {\n this[kBeforeEdit](this.line, this.cursor);\n var leading = StringPrototypeSlice.@call(this.line, 0, this.cursor), reversed = ArrayPrototypeJoin.@call(ArrayPrototypeReverse.@call(ArrayFrom(leading)), \"\"), match = RegExpPrototypeExec.@call(/^\\s*(\?:[^\\w\\s]+|\\w+)\?/, reversed);\n leading = StringPrototypeSlice.@call(leading, 0, leading.length - match[0].length), this.line = leading + StringPrototypeSlice.@call(this.line, this.cursor, this.line.length), this.cursor = leading.length, this[kRefreshLine]();\n }\n }\n [kDeleteWordRight]() {\n if (this.cursor < this.line.length) {\n this[kBeforeEdit](this.line, this.cursor);\n var trailing = StringPrototypeSlice.@call(this.line, this.cursor), match = RegExpPrototypeExec.@call(/^(\?:\\s+|\\W+|\\w+)\\s*/, trailing);\n this.line = StringPrototypeSlice.@call(this.line, 0, this.cursor) + StringPrototypeSlice.@call(trailing, match[0].length), this[kRefreshLine]();\n }\n }\n [kDeleteLineLeft]() {\n this[kBeforeEdit](this.line, this.cursor);\n var del = StringPrototypeSlice.@call(this.line, 0, this.cursor);\n this.line = StringPrototypeSlice.@call(this.line, this.cursor), this.cursor = 0, this[kPushToKillRing](del), this[kRefreshLine]();\n }\n [kDeleteLineRight]() {\n this[kBeforeEdit](this.line, this.cursor);\n var del = StringPrototypeSlice.@call(this.line, this.cursor);\n this.line = StringPrototypeSlice.@call(this.line, 0, this.cursor), this[kPushToKillRing](del), this[kRefreshLine]();\n }\n [kPushToKillRing](del) {\n if (!del || del === this[kKillRing][0])\n return;\n ArrayPrototypeUnshift.@call(this[kKillRing], del), this[kKillRingCursor] = 0;\n while (this[kKillRing].length > kMaxLengthOfKillRing)\n ArrayPrototypePop.@call(this[kKillRing]);\n }\n [kYank]() {\n if (this[kKillRing].length > 0)\n this[kYanking] = !0, this[kInsertString](this[kKillRing][this[kKillRingCursor]]);\n }\n [kYankPop]() {\n if (!this[kYanking])\n return;\n if (this[kKillRing].length > 1) {\n var lastYank = this[kKillRing][this[kKillRingCursor]];\n if (this[kKillRingCursor]++, this[kKillRingCursor] >= this[kKillRing].length)\n this[kKillRingCursor] = 0;\n var currentYank = this[kKillRing][this[kKillRingCursor]], head = StringPrototypeSlice.@call(this.line, 0, this.cursor - lastYank.length), tail = StringPrototypeSlice.@call(this.line, this.cursor);\n this.line = head + currentYank + tail, this.cursor = head.length + currentYank.length, this[kRefreshLine]();\n }\n }\n clearLine() {\n this[kMoveCursor](+@Infinity), this[kWriteToOutput](\"\\r\\n\"), this.line = \"\", this.cursor = 0, this.prevRows = 0;\n }\n [kLine]() {\n var line = this[kAddHistory]();\n this[kUndoStack] = [], this[kRedoStack] = [], this.clearLine(), this[kOnLine](line);\n }\n [kPushToUndoStack](text, cursor) {\n if (ArrayPrototypePush.@call(this[kUndoStack], { text, cursor }) > kMaxUndoRedoStackSize)\n ArrayPrototypeShift.@call(this[kUndoStack]);\n }\n [kUndo]() {\n if (this[kUndoStack].length <= 0)\n return;\n ArrayPrototypePush.@call(this[kRedoStack], {\n text: this.line,\n cursor: this.cursor\n });\n var entry = ArrayPrototypePop.@call(this[kUndoStack]);\n this.line = entry.text, this.cursor = entry.cursor, this[kRefreshLine]();\n }\n [kRedo]() {\n if (this[kRedoStack].length <= 0)\n return;\n ArrayPrototypePush.@call(this[kUndoStack], {\n text: this.line,\n cursor: this.cursor\n });\n var entry = ArrayPrototypePop.@call(this[kRedoStack]);\n this.line = entry.text, this.cursor = entry.cursor, this[kRefreshLine]();\n }\n [kHistoryNext]() {\n if (this.historyIndex >= 0) {\n this[kBeforeEdit](this.line, this.cursor);\n var search = this[kSubstringSearch] || \"\", index = this.historyIndex - 1;\n while (index >= 0 && (!StringPrototypeStartsWith.@call(this.history[index], search) || this.line === this.history[index]))\n index--;\n if (index === -1)\n this.line = search;\n else\n this.line = this.history[index];\n this.historyIndex = index, this.cursor = this.line.length, this[kRefreshLine]();\n }\n }\n [kHistoryPrev]() {\n if (this.historyIndex < this.history.length && this.history.length) {\n this[kBeforeEdit](this.line, this.cursor);\n var search = this[kSubstringSearch] || \"\", index = this.historyIndex + 1;\n while (index < this.history.length && (!StringPrototypeStartsWith.@call(this.history[index], search) || this.line === this.history[index]))\n index++;\n if (index === this.history.length)\n this.line = search;\n else\n this.line = this.history[index];\n this.historyIndex = index, this.cursor = this.line.length, this[kRefreshLine]();\n }\n }\n [kGetDisplayPos](str) {\n var offset = 0, col = this.columns, rows = 0;\n str = stripVTControlCharacters(str);\n for (var char of new SafeStringIterator(str)) {\n if (char === \"\\n\") {\n rows += MathCeil(offset / col) || 1, offset = 0;\n continue;\n }\n if (char === \"\\t\") {\n offset += this.tabSize - offset % this.tabSize;\n continue;\n }\n var width = getStringWidth(char, !1);\n if (width === 0 || width === 1)\n offset += width;\n else {\n if ((offset + 1) % col === 0)\n offset++;\n offset += 2;\n }\n }\n var cols = offset % col;\n return rows += (offset - cols) / col, { cols, rows };\n }\n getCursorPos() {\n var strBeforeCursor = this[kPrompt] + StringPrototypeSlice.@call(this.line, 0, this.cursor);\n return this[kGetDisplayPos](strBeforeCursor);\n }\n [kMoveCursor](dx) {\n if (dx === 0)\n return;\n var oldPos = this.getCursorPos();\n if (this.cursor += dx, this.cursor < 0)\n this.cursor = 0;\n else if (this.cursor > this.line.length)\n this.cursor = this.line.length;\n var newPos = this.getCursorPos();\n if (oldPos.rows === newPos.rows) {\n var diffWidth = newPos.cols - oldPos.cols;\n moveCursor(this.output, diffWidth, 0);\n } else\n this[kRefreshLine]();\n }\n [kTtyWrite](s, key) {\n var previousKey = this[kPreviousKey];\n key = key || kEmptyObject, this[kPreviousKey] = key;\n var { name: keyName, meta: keyMeta, ctrl: keyCtrl2, shift: keyShift, sequence: keySeq } = key;\n if (!keyMeta || keyName !== \"y\")\n this[kYanking] = !1;\n if ((keyName === \"up\" || keyName === \"down\") && !keyCtrl2 && !keyMeta && !keyShift) {\n if (this[kSubstringSearch] === null)\n this[kSubstringSearch] = StringPrototypeSlice.@call(this.line, 0, this.cursor);\n } else if (this[kSubstringSearch] !== null) {\n if (this[kSubstringSearch] = null, this.history.length === this.historyIndex)\n this.historyIndex = -1;\n }\n if (typeof keySeq === \"string\")\n switch (StringPrototypeCodePointAt.@call(keySeq, 0)) {\n case 31:\n this[kUndo]();\n return;\n case 30:\n this[kRedo]();\n return;\n default:\n break;\n }\n if (keyName === \"escape\")\n return;\n if (keyCtrl2 && keyShift)\n switch (keyName) {\n case \"backspace\":\n this[kDeleteLineLeft]();\n break;\n case \"delete\":\n this[kDeleteLineRight]();\n break;\n }\n else if (keyCtrl2)\n switch (keyName) {\n case \"c\":\n if (this.listenerCount(\"SIGINT\") > 0)\n this.emit(\"SIGINT\");\n else\n this.close();\n break;\n case \"h\":\n this[kDeleteLeft]();\n break;\n case \"d\":\n if (this.cursor === 0 && this.line.length === 0)\n this.close();\n else if (this.cursor < this.line.length)\n this[kDeleteRight]();\n break;\n case \"u\":\n this[kDeleteLineLeft]();\n break;\n case \"k\":\n this[kDeleteLineRight]();\n break;\n case \"a\":\n this[kMoveCursor](-@Infinity);\n break;\n case \"e\":\n this[kMoveCursor](+@Infinity);\n break;\n case \"b\":\n this[kMoveCursor](-charLengthLeft(this.line, this.cursor));\n break;\n case \"f\":\n this[kMoveCursor](+charLengthAt(this.line, this.cursor));\n break;\n case \"l\":\n cursorTo(this.output, 0, 0), clearScreenDown(this.output), this[kRefreshLine]();\n break;\n case \"n\":\n this[kHistoryNext]();\n break;\n case \"p\":\n this[kHistoryPrev]();\n break;\n case \"y\":\n this[kYank]();\n break;\n case \"z\":\n if (this.listenerCount(\"SIGTSTP\") > 0)\n this.emit(\"SIGTSTP\");\n else\n process.once(\"SIGCONT\", () => {\n if (!this.paused)\n this.pause(), this.emit(\"SIGCONT\");\n this[kSetRawMode](!0), this[kRefreshLine]();\n }), this[kSetRawMode](!1), process.kill(process.pid, \"SIGTSTP\");\n break;\n case \"w\":\n case \"backspace\":\n this[kDeleteWordLeft]();\n break;\n case \"delete\":\n this[kDeleteWordRight]();\n break;\n case \"left\":\n this[kWordLeft]();\n break;\n case \"right\":\n this[kWordRight]();\n break;\n }\n else if (keyMeta)\n switch (keyName) {\n case \"b\":\n this[kWordLeft]();\n break;\n case \"f\":\n this[kWordRight]();\n break;\n case \"d\":\n case \"delete\":\n this[kDeleteWordRight]();\n break;\n case \"backspace\":\n this[kDeleteWordLeft]();\n break;\n case \"y\":\n this[kYankPop]();\n break;\n }\n else {\n if (this[kSawReturnAt] && keyName !== \"enter\")\n this[kSawReturnAt] = 0;\n switch (keyName) {\n case \"return\":\n this[kSawReturnAt] = DateNow(), this[kLine]();\n break;\n case \"enter\":\n if (this[kSawReturnAt] === 0 || DateNow() - this[kSawReturnAt] > this.crlfDelay)\n this[kLine]();\n this[kSawReturnAt] = 0;\n break;\n case \"backspace\":\n this[kDeleteLeft]();\n break;\n case \"delete\":\n this[kDeleteRight]();\n break;\n case \"left\":\n this[kMoveCursor](-charLengthLeft(this.line, this.cursor));\n break;\n case \"right\":\n this[kMoveCursor](+charLengthAt(this.line, this.cursor));\n break;\n case \"home\":\n this[kMoveCursor](-@Infinity);\n break;\n case \"end\":\n this[kMoveCursor](+@Infinity);\n break;\n case \"up\":\n this[kHistoryPrev]();\n break;\n case \"down\":\n this[kHistoryNext]();\n break;\n case \"tab\":\n if (typeof this.completer === \"function\" && this.isCompletionEnabled) {\n var lastKeypressWasTab = previousKey && previousKey.name === \"tab\";\n this[kTabComplete](lastKeypressWasTab);\n break;\n }\n default:\n if (typeof s === \"string\" && s) {\n var nextMatch = RegExpPrototypeExec.@call(lineEnding, s);\n if (nextMatch !== null) {\n this[kInsertString](StringPrototypeSlice.@call(s, 0, nextMatch.index));\n var { lastIndex } = lineEnding;\n while ((nextMatch = RegExpPrototypeExec.@call(lineEnding, s)) !== null)\n this[kLine](), this[kInsertString](StringPrototypeSlice.@call(s, lastIndex, nextMatch.index)), { lastIndex } = lineEnding;\n if (lastIndex === s.length)\n this[kLine]();\n } else\n this[kInsertString](s);\n }\n }\n }\n }\n [SymbolAsyncIterator]() {\n if (this[kLineObjectStream] === @undefined)\n this[kLineObjectStream] = EventEmitter.on(this, \"line\", {\n close: [\"close\"],\n highWatermark: 1024,\n [kFirstEventParam]: !0\n });\n return this[kLineObjectStream];\n }\n};\nInterface.prototype = {};\nObjectSetPrototypeOf(Interface.prototype, _Interface.prototype);\nObjectSetPrototypeOf(Interface, _Interface);\nInterface.prototype.question = function question(query, options, cb) {\n if (cb = typeof options === \"function\" \? options : cb, options === null || typeof options !== \"object\")\n options = kEmptyObject;\n var signal = options\?.signal;\n if (signal) {\n if (validateAbortSignal(signal, \"options.signal\"), signal.aborted)\n return;\n var onAbort = () => {\n this[kQuestionCancel]();\n };\n signal.addEventListener(\"abort\", onAbort, { once: !0 });\n var cleanup = () => {\n signal.removeEventListener(\"abort\", onAbort);\n }, originalCb = cb;\n cb = typeof cb === \"function\" \? (answer) => {\n return cleanup(), originalCb(answer);\n } : cleanup;\n }\n if (typeof cb === \"function\")\n this[kQuestion](query, cb);\n};\nInterface.prototype.question[promisify.custom] = function question2(query, options) {\n if (options === null || typeof options !== \"object\")\n options = kEmptyObject;\n var signal = options\?.signal;\n if (signal && signal.aborted)\n return PromiseReject(new AbortError(@undefined, { cause: signal.reason }));\n return new @Promise((resolve, reject) => {\n var cb = resolve;\n if (signal) {\n var onAbort = () => {\n reject(new AbortError(@undefined, { cause: signal.reason }));\n };\n signal.addEventListener(\"abort\", onAbort, { once: !0 }), cb = (answer) => {\n signal.removeEventListener(\"abort\", onAbort), resolve(answer);\n };\n }\n this.question(query, options, cb);\n });\n};\nObjectDefineProperties(Interface.prototype, {\n [kSetRawMode]: {\n __proto__: null,\n get() {\n return this._setRawMode;\n }\n },\n [kOnLine]: {\n __proto__: null,\n get() {\n return this._onLine;\n }\n },\n [kWriteToOutput]: {\n __proto__: null,\n get() {\n return this._writeToOutput;\n }\n },\n [kAddHistory]: {\n __proto__: null,\n get() {\n return this._addHistory;\n }\n },\n [kRefreshLine]: {\n __proto__: null,\n get() {\n return this._refreshLine;\n }\n },\n [kNormalWrite]: {\n __proto__: null,\n get() {\n return this._normalWrite;\n }\n },\n [kInsertString]: {\n __proto__: null,\n get() {\n return this._insertString;\n }\n },\n [kTabComplete]: {\n __proto__: null,\n get() {\n return this._tabComplete;\n }\n },\n [kWordLeft]: {\n __proto__: null,\n get() {\n return this._wordLeft;\n }\n },\n [kWordRight]: {\n __proto__: null,\n get() {\n return this._wordRight;\n }\n },\n [kDeleteLeft]: {\n __proto__: null,\n get() {\n return this._deleteLeft;\n }\n },\n [kDeleteRight]: {\n __proto__: null,\n get() {\n return this._deleteRight;\n }\n },\n [kDeleteWordLeft]: {\n __proto__: null,\n get() {\n return this._deleteWordLeft;\n }\n },\n [kDeleteWordRight]: {\n __proto__: null,\n get() {\n return this._deleteWordRight;\n }\n },\n [kDeleteLineLeft]: {\n __proto__: null,\n get() {\n return this._deleteLineLeft;\n }\n },\n [kDeleteLineRight]: {\n __proto__: null,\n get() {\n return this._deleteLineRight;\n }\n },\n [kLine]: {\n __proto__: null,\n get() {\n return this._line;\n }\n },\n [kHistoryNext]: {\n __proto__: null,\n get() {\n return this._historyNext;\n }\n },\n [kHistoryPrev]: {\n __proto__: null,\n get() {\n return this._historyPrev;\n }\n },\n [kGetDisplayPos]: {\n __proto__: null,\n get() {\n return this._getDisplayPos;\n }\n },\n [kMoveCursor]: {\n __proto__: null,\n get() {\n return this._moveCursor;\n }\n },\n [kTtyWrite]: {\n __proto__: null,\n get() {\n return this._ttyWrite;\n }\n },\n _decoder: {\n __proto__: null,\n get() {\n return this[kDecoder];\n },\n set(value) {\n this[kDecoder] = value;\n }\n },\n _line_buffer: {\n __proto__: null,\n get() {\n return this[kLine_buffer];\n },\n set(value) {\n this[kLine_buffer] = value;\n }\n },\n _oldPrompt: {\n __proto__: null,\n get() {\n return this[kOldPrompt];\n },\n set(value) {\n this[kOldPrompt] = value;\n }\n },\n _previousKey: {\n __proto__: null,\n get() {\n return this[kPreviousKey];\n },\n set(value) {\n this[kPreviousKey] = value;\n }\n },\n _prompt: {\n __proto__: null,\n get() {\n return this[kPrompt];\n },\n set(value) {\n this[kPrompt] = value;\n }\n },\n _questionCallback: {\n __proto__: null,\n get() {\n return this[kQuestionCallback];\n },\n set(value) {\n this[kQuestionCallback] = value;\n }\n },\n _sawKeyPress: {\n __proto__: null,\n get() {\n return this[kSawKeyPress];\n },\n set(value) {\n this[kSawKeyPress] = value;\n }\n },\n _sawReturnAt: {\n __proto__: null,\n get() {\n return this[kSawReturnAt];\n },\n set(value) {\n this[kSawReturnAt] = value;\n }\n }\n});\nInterface.prototype._setRawMode = _Interface.prototype[kSetRawMode];\nInterface.prototype._onLine = _Interface.prototype[kOnLine];\nInterface.prototype._writeToOutput = _Interface.prototype[kWriteToOutput];\nInterface.prototype._addHistory = _Interface.prototype[kAddHistory];\nInterface.prototype._refreshLine = _Interface.prototype[kRefreshLine];\nInterface.prototype._normalWrite = _Interface.prototype[kNormalWrite];\nInterface.prototype._insertString = _Interface.prototype[kInsertString];\nInterface.prototype._tabComplete = function(lastKeypressWasTab) {\n this.pause();\n var string = StringPrototypeSlice.@call(this.line, 0, this.cursor);\n this.completer(string, (err, value) => {\n if (this.resume(), err) {\n this._writeToOutput(`Tab completion error: ${inspect(err)}`);\n return;\n }\n this[kTabCompleter](lastKeypressWasTab, value);\n });\n};\nInterface.prototype._wordLeft = _Interface.prototype[kWordLeft];\nInterface.prototype._wordRight = _Interface.prototype[kWordRight];\nInterface.prototype._deleteLeft = _Interface.prototype[kDeleteLeft];\nInterface.prototype._deleteRight = _Interface.prototype[kDeleteRight];\nInterface.prototype._deleteWordLeft = _Interface.prototype[kDeleteWordLeft];\nInterface.prototype._deleteWordRight = _Interface.prototype[kDeleteWordRight];\nInterface.prototype._deleteLineLeft = _Interface.prototype[kDeleteLineLeft];\nInterface.prototype._deleteLineRight = _Interface.prototype[kDeleteLineRight];\nInterface.prototype._line = _Interface.prototype[kLine];\nInterface.prototype._historyNext = _Interface.prototype[kHistoryNext];\nInterface.prototype._historyPrev = _Interface.prototype[kHistoryPrev];\nInterface.prototype._getDisplayPos = _Interface.prototype[kGetDisplayPos];\nInterface.prototype._getCursorPos = _Interface.prototype.getCursorPos;\nInterface.prototype._moveCursor = _Interface.prototype[kMoveCursor];\nInterface.prototype._ttyWrite = _Interface.prototype[kTtyWrite];\n\nclass Readline {\n #autoCommit = !1;\n #stream;\n #todo = [];\n constructor(stream, options = @undefined) {\n if (isWritable \?\?= (@getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39)).isWritable, !isWritable(stream))\n throw new ERR_INVALID_ARG_TYPE(\"stream\", \"Writable\", stream);\n if (this.#stream = stream, options\?.autoCommit != null)\n validateBoolean(options.autoCommit, \"options.autoCommit\"), this.#autoCommit = options.autoCommit;\n }\n cursorTo(x, y = @undefined) {\n if (validateInteger(x, \"x\"), y != null)\n validateInteger(y, \"y\");\n var data = y == null \? CSI`${x + 1}G` : CSI`${y + 1};${x + 1}H`;\n if (this.#autoCommit)\n process.nextTick(() => this.#stream.write(data));\n else\n ArrayPrototypePush.@call(this.#todo, data);\n return this;\n }\n moveCursor(dx, dy) {\n if (dx || dy) {\n validateInteger(dx, \"dx\"), validateInteger(dy, \"dy\");\n var data = \"\";\n if (dx < 0)\n data += CSI`${-dx}D`;\n else if (dx > 0)\n data += CSI`${dx}C`;\n if (dy < 0)\n data += CSI`${-dy}A`;\n else if (dy > 0)\n data += CSI`${dy}B`;\n if (this.#autoCommit)\n process.nextTick(() => this.#stream.write(data));\n else\n ArrayPrototypePush.@call(this.#todo, data);\n }\n return this;\n }\n clearLine(dir) {\n validateInteger(dir, \"dir\", -1, 1);\n var data = dir < 0 \? kClearToLineBeginning : dir > 0 \? kClearToLineEnd : kClearLine;\n if (this.#autoCommit)\n process.nextTick(() => this.#stream.write(data));\n else\n ArrayPrototypePush.@call(this.#todo, data);\n return this;\n }\n clearScreenDown() {\n if (this.#autoCommit)\n process.nextTick(() => this.#stream.write(kClearScreenDown));\n else\n ArrayPrototypePush.@call(this.#todo, kClearScreenDown);\n return this;\n }\n commit() {\n return new @Promise((resolve) => {\n this.#stream.write(ArrayPrototypeJoin.@call(this.#todo, \"\"), resolve), this.#todo = [];\n });\n }\n rollback() {\n return this.#todo = [], this;\n }\n}\nvar PromisesInterface = class Interface3 extends _Interface {\n constructor(input, output, completer, terminal) {\n super(input, output, completer, terminal);\n }\n question(query, options = kEmptyObject) {\n var signal = options\?.signal;\n if (signal) {\n if (validateAbortSignal(signal, \"options.signal\"), signal.aborted)\n return PromiseReject(new AbortError(@undefined, { cause: signal.reason }));\n }\n return new @Promise((resolve, reject) => {\n var cb = resolve;\n if (options\?.signal) {\n var onAbort = () => {\n this[kQuestionCancel](), reject(new AbortError(@undefined, { cause: signal.reason }));\n };\n signal.addEventListener(\"abort\", onAbort, { once: !0 }), cb = (answer) => {\n signal.removeEventListener(\"abort\", onAbort), resolve(answer);\n };\n }\n this[kQuestion](query, cb);\n });\n }\n};\n$ = {\n Interface,\n clearLine,\n clearScreenDown,\n createInterface,\n cursorTo,\n emitKeypressEvents,\n moveCursor,\n promises: {\n Readline,\n Interface: PromisesInterface,\n createInterface(input, output, completer, terminal) {\n return new PromisesInterface(input, output, completer, terminal);\n }\n },\n [SymbolFor(\"__BUN_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED__\")]: {\n CSI,\n utils: {\n getStringWidth,\n stripVTControlCharacters\n }\n }\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeReadlinePromisesCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/readline.promises.ts\nreturn (@getInternalField(@internalModuleRegistry, 35) || @createInternalModuleById(35)).promises})\n"); -// - -// -static constexpr ASCIILiteral NodeReplCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/repl.ts\nvar $, { throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6);\n$ = {\n lines: [],\n context: globalThis,\n historyIndex: -1,\n cursor: 0,\n historySize: 1000,\n removeHistoryDuplicates: !1,\n crlfDelay: 100,\n completer: () => {\n throwNotImplemented(\"node:repl\");\n },\n history: [],\n _initialPrompt: \"> \",\n terminal: !0,\n input: new Proxy({}, {\n get() {\n throwNotImplemented(\"node:repl\");\n },\n has: () => !1,\n ownKeys: () => [],\n getOwnPropertyDescriptor: () => @undefined,\n set() {\n throwNotImplemented(\"node:repl\");\n }\n }),\n line: \"\",\n eval: () => {\n throwNotImplemented(\"node:repl\");\n },\n isCompletionEnabled: !0,\n escapeCodeTimeout: 500,\n tabSize: 8,\n breakEvalOnSigint: !0,\n useGlobal: !0,\n underscoreAssigned: !1,\n last: @undefined,\n _domain: @undefined,\n allowBlockingCompletions: !1,\n useColors: !0,\n output: new Proxy({}, {\n get() {\n throwNotImplemented(\"node:repl\");\n },\n has: () => !1,\n ownKeys: () => [],\n getOwnPropertyDescriptor: () => @undefined,\n set() {\n throwNotImplemented(\"node:repl\");\n }\n }),\n _builtinLibs: [\n \"bun\",\n \"ffi\",\n \"assert\",\n \"assert/strict\",\n \"async_hooks\",\n \"buffer\",\n \"child_process\",\n \"cluster\",\n \"console\",\n \"constants\",\n \"crypto\",\n \"dgram\",\n \"diagnostics_channel\",\n \"dns\",\n \"dns/promises\",\n \"domain\",\n \"events\",\n \"fs\",\n \"fs/promises\",\n \"http\",\n \"http2\",\n \"https\",\n \"inspector\",\n \"inspector/promises\",\n \"module\",\n \"net\",\n \"os\",\n \"path\",\n \"path/posix\",\n \"path/win32\",\n \"perf_hooks\",\n \"process\",\n \"punycode\",\n \"querystring\",\n \"readline\",\n \"readline/promises\",\n \"repl\",\n \"stream\",\n \"stream/consumers\",\n \"stream/promises\",\n \"stream/web\",\n \"string_decoder\",\n \"sys\",\n \"timers\",\n \"timers/promises\",\n \"tls\",\n \"trace_events\",\n \"tty\",\n \"url\",\n \"util\",\n \"util/types\",\n \"v8\",\n \"vm\",\n \"wasi\",\n \"worker_threads\",\n \"zlib\"\n ]\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeStreamConsumersCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/stream.consumers.ts\nvar $, arrayBuffer = Bun.readableStreamToArrayBuffer, text = Bun.readableStreamToText, json = (stream) => Bun.readableStreamToText(stream).then(JSON.parse), buffer = async (readableStream) => {\n return new @Buffer(await arrayBuffer(readableStream));\n}, blob = Bun.readableStreamToBlob;\n$ = {\n arrayBuffer,\n text,\n json,\n buffer,\n blob\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeStreamCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/stream.ts\nvar isReadableStream = function(value) {\n return typeof value === \"object\" && value !== null && value instanceof @ReadableStream;\n}, validateBoolean = function(value, name) {\n if (typeof value !== \"boolean\")\n throw new ERR_INVALID_ARG_TYPE(name, \"boolean\", value);\n};\nvar ERR_INVALID_ARG_TYPE = function(name, type, value) {\n return new Error(`The argument '${name}' is invalid. Received '${value}' for type '${type}'`);\n}, ERR_INVALID_ARG_VALUE = function(name, value, reason) {\n return new Error(`The value '${value}' is invalid for argument '${name}'. Reason: ${reason}`);\n}, createNativeStreamReadable = function(nativeType, Readable) {\n var [pull, start, cancel, setClose, deinit, updateRef, drainFn] = @lazy(nativeType), closer = [!1], handleNumberResult = function(nativeReadable, result, view, isClosed) {\n if (result > 0) {\n const slice = view.subarray(0, result), remainder = view.subarray(result);\n if (slice.byteLength > 0)\n nativeReadable.push(slice);\n if (isClosed)\n nativeReadable.push(null);\n return remainder.byteLength > 0 \? remainder : @undefined;\n }\n if (isClosed)\n nativeReadable.push(null);\n return view;\n }, handleArrayBufferViewResult = function(nativeReadable, result, view, isClosed) {\n if (result.byteLength > 0)\n nativeReadable.push(result);\n if (isClosed)\n nativeReadable.push(null);\n return view;\n }, DYNAMICALLY_ADJUST_CHUNK_SIZE = process.env.BUN_DISABLE_DYNAMIC_CHUNK_SIZE !== \"1\";\n const finalizer = new FinalizationRegistry((ptr) => ptr && deinit(ptr)), MIN_BUFFER_SIZE = 512;\n var NativeReadable = class NativeReadable2 extends Readable {\n #bunNativePtr;\n #refCount = 1;\n #constructed = !1;\n #remainingChunk = @undefined;\n #highWaterMark;\n #pendingRead = !1;\n #hasResized = !DYNAMICALLY_ADJUST_CHUNK_SIZE;\n #unregisterToken;\n constructor(ptr, options = {}) {\n super(options);\n if (typeof options.highWaterMark === \"number\")\n this.#highWaterMark = options.highWaterMark;\n else\n this.#highWaterMark = 262144;\n this.#bunNativePtr = ptr, this.#constructed = !1, this.#remainingChunk = @undefined, this.#pendingRead = !1, this.#unregisterToken = {}, finalizer.register(this, this.#bunNativePtr, this.#unregisterToken);\n }\n _read(maxToRead) {\n if (this.#pendingRead)\n return;\n var ptr = this.#bunNativePtr;\n if (ptr === 0) {\n this.push(null);\n return;\n }\n if (!this.#constructed)\n this.#internalConstruct(ptr);\n return this.#internalRead(this.#getRemainingChunk(maxToRead), ptr);\n }\n #internalConstruct(ptr) {\n this.#constructed = !0;\n const result = start(ptr, this.#highWaterMark);\n if (typeof result === \"number\" && result > 1)\n this.#hasResized = !0, this.#highWaterMark = Math.min(this.#highWaterMark, result);\n if (drainFn) {\n const drainResult = drainFn(ptr);\n if ((drainResult\?.byteLength \?\? 0) > 0)\n this.push(drainResult);\n }\n }\n #getRemainingChunk(maxToRead = this.#highWaterMark) {\n var chunk = this.#remainingChunk;\n if (chunk\?.byteLength \?\? 0 < MIN_BUFFER_SIZE) {\n var size = maxToRead > MIN_BUFFER_SIZE \? maxToRead : MIN_BUFFER_SIZE;\n this.#remainingChunk = chunk = new @Buffer(size);\n }\n return chunk;\n }\n #handleResult(result, view, isClosed) {\n if (typeof result === \"number\") {\n if (result >= this.#highWaterMark && !this.#hasResized && !isClosed)\n this.#highWaterMark *= 2, this.#hasResized = !0;\n return handleNumberResult(this, result, view, isClosed);\n } else if (typeof result === \"boolean\")\n return process.nextTick(() => {\n this.push(null);\n }), view\?.byteLength \?\? 0 > 0 \? view : @undefined;\n else if (@ArrayBuffer.isView(result)) {\n if (result.byteLength >= this.#highWaterMark && !this.#hasResized && !isClosed)\n this.#highWaterMark *= 2, this.#hasResized = !0;\n return handleArrayBufferViewResult(this, result, view, isClosed);\n } else\n throw new Error(\"Invalid result from pull\");\n }\n #internalRead(view, ptr) {\n closer[0] = !1;\n var result = pull(ptr, view, closer);\n if (@isPromise(result))\n return this.#pendingRead = !0, result.then((result2) => {\n this.#pendingRead = !1, this.#remainingChunk = this.#handleResult(result2, view, closer[0]);\n }, (reason) => {\n errorOrDestroy(this, reason);\n });\n else\n this.#remainingChunk = this.#handleResult(result, view, closer[0]);\n }\n _destroy(error, callback) {\n var ptr = this.#bunNativePtr;\n if (ptr === 0) {\n callback(error);\n return;\n }\n if (finalizer.unregister(this.#unregisterToken), this.#bunNativePtr = 0, updateRef)\n updateRef(ptr, !1);\n cancel(ptr, error), callback(error);\n }\n ref() {\n var ptr = this.#bunNativePtr;\n if (ptr === 0)\n return;\n if (this.#refCount++ === 0)\n updateRef(ptr, !0);\n }\n unref() {\n var ptr = this.#bunNativePtr;\n if (ptr === 0)\n return;\n if (this.#refCount-- === 1)\n updateRef(ptr, !1);\n }\n };\n if (!updateRef)\n NativeReadable.prototype.ref = @undefined, NativeReadable.prototype.unref = @undefined;\n return NativeReadable;\n}, getNativeReadableStreamPrototype = function(nativeType, Readable) {\n return nativeReadableStreamPrototypes[nativeType] ||= createNativeStreamReadable(nativeType, Readable);\n}, getNativeReadableStream = function(Readable, stream, options) {\n if (!(stream && typeof stream === \"object\" && stream instanceof @ReadableStream))\n return @undefined;\n const native = @direct(stream);\n if (!native)\n return @undefined;\n const { stream: ptr, data: type } = native;\n return new (getNativeReadableStreamPrototype(type, Readable))(ptr, options);\n}, NativeWritable = function(pathOrFdOrSink, options = {}) {\n Writable.@call(this, options), this[_native] = !0, this._construct = NativeWritable_internalConstruct, this._destroy = NativeWritable_internalDestroy, this._final = NativeWritable_internalFinal, this[_pathOrFdOrSink] = pathOrFdOrSink;\n}, NativeWritable_internalConstruct = function(cb) {\n if (this._writableState.constructed = !0, this.constructed = !0, typeof cb === \"function\")\n cb();\n process.nextTick(() => {\n this.emit(\"open\", this.fd), this.emit(\"ready\");\n });\n}, NativeWritable_lazyConstruct = function(stream) {\n var sink = stream[_pathOrFdOrSink];\n if (typeof sink === \"object\")\n if (typeof sink.write === \"function\")\n return stream[_fileSink] = sink;\n else\n throw new Error(\"Invalid FileSink\");\n else\n return stream[_fileSink] = Bun.file(sink).writer();\n}, NativeWritable_internalDestroy = function(error, cb) {\n const w = this._writableState, r = this._readableState;\n if (w)\n w.destroyed = !0, w.closeEmitted = !0;\n if (r)\n r.destroyed = !0, r.closeEmitted = !0;\n if (typeof cb === \"function\")\n cb(error);\n if (w\?.closeEmitted || r\?.closeEmitted)\n this.emit(\"close\");\n}, NativeWritable_internalFinal = function(cb) {\n var sink = this[_fileSink];\n if (sink)\n sink.end();\n if (cb)\n cb();\n}, EE = @lazy(\"events\"), StringDecoder = @requireNativeModule(\"string_decoder\").StringDecoder, __getOwnPropNames = Object.getOwnPropertyNames, __commonJS = (cb, mod) => function __require2() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n}, runOnNextTick = process.nextTick;\nvar ArrayIsArray = @Array.isArray, require_primordials = __commonJS({\n \"node_modules/readable-stream/lib/ours/primordials.js\"(exports, module) {\n module.exports = {\n ArrayIsArray(self) {\n return @Array.isArray(self);\n },\n ArrayPrototypeIncludes(self, el) {\n return self.includes(el);\n },\n ArrayPrototypeIndexOf(self, el) {\n return self.indexOf(el);\n },\n ArrayPrototypeJoin(self, sep) {\n return self.join(sep);\n },\n ArrayPrototypeMap(self, fn) {\n return self.map(fn);\n },\n ArrayPrototypePop(self, el) {\n return self.pop(el);\n },\n ArrayPrototypePush(self, el) {\n return self.push(el);\n },\n ArrayPrototypeSlice(self, start, end) {\n return self.slice(start, end);\n },\n Error,\n FunctionPrototypeCall(fn, thisArgs, ...args) {\n return fn.@call(thisArgs, ...args);\n },\n FunctionPrototypeSymbolHasInstance(self, instance) {\n return Function.prototype[Symbol.hasInstance].@call(self, instance);\n },\n MathFloor: Math.floor,\n Number,\n NumberIsInteger: Number.isInteger,\n NumberIsNaN: Number.isNaN,\n NumberMAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER,\n NumberMIN_SAFE_INTEGER: Number.MIN_SAFE_INTEGER,\n NumberParseInt: Number.parseInt,\n ObjectDefineProperties(self, props) {\n return Object.defineProperties(self, props);\n },\n ObjectDefineProperty(self, name, prop) {\n return Object.defineProperty(self, name, prop);\n },\n ObjectGetOwnPropertyDescriptor(self, name) {\n return Object.getOwnPropertyDescriptor(self, name);\n },\n ObjectKeys(obj) {\n return Object.keys(obj);\n },\n ObjectSetPrototypeOf(target, proto) {\n return Object.setPrototypeOf(target, proto);\n },\n Promise: @Promise,\n PromisePrototypeCatch(self, fn) {\n return self.catch(fn);\n },\n PromisePrototypeThen(self, thenFn, catchFn) {\n return self.then(thenFn, catchFn);\n },\n PromiseReject(err) {\n return @Promise.reject(err);\n },\n ReflectApply: @getByIdDirect(Reflect, \"apply\"),\n RegExpPrototypeTest(self, value) {\n return self.test(value);\n },\n SafeSet: Set,\n String: @String,\n StringPrototypeSlice(self, start, end) {\n return self.slice(start, end);\n },\n StringPrototypeToLowerCase(self) {\n return self.toLowerCase();\n },\n StringPrototypeToUpperCase(self) {\n return self.toUpperCase();\n },\n StringPrototypeTrim(self) {\n return self.trim();\n },\n Symbol,\n SymbolAsyncIterator: Symbol.asyncIterator,\n SymbolHasInstance: Symbol.hasInstance,\n SymbolIterator: Symbol.iterator,\n TypedArrayPrototypeSet(self, buf, len) {\n return self.set(buf, len);\n },\n Uint8Array: @Uint8Array\n };\n }\n}), require_util = __commonJS({\n \"node_modules/readable-stream/lib/ours/util.js\"(exports, module) {\n var AsyncFunction = Object.getPrototypeOf(async function() {\n }).constructor, isBlob = typeof Blob !== \"undefined\" \? function isBlob2(b) {\n return b instanceof Blob;\n } : function isBlob2(b) {\n return !1;\n }, AggregateError = class extends Error {\n constructor(errors) {\n if (!@Array.isArray(errors))\n @throwTypeError(`Expected input to be an Array, got ${typeof errors}`);\n let message = \"\";\n for (let i = 0;i < errors.length; i++)\n message += ` ${errors[i].stack}\n`;\n super(message);\n this.name = \"AggregateError\", this.errors = errors;\n }\n };\n module.exports = {\n AggregateError,\n once(callback) {\n let called = !1;\n return function(...args) {\n if (called)\n return;\n called = !0, callback.@apply(this, args);\n };\n },\n createDeferredPromise: function() {\n let resolve, reject;\n return {\n promise: new @Promise((res, rej) => {\n resolve = res, reject = rej;\n }),\n resolve,\n reject\n };\n },\n promisify(fn) {\n return new @Promise((resolve, reject) => {\n fn((err, ...args) => {\n if (err)\n return reject(err);\n return resolve(...args);\n });\n });\n },\n debuglog() {\n return function() {\n };\n },\n format(format, ...args) {\n return format.replace(/%([sdifj])/g, function(...[_unused, type]) {\n const replacement = args.shift();\n if (type === \"f\")\n return replacement.toFixed(6);\n else if (type === \"j\")\n return JSON.stringify(replacement);\n else if (type === \"s\" && typeof replacement === \"object\")\n return `${replacement.constructor !== Object \? replacement.constructor.name : \"\"} {}`.trim();\n else\n return replacement.toString();\n });\n },\n inspect(value) {\n switch (typeof value) {\n case \"string\":\n if (value.includes(\"'\")) {\n if (!value.includes('\"'))\n return `\"${value}\"`;\n else if (!value.includes(\"`\") && !value.includes(\"${\"))\n return `\\`${value}\\``;\n }\n return `'${value}'`;\n case \"number\":\n if (isNaN(value))\n return \"NaN\";\n else if (Object.is(value, -0))\n return @String(value);\n return value;\n case \"bigint\":\n return `${@String(value)}n`;\n case \"boolean\":\n case \"undefined\":\n return @String(value);\n case \"object\":\n return \"{}\";\n }\n },\n types: {\n isAsyncFunction(fn) {\n return fn instanceof AsyncFunction;\n },\n isArrayBufferView(arr) {\n return @ArrayBuffer.isView(arr);\n }\n },\n isBlob\n }, module.exports.promisify.custom = Symbol.for(\"nodejs.util.promisify.custom\");\n }\n}), require_errors = __commonJS({\n \"node_modules/readable-stream/lib/ours/errors.js\"(exports, module) {\n var { format, inspect, AggregateError: CustomAggregateError } = require_util(), AggregateError = globalThis.AggregateError || CustomAggregateError, kIsNodeError = Symbol(\"kIsNodeError\"), kTypes = [\"string\", \"function\", \"number\", \"object\", \"Function\", \"Object\", \"boolean\", \"bigint\", \"symbol\"], classRegExp = /^([A-Z][a-z0-9]*)+$/, nodeInternalPrefix = \"__node_internal_\", codes = {};\n function assert(value, message) {\n if (!value)\n throw new codes.ERR_INTERNAL_ASSERTION(message);\n }\n function addNumericalSeparator(val) {\n let res = \"\", i = val.length;\n const start = val[0] === \"-\" \? 1 : 0;\n for (;i >= start + 4; i -= 3)\n res = `_${val.slice(i - 3, i)}${res}`;\n return `${val.slice(0, i)}${res}`;\n }\n function getMessage(key, msg, args) {\n if (typeof msg === \"function\")\n return assert(msg.length <= args.length, `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${msg.length}).`), msg(...args);\n const expectedLength = (msg.match(/%[dfijoOs]/g) || []).length;\n if (assert(expectedLength === args.length, `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${expectedLength}).`), args.length === 0)\n return msg;\n return format(msg, ...args);\n }\n function E(code, message, Base) {\n if (!Base)\n Base = Error;\n\n class NodeError extends Base {\n constructor(...args) {\n super(getMessage(code, message, args));\n }\n toString() {\n return `${this.name} [${code}]: ${this.message}`;\n }\n }\n Object.defineProperties(NodeError.prototype, {\n name: {\n value: Base.name,\n writable: !0,\n enumerable: !1,\n configurable: !0\n },\n toString: {\n value() {\n return `${this.name} [${code}]: ${this.message}`;\n },\n writable: !0,\n enumerable: !1,\n configurable: !0\n }\n }), NodeError.prototype.code = code, NodeError.prototype[kIsNodeError] = !0, codes[code] = NodeError;\n }\n function hideStackFrames(fn) {\n const hidden = nodeInternalPrefix + fn.name;\n return Object.defineProperty(fn, \"name\", {\n value: hidden\n }), fn;\n }\n function aggregateTwoErrors(innerError, outerError) {\n if (innerError && outerError && innerError !== outerError) {\n if (@Array.isArray(outerError.errors))\n return outerError.errors.push(innerError), outerError;\n const err = new AggregateError([outerError, innerError], outerError.message);\n return err.code = outerError.code, err;\n }\n return innerError || outerError;\n }\n var AbortError2 = class extends Error {\n constructor(message = \"The operation was aborted\", options = void 0) {\n if (options !== void 0 && typeof options !== \"object\")\n throw new codes.ERR_INVALID_ARG_TYPE(\"options\", \"Object\", options);\n super(message, options);\n this.code = \"ABORT_ERR\", this.name = \"AbortError\";\n }\n };\n E(\"ERR_ASSERTION\", \"%s\", Error), E(\"ERR_INVALID_ARG_TYPE\", (name, expected, actual) => {\n if (assert(typeof name === \"string\", \"'name' must be a string\"), !@Array.isArray(expected))\n expected = [expected];\n let msg = \"The \";\n if (name.endsWith(\" argument\"))\n msg += `${name} `;\n else\n msg += `\"${name}\" ${name.includes(\".\") \? \"property\" : \"argument\"} `;\n msg += \"must be \";\n const types = [], instances = [], other = [];\n for (let value of expected)\n if (assert(typeof value === \"string\", \"All expected entries have to be of type string\"), kTypes.includes(value))\n types.push(value.toLowerCase());\n else if (classRegExp.test(value))\n instances.push(value);\n else\n assert(value !== \"object\", 'The value \"object\" should be written as \"Object\"'), other.push(value);\n if (instances.length > 0) {\n const pos = types.indexOf(\"object\");\n if (pos !== -1)\n types.splice(types, pos, 1), instances.push(\"Object\");\n }\n if (types.length > 0) {\n switch (types.length) {\n case 1:\n msg += `of type ${types[0]}`;\n break;\n case 2:\n msg += `one of type ${types[0]} or ${types[1]}`;\n break;\n default: {\n const last = types.pop();\n msg += `one of type ${types.join(\", \")}, or ${last}`;\n }\n }\n if (instances.length > 0 || other.length > 0)\n msg += \" or \";\n }\n if (instances.length > 0) {\n switch (instances.length) {\n case 1:\n msg += `an instance of ${instances[0]}`;\n break;\n case 2:\n msg += `an instance of ${instances[0]} or ${instances[1]}`;\n break;\n default: {\n const last = instances.pop();\n msg += `an instance of ${instances.join(\", \")}, or ${last}`;\n }\n }\n if (other.length > 0)\n msg += \" or \";\n }\n switch (other.length) {\n case 0:\n break;\n case 1:\n if (other[0].toLowerCase() !== other[0])\n msg += \"an \";\n msg += `${other[0]}`;\n break;\n case 2:\n msg += `one of ${other[0]} or ${other[1]}`;\n break;\n default: {\n const last = other.pop();\n msg += `one of ${other.join(\", \")}, or ${last}`;\n }\n }\n if (actual == null)\n msg += `. Received ${actual}`;\n else if (typeof actual === \"function\" && actual.name)\n msg += `. Received function ${actual.name}`;\n else if (typeof actual === \"object\") {\n var _actual$constructor;\n if ((_actual$constructor = actual.constructor) !== null && _actual$constructor !== void 0 && _actual$constructor.name)\n msg += `. Received an instance of ${actual.constructor.name}`;\n else {\n const inspected = inspect(actual, {\n depth: -1\n });\n msg += `. Received ${inspected}`;\n }\n } else {\n let inspected = inspect(actual, {\n colors: !1\n });\n if (inspected.length > 25)\n inspected = `${inspected.slice(0, 25)}...`;\n msg += `. Received type ${typeof actual} (${inspected})`;\n }\n return msg;\n }, TypeError), E(\"ERR_INVALID_ARG_VALUE\", (name, value, reason = \"is invalid\") => {\n let inspected = inspect(value);\n if (inspected.length > 128)\n inspected = inspected.slice(0, 128) + \"...\";\n return `The ${name.includes(\".\") \? \"property\" : \"argument\"} '${name}' ${reason}. Received ${inspected}`;\n }, TypeError), E(\"ERR_INVALID_RETURN_VALUE\", (input, name, value) => {\n var _value$constructor;\n const type = value !== null && value !== void 0 && (_value$constructor = value.constructor) !== null && _value$constructor !== void 0 && _value$constructor.name \? `instance of ${value.constructor.name}` : `type ${typeof value}`;\n return `Expected ${input} to be returned from the \"${name}\" function but got ${type}.`;\n }, TypeError), E(\"ERR_MISSING_ARGS\", (...args) => {\n assert(args.length > 0, \"At least one arg needs to be specified\");\n let msg;\n const len = args.length;\n switch (args = (@Array.isArray(args) \? args : [args]).map((a) => `\"${a}\"`).join(\" or \"), len) {\n case 1:\n msg += `The ${args[0]} argument`;\n break;\n case 2:\n msg += `The ${args[0]} and ${args[1]} arguments`;\n break;\n default:\n {\n const last = args.pop();\n msg += `The ${args.join(\", \")}, and ${last} arguments`;\n }\n break;\n }\n return `${msg} must be specified`;\n }, TypeError), E(\"ERR_OUT_OF_RANGE\", (str, range, input) => {\n assert(range, 'Missing \"range\" argument');\n let received;\n if (Number.isInteger(input) && Math.abs(input) > 4294967296)\n received = addNumericalSeparator(@String(input));\n else if (typeof input === \"bigint\") {\n if (received = @String(input), input > 2n ** 32n || input < -(2n ** 32n))\n received = addNumericalSeparator(received);\n received += \"n\";\n } else\n received = inspect(input);\n return `The value of \"${str}\" is out of range. It must be ${range}. Received ${received}`;\n }, RangeError), E(\"ERR_MULTIPLE_CALLBACK\", \"Callback called multiple times\", Error), E(\"ERR_METHOD_NOT_IMPLEMENTED\", \"The %s method is not implemented\", Error), E(\"ERR_STREAM_ALREADY_FINISHED\", \"Cannot call %s after a stream was finished\", Error), E(\"ERR_STREAM_CANNOT_PIPE\", \"Cannot pipe, not readable\", Error), E(\"ERR_STREAM_DESTROYED\", \"Cannot call %s after a stream was destroyed\", Error), E(\"ERR_STREAM_NULL_VALUES\", \"May not write null values to stream\", TypeError), E(\"ERR_STREAM_PREMATURE_CLOSE\", \"Premature close\", Error), E(\"ERR_STREAM_PUSH_AFTER_EOF\", \"stream.push() after EOF\", Error), E(\"ERR_STREAM_UNSHIFT_AFTER_END_EVENT\", \"stream.unshift() after end event\", Error), E(\"ERR_STREAM_WRITE_AFTER_END\", \"write after end\", Error), E(\"ERR_UNKNOWN_ENCODING\", \"Unknown encoding: %s\", TypeError), module.exports = {\n AbortError: AbortError2,\n aggregateTwoErrors: hideStackFrames(aggregateTwoErrors),\n hideStackFrames,\n codes\n };\n }\n}), require_validators = __commonJS({\n \"node_modules/readable-stream/lib/internal/validators.js\"(exports, module) {\n var {\n ArrayIsArray: ArrayIsArray2,\n ArrayPrototypeIncludes,\n ArrayPrototypeJoin,\n ArrayPrototypeMap,\n NumberIsInteger,\n NumberMAX_SAFE_INTEGER,\n NumberMIN_SAFE_INTEGER,\n NumberParseInt,\n RegExpPrototypeTest,\n String: String2,\n StringPrototypeToUpperCase,\n StringPrototypeTrim\n } = require_primordials(), {\n hideStackFrames,\n codes: { ERR_SOCKET_BAD_PORT, ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE2, ERR_INVALID_ARG_VALUE: ERR_INVALID_ARG_VALUE2, ERR_OUT_OF_RANGE, ERR_UNKNOWN_SIGNAL }\n } = require_errors(), { normalizeEncoding } = require_util(), { isAsyncFunction, isArrayBufferView } = require_util().types, signals = {};\n function isInt32(value) {\n return value === (value | 0);\n }\n function isUint32(value) {\n return value === value >>> 0;\n }\n var octalReg = /^[0-7]+$/, modeDesc = \"must be a 32-bit unsigned integer or an octal string\";\n function parseFileMode(value, name, def) {\n if (typeof value === \"undefined\")\n value = def;\n if (typeof value === \"string\") {\n if (!RegExpPrototypeTest(octalReg, value))\n throw new ERR_INVALID_ARG_VALUE2(name, value, modeDesc);\n value = NumberParseInt(value, 8);\n }\n return validateInt32(value, name, 0, 4294967295), value;\n }\n var validateInteger = hideStackFrames((value, name, min = NumberMIN_SAFE_INTEGER, max = NumberMAX_SAFE_INTEGER) => {\n if (typeof value !== \"number\")\n throw new ERR_INVALID_ARG_TYPE2(name, \"number\", value);\n if (!NumberIsInteger(value))\n throw new ERR_OUT_OF_RANGE(name, \"an integer\", value);\n if (value < min || value > max)\n throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);\n }), validateInt32 = hideStackFrames((value, name, min = -2147483648, max = 2147483647) => {\n if (typeof value !== \"number\")\n throw new ERR_INVALID_ARG_TYPE2(name, \"number\", value);\n if (!isInt32(value)) {\n if (!NumberIsInteger(value))\n throw new ERR_OUT_OF_RANGE(name, \"an integer\", value);\n throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);\n }\n if (value < min || value > max)\n throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);\n }), validateUint32 = hideStackFrames((value, name, positive) => {\n if (typeof value !== \"number\")\n throw new ERR_INVALID_ARG_TYPE2(name, \"number\", value);\n if (!isUint32(value)) {\n if (!NumberIsInteger(value))\n throw new ERR_OUT_OF_RANGE(name, \"an integer\", value);\n throw new ERR_OUT_OF_RANGE(name, `>= ${positive \? 1 : 0} && < 4294967296`, value);\n }\n if (positive && value === 0)\n throw new ERR_OUT_OF_RANGE(name, \">= 1 && < 4294967296\", value);\n });\n function validateString(value, name) {\n if (typeof value !== \"string\")\n throw new ERR_INVALID_ARG_TYPE2(name, \"string\", value);\n }\n function validateNumber(value, name) {\n if (typeof value !== \"number\")\n throw new ERR_INVALID_ARG_TYPE2(name, \"number\", value);\n }\n var validateOneOf = hideStackFrames((value, name, oneOf) => {\n if (!ArrayPrototypeIncludes(oneOf, value)) {\n const reason = \"must be one of: \" + ArrayPrototypeJoin(ArrayPrototypeMap(oneOf, (v) => typeof v === \"string\" \? `'${v}'` : String2(v)), \", \");\n throw new ERR_INVALID_ARG_VALUE2(name, value, reason);\n }\n });\n function validateBoolean2(value, name) {\n if (typeof value !== \"boolean\")\n throw new ERR_INVALID_ARG_TYPE2(name, \"boolean\", value);\n }\n var validateObject = hideStackFrames((value, name, options) => {\n const useDefaultOptions = options == null, allowArray = useDefaultOptions \? !1 : options.allowArray, allowFunction = useDefaultOptions \? !1 : options.allowFunction;\n if (!(useDefaultOptions \? !1 : options.nullable) && value === null || !allowArray && ArrayIsArray2(value) || typeof value !== \"object\" && (!allowFunction || typeof value !== \"function\"))\n throw new ERR_INVALID_ARG_TYPE2(name, \"Object\", value);\n }), validateArray = hideStackFrames((value, name, minLength = 0) => {\n if (!ArrayIsArray2(value))\n throw new ERR_INVALID_ARG_TYPE2(name, \"Array\", value);\n if (value.length < minLength) {\n const reason = `must be longer than ${minLength}`;\n throw new ERR_INVALID_ARG_VALUE2(name, value, reason);\n }\n });\n function validateSignalName(signal, name = \"signal\") {\n if (validateString(signal, name), signals[signal] === void 0) {\n if (signals[StringPrototypeToUpperCase(signal)] !== void 0)\n throw new ERR_UNKNOWN_SIGNAL(signal + \" (signals must use all capital letters)\");\n throw new ERR_UNKNOWN_SIGNAL(signal);\n }\n }\n var validateBuffer = hideStackFrames((buffer, name = \"buffer\") => {\n if (!isArrayBufferView(buffer))\n throw new ERR_INVALID_ARG_TYPE2(name, [\"Buffer\", \"TypedArray\", \"DataView\"], buffer);\n });\n function validateEncoding(data, encoding) {\n const normalizedEncoding = normalizeEncoding(encoding), length = data.length;\n if (normalizedEncoding === \"hex\" && length % 2 !== 0)\n throw new ERR_INVALID_ARG_VALUE2(\"encoding\", encoding, `is invalid for data of length ${length}`);\n }\n function validatePort(port, name = \"Port\", allowZero = !0) {\n if (typeof port !== \"number\" && typeof port !== \"string\" || typeof port === \"string\" && StringPrototypeTrim(port).length === 0 || +port !== +port >>> 0 || port > 65535 || port === 0 && !allowZero)\n throw new ERR_SOCKET_BAD_PORT(name, port, allowZero);\n return port | 0;\n }\n var validateAbortSignal = hideStackFrames((signal, name) => {\n if (signal !== void 0 && (signal === null || typeof signal !== \"object\" || !(\"aborted\" in signal)))\n throw new ERR_INVALID_ARG_TYPE2(name, \"AbortSignal\", signal);\n }), validateFunction = hideStackFrames((value, name) => {\n if (typeof value !== \"function\")\n throw new ERR_INVALID_ARG_TYPE2(name, \"Function\", value);\n }), validatePlainFunction = hideStackFrames((value, name) => {\n if (typeof value !== \"function\" || isAsyncFunction(value))\n throw new ERR_INVALID_ARG_TYPE2(name, \"Function\", value);\n }), validateUndefined = hideStackFrames((value, name) => {\n if (value !== void 0)\n throw new ERR_INVALID_ARG_TYPE2(name, \"undefined\", value);\n });\n module.exports = {\n isInt32,\n isUint32,\n parseFileMode,\n validateArray,\n validateBoolean: validateBoolean2,\n validateBuffer,\n validateEncoding,\n validateFunction,\n validateInt32,\n validateInteger,\n validateNumber,\n validateObject,\n validateOneOf,\n validatePlainFunction,\n validatePort,\n validateSignalName,\n validateString,\n validateUint32,\n validateUndefined,\n validateAbortSignal\n };\n }\n}), require_utils = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/utils.js\"(exports, module) {\n var { Symbol: Symbol2, SymbolAsyncIterator, SymbolIterator } = require_primordials(), kDestroyed = Symbol2(\"kDestroyed\"), kIsErrored = Symbol2(\"kIsErrored\"), kIsReadable = Symbol2(\"kIsReadable\"), kIsDisturbed = Symbol2(\"kIsDisturbed\");\n function isReadableNodeStream(obj, strict = !1) {\n var _obj$_readableState;\n return !!(obj && typeof obj.pipe === \"function\" && typeof obj.on === \"function\" && (!strict || typeof obj.pause === \"function\" && typeof obj.resume === \"function\") && (!obj._writableState || ((_obj$_readableState = obj._readableState) === null || _obj$_readableState === void 0 \? void 0 : _obj$_readableState.readable) !== !1) && (!obj._writableState || obj._readableState));\n }\n function isWritableNodeStream(obj) {\n var _obj$_writableState;\n return !!(obj && typeof obj.write === \"function\" && typeof obj.on === \"function\" && (!obj._readableState || ((_obj$_writableState = obj._writableState) === null || _obj$_writableState === void 0 \? void 0 : _obj$_writableState.writable) !== !1));\n }\n function isDuplexNodeStream(obj) {\n return !!(obj && typeof obj.pipe === \"function\" && obj._readableState && typeof obj.on === \"function\" && typeof obj.write === \"function\");\n }\n function isNodeStream(obj) {\n return obj && (obj._readableState || obj._writableState || typeof obj.write === \"function\" && typeof obj.on === \"function\" || typeof obj.pipe === \"function\" && typeof obj.on === \"function\");\n }\n function isIterable(obj, isAsync) {\n if (obj == null)\n return !1;\n if (isAsync === !0)\n return typeof obj[SymbolAsyncIterator] === \"function\";\n if (isAsync === !1)\n return typeof obj[SymbolIterator] === \"function\";\n return typeof obj[SymbolAsyncIterator] === \"function\" || typeof obj[SymbolIterator] === \"function\";\n }\n function isDestroyed(stream) {\n if (!isNodeStream(stream))\n return null;\n const { _writableState: wState, _readableState: rState } = stream, state = wState || rState;\n return !!(stream.destroyed || stream[kDestroyed] || state !== null && state !== void 0 && state.destroyed);\n }\n function isWritableEnded(stream) {\n if (!isWritableNodeStream(stream))\n return null;\n if (stream.writableEnded === !0)\n return !0;\n const wState = stream._writableState;\n if (wState !== null && wState !== void 0 && wState.errored)\n return !1;\n if (typeof (wState === null || wState === void 0 \? void 0 : wState.ended) !== \"boolean\")\n return null;\n return wState.ended;\n }\n function isWritableFinished(stream, strict) {\n if (!isWritableNodeStream(stream))\n return null;\n if (stream.writableFinished === !0)\n return !0;\n const wState = stream._writableState;\n if (wState !== null && wState !== void 0 && wState.errored)\n return !1;\n if (typeof (wState === null || wState === void 0 \? void 0 : wState.finished) !== \"boolean\")\n return null;\n return !!(wState.finished || strict === !1 && wState.ended === !0 && wState.length === 0);\n }\n function isReadableEnded(stream) {\n if (!isReadableNodeStream(stream))\n return null;\n if (stream.readableEnded === !0)\n return !0;\n const rState = stream._readableState;\n if (!rState || rState.errored)\n return !1;\n if (typeof (rState === null || rState === void 0 \? void 0 : rState.ended) !== \"boolean\")\n return null;\n return rState.ended;\n }\n function isReadableFinished(stream, strict) {\n if (!isReadableNodeStream(stream))\n return null;\n const rState = stream._readableState;\n if (rState !== null && rState !== void 0 && rState.errored)\n return !1;\n if (typeof (rState === null || rState === void 0 \? void 0 : rState.endEmitted) !== \"boolean\")\n return null;\n return !!(rState.endEmitted || strict === !1 && rState.ended === !0 && rState.length === 0);\n }\n function isReadable(stream) {\n if (stream && stream[kIsReadable] != null)\n return stream[kIsReadable];\n if (typeof (stream === null || stream === void 0 \? void 0 : stream.readable) !== \"boolean\")\n return null;\n if (isDestroyed(stream))\n return !1;\n return isReadableNodeStream(stream) && stream.readable && !isReadableFinished(stream);\n }\n function isWritable(stream) {\n if (typeof (stream === null || stream === void 0 \? void 0 : stream.writable) !== \"boolean\")\n return null;\n if (isDestroyed(stream))\n return !1;\n return isWritableNodeStream(stream) && stream.writable && !isWritableEnded(stream);\n }\n function isFinished(stream, opts) {\n if (!isNodeStream(stream))\n return null;\n if (isDestroyed(stream))\n return !0;\n if ((opts === null || opts === void 0 \? void 0 : opts.readable) !== !1 && isReadable(stream))\n return !1;\n if ((opts === null || opts === void 0 \? void 0 : opts.writable) !== !1 && isWritable(stream))\n return !1;\n return !0;\n }\n function isWritableErrored(stream) {\n var _stream$_writableStat, _stream$_writableStat2;\n if (!isNodeStream(stream))\n return null;\n if (stream.writableErrored)\n return stream.writableErrored;\n return (_stream$_writableStat = (_stream$_writableStat2 = stream._writableState) === null || _stream$_writableStat2 === void 0 \? void 0 : _stream$_writableStat2.errored) !== null && _stream$_writableStat !== void 0 \? _stream$_writableStat : null;\n }\n function isReadableErrored(stream) {\n var _stream$_readableStat, _stream$_readableStat2;\n if (!isNodeStream(stream))\n return null;\n if (stream.readableErrored)\n return stream.readableErrored;\n return (_stream$_readableStat = (_stream$_readableStat2 = stream._readableState) === null || _stream$_readableStat2 === void 0 \? void 0 : _stream$_readableStat2.errored) !== null && _stream$_readableStat !== void 0 \? _stream$_readableStat : null;\n }\n function isClosed(stream) {\n if (!isNodeStream(stream))\n return null;\n if (typeof stream.closed === \"boolean\")\n return stream.closed;\n const { _writableState: wState, _readableState: rState } = stream;\n if (typeof (wState === null || wState === void 0 \? void 0 : wState.closed) === \"boolean\" || typeof (rState === null || rState === void 0 \? void 0 : rState.closed) === \"boolean\")\n return (wState === null || wState === void 0 \? void 0 : wState.closed) || (rState === null || rState === void 0 \? void 0 : rState.closed);\n if (typeof stream._closed === \"boolean\" && isOutgoingMessage(stream))\n return stream._closed;\n return null;\n }\n function isOutgoingMessage(stream) {\n return typeof stream._closed === \"boolean\" && typeof stream._defaultKeepAlive === \"boolean\" && typeof stream._removedConnection === \"boolean\" && typeof stream._removedContLen === \"boolean\";\n }\n function isServerResponse(stream) {\n return typeof stream._sent100 === \"boolean\" && isOutgoingMessage(stream);\n }\n function isServerRequest(stream) {\n var _stream$req;\n return typeof stream._consuming === \"boolean\" && typeof stream._dumped === \"boolean\" && ((_stream$req = stream.req) === null || _stream$req === void 0 \? void 0 : _stream$req.upgradeOrConnect) === void 0;\n }\n function willEmitClose(stream) {\n if (!isNodeStream(stream))\n return null;\n const { _writableState: wState, _readableState: rState } = stream, state = wState || rState;\n return !state && isServerResponse(stream) || !!(state && state.autoDestroy && state.emitClose && state.closed === !1);\n }\n function isDisturbed(stream) {\n var _stream$kIsDisturbed;\n return !!(stream && ((_stream$kIsDisturbed = stream[kIsDisturbed]) !== null && _stream$kIsDisturbed !== void 0 \? _stream$kIsDisturbed : stream.readableDidRead || stream.readableAborted));\n }\n function isErrored(stream) {\n var _ref, _ref2, _ref3, _ref4, _ref5, _stream$kIsErrored, _stream$_readableStat3, _stream$_writableStat3, _stream$_readableStat4, _stream$_writableStat4;\n return !!(stream && ((_ref = (_ref2 = (_ref3 = (_ref4 = (_ref5 = (_stream$kIsErrored = stream[kIsErrored]) !== null && _stream$kIsErrored !== void 0 \? _stream$kIsErrored : stream.readableErrored) !== null && _ref5 !== void 0 \? _ref5 : stream.writableErrored) !== null && _ref4 !== void 0 \? _ref4 : (_stream$_readableStat3 = stream._readableState) === null || _stream$_readableStat3 === void 0 \? void 0 : _stream$_readableStat3.errorEmitted) !== null && _ref3 !== void 0 \? _ref3 : (_stream$_writableStat3 = stream._writableState) === null || _stream$_writableStat3 === void 0 \? void 0 : _stream$_writableStat3.errorEmitted) !== null && _ref2 !== void 0 \? _ref2 : (_stream$_readableStat4 = stream._readableState) === null || _stream$_readableStat4 === void 0 \? void 0 : _stream$_readableStat4.errored) !== null && _ref !== void 0 \? _ref : (_stream$_writableStat4 = stream._writableState) === null || _stream$_writableStat4 === void 0 \? void 0 : _stream$_writableStat4.errored));\n }\n module.exports = {\n kDestroyed,\n isDisturbed,\n kIsDisturbed,\n isErrored,\n kIsErrored,\n isReadable,\n kIsReadable,\n isClosed,\n isDestroyed,\n isDuplexNodeStream,\n isFinished,\n isIterable,\n isReadableNodeStream,\n isReadableEnded,\n isReadableFinished,\n isReadableErrored,\n isNodeStream,\n isWritable,\n isWritableNodeStream,\n isWritableEnded,\n isWritableFinished,\n isWritableErrored,\n isServerRequest,\n isServerResponse,\n willEmitClose\n };\n }\n}), require_end_of_stream = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/end-of-stream.js\"(exports, module) {\n var { AbortError: AbortError2, codes } = require_errors(), { ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE2, ERR_STREAM_PREMATURE_CLOSE } = codes, { once } = require_util(), { validateAbortSignal, validateFunction, validateObject } = require_validators(), { Promise: Promise2 } = require_primordials(), {\n isClosed,\n isReadable,\n isReadableNodeStream,\n isReadableFinished,\n isReadableErrored,\n isWritable,\n isWritableNodeStream,\n isWritableFinished,\n isWritableErrored,\n isNodeStream,\n willEmitClose: _willEmitClose\n } = require_utils();\n function isRequest(stream) {\n return stream.setHeader && typeof stream.abort === \"function\";\n }\n var nop = () => {\n };\n function eos(stream, options, callback) {\n var _options$readable, _options$writable;\n if (arguments.length === 2)\n callback = options, options = {};\n else if (options == null)\n options = {};\n else\n validateObject(options, \"options\");\n validateFunction(callback, \"callback\"), validateAbortSignal(options.signal, \"options.signal\"), callback = once(callback);\n const readable = (_options$readable = options.readable) !== null && _options$readable !== void 0 \? _options$readable : isReadableNodeStream(stream), writable = (_options$writable = options.writable) !== null && _options$writable !== void 0 \? _options$writable : isWritableNodeStream(stream);\n if (!isNodeStream(stream))\n throw new ERR_INVALID_ARG_TYPE2(\"stream\", \"Stream\", stream);\n const { _writableState: wState, _readableState: rState } = stream, onlegacyfinish = () => {\n if (!stream.writable)\n onfinish();\n };\n let willEmitClose = _willEmitClose(stream) && isReadableNodeStream(stream) === readable && isWritableNodeStream(stream) === writable, writableFinished = isWritableFinished(stream, !1);\n const onfinish = () => {\n if (writableFinished = !0, stream.destroyed)\n willEmitClose = !1;\n if (willEmitClose && (!stream.readable || readable))\n return;\n if (!readable || readableFinished)\n callback.@call(stream);\n };\n let readableFinished = isReadableFinished(stream, !1);\n const onend = () => {\n if (readableFinished = !0, stream.destroyed)\n willEmitClose = !1;\n if (willEmitClose && (!stream.writable || writable))\n return;\n if (!writable || writableFinished)\n callback.@call(stream);\n }, onerror = (err) => {\n callback.@call(stream, err);\n };\n let closed = isClosed(stream);\n const onclose = () => {\n closed = !0;\n const errored = isWritableErrored(stream) || isReadableErrored(stream);\n if (errored && typeof errored !== \"boolean\")\n return callback.@call(stream, errored);\n if (readable && !readableFinished && isReadableNodeStream(stream, !0)) {\n if (!isReadableFinished(stream, !1))\n return callback.@call(stream, new ERR_STREAM_PREMATURE_CLOSE);\n }\n if (writable && !writableFinished) {\n if (!isWritableFinished(stream, !1))\n return callback.@call(stream, new ERR_STREAM_PREMATURE_CLOSE);\n }\n callback.@call(stream);\n }, onrequest = () => {\n stream.req.on(\"finish\", onfinish);\n };\n if (isRequest(stream)) {\n if (stream.on(\"complete\", onfinish), !willEmitClose)\n stream.on(\"abort\", onclose);\n if (stream.req)\n onrequest();\n else\n stream.on(\"request\", onrequest);\n } else if (writable && !wState)\n stream.on(\"end\", onlegacyfinish), stream.on(\"close\", onlegacyfinish);\n if (!willEmitClose && typeof stream.aborted === \"boolean\")\n stream.on(\"aborted\", onclose);\n if (stream.on(\"end\", onend), stream.on(\"finish\", onfinish), options.error !== !1)\n stream.on(\"error\", onerror);\n if (stream.on(\"close\", onclose), closed)\n runOnNextTick(onclose);\n else if (wState !== null && wState !== void 0 && wState.errorEmitted || rState !== null && rState !== void 0 && rState.errorEmitted) {\n if (!willEmitClose)\n runOnNextTick(onclose);\n } else if (!readable && (!willEmitClose || isReadable(stream)) && (writableFinished || isWritable(stream) === !1))\n runOnNextTick(onclose);\n else if (!writable && (!willEmitClose || isWritable(stream)) && (readableFinished || isReadable(stream) === !1))\n runOnNextTick(onclose);\n else if (rState && stream.req && stream.aborted)\n runOnNextTick(onclose);\n const cleanup = () => {\n if (callback = nop, stream.removeListener(\"aborted\", onclose), stream.removeListener(\"complete\", onfinish), stream.removeListener(\"abort\", onclose), stream.removeListener(\"request\", onrequest), stream.req)\n stream.req.removeListener(\"finish\", onfinish);\n stream.removeListener(\"end\", onlegacyfinish), stream.removeListener(\"close\", onlegacyfinish), stream.removeListener(\"finish\", onfinish), stream.removeListener(\"end\", onend), stream.removeListener(\"error\", onerror), stream.removeListener(\"close\", onclose);\n };\n if (options.signal && !closed) {\n const abort = () => {\n const endCallback = callback;\n cleanup(), endCallback.@call(stream, new AbortError2(void 0, {\n cause: options.signal.reason\n }));\n };\n if (options.signal.aborted)\n runOnNextTick(abort);\n else {\n const originalCallback = callback;\n callback = once((...args) => {\n options.signal.removeEventListener(\"abort\", abort), originalCallback.@apply(stream, args);\n }), options.signal.addEventListener(\"abort\", abort);\n }\n }\n return cleanup;\n }\n function finished(stream, opts) {\n return new Promise2((resolve, reject) => {\n eos(stream, opts, (err) => {\n if (err)\n reject(err);\n else\n resolve();\n });\n });\n }\n module.exports = eos, module.exports.finished = finished;\n }\n}), require_operators = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/operators.js\"(exports, module) {\n var {\n codes: { ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE2, ERR_MISSING_ARGS, ERR_OUT_OF_RANGE },\n AbortError: AbortError2\n } = require_errors(), { validateAbortSignal, validateInteger, validateObject } = require_validators(), kWeakHandler = require_primordials().Symbol(\"kWeak\"), { finished } = require_end_of_stream(), {\n ArrayPrototypePush,\n MathFloor,\n Number: Number2,\n NumberIsNaN,\n Promise: Promise2,\n PromiseReject,\n PromisePrototypeCatch,\n Symbol: Symbol2\n } = require_primordials(), kEmpty = Symbol2(\"kEmpty\"), kEof = Symbol2(\"kEof\");\n function map(fn, options) {\n if (typeof fn !== \"function\")\n throw new ERR_INVALID_ARG_TYPE2(\"fn\", [\"Function\", \"AsyncFunction\"], fn);\n if (options != null)\n validateObject(options, \"options\");\n if ((options === null || options === void 0 \? void 0 : options.signal) != null)\n validateAbortSignal(options.signal, \"options.signal\");\n let concurrency = 1;\n if ((options === null || options === void 0 \? void 0 : options.concurrency) != null)\n concurrency = MathFloor(options.concurrency);\n return validateInteger(concurrency, \"concurrency\", 1), async function* map2() {\n var _options$signal, _options$signal2;\n const ac = new AbortController, stream = this, queue = [], signal = ac.signal, signalOpt = {\n signal\n }, abort = () => ac.abort();\n if (options !== null && options !== void 0 && (_options$signal = options.signal) !== null && _options$signal !== void 0 && _options$signal.aborted)\n abort();\n options === null || options === void 0 || (_options$signal2 = options.signal) === null || _options$signal2 === void 0 || _options$signal2.addEventListener(\"abort\", abort);\n let next, resume, done = !1;\n function onDone() {\n done = !0;\n }\n async function pump() {\n try {\n for await (let val of stream) {\n var _val;\n if (done)\n return;\n if (signal.aborted)\n throw new AbortError2;\n try {\n val = fn(val, signalOpt);\n } catch (err) {\n val = PromiseReject(err);\n }\n if (val === kEmpty)\n continue;\n if (typeof ((_val = val) === null || _val === void 0 \? void 0 : _val.catch) === \"function\")\n val.catch(onDone);\n if (queue.push(val), next)\n next(), next = null;\n if (!done && queue.length && queue.length >= concurrency)\n await new Promise2((resolve) => {\n resume = resolve;\n });\n }\n queue.push(kEof);\n } catch (err) {\n const val = PromiseReject(err);\n PromisePrototypeCatch(val, onDone), queue.push(val);\n } finally {\n var _options$signal3;\n if (done = !0, next)\n next(), next = null;\n options === null || options === void 0 || (_options$signal3 = options.signal) === null || _options$signal3 === void 0 || _options$signal3.removeEventListener(\"abort\", abort);\n }\n }\n pump();\n try {\n while (!0) {\n while (queue.length > 0) {\n const val = await queue[0];\n if (val === kEof)\n return;\n if (signal.aborted)\n throw new AbortError2;\n if (val !== kEmpty)\n yield val;\n if (queue.shift(), resume)\n resume(), resume = null;\n }\n await new Promise2((resolve) => {\n next = resolve;\n });\n }\n } finally {\n if (ac.abort(), done = !0, resume)\n resume(), resume = null;\n }\n }.@call(this);\n }\n function asIndexedPairs(options = void 0) {\n if (options != null)\n validateObject(options, \"options\");\n if ((options === null || options === void 0 \? void 0 : options.signal) != null)\n validateAbortSignal(options.signal, \"options.signal\");\n return async function* asIndexedPairs2() {\n let index = 0;\n for await (let val of this) {\n var _options$signal4;\n if (options !== null && options !== void 0 && (_options$signal4 = options.signal) !== null && _options$signal4 !== void 0 && _options$signal4.aborted)\n throw new AbortError2({\n cause: options.signal.reason\n });\n yield [index++, val];\n }\n }.@call(this);\n }\n async function some(fn, options = void 0) {\n for await (let unused of filter.@call(this, fn, options))\n return !0;\n return !1;\n }\n async function every(fn, options = void 0) {\n if (typeof fn !== \"function\")\n throw new ERR_INVALID_ARG_TYPE2(\"fn\", [\"Function\", \"AsyncFunction\"], fn);\n return !await some.@call(this, async (...args) => {\n return !await fn(...args);\n }, options);\n }\n async function find(fn, options) {\n for await (let result of filter.@call(this, fn, options))\n return result;\n return;\n }\n async function forEach(fn, options) {\n if (typeof fn !== \"function\")\n throw new ERR_INVALID_ARG_TYPE2(\"fn\", [\"Function\", \"AsyncFunction\"], fn);\n async function forEachFn(value, options2) {\n return await fn(value, options2), kEmpty;\n }\n for await (let unused of map.@call(this, forEachFn, options))\n ;\n }\n function filter(fn, options) {\n if (typeof fn !== \"function\")\n throw new ERR_INVALID_ARG_TYPE2(\"fn\", [\"Function\", \"AsyncFunction\"], fn);\n async function filterFn(value, options2) {\n if (await fn(value, options2))\n return value;\n return kEmpty;\n }\n return map.@call(this, filterFn, options);\n }\n var ReduceAwareErrMissingArgs = class extends ERR_MISSING_ARGS {\n constructor() {\n super(\"reduce\");\n this.message = \"Reduce of an empty stream requires an initial value\";\n }\n };\n async function reduce(reducer, initialValue, options) {\n var _options$signal5;\n if (typeof reducer !== \"function\")\n throw new ERR_INVALID_ARG_TYPE2(\"reducer\", [\"Function\", \"AsyncFunction\"], reducer);\n if (options != null)\n validateObject(options, \"options\");\n if ((options === null || options === void 0 \? void 0 : options.signal) != null)\n validateAbortSignal(options.signal, \"options.signal\");\n let hasInitialValue = arguments.length > 1;\n if (options !== null && options !== void 0 && (_options$signal5 = options.signal) !== null && _options$signal5 !== void 0 && _options$signal5.aborted) {\n const err = new AbortError2(void 0, {\n cause: options.signal.reason\n });\n throw this.once(\"error\", () => {\n }), await finished(this.destroy(err)), err;\n }\n const ac = new AbortController, signal = ac.signal;\n if (options !== null && options !== void 0 && options.signal) {\n const opts = {\n once: !0,\n [kWeakHandler]: this\n };\n options.signal.addEventListener(\"abort\", () => ac.abort(), opts);\n }\n let gotAnyItemFromStream = !1;\n try {\n for await (let value of this) {\n var _options$signal6;\n if (gotAnyItemFromStream = !0, options !== null && options !== void 0 && (_options$signal6 = options.signal) !== null && _options$signal6 !== void 0 && _options$signal6.aborted)\n throw new AbortError2;\n if (!hasInitialValue)\n initialValue = value, hasInitialValue = !0;\n else\n initialValue = await reducer(initialValue, value, {\n signal\n });\n }\n if (!gotAnyItemFromStream && !hasInitialValue)\n throw new ReduceAwareErrMissingArgs;\n } finally {\n ac.abort();\n }\n return initialValue;\n }\n async function toArray(options) {\n if (options != null)\n validateObject(options, \"options\");\n if ((options === null || options === void 0 \? void 0 : options.signal) != null)\n validateAbortSignal(options.signal, \"options.signal\");\n const result = [];\n for await (let val of this) {\n var _options$signal7;\n if (options !== null && options !== void 0 && (_options$signal7 = options.signal) !== null && _options$signal7 !== void 0 && _options$signal7.aborted)\n throw new AbortError2(void 0, {\n cause: options.signal.reason\n });\n ArrayPrototypePush(result, val);\n }\n return result;\n }\n function flatMap(fn, options) {\n const values = map.@call(this, fn, options);\n return async function* flatMap2() {\n for await (let val of values)\n yield* val;\n }.@call(this);\n }\n function toIntegerOrInfinity(number) {\n if (number = Number2(number), NumberIsNaN(number))\n return 0;\n if (number < 0)\n throw new ERR_OUT_OF_RANGE(\"number\", \">= 0\", number);\n return number;\n }\n function drop(number, options = void 0) {\n if (options != null)\n validateObject(options, \"options\");\n if ((options === null || options === void 0 \? void 0 : options.signal) != null)\n validateAbortSignal(options.signal, \"options.signal\");\n return number = toIntegerOrInfinity(number), async function* drop2() {\n var _options$signal8;\n if (options !== null && options !== void 0 && (_options$signal8 = options.signal) !== null && _options$signal8 !== void 0 && _options$signal8.aborted)\n throw new AbortError2;\n for await (let val of this) {\n var _options$signal9;\n if (options !== null && options !== void 0 && (_options$signal9 = options.signal) !== null && _options$signal9 !== void 0 && _options$signal9.aborted)\n throw new AbortError2;\n if (number-- <= 0)\n yield val;\n }\n }.@call(this);\n }\n function take(number, options = void 0) {\n if (options != null)\n validateObject(options, \"options\");\n if ((options === null || options === void 0 \? void 0 : options.signal) != null)\n validateAbortSignal(options.signal, \"options.signal\");\n return number = toIntegerOrInfinity(number), async function* take2() {\n var _options$signal10;\n if (options !== null && options !== void 0 && (_options$signal10 = options.signal) !== null && _options$signal10 !== void 0 && _options$signal10.aborted)\n throw new AbortError2;\n for await (let val of this) {\n var _options$signal11;\n if (options !== null && options !== void 0 && (_options$signal11 = options.signal) !== null && _options$signal11 !== void 0 && _options$signal11.aborted)\n throw new AbortError2;\n if (number-- > 0)\n yield val;\n else\n return;\n }\n }.@call(this);\n }\n module.exports.streamReturningOperators = {\n asIndexedPairs,\n drop,\n filter,\n flatMap,\n map,\n take\n }, module.exports.promiseReturningOperators = {\n every,\n forEach,\n reduce,\n toArray,\n some,\n find\n };\n }\n}), require_destroy = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/destroy.js\"(exports, module) {\n var {\n aggregateTwoErrors,\n codes: { ERR_MULTIPLE_CALLBACK },\n AbortError: AbortError2\n } = require_errors(), { Symbol: Symbol2 } = require_primordials(), { kDestroyed, isDestroyed, isFinished, isServerRequest } = require_utils(), kDestroy = \"#kDestroy\", kConstruct = \"#kConstruct\";\n function checkError(err, w, r) {\n if (err) {\n if (err.stack, w && !w.errored)\n w.errored = err;\n if (r && !r.errored)\n r.errored = err;\n }\n }\n function destroy2(err, cb) {\n const r = this._readableState, w = this._writableState, s = w || r;\n if (w && w.destroyed || r && r.destroyed) {\n if (typeof cb === \"function\")\n cb();\n return this;\n }\n if (checkError(err, w, r), w)\n w.destroyed = !0;\n if (r)\n r.destroyed = !0;\n if (!s.constructed)\n this.once(kDestroy, (er) => {\n _destroy(this, aggregateTwoErrors(er, err), cb);\n });\n else\n _destroy(this, err, cb);\n return this;\n }\n function _destroy(self, err, cb) {\n let called = !1;\n function onDestroy(err2) {\n if (called)\n return;\n called = !0;\n const { _readableState: r, _writableState: w } = self;\n if (checkError(err2, w, r), w)\n w.closed = !0;\n if (r)\n r.closed = !0;\n if (typeof cb === \"function\")\n cb(err2);\n if (err2)\n runOnNextTick(emitErrorCloseNT, self, err2);\n else\n runOnNextTick(emitCloseNT, self);\n }\n try {\n self._destroy(err || null, onDestroy);\n } catch (err2) {\n onDestroy(err2);\n }\n }\n function emitErrorCloseNT(self, err) {\n emitErrorNT(self, err), emitCloseNT(self);\n }\n function emitCloseNT(self) {\n const { _readableState: r, _writableState: w } = self;\n if (w)\n w.closeEmitted = !0;\n if (r)\n r.closeEmitted = !0;\n if (w && w.emitClose || r && r.emitClose)\n self.emit(\"close\");\n }\n function emitErrorNT(self, err) {\n const r = self\?._readableState, w = self\?._writableState;\n if (w\?.errorEmitted || r\?.errorEmitted)\n return;\n if (w)\n w.errorEmitted = !0;\n if (r)\n r.errorEmitted = !0;\n self\?.emit\?.(\"error\", err);\n }\n function undestroy() {\n const r = this._readableState, w = this._writableState;\n if (r)\n r.constructed = !0, r.closed = !1, r.closeEmitted = !1, r.destroyed = !1, r.errored = null, r.errorEmitted = !1, r.reading = !1, r.ended = r.readable === !1, r.endEmitted = r.readable === !1;\n if (w)\n w.constructed = !0, w.destroyed = !1, w.closed = !1, w.closeEmitted = !1, w.errored = null, w.errorEmitted = !1, w.finalCalled = !1, w.prefinished = !1, w.ended = w.writable === !1, w.ending = w.writable === !1, w.finished = w.writable === !1;\n }\n function errorOrDestroy2(stream, err, sync) {\n const r = stream\?._readableState, w = stream\?._writableState;\n if (w && w.destroyed || r && r.destroyed)\n return this;\n if (r && r.autoDestroy || w && w.autoDestroy)\n stream.destroy(err);\n else if (err) {\n if (Error.captureStackTrace(err), w && !w.errored)\n w.errored = err;\n if (r && !r.errored)\n r.errored = err;\n if (sync)\n runOnNextTick(emitErrorNT, stream, err);\n else\n emitErrorNT(stream, err);\n }\n }\n function construct(stream, cb) {\n if (typeof stream._construct !== \"function\")\n return;\n const { _readableState: r, _writableState: w } = stream;\n if (r)\n r.constructed = !1;\n if (w)\n w.constructed = !1;\n if (stream.once(kConstruct, cb), stream.listenerCount(kConstruct) > 1)\n return;\n runOnNextTick(constructNT, stream);\n }\n function constructNT(stream) {\n let called = !1;\n function onConstruct(err) {\n if (called) {\n errorOrDestroy2(stream, err !== null && err !== void 0 \? err : new ERR_MULTIPLE_CALLBACK);\n return;\n }\n called = !0;\n const { _readableState: r, _writableState: w } = stream, s = w || r;\n if (r)\n r.constructed = !0;\n if (w)\n w.constructed = !0;\n if (s.destroyed)\n stream.emit(kDestroy, err);\n else if (err)\n errorOrDestroy2(stream, err, !0);\n else\n runOnNextTick(emitConstructNT, stream);\n }\n try {\n stream._construct(onConstruct);\n } catch (err) {\n onConstruct(err);\n }\n }\n function emitConstructNT(stream) {\n stream.emit(kConstruct);\n }\n function isRequest(stream) {\n return stream && stream.setHeader && typeof stream.abort === \"function\";\n }\n function emitCloseLegacy(stream) {\n stream.emit(\"close\");\n }\n function emitErrorCloseLegacy(stream, err) {\n stream.emit(\"error\", err), runOnNextTick(emitCloseLegacy, stream);\n }\n function destroyer(stream, err) {\n if (!stream || isDestroyed(stream))\n return;\n if (!err && !isFinished(stream))\n err = new AbortError2;\n if (isServerRequest(stream))\n stream.socket = null, stream.destroy(err);\n else if (isRequest(stream))\n stream.abort();\n else if (isRequest(stream.req))\n stream.req.abort();\n else if (typeof stream.destroy === \"function\")\n stream.destroy(err);\n else if (typeof stream.close === \"function\")\n stream.close();\n else if (err)\n runOnNextTick(emitErrorCloseLegacy, stream);\n else\n runOnNextTick(emitCloseLegacy, stream);\n if (!stream.destroyed)\n stream[kDestroyed] = !0;\n }\n module.exports = {\n construct,\n destroyer,\n destroy: destroy2,\n undestroy,\n errorOrDestroy: errorOrDestroy2\n };\n }\n}), require_legacy = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/legacy.js\"(exports, module) {\n var { ArrayIsArray: ArrayIsArray2, ObjectSetPrototypeOf } = require_primordials();\n function Stream(options) {\n if (!(this instanceof Stream))\n return new Stream(options);\n EE.@call(this, options);\n }\n Stream.prototype = {}, ObjectSetPrototypeOf(Stream.prototype, EE.prototype), ObjectSetPrototypeOf(Stream, EE), Stream.prototype.pipe = function(dest, options) {\n const source = this;\n function ondata(chunk) {\n if (dest.writable && dest.write(chunk) === !1 && source.pause)\n source.pause();\n }\n source.on(\"data\", ondata);\n function ondrain() {\n if (source.readable && source.resume)\n source.resume();\n }\n if (dest.on(\"drain\", ondrain), !dest._isStdio && (!options || options.end !== !1))\n source.on(\"end\", onend), source.on(\"close\", onclose);\n let didOnEnd = !1;\n function onend() {\n if (didOnEnd)\n return;\n didOnEnd = !0, dest.end();\n }\n function onclose() {\n if (didOnEnd)\n return;\n if (didOnEnd = !0, typeof dest.destroy === \"function\")\n dest.destroy();\n }\n function onerror(er) {\n if (cleanup(), EE.listenerCount(this, \"error\") === 0)\n this.emit(\"error\", er);\n }\n prependListener(source, \"error\", onerror), prependListener(dest, \"error\", onerror);\n function cleanup() {\n source.removeListener(\"data\", ondata), dest.removeListener(\"drain\", ondrain), source.removeListener(\"end\", onend), source.removeListener(\"close\", onclose), source.removeListener(\"error\", onerror), dest.removeListener(\"error\", onerror), source.removeListener(\"end\", cleanup), source.removeListener(\"close\", cleanup), dest.removeListener(\"close\", cleanup);\n }\n return source.on(\"end\", cleanup), source.on(\"close\", cleanup), dest.on(\"close\", cleanup), dest.emit(\"pipe\", source), dest;\n };\n function prependListener(emitter, event, fn) {\n if (typeof emitter.prependListener === \"function\")\n return emitter.prependListener(event, fn);\n if (!emitter._events || !emitter._events[event])\n emitter.on(event, fn);\n else if (ArrayIsArray2(emitter._events[event]))\n emitter._events[event].unshift(fn);\n else\n emitter._events[event] = [fn, emitter._events[event]];\n }\n module.exports = {\n Stream,\n prependListener\n };\n }\n}), require_add_abort_signal = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/add-abort-signal.js\"(exports, module) {\n var { AbortError: AbortError2, codes } = require_errors(), eos = require_end_of_stream(), { ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE2 } = codes, validateAbortSignal = (signal, name) => {\n if (typeof signal !== \"object\" || !(\"aborted\" in signal))\n throw new ERR_INVALID_ARG_TYPE2(name, \"AbortSignal\", signal);\n };\n function isNodeStream(obj) {\n return !!(obj && typeof obj.pipe === \"function\");\n }\n module.exports.addAbortSignal = function addAbortSignal(signal, stream) {\n if (validateAbortSignal(signal, \"signal\"), !isNodeStream(stream))\n throw new ERR_INVALID_ARG_TYPE2(\"stream\", \"stream.Stream\", stream);\n return module.exports.addAbortSignalNoValidate(signal, stream);\n }, module.exports.addAbortSignalNoValidate = function(signal, stream) {\n if (typeof signal !== \"object\" || !(\"aborted\" in signal))\n return stream;\n const onAbort = () => {\n stream.destroy(new AbortError2(void 0, {\n cause: signal.reason\n }));\n };\n if (signal.aborted)\n onAbort();\n else\n signal.addEventListener(\"abort\", onAbort), eos(stream, () => signal.removeEventListener(\"abort\", onAbort));\n return stream;\n };\n }\n}), require_state = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/state.js\"(exports, module) {\n var { MathFloor, NumberIsInteger } = require_primordials(), { ERR_INVALID_ARG_VALUE: ERR_INVALID_ARG_VALUE2 } = require_errors().codes;\n function highWaterMarkFrom(options, isDuplex, duplexKey) {\n return options.highWaterMark != null \? options.highWaterMark : isDuplex \? options[duplexKey] : null;\n }\n function getDefaultHighWaterMark(objectMode) {\n return objectMode \? 16 : 16384;\n }\n function getHighWaterMark(state, options, duplexKey, isDuplex) {\n const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);\n if (hwm != null) {\n if (!NumberIsInteger(hwm) || hwm < 0) {\n const name = isDuplex \? `options.${duplexKey}` : \"options.highWaterMark\";\n throw new ERR_INVALID_ARG_VALUE2(name, hwm);\n }\n return MathFloor(hwm);\n }\n return getDefaultHighWaterMark(state.objectMode);\n }\n module.exports = {\n getHighWaterMark,\n getDefaultHighWaterMark\n };\n }\n}), require_from = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/from.js\"(exports, module) {\n var { PromisePrototypeThen, SymbolAsyncIterator, SymbolIterator } = require_primordials(), { ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE2, ERR_STREAM_NULL_VALUES } = require_errors().codes;\n function from(Readable, iterable, opts) {\n let iterator;\n if (typeof iterable === \"string\" || iterable instanceof @Buffer)\n return new Readable({\n objectMode: !0,\n ...opts,\n read() {\n this.push(iterable), this.push(null);\n }\n });\n let isAsync;\n if (iterable && iterable[SymbolAsyncIterator])\n isAsync = !0, iterator = iterable[SymbolAsyncIterator]();\n else if (iterable && iterable[SymbolIterator])\n isAsync = !1, iterator = iterable[SymbolIterator]();\n else\n throw new ERR_INVALID_ARG_TYPE2(\"iterable\", [\"Iterable\"], iterable);\n const readable = new Readable({\n objectMode: !0,\n highWaterMark: 1,\n ...opts\n });\n let reading = !1;\n readable._read = function() {\n if (!reading)\n reading = !0, next();\n }, readable._destroy = function(error, cb) {\n PromisePrototypeThen(close(error), () => runOnNextTick(cb, error), (e) => runOnNextTick(cb, e || error));\n };\n async function close(error) {\n const hadError = error !== void 0 && error !== null, hasThrow = typeof iterator.throw === \"function\";\n if (hadError && hasThrow) {\n const { value, done } = await iterator.throw(error);\n if (await value, done)\n return;\n }\n if (typeof iterator.return === \"function\") {\n const { value } = await iterator.return();\n await value;\n }\n }\n async function next() {\n for (;; ) {\n try {\n const { value, done } = isAsync \? await iterator.next() : iterator.next();\n if (done)\n readable.push(null);\n else {\n const res = value && typeof value.then === \"function\" \? await value : value;\n if (res === null)\n throw reading = !1, new ERR_STREAM_NULL_VALUES;\n else if (readable.push(res))\n continue;\n else\n reading = !1;\n }\n } catch (err) {\n readable.destroy(err);\n }\n break;\n }\n }\n return readable;\n }\n module.exports = from;\n }\n}), _ReadableFromWeb, _ReadableFromWebForUndici, require_readable = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/readable.js\"(exports, module) {\n var {\n ArrayPrototypeIndexOf,\n NumberIsInteger,\n NumberIsNaN,\n NumberParseInt,\n ObjectDefineProperties,\n ObjectKeys,\n ObjectSetPrototypeOf,\n Promise: Promise2,\n SafeSet,\n SymbolAsyncIterator,\n Symbol: Symbol2\n } = require_primordials(), ReadableState = @lazy(\"bun:stream\").ReadableState, { Stream, prependListener } = require_legacy();\n function Readable(options) {\n if (!(this instanceof Readable))\n return new Readable(options);\n const isDuplex = this instanceof require_duplex();\n if (this._readableState = new ReadableState(options, this, isDuplex), options) {\n const { read, destroy: destroy2, construct, signal } = options;\n if (typeof read === \"function\")\n this._read = read;\n if (typeof destroy2 === \"function\")\n this._destroy = destroy2;\n if (typeof construct === \"function\")\n this._construct = construct;\n if (signal && !isDuplex)\n addAbortSignal(signal, this);\n }\n Stream.@call(this, options), destroyImpl.construct(this, () => {\n if (this._readableState.needReadable)\n maybeReadMore(this, this._readableState);\n });\n }\n Readable.prototype = {}, ObjectSetPrototypeOf(Readable.prototype, Stream.prototype), ObjectSetPrototypeOf(Readable, Stream), Readable.prototype.on = function(ev, fn) {\n const res = Stream.prototype.on.@call(this, ev, fn), state = this._readableState;\n if (ev === \"data\") {\n if (state.readableListening = this.listenerCount(\"readable\") > 0, state.flowing !== !1)\n this.resume();\n } else if (ev === \"readable\") {\n if (!state.endEmitted && !state.readableListening) {\n if (state.readableListening = state.needReadable = !0, state.flowing = !1, state.emittedReadable = !1, state.length)\n emitReadable(this, state);\n else if (!state.reading)\n runOnNextTick(nReadingNextTick, this);\n } else if (state.endEmitted)\n ;\n }\n return res;\n };\n\n class ReadableFromWeb extends Readable {\n #reader;\n #closed;\n #pendingChunks;\n #stream;\n constructor(options, stream) {\n const { objectMode, highWaterMark, encoding, signal } = options;\n super({\n objectMode,\n highWaterMark,\n encoding,\n signal\n });\n this.#pendingChunks = [], this.#reader = @undefined, this.#stream = stream, this.#closed = !1;\n }\n #drainPending() {\n var pendingChunks = this.#pendingChunks, pendingChunksI = 0, pendingChunksCount = pendingChunks.length;\n for (;pendingChunksI < pendingChunksCount; pendingChunksI++) {\n const chunk = pendingChunks[pendingChunksI];\n if (pendingChunks[pendingChunksI] = @undefined, !this.push(chunk, @undefined))\n return this.#pendingChunks = pendingChunks.slice(pendingChunksI + 1), !0;\n }\n if (pendingChunksCount > 0)\n this.#pendingChunks = [];\n return !1;\n }\n #handleDone(reader) {\n reader.releaseLock(), this.#reader = @undefined, this.#closed = !0, this.push(null);\n return;\n }\n async _read() {\n var stream = this.#stream, reader = this.#reader;\n if (stream)\n reader = this.#reader = stream.getReader(), this.#stream = @undefined;\n else if (this.#drainPending())\n return;\n var deferredError;\n try {\n do {\n var done = !1, value;\n const firstResult = reader.readMany();\n if (@isPromise(firstResult)) {\n if ({ done, value } = await firstResult, this.#closed) {\n this.#pendingChunks.push(...value);\n return;\n }\n } else\n ({ done, value } = firstResult);\n if (done) {\n this.#handleDone(reader);\n return;\n }\n if (!this.push(value[0])) {\n this.#pendingChunks = value.slice(1);\n return;\n }\n for (let i = 1, count = value.length;i < count; i++)\n if (!this.push(value[i])) {\n this.#pendingChunks = value.slice(i + 1);\n return;\n }\n } while (!this.#closed);\n } catch (e) {\n deferredError = e;\n } finally {\n if (deferredError)\n throw deferredError;\n }\n }\n _destroy(error, callback) {\n if (!this.#closed) {\n var reader = this.#reader;\n if (reader)\n this.#reader = @undefined, reader.cancel(error).finally(() => {\n this.#closed = !0, callback(error);\n });\n return;\n }\n try {\n callback(error);\n } catch (error2) {\n globalThis.reportError(error2);\n }\n }\n }\n _ReadableFromWebForUndici = ReadableFromWeb;\n function newStreamReadableFromReadableStream(readableStream, options = {}) {\n if (!isReadableStream(readableStream))\n throw new ERR_INVALID_ARG_TYPE2(\"readableStream\", \"ReadableStream\", readableStream);\n validateObject(options, \"options\");\n const {\n highWaterMark,\n encoding,\n objectMode = !1,\n signal\n } = options;\n if (encoding !== @undefined && !@Buffer.isEncoding(encoding))\n throw new ERR_INVALID_ARG_VALUE(encoding, \"options.encoding\");\n return validateBoolean(objectMode, \"options.objectMode\"), getNativeReadableStream(Readable, readableStream, options) || new ReadableFromWeb({\n highWaterMark,\n encoding,\n objectMode,\n signal\n }, readableStream);\n }\n module.exports = Readable, _ReadableFromWeb = newStreamReadableFromReadableStream;\n var { addAbortSignal } = require_add_abort_signal(), eos = require_end_of_stream();\n const { maybeReadMore: _maybeReadMore, resume, emitReadable: _emitReadable, onEofChunk } = @lazy(\"bun:stream\");\n function maybeReadMore(stream, state) {\n process.nextTick(_maybeReadMore, stream, state);\n }\n function emitReadable(stream, state) {\n _emitReadable(stream, state);\n }\n var destroyImpl = require_destroy(), {\n aggregateTwoErrors,\n codes: {\n ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE2,\n ERR_METHOD_NOT_IMPLEMENTED,\n ERR_OUT_OF_RANGE,\n ERR_STREAM_PUSH_AFTER_EOF,\n ERR_STREAM_UNSHIFT_AFTER_END_EVENT\n }\n } = require_errors(), { validateObject } = require_validators(), from = require_from(), nop = () => {\n }, { errorOrDestroy: errorOrDestroy2 } = destroyImpl;\n Readable.prototype.destroy = destroyImpl.destroy, Readable.prototype._undestroy = destroyImpl.undestroy, Readable.prototype._destroy = function(err, cb) {\n cb(err);\n }, Readable.prototype[EE.captureRejectionSymbol] = function(err) {\n this.destroy(err);\n }, Readable.prototype.push = function(chunk, encoding) {\n return readableAddChunk(this, chunk, encoding, !1);\n }, Readable.prototype.unshift = function(chunk, encoding) {\n return readableAddChunk(this, chunk, encoding, !0);\n };\n function readableAddChunk(stream, chunk, encoding, addToFront) {\n const state = stream._readableState;\n let err;\n if (!state.objectMode) {\n if (typeof chunk === \"string\") {\n if (encoding = encoding || state.defaultEncoding, state.encoding !== encoding)\n if (addToFront && state.encoding)\n chunk = @Buffer.from(chunk, encoding).toString(state.encoding);\n else\n chunk = @Buffer.from(chunk, encoding), encoding = \"\";\n } else if (chunk instanceof @Buffer)\n encoding = \"\";\n else if (Stream._isUint8Array(chunk)) {\n if (addToFront || !state.decoder)\n chunk = Stream._uint8ArrayToBuffer(chunk);\n encoding = \"\";\n } else if (chunk != null)\n err = new ERR_INVALID_ARG_TYPE2(\"chunk\", [\"string\", \"Buffer\", \"Uint8Array\"], chunk);\n }\n if (err)\n errorOrDestroy2(stream, err);\n else if (chunk === null)\n state.reading = !1, onEofChunk(stream, state);\n else if (state.objectMode || chunk && chunk.length > 0)\n if (addToFront)\n if (state.endEmitted)\n errorOrDestroy2(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT);\n else if (state.destroyed || state.errored)\n return !1;\n else\n addChunk(stream, state, chunk, !0);\n else if (state.ended)\n errorOrDestroy2(stream, new ERR_STREAM_PUSH_AFTER_EOF);\n else if (state.destroyed || state.errored)\n return !1;\n else if (state.reading = !1, state.decoder && !encoding)\n if (chunk = state.decoder.write(chunk), state.objectMode || chunk.length !== 0)\n addChunk(stream, state, chunk, !1);\n else\n maybeReadMore(stream, state);\n else\n addChunk(stream, state, chunk, !1);\n else if (!addToFront)\n state.reading = !1, maybeReadMore(stream, state);\n return !state.ended && (state.length < state.highWaterMark || state.length === 0);\n }\n function addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync && stream.listenerCount(\"data\") > 0) {\n if (state.multiAwaitDrain)\n state.awaitDrainWriters.clear();\n else\n state.awaitDrainWriters = null;\n state.dataEmitted = !0, stream.emit(\"data\", chunk);\n } else {\n if (state.length += state.objectMode \? 1 : chunk.length, addToFront)\n state.buffer.unshift(chunk);\n else\n state.buffer.push(chunk);\n if (state.needReadable)\n emitReadable(stream, state);\n }\n maybeReadMore(stream, state);\n }\n Readable.prototype.isPaused = function() {\n const state = this._readableState;\n return state.paused === !0 || state.flowing === !1;\n }, Readable.prototype.setEncoding = function(enc) {\n const decoder = new StringDecoder(enc);\n this._readableState.decoder = decoder, this._readableState.encoding = this._readableState.decoder.encoding;\n const buffer = this._readableState.buffer;\n let content = \"\";\n for (let i = buffer.length;i > 0; i--)\n content += decoder.write(buffer.shift());\n if (content !== \"\")\n buffer.push(content);\n return this._readableState.length = content.length, this;\n };\n var MAX_HWM = 1073741824;\n function computeNewHighWaterMark(n) {\n if (n > MAX_HWM)\n throw new ERR_OUT_OF_RANGE(\"size\", \"<= 1GiB\", n);\n else\n n--, n |= n >>> 1, n |= n >>> 2, n |= n >>> 4, n |= n >>> 8, n |= n >>> 16, n++;\n return n;\n }\n function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended)\n return 0;\n if (state.objectMode)\n return 1;\n if (NumberIsNaN(n)) {\n if (state.flowing && state.length)\n return state.buffer.first().length;\n return state.length;\n }\n if (n <= state.length)\n return n;\n return state.ended \? state.length : 0;\n }\n Readable.prototype.read = function(n) {\n if (!NumberIsInteger(n))\n n = NumberParseInt(n, 10);\n const state = this._readableState, nOrig = n;\n if (n > state.highWaterMark)\n state.highWaterMark = computeNewHighWaterMark(n);\n if (n !== 0)\n state.emittedReadable = !1;\n if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 \? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {\n if (state.length === 0 && state.ended)\n endReadable(this);\n else\n emitReadable(this, state);\n return null;\n }\n if (n = howMuchToRead(n, state), n === 0 && state.ended) {\n if (state.length === 0)\n endReadable(this);\n return null;\n }\n let doRead = state.needReadable;\n if (state.length === 0 || state.length - n < state.highWaterMark)\n doRead = !0;\n if (state.ended || state.reading || state.destroyed || state.errored || !state.constructed)\n doRead = !1;\n else if (doRead) {\n if (state.reading = !0, state.sync = !0, state.length === 0)\n state.needReadable = !0;\n try {\n var result = this._read(state.highWaterMark);\n if (@isPromise(result)) {\n const peeked = Bun.peek(result);\n if (peeked !== result)\n result = peeked;\n }\n if (@isPromise(result) && result\?.then && @isCallable(result.then))\n result.then(nop, function(err) {\n errorOrDestroy2(this, err);\n });\n } catch (err) {\n errorOrDestroy2(this, err);\n }\n if (state.sync = !1, !state.reading)\n n = howMuchToRead(nOrig, state);\n }\n let ret;\n if (n > 0)\n ret = fromList(n, state);\n else\n ret = null;\n if (ret === null)\n state.needReadable = state.length <= state.highWaterMark, n = 0;\n else if (state.length -= n, state.multiAwaitDrain)\n state.awaitDrainWriters.clear();\n else\n state.awaitDrainWriters = null;\n if (state.length === 0) {\n if (!state.ended)\n state.needReadable = !0;\n if (nOrig !== n && state.ended)\n endReadable(this);\n }\n if (ret !== null && !state.errorEmitted && !state.closeEmitted)\n state.dataEmitted = !0, this.emit(\"data\", ret);\n return ret;\n }, Readable.prototype._read = function(n) {\n throw new ERR_METHOD_NOT_IMPLEMENTED(\"_read()\");\n }, Readable.prototype.pipe = function(dest, pipeOpts) {\n const src = this, state = this._readableState;\n if (state.pipes.length === 1) {\n if (!state.multiAwaitDrain)\n state.multiAwaitDrain = !0, state.awaitDrainWriters = new SafeSet(state.awaitDrainWriters \? [state.awaitDrainWriters] : []);\n }\n state.pipes.push(dest);\n const endFn = (!pipeOpts || pipeOpts.end !== !1) && dest !== process.stdout && dest !== process.stderr \? onend : unpipe;\n if (state.endEmitted)\n runOnNextTick(endFn);\n else\n src.once(\"end\", endFn);\n dest.on(\"unpipe\", onunpipe);\n function onunpipe(readable, unpipeInfo) {\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === !1)\n unpipeInfo.hasUnpiped = !0, cleanup();\n }\n }\n function onend() {\n dest.end();\n }\n let ondrain, cleanedUp = !1;\n function cleanup() {\n if (dest.removeListener(\"close\", onclose), dest.removeListener(\"finish\", onfinish), ondrain)\n dest.removeListener(\"drain\", ondrain);\n if (dest.removeListener(\"error\", onerror), dest.removeListener(\"unpipe\", onunpipe), src.removeListener(\"end\", onend), src.removeListener(\"end\", unpipe), src.removeListener(\"data\", ondata), cleanedUp = !0, ondrain && state.awaitDrainWriters && (!dest._writableState || dest._writableState.needDrain))\n ondrain();\n }\n function pause() {\n if (!cleanedUp) {\n if (state.pipes.length === 1 && state.pipes[0] === dest)\n state.awaitDrainWriters = dest, state.multiAwaitDrain = !1;\n else if (state.pipes.length > 1 && state.pipes.includes(dest))\n state.awaitDrainWriters.add(dest);\n src.pause();\n }\n if (!ondrain)\n ondrain = pipeOnDrain(src, dest), dest.on(\"drain\", ondrain);\n }\n src.on(\"data\", ondata);\n function ondata(chunk) {\n if (dest.write(chunk) === !1)\n pause();\n }\n function onerror(er) {\n if (unpipe(), dest.removeListener(\"error\", onerror), dest.listenerCount(\"error\") === 0) {\n const s = dest._writableState || dest._readableState;\n if (s && !s.errorEmitted)\n errorOrDestroy2(dest, er);\n else\n dest.emit(\"error\", er);\n }\n }\n prependListener(dest, \"error\", onerror);\n function onclose() {\n dest.removeListener(\"finish\", onfinish), unpipe();\n }\n dest.once(\"close\", onclose);\n function onfinish() {\n dest.removeListener(\"close\", onclose), unpipe();\n }\n dest.once(\"finish\", onfinish);\n function unpipe() {\n src.unpipe(dest);\n }\n if (dest.emit(\"pipe\", src), dest.writableNeedDrain === !0) {\n if (state.flowing)\n pause();\n } else if (!state.flowing)\n src.resume();\n return dest;\n };\n function pipeOnDrain(src, dest) {\n return function pipeOnDrainFunctionResult() {\n const state = src._readableState;\n if (state.awaitDrainWriters === dest)\n state.awaitDrainWriters = null;\n else if (state.multiAwaitDrain)\n state.awaitDrainWriters.delete(dest);\n if ((!state.awaitDrainWriters || state.awaitDrainWriters.size === 0) && src.listenerCount(\"data\"))\n src.resume();\n };\n }\n Readable.prototype.unpipe = function(dest) {\n const state = this._readableState, unpipeInfo = {\n hasUnpiped: !1\n };\n if (state.pipes.length === 0)\n return this;\n if (!dest) {\n const dests = state.pipes;\n state.pipes = [], this.pause();\n for (let i = 0;i < dests.length; i++)\n dests[i].emit(\"unpipe\", this, {\n hasUnpiped: !1\n });\n return this;\n }\n const index = ArrayPrototypeIndexOf(state.pipes, dest);\n if (index === -1)\n return this;\n if (state.pipes.splice(index, 1), state.pipes.length === 0)\n this.pause();\n return dest.emit(\"unpipe\", this, unpipeInfo), this;\n }, Readable.prototype.addListener = Readable.prototype.on, Readable.prototype.removeListener = function(ev, fn) {\n const res = Stream.prototype.removeListener.@call(this, ev, fn);\n if (ev === \"readable\")\n runOnNextTick(updateReadableListening, this);\n return res;\n }, Readable.prototype.off = Readable.prototype.removeListener, Readable.prototype.removeAllListeners = function(ev) {\n const res = Stream.prototype.removeAllListeners.@apply(this, arguments);\n if (ev === \"readable\" || ev === void 0)\n runOnNextTick(updateReadableListening, this);\n return res;\n };\n function updateReadableListening(self) {\n const state = self._readableState;\n if (state.readableListening = self.listenerCount(\"readable\") > 0, state.resumeScheduled && state.paused === !1)\n state.flowing = !0;\n else if (self.listenerCount(\"data\") > 0)\n self.resume();\n else if (!state.readableListening)\n state.flowing = null;\n }\n function nReadingNextTick(self) {\n self.read(0);\n }\n Readable.prototype.resume = function() {\n const state = this._readableState;\n if (!state.flowing)\n state.flowing = !state.readableListening, resume(this, state);\n return state.paused = !1, this;\n }, Readable.prototype.pause = function() {\n if (this._readableState.flowing !== !1)\n this._readableState.flowing = !1, this.emit(\"pause\");\n return this._readableState.paused = !0, this;\n }, Readable.prototype.wrap = function(stream) {\n let paused = !1;\n stream.on(\"data\", (chunk) => {\n if (!this.push(chunk) && stream.pause)\n paused = !0, stream.pause();\n }), stream.on(\"end\", () => {\n this.push(null);\n }), stream.on(\"error\", (err) => {\n errorOrDestroy2(this, err);\n }), stream.on(\"close\", () => {\n this.destroy();\n }), stream.on(\"destroy\", () => {\n this.destroy();\n }), this._read = () => {\n if (paused && stream.resume)\n paused = !1, stream.resume();\n };\n const streamKeys = ObjectKeys(stream);\n for (let j = 1;j < streamKeys.length; j++) {\n const i = streamKeys[j];\n if (this[i] === void 0 && typeof stream[i] === \"function\")\n this[i] = stream[i].bind(stream);\n }\n return this;\n }, Readable.prototype[SymbolAsyncIterator] = function() {\n return streamToAsyncIterator(this);\n }, Readable.prototype.iterator = function(options) {\n if (options !== void 0)\n validateObject(options, \"options\");\n return streamToAsyncIterator(this, options);\n };\n function streamToAsyncIterator(stream, options) {\n if (typeof stream.read !== \"function\")\n stream = Readable.wrap(stream, {\n objectMode: !0\n });\n const iter = createAsyncIterator(stream, options);\n return iter.stream = stream, iter;\n }\n async function* createAsyncIterator(stream, options) {\n let callback = nop;\n function next(resolve) {\n if (this === stream)\n callback(), callback = nop;\n else\n callback = resolve;\n }\n stream.on(\"readable\", next);\n let error;\n const cleanup = eos(stream, {\n writable: !1\n }, (err) => {\n error = err \? aggregateTwoErrors(error, err) : null, callback(), callback = nop;\n });\n try {\n while (!0) {\n const chunk = stream.destroyed \? null : stream.read();\n if (chunk !== null)\n yield chunk;\n else if (error)\n throw error;\n else if (error === null)\n return;\n else\n await new Promise2(next);\n }\n } catch (err) {\n throw error = aggregateTwoErrors(error, err), error;\n } finally {\n if ((error || (options === null || options === void 0 \? void 0 : options.destroyOnReturn) !== !1) && (error === void 0 || stream._readableState.autoDestroy))\n destroyImpl.destroyer(stream, null);\n else\n stream.off(\"readable\", next), cleanup();\n }\n }\n ObjectDefineProperties(Readable.prototype, {\n readable: {\n get() {\n const r = this._readableState;\n return !!r && r.readable !== !1 && !r.destroyed && !r.errorEmitted && !r.endEmitted;\n },\n set(val) {\n if (this._readableState)\n this._readableState.readable = !!val;\n }\n },\n readableDidRead: {\n enumerable: !1,\n get: function() {\n return this._readableState.dataEmitted;\n }\n },\n readableAborted: {\n enumerable: !1,\n get: function() {\n return !!(this._readableState.readable !== !1 && (this._readableState.destroyed || this._readableState.errored) && !this._readableState.endEmitted);\n }\n },\n readableHighWaterMark: {\n enumerable: !1,\n get: function() {\n return this._readableState.highWaterMark;\n }\n },\n readableBuffer: {\n enumerable: !1,\n get: function() {\n return this._readableState && this._readableState.buffer;\n }\n },\n readableFlowing: {\n enumerable: !1,\n get: function() {\n return this._readableState.flowing;\n },\n set: function(state) {\n if (this._readableState)\n this._readableState.flowing = state;\n }\n },\n readableLength: {\n enumerable: !1,\n get() {\n return this._readableState.length;\n }\n },\n readableObjectMode: {\n enumerable: !1,\n get() {\n return this._readableState \? this._readableState.objectMode : !1;\n }\n },\n readableEncoding: {\n enumerable: !1,\n get() {\n return this._readableState \? this._readableState.encoding : null;\n }\n },\n errored: {\n enumerable: !1,\n get() {\n return this._readableState \? this._readableState.errored : null;\n }\n },\n closed: {\n get() {\n return this._readableState \? this._readableState.closed : !1;\n }\n },\n destroyed: {\n enumerable: !1,\n get() {\n return this._readableState \? this._readableState.destroyed : !1;\n },\n set(value) {\n if (!this._readableState)\n return;\n this._readableState.destroyed = value;\n }\n },\n readableEnded: {\n enumerable: !1,\n get() {\n return this._readableState \? this._readableState.endEmitted : !1;\n }\n }\n }), Readable._fromList = fromList;\n function fromList(n, state) {\n if (state.length === 0)\n return null;\n let ret;\n if (state.objectMode)\n ret = state.buffer.shift();\n else if (!n || n >= state.length) {\n if (state.decoder)\n ret = state.buffer.join(\"\");\n else if (state.buffer.length === 1)\n ret = state.buffer.first();\n else\n ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else\n ret = state.buffer.consume(n, state.decoder);\n return ret;\n }\n function endReadable(stream) {\n const state = stream._readableState;\n if (!state.endEmitted)\n state.ended = !0, runOnNextTick(endReadableNT, state, stream);\n }\n function endReadableNT(state, stream) {\n if (!state.errored && !state.closeEmitted && !state.endEmitted && state.length === 0) {\n if (state.endEmitted = !0, stream.emit(\"end\"), stream.writable && stream.allowHalfOpen === !1)\n runOnNextTick(endWritableNT, stream);\n else if (state.autoDestroy) {\n const wState = stream._writableState;\n if (!wState || wState.autoDestroy && (wState.finished || wState.writable === !1))\n stream.destroy();\n }\n }\n }\n function endWritableNT(stream) {\n if (stream.writable && !stream.writableEnded && !stream.destroyed)\n stream.end();\n }\n Readable.from = function(iterable, opts) {\n return from(Readable, iterable, opts);\n };\n var webStreamsAdapters = {\n newStreamReadableFromReadableStream,\n newReadableStreamFromStreamReadable(streamReadable, options = {}) {\n if (typeof streamReadable\?._readableState !== \"object\")\n throw new ERR_INVALID_ARG_TYPE2(\"streamReadable\", \"stream.Readable\", streamReadable);\n var { isDestroyed, isReadable } = require_utils();\n if (isDestroyed(streamReadable) || !isReadable(streamReadable)) {\n const readable = new @ReadableStream;\n return readable.cancel(), readable;\n }\n const { readableObjectMode: objectMode, readableHighWaterMark: highWaterMark } = streamReadable, strategy = ((strategy2) => {\n if (strategy2)\n return strategy2;\n if (objectMode)\n return new CountQueuingStrategy({ highWaterMark });\n return { highWaterMark };\n })(options\?.strategy);\n let controller;\n function onData(chunk) {\n if (controller.enqueue(chunk), controller.desiredSize <= 0)\n streamReadable.pause();\n }\n streamReadable.pause();\n const cleanup = eos(streamReadable, (error) => {\n if (error\?.code === \"ERR_STREAM_PREMATURE_CLOSE\")\n error = new AbortError(@undefined, { cause: error });\n if (cleanup(), streamReadable.on(\"error\", () => {\n }), error)\n return controller.error(error);\n controller.close();\n });\n return streamReadable.on(\"data\", onData), new @ReadableStream({\n start(c) {\n controller = c;\n },\n pull() {\n streamReadable.resume();\n },\n cancel(reason) {\n destroy(streamReadable, reason);\n }\n }, strategy);\n }\n };\n Readable.fromWeb = function(readableStream, options) {\n return webStreamsAdapters.newStreamReadableFromReadableStream(readableStream, options);\n }, Readable.toWeb = function(streamReadable, options) {\n return webStreamsAdapters.newReadableStreamFromStreamReadable(streamReadable, options);\n }, Readable.wrap = function(src, options) {\n var _ref, _src$readableObjectMo;\n return new Readable({\n objectMode: (_ref = (_src$readableObjectMo = src.readableObjectMode) !== null && _src$readableObjectMo !== void 0 \? _src$readableObjectMo : src.objectMode) !== null && _ref !== void 0 \? _ref : !0,\n ...options,\n destroy(err, callback) {\n destroyImpl.destroyer(src, err), callback(err);\n }\n }).wrap(src);\n };\n }\n}), require_writable = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/writable.js\"(exports, module) {\n var {\n ArrayPrototypeSlice,\n Error: Error2,\n FunctionPrototypeSymbolHasInstance,\n ObjectDefineProperty,\n ObjectDefineProperties,\n ObjectSetPrototypeOf,\n StringPrototypeToLowerCase,\n Symbol: Symbol2,\n SymbolHasInstance\n } = require_primordials(), Stream = require_legacy().Stream, destroyImpl = require_destroy(), { addAbortSignal } = require_add_abort_signal(), { getHighWaterMark, getDefaultHighWaterMark } = require_state(), {\n ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE2,\n ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK,\n ERR_STREAM_CANNOT_PIPE,\n ERR_STREAM_DESTROYED,\n ERR_STREAM_ALREADY_FINISHED,\n ERR_STREAM_NULL_VALUES,\n ERR_STREAM_WRITE_AFTER_END,\n ERR_UNKNOWN_ENCODING\n } = require_errors().codes, { errorOrDestroy: errorOrDestroy2 } = destroyImpl;\n function Writable(options = {}) {\n const isDuplex = this instanceof require_duplex();\n if (!isDuplex && !FunctionPrototypeSymbolHasInstance(Writable, this))\n return new Writable(options);\n if (this._writableState = new WritableState(options, this, isDuplex), options) {\n if (typeof options.write === \"function\")\n this._write = options.write;\n if (typeof options.writev === \"function\")\n this._writev = options.writev;\n if (typeof options.destroy === \"function\")\n this._destroy = options.destroy;\n if (typeof options.final === \"function\")\n this._final = options.final;\n if (typeof options.construct === \"function\")\n this._construct = options.construct;\n if (options.signal)\n addAbortSignal(options.signal, this);\n }\n Stream.@call(this, options), destroyImpl.construct(this, () => {\n const state = this._writableState;\n if (!state.writing)\n clearBuffer(this, state);\n finishMaybe(this, state);\n });\n }\n Writable.prototype = {}, ObjectSetPrototypeOf(Writable.prototype, Stream.prototype), ObjectSetPrototypeOf(Writable, Stream), module.exports = Writable;\n function nop() {\n }\n var kOnFinished = Symbol2(\"kOnFinished\");\n function WritableState(options, stream, isDuplex) {\n if (typeof isDuplex !== \"boolean\")\n isDuplex = stream instanceof require_duplex();\n if (this.objectMode = !!(options && options.objectMode), isDuplex)\n this.objectMode = this.objectMode || !!(options && options.writableObjectMode);\n this.highWaterMark = options \? getHighWaterMark(this, options, \"writableHighWaterMark\", isDuplex) : getDefaultHighWaterMark(!1), this.finalCalled = !1, this.needDrain = !1, this.ending = !1, this.ended = !1, this.finished = !1, this.destroyed = !1;\n const noDecode = !!(options && options.decodeStrings === !1);\n this.decodeStrings = !noDecode, this.defaultEncoding = options && options.defaultEncoding || \"utf8\", this.length = 0, this.writing = !1, this.corked = 0, this.sync = !0, this.bufferProcessing = !1, this.onwrite = onwrite.bind(void 0, stream), this.writecb = null, this.writelen = 0, this.afterWriteTickInfo = null, resetBuffer(this), this.pendingcb = 0, this.constructed = !0, this.prefinished = !1, this.errorEmitted = !1, this.emitClose = !options || options.emitClose !== !1, this.autoDestroy = !options || options.autoDestroy !== !1, this.errored = null, this.closed = !1, this.closeEmitted = !1, this[kOnFinished] = [];\n }\n WritableState.prototype = {};\n function resetBuffer(state) {\n state.buffered = [], state.bufferedIndex = 0, state.allBuffers = !0, state.allNoop = !0;\n }\n WritableState.prototype.getBuffer = function getBuffer() {\n return ArrayPrototypeSlice(this.buffered, this.bufferedIndex);\n }, ObjectDefineProperty(WritableState.prototype, \"bufferedRequestCount\", {\n get() {\n return this.buffered.length - this.bufferedIndex;\n }\n }), ObjectDefineProperty(Writable, SymbolHasInstance, {\n value: function(object) {\n if (FunctionPrototypeSymbolHasInstance(this, object))\n return !0;\n if (this !== Writable)\n return !1;\n return object && object._writableState instanceof WritableState;\n }\n }), Writable.prototype.pipe = function() {\n errorOrDestroy2(this, new ERR_STREAM_CANNOT_PIPE);\n };\n function _write(stream, chunk, encoding, cb) {\n const state = stream._writableState;\n if (typeof encoding === \"function\")\n cb = encoding, encoding = state.defaultEncoding;\n else {\n if (!encoding)\n encoding = state.defaultEncoding;\n else if (encoding !== \"buffer\" && !@Buffer.isEncoding(encoding))\n throw new ERR_UNKNOWN_ENCODING(encoding);\n if (typeof cb !== \"function\")\n cb = nop;\n }\n if (chunk === null)\n throw new ERR_STREAM_NULL_VALUES;\n else if (!state.objectMode)\n if (typeof chunk === \"string\") {\n if (state.decodeStrings !== !1)\n chunk = @Buffer.from(chunk, encoding), encoding = \"buffer\";\n } else if (chunk instanceof @Buffer)\n encoding = \"buffer\";\n else if (Stream._isUint8Array(chunk))\n chunk = Stream._uint8ArrayToBuffer(chunk), encoding = \"buffer\";\n else\n throw new ERR_INVALID_ARG_TYPE2(\"chunk\", [\"string\", \"Buffer\", \"Uint8Array\"], chunk);\n let err;\n if (state.ending)\n err = new ERR_STREAM_WRITE_AFTER_END;\n else if (state.destroyed)\n err = new ERR_STREAM_DESTROYED(\"write\");\n if (err)\n return runOnNextTick(cb, err), errorOrDestroy2(stream, err, !0), err;\n return state.pendingcb++, writeOrBuffer(stream, state, chunk, encoding, cb);\n }\n Writable.prototype.write = function(chunk, encoding, cb) {\n return _write(this, chunk, encoding, cb) === !0;\n }, Writable.prototype.cork = function() {\n this._writableState.corked++;\n }, Writable.prototype.uncork = function() {\n const state = this._writableState;\n if (state.corked) {\n if (state.corked--, !state.writing)\n clearBuffer(this, state);\n }\n }, Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n if (typeof encoding === \"string\")\n encoding = StringPrototypeToLowerCase(encoding);\n if (!@Buffer.isEncoding(encoding))\n throw new ERR_UNKNOWN_ENCODING(encoding);\n return this._writableState.defaultEncoding = encoding, this;\n };\n function writeOrBuffer(stream, state, chunk, encoding, callback) {\n const len = state.objectMode \? 1 : chunk.length;\n state.length += len;\n const ret = state.length < state.highWaterMark;\n if (!ret)\n state.needDrain = !0;\n if (state.writing || state.corked || state.errored || !state.constructed) {\n if (state.buffered.push({\n chunk,\n encoding,\n callback\n }), state.allBuffers && encoding !== \"buffer\")\n state.allBuffers = !1;\n if (state.allNoop && callback !== nop)\n state.allNoop = !1;\n } else\n state.writelen = len, state.writecb = callback, state.writing = !0, state.sync = !0, stream._write(chunk, encoding, state.onwrite), state.sync = !1;\n return ret && !state.errored && !state.destroyed;\n }\n function doWrite(stream, state, writev, len, chunk, encoding, cb) {\n if (state.writelen = len, state.writecb = cb, state.writing = !0, state.sync = !0, state.destroyed)\n state.onwrite(new ERR_STREAM_DESTROYED(\"write\"));\n else if (writev)\n stream._writev(chunk, state.onwrite);\n else\n stream._write(chunk, encoding, state.onwrite);\n state.sync = !1;\n }\n function onwriteError(stream, state, er, cb) {\n --state.pendingcb, cb(er), errorBuffer(state), errorOrDestroy2(stream, er);\n }\n function onwrite(stream, er) {\n const state = stream._writableState, sync = state.sync, cb = state.writecb;\n if (typeof cb !== \"function\") {\n errorOrDestroy2(stream, new ERR_MULTIPLE_CALLBACK);\n return;\n }\n if (state.writing = !1, state.writecb = null, state.length -= state.writelen, state.writelen = 0, er) {\n if (Error.captureStackTrace(er), !state.errored)\n state.errored = er;\n if (stream._readableState && !stream._readableState.errored)\n stream._readableState.errored = er;\n if (sync)\n runOnNextTick(onwriteError, stream, state, er, cb);\n else\n onwriteError(stream, state, er, cb);\n } else {\n if (state.buffered.length > state.bufferedIndex)\n clearBuffer(stream, state);\n if (sync)\n if (state.afterWriteTickInfo !== null && state.afterWriteTickInfo.cb === cb)\n state.afterWriteTickInfo.count++;\n else\n state.afterWriteTickInfo = {\n count: 1,\n cb,\n stream,\n state\n }, runOnNextTick(afterWriteTick, state.afterWriteTickInfo);\n else\n afterWrite(stream, state, 1, cb);\n }\n }\n function afterWriteTick({ stream, state, count, cb }) {\n return state.afterWriteTickInfo = null, afterWrite(stream, state, count, cb);\n }\n function afterWrite(stream, state, count, cb) {\n if (!state.ending && !stream.destroyed && state.length === 0 && state.needDrain)\n state.needDrain = !1, stream.emit(\"drain\");\n while (count-- > 0)\n state.pendingcb--, cb();\n if (state.destroyed)\n errorBuffer(state);\n finishMaybe(stream, state);\n }\n function errorBuffer(state) {\n if (state.writing)\n return;\n for (let n = state.bufferedIndex;n < state.buffered.length; ++n) {\n var _state$errored;\n const { chunk, callback } = state.buffered[n], len = state.objectMode \? 1 : chunk.length;\n state.length -= len, callback((_state$errored = state.errored) !== null && _state$errored !== void 0 \? _state$errored : new ERR_STREAM_DESTROYED(\"write\"));\n }\n const onfinishCallbacks = state[kOnFinished].splice(0);\n for (let i = 0;i < onfinishCallbacks.length; i++) {\n var _state$errored2;\n onfinishCallbacks[i]((_state$errored2 = state.errored) !== null && _state$errored2 !== void 0 \? _state$errored2 : new ERR_STREAM_DESTROYED(\"end\"));\n }\n resetBuffer(state);\n }\n function clearBuffer(stream, state) {\n if (state.corked || state.bufferProcessing || state.destroyed || !state.constructed)\n return;\n const { buffered, bufferedIndex, objectMode } = state, bufferedLength = buffered.length - bufferedIndex;\n if (!bufferedLength)\n return;\n let i = bufferedIndex;\n if (state.bufferProcessing = !0, bufferedLength > 1 && stream._writev) {\n state.pendingcb -= bufferedLength - 1;\n const callback = state.allNoop \? nop : (err) => {\n for (let n = i;n < buffered.length; ++n)\n buffered[n].callback(err);\n }, chunks = state.allNoop && i === 0 \? buffered : ArrayPrototypeSlice(buffered, i);\n chunks.allBuffers = state.allBuffers, doWrite(stream, state, !0, state.length, chunks, \"\", callback), resetBuffer(state);\n } else {\n do {\n const { chunk, encoding, callback } = buffered[i];\n buffered[i++] = null;\n const len = objectMode \? 1 : chunk.length;\n doWrite(stream, state, !1, len, chunk, encoding, callback);\n } while (i < buffered.length && !state.writing);\n if (i === buffered.length)\n resetBuffer(state);\n else if (i > 256)\n buffered.splice(0, i), state.bufferedIndex = 0;\n else\n state.bufferedIndex = i;\n }\n state.bufferProcessing = !1;\n }\n Writable.prototype._write = function(chunk, encoding, cb) {\n if (this._writev)\n this._writev([\n {\n chunk,\n encoding\n }\n ], cb);\n else\n throw new ERR_METHOD_NOT_IMPLEMENTED(\"_write()\");\n }, Writable.prototype._writev = null, Writable.prototype.end = function(chunk, encoding, cb, native = !1) {\n const state = this._writableState;\n if (typeof chunk === \"function\")\n cb = chunk, chunk = null, encoding = null;\n else if (typeof encoding === \"function\")\n cb = encoding, encoding = null;\n let err;\n if (chunk !== null && chunk !== void 0) {\n let ret;\n if (!native)\n ret = _write(this, chunk, encoding);\n else\n ret = this.write(chunk, encoding);\n if (ret instanceof Error2)\n err = ret;\n }\n if (state.corked)\n state.corked = 1, this.uncork();\n if (err)\n this.emit(\"error\", err);\n else if (!state.errored && !state.ending)\n state.ending = !0, finishMaybe(this, state, !0), state.ended = !0;\n else if (state.finished)\n err = new ERR_STREAM_ALREADY_FINISHED(\"end\");\n else if (state.destroyed)\n err = new ERR_STREAM_DESTROYED(\"end\");\n if (typeof cb === \"function\")\n if (err || state.finished)\n runOnNextTick(cb, err);\n else\n state[kOnFinished].push(cb);\n return this;\n };\n function needFinish(state, tag) {\n var needFinish2 = state.ending && !state.destroyed && state.constructed && state.length === 0 && !state.errored && state.buffered.length === 0 && !state.finished && !state.writing && !state.errorEmitted && !state.closeEmitted;\n return needFinish2;\n }\n function callFinal(stream, state) {\n let called = !1;\n function onFinish(err) {\n if (called) {\n errorOrDestroy2(stream, err !== null && err !== void 0 \? err : ERR_MULTIPLE_CALLBACK());\n return;\n }\n if (called = !0, state.pendingcb--, err) {\n const onfinishCallbacks = state[kOnFinished].splice(0);\n for (let i = 0;i < onfinishCallbacks.length; i++)\n onfinishCallbacks[i](err);\n errorOrDestroy2(stream, err, state.sync);\n } else if (needFinish(state))\n state.prefinished = !0, stream.emit(\"prefinish\"), state.pendingcb++, runOnNextTick(finish, stream, state);\n }\n state.sync = !0, state.pendingcb++;\n try {\n stream._final(onFinish);\n } catch (err) {\n onFinish(err);\n }\n state.sync = !1;\n }\n function prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled)\n if (typeof stream._final === \"function\" && !state.destroyed)\n state.finalCalled = !0, callFinal(stream, state);\n else\n state.prefinished = !0, stream.emit(\"prefinish\");\n }\n function finishMaybe(stream, state, sync) {\n if (!needFinish(state, stream.__id))\n return;\n if (prefinish(stream, state), state.pendingcb === 0) {\n if (sync)\n state.pendingcb++, runOnNextTick((stream2, state2) => {\n if (needFinish(state2))\n finish(stream2, state2);\n else\n state2.pendingcb--;\n }, stream, state);\n else if (needFinish(state))\n state.pendingcb++, finish(stream, state);\n }\n }\n function finish(stream, state) {\n state.pendingcb--, state.finished = !0;\n const onfinishCallbacks = state[kOnFinished].splice(0);\n for (let i = 0;i < onfinishCallbacks.length; i++)\n onfinishCallbacks[i]();\n if (stream.emit(\"finish\"), state.autoDestroy) {\n const rState = stream._readableState;\n if (!rState || rState.autoDestroy && (rState.endEmitted || rState.readable === !1))\n stream.destroy();\n }\n }\n ObjectDefineProperties(Writable.prototype, {\n closed: {\n get() {\n return this._writableState \? this._writableState.closed : !1;\n }\n },\n destroyed: {\n get() {\n return this._writableState \? this._writableState.destroyed : !1;\n },\n set(value) {\n if (this._writableState)\n this._writableState.destroyed = value;\n }\n },\n writable: {\n get() {\n const w = this._writableState;\n return !!w && w.writable !== !1 && !w.destroyed && !w.errored && !w.ending && !w.ended;\n },\n set(val) {\n if (this._writableState)\n this._writableState.writable = !!val;\n }\n },\n writableFinished: {\n get() {\n return this._writableState \? this._writableState.finished : !1;\n }\n },\n writableObjectMode: {\n get() {\n return this._writableState \? this._writableState.objectMode : !1;\n }\n },\n writableBuffer: {\n get() {\n return this._writableState && this._writableState.getBuffer();\n }\n },\n writableEnded: {\n get() {\n return this._writableState \? this._writableState.ending : !1;\n }\n },\n writableNeedDrain: {\n get() {\n const wState = this._writableState;\n if (!wState)\n return !1;\n return !wState.destroyed && !wState.ending && wState.needDrain;\n }\n },\n writableHighWaterMark: {\n get() {\n return this._writableState && this._writableState.highWaterMark;\n }\n },\n writableCorked: {\n get() {\n return this._writableState \? this._writableState.corked : 0;\n }\n },\n writableLength: {\n get() {\n return this._writableState && this._writableState.length;\n }\n },\n errored: {\n enumerable: !1,\n get() {\n return this._writableState \? this._writableState.errored : null;\n }\n },\n writableAborted: {\n enumerable: !1,\n get: function() {\n return !!(this._writableState.writable !== !1 && (this._writableState.destroyed || this._writableState.errored) && !this._writableState.finished);\n }\n }\n });\n var destroy2 = destroyImpl.destroy;\n Writable.prototype.destroy = function(err, cb) {\n const state = this._writableState;\n if (!state.destroyed && (state.bufferedIndex < state.buffered.length || state[kOnFinished].length))\n runOnNextTick(errorBuffer, state);\n return destroy2.@call(this, err, cb), this;\n }, Writable.prototype._undestroy = destroyImpl.undestroy, Writable.prototype._destroy = function(err, cb) {\n cb(err);\n }, Writable.prototype[EE.captureRejectionSymbol] = function(err) {\n this.destroy(err);\n };\n var webStreamsAdapters;\n function lazyWebStreams() {\n if (webStreamsAdapters === void 0)\n webStreamsAdapters = {};\n return webStreamsAdapters;\n }\n Writable.fromWeb = function(writableStream, options) {\n return lazyWebStreams().newStreamWritableFromWritableStream(writableStream, options);\n }, Writable.toWeb = function(streamWritable) {\n return lazyWebStreams().newWritableStreamFromStreamWritable(streamWritable);\n };\n }\n}), require_duplexify = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/duplexify.js\"(exports, module) {\n var {\n isReadable,\n isWritable,\n isIterable,\n isNodeStream,\n isReadableNodeStream,\n isWritableNodeStream,\n isDuplexNodeStream\n } = require_utils(), eos = require_end_of_stream(), {\n AbortError: AbortError2,\n codes: { ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE2, ERR_INVALID_RETURN_VALUE }\n } = require_errors(), { destroyer } = require_destroy(), Duplex = require_duplex(), Readable = require_readable(), { createDeferredPromise } = require_util(), from = require_from(), isBlob = typeof Blob !== \"undefined\" \? function isBlob2(b) {\n return b instanceof Blob;\n } : function isBlob2(b) {\n return !1;\n }, { FunctionPrototypeCall } = require_primordials();\n\n class Duplexify extends Duplex {\n constructor(options) {\n super(options);\n if ((options === null || options === @undefined \? @undefined : options.readable) === !1)\n this._readableState.readable = !1, this._readableState.ended = !0, this._readableState.endEmitted = !0;\n if ((options === null || options === @undefined \? @undefined : options.writable) === !1)\n this._writableState.writable = !1, this._writableState.ending = !0, this._writableState.ended = !0, this._writableState.finished = !0;\n }\n }\n module.exports = function duplexify(body, name) {\n if (isDuplexNodeStream(body))\n return body;\n if (isReadableNodeStream(body))\n return _duplexify({\n readable: body\n });\n if (isWritableNodeStream(body))\n return _duplexify({\n writable: body\n });\n if (isNodeStream(body))\n return _duplexify({\n writable: !1,\n readable: !1\n });\n if (typeof body === \"function\") {\n const { value, write, final, destroy: destroy2 } = fromAsyncGen(body);\n if (isIterable(value))\n return from(Duplexify, value, {\n objectMode: !0,\n write,\n final,\n destroy: destroy2\n });\n const then2 = value === null || value === void 0 \? void 0 : value.then;\n if (typeof then2 === \"function\") {\n let d;\n const promise = FunctionPrototypeCall(then2, value, (val) => {\n if (val != null)\n throw new ERR_INVALID_RETURN_VALUE(\"nully\", \"body\", val);\n }, (err) => {\n destroyer(d, err);\n });\n return d = new Duplexify({\n objectMode: !0,\n readable: !1,\n write,\n final(cb) {\n final(async () => {\n try {\n await promise, runOnNextTick(cb, null);\n } catch (err) {\n runOnNextTick(cb, err);\n }\n });\n },\n destroy: destroy2\n });\n }\n throw new ERR_INVALID_RETURN_VALUE(\"Iterable, AsyncIterable or AsyncFunction\", name, value);\n }\n if (isBlob(body))\n return duplexify(body.arrayBuffer());\n if (isIterable(body))\n return from(Duplexify, body, {\n objectMode: !0,\n writable: !1\n });\n if (typeof (body === null || body === void 0 \? void 0 : body.writable) === \"object\" || typeof (body === null || body === void 0 \? void 0 : body.readable) === \"object\") {\n const readable = body !== null && body !== void 0 && body.readable \? isReadableNodeStream(body === null || body === void 0 \? void 0 : body.readable) \? body === null || body === void 0 \? void 0 : body.readable : duplexify(body.readable) : void 0, writable = body !== null && body !== void 0 && body.writable \? isWritableNodeStream(body === null || body === void 0 \? void 0 : body.writable) \? body === null || body === void 0 \? void 0 : body.writable : duplexify(body.writable) : void 0;\n return _duplexify({\n readable,\n writable\n });\n }\n const then = body === null || body === void 0 \? void 0 : body.then;\n if (typeof then === \"function\") {\n let d;\n return FunctionPrototypeCall(then, body, (val) => {\n if (val != null)\n d.push(val);\n d.push(null);\n }, (err) => {\n destroyer(d, err);\n }), d = new Duplexify({\n objectMode: !0,\n writable: !1,\n read() {\n }\n });\n }\n throw new ERR_INVALID_ARG_TYPE2(name, [\n \"Blob\",\n \"ReadableStream\",\n \"WritableStream\",\n \"Stream\",\n \"Iterable\",\n \"AsyncIterable\",\n \"Function\",\n \"{ readable, writable } pair\",\n \"Promise\"\n ], body);\n };\n function fromAsyncGen(fn) {\n let { promise, resolve } = createDeferredPromise();\n const ac = new AbortController, signal = ac.signal;\n return {\n value: fn(async function* () {\n while (!0) {\n const _promise = promise;\n promise = null;\n const { chunk, done, cb } = await _promise;\n if (runOnNextTick(cb), done)\n return;\n if (signal.aborted)\n throw new AbortError2(void 0, {\n cause: signal.reason\n });\n ({ promise, resolve } = createDeferredPromise()), yield chunk;\n }\n }(), {\n signal\n }),\n write(chunk, encoding, cb) {\n const _resolve = resolve;\n resolve = null, _resolve({\n chunk,\n done: !1,\n cb\n });\n },\n final(cb) {\n const _resolve = resolve;\n resolve = null, _resolve({\n done: !0,\n cb\n });\n },\n destroy(err, cb) {\n ac.abort(), cb(err);\n }\n };\n }\n function _duplexify(pair) {\n const r = pair.readable && typeof pair.readable.read !== \"function\" \? Readable.wrap(pair.readable) : pair.readable, w = pair.writable;\n let readable = !!isReadable(r), writable = !!isWritable(w), ondrain, onfinish, onreadable, onclose, d;\n function onfinished(err) {\n const cb = onclose;\n if (onclose = null, cb)\n cb(err);\n else if (err)\n d.destroy(err);\n else if (!readable && !writable)\n d.destroy();\n }\n if (d = new Duplexify({\n readableObjectMode: !!(r !== null && r !== void 0 && r.readableObjectMode),\n writableObjectMode: !!(w !== null && w !== void 0 && w.writableObjectMode),\n readable,\n writable\n }), writable)\n eos(w, (err) => {\n if (writable = !1, err)\n destroyer(r, err);\n onfinished(err);\n }), d._write = function(chunk, encoding, callback) {\n if (w.write(chunk, encoding))\n callback();\n else\n ondrain = callback;\n }, d._final = function(callback) {\n w.end(), onfinish = callback;\n }, w.on(\"drain\", function() {\n if (ondrain) {\n const cb = ondrain;\n ondrain = null, cb();\n }\n }), w.on(\"finish\", function() {\n if (onfinish) {\n const cb = onfinish;\n onfinish = null, cb();\n }\n });\n if (readable)\n eos(r, (err) => {\n if (readable = !1, err)\n destroyer(r, err);\n onfinished(err);\n }), r.on(\"readable\", function() {\n if (onreadable) {\n const cb = onreadable;\n onreadable = null, cb();\n }\n }), r.on(\"end\", function() {\n d.push(null);\n }), d._read = function() {\n while (!0) {\n const buf = r.read();\n if (buf === null) {\n onreadable = d._read;\n return;\n }\n if (!d.push(buf))\n return;\n }\n };\n return d._destroy = function(err, callback) {\n if (!err && onclose !== null)\n err = new AbortError2;\n if (onreadable = null, ondrain = null, onfinish = null, onclose === null)\n callback(err);\n else\n onclose = callback, destroyer(w, err), destroyer(r, err);\n }, d;\n }\n }\n}), require_duplex = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/duplex.js\"(exports, module) {\n var { ObjectDefineProperties, ObjectGetOwnPropertyDescriptor, ObjectKeys, ObjectSetPrototypeOf } = require_primordials(), Readable = require_readable();\n function Duplex(options) {\n if (!(this instanceof Duplex))\n return new Duplex(options);\n if (Readable.@call(this, options), Writable.@call(this, options), options) {\n if (this.allowHalfOpen = options.allowHalfOpen !== !1, options.readable === !1)\n this._readableState.readable = !1, this._readableState.ended = !0, this._readableState.endEmitted = !0;\n if (options.writable === !1)\n this._writableState.writable = !1, this._writableState.ending = !0, this._writableState.ended = !0, this._writableState.finished = !0;\n } else\n this.allowHalfOpen = !0;\n }\n Duplex.prototype = {}, module.exports = Duplex, ObjectSetPrototypeOf(Duplex.prototype, Readable.prototype), ObjectSetPrototypeOf(Duplex, Readable);\n for (var method in Writable.prototype)\n if (!Duplex.prototype[method])\n Duplex.prototype[method] = Writable.prototype[method];\n ObjectDefineProperties(Duplex.prototype, {\n writable: ObjectGetOwnPropertyDescriptor(Writable.prototype, \"writable\"),\n writableHighWaterMark: ObjectGetOwnPropertyDescriptor(Writable.prototype, \"writableHighWaterMark\"),\n writableObjectMode: ObjectGetOwnPropertyDescriptor(Writable.prototype, \"writableObjectMode\"),\n writableBuffer: ObjectGetOwnPropertyDescriptor(Writable.prototype, \"writableBuffer\"),\n writableLength: ObjectGetOwnPropertyDescriptor(Writable.prototype, \"writableLength\"),\n writableFinished: ObjectGetOwnPropertyDescriptor(Writable.prototype, \"writableFinished\"),\n writableCorked: ObjectGetOwnPropertyDescriptor(Writable.prototype, \"writableCorked\"),\n writableEnded: ObjectGetOwnPropertyDescriptor(Writable.prototype, \"writableEnded\"),\n writableNeedDrain: ObjectGetOwnPropertyDescriptor(Writable.prototype, \"writableNeedDrain\"),\n destroyed: {\n get() {\n if (this._readableState === void 0 || this._writableState === void 0)\n return !1;\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set(value) {\n if (this._readableState && this._writableState)\n this._readableState.destroyed = value, this._writableState.destroyed = value;\n }\n }\n });\n var webStreamsAdapters;\n function lazyWebStreams() {\n if (webStreamsAdapters === void 0)\n webStreamsAdapters = {};\n return webStreamsAdapters;\n }\n Duplex.fromWeb = function(pair, options) {\n return lazyWebStreams().newStreamDuplexFromReadableWritablePair(pair, options);\n }, Duplex.toWeb = function(duplex) {\n return lazyWebStreams().newReadableWritablePairFromDuplex(duplex);\n };\n var duplexify;\n Duplex.from = function(body) {\n if (!duplexify)\n duplexify = require_duplexify();\n return duplexify(body, \"body\");\n };\n }\n}), require_transform = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/transform.js\"(exports, module) {\n var { ObjectSetPrototypeOf, Symbol: Symbol2 } = require_primordials(), { ERR_METHOD_NOT_IMPLEMENTED } = require_errors().codes, Duplex = require_duplex();\n function Transform(options) {\n if (!(this instanceof Transform))\n return new Transform(options);\n if (Duplex.@call(this, options), this._readableState.sync = !1, this[kCallback] = null, options) {\n if (typeof options.transform === \"function\")\n this._transform = options.transform;\n if (typeof options.flush === \"function\")\n this._flush = options.flush;\n }\n this.on(\"prefinish\", prefinish.bind(this));\n }\n Transform.prototype = {}, ObjectSetPrototypeOf(Transform.prototype, Duplex.prototype), ObjectSetPrototypeOf(Transform, Duplex), module.exports = Transform;\n var kCallback = Symbol2(\"kCallback\");\n function final(cb) {\n if (typeof this._flush === \"function\" && !this.destroyed)\n this._flush((er, data) => {\n if (er) {\n if (cb)\n cb(er);\n else\n this.destroy(er);\n return;\n }\n if (data != null)\n this.push(data);\n if (this.push(null), cb)\n cb();\n });\n else if (this.push(null), cb)\n cb();\n }\n function prefinish() {\n if (this._final !== final)\n final.@call(this);\n }\n Transform.prototype._final = final, Transform.prototype._transform = function(chunk, encoding, callback) {\n throw new ERR_METHOD_NOT_IMPLEMENTED(\"_transform()\");\n }, Transform.prototype._write = function(chunk, encoding, callback) {\n const rState = this._readableState, wState = this._writableState, length = rState.length;\n this._transform(chunk, encoding, (err, val) => {\n if (err) {\n callback(err);\n return;\n }\n if (val != null)\n this.push(val);\n if (wState.ended || length === rState.length || rState.length < rState.highWaterMark || rState.highWaterMark === 0 || rState.length === 0)\n callback();\n else\n this[kCallback] = callback;\n });\n }, Transform.prototype._read = function() {\n if (this[kCallback]) {\n const callback = this[kCallback];\n this[kCallback] = null, callback();\n }\n };\n }\n}), require_passthrough = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/passthrough.js\"(exports, module) {\n var { ObjectSetPrototypeOf } = require_primordials(), Transform = require_transform();\n function PassThrough(options) {\n if (!(this instanceof PassThrough))\n return new PassThrough(options);\n Transform.@call(this, options);\n }\n PassThrough.prototype = {}, ObjectSetPrototypeOf(PassThrough.prototype, Transform.prototype), ObjectSetPrototypeOf(PassThrough, Transform), PassThrough.prototype._transform = function(chunk, encoding, cb) {\n cb(null, chunk);\n }, module.exports = PassThrough;\n }\n}), require_pipeline = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/pipeline.js\"(exports, module) {\n var { ArrayIsArray: ArrayIsArray2, Promise: Promise2, SymbolAsyncIterator } = require_primordials(), eos = require_end_of_stream(), { once } = require_util(), destroyImpl = require_destroy(), Duplex = require_duplex(), {\n aggregateTwoErrors,\n codes: { ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE2, ERR_INVALID_RETURN_VALUE, ERR_MISSING_ARGS, ERR_STREAM_DESTROYED },\n AbortError: AbortError2\n } = require_errors(), { validateFunction, validateAbortSignal } = require_validators(), { isIterable, isReadable, isReadableNodeStream, isNodeStream } = require_utils(), PassThrough, Readable;\n function destroyer(stream, reading, writing) {\n let finished = !1;\n stream.on(\"close\", () => {\n finished = !0;\n });\n const cleanup = eos(stream, {\n readable: reading,\n writable: writing\n }, (err) => {\n finished = !err;\n });\n return {\n destroy: (err) => {\n if (finished)\n return;\n finished = !0, destroyImpl.destroyer(stream, err || new ERR_STREAM_DESTROYED(\"pipe\"));\n },\n cleanup\n };\n }\n function popCallback(streams) {\n return validateFunction(streams[streams.length - 1], \"streams[stream.length - 1]\"), streams.pop();\n }\n function makeAsyncIterable(val) {\n if (isIterable(val))\n return val;\n else if (isReadableNodeStream(val))\n return fromReadable(val);\n throw new ERR_INVALID_ARG_TYPE2(\"val\", [\"Readable\", \"Iterable\", \"AsyncIterable\"], val);\n }\n async function* fromReadable(val) {\n if (!Readable)\n Readable = require_readable();\n yield* Readable.prototype[SymbolAsyncIterator].@call(val);\n }\n async function pump(iterable, writable, finish, { end }) {\n let error, onresolve = null;\n const resume = (err) => {\n if (err)\n error = err;\n if (onresolve) {\n const callback = onresolve;\n onresolve = null, callback();\n }\n }, wait = () => new Promise2((resolve, reject) => {\n if (error)\n reject(error);\n else\n onresolve = () => {\n if (error)\n reject(error);\n else\n resolve();\n };\n });\n writable.on(\"drain\", resume);\n const cleanup = eos(writable, {\n readable: !1\n }, resume);\n try {\n if (writable.writableNeedDrain)\n await wait();\n for await (let chunk of iterable)\n if (!writable.write(chunk))\n await wait();\n if (end)\n writable.end();\n await wait(), finish();\n } catch (err) {\n finish(error !== err \? aggregateTwoErrors(error, err) : err);\n } finally {\n cleanup(), writable.off(\"drain\", resume);\n }\n }\n function pipeline(...streams) {\n return pipelineImpl(streams, once(popCallback(streams)));\n }\n function pipelineImpl(streams, callback, opts) {\n if (streams.length === 1 && ArrayIsArray2(streams[0]))\n streams = streams[0];\n if (streams.length < 2)\n throw new ERR_MISSING_ARGS(\"streams\");\n const ac = new AbortController, signal = ac.signal, outerSignal = opts === null || opts === void 0 \? void 0 : opts.signal, lastStreamCleanup = [];\n validateAbortSignal(outerSignal, \"options.signal\");\n function abort() {\n finishImpl(new AbortError2);\n }\n outerSignal === null || outerSignal === void 0 || outerSignal.addEventListener(\"abort\", abort);\n let error, value;\n const destroys = [];\n let finishCount = 0;\n function finish(err) {\n finishImpl(err, --finishCount === 0);\n }\n function finishImpl(err, final) {\n if (err && (!error || error.code === \"ERR_STREAM_PREMATURE_CLOSE\"))\n error = err;\n if (!error && !final)\n return;\n while (destroys.length)\n destroys.shift()(error);\n if (outerSignal === null || outerSignal === void 0 || outerSignal.removeEventListener(\"abort\", abort), ac.abort(), final) {\n if (!error)\n lastStreamCleanup.forEach((fn) => fn());\n runOnNextTick(callback, error, value);\n }\n }\n let ret;\n for (let i = 0;i < streams.length; i++) {\n const stream = streams[i], reading = i < streams.length - 1, writing = i > 0, end = reading || (opts === null || opts === void 0 \? void 0 : opts.end) !== !1, isLastStream = i === streams.length - 1;\n if (isNodeStream(stream)) {\n let onError = function(err) {\n if (err && err.name !== \"AbortError\" && err.code !== \"ERR_STREAM_PREMATURE_CLOSE\")\n finish(err);\n };\n if (end) {\n const { destroy: destroy2, cleanup } = destroyer(stream, reading, writing);\n if (destroys.push(destroy2), isReadable(stream) && isLastStream)\n lastStreamCleanup.push(cleanup);\n }\n if (stream.on(\"error\", onError), isReadable(stream) && isLastStream)\n lastStreamCleanup.push(() => {\n stream.removeListener(\"error\", onError);\n });\n }\n if (i === 0)\n if (typeof stream === \"function\") {\n if (ret = stream({\n signal\n }), !isIterable(ret))\n throw new ERR_INVALID_RETURN_VALUE(\"Iterable, AsyncIterable or Stream\", \"source\", ret);\n } else if (isIterable(stream) || isReadableNodeStream(stream))\n ret = stream;\n else\n ret = Duplex.from(stream);\n else if (typeof stream === \"function\")\n if (ret = makeAsyncIterable(ret), ret = stream(ret, {\n signal\n }), reading) {\n if (!isIterable(ret, !0))\n throw new ERR_INVALID_RETURN_VALUE(\"AsyncIterable\", `transform[${i - 1}]`, ret);\n } else {\n var _ret;\n if (!PassThrough)\n PassThrough = require_passthrough();\n const pt = new PassThrough({\n objectMode: !0\n }), then = (_ret = ret) === null || _ret === void 0 \? void 0 : _ret.then;\n if (typeof then === \"function\")\n finishCount++, then.@call(ret, (val) => {\n if (value = val, val != null)\n pt.write(val);\n if (end)\n pt.end();\n runOnNextTick(finish);\n }, (err) => {\n pt.destroy(err), runOnNextTick(finish, err);\n });\n else if (isIterable(ret, !0))\n finishCount++, pump(ret, pt, finish, {\n end\n });\n else\n throw new ERR_INVALID_RETURN_VALUE(\"AsyncIterable or Promise\", \"destination\", ret);\n ret = pt;\n const { destroy: destroy2, cleanup } = destroyer(ret, !1, !0);\n if (destroys.push(destroy2), isLastStream)\n lastStreamCleanup.push(cleanup);\n }\n else if (isNodeStream(stream)) {\n if (isReadableNodeStream(ret)) {\n finishCount += 2;\n const cleanup = pipe(ret, stream, finish, {\n end\n });\n if (isReadable(stream) && isLastStream)\n lastStreamCleanup.push(cleanup);\n } else if (isIterable(ret))\n finishCount++, pump(ret, stream, finish, {\n end\n });\n else\n throw new ERR_INVALID_ARG_TYPE2(\"val\", [\"Readable\", \"Iterable\", \"AsyncIterable\"], ret);\n ret = stream;\n } else\n ret = Duplex.from(stream);\n }\n if (signal !== null && signal !== void 0 && signal.aborted || outerSignal !== null && outerSignal !== void 0 && outerSignal.aborted)\n runOnNextTick(abort);\n return ret;\n }\n function pipe(src, dst, finish, { end }) {\n if (src.pipe(dst, {\n end\n }), end)\n src.once(\"end\", () => dst.end());\n else\n finish();\n return eos(src, {\n readable: !0,\n writable: !1\n }, (err) => {\n const rState = src._readableState;\n if (err && err.code === \"ERR_STREAM_PREMATURE_CLOSE\" && rState && rState.ended && !rState.errored && !rState.errorEmitted)\n src.once(\"end\", finish).once(\"error\", finish);\n else\n finish(err);\n }), eos(dst, {\n readable: !1,\n writable: !0\n }, finish);\n }\n module.exports = {\n pipelineImpl,\n pipeline\n };\n }\n}), require_compose = __commonJS({\n \"node_modules/readable-stream/lib/internal/streams/compose.js\"(exports, module) {\n var { pipeline } = require_pipeline(), Duplex = require_duplex(), { destroyer } = require_destroy(), { isNodeStream, isReadable, isWritable } = require_utils(), {\n AbortError: AbortError2,\n codes: { ERR_INVALID_ARG_VALUE: ERR_INVALID_ARG_VALUE2, ERR_MISSING_ARGS }\n } = require_errors();\n module.exports = function compose(...streams) {\n if (streams.length === 0)\n throw new ERR_MISSING_ARGS(\"streams\");\n if (streams.length === 1)\n return Duplex.from(streams[0]);\n const orgStreams = [...streams];\n if (typeof streams[0] === \"function\")\n streams[0] = Duplex.from(streams[0]);\n if (typeof streams[streams.length - 1] === \"function\") {\n const idx = streams.length - 1;\n streams[idx] = Duplex.from(streams[idx]);\n }\n for (let n = 0;n < streams.length; ++n) {\n if (!isNodeStream(streams[n]))\n continue;\n if (n < streams.length - 1 && !isReadable(streams[n]))\n throw new ERR_INVALID_ARG_VALUE2(`streams[${n}]`, orgStreams[n], \"must be readable\");\n if (n > 0 && !isWritable(streams[n]))\n throw new ERR_INVALID_ARG_VALUE2(`streams[${n}]`, orgStreams[n], \"must be writable\");\n }\n let ondrain, onfinish, onreadable, onclose, d;\n function onfinished(err) {\n const cb = onclose;\n if (onclose = null, cb)\n cb(err);\n else if (err)\n d.destroy(err);\n else if (!readable && !writable)\n d.destroy();\n }\n const head = streams[0], tail = pipeline(streams, onfinished), writable = !!isWritable(head), readable = !!isReadable(tail);\n if (d = new Duplex({\n writableObjectMode: !!(head !== null && head !== void 0 && head.writableObjectMode),\n readableObjectMode: !!(tail !== null && tail !== void 0 && tail.writableObjectMode),\n writable,\n readable\n }), writable)\n d._write = function(chunk, encoding, callback) {\n if (head.write(chunk, encoding))\n callback();\n else\n ondrain = callback;\n }, d._final = function(callback) {\n head.end(), onfinish = callback;\n }, head.on(\"drain\", function() {\n if (ondrain) {\n const cb = ondrain;\n ondrain = null, cb();\n }\n }), tail.on(\"finish\", function() {\n if (onfinish) {\n const cb = onfinish;\n onfinish = null, cb();\n }\n });\n if (readable)\n tail.on(\"readable\", function() {\n if (onreadable) {\n const cb = onreadable;\n onreadable = null, cb();\n }\n }), tail.on(\"end\", function() {\n d.push(null);\n }), d._read = function() {\n while (!0) {\n const buf = tail.read();\n if (buf === null) {\n onreadable = d._read;\n return;\n }\n if (!d.push(buf))\n return;\n }\n };\n return d._destroy = function(err, callback) {\n if (!err && onclose !== null)\n err = new AbortError2;\n if (onreadable = null, ondrain = null, onfinish = null, onclose === null)\n callback(err);\n else\n onclose = callback, destroyer(tail, err);\n }, d;\n };\n }\n}), require_promises = __commonJS({\n \"node_modules/readable-stream/lib/stream/promises.js\"(exports, module) {\n var { ArrayPrototypePop, Promise: Promise2 } = require_primordials(), { isIterable, isNodeStream } = require_utils(), { pipelineImpl: pl } = require_pipeline(), { finished } = require_end_of_stream();\n function pipeline(...streams) {\n return new Promise2((resolve, reject) => {\n let signal, end;\n const lastArg = streams[streams.length - 1];\n if (lastArg && typeof lastArg === \"object\" && !isNodeStream(lastArg) && !isIterable(lastArg)) {\n const options = ArrayPrototypePop(streams);\n signal = options.signal, end = options.end;\n }\n pl(streams, (err, value) => {\n if (err)\n reject(err);\n else\n resolve(value);\n }, {\n signal,\n end\n });\n });\n }\n module.exports = {\n finished,\n pipeline\n };\n }\n}), require_stream = __commonJS({\n \"node_modules/readable-stream/lib/stream.js\"(exports, module) {\n var { ObjectDefineProperty, ObjectKeys, ReflectApply } = require_primordials(), {\n promisify: { custom: customPromisify }\n } = require_util(), { streamReturningOperators, promiseReturningOperators } = require_operators(), {\n codes: { ERR_ILLEGAL_CONSTRUCTOR }\n } = require_errors(), compose = require_compose(), { pipeline } = require_pipeline(), { destroyer } = require_destroy(), eos = require_end_of_stream(), promises = require_promises(), utils = require_utils(), Stream = module.exports = require_legacy().Stream;\n Stream.isDisturbed = utils.isDisturbed, Stream.isErrored = utils.isErrored, Stream.isWritable = utils.isWritable, Stream.isReadable = utils.isReadable, Stream.Readable = require_readable();\n for (let key of ObjectKeys(streamReturningOperators)) {\n let fn = function(...args) {\n if (new.target)\n throw ERR_ILLEGAL_CONSTRUCTOR();\n return Stream.Readable.from(ReflectApply(op, this, args));\n };\n const op = streamReturningOperators[key];\n ObjectDefineProperty(fn, \"name\", {\n value: op.name\n }), ObjectDefineProperty(fn, \"length\", {\n value: op.length\n }), ObjectDefineProperty(Stream.Readable.prototype, key, {\n value: fn,\n enumerable: !1,\n configurable: !0,\n writable: !0\n });\n }\n for (let key of ObjectKeys(promiseReturningOperators)) {\n let fn = function(...args) {\n if (new.target)\n throw ERR_ILLEGAL_CONSTRUCTOR();\n return ReflectApply(op, this, args);\n };\n const op = promiseReturningOperators[key];\n ObjectDefineProperty(fn, \"name\", {\n value: op.name\n }), ObjectDefineProperty(fn, \"length\", {\n value: op.length\n }), ObjectDefineProperty(Stream.Readable.prototype, key, {\n value: fn,\n enumerable: !1,\n configurable: !0,\n writable: !0\n });\n }\n Stream.Writable = require_writable(), Stream.Duplex = require_duplex(), Stream.Transform = require_transform(), Stream.PassThrough = require_passthrough(), Stream.pipeline = pipeline;\n var { addAbortSignal } = require_add_abort_signal();\n Stream.addAbortSignal = addAbortSignal, Stream.finished = eos, Stream.destroy = destroyer, Stream.compose = compose, ObjectDefineProperty(Stream, \"promises\", {\n configurable: !0,\n enumerable: !0,\n get() {\n return promises;\n }\n }), ObjectDefineProperty(pipeline, customPromisify, {\n enumerable: !0,\n get() {\n return promises.pipeline;\n }\n }), ObjectDefineProperty(eos, customPromisify, {\n enumerable: !0,\n get() {\n return promises.finished;\n }\n }), Stream.Stream = Stream, Stream._isUint8Array = function isUint8Array(value) {\n return value instanceof @Uint8Array;\n }, Stream._uint8ArrayToBuffer = function _uint8ArrayToBuffer(chunk) {\n return new @Buffer(chunk.buffer, chunk.byteOffset, chunk.byteLength);\n };\n }\n}), nativeReadableStreamPrototypes = {\n 0: @undefined,\n 1: @undefined,\n 2: @undefined,\n 3: @undefined,\n 4: @undefined,\n 5: @undefined\n}, Writable = require_writable(), _pathOrFdOrSink = Symbol(\"pathOrFdOrSink\"), _fileSink = Symbol(\"fileSink\"), _native = Symbol(\"native\");\nNativeWritable.prototype = Object.create(Writable.prototype);\nvar WritablePrototypeWrite = Writable.prototype.write;\nNativeWritable.prototype.write = function NativeWritablePrototypeWrite(chunk, encoding, cb, native) {\n if (!(native \?\? this[_native]))\n return this[_native] = !1, WritablePrototypeWrite.@call(this, chunk, encoding, cb);\n var fileSink = this[_fileSink] \?\? NativeWritable_lazyConstruct(this), result = fileSink.write(chunk);\n if (@isPromise(result))\n return result.then(() => {\n this.emit(\"drain\"), fileSink.flush(!0);\n }), !1;\n if (fileSink.flush(!0), typeof encoding === \"function\")\n cb = encoding;\n if (cb)\n cb(null, chunk.byteLength);\n return !0;\n};\nvar WritablePrototypeEnd = Writable.prototype.end;\nNativeWritable.prototype.end = function end(chunk, encoding, cb, native) {\n return WritablePrototypeEnd.@call(this, chunk, encoding, cb, native \?\? this[_native]);\n};\nNativeWritable.prototype.ref = function ref() {\n var sink = this[_fileSink];\n if (!sink)\n this.NativeWritable_lazyConstruct();\n sink.ref();\n};\nNativeWritable.prototype.unref = function unref() {\n this[_fileSink]\?.unref();\n};\nvar exports = require_stream(), promises = require_promises();\nexports._getNativeReadableStreamPrototype = getNativeReadableStreamPrototype;\nexports.NativeWritable = NativeWritable;\nObject.defineProperty(exports, \"promises\", {\n configurable: !0,\n enumerable: !0,\n get() {\n return promises;\n }\n});\nexports[Symbol.for(\"::bunternal::\")] = { _ReadableFromWeb, _ReadableFromWebForUndici };\nexports.eos = require_end_of_stream();\nexports.EventEmitter = EE;\nreturn exports})\n"); -// - -// -static constexpr ASCIILiteral NodeStreamPromisesCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/stream.promises.ts\nreturn (@getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39)).promises})\n"); -// - -// -static constexpr ASCIILiteral NodeStreamWebCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/stream.web.ts\nvar $;\n$ = {\n ReadableStream: @ReadableStream,\n ReadableStreamDefaultReader: @ReadableStreamDefaultReader,\n ReadableStreamBYOBReader: @ReadableStreamBYOBReader,\n ReadableStreamBYOBRequest: @ReadableStreamBYOBRequest,\n ReadableByteStreamController: @ReadableByteStreamController,\n ReadableStreamDefaultController: @ReadableStreamDefaultController,\n TransformStream: @TransformStream,\n TransformStreamDefaultController: @TransformStreamDefaultController,\n WritableStream: @WritableStream,\n WritableStreamDefaultWriter: @WritableStreamDefaultWriter,\n WritableStreamDefaultController: @WritableStreamDefaultController,\n ByteLengthQueuingStrategy,\n CountQueuingStrategy,\n TextEncoderStream: @undefined,\n TextDecoderStream: @undefined,\n CompressionStream: @undefined,\n DecompressionStream: @undefined\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeTimersCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/timers.ts\nvar $;\n$ = {\n setTimeout,\n clearTimeout,\n setInterval,\n setImmediate,\n clearInterval,\n clearImmediate\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeTimersPromisesCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/timers.promises.ts\nvar validateObject = function(object, name) {\n if (object === null || typeof object !== \"object\")\n throw new ERR_INVALID_ARG_TYPE(name, \"Object\", object);\n}, validateBoolean = function(value, name) {\n if (typeof value !== \"boolean\")\n throw new ERR_INVALID_ARG_TYPE(name, \"boolean\", value);\n}, validateAbortSignal = function(signal, name) {\n if (typeof signal !== \"undefined\" && (signal === null || typeof signal !== \"object\" || !(\"aborted\" in signal)))\n throw new ERR_INVALID_ARG_TYPE(name, \"AbortSignal\", signal);\n}, asyncIterator = function({ next: nextFunction, return: returnFunction }) {\n const result = {};\n if (typeof nextFunction === \"function\")\n result.next = nextFunction;\n if (typeof returnFunction === \"function\")\n result.return = returnFunction;\n return result[symbolAsyncIterator] = function() {\n return this;\n }, result;\n}, setTimeoutPromise = function(after = 1, value, options = {}) {\n const arguments_ = [].concat(value \?\? []);\n try {\n validateObject(options, \"options\");\n } catch (error) {\n return @Promise.reject(error);\n }\n const { signal, ref: reference = !0 } = options;\n try {\n validateAbortSignal(signal, \"options.signal\");\n } catch (error) {\n return @Promise.reject(error);\n }\n try {\n validateBoolean(reference, \"options.ref\");\n } catch (error) {\n return @Promise.reject(error);\n }\n if (signal\?.aborted)\n return @Promise.reject(new AbortError);\n let onCancel;\n const returnValue = new @Promise((resolve, reject) => {\n const timeout = setTimeout(() => resolve(value), after, ...arguments_);\n if (!reference)\n timeout\?.unref\?.();\n if (signal)\n onCancel = () => {\n clearTimeout(timeout), reject(new AbortError);\n }, signal.addEventListener(\"abort\", onCancel);\n });\n if (typeof onCancel !== \"undefined\")\n returnValue.finally(() => signal.removeEventListener(\"abort\", onCancel));\n return returnValue;\n}, setImmediatePromise = function(value, options = {}) {\n try {\n validateObject(options, \"options\");\n } catch (error) {\n return @Promise.reject(error);\n }\n const { signal, ref: reference = !0 } = options;\n try {\n validateAbortSignal(signal, \"options.signal\");\n } catch (error) {\n return @Promise.reject(error);\n }\n try {\n validateBoolean(reference, \"options.ref\");\n } catch (error) {\n return @Promise.reject(error);\n }\n if (signal\?.aborted)\n return @Promise.reject(new AbortError);\n let onCancel;\n const returnValue = new @Promise((resolve, reject) => {\n const immediate = setImmediate(() => resolve(value));\n if (!reference)\n immediate\?.unref\?.();\n if (signal)\n onCancel = () => {\n clearImmediate(immediate), reject(new AbortError);\n }, signal.addEventListener(\"abort\", onCancel);\n });\n if (typeof onCancel !== \"undefined\")\n returnValue.finally(() => signal.removeEventListener(\"abort\", onCancel));\n return returnValue;\n}, setIntervalPromise = function(after = 1, value, options = {}) {\n try {\n validateObject(options, \"options\");\n } catch (error) {\n return asyncIterator({\n next: function() {\n return @Promise.reject(error);\n }\n });\n }\n const { signal, ref: reference = !0 } = options;\n try {\n validateAbortSignal(signal, \"options.signal\");\n } catch (error) {\n return asyncIterator({\n next: function() {\n return @Promise.reject(error);\n }\n });\n }\n try {\n validateBoolean(reference, \"options.ref\");\n } catch (error) {\n return asyncIterator({\n next: function() {\n return @Promise.reject(error);\n }\n });\n }\n if (signal\?.aborted)\n return asyncIterator({\n next: function() {\n return @Promise.reject(new AbortError);\n }\n });\n let onCancel, interval;\n try {\n let notYielded = 0, callback;\n if (interval = setInterval(() => {\n if (notYielded++, callback)\n callback(), callback = @undefined;\n }, after), !reference)\n interval\?.unref\?.();\n if (signal)\n onCancel = () => {\n if (clearInterval(interval), callback)\n callback(), callback = @undefined;\n }, signal.addEventListener(\"abort\", onCancel);\n return asyncIterator({\n next: function() {\n return new @Promise((resolve, reject) => {\n if (!signal\?.aborted)\n if (notYielded === 0)\n callback = resolve;\n else\n resolve();\n else if (notYielded === 0)\n reject(new AbortError);\n else\n resolve();\n }).then(() => {\n if (notYielded > 0)\n return notYielded = notYielded - 1, { done: !1, value };\n return { done: !0 };\n });\n },\n return: function() {\n return clearInterval(interval), signal\?.removeEventListener(\"abort\", onCancel), @Promise.resolve({});\n }\n });\n } catch (error) {\n return asyncIterator({\n next: function() {\n clearInterval(interval), signal\?.removeEventListener(\"abort\", onCancel);\n }\n });\n }\n}, $, symbolAsyncIterator = Symbol.asyncIterator;\n\nclass ERR_INVALID_ARG_TYPE extends Error {\n constructor(name, expected, actual) {\n super(`${name} must be ${expected}, ${typeof actual} given`);\n this.code = \"ERR_INVALID_ARG_TYPE\";\n }\n}\n\nclass AbortError extends Error {\n constructor() {\n super(\"The operation was aborted\");\n this.code = \"ABORT_ERR\";\n }\n}\n$ = {\n setTimeout: setTimeoutPromise,\n setImmediate: setImmediatePromise,\n setInterval: setIntervalPromise,\n scheduler: {\n wait: (delay, options) => setTimeoutPromise(delay, @undefined, options),\n yield: setImmediatePromise\n }\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeTLSCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/tls.ts\nvar parseCertString = function() {\n throwNotImplemented(\"Not implemented\");\n}, isValidTLSArray = function(obj) {\n if (typeof obj === \"string\" || isTypedArray(obj) || obj instanceof @ArrayBuffer || obj instanceof Blob)\n return !0;\n if (@Array.isArray(obj)) {\n for (var i = 0;i < obj.length; i++)\n if (typeof obj !== \"string\" && !isTypedArray(obj) && !(obj instanceof @ArrayBuffer) && !(obj instanceof Blob))\n return !1;\n return !0;\n }\n}, unfqdn = function(host) {\n return RegExpPrototypeSymbolReplace.@call(/[.]$/, host, \"\");\n}, toLowerCase = function(c) {\n return StringFromCharCode.@call(32 + StringPrototypeCharCodeAt.@call(c, 0));\n}, splitHost = function(host) {\n return StringPrototypeSplit.@call(RegExpPrototypeSymbolReplace.@call(/[A-Z]/g, unfqdn(host), toLowerCase), \".\");\n}, check = function(hostParts, pattern, wildcards) {\n if (!pattern)\n return !1;\n const patternParts = splitHost(pattern);\n if (hostParts.length !== patternParts.length)\n return !1;\n if (ArrayPrototypeIncludes.@call(patternParts, \"\"))\n return !1;\n const isBad = (s) => RegExpPrototypeExec.@call(/[^\\u0021-\\u007F]/u, s) !== null;\n if (ArrayPrototypeSome.@call(patternParts, isBad))\n return !1;\n for (let i = hostParts.length - 1;i > 0; i -= 1)\n if (hostParts[i] !== patternParts[i])\n return !1;\n const hostSubdomain = hostParts[0], patternSubdomain = patternParts[0], patternSubdomainParts = StringPrototypeSplit.@call(patternSubdomain, \"*\");\n if (patternSubdomainParts.length === 1 || StringPrototypeIncludes.@call(patternSubdomain, \"xn--\"))\n return hostSubdomain === patternSubdomain;\n if (!wildcards)\n return !1;\n if (patternSubdomainParts.length > 2)\n return !1;\n if (patternParts.length <= 2)\n return !1;\n const { 0: prefix, 1: suffix } = patternSubdomainParts;\n if (prefix.length + suffix.length > hostSubdomain.length)\n return !1;\n if (!StringPrototypeStartsWith.@call(hostSubdomain, prefix))\n return !1;\n if (!StringPrototypeEndsWith.@call(hostSubdomain, suffix))\n return !1;\n return !0;\n}, splitEscapedAltNames = function(altNames) {\n const result = [];\n let currentToken = \"\", offset = 0;\n while (offset !== altNames.length) {\n const nextSep = StringPrototypeIndexOf.@call(altNames, \", \", offset), nextQuote = StringPrototypeIndexOf.@call(altNames, '\"', offset);\n if (nextQuote !== -1 && (nextSep === -1 || nextQuote < nextSep)) {\n currentToken += StringPrototypeSubstring.@call(altNames, offset, nextQuote);\n const match = RegExpPrototypeExec.@call(jsonStringPattern, StringPrototypeSubstring.@call(altNames, nextQuote));\n if (!match) {\n let error = new SyntaxError(\"ERR_TLS_CERT_ALTNAME_FORMAT: Invalid subject alternative name string\");\n throw error.name = ERR_TLS_CERT_ALTNAME_FORMAT, error;\n }\n currentToken += JSON.parse(match[0]), offset = nextQuote + match[0].length;\n } else if (nextSep !== -1)\n currentToken += StringPrototypeSubstring.@call(altNames, offset, nextSep), ArrayPrototypePush.@call(result, currentToken), currentToken = \"\", offset = nextSep + 2;\n else\n currentToken += StringPrototypeSubstring.@call(altNames, offset), offset = altNames.length;\n }\n return ArrayPrototypePush.@call(result, currentToken), result;\n}, checkServerIdentity = function(hostname, cert) {\n const { subject, subjectaltname: altNames } = cert, dnsNames = [], ips = [];\n if (hostname = \"\" + hostname, altNames) {\n const splitAltNames = StringPrototypeIncludes.@call(altNames, '\"') \? splitEscapedAltNames(altNames) : StringPrototypeSplit.@call(altNames, \", \");\n ArrayPrototypeForEach.@call(splitAltNames, (name) => {\n if (StringPrototypeStartsWith.@call(name, \"DNS:\"))\n ArrayPrototypePush.@call(dnsNames, StringPrototypeSlice.@call(name, 4));\n else if (StringPrototypeStartsWith.@call(name, \"IP Address:\"))\n ArrayPrototypePush.@call(ips, canonicalizeIP(StringPrototypeSlice.@call(name, 11)));\n });\n }\n let valid = !1, reason = \"Unknown reason\";\n if (hostname = unfqdn(hostname), net.isIP(hostname)) {\n if (valid = ArrayPrototypeIncludes.@call(ips, canonicalizeIP(hostname)), !valid)\n reason = `IP: ${hostname} is not in the cert's list: ` + ArrayPrototypeJoin.@call(ips, \", \");\n } else if (dnsNames.length > 0 || subject\?.CN) {\n const hostParts = splitHost(hostname), wildcard = (pattern) => check(hostParts, pattern, !0);\n if (dnsNames.length > 0) {\n if (valid = ArrayPrototypeSome.@call(dnsNames, wildcard), !valid)\n reason = `Host: ${hostname}. is not in the cert's altnames: ${altNames}`;\n } else {\n const cn = subject.CN;\n if (@Array.isArray(cn))\n valid = ArrayPrototypeSome.@call(cn, wildcard);\n else if (cn)\n valid = wildcard(cn);\n if (!valid)\n reason = `Host: ${hostname}. is not cert's CN: ${cn}`;\n }\n } else\n reason = \"Cert does not contain a DNS name\";\n if (!valid) {\n let error = new Error(`ERR_TLS_CERT_ALTNAME_INVALID: Hostname/IP does not match certificate's altnames: ${reason}`);\n return error.name = \"ERR_TLS_CERT_ALTNAME_INVALID\", error.reason = reason, error.host = hostname, error.cert = cert, error;\n }\n}, SecureContext = function(options) {\n return new InternalSecureContext(options);\n}, createSecureContext = function(options) {\n return new SecureContext(options);\n}, translatePeerCertificate = function(c) {\n if (!c)\n return null;\n if (c.issuerCertificate != null && c.issuerCertificate !== c)\n c.issuerCertificate = translatePeerCertificate(c.issuerCertificate);\n if (c.infoAccess != null) {\n const info = c.infoAccess;\n c.infoAccess = { __proto__: null }, RegExpPrototypeSymbolReplace.@call(/([^\\n:]*):([^\\n]*)(\?:\\n|$)/g, info, (all, key, val) => {\n if (val.charCodeAt(0) === 34)\n val = JSONParse(val);\n if (key in c.infoAccess)\n ArrayPrototypePush.@call(c.infoAccess[key], val);\n else\n c.infoAccess[key] = [val];\n });\n }\n return c;\n}, createServer = function(options, connectionListener) {\n return new Server(options, connectionListener);\n}, getCiphers = function() {\n return DEFAULT_CIPHERS.split(\":\");\n}, convertProtocols = function(protocols) {\n const lens = new @Array(protocols.length), buff = @Buffer.allocUnsafe(ArrayPrototypeReduce.@call(protocols, (p, c, i) => {\n const len = @Buffer.byteLength(c);\n if (len > 255)\n @throwRangeError(\"The byte length of the protocol at index \" + `${i} exceeds the maximum length.`, \"<= 255\", len, !0);\n return lens[i] = len, p + 1 + len;\n }, 0));\n let offset = 0;\n for (let i = 0, c = protocols.length;i < c; i++)\n buff[offset++] = lens[i], buff.write(protocols[i], offset), offset += lens[i];\n return buff;\n}, convertALPNProtocols = function(protocols, out) {\n if (@Array.isArray(protocols))\n out.ALPNProtocols = convertProtocols(protocols);\n else if (isTypedArray(protocols))\n out.ALPNProtocols = @Buffer.from(protocols);\n else if (isArrayBufferView(protocols))\n out.ALPNProtocols = @Buffer.from(protocols.buffer.slice(protocols.byteOffset, protocols.byteOffset + protocols.byteLength));\n else if (@Buffer.isBuffer(protocols))\n out.ALPNProtocols = protocols;\n}, $, { isArrayBufferView, isTypedArray } = @requireNativeModule(\"util/types\"), net = @getInternalField(@internalModuleRegistry, 27) || @createInternalModuleById(27), { Server: NetServer, [Symbol.for(\"::bunternal::\")]: InternalTCPSocket } = net, bunSocketInternal = Symbol.for(\"::bunnetsocketinternal::\"), { rootCertificates, canonicalizeIP } = @lazy(\"internal/tls\"), SymbolReplace = Symbol.replace, RegExpPrototypeSymbolReplace = @RegExp.prototype[SymbolReplace], RegExpPrototypeExec = @RegExp.prototype.exec, StringPrototypeStartsWith = @String.prototype.startsWith, StringPrototypeSlice = @String.prototype.slice, StringPrototypeIncludes = @String.prototype.includes, StringPrototypeSplit = @String.prototype.split, StringPrototypeIndexOf = @String.prototype.indexOf, StringPrototypeSubstring = @String.prototype.substring, StringPrototypeEndsWith = @String.prototype.endsWith, StringFromCharCode = @String.fromCharCode, StringPrototypeCharCodeAt = @String.prototype.charCodeAt, ArrayPrototypeIncludes = @Array.prototype.includes, ArrayPrototypeJoin = @Array.prototype.join, ArrayPrototypeForEach = @Array.prototype.forEach, ArrayPrototypePush = @Array.prototype.push, ArrayPrototypeSome = @Array.prototype.some, ArrayPrototypeReduce = @Array.prototype.reduce, jsonStringPattern = /^\"(\?:[^\"\\\\\\u0000-\\u001f]|\\\\(\?:[\"\\\\/bfnrt]|u[0-9a-fA-F]{4}))*\"/, InternalSecureContext = class SecureContext2 {\n context;\n constructor(options) {\n const context = {};\n if (options) {\n let key = options.key;\n if (key) {\n if (!isValidTLSArray(key))\n @throwTypeError(\"key argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");\n this.key = key;\n }\n let cert = options.cert;\n if (cert) {\n if (!isValidTLSArray(cert))\n @throwTypeError(\"cert argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");\n this.cert = cert;\n }\n let ca = options.ca;\n if (ca) {\n if (!isValidTLSArray(ca))\n @throwTypeError(\"ca argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");\n this.ca = ca;\n }\n let passphrase = options.passphrase;\n if (passphrase && typeof passphrase !== \"string\")\n @throwTypeError(\"passphrase argument must be an string\");\n this.passphrase = passphrase;\n let servername = options.servername;\n if (servername && typeof servername !== \"string\")\n @throwTypeError(\"servername argument must be an string\");\n this.servername = servername;\n let secureOptions = options.secureOptions || 0;\n if (secureOptions && typeof secureOptions !== \"number\")\n @throwTypeError(\"secureOptions argument must be an number\");\n this.secureOptions = secureOptions;\n }\n this.context = context;\n }\n}, buntls = Symbol.for(\"::buntls::\"), SocketClass, TLSSocket = function(InternalTLSSocket) {\n SocketClass = InternalTLSSocket, Object.defineProperty(SocketClass.prototype, Symbol.toStringTag, {\n value: \"TLSSocket\",\n enumerable: !1\n });\n function Socket(options) {\n return new InternalTLSSocket(options);\n }\n return Socket.prototype = InternalTLSSocket.prototype, Object.defineProperty(Socket, Symbol.hasInstance, {\n value(instance) {\n return instance instanceof InternalTLSSocket;\n }\n });\n}(class TLSSocket2 extends InternalTCPSocket {\n #secureContext;\n ALPNProtocols;\n #socket;\n #checkServerIdentity;\n #session;\n constructor(socket, options) {\n super(socket instanceof InternalTCPSocket \? options : options || socket);\n if (options = options || socket || {}, typeof options === \"object\") {\n const { ALPNProtocols } = options;\n if (ALPNProtocols)\n convertALPNProtocols(ALPNProtocols, this);\n if (socket instanceof InternalTCPSocket)\n this.#socket = socket;\n }\n this.#secureContext = options.secureContext || createSecureContext(options), this.authorized = !1, this.secureConnecting = !0, this._secureEstablished = !1, this._securePending = !0, this.#checkServerIdentity = options.checkServerIdentity || checkServerIdentity, this.#session = options.session || null;\n }\n _secureEstablished = !1;\n _securePending = !0;\n _newSessionPending;\n _controlReleased;\n secureConnecting = !1;\n _SNICallback;\n servername;\n authorized = !1;\n authorizationError;\n #renegotiationDisabled = !1;\n encrypted = !0;\n _start() {\n this.connect();\n }\n getSession() {\n return this[bunSocketInternal]\?.getSession();\n }\n getEphemeralKeyInfo() {\n return this[bunSocketInternal]\?.getEphemeralKeyInfo();\n }\n getCipher() {\n return this[bunSocketInternal]\?.getCipher();\n }\n getSharedSigalgs() {\n return this[bunSocketInternal]\?.getSharedSigalgs();\n }\n getProtocol() {\n return this[bunSocketInternal]\?.getTLSVersion();\n }\n getFinished() {\n return this[bunSocketInternal]\?.getTLSFinishedMessage() || @undefined;\n }\n getPeerFinished() {\n return this[bunSocketInternal]\?.getTLSPeerFinishedMessage() || @undefined;\n }\n isSessionReused() {\n return !!this.#session;\n }\n renegotiate() {\n if (this.#renegotiationDisabled) {\n const error = new Error(\"ERR_TLS_RENEGOTIATION_DISABLED: TLS session renegotiation disabled for this socket\");\n throw error.name = \"ERR_TLS_RENEGOTIATION_DISABLED\", error;\n }\n throw Error(\"Not implented in Bun yet\");\n }\n disableRenegotiation() {\n this.#renegotiationDisabled = !0;\n }\n getTLSTicket() {\n return this[bunSocketInternal]\?.getTLSTicket();\n }\n exportKeyingMaterial(length, label, context) {\n if (context)\n return this[bunSocketInternal]\?.exportKeyingMaterial(length, label, context);\n return this[bunSocketInternal]\?.exportKeyingMaterial(length, label);\n }\n setMaxSendFragment(size) {\n return this[bunSocketInternal]\?.setMaxSendFragment(size) || !1;\n }\n enableTrace() {\n }\n setServername(name) {\n if (this.isServer) {\n let error = new Error(\"ERR_TLS_SNI_FROM_SERVER: Cannot issue SNI from a TLS server-side socket\");\n throw error.name = \"ERR_TLS_SNI_FROM_SERVER\", error;\n }\n this.servername = name, this[bunSocketInternal]\?.setServername(name);\n }\n setSession(session) {\n if (this.#session = session, typeof session === \"string\")\n session = @Buffer.from(session, \"latin1\");\n return this[bunSocketInternal]\?.setSession(session);\n }\n getPeerCertificate(abbreviated) {\n const cert = arguments.length < 1 \? this[bunSocketInternal]\?.getPeerCertificate() : this[bunSocketInternal]\?.getPeerCertificate(abbreviated);\n if (cert)\n return translatePeerCertificate(cert);\n }\n getCertificate() {\n const cert = this[bunSocketInternal]\?.getCertificate();\n if (cert)\n return translatePeerCertificate(cert);\n }\n getPeerX509Certificate() {\n throw Error(\"Not implented in Bun yet\");\n }\n getX509Certificate() {\n throw Error(\"Not implented in Bun yet\");\n }\n get alpnProtocol() {\n return this[bunSocketInternal]\?.alpnProtocol;\n }\n [buntls](port, host) {\n return {\n socket: this.#socket,\n ALPNProtocols: this.ALPNProtocols,\n serverName: this.servername || host || \"localhost\",\n checkServerIdentity: this.#checkServerIdentity,\n session: this.#session,\n ...this.#secureContext\n };\n }\n});\n\nclass Server extends NetServer {\n key;\n cert;\n ca;\n passphrase;\n secureOptions;\n _rejectUnauthorized;\n _requestCert;\n servername;\n ALPNProtocols;\n constructor(options, secureConnectionListener) {\n super(options, secureConnectionListener);\n this.setSecureContext(options);\n }\n setSecureContext(options) {\n if (options instanceof InternalSecureContext)\n options = options.context;\n if (options) {\n const { ALPNProtocols } = options;\n if (ALPNProtocols)\n convertALPNProtocols(ALPNProtocols, this);\n let key = options.key;\n if (key) {\n if (!isValidTLSArray(key))\n @throwTypeError(\"key argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");\n this.key = key;\n }\n let cert = options.cert;\n if (cert) {\n if (!isValidTLSArray(cert))\n @throwTypeError(\"cert argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");\n this.cert = cert;\n }\n let ca = options.ca;\n if (ca) {\n if (!isValidTLSArray(ca))\n @throwTypeError(\"ca argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");\n this.ca = ca;\n }\n let passphrase = options.passphrase;\n if (passphrase && typeof passphrase !== \"string\")\n @throwTypeError(\"passphrase argument must be an string\");\n this.passphrase = passphrase;\n let servername = options.servername;\n if (servername && typeof servername !== \"string\")\n @throwTypeError(\"servername argument must be an string\");\n this.servername = servername;\n let secureOptions = options.secureOptions || 0;\n if (secureOptions && typeof secureOptions !== \"number\")\n @throwTypeError(\"secureOptions argument must be an number\");\n this.secureOptions = secureOptions;\n const requestCert = options.requestCert || !1;\n if (requestCert)\n this._requestCert = requestCert;\n else\n this._requestCert = @undefined;\n const rejectUnauthorized = options.rejectUnauthorized || !1;\n if (rejectUnauthorized)\n this._rejectUnauthorized = rejectUnauthorized;\n else\n this._rejectUnauthorized = @undefined;\n }\n }\n getTicketKeys() {\n throw Error(\"Not implented in Bun yet\");\n }\n setTicketKeys() {\n throw Error(\"Not implented in Bun yet\");\n }\n [buntls](port, host, isClient) {\n return [\n {\n serverName: this.servername || host || \"localhost\",\n key: this.key,\n cert: this.cert,\n ca: this.ca,\n passphrase: this.passphrase,\n secureOptions: this.secureOptions,\n rejectUnauthorized: isClient \? !1 : this._rejectUnauthorized,\n requestCert: isClient \? !1 : this._requestCert,\n ALPNProtocols: this.ALPNProtocols\n },\n SocketClass\n ];\n }\n}\nvar CLIENT_RENEG_LIMIT = 3, CLIENT_RENEG_WINDOW = 600, DEFAULT_ECDH_CURVE = \"auto\", DEFAULT_CIPHERS = \"DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256\", DEFAULT_MIN_VERSION = \"TLSv1.2\", DEFAULT_MAX_VERSION = \"TLSv1.3\", createConnection = (port, host, connectListener) => {\n if (typeof port === \"object\") {\n port.checkServerIdentity;\n const { ALPNProtocols } = port;\n if (ALPNProtocols)\n convertALPNProtocols(ALPNProtocols, port);\n return new TLSSocket(port).connect(port, host, connectListener);\n }\n return new TLSSocket().connect(port, host, connectListener);\n}, connect = createConnection;\n$ = {\n CLIENT_RENEG_LIMIT,\n CLIENT_RENEG_WINDOW,\n connect,\n convertALPNProtocols,\n createConnection,\n createSecureContext,\n createServer,\n DEFAULT_CIPHERS,\n DEFAULT_ECDH_CURVE,\n DEFAULT_MAX_VERSION,\n DEFAULT_MIN_VERSION,\n getCiphers,\n parseCertString,\n SecureContext,\n Server,\n TLSSocket,\n checkServerIdentity,\n rootCertificates\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeTraceEventsCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/trace_events.ts\nvar ERR_INVALID_ARG_TYPE = function(name, type, value) {\n const err = @makeTypeError(`The \"${name}\" argument must be of type ${type}. Received ${value}`);\n return err.code = \"ERR_INVALID_ARG_TYPE\", err;\n}, createTracing = function(opts) {\n if (typeof opts !== \"object\" || opts == null)\n throw new ERR_INVALID_ARG_TYPE(\"options\", \"Object\", opts);\n return new Tracing(opts);\n}, getEnabledCategories = function() {\n return \"\";\n}, $;\n\nclass Tracing {\n enabled = !1;\n categories = \"\";\n}\n$ = {\n createTracing,\n getEnabledCategories\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeTtyCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/tty.ts\nvar ReadStream = function(fd) {\n if (!(this instanceof ReadStream))\n return new ReadStream(fd);\n if (fd >> 0 !== fd || fd < 0)\n @throwRangeError(\"fd must be a positive integer\");\n const stream = (@getInternalField(@internalModuleRegistry, 21) || @createInternalModuleById(21)).ReadStream.@call(this, \"\", {\n fd\n });\n return Object.setPrototypeOf(stream, ReadStream.prototype), stream.isRaw = !1, stream.isTTY = !0, stream;\n}, warnOnDeactivatedColors = function(env) {\n if (warned)\n return;\n let name = \"\";\n if (env.NODE_DISABLE_COLORS !== @undefined)\n name = \"NODE_DISABLE_COLORS\";\n if (env.NO_COLOR !== @undefined) {\n if (name !== \"\")\n name += \"' and '\";\n name += \"NO_COLOR\";\n }\n if (name !== \"\")\n process.emitWarning(`The '${name}' env is ignored due to the 'FORCE_COLOR' env being set.`, \"Warning\"), warned = !0;\n}, WriteStream = function(fd) {\n if (!(this instanceof WriteStream))\n return new WriteStream(fd);\n if (fd >> 0 !== fd || fd < 0)\n @throwRangeError(\"fd must be a positive integer\");\n const stream = (@getInternalField(@internalModuleRegistry, 21) || @createInternalModuleById(21)).WriteStream.@call(this, \"\", {\n fd\n });\n if (stream.columns = @undefined, stream.rows = @undefined, stream.isTTY = isatty(stream.fd), stream.isTTY) {\n const windowSizeArray = [0, 0];\n if (_getWindowSize(fd, windowSizeArray) === !0)\n stream.columns = windowSizeArray[0], stream.rows = windowSizeArray[1];\n }\n return stream;\n}, { ttySetMode, isatty, getWindowSize: _getWindowSize } = @lazy(\"tty\"), NumberIsInteger = Number.isInteger;\nObject.defineProperty(ReadStream, \"prototype\", {\n get() {\n const Prototype = Object.create((@getInternalField(@internalModuleRegistry, 21) || @createInternalModuleById(21)).ReadStream.prototype);\n return Prototype.setRawMode = function(flag) {\n const mode = flag \? 1 : 0, err = ttySetMode(this.fd, mode);\n if (err)\n return this.emit(\"error\", new Error(\"setRawMode failed with errno: \" + err)), this;\n return this.isRaw = flag, this;\n }, Object.defineProperty(ReadStream, \"prototype\", { value: Prototype }), Prototype;\n },\n enumerable: !0,\n configurable: !0\n});\nvar COLORS_2 = 1, COLORS_16 = 4, COLORS_256 = 8, COLORS_16m = 24, TERM_ENVS = {\n eterm: COLORS_16,\n cons25: COLORS_16,\n console: COLORS_16,\n cygwin: COLORS_16,\n dtterm: COLORS_16,\n gnome: COLORS_16,\n hurd: COLORS_16,\n jfbterm: COLORS_16,\n konsole: COLORS_16,\n kterm: COLORS_16,\n mlterm: COLORS_16,\n mosh: COLORS_16m,\n putty: COLORS_16,\n st: COLORS_16,\n \"rxvt-unicode-24bit\": COLORS_16m,\n terminator: COLORS_16m\n}, TERM_ENVS_REG_EXP = [/ansi/, /color/, /linux/, /^con[0-9]*x[0-9]/, /^rxvt/, /^screen/, /^xterm/, /^vt100/], warned = !1;\nObject.defineProperty(WriteStream, \"prototype\", {\n get() {\n const Real = (@getInternalField(@internalModuleRegistry, 21) || @createInternalModuleById(21)).WriteStream.prototype;\n Object.defineProperty(WriteStream, \"prototype\", { value: Real }), WriteStream.prototype._refreshSize = function() {\n const oldCols = this.columns, oldRows = this.rows, windowSizeArray = [0, 0];\n if (_getWindowSize(this.fd, windowSizeArray) === !0) {\n if (oldCols !== windowSizeArray[0] || oldRows !== windowSizeArray[1])\n this.columns = windowSizeArray[0], this.rows = windowSizeArray[1], this.emit(\"resize\");\n }\n };\n var readline = @undefined;\n return WriteStream.prototype.clearLine = function(dir, cb) {\n return (readline \?\?= @getInternalField(@internalModuleRegistry, 35) || @createInternalModuleById(35)).clearLine(this, dir, cb);\n }, WriteStream.prototype.clearScreenDown = function(cb) {\n return (readline \?\?= @getInternalField(@internalModuleRegistry, 35) || @createInternalModuleById(35)).clearScreenDown(this, cb);\n }, WriteStream.prototype.cursorTo = function(x, y, cb) {\n return (readline \?\?= @getInternalField(@internalModuleRegistry, 35) || @createInternalModuleById(35)).cursorTo(this, x, y, cb);\n }, WriteStream.prototype.getColorDepth = function(env = process.env) {\n if (env.FORCE_COLOR !== @undefined)\n switch (env.FORCE_COLOR) {\n case \"\":\n case \"1\":\n case \"true\":\n return warnOnDeactivatedColors(env), COLORS_16;\n case \"2\":\n return warnOnDeactivatedColors(env), COLORS_256;\n case \"3\":\n return warnOnDeactivatedColors(env), COLORS_16m;\n default:\n return COLORS_2;\n }\n if (env.NODE_DISABLE_COLORS !== @undefined || env.NO_COLOR !== @undefined || env.TERM === \"dumb\")\n return COLORS_2;\n if (env.TMUX)\n return COLORS_256;\n if (env.CI) {\n if ([\"APPVEYOR\", \"BUILDKITE\", \"CIRCLECI\", \"DRONE\", \"GITHUB_ACTIONS\", \"GITLAB_CI\", \"TRAVIS\"].some((sign) => (sign in env)) || env.CI_NAME === \"codeship\")\n return COLORS_256;\n return COLORS_2;\n }\n if (\"TEAMCITY_VERSION\" in env)\n return /^(9\\.(0*[1-9]\\d*)\\.|\\d{2,}\\.)/.test(env.TEAMCITY_VERSION) \? COLORS_16 : COLORS_2;\n switch (env.TERM_PROGRAM) {\n case \"iTerm.app\":\n if (!env.TERM_PROGRAM_VERSION || /^[0-2]\\./.test(env.TERM_PROGRAM_VERSION))\n return COLORS_256;\n return COLORS_16m;\n case \"HyperTerm\":\n case \"MacTerm\":\n return COLORS_16m;\n case \"Apple_Terminal\":\n return COLORS_256;\n }\n if (env.COLORTERM === \"truecolor\" || env.COLORTERM === \"24bit\")\n return COLORS_16m;\n if (env.TERM) {\n if (/^xterm-256/.test(env.TERM) !== null)\n return COLORS_256;\n const termEnv = env.TERM.toLowerCase();\n if (TERM_ENVS[termEnv])\n return TERM_ENVS[termEnv];\n if (TERM_ENVS_REG_EXP.some((term) => term.test(termEnv)))\n return COLORS_16;\n }\n if (env.COLORTERM)\n return COLORS_16;\n return COLORS_2;\n }, WriteStream.prototype.getWindowSize = function() {\n return [this.columns, this.rows];\n }, WriteStream.prototype.hasColors = function(count, env) {\n if (env === @undefined && (count === @undefined || typeof count === \"object\" && count !== null))\n env = count, count = 16;\n else\n validateInteger(count, \"count\", 2);\n return count <= 2 ** this.getColorDepth(env);\n }, WriteStream.prototype.moveCursor = function(dx, dy, cb) {\n return (readline \?\?= @getInternalField(@internalModuleRegistry, 35) || @createInternalModuleById(35)).moveCursor(this, dx, dy, cb);\n }, Real;\n },\n enumerable: !0,\n configurable: !0\n});\nvar validateInteger = (value, name, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER) => {\n if (typeof value !== \"number\")\n throw new ERR_INVALID_ARG_TYPE(name, \"number\", value);\n if (!NumberIsInteger(value))\n throw new ERR_OUT_OF_RANGE(name, \"an integer\", value);\n if (value < min || value > max)\n throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);\n};\nreturn { ReadStream, WriteStream, isatty }})\n"); -// - -// -static constexpr ASCIILiteral NodeUrlCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/url.ts\nvar Url = function() {\n this.protocol = null, this.slashes = null, this.auth = null, this.host = null, this.port = null, this.hostname = null, this.hash = null, this.search = null, this.query = null, this.pathname = null, this.path = null, this.href = null;\n}, urlParse = function(url, parseQueryString, slashesDenoteHost) {\n if (url && typeof url === \"object\" && url instanceof Url)\n return url;\n var u = new Url;\n return u.parse(url, parseQueryString, slashesDenoteHost), u;\n}, urlFormat = function(obj) {\n if (typeof obj === \"string\")\n obj = urlParse(obj);\n if (!(obj instanceof Url))\n return Url.prototype.format.@call(obj);\n return obj.format();\n}, urlResolve = function(source, relative) {\n return urlParse(source, !1, !0).resolve(relative);\n}, urlResolveObject = function(source, relative) {\n if (!source)\n return relative;\n return urlParse(source, !1, !0).resolveObject(relative);\n}, urlToHttpOptions = function(url) {\n const options = {\n protocol: url.protocol,\n hostname: typeof url.hostname === \"string\" && url.hostname.startsWith(\"[\") \? url.hostname.slice(1, -1) : url.hostname,\n hash: url.hash,\n search: url.search,\n pathname: url.pathname,\n path: `${url.pathname || \"\"}${url.search || \"\"}`,\n href: url.href\n };\n if (url.port !== \"\")\n options.port = Number(url.port);\n if (url.username || url.password)\n options.auth = `${decodeURIComponent(url.username)}:${decodeURIComponent(url.password)}`;\n return options;\n}, $, { URL, URLSearchParams } = globalThis;\nUrl.prototype = {};\nvar protocolPattern = /^([a-z0-9.+-]+:)/i, portPattern = /:[0-9]*$/, simplePathPattern = /^(\\/\\/\?(\?!\\/)[^\?\\s]*)(\\\?[^\\s]*)\?$/, delims = [\"<\", \">\", '\"', \"`\", \" \", \"\\r\", \"\\n\", \"\\t\"], unwise = [\"{\", \"}\", \"|\", \"\\\\\", \"^\", \"`\"].concat(delims), autoEscape = [\"'\"].concat(unwise), nonHostChars = [\"%\", \"/\", \"\?\", \";\", \"#\"].concat(autoEscape), hostEndingChars = [\"/\", \"\?\", \"#\"], hostnameMaxLen = 255, hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, unsafeProtocol = {\n javascript: !0,\n \"javascript:\": !0\n}, hostlessProtocol = {\n javascript: !0,\n \"javascript:\": !0\n}, slashedProtocol = {\n http: !0,\n https: !0,\n ftp: !0,\n gopher: !0,\n file: !0,\n \"http:\": !0,\n \"https:\": !0,\n \"ftp:\": !0,\n \"gopher:\": !0,\n \"file:\": !0\n};\nUrl.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {\n if (typeof url !== \"string\")\n @throwTypeError(\"Parameter 'url' must be a string, not \" + typeof url);\n var queryIndex = url.indexOf(\"\?\"), splitter = queryIndex !== -1 && queryIndex < url.indexOf(\"#\") \? \"\?\" : \"#\", uSplit = url.split(splitter), slashRegex = /\\\\/g;\n uSplit[0] = uSplit[0].replace(slashRegex, \"/\"), url = uSplit.join(splitter);\n var rest = url;\n if (rest = rest.trim(), !slashesDenoteHost && url.split(\"#\").length === 1) {\n var simplePath = simplePathPattern.exec(rest);\n if (simplePath) {\n if (this.path = rest, this.href = rest, this.pathname = simplePath[1], simplePath[2])\n if (this.search = simplePath[2], parseQueryString)\n this.query = new URLSearchParams(this.search.substr(1)).toJSON();\n else\n this.query = this.search.substr(1);\n else if (parseQueryString)\n this.search = \"\", this.query = {};\n return this;\n }\n }\n var proto = protocolPattern.exec(rest);\n if (proto) {\n proto = proto[0];\n var lowerProto = proto.toLowerCase();\n this.protocol = lowerProto, rest = rest.substr(proto.length);\n }\n if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@/]+@[^@/]+/)) {\n var slashes = rest.substr(0, 2) === \"//\";\n if (slashes && !(proto && hostlessProtocol[proto]))\n rest = rest.substr(2), this.slashes = !0;\n }\n if (!hostlessProtocol[proto] && (slashes || proto && !slashedProtocol[proto])) {\n var hostEnd = -1;\n for (var i = 0;i < hostEndingChars.length; i++) {\n var hec = rest.indexOf(hostEndingChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n var auth, atSign;\n if (hostEnd === -1)\n atSign = rest.lastIndexOf(\"@\");\n else\n atSign = rest.lastIndexOf(\"@\", hostEnd);\n if (atSign !== -1)\n auth = rest.slice(0, atSign), rest = rest.slice(atSign + 1), this.auth = decodeURIComponent(auth);\n hostEnd = -1;\n for (var i = 0;i < nonHostChars.length; i++) {\n var hec = rest.indexOf(nonHostChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n if (hostEnd === -1)\n hostEnd = rest.length;\n this.host = rest.slice(0, hostEnd), rest = rest.slice(hostEnd), this.parseHost(), this.hostname = this.hostname || \"\";\n var ipv6Hostname = this.hostname[0] === \"[\" && this.hostname[this.hostname.length - 1] === \"]\";\n if (!ipv6Hostname) {\n var hostparts = this.hostname.split(/\\./);\n for (var i = 0, l = hostparts.length;i < l; i++) {\n var part = hostparts[i];\n if (!part)\n continue;\n if (!part.match(hostnamePartPattern)) {\n var newpart = \"\";\n for (var j = 0, k = part.length;j < k; j++)\n if (part.charCodeAt(j) > 127)\n newpart += \"x\";\n else\n newpart += part[j];\n if (!newpart.match(hostnamePartPattern)) {\n var validParts = hostparts.slice(0, i), notHost = hostparts.slice(i + 1), bit = part.match(hostnamePartStart);\n if (bit)\n validParts.push(bit[1]), notHost.unshift(bit[2]);\n if (notHost.length)\n rest = \"/\" + notHost.join(\".\") + rest;\n this.hostname = validParts.join(\".\");\n break;\n }\n }\n }\n }\n if (this.hostname.length > hostnameMaxLen)\n this.hostname = \"\";\n else\n this.hostname = this.hostname.toLowerCase();\n if (!ipv6Hostname)\n this.hostname = new URL(\"http://\" + this.hostname).hostname;\n var p = this.port \? \":\" + this.port : \"\", h = this.hostname || \"\";\n if (this.host = h + p, this.href += this.host, ipv6Hostname) {\n if (this.hostname = this.hostname.substr(1, this.hostname.length - 2), rest[0] !== \"/\")\n rest = \"/\" + rest;\n }\n }\n if (!unsafeProtocol[lowerProto])\n for (var i = 0, l = autoEscape.length;i < l; i++) {\n var ae = autoEscape[i];\n if (rest.indexOf(ae) === -1)\n continue;\n var esc = encodeURIComponent(ae);\n if (esc === ae)\n esc = escape(ae);\n rest = rest.split(ae).join(esc);\n }\n var hash = rest.indexOf(\"#\");\n if (hash !== -1)\n this.hash = rest.substr(hash), rest = rest.slice(0, hash);\n var qm = rest.indexOf(\"\?\");\n if (qm !== -1) {\n if (this.search = rest.substr(qm), this.query = rest.substr(qm + 1), parseQueryString) {\n const query = this.query;\n this.query = new URLSearchParams(query).toJSON();\n }\n rest = rest.slice(0, qm);\n } else if (parseQueryString)\n this.search = \"\", this.query = {};\n if (rest)\n this.pathname = rest;\n if (slashedProtocol[lowerProto] && this.hostname && !this.pathname)\n this.pathname = \"/\";\n if (this.pathname || this.search) {\n var p = this.pathname || \"\", s = this.search || \"\";\n this.path = p + s;\n }\n return this.href = this.format(), this;\n};\nUrl.prototype.format = function() {\n var auth = this.auth || \"\";\n if (auth)\n auth = encodeURIComponent(auth), auth = auth.replace(/%3A/i, \":\"), auth += \"@\";\n var protocol = this.protocol || \"\", pathname = this.pathname || \"\", hash = this.hash || \"\", host = !1, query = \"\";\n if (this.host)\n host = auth + this.host;\n else if (this.hostname) {\n if (host = auth + (this.hostname.indexOf(\":\") === -1 \? this.hostname : \"[\" + this.hostname + \"]\"), this.port)\n host += \":\" + this.port;\n }\n if (this.query && typeof this.query === \"object\" && Object.keys(this.query).length)\n query = new URLSearchParams(this.query).toString();\n var search = this.search || query && \"\?\" + query || \"\";\n if (protocol && protocol.substr(-1) !== \":\")\n protocol += \":\";\n if (this.slashes || (!protocol || slashedProtocol[protocol]) && host !== !1) {\n if (host = \"//\" + (host || \"\"), pathname && pathname.charAt(0) !== \"/\")\n pathname = \"/\" + pathname;\n } else if (!host)\n host = \"\";\n if (hash && hash.charAt(0) !== \"#\")\n hash = \"#\" + hash;\n if (search && search.charAt(0) !== \"\?\")\n search = \"\?\" + search;\n return pathname = pathname.replace(/[\?#]/g, function(match) {\n return encodeURIComponent(match);\n }), search = search.replace(\"#\", \"%23\"), protocol + host + pathname + search + hash;\n};\nUrl.prototype.resolve = function(relative) {\n return this.resolveObject(urlParse(relative, !1, !0)).format();\n};\nUrl.prototype.resolveObject = function(relative) {\n if (typeof relative === \"string\") {\n var rel = new Url;\n rel.parse(relative, !1, !0), relative = rel;\n }\n var result = new Url, tkeys = Object.keys(this);\n for (var tk = 0;tk < tkeys.length; tk++) {\n var tkey = tkeys[tk];\n result[tkey] = this[tkey];\n }\n if (result.hash = relative.hash, relative.href === \"\")\n return result.href = result.format(), result;\n if (relative.slashes && !relative.protocol) {\n var rkeys = Object.keys(relative);\n for (var rk = 0;rk < rkeys.length; rk++) {\n var rkey = rkeys[rk];\n if (rkey !== \"protocol\")\n result[rkey] = relative[rkey];\n }\n if (slashedProtocol[result.protocol] && result.hostname && !result.pathname)\n result.pathname = \"/\", result.path = result.pathname;\n return result.href = result.format(), result;\n }\n if (relative.protocol && relative.protocol !== result.protocol) {\n if (!slashedProtocol[relative.protocol]) {\n var keys = Object.keys(relative);\n for (var v = 0;v < keys.length; v++) {\n var k = keys[v];\n result[k] = relative[k];\n }\n return result.href = result.format(), result;\n }\n if (result.protocol = relative.protocol, !relative.host && !hostlessProtocol[relative.protocol]) {\n var relPath = (relative.pathname || \"\").split(\"/\");\n while (relPath.length && !(relative.host = relPath.shift()))\n ;\n if (!relative.host)\n relative.host = \"\";\n if (!relative.hostname)\n relative.hostname = \"\";\n if (relPath[0] !== \"\")\n relPath.unshift(\"\");\n if (relPath.length < 2)\n relPath.unshift(\"\");\n result.pathname = relPath.join(\"/\");\n } else\n result.pathname = relative.pathname;\n if (result.search = relative.search, result.query = relative.query, result.host = relative.host || \"\", result.auth = relative.auth, result.hostname = relative.hostname || relative.host, result.port = relative.port, result.pathname || result.search) {\n var p = result.pathname || \"\", s = result.search || \"\";\n result.path = p + s;\n }\n return result.slashes = result.slashes || relative.slashes, result.href = result.format(), result;\n }\n var isSourceAbs = result.pathname && result.pathname.charAt(0) === \"/\", isRelAbs = relative.host || relative.pathname && relative.pathname.charAt(0) === \"/\", mustEndAbs = isRelAbs || isSourceAbs || result.host && relative.pathname, removeAllDots = mustEndAbs, srcPath = result.pathname && result.pathname.split(\"/\") || [], relPath = relative.pathname && relative.pathname.split(\"/\") || [], psychotic = result.protocol && !slashedProtocol[result.protocol];\n if (psychotic) {\n if (result.hostname = \"\", result.port = null, result.host)\n if (srcPath[0] === \"\")\n srcPath[0] = result.host;\n else\n srcPath.unshift(result.host);\n if (result.host = \"\", relative.protocol) {\n if (relative.hostname = null, relative.port = null, relative.host)\n if (relPath[0] === \"\")\n relPath[0] = relative.host;\n else\n relPath.unshift(relative.host);\n relative.host = null;\n }\n mustEndAbs = mustEndAbs && (relPath[0] === \"\" || srcPath[0] === \"\");\n }\n if (isRelAbs)\n result.host = relative.host || relative.host === \"\" \? relative.host : result.host, result.hostname = relative.hostname || relative.hostname === \"\" \? relative.hostname : result.hostname, result.search = relative.search, result.query = relative.query, srcPath = relPath;\n else if (relPath.length) {\n if (!srcPath)\n srcPath = [];\n srcPath.pop(), srcPath = srcPath.concat(relPath), result.search = relative.search, result.query = relative.query;\n } else if (relative.search != null) {\n if (psychotic) {\n result.host = srcPath.shift(), result.hostname = result.host;\n var authInHost = result.host && result.host.indexOf(\"@\") > 0 \? result.host.split(\"@\") : !1;\n if (authInHost)\n result.auth = authInHost.shift(), result.hostname = authInHost.shift(), result.host = result.hostname;\n }\n if (result.search = relative.search, result.query = relative.query, result.pathname !== null || result.search !== null)\n result.path = (result.pathname \? result.pathname : \"\") + (result.search \? result.search : \"\");\n return result.href = result.format(), result;\n }\n if (!srcPath.length) {\n if (result.pathname = null, result.search)\n result.path = \"/\" + result.search;\n else\n result.path = null;\n return result.href = result.format(), result;\n }\n var last = srcPath.slice(-1)[0], hasTrailingSlash = (result.host || relative.host || srcPath.length > 1) && (last === \".\" || last === \"..\") || last === \"\", up = 0;\n for (var i = srcPath.length;i >= 0; i--)\n if (last = srcPath[i], last === \".\")\n srcPath.splice(i, 1);\n else if (last === \"..\")\n srcPath.splice(i, 1), up++;\n else if (up)\n srcPath.splice(i, 1), up--;\n if (!mustEndAbs && !removeAllDots)\n for (;up--; up)\n srcPath.unshift(\"..\");\n if (mustEndAbs && srcPath[0] !== \"\" && (!srcPath[0] || srcPath[0].charAt(0) !== \"/\"))\n srcPath.unshift(\"\");\n if (hasTrailingSlash && srcPath.join(\"/\").substr(-1) !== \"/\")\n srcPath.push(\"\");\n var isAbsolute = srcPath[0] === \"\" || srcPath[0] && srcPath[0].charAt(0) === \"/\";\n if (psychotic) {\n result.hostname = isAbsolute \? \"\" : srcPath.length \? srcPath.shift() : \"\", result.host = result.hostname;\n var authInHost = result.host && result.host.indexOf(\"@\") > 0 \? result.host.split(\"@\") : !1;\n if (authInHost)\n result.auth = authInHost.shift(), result.hostname = authInHost.shift(), result.host = result.hostname;\n }\n if (mustEndAbs = mustEndAbs || result.host && srcPath.length, mustEndAbs && !isAbsolute)\n srcPath.unshift(\"\");\n if (srcPath.length > 0)\n result.pathname = srcPath.join(\"/\");\n else\n result.pathname = null, result.path = null;\n if (result.pathname !== null || result.search !== null)\n result.path = (result.pathname \? result.pathname : \"\") + (result.search \? result.search : \"\");\n return result.auth = relative.auth || result.auth, result.slashes = result.slashes || relative.slashes, result.href = result.format(), result;\n};\nUrl.prototype.parseHost = function() {\n var host = this.host, port = portPattern.exec(host);\n if (port) {\n if (port = port[0], port !== \":\")\n this.port = port.substr(1);\n host = host.substr(0, host.length - port.length);\n }\n if (host)\n this.hostname = host;\n};\nvar pathToFileURL = @lazy(\"pathToFileURL\"), fileURLToPath = @lazy(\"fileURLToPath\");\n$ = {\n parse: urlParse,\n resolve: urlResolve,\n resolveObject: urlResolveObject,\n format: urlFormat,\n Url,\n URLSearchParams,\n URL,\n pathToFileURL,\n fileURLToPath,\n urlToHttpOptions\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeUtilCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/util.ts\nvar isBuffer = function(value) {\n return @Buffer.isBuffer(value);\n}, isFunction = function(value) {\n return typeof value === \"function\";\n}, deprecate = function(fn, msg, code) {\n if (process.noDeprecation === !0)\n return fn;\n var warned = !1;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n var err = new Error(msg);\n if (code)\n err.code = code;\n throw err;\n } else if (process.traceDeprecation)\n console.trace(msg);\n else\n console.error(msg);\n warned = !0;\n }\n return fn.@apply(this, arguments);\n }\n return deprecated;\n}, debuglog = function(set) {\n if (set = set.toUpperCase(), !debugs[set])\n if (debugEnvRegex.test(set)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = format.@apply(cjs_exports, arguments);\n console.error(\"%s %d: %s\", set, pid, msg);\n };\n } else\n debugs[set] = function() {\n };\n return debugs[set];\n}, isBoolean = function(arg) {\n return typeof arg === \"boolean\";\n}, isNull = function(arg) {\n return arg === null;\n}, isNullOrUndefined = function(arg) {\n return arg == null;\n}, isNumber = function(arg) {\n return typeof arg === \"number\";\n}, isString = function(arg) {\n return typeof arg === \"string\";\n}, isSymbol = function(arg) {\n return typeof arg === \"symbol\";\n}, isUndefined = function(arg) {\n return arg === void 0;\n}, isObject = function(arg) {\n return typeof arg === \"object\" && arg !== null;\n}, isPrimitive = function(arg) {\n return arg === null || typeof arg === \"boolean\" || typeof arg === \"number\" || typeof arg === \"string\" || typeof arg === \"symbol\" || typeof arg === \"undefined\";\n}, pad = function(n) {\n return n < 10 \? \"0\" + n.toString(10) : n.toString(10);\n}, timestamp = function() {\n var d = new Date, time = [pad(d.getHours()), pad(d.getMinutes()), pad(d.getSeconds())].join(\":\");\n return [d.getDate(), months[d.getMonth()], time].join(\" \");\n}, callbackifyOnRejected = function(reason, cb) {\n if (!reason) {\n var newReason = new Error(\"Promise was rejected with a falsy value\");\n newReason.reason = reason, newReason.code = \"ERR_FALSY_VALUE_REJECTION\", reason = newReason;\n }\n return cb(reason);\n}, callbackify = function(original) {\n if (typeof original !== \"function\")\n @throwTypeError('The \"original\" argument must be of type Function');\n function callbackified() {\n var args = @Array.prototype.slice.@call(arguments), maybeCb = args.pop();\n if (typeof maybeCb !== \"function\")\n @throwTypeError(\"The last argument must be of type Function\");\n var self = this, cb = function() {\n return maybeCb.@apply(self, arguments);\n };\n original.@apply(this, args).then(function(ret) {\n process.nextTick(cb, null, ret);\n }, function(rej) {\n process.nextTick(callbackifyOnRejected, rej, cb);\n });\n }\n return Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original)), Object.defineProperties(callbackified, getOwnPropertyDescriptors(original)), callbackified;\n}, $, types = @requireNativeModule(\"util/types\"), utl = @getInternalField(@internalModuleRegistry, 7) || @createInternalModuleById(7), cjs_exports = {}, deepEquals = Bun.deepEquals, isDeepStrictEqual = (a, b) => deepEquals(a, b, !0), getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors, inspect = utl.inspect, formatWithOptions = utl.formatWithOptions, format = utl.format, stripVTControlCharacters = utl.stripVTControlCharacters, debugs = {}, debugEnvRegex = /^$/;\nif (process.env.NODE_DEBUG)\n debugEnv = process.env.NODE_DEBUG, debugEnv = debugEnv.replace(/[|\\\\{}()[\\]^$+\?.]/g, \"\\\\$&\").replace(/\\*/g, \".*\").replace(/,/g, \"$|^\").toUpperCase(), debugEnvRegex = new @RegExp(\"^\" + debugEnv + \"$\", \"i\");\nvar debugEnv, isRegExp = types.isRegExp, isDate = types.isDate, isError = types.isNativeError, months = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], log = function log2() {\n console.log(\"%s - %s\", timestamp(), format.@apply(cjs_exports, arguments));\n}, inherits = function inherits2(ctor, superCtor) {\n ctor.super_ = superCtor, ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: !1,\n writable: !0,\n configurable: !0\n }\n });\n}, _extend = function(origin, add) {\n if (!add || !isObject(add))\n return origin;\n var keys = Object.keys(add), i = keys.length;\n while (i--)\n origin[keys[i]] = add[keys[i]];\n return origin;\n}, kCustomPromisifiedSymbol = Symbol.for(\"util.promisify.custom\"), promisify = function promisify2(original) {\n if (typeof original !== \"function\")\n @throwTypeError('The \"original\" argument must be of type Function');\n if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {\n var fn = original[kCustomPromisifiedSymbol];\n if (typeof fn !== \"function\")\n @throwTypeError('The \"util.promisify.custom\" argument must be of type Function');\n return Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn,\n enumerable: !1,\n writable: !1,\n configurable: !0\n }), fn;\n }\n function fn() {\n var promiseResolve, promiseReject, promise = new @Promise(function(resolve, reject) {\n promiseResolve = resolve, promiseReject = reject;\n }), args = [];\n for (var i = 0;i < arguments.length; i++)\n args.push(arguments[i]);\n args.push(function(err, value) {\n if (err)\n promiseReject(err);\n else\n promiseResolve(value);\n });\n try {\n original.@apply(this, args);\n } catch (err) {\n promiseReject(err);\n }\n return promise;\n }\n if (Object.setPrototypeOf(fn, Object.getPrototypeOf(original)), kCustomPromisifiedSymbol)\n Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn,\n enumerable: !1,\n writable: !1,\n configurable: !0\n });\n return Object.defineProperties(fn, getOwnPropertyDescriptors(original));\n};\npromisify.custom = kCustomPromisifiedSymbol;\nvar toUSVString = (input) => {\n return (input + \"\").toWellFormed();\n};\n$ = Object.assign(cjs_exports, {\n format,\n formatWithOptions,\n stripVTControlCharacters,\n deprecate,\n debuglog,\n _extend,\n inspect,\n types,\n isArray: @isArray,\n isBoolean,\n isNull,\n isNullOrUndefined,\n isNumber,\n isString,\n isSymbol,\n isUndefined,\n isRegExp,\n isObject,\n isDate,\n isFunction,\n isError,\n isPrimitive,\n isBuffer,\n log,\n inherits,\n toUSVString,\n promisify,\n callbackify,\n isDeepStrictEqual,\n TextDecoder,\n TextEncoder\n});\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeV8Code = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/v8.ts\nvar notimpl = function(message) {\n throwNotImplemented(\"node:v8 \" + message);\n}, cachedDataVersionTag = function() {\n notimpl(\"cachedDataVersionTag\");\n}, getHeapSnapshot = function() {\n notimpl(\"getHeapSnapshot\");\n}, getHeapStatistics = function() {\n const stats = jsc.heapStats();\n return {\n total_heap_size: stats.heapCapacity,\n total_heap_size_executable: 0,\n total_physical_size: stats.heapSize,\n total_available_size: @Infinity,\n used_heap_size: stats.heapSize,\n heap_size_limit: @Infinity,\n malloced_memory: stats.heapSize,\n peak_malloced_memory: @Infinity,\n does_zap_garbage: 0,\n number_of_native_contexts: @Infinity,\n number_of_detached_contexts: @Infinity,\n total_global_handles_size: @Infinity,\n used_global_handles_size: @Infinity,\n external_memory: @Infinity\n };\n}, getHeapSpaceStatistics = function() {\n notimpl(\"getHeapSpaceStatistics\");\n}, getHeapCodeStatistics = function() {\n notimpl(\"getHeapCodeStatistics\");\n}, setFlagsFromString = function() {\n notimpl(\"setFlagsFromString\");\n}, deserialize = function(value) {\n return jsc.deserialize(value);\n}, takeCoverage = function() {\n notimpl(\"takeCoverage\");\n}, stopCoverage = function() {\n notimpl(\"stopCoverage\");\n}, serialize = function(arg1) {\n return jsc.serialize(arg1, { binaryType: \"nodebuffer\" });\n}, writeHeapSnapshot = function() {\n notimpl(\"writeHeapSnapshot\");\n}, setHeapSnapshotNearHeapLimit = function() {\n notimpl(\"setHeapSnapshotNearHeapLimit\");\n}, $, { hideFromStack, throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6), jsc = @requireNativeModule(\"bun:jsc\");\n\nclass Deserializer {\n constructor() {\n notimpl(\"Deserializer\");\n }\n}\n\nclass Serializer {\n constructor() {\n notimpl(\"Serializer\");\n }\n}\n\nclass DefaultDeserializer extends Deserializer {\n constructor() {\n super(...arguments);\n }\n}\n\nclass DefaultSerializer extends Serializer {\n constructor() {\n super(...arguments);\n }\n}\n\nclass GCProfiler {\n constructor() {\n notimpl(\"GCProfiler\");\n }\n}\nvar promiseHooks = {\n createHook: () => {\n notimpl(\"createHook\");\n },\n onInit: () => {\n notimpl(\"onInit\");\n },\n onBefore: () => {\n notimpl(\"onBefore\");\n },\n onAfter: () => {\n notimpl(\"onAfter\");\n },\n onSettled: () => {\n notimpl(\"onSettled\");\n }\n}, startupSnapshot = {\n addDeserializeCallback: () => notimpl(\"addDeserializeCallback\"),\n addSerializeCallback: () => notimpl(\"addSerializeCallback\"),\n setDeserializeMainFunction: () => notimpl(\"setDeserializeMainFunction\"),\n isBuildingSnapshot: () => notimpl(\"isBuildingSnapshot\")\n};\n$ = {\n cachedDataVersionTag,\n getHeapSnapshot,\n getHeapStatistics,\n getHeapSpaceStatistics,\n getHeapCodeStatistics,\n setFlagsFromString,\n deserialize,\n takeCoverage,\n stopCoverage,\n serialize,\n writeHeapSnapshot,\n setHeapSnapshotNearHeapLimit,\n promiseHooks,\n startupSnapshot,\n Deserializer,\n Serializer\n};\nhideFromStack(notimpl, cachedDataVersionTag, getHeapSnapshot, getHeapStatistics, getHeapSpaceStatistics, getHeapCodeStatistics, setFlagsFromString, deserialize, takeCoverage, stopCoverage, serialize, writeHeapSnapshot, setHeapSnapshotNearHeapLimit, Deserializer, Serializer, DefaultDeserializer, DefaultSerializer, GCProfiler);\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeVMCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/vm.ts\nvar runInContext = function(code, context, options) {\n return new Script(code, options).runInContext(context);\n}, compileFunction = function() {\n throwNotImplemented(\"node:vm compileFunction\");\n}, measureMemory = function() {\n throwNotImplemented(\"node:vm measureMemory\");\n}, $, { throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6), vm = @lazy(\"vm\"), { createContext, isContext, Script, runInNewContext, runInThisContext } = vm;\n\nclass Module {\n constructor() {\n throwNotImplemented(\"node:vm Module\");\n }\n}\n\nclass SourceTextModule {\n constructor() {\n throwNotImplemented(\"node:vm Module\");\n }\n}\n\nclass SyntheticModule {\n constructor() {\n throwNotImplemented(\"node:vm Module\");\n }\n}\n$ = {\n createContext,\n runInContext,\n runInNewContext,\n runInThisContext,\n isContext,\n compileFunction,\n measureMemory,\n Script,\n Module,\n SourceTextModule,\n SyntheticModule\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeWasiCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/wasi.ts\nvar nodeFsConstants = @processBindingConstants.fs, __getOwnPropNames = Object.getOwnPropertyNames, __commonJS = (cb, mod) => function __require2() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n}, require_types = __commonJS({\n \"node_modules/wasi-js/dist/types.js\"(exports) {\n Object.defineProperty(exports, \"__esModule\", { value: !0 }), exports.WASIKillError = exports.WASIExitError = exports.WASIError = void 0;\n var WASIError = class extends Error {\n constructor(errno) {\n super();\n this.errno = errno, Object.setPrototypeOf(this, WASIError.prototype);\n }\n };\n exports.WASIError = WASIError;\n var WASIExitError = class extends Error {\n constructor(code) {\n super(`WASI Exit error: ${code}`);\n this.code = code, Object.setPrototypeOf(this, WASIExitError.prototype);\n }\n };\n exports.WASIExitError = WASIExitError;\n var WASIKillError = class extends Error {\n constructor(signal) {\n super(`WASI Kill signal: ${signal}`);\n this.signal = signal, Object.setPrototypeOf(this, WASIKillError.prototype);\n }\n };\n exports.WASIKillError = WASIKillError;\n }\n}), require_constants = __commonJS({\n \"node_modules/wasi-js/dist/constants.js\"(exports) {\n Object.defineProperty(exports, \"__esModule\", { value: !0 }), exports.WASI_ENOMSG = exports.WASI_ENOMEM = exports.WASI_ENOLINK = exports.WASI_ENOLCK = exports.WASI_ENOEXEC = exports.WASI_ENOENT = exports.WASI_ENODEV = exports.WASI_ENOBUFS = exports.WASI_ENFILE = exports.WASI_ENETUNREACH = exports.WASI_ENETRESET = exports.WASI_ENETDOWN = exports.WASI_ENAMETOOLONG = exports.WASI_EMULTIHOP = exports.WASI_EMSGSIZE = exports.WASI_EMLINK = exports.WASI_EMFILE = exports.WASI_ELOOP = exports.WASI_EISDIR = exports.WASI_EISCONN = exports.WASI_EIO = exports.WASI_EINVAL = exports.WASI_EINTR = exports.WASI_EINPROGRESS = exports.WASI_EILSEQ = exports.WASI_EIDRM = exports.WASI_EHOSTUNREACH = exports.WASI_EFBIG = exports.WASI_EFAULT = exports.WASI_EEXIST = exports.WASI_EDQUOT = exports.WASI_EDOM = exports.WASI_EDESTADDRREQ = exports.WASI_EDEADLK = exports.WASI_ECONNRESET = exports.WASI_ECONNREFUSED = exports.WASI_ECONNABORTED = exports.WASI_ECHILD = exports.WASI_ECANCELED = exports.WASI_EBUSY = exports.WASI_EBADMSG = exports.WASI_EBADF = exports.WASI_EALREADY = exports.WASI_EAGAIN = exports.WASI_EAFNOSUPPORT = exports.WASI_EADDRNOTAVAIL = exports.WASI_EADDRINUSE = exports.WASI_EACCES = exports.WASI_E2BIG = exports.WASI_ESUCCESS = void 0, exports.WASI_SIGVTALRM = exports.WASI_SIGUSR2 = exports.WASI_SIGUSR1 = exports.WASI_SIGURG = exports.WASI_SIGTTOU = exports.WASI_SIGTTIN = exports.WASI_SIGTSTP = exports.WASI_SIGTRAP = exports.WASI_SIGTERM = exports.WASI_SIGSTOP = exports.WASI_SIGSEGV = exports.WASI_SIGQUIT = exports.WASI_SIGPIPE = exports.WASI_SIGKILL = exports.WASI_SIGINT = exports.WASI_SIGILL = exports.WASI_SIGHUP = exports.WASI_SIGFPE = exports.WASI_SIGCONT = exports.WASI_SIGCHLD = exports.WASI_SIGBUS = exports.WASI_SIGALRM = exports.WASI_SIGABRT = exports.WASI_ENOTCAPABLE = exports.WASI_EXDEV = exports.WASI_ETXTBSY = exports.WASI_ETIMEDOUT = exports.WASI_ESTALE = exports.WASI_ESRCH = exports.WASI_ESPIPE = exports.WASI_EROFS = exports.WASI_ERANGE = exports.WASI_EPROTOTYPE = exports.WASI_EPROTONOSUPPORT = exports.WASI_EPROTO = exports.WASI_EPIPE = exports.WASI_EPERM = exports.WASI_EOWNERDEAD = exports.WASI_EOVERFLOW = exports.WASI_ENXIO = exports.WASI_ENOTTY = exports.WASI_ENOTSUP = exports.WASI_ENOTSOCK = exports.WASI_ENOTRECOVERABLE = exports.WASI_ENOTEMPTY = exports.WASI_ENOTDIR = exports.WASI_ENOTCONN = exports.WASI_ENOSYS = exports.WASI_ENOSPC = exports.WASI_ENOPROTOOPT = void 0, exports.RIGHTS_REGULAR_FILE_BASE = exports.RIGHTS_CHARACTER_DEVICE_INHERITING = exports.RIGHTS_CHARACTER_DEVICE_BASE = exports.RIGHTS_BLOCK_DEVICE_INHERITING = exports.RIGHTS_BLOCK_DEVICE_BASE = exports.RIGHTS_ALL = exports.WASI_RIGHT_SOCK_SHUTDOWN = exports.WASI_RIGHT_POLL_FD_READWRITE = exports.WASI_RIGHT_PATH_UNLINK_FILE = exports.WASI_RIGHT_PATH_REMOVE_DIRECTORY = exports.WASI_RIGHT_PATH_SYMLINK = exports.WASI_RIGHT_FD_FILESTAT_SET_TIMES = exports.WASI_RIGHT_FD_FILESTAT_SET_SIZE = exports.WASI_RIGHT_FD_FILESTAT_GET = exports.WASI_RIGHT_PATH_FILESTAT_SET_TIMES = exports.WASI_RIGHT_PATH_FILESTAT_SET_SIZE = exports.WASI_RIGHT_PATH_FILESTAT_GET = exports.WASI_RIGHT_PATH_RENAME_TARGET = exports.WASI_RIGHT_PATH_RENAME_SOURCE = exports.WASI_RIGHT_PATH_READLINK = exports.WASI_RIGHT_FD_READDIR = exports.WASI_RIGHT_PATH_OPEN = exports.WASI_RIGHT_PATH_LINK_TARGET = exports.WASI_RIGHT_PATH_LINK_SOURCE = exports.WASI_RIGHT_PATH_CREATE_FILE = exports.WASI_RIGHT_PATH_CREATE_DIRECTORY = exports.WASI_RIGHT_FD_ALLOCATE = exports.WASI_RIGHT_FD_ADVISE = exports.WASI_RIGHT_FD_WRITE = exports.WASI_RIGHT_FD_TELL = exports.WASI_RIGHT_FD_SYNC = exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS = exports.WASI_RIGHT_FD_SEEK = exports.WASI_RIGHT_FD_READ = exports.WASI_RIGHT_FD_DATASYNC = exports.WASI_FDFLAG_SYNC = exports.WASI_FDFLAG_RSYNC = exports.WASI_FDFLAG_NONBLOCK = exports.WASI_FDFLAG_DSYNC = exports.WASI_FDFLAG_APPEND = exports.WASI_FILETYPE_SYMBOLIC_LINK = exports.WASI_FILETYPE_SOCKET_STREAM = exports.WASI_FILETYPE_SOCKET_DGRAM = exports.WASI_FILETYPE_REGULAR_FILE = exports.WASI_FILETYPE_DIRECTORY = exports.WASI_FILETYPE_CHARACTER_DEVICE = exports.WASI_FILETYPE_BLOCK_DEVICE = exports.WASI_FILETYPE_UNKNOWN = exports.WASI_SIGXFSZ = exports.WASI_SIGXCPU = void 0, exports.SIGNAL_MAP = exports.ERROR_MAP = exports.WASI_WHENCE_END = exports.WASI_WHENCE_CUR = exports.WASI_WHENCE_SET = exports.WASI_STDERR_FILENO = exports.WASI_STDOUT_FILENO = exports.WASI_STDIN_FILENO = exports.WASI_DIRCOOKIE_START = exports.WASI_PREOPENTYPE_DIR = exports.WASI_O_TRUNC = exports.WASI_O_EXCL = exports.WASI_O_DIRECTORY = exports.WASI_O_CREAT = exports.WASI_FILESTAT_SET_MTIM_NOW = exports.WASI_FILESTAT_SET_MTIM = exports.WASI_FILESTAT_SET_ATIM_NOW = exports.WASI_FILESTAT_SET_ATIM = exports.WASI_EVENTTYPE_FD_WRITE = exports.WASI_EVENTTYPE_FD_READ = exports.WASI_EVENTTYPE_CLOCK = exports.WASI_CLOCK_THREAD_CPUTIME_ID = exports.WASI_CLOCK_PROCESS_CPUTIME_ID = exports.WASI_CLOCK_MONOTONIC = exports.WASI_CLOCK_REALTIME = exports.RIGHTS_TTY_INHERITING = exports.RIGHTS_TTY_BASE = exports.RIGHTS_SOCKET_INHERITING = exports.RIGHTS_SOCKET_BASE = exports.RIGHTS_DIRECTORY_INHERITING = exports.RIGHTS_DIRECTORY_BASE = exports.RIGHTS_REGULAR_FILE_INHERITING = void 0, exports.WASI_ESUCCESS = 0, exports.WASI_E2BIG = 1, exports.WASI_EACCES = 2, exports.WASI_EADDRINUSE = 3, exports.WASI_EADDRNOTAVAIL = 4, exports.WASI_EAFNOSUPPORT = 5, exports.WASI_EAGAIN = 6, exports.WASI_EALREADY = 7, exports.WASI_EBADF = 8, exports.WASI_EBADMSG = 9, exports.WASI_EBUSY = 10, exports.WASI_ECANCELED = 11, exports.WASI_ECHILD = 12, exports.WASI_ECONNABORTED = 13, exports.WASI_ECONNREFUSED = 14, exports.WASI_ECONNRESET = 15, exports.WASI_EDEADLK = 16, exports.WASI_EDESTADDRREQ = 17, exports.WASI_EDOM = 18, exports.WASI_EDQUOT = 19, exports.WASI_EEXIST = 20, exports.WASI_EFAULT = 21, exports.WASI_EFBIG = 22, exports.WASI_EHOSTUNREACH = 23, exports.WASI_EIDRM = 24, exports.WASI_EILSEQ = 25, exports.WASI_EINPROGRESS = 26, exports.WASI_EINTR = 27, exports.WASI_EINVAL = 28, exports.WASI_EIO = 29, exports.WASI_EISCONN = 30, exports.WASI_EISDIR = 31, exports.WASI_ELOOP = 32, exports.WASI_EMFILE = 33, exports.WASI_EMLINK = 34, exports.WASI_EMSGSIZE = 35, exports.WASI_EMULTIHOP = 36, exports.WASI_ENAMETOOLONG = 37, exports.WASI_ENETDOWN = 38, exports.WASI_ENETRESET = 39, exports.WASI_ENETUNREACH = 40, exports.WASI_ENFILE = 41, exports.WASI_ENOBUFS = 42, exports.WASI_ENODEV = 43, exports.WASI_ENOENT = 44, exports.WASI_ENOEXEC = 45, exports.WASI_ENOLCK = 46, exports.WASI_ENOLINK = 47, exports.WASI_ENOMEM = 48, exports.WASI_ENOMSG = 49, exports.WASI_ENOPROTOOPT = 50, exports.WASI_ENOSPC = 51, exports.WASI_ENOSYS = 52, exports.WASI_ENOTCONN = 53, exports.WASI_ENOTDIR = 54, exports.WASI_ENOTEMPTY = 55, exports.WASI_ENOTRECOVERABLE = 56, exports.WASI_ENOTSOCK = 57, exports.WASI_ENOTSUP = 58, exports.WASI_ENOTTY = 59, exports.WASI_ENXIO = 60, exports.WASI_EOVERFLOW = 61, exports.WASI_EOWNERDEAD = 62, exports.WASI_EPERM = 63, exports.WASI_EPIPE = 64, exports.WASI_EPROTO = 65, exports.WASI_EPROTONOSUPPORT = 66, exports.WASI_EPROTOTYPE = 67, exports.WASI_ERANGE = 68, exports.WASI_EROFS = 69, exports.WASI_ESPIPE = 70, exports.WASI_ESRCH = 71, exports.WASI_ESTALE = 72, exports.WASI_ETIMEDOUT = 73, exports.WASI_ETXTBSY = 74, exports.WASI_EXDEV = 75, exports.WASI_ENOTCAPABLE = 76, exports.WASI_SIGABRT = 0, exports.WASI_SIGALRM = 1, exports.WASI_SIGBUS = 2, exports.WASI_SIGCHLD = 3, exports.WASI_SIGCONT = 4, exports.WASI_SIGFPE = 5, exports.WASI_SIGHUP = 6, exports.WASI_SIGILL = 7, exports.WASI_SIGINT = 8, exports.WASI_SIGKILL = 9, exports.WASI_SIGPIPE = 10, exports.WASI_SIGQUIT = 11, exports.WASI_SIGSEGV = 12, exports.WASI_SIGSTOP = 13, exports.WASI_SIGTERM = 14, exports.WASI_SIGTRAP = 15, exports.WASI_SIGTSTP = 16, exports.WASI_SIGTTIN = 17, exports.WASI_SIGTTOU = 18, exports.WASI_SIGURG = 19, exports.WASI_SIGUSR1 = 20, exports.WASI_SIGUSR2 = 21, exports.WASI_SIGVTALRM = 22, exports.WASI_SIGXCPU = 23, exports.WASI_SIGXFSZ = 24, exports.WASI_FILETYPE_UNKNOWN = 0, exports.WASI_FILETYPE_BLOCK_DEVICE = 1, exports.WASI_FILETYPE_CHARACTER_DEVICE = 2, exports.WASI_FILETYPE_DIRECTORY = 3, exports.WASI_FILETYPE_REGULAR_FILE = 4, exports.WASI_FILETYPE_SOCKET_DGRAM = 5, exports.WASI_FILETYPE_SOCKET_STREAM = 6, exports.WASI_FILETYPE_SYMBOLIC_LINK = 7, exports.WASI_FDFLAG_APPEND = 1, exports.WASI_FDFLAG_DSYNC = 2, exports.WASI_FDFLAG_NONBLOCK = 4, exports.WASI_FDFLAG_RSYNC = 8, exports.WASI_FDFLAG_SYNC = 16, exports.WASI_RIGHT_FD_DATASYNC = BigInt(1), exports.WASI_RIGHT_FD_READ = BigInt(2), exports.WASI_RIGHT_FD_SEEK = BigInt(4), exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS = BigInt(8), exports.WASI_RIGHT_FD_SYNC = BigInt(16), exports.WASI_RIGHT_FD_TELL = BigInt(32), exports.WASI_RIGHT_FD_WRITE = BigInt(64), exports.WASI_RIGHT_FD_ADVISE = BigInt(128), exports.WASI_RIGHT_FD_ALLOCATE = BigInt(256), exports.WASI_RIGHT_PATH_CREATE_DIRECTORY = BigInt(512), exports.WASI_RIGHT_PATH_CREATE_FILE = BigInt(1024), exports.WASI_RIGHT_PATH_LINK_SOURCE = BigInt(2048), exports.WASI_RIGHT_PATH_LINK_TARGET = BigInt(4096), exports.WASI_RIGHT_PATH_OPEN = BigInt(8192), exports.WASI_RIGHT_FD_READDIR = BigInt(16384), exports.WASI_RIGHT_PATH_READLINK = BigInt(32768), exports.WASI_RIGHT_PATH_RENAME_SOURCE = BigInt(65536), exports.WASI_RIGHT_PATH_RENAME_TARGET = BigInt(131072), exports.WASI_RIGHT_PATH_FILESTAT_GET = BigInt(262144), exports.WASI_RIGHT_PATH_FILESTAT_SET_SIZE = BigInt(524288), exports.WASI_RIGHT_PATH_FILESTAT_SET_TIMES = BigInt(1048576), exports.WASI_RIGHT_FD_FILESTAT_GET = BigInt(2097152), exports.WASI_RIGHT_FD_FILESTAT_SET_SIZE = BigInt(4194304), exports.WASI_RIGHT_FD_FILESTAT_SET_TIMES = BigInt(8388608), exports.WASI_RIGHT_PATH_SYMLINK = BigInt(16777216), exports.WASI_RIGHT_PATH_REMOVE_DIRECTORY = BigInt(33554432), exports.WASI_RIGHT_PATH_UNLINK_FILE = BigInt(67108864), exports.WASI_RIGHT_POLL_FD_READWRITE = BigInt(134217728), exports.WASI_RIGHT_SOCK_SHUTDOWN = BigInt(268435456), exports.RIGHTS_ALL = exports.WASI_RIGHT_FD_DATASYNC | exports.WASI_RIGHT_FD_READ | exports.WASI_RIGHT_FD_SEEK | exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS | exports.WASI_RIGHT_FD_SYNC | exports.WASI_RIGHT_FD_TELL | exports.WASI_RIGHT_FD_WRITE | exports.WASI_RIGHT_FD_ADVISE | exports.WASI_RIGHT_FD_ALLOCATE | exports.WASI_RIGHT_PATH_CREATE_DIRECTORY | exports.WASI_RIGHT_PATH_CREATE_FILE | exports.WASI_RIGHT_PATH_LINK_SOURCE | exports.WASI_RIGHT_PATH_LINK_TARGET | exports.WASI_RIGHT_PATH_OPEN | exports.WASI_RIGHT_FD_READDIR | exports.WASI_RIGHT_PATH_READLINK | exports.WASI_RIGHT_PATH_RENAME_SOURCE | exports.WASI_RIGHT_PATH_RENAME_TARGET | exports.WASI_RIGHT_PATH_FILESTAT_GET | exports.WASI_RIGHT_PATH_FILESTAT_SET_SIZE | exports.WASI_RIGHT_PATH_FILESTAT_SET_TIMES | exports.WASI_RIGHT_FD_FILESTAT_GET | exports.WASI_RIGHT_FD_FILESTAT_SET_TIMES | exports.WASI_RIGHT_FD_FILESTAT_SET_SIZE | exports.WASI_RIGHT_PATH_SYMLINK | exports.WASI_RIGHT_PATH_UNLINK_FILE | exports.WASI_RIGHT_PATH_REMOVE_DIRECTORY | exports.WASI_RIGHT_POLL_FD_READWRITE | exports.WASI_RIGHT_SOCK_SHUTDOWN, exports.RIGHTS_BLOCK_DEVICE_BASE = exports.RIGHTS_ALL, exports.RIGHTS_BLOCK_DEVICE_INHERITING = exports.RIGHTS_ALL, exports.RIGHTS_CHARACTER_DEVICE_BASE = exports.RIGHTS_ALL, exports.RIGHTS_CHARACTER_DEVICE_INHERITING = exports.RIGHTS_ALL, exports.RIGHTS_REGULAR_FILE_BASE = exports.WASI_RIGHT_FD_DATASYNC | exports.WASI_RIGHT_FD_READ | exports.WASI_RIGHT_FD_SEEK | exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS | exports.WASI_RIGHT_FD_SYNC | exports.WASI_RIGHT_FD_TELL | exports.WASI_RIGHT_FD_WRITE | exports.WASI_RIGHT_FD_ADVISE | exports.WASI_RIGHT_FD_ALLOCATE | exports.WASI_RIGHT_FD_FILESTAT_GET | exports.WASI_RIGHT_FD_FILESTAT_SET_SIZE | exports.WASI_RIGHT_FD_FILESTAT_SET_TIMES | exports.WASI_RIGHT_POLL_FD_READWRITE, exports.RIGHTS_REGULAR_FILE_INHERITING = BigInt(0), exports.RIGHTS_DIRECTORY_BASE = exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS | exports.WASI_RIGHT_FD_SYNC | exports.WASI_RIGHT_FD_ADVISE | exports.WASI_RIGHT_PATH_CREATE_DIRECTORY | exports.WASI_RIGHT_PATH_CREATE_FILE | exports.WASI_RIGHT_PATH_LINK_SOURCE | exports.WASI_RIGHT_PATH_LINK_TARGET | exports.WASI_RIGHT_PATH_OPEN | exports.WASI_RIGHT_FD_READDIR | exports.WASI_RIGHT_PATH_READLINK | exports.WASI_RIGHT_PATH_RENAME_SOURCE | exports.WASI_RIGHT_PATH_RENAME_TARGET | exports.WASI_RIGHT_PATH_FILESTAT_GET | exports.WASI_RIGHT_PATH_FILESTAT_SET_SIZE | exports.WASI_RIGHT_PATH_FILESTAT_SET_TIMES | exports.WASI_RIGHT_FD_FILESTAT_GET | exports.WASI_RIGHT_FD_FILESTAT_SET_TIMES | exports.WASI_RIGHT_PATH_SYMLINK | exports.WASI_RIGHT_PATH_UNLINK_FILE | exports.WASI_RIGHT_PATH_REMOVE_DIRECTORY | exports.WASI_RIGHT_POLL_FD_READWRITE, exports.RIGHTS_DIRECTORY_INHERITING = exports.RIGHTS_DIRECTORY_BASE | exports.RIGHTS_REGULAR_FILE_BASE, exports.RIGHTS_SOCKET_BASE = exports.WASI_RIGHT_FD_READ | exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS | exports.WASI_RIGHT_FD_WRITE | exports.WASI_RIGHT_FD_FILESTAT_GET | exports.WASI_RIGHT_POLL_FD_READWRITE | exports.WASI_RIGHT_SOCK_SHUTDOWN, exports.RIGHTS_SOCKET_INHERITING = exports.RIGHTS_ALL, exports.RIGHTS_TTY_BASE = exports.WASI_RIGHT_FD_READ | exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS | exports.WASI_RIGHT_FD_WRITE | exports.WASI_RIGHT_FD_FILESTAT_GET | exports.WASI_RIGHT_POLL_FD_READWRITE, exports.RIGHTS_TTY_INHERITING = BigInt(0), exports.WASI_CLOCK_REALTIME = 0, exports.WASI_CLOCK_MONOTONIC = 1, exports.WASI_CLOCK_PROCESS_CPUTIME_ID = 2, exports.WASI_CLOCK_THREAD_CPUTIME_ID = 3, exports.WASI_EVENTTYPE_CLOCK = 0, exports.WASI_EVENTTYPE_FD_READ = 1, exports.WASI_EVENTTYPE_FD_WRITE = 2, exports.WASI_FILESTAT_SET_ATIM = 1 << 0, exports.WASI_FILESTAT_SET_ATIM_NOW = 1 << 1, exports.WASI_FILESTAT_SET_MTIM = 1 << 2, exports.WASI_FILESTAT_SET_MTIM_NOW = 1 << 3, exports.WASI_O_CREAT = 1 << 0, exports.WASI_O_DIRECTORY = 1 << 1, exports.WASI_O_EXCL = 1 << 2, exports.WASI_O_TRUNC = 1 << 3, exports.WASI_PREOPENTYPE_DIR = 0, exports.WASI_DIRCOOKIE_START = 0, exports.WASI_STDIN_FILENO = 0, exports.WASI_STDOUT_FILENO = 1, exports.WASI_STDERR_FILENO = 2, exports.WASI_WHENCE_SET = 0, exports.WASI_WHENCE_CUR = 1, exports.WASI_WHENCE_END = 2, exports.ERROR_MAP = {\n E2BIG: exports.WASI_E2BIG,\n EACCES: exports.WASI_EACCES,\n EADDRINUSE: exports.WASI_EADDRINUSE,\n EADDRNOTAVAIL: exports.WASI_EADDRNOTAVAIL,\n EAFNOSUPPORT: exports.WASI_EAFNOSUPPORT,\n EALREADY: exports.WASI_EALREADY,\n EAGAIN: exports.WASI_EAGAIN,\n EBADF: exports.WASI_EBADF,\n EBADMSG: exports.WASI_EBADMSG,\n EBUSY: exports.WASI_EBUSY,\n ECANCELED: exports.WASI_ECANCELED,\n ECHILD: exports.WASI_ECHILD,\n ECONNABORTED: exports.WASI_ECONNABORTED,\n ECONNREFUSED: exports.WASI_ECONNREFUSED,\n ECONNRESET: exports.WASI_ECONNRESET,\n EDEADLOCK: exports.WASI_EDEADLK,\n EDESTADDRREQ: exports.WASI_EDESTADDRREQ,\n EDOM: exports.WASI_EDOM,\n EDQUOT: exports.WASI_EDQUOT,\n EEXIST: exports.WASI_EEXIST,\n EFAULT: exports.WASI_EFAULT,\n EFBIG: exports.WASI_EFBIG,\n EHOSTDOWN: exports.WASI_EHOSTUNREACH,\n EHOSTUNREACH: exports.WASI_EHOSTUNREACH,\n EIDRM: exports.WASI_EIDRM,\n EILSEQ: exports.WASI_EILSEQ,\n EINPROGRESS: exports.WASI_EINPROGRESS,\n EINTR: exports.WASI_EINTR,\n EINVAL: exports.WASI_EINVAL,\n EIO: exports.WASI_EIO,\n EISCONN: exports.WASI_EISCONN,\n EISDIR: exports.WASI_EISDIR,\n ELOOP: exports.WASI_ELOOP,\n EMFILE: exports.WASI_EMFILE,\n EMLINK: exports.WASI_EMLINK,\n EMSGSIZE: exports.WASI_EMSGSIZE,\n EMULTIHOP: exports.WASI_EMULTIHOP,\n ENAMETOOLONG: exports.WASI_ENAMETOOLONG,\n ENETDOWN: exports.WASI_ENETDOWN,\n ENETRESET: exports.WASI_ENETRESET,\n ENETUNREACH: exports.WASI_ENETUNREACH,\n ENFILE: exports.WASI_ENFILE,\n ENOBUFS: exports.WASI_ENOBUFS,\n ENODEV: exports.WASI_ENODEV,\n ENOENT: exports.WASI_ENOENT,\n ENOEXEC: exports.WASI_ENOEXEC,\n ENOLCK: exports.WASI_ENOLCK,\n ENOLINK: exports.WASI_ENOLINK,\n ENOMEM: exports.WASI_ENOMEM,\n ENOMSG: exports.WASI_ENOMSG,\n ENOPROTOOPT: exports.WASI_ENOPROTOOPT,\n ENOSPC: exports.WASI_ENOSPC,\n ENOSYS: exports.WASI_ENOSYS,\n ENOTCONN: exports.WASI_ENOTCONN,\n ENOTDIR: exports.WASI_ENOTDIR,\n ENOTEMPTY: exports.WASI_ENOTEMPTY,\n ENOTRECOVERABLE: exports.WASI_ENOTRECOVERABLE,\n ENOTSOCK: exports.WASI_ENOTSOCK,\n ENOTTY: exports.WASI_ENOTTY,\n ENXIO: exports.WASI_ENXIO,\n EOVERFLOW: exports.WASI_EOVERFLOW,\n EOWNERDEAD: exports.WASI_EOWNERDEAD,\n EPERM: exports.WASI_EPERM,\n EPIPE: exports.WASI_EPIPE,\n EPROTO: exports.WASI_EPROTO,\n EPROTONOSUPPORT: exports.WASI_EPROTONOSUPPORT,\n EPROTOTYPE: exports.WASI_EPROTOTYPE,\n ERANGE: exports.WASI_ERANGE,\n EROFS: exports.WASI_EROFS,\n ESPIPE: exports.WASI_ESPIPE,\n ESRCH: exports.WASI_ESRCH,\n ESTALE: exports.WASI_ESTALE,\n ETIMEDOUT: exports.WASI_ETIMEDOUT,\n ETXTBSY: exports.WASI_ETXTBSY,\n EXDEV: exports.WASI_EXDEV\n }, exports.SIGNAL_MAP = {\n [exports.WASI_SIGHUP]: \"SIGHUP\",\n [exports.WASI_SIGINT]: \"SIGINT\",\n [exports.WASI_SIGQUIT]: \"SIGQUIT\",\n [exports.WASI_SIGILL]: \"SIGILL\",\n [exports.WASI_SIGTRAP]: \"SIGTRAP\",\n [exports.WASI_SIGABRT]: \"SIGABRT\",\n [exports.WASI_SIGBUS]: \"SIGBUS\",\n [exports.WASI_SIGFPE]: \"SIGFPE\",\n [exports.WASI_SIGKILL]: \"SIGKILL\",\n [exports.WASI_SIGUSR1]: \"SIGUSR1\",\n [exports.WASI_SIGSEGV]: \"SIGSEGV\",\n [exports.WASI_SIGUSR2]: \"SIGUSR2\",\n [exports.WASI_SIGPIPE]: \"SIGPIPE\",\n [exports.WASI_SIGALRM]: \"SIGALRM\",\n [exports.WASI_SIGTERM]: \"SIGTERM\",\n [exports.WASI_SIGCHLD]: \"SIGCHLD\",\n [exports.WASI_SIGCONT]: \"SIGCONT\",\n [exports.WASI_SIGSTOP]: \"SIGSTOP\",\n [exports.WASI_SIGTSTP]: \"SIGTSTP\",\n [exports.WASI_SIGTTIN]: \"SIGTTIN\",\n [exports.WASI_SIGTTOU]: \"SIGTTOU\",\n [exports.WASI_SIGURG]: \"SIGURG\",\n [exports.WASI_SIGXCPU]: \"SIGXCPU\",\n [exports.WASI_SIGXFSZ]: \"SIGXFSZ\",\n [exports.WASI_SIGVTALRM]: \"SIGVTALRM\"\n };\n }\n}), require_wasi = __commonJS({\n \"node_modules/wasi-js/dist/wasi.js\"(exports) {\n var __importDefault = exports && exports.__importDefault || function(mod) {\n return mod && mod.__esModule \? mod : { default: mod };\n };\n let fs;\n Object.defineProperty(exports, \"__esModule\", { value: !0 }), exports.SOCKET_DEFAULT_RIGHTS = void 0;\n var log = () => {\n }, logOpen = () => {\n }, SC_OPEN_MAX = 32768, types_1 = require_types(), constants_1 = require_constants(), STDIN_DEFAULT_RIGHTS = constants_1.WASI_RIGHT_FD_DATASYNC | constants_1.WASI_RIGHT_FD_READ | constants_1.WASI_RIGHT_FD_SYNC | constants_1.WASI_RIGHT_FD_ADVISE | constants_1.WASI_RIGHT_FD_FILESTAT_GET | constants_1.WASI_RIGHT_POLL_FD_READWRITE, STDOUT_DEFAULT_RIGHTS = constants_1.WASI_RIGHT_FD_DATASYNC | constants_1.WASI_RIGHT_FD_WRITE | constants_1.WASI_RIGHT_FD_SYNC | constants_1.WASI_RIGHT_FD_ADVISE | constants_1.WASI_RIGHT_FD_FILESTAT_GET | constants_1.WASI_RIGHT_POLL_FD_READWRITE, STDERR_DEFAULT_RIGHTS = STDOUT_DEFAULT_RIGHTS;\n exports.SOCKET_DEFAULT_RIGHTS = constants_1.WASI_RIGHT_FD_DATASYNC | constants_1.WASI_RIGHT_FD_READ | constants_1.WASI_RIGHT_FD_WRITE | constants_1.WASI_RIGHT_FD_ADVISE | constants_1.WASI_RIGHT_FD_FILESTAT_GET | constants_1.WASI_RIGHT_POLL_FD_READWRITE | constants_1.WASI_RIGHT_FD_FDSTAT_SET_FLAGS;\n var msToNs = (ms) => {\n const msInt = Math.trunc(ms), decimal = BigInt(Math.round((ms - msInt) * 1e6));\n return BigInt(msInt) * BigInt(1e6) + decimal;\n }, nsToMs = (ns) => {\n if (typeof ns === \"number\")\n ns = Math.trunc(ns);\n const nsInt = BigInt(ns);\n return Number(nsInt / BigInt(1e6));\n }, wrap = (f) => (...args) => {\n try {\n return f(...args);\n } catch (err) {\n let e = err;\n while (e.prev != null)\n e = e.prev;\n if (e\?.code && typeof e\?.code === \"string\")\n return constants_1.ERROR_MAP[e.code] || constants_1.WASI_EINVAL;\n if (e instanceof types_1.WASIError)\n return e.errno;\n throw e;\n }\n }, stat = (wasi, fd) => {\n const entry = wasi.FD_MAP.get(fd);\n if (!entry)\n throw new types_1.WASIError(constants_1.WASI_EBADF);\n if (entry.filetype === void 0) {\n const stats = wasi.fstatSync(entry.real), { filetype, rightsBase, rightsInheriting } = translateFileAttributes(wasi, fd, stats);\n if (entry.filetype = filetype, !entry.rights)\n entry.rights = {\n base: rightsBase,\n inheriting: rightsInheriting\n };\n }\n return entry;\n }, translateFileAttributes = (wasi, fd, stats) => {\n switch (!0) {\n case stats.isBlockDevice():\n return {\n filetype: constants_1.WASI_FILETYPE_BLOCK_DEVICE,\n rightsBase: constants_1.RIGHTS_BLOCK_DEVICE_BASE,\n rightsInheriting: constants_1.RIGHTS_BLOCK_DEVICE_INHERITING\n };\n case stats.isCharacterDevice(): {\n const filetype = constants_1.WASI_FILETYPE_CHARACTER_DEVICE;\n if (fd !== void 0 && wasi.bindings.isTTY(fd))\n return {\n filetype,\n rightsBase: constants_1.RIGHTS_TTY_BASE,\n rightsInheriting: constants_1.RIGHTS_TTY_INHERITING\n };\n return {\n filetype,\n rightsBase: constants_1.RIGHTS_CHARACTER_DEVICE_BASE,\n rightsInheriting: constants_1.RIGHTS_CHARACTER_DEVICE_INHERITING\n };\n }\n case stats.isDirectory():\n return {\n filetype: constants_1.WASI_FILETYPE_DIRECTORY,\n rightsBase: constants_1.RIGHTS_DIRECTORY_BASE,\n rightsInheriting: constants_1.RIGHTS_DIRECTORY_INHERITING\n };\n case stats.isFIFO():\n return {\n filetype: constants_1.WASI_FILETYPE_SOCKET_STREAM,\n rightsBase: constants_1.RIGHTS_SOCKET_BASE,\n rightsInheriting: constants_1.RIGHTS_SOCKET_INHERITING\n };\n case stats.isFile():\n return {\n filetype: constants_1.WASI_FILETYPE_REGULAR_FILE,\n rightsBase: constants_1.RIGHTS_REGULAR_FILE_BASE,\n rightsInheriting: constants_1.RIGHTS_REGULAR_FILE_INHERITING\n };\n case stats.isSocket():\n return {\n filetype: constants_1.WASI_FILETYPE_SOCKET_STREAM,\n rightsBase: constants_1.RIGHTS_SOCKET_BASE,\n rightsInheriting: constants_1.RIGHTS_SOCKET_INHERITING\n };\n case stats.isSymbolicLink():\n return {\n filetype: constants_1.WASI_FILETYPE_SYMBOLIC_LINK,\n rightsBase: BigInt(0),\n rightsInheriting: BigInt(0)\n };\n default:\n return {\n filetype: constants_1.WASI_FILETYPE_UNKNOWN,\n rightsBase: BigInt(0),\n rightsInheriting: BigInt(0)\n };\n }\n }, warnedAboutSleep = !1, defaultConfig;\n function getDefaults() {\n if (defaultConfig)\n return defaultConfig;\n const defaultBindings = {\n hrtime: () => process.hrtime.bigint(),\n exit: (code) => {\n process.exit(code);\n },\n kill: (signal) => {\n process.kill(process.pid, signal);\n },\n randomFillSync: (array) => crypto.getRandomValues(array),\n isTTY: (fd) => (@getInternalField(@internalModuleRegistry, 46) || @createInternalModuleById(46)).isatty(fd),\n fs: Bun.fs(),\n path: @getInternalField(@internalModuleRegistry, 30) || @createInternalModuleById(30)\n };\n return defaultConfig = {\n args: [],\n env: {},\n preopens: {},\n bindings: defaultBindings,\n sleep: (ms) => {\n Bun.sleepSync(ms);\n }\n };\n }\n var WASI = class WASI2 {\n constructor(wasiConfig = {}) {\n const defaultConfig2 = getDefaults();\n this.lastStdin = 0, this.sleep = wasiConfig.sleep || defaultConfig2.sleep, this.getStdin = wasiConfig.getStdin, this.sendStdout = wasiConfig.sendStdout, this.sendStderr = wasiConfig.sendStderr;\n let preopens = wasiConfig.preopens \?\? defaultConfig2.preopens;\n this.env = wasiConfig.env \?\? defaultConfig2.env;\n const args = wasiConfig.args \?\? defaultConfig2.args;\n this.memory = void 0, this.view = void 0, this.bindings = wasiConfig.bindings || defaultConfig2.bindings;\n const bindings2 = this.bindings;\n fs = bindings2.fs, this.FD_MAP = new Map([\n [\n constants_1.WASI_STDIN_FILENO,\n {\n real: 0,\n filetype: constants_1.WASI_FILETYPE_CHARACTER_DEVICE,\n rights: {\n base: STDIN_DEFAULT_RIGHTS,\n inheriting: BigInt(0)\n },\n path: \"/dev/stdin\"\n }\n ],\n [\n constants_1.WASI_STDOUT_FILENO,\n {\n real: 1,\n filetype: constants_1.WASI_FILETYPE_CHARACTER_DEVICE,\n rights: {\n base: STDOUT_DEFAULT_RIGHTS,\n inheriting: BigInt(0)\n },\n path: \"/dev/stdout\"\n }\n ],\n [\n constants_1.WASI_STDERR_FILENO,\n {\n real: 2,\n filetype: constants_1.WASI_FILETYPE_CHARACTER_DEVICE,\n rights: {\n base: STDERR_DEFAULT_RIGHTS,\n inheriting: BigInt(0)\n },\n path: \"/dev/stderr\"\n }\n ]\n ]);\n const path = bindings2.path;\n for (let [k, v] of Object.entries(preopens)) {\n const real = fs.openSync(v, nodeFsConstants.O_RDONLY), newfd = this.getUnusedFileDescriptor();\n this.FD_MAP.set(newfd, {\n real,\n filetype: constants_1.WASI_FILETYPE_DIRECTORY,\n rights: {\n base: constants_1.RIGHTS_DIRECTORY_BASE,\n inheriting: constants_1.RIGHTS_DIRECTORY_INHERITING\n },\n fakePath: k,\n path: v\n });\n }\n const getiovs = (iovs, iovsLen) => {\n this.refreshMemory();\n const { view, memory } = this, { buffer } = memory, { byteLength } = buffer;\n if (iovsLen === 1) {\n const ptr = iovs, buf = view.getUint32(ptr, !0);\n let bufLen = view.getUint32(ptr + 4, !0);\n if (bufLen > byteLength - buf)\n console.log({\n buf,\n bufLen,\n total_memory: byteLength\n }), log(\"getiovs: warning -- truncating buffer to fit in memory\"), bufLen = Math.min(bufLen, Math.max(0, byteLength - buf));\n try {\n return [new @Uint8Array(buffer, buf, bufLen)];\n } catch (err) {\n throw console.warn(\"WASI.getiovs -- invalid buffer\", err), new types_1.WASIError(constants_1.WASI_EINVAL);\n }\n }\n const buffers = [];\n buffers.length = iovsLen;\n for (let i = 0, ptr = iovs;i < iovsLen; i++, ptr += 8) {\n const buf = view.getUint32(ptr, !0);\n let bufLen = view.getUint32(ptr + 4, !0);\n if (bufLen > byteLength - buf)\n console.log({\n buf,\n bufLen,\n total_memory: byteLength\n }), log(\"getiovs: warning -- truncating buffer to fit in memory\"), bufLen = Math.min(bufLen, Math.max(0, byteLength - buf));\n try {\n buffers[i] = new @Uint8Array(buffer, buf, bufLen);\n } catch (err) {\n throw console.warn(\"WASI.getiovs -- invalid buffer\", err), new types_1.WASIError(constants_1.WASI_EINVAL);\n }\n }\n return buffers;\n }, CHECK_FD = (fd, rights) => {\n const stats = stat(this, fd);\n if (rights !== BigInt(0) && (stats.rights.base & rights) === BigInt(0))\n throw new types_1.WASIError(constants_1.WASI_EPERM);\n return stats;\n }, CPUTIME_START = Bun.nanoseconds(), timeOrigin = Math.trunc(performance.timeOrigin * 1e6), now = (clockId) => {\n switch (clockId) {\n case constants_1.WASI_CLOCK_MONOTONIC:\n return Bun.nanoseconds();\n case constants_1.WASI_CLOCK_REALTIME:\n return Bun.nanoseconds() + timeOrigin;\n case constants_1.WASI_CLOCK_PROCESS_CPUTIME_ID:\n case constants_1.WASI_CLOCK_THREAD_CPUTIME_ID:\n return Bun.nanoseconds() - CPUTIME_START;\n default:\n return null;\n }\n };\n if (this.wasiImport = {\n args_get: (argv, argvBuf) => {\n this.refreshMemory();\n let coffset = argv, offset = argvBuf;\n return args.forEach((a) => {\n this.view.setUint32(coffset, offset, !0), coffset += 4, offset += @Buffer.from(this.memory.buffer).write(`${a}\\0`, offset);\n }), constants_1.WASI_ESUCCESS;\n },\n args_sizes_get: (argc, argvBufSize) => {\n this.refreshMemory(), this.view.setUint32(argc, args.length, !0);\n const size = args.reduce((acc, a) => acc + @Buffer.byteLength(a) + 1, 0);\n return this.view.setUint32(argvBufSize, size, !0), constants_1.WASI_ESUCCESS;\n },\n environ_get: (environ, environBuf) => {\n this.refreshMemory();\n let coffset = environ, offset = environBuf;\n return Object.entries(this.env).forEach(([key, value]) => {\n this.view.setUint32(coffset, offset, !0), coffset += 4, offset += @Buffer.from(this.memory.buffer).write(`${key}=${value}\\0`, offset);\n }), constants_1.WASI_ESUCCESS;\n },\n environ_sizes_get: (environCount, environBufSize) => {\n this.refreshMemory();\n const envProcessed = Object.entries(this.env).map(([key, value]) => `${key}=${value}\\0`), size = envProcessed.reduce((acc, e) => acc + @Buffer.byteLength(e), 0);\n return this.view.setUint32(environCount, envProcessed.length, !0), this.view.setUint32(environBufSize, size, !0), constants_1.WASI_ESUCCESS;\n },\n clock_res_get: (clockId, resolution) => {\n let res;\n switch (clockId) {\n case constants_1.WASI_CLOCK_MONOTONIC:\n case constants_1.WASI_CLOCK_PROCESS_CPUTIME_ID:\n case constants_1.WASI_CLOCK_THREAD_CPUTIME_ID: {\n res = BigInt(1);\n break;\n }\n case constants_1.WASI_CLOCK_REALTIME: {\n res = BigInt(1000);\n break;\n }\n }\n if (!res)\n throw Error(\"invalid clockId\");\n return this.view.setBigUint64(resolution, res), constants_1.WASI_ESUCCESS;\n },\n clock_time_get: (clockId, _precision, time) => {\n this.refreshMemory();\n const n = now(clockId);\n if (n === null)\n return constants_1.WASI_EINVAL;\n return this.view.setBigUint64(time, BigInt(n), !0), constants_1.WASI_ESUCCESS;\n },\n fd_advise: wrap((fd, _offset, _len, _advice) => {\n return CHECK_FD(fd, constants_1.WASI_RIGHT_FD_ADVISE), constants_1.WASI_ENOSYS;\n }),\n fd_allocate: wrap((fd, _offset, _len) => {\n return CHECK_FD(fd, constants_1.WASI_RIGHT_FD_ALLOCATE), constants_1.WASI_ENOSYS;\n }),\n fd_close: wrap((fd) => {\n const stats = CHECK_FD(fd, BigInt(0));\n return fs.closeSync(stats.real), this.FD_MAP.delete(fd), constants_1.WASI_ESUCCESS;\n }),\n fd_datasync: wrap((fd) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_DATASYNC);\n return fs.fdatasyncSync(stats.real), constants_1.WASI_ESUCCESS;\n }),\n fd_fdstat_get: wrap((fd, bufPtr) => {\n const stats = CHECK_FD(fd, BigInt(0));\n if (this.refreshMemory(), stats.filetype == null)\n throw Error(\"stats.filetype must be set\");\n return this.view.setUint8(bufPtr, stats.filetype), this.view.setUint16(bufPtr + 2, 0, !0), this.view.setUint16(bufPtr + 4, 0, !0), this.view.setBigUint64(bufPtr + 8, BigInt(stats.rights.base), !0), this.view.setBigUint64(bufPtr + 8 + 8, BigInt(stats.rights.inheriting), !0), constants_1.WASI_ESUCCESS;\n }),\n fd_fdstat_set_flags: wrap((fd, flags) => {\n if (CHECK_FD(fd, constants_1.WASI_RIGHT_FD_FDSTAT_SET_FLAGS), this.wasiImport.sock_fcntlSetFlags(fd, flags) == 0)\n return constants_1.WASI_ESUCCESS;\n return constants_1.WASI_ENOSYS;\n }),\n fd_fdstat_set_rights: wrap((fd, fsRightsBase, fsRightsInheriting) => {\n const stats = CHECK_FD(fd, BigInt(0));\n if ((stats.rights.base | fsRightsBase) > stats.rights.base)\n return constants_1.WASI_EPERM;\n if ((stats.rights.inheriting | fsRightsInheriting) > stats.rights.inheriting)\n return constants_1.WASI_EPERM;\n return stats.rights.base = fsRightsBase, stats.rights.inheriting = fsRightsInheriting, constants_1.WASI_ESUCCESS;\n }),\n fd_filestat_get: wrap((fd, bufPtr) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_FILESTAT_GET), rstats = this.fstatSync(stats.real);\n if (this.refreshMemory(), this.view.setBigUint64(bufPtr, BigInt(rstats.dev), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, BigInt(rstats.ino), !0), bufPtr += 8, stats.filetype == null)\n throw Error(\"stats.filetype must be set\");\n return this.view.setUint8(bufPtr, stats.filetype), bufPtr += 8, this.view.setBigUint64(bufPtr, BigInt(rstats.nlink), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, BigInt(rstats.size), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, msToNs(rstats.atimeMs), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, msToNs(rstats.mtimeMs), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, msToNs(rstats.ctimeMs), !0), constants_1.WASI_ESUCCESS;\n }),\n fd_filestat_set_size: wrap((fd, stSize) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_FILESTAT_SET_SIZE);\n return fs.ftruncateSync(stats.real, Number(stSize)), constants_1.WASI_ESUCCESS;\n }),\n fd_filestat_set_times: wrap((fd, stAtim, stMtim, fstflags) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_FILESTAT_SET_TIMES), rstats = this.fstatSync(stats.real);\n let { atime: atim, mtime: mtim } = rstats;\n const n = nsToMs(now(constants_1.WASI_CLOCK_REALTIME)), atimflags = constants_1.WASI_FILESTAT_SET_ATIM | constants_1.WASI_FILESTAT_SET_ATIM_NOW;\n if ((fstflags & atimflags) === atimflags)\n return constants_1.WASI_EINVAL;\n const mtimflags = constants_1.WASI_FILESTAT_SET_MTIM | constants_1.WASI_FILESTAT_SET_MTIM_NOW;\n if ((fstflags & mtimflags) === mtimflags)\n return constants_1.WASI_EINVAL;\n if ((fstflags & constants_1.WASI_FILESTAT_SET_ATIM) === constants_1.WASI_FILESTAT_SET_ATIM)\n atim = nsToMs(stAtim);\n else if ((fstflags & constants_1.WASI_FILESTAT_SET_ATIM_NOW) === constants_1.WASI_FILESTAT_SET_ATIM_NOW)\n atim = n;\n if ((fstflags & constants_1.WASI_FILESTAT_SET_MTIM) === constants_1.WASI_FILESTAT_SET_MTIM)\n mtim = nsToMs(stMtim);\n else if ((fstflags & constants_1.WASI_FILESTAT_SET_MTIM_NOW) === constants_1.WASI_FILESTAT_SET_MTIM_NOW)\n mtim = n;\n return fs.futimesSync(stats.real, new Date(atim), new Date(mtim)), constants_1.WASI_ESUCCESS;\n }),\n fd_prestat_get: wrap((fd, bufPtr) => {\n const stats = CHECK_FD(fd, BigInt(0));\n return this.refreshMemory(), this.view.setUint8(bufPtr, constants_1.WASI_PREOPENTYPE_DIR), this.view.setUint32(bufPtr + 4, @Buffer.byteLength(stats.fakePath \?\? stats.path \?\? \"\"), !0), constants_1.WASI_ESUCCESS;\n }),\n fd_prestat_dir_name: wrap((fd, pathPtr, pathLen) => {\n const stats = CHECK_FD(fd, BigInt(0));\n return this.refreshMemory(), @Buffer.from(this.memory.buffer).write(stats.fakePath \?\? stats.path \?\? \"\", pathPtr, pathLen, \"utf8\"), constants_1.WASI_ESUCCESS;\n }),\n fd_pwrite: wrap((fd, iovs, iovsLen, offset, nwritten) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_WRITE | constants_1.WASI_RIGHT_FD_SEEK);\n let written = 0;\n return getiovs(iovs, iovsLen).forEach((iov) => {\n let w = 0;\n while (w < iov.byteLength)\n w += fs.writeSync(stats.real, iov, w, iov.byteLength - w, Number(offset) + written + w);\n written += w;\n }), this.view.setUint32(nwritten, written, !0), constants_1.WASI_ESUCCESS;\n }),\n fd_write: wrap((fd, iovs, iovsLen, nwritten) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_WRITE), IS_STDOUT = fd == constants_1.WASI_STDOUT_FILENO, IS_STDERR = fd == constants_1.WASI_STDERR_FILENO;\n let written = 0;\n return getiovs(iovs, iovsLen).forEach((iov) => {\n if (iov.byteLength == 0)\n return;\n if (IS_STDOUT && this.sendStdout != null)\n this.sendStdout(iov), written += iov.byteLength;\n else if (IS_STDERR && this.sendStderr != null)\n this.sendStderr(iov), written += iov.byteLength;\n else {\n let w = 0;\n while (w < iov.byteLength) {\n const i = fs.writeSync(stats.real, iov, w, iov.byteLength - w, stats.offset \? Number(stats.offset) : null);\n if (stats.offset)\n stats.offset += BigInt(i);\n w += i;\n }\n written += w;\n }\n }), this.view.setUint32(nwritten, written, !0), constants_1.WASI_ESUCCESS;\n }),\n fd_pread: wrap((fd, iovs, iovsLen, offset, nread) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_READ | constants_1.WASI_RIGHT_FD_SEEK);\n let read = 0;\n outer:\n for (let iov of getiovs(iovs, iovsLen)) {\n let r = 0;\n while (r < iov.byteLength) {\n const length = iov.byteLength - r, rr = fs.readSync(stats.real, iov, r, iov.byteLength - r, Number(offset) + read + r);\n if (r += rr, read += rr, rr === 0 || rr < length)\n break outer;\n }\n read += r;\n }\n return this.view.setUint32(nread, read, !0), constants_1.WASI_ESUCCESS;\n }),\n fd_read: wrap((fd, iovs, iovsLen, nread) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_READ), IS_STDIN = fd == constants_1.WASI_STDIN_FILENO;\n let read = 0;\n outer:\n for (let iov of getiovs(iovs, iovsLen)) {\n let r = 0;\n while (r < iov.byteLength) {\n let length = iov.byteLength - r, position = IS_STDIN || stats.offset === void 0 \? null : Number(stats.offset), rr = 0;\n if (IS_STDIN)\n if (this.getStdin != null) {\n if (this.stdinBuffer == null)\n this.stdinBuffer = this.getStdin();\n if (this.stdinBuffer != null) {\n if (rr = this.stdinBuffer.copy(iov), rr == this.stdinBuffer.length)\n this.stdinBuffer = void 0;\n else\n this.stdinBuffer = this.stdinBuffer.slice(rr);\n if (rr > 0)\n this.lastStdin = (new Date()).valueOf();\n }\n } else {\n if (this.sleep == null && !warnedAboutSleep)\n warnedAboutSleep = !0, console.log(\"(cpu waiting for stdin: please define a way to sleep!) \");\n try {\n rr = fs.readSync(stats.real, iov, r, length, position);\n } catch (_err) {\n }\n if (rr == 0)\n this.shortPause();\n else\n this.lastStdin = (new Date()).valueOf();\n }\n else\n rr = fs.readSync(stats.real, iov, r, length, position);\n if (stats.filetype == constants_1.WASI_FILETYPE_REGULAR_FILE)\n stats.offset = (stats.offset \? stats.offset : BigInt(0)) + BigInt(rr);\n if (r += rr, read += rr, rr === 0 || rr < length)\n break outer;\n }\n }\n return this.view.setUint32(nread, read, !0), constants_1.WASI_ESUCCESS;\n }),\n fd_readdir: wrap((fd, bufPtr, bufLen, cookie, bufusedPtr) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_READDIR);\n this.refreshMemory();\n const entries = fs.readdirSync(stats.path, { withFileTypes: !0 }), startPtr = bufPtr;\n for (let i = Number(cookie);i < entries.length; i += 1) {\n const entry = entries[i];\n let nameLength = @Buffer.byteLength(entry.name);\n if (bufPtr - startPtr > bufLen)\n break;\n if (this.view.setBigUint64(bufPtr, BigInt(i + 1), !0), bufPtr += 8, bufPtr - startPtr > bufLen)\n break;\n const rstats = fs.lstatSync(path.resolve(stats.path, entry.name));\n if (this.view.setBigUint64(bufPtr, BigInt(rstats.ino), !0), bufPtr += 8, bufPtr - startPtr > bufLen)\n break;\n if (this.view.setUint32(bufPtr, nameLength, !0), bufPtr += 4, bufPtr - startPtr > bufLen)\n break;\n let filetype;\n switch (!0) {\n case rstats.isBlockDevice():\n filetype = constants_1.WASI_FILETYPE_BLOCK_DEVICE;\n break;\n case rstats.isCharacterDevice():\n filetype = constants_1.WASI_FILETYPE_CHARACTER_DEVICE;\n break;\n case rstats.isDirectory():\n filetype = constants_1.WASI_FILETYPE_DIRECTORY;\n break;\n case rstats.isFIFO():\n filetype = constants_1.WASI_FILETYPE_SOCKET_STREAM;\n break;\n case rstats.isFile():\n filetype = constants_1.WASI_FILETYPE_REGULAR_FILE;\n break;\n case rstats.isSocket():\n filetype = constants_1.WASI_FILETYPE_SOCKET_STREAM;\n break;\n case rstats.isSymbolicLink():\n filetype = constants_1.WASI_FILETYPE_SYMBOLIC_LINK;\n break;\n default:\n filetype = constants_1.WASI_FILETYPE_UNKNOWN;\n break;\n }\n if (this.view.setUint8(bufPtr, filetype), bufPtr += 1, bufPtr += 3, bufPtr + nameLength >= startPtr + bufLen)\n break;\n @Buffer.from(this.memory.buffer).write(entry.name, bufPtr), bufPtr += nameLength;\n }\n const bufused = bufPtr - startPtr;\n return this.view.setUint32(bufusedPtr, Math.min(bufused, bufLen), !0), constants_1.WASI_ESUCCESS;\n }),\n fd_renumber: wrap((from, to) => {\n return CHECK_FD(from, BigInt(0)), CHECK_FD(to, BigInt(0)), fs.closeSync(this.FD_MAP.get(from).real), this.FD_MAP.set(from, this.FD_MAP.get(to)), this.FD_MAP.delete(to), constants_1.WASI_ESUCCESS;\n }),\n fd_seek: wrap((fd, offset, whence, newOffsetPtr) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_SEEK);\n switch (this.refreshMemory(), whence) {\n case constants_1.WASI_WHENCE_CUR:\n stats.offset = (stats.offset \? stats.offset : BigInt(0)) + BigInt(offset);\n break;\n case constants_1.WASI_WHENCE_END:\n const { size } = this.fstatSync(stats.real);\n stats.offset = BigInt(size) + BigInt(offset);\n break;\n case constants_1.WASI_WHENCE_SET:\n stats.offset = BigInt(offset);\n break;\n }\n if (stats.offset == null)\n throw Error(\"stats.offset must be defined\");\n return this.view.setBigUint64(newOffsetPtr, stats.offset, !0), constants_1.WASI_ESUCCESS;\n }),\n fd_tell: wrap((fd, offsetPtr) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_TELL);\n if (this.refreshMemory(), !stats.offset)\n stats.offset = BigInt(0);\n return this.view.setBigUint64(offsetPtr, stats.offset, !0), constants_1.WASI_ESUCCESS;\n }),\n fd_sync: wrap((fd) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_SYNC);\n return fs.fsyncSync(stats.real), constants_1.WASI_ESUCCESS;\n }),\n path_create_directory: wrap((fd, pathPtr, pathLen) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_CREATE_DIRECTORY);\n if (!stats.path)\n return constants_1.WASI_EINVAL;\n this.refreshMemory();\n const p = @Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n return fs.mkdirSync(path.resolve(stats.path, p)), constants_1.WASI_ESUCCESS;\n }),\n path_filestat_get: wrap((fd, flags, pathPtr, pathLen, bufPtr) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_FILESTAT_GET);\n if (!stats.path)\n return constants_1.WASI_EINVAL;\n this.refreshMemory();\n const p = @Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n let rstats;\n if (flags)\n rstats = fs.statSync(path.resolve(stats.path, p));\n else\n rstats = fs.lstatSync(path.resolve(stats.path, p));\n return this.view.setBigUint64(bufPtr, BigInt(rstats.dev), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, BigInt(rstats.ino), !0), bufPtr += 8, this.view.setUint8(bufPtr, translateFileAttributes(this, void 0, rstats).filetype), bufPtr += 8, this.view.setBigUint64(bufPtr, BigInt(rstats.nlink), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, BigInt(rstats.size), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, BigInt(rstats.atime.getTime() * 1e6), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, BigInt(rstats.mtime.getTime() * 1e6), !0), bufPtr += 8, this.view.setBigUint64(bufPtr, BigInt(rstats.ctime.getTime() * 1e6), !0), constants_1.WASI_ESUCCESS;\n }),\n path_filestat_set_times: wrap((fd, _dirflags, pathPtr, pathLen, stAtim, stMtim, fstflags) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_FILESTAT_SET_TIMES);\n if (!stats.path)\n return constants_1.WASI_EINVAL;\n this.refreshMemory();\n const rstats = this.fstatSync(stats.real);\n let { atime: atim, mtime: mtim } = rstats;\n const n = nsToMs(now(constants_1.WASI_CLOCK_REALTIME)), atimflags = constants_1.WASI_FILESTAT_SET_ATIM | constants_1.WASI_FILESTAT_SET_ATIM_NOW;\n if ((fstflags & atimflags) === atimflags)\n return constants_1.WASI_EINVAL;\n const mtimflags = constants_1.WASI_FILESTAT_SET_MTIM | constants_1.WASI_FILESTAT_SET_MTIM_NOW;\n if ((fstflags & mtimflags) === mtimflags)\n return constants_1.WASI_EINVAL;\n if ((fstflags & constants_1.WASI_FILESTAT_SET_ATIM) === constants_1.WASI_FILESTAT_SET_ATIM)\n atim = nsToMs(stAtim);\n else if ((fstflags & constants_1.WASI_FILESTAT_SET_ATIM_NOW) === constants_1.WASI_FILESTAT_SET_ATIM_NOW)\n atim = n;\n if ((fstflags & constants_1.WASI_FILESTAT_SET_MTIM) === constants_1.WASI_FILESTAT_SET_MTIM)\n mtim = nsToMs(stMtim);\n else if ((fstflags & constants_1.WASI_FILESTAT_SET_MTIM_NOW) === constants_1.WASI_FILESTAT_SET_MTIM_NOW)\n mtim = n;\n const p = @Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n return fs.utimesSync(path.resolve(stats.path, p), new Date(atim), new Date(mtim)), constants_1.WASI_ESUCCESS;\n }),\n path_link: wrap((oldFd, _oldFlags, oldPath, oldPathLen, newFd, newPath, newPathLen) => {\n const ostats = CHECK_FD(oldFd, constants_1.WASI_RIGHT_PATH_LINK_SOURCE), nstats = CHECK_FD(newFd, constants_1.WASI_RIGHT_PATH_LINK_TARGET);\n if (!ostats.path || !nstats.path)\n return constants_1.WASI_EINVAL;\n this.refreshMemory();\n const op = @Buffer.from(this.memory.buffer, oldPath, oldPathLen).toString(), np = @Buffer.from(this.memory.buffer, newPath, newPathLen).toString();\n return fs.linkSync(path.resolve(ostats.path, op), path.resolve(nstats.path, np)), constants_1.WASI_ESUCCESS;\n }),\n path_open: wrap((dirfd, _dirflags, pathPtr, pathLen, oflags, fsRightsBase, fsRightsInheriting, fsFlags, fdPtr) => {\n try {\n const stats = CHECK_FD(dirfd, constants_1.WASI_RIGHT_PATH_OPEN);\n fsRightsBase = BigInt(fsRightsBase), fsRightsInheriting = BigInt(fsRightsInheriting);\n const read = (fsRightsBase & (constants_1.WASI_RIGHT_FD_READ | constants_1.WASI_RIGHT_FD_READDIR)) !== BigInt(0), write = (fsRightsBase & (constants_1.WASI_RIGHT_FD_DATASYNC | constants_1.WASI_RIGHT_FD_WRITE | constants_1.WASI_RIGHT_FD_ALLOCATE | constants_1.WASI_RIGHT_FD_FILESTAT_SET_SIZE)) !== BigInt(0);\n let noflags;\n if (write && read)\n noflags = nodeFsConstants.O_RDWR;\n else if (read)\n noflags = nodeFsConstants.O_RDONLY;\n else if (write)\n noflags = nodeFsConstants.O_WRONLY;\n let neededBase = fsRightsBase | constants_1.WASI_RIGHT_PATH_OPEN, neededInheriting = fsRightsBase | fsRightsInheriting;\n if ((oflags & constants_1.WASI_O_CREAT) !== 0)\n noflags |= nodeFsConstants.O_CREAT, neededBase |= constants_1.WASI_RIGHT_PATH_CREATE_FILE;\n if ((oflags & constants_1.WASI_O_DIRECTORY) !== 0)\n noflags |= nodeFsConstants.O_DIRECTORY;\n if ((oflags & constants_1.WASI_O_EXCL) !== 0)\n noflags |= nodeFsConstants.O_EXCL;\n if ((oflags & constants_1.WASI_O_TRUNC) !== 0)\n noflags |= nodeFsConstants.O_TRUNC, neededBase |= constants_1.WASI_RIGHT_PATH_FILESTAT_SET_SIZE;\n if ((fsFlags & constants_1.WASI_FDFLAG_APPEND) !== 0)\n noflags |= nodeFsConstants.O_APPEND;\n if ((fsFlags & constants_1.WASI_FDFLAG_DSYNC) !== 0) {\n if (nodeFsConstants.O_DSYNC)\n noflags |= nodeFsConstants.O_DSYNC;\n else\n noflags |= nodeFsConstants.O_SYNC;\n neededInheriting |= constants_1.WASI_RIGHT_FD_DATASYNC;\n }\n if ((fsFlags & constants_1.WASI_FDFLAG_NONBLOCK) !== 0)\n noflags |= nodeFsConstants.O_NONBLOCK;\n if ((fsFlags & constants_1.WASI_FDFLAG_RSYNC) !== 0) {\n if (nodeFsConstants.O_RSYNC)\n noflags |= nodeFsConstants.O_RSYNC;\n else\n noflags |= nodeFsConstants.O_SYNC;\n neededInheriting |= constants_1.WASI_RIGHT_FD_SYNC;\n }\n if ((fsFlags & constants_1.WASI_FDFLAG_SYNC) !== 0)\n noflags |= nodeFsConstants.O_SYNC, neededInheriting |= constants_1.WASI_RIGHT_FD_SYNC;\n if (write && (noflags & (nodeFsConstants.O_APPEND | nodeFsConstants.O_TRUNC)) === 0)\n neededInheriting |= constants_1.WASI_RIGHT_FD_SEEK;\n this.refreshMemory();\n const p = @Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n if (p == \"dev/tty\")\n return this.view.setUint32(fdPtr, constants_1.WASI_STDIN_FILENO, !0), constants_1.WASI_ESUCCESS;\n if (logOpen(\"path_open\", p), p.startsWith(\"proc/\"))\n throw new types_1.WASIError(constants_1.WASI_EBADF);\n const fullUnresolved = path.resolve(p);\n let full;\n try {\n full = fs.realpathSync(fullUnresolved);\n } catch (e) {\n if (e\?.code === \"ENOENT\")\n full = fullUnresolved;\n else\n throw e;\n }\n let isDirectory;\n if (write)\n try {\n isDirectory = fs.statSync(full).isDirectory();\n } catch (_err) {\n }\n let realfd;\n if (!write && isDirectory)\n realfd = fs.openSync(full, nodeFsConstants.O_RDONLY);\n else\n realfd = fs.openSync(full, noflags);\n const newfd = this.getUnusedFileDescriptor();\n this.FD_MAP.set(newfd, {\n real: realfd,\n filetype: void 0,\n rights: {\n base: neededBase,\n inheriting: neededInheriting\n },\n path: full\n }), stat(this, newfd), this.view.setUint32(fdPtr, newfd, !0);\n } catch (e) {\n console.error(e);\n }\n return constants_1.WASI_ESUCCESS;\n }),\n path_readlink: wrap((fd, pathPtr, pathLen, buf, bufLen, bufused) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_READLINK);\n if (!stats.path)\n return constants_1.WASI_EINVAL;\n this.refreshMemory();\n const p = @Buffer.from(this.memory.buffer, pathPtr, pathLen).toString(), full = path.resolve(stats.path, p), r = fs.readlinkSync(full), used = @Buffer.from(this.memory.buffer).write(r, buf, bufLen);\n return this.view.setUint32(bufused, used, !0), constants_1.WASI_ESUCCESS;\n }),\n path_remove_directory: wrap((fd, pathPtr, pathLen) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_REMOVE_DIRECTORY);\n if (!stats.path)\n return constants_1.WASI_EINVAL;\n this.refreshMemory();\n const p = @Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n return fs.rmdirSync(path.resolve(stats.path, p)), constants_1.WASI_ESUCCESS;\n }),\n path_rename: wrap((oldFd, oldPath, oldPathLen, newFd, newPath, newPathLen) => {\n const ostats = CHECK_FD(oldFd, constants_1.WASI_RIGHT_PATH_RENAME_SOURCE), nstats = CHECK_FD(newFd, constants_1.WASI_RIGHT_PATH_RENAME_TARGET);\n if (!ostats.path || !nstats.path)\n return constants_1.WASI_EINVAL;\n this.refreshMemory();\n const op = @Buffer.from(this.memory.buffer, oldPath, oldPathLen).toString(), np = @Buffer.from(this.memory.buffer, newPath, newPathLen).toString();\n return fs.renameSync(path.resolve(ostats.path, op), path.resolve(nstats.path, np)), constants_1.WASI_ESUCCESS;\n }),\n path_symlink: wrap((oldPath, oldPathLen, fd, newPath, newPathLen) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_SYMLINK);\n if (!stats.path)\n return constants_1.WASI_EINVAL;\n this.refreshMemory();\n const op = @Buffer.from(this.memory.buffer, oldPath, oldPathLen).toString(), np = @Buffer.from(this.memory.buffer, newPath, newPathLen).toString();\n return fs.symlinkSync(op, path.resolve(stats.path, np)), constants_1.WASI_ESUCCESS;\n }),\n path_unlink_file: wrap((fd, pathPtr, pathLen) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_UNLINK_FILE);\n if (!stats.path)\n return constants_1.WASI_EINVAL;\n this.refreshMemory();\n const p = @Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n return fs.unlinkSync(path.resolve(stats.path, p)), constants_1.WASI_ESUCCESS;\n }),\n poll_oneoff: (sin, sout, nsubscriptions, neventsPtr) => {\n let nevents = 0, name = \"\", waitTimeNs = BigInt(0), fd = -1, fd_type = \"read\", fd_timeout_ms = 0;\n const startNs = BigInt(bindings2.hrtime());\n this.refreshMemory();\n let last_sin = sin;\n for (let i = 0;i < nsubscriptions; i += 1) {\n const userdata = this.view.getBigUint64(sin, !0);\n sin += 8;\n const type = this.view.getUint8(sin);\n if (sin += 1, sin += 7, log.enabled) {\n if (type == constants_1.WASI_EVENTTYPE_CLOCK)\n name = \"poll_oneoff (type=WASI_EVENTTYPE_CLOCK): \";\n else if (type == constants_1.WASI_EVENTTYPE_FD_READ)\n name = \"poll_oneoff (type=WASI_EVENTTYPE_FD_READ): \";\n else\n name = \"poll_oneoff (type=WASI_EVENTTYPE_FD_WRITE): \";\n log(name);\n }\n switch (type) {\n case constants_1.WASI_EVENTTYPE_CLOCK: {\n const clockid = this.view.getUint32(sin, !0);\n sin += 4, sin += 4;\n const timeout = this.view.getBigUint64(sin, !0);\n sin += 8, sin += 8;\n const subclockflags = this.view.getUint16(sin, !0);\n sin += 2, sin += 6;\n const absolute = subclockflags === 1;\n if (log.enabled)\n log(name, { clockid, timeout, absolute });\n if (!absolute)\n fd_timeout_ms = timeout / BigInt(1e6);\n let e = constants_1.WASI_ESUCCESS;\n const t = now(clockid);\n if (t == null)\n e = constants_1.WASI_EINVAL;\n else {\n const tNS = BigInt(t), waitNs = (absolute \? timeout : tNS + timeout) - tNS;\n if (waitNs > waitTimeNs)\n waitTimeNs = waitNs;\n }\n this.view.setBigUint64(sout, userdata, !0), sout += 8, this.view.setUint16(sout, e, !0), sout += 2, this.view.setUint8(sout, constants_1.WASI_EVENTTYPE_CLOCK), sout += 1, sout += 5, nevents += 1;\n break;\n }\n case constants_1.WASI_EVENTTYPE_FD_READ:\n case constants_1.WASI_EVENTTYPE_FD_WRITE: {\n if (fd = this.view.getUint32(sin, !0), fd_type = type == constants_1.WASI_EVENTTYPE_FD_READ \? \"read\" : \"write\", sin += 4, log(name, \"fd =\", fd), sin += 28, this.view.setBigUint64(sout, userdata, !0), sout += 8, this.view.setUint16(sout, constants_1.WASI_ENOSYS, !0), sout += 2, this.view.setUint8(sout, type), sout += 1, sout += 5, nevents += 1, fd == constants_1.WASI_STDIN_FILENO && constants_1.WASI_EVENTTYPE_FD_READ == type)\n this.shortPause();\n break;\n }\n default:\n return constants_1.WASI_EINVAL;\n }\n if (sin - last_sin != 48)\n console.warn(\"*** BUG in wasi-js in poll_oneoff \", {\n i,\n sin,\n last_sin,\n diff: sin - last_sin\n });\n last_sin = sin;\n }\n if (this.view.setUint32(neventsPtr, nevents, !0), nevents == 2 && fd >= 0) {\n const r = this.wasiImport.sock_pollSocket(fd, fd_type, fd_timeout_ms);\n if (r != constants_1.WASI_ENOSYS)\n return r;\n }\n if (waitTimeNs > 0) {\n if (waitTimeNs -= Bun.nanoseconds() - timeOrigin, waitTimeNs >= 1e6) {\n if (this.sleep == null && !warnedAboutSleep)\n warnedAboutSleep = !0, console.log(\"(100% cpu burning waiting for stdin: please define a way to sleep!) \");\n if (this.sleep != null) {\n const ms = nsToMs(waitTimeNs);\n this.sleep(ms);\n } else {\n const end = BigInt(bindings2.hrtime()) + waitTimeNs;\n while (BigInt(bindings2.hrtime()) < end)\n ;\n }\n }\n }\n return constants_1.WASI_ESUCCESS;\n },\n proc_exit: (rval) => {\n return bindings2.exit(rval), constants_1.WASI_ESUCCESS;\n },\n proc_raise: (sig) => {\n if (!(sig in constants_1.SIGNAL_MAP))\n return constants_1.WASI_EINVAL;\n return bindings2.kill(constants_1.SIGNAL_MAP[sig]), constants_1.WASI_ESUCCESS;\n },\n random_get: (bufPtr, bufLen) => {\n return this.refreshMemory(), crypto.getRandomValues(this.memory.buffer, bufPtr, bufLen), bufLen;\n },\n sched_yield() {\n return constants_1.WASI_ESUCCESS;\n },\n sock_recv() {\n return constants_1.WASI_ENOSYS;\n },\n sock_send() {\n return constants_1.WASI_ENOSYS;\n },\n sock_shutdown() {\n return constants_1.WASI_ENOSYS;\n },\n sock_fcntlSetFlags(_fd, _flags) {\n return constants_1.WASI_ENOSYS;\n },\n sock_pollSocket(_fd, _eventtype, _timeout_ms) {\n return constants_1.WASI_ENOSYS;\n }\n }, log.enabled)\n Object.keys(this.wasiImport).forEach((key) => {\n const prevImport = this.wasiImport[key];\n this.wasiImport[key] = function(...args2) {\n log(key, args2);\n try {\n let result = prevImport(...args2);\n return log(\"result\", result), result;\n } catch (e) {\n throw log(\"error: \", e), e;\n }\n };\n });\n }\n getState() {\n return { env: this.env, FD_MAP: this.FD_MAP, bindings };\n }\n setState(state) {\n this.env = state.env, this.FD_MAP = state.FD_MAP, bindings = state.bindings;\n }\n fstatSync(real_fd) {\n if (real_fd <= 2)\n try {\n return fs.fstatSync(real_fd);\n } catch (_) {\n const now = new Date;\n return {\n dev: 0,\n mode: 8592,\n nlink: 1,\n uid: 0,\n gid: 0,\n rdev: 0,\n blksize: 65536,\n ino: 0,\n size: 0,\n blocks: 0,\n atimeMs: now.valueOf(),\n mtimeMs: now.valueOf(),\n ctimeMs: now.valueOf(),\n birthtimeMs: 0,\n atime: new Date,\n mtime: new Date,\n ctime: new Date,\n birthtime: new Date(0)\n };\n }\n return fs.fstatSync(real_fd);\n }\n shortPause() {\n if (this.sleep == null)\n return;\n if ((new Date()).valueOf() - this.lastStdin > 2000)\n this.sleep(50);\n }\n getUnusedFileDescriptor(start = 3) {\n let fd = start;\n while (this.FD_MAP.has(fd))\n fd += 1;\n if (fd > SC_OPEN_MAX)\n throw Error(\"no available file descriptors\");\n return fd;\n }\n refreshMemory() {\n if (!this.view || this.view.buffer.byteLength === 0)\n this.view = new DataView(this.memory.buffer);\n }\n setMemory(memory) {\n this.memory = memory;\n }\n start(instance, memory) {\n const exports2 = instance.exports;\n if (exports2 === null || typeof exports2 !== \"object\")\n throw new Error(`instance.exports must be an Object. Received ${exports2}.`);\n if (memory == null) {\n if (memory = exports2.memory, !(memory instanceof WebAssembly.Memory))\n throw new Error(`instance.exports.memory must be a WebAssembly.Memory. Recceived ${memory}.`);\n }\n if (this.setMemory(memory), exports2._start)\n exports2._start();\n }\n getImports(module2) {\n let namespace = null;\n const imports = WebAssembly.Module.imports(module2);\n for (let imp of imports) {\n if (imp.kind !== \"function\")\n continue;\n if (!imp.module.startsWith(\"wasi_\"))\n continue;\n namespace = imp.module;\n break;\n }\n switch (namespace) {\n case \"wasi_unstable\":\n return {\n wasi_unstable: this.wasiImport\n };\n case \"wasi_snapshot_preview1\":\n return {\n wasi_snapshot_preview1: this.wasiImport\n };\n default:\n throw new Error(\"No WASI namespace found. Only wasi_unstable and wasi_snapshot_preview1 are supported.\\n\\nList of imports:\\n\\n\" + imports.map(({ name, kind, module }) => `${module}:${name} (${kind})`).join(\"\\n\") + \"\\n\");\n }\n }\n initWasiFdInfo() {\n if (this.env.WASI_FD_INFO != null) {\n const fdInfo = JSON.parse(this.env.WASI_FD_INFO);\n for (let wasi_fd in fdInfo) {\n console.log(wasi_fd);\n const fd = parseInt(wasi_fd);\n if (this.FD_MAP.has(fd))\n continue;\n const real = fdInfo[wasi_fd];\n try {\n this.fstatSync(real);\n } catch (_err) {\n console.log(\"discarding \", { wasi_fd, real });\n continue;\n }\n const file = {\n real,\n filetype: constants_1.WASI_FILETYPE_SOCKET_STREAM,\n rights: {\n base: STDIN_DEFAULT_RIGHTS,\n inheriting: BigInt(0)\n }\n };\n this.FD_MAP.set(fd, file);\n }\n console.log(\"after initWasiFdInfo: \", this.FD_MAP), console.log(\"fdInfo = \", fdInfo);\n } else\n console.log(\"no WASI_FD_INFO\");\n }\n };\n exports.default = WASI;\n }\n});\nreturn { WASI: require_wasi().default }})\n"); -// - -// -static constexpr ASCIILiteral NodeWorkerThreadsCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/worker_threads.ts\nvar emitWarning = function(type, message) {\n if (emittedWarnings.has(type))\n return;\n emittedWarnings.add(type), console.warn(\"[bun] Warning:\", message);\n}, injectFakeEmitter = function(Class) {\n function messageEventHandler(event) {\n return event.data;\n }\n function errorEventHandler(event) {\n return event.error;\n }\n const wrappedListener = Symbol(\"wrappedListener\");\n function wrapped(run, listener) {\n const callback = function(event) {\n return listener(run(event));\n };\n return listener[wrappedListener] = callback, callback;\n }\n function functionForEventType(event, listener) {\n switch (event) {\n case \"error\":\n case \"messageerror\":\n return wrapped(errorEventHandler, listener);\n default:\n return wrapped(messageEventHandler, listener);\n }\n }\n Class.prototype.on = function(event, listener) {\n return this.addEventListener(event, functionForEventType(event, listener)), this;\n }, Class.prototype.off = function(event, listener) {\n if (listener)\n this.removeEventListener(event, listener[wrappedListener] || listener);\n else\n this.removeEventListener(event);\n return this;\n }, Class.prototype.once = function(event, listener) {\n return this.addEventListener(event, functionForEventType(event, listener), { once: !0 }), this;\n };\n function EventClass(eventName) {\n if (eventName === \"error\" || eventName === \"messageerror\")\n return ErrorEvent;\n return MessageEvent;\n }\n Class.prototype.emit = function(event, ...args) {\n return this.dispatchEvent(new (EventClass(event))(event, ...args)), this;\n }, Class.prototype.prependListener = Class.prototype.on, Class.prototype.prependOnceListener = Class.prototype.once;\n}, receiveMessageOnPort = function(port) {\n let res = _receiveMessageOnPort(port);\n if (!res)\n return @undefined;\n return {\n message: res\n };\n}, fakeParentPort = function() {\n const fake = Object.create(MessagePort.prototype);\n return Object.defineProperty(fake, \"onmessage\", {\n get() {\n return self.onmessage;\n },\n set(value) {\n self.onmessage = value;\n }\n }), Object.defineProperty(fake, \"onmessageerror\", {\n get() {\n return self.onmessageerror;\n },\n set(value) {\n }\n }), Object.defineProperty(fake, \"postMessage\", {\n value(...args) {\n return self.postMessage(...args);\n }\n }), Object.defineProperty(fake, \"close\", {\n value() {\n return process.exit(0);\n }\n }), Object.defineProperty(fake, \"start\", {\n value() {\n }\n }), Object.defineProperty(fake, \"unref\", {\n value() {\n }\n }), Object.defineProperty(fake, \"ref\", {\n value() {\n }\n }), Object.defineProperty(fake, \"hasRef\", {\n value() {\n return !1;\n }\n }), Object.defineProperty(fake, \"setEncoding\", {\n value() {\n }\n }), Object.defineProperty(fake, \"addEventListener\", {\n value: self.addEventListener.bind(self)\n }), Object.defineProperty(fake, \"removeEventListener\", {\n value: self.removeEventListener.bind(self)\n }), fake;\n}, getEnvironmentData = function() {\n return process.env;\n}, setEnvironmentData = function(env) {\n process.env = env;\n}, markAsUntransferable = function() {\n throwNotImplemented(\"worker_threads.markAsUntransferable\");\n}, moveMessagePortToContext = function() {\n throwNotImplemented(\"worker_threads.moveMessagePortToContext\");\n}, $, EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20), { throwNotImplemented } = @getInternalField(@internalModuleRegistry, 6) || @createInternalModuleById(6), { MessageChannel, BroadcastChannel, Worker: WebWorker } = globalThis, SHARE_ENV = Symbol(\"nodejs.worker_threads.SHARE_ENV\"), isMainThread = Bun.isMainThread, [_workerData, _threadId, _receiveMessageOnPort] = @lazy(\"worker_threads\"), emittedWarnings = new Set, _MessagePort = globalThis.MessagePort;\ninjectFakeEmitter(_MessagePort);\nvar MessagePort = _MessagePort, resourceLimits = {}, workerData = _workerData, threadId = _threadId, parentPort = isMainThread \? null : fakeParentPort(), unsupportedOptions = [\n \"eval\",\n \"argv\",\n \"execArgv\",\n \"stdin\",\n \"stdout\",\n \"stderr\",\n \"trackedUnmanagedFds\",\n \"resourceLimits\"\n];\n\nclass Worker extends EventEmitter {\n #worker;\n #performance;\n #onExitPromise = @undefined;\n constructor(filename, options = {}) {\n super();\n for (let key of unsupportedOptions)\n if (key in options)\n emitWarning(\"option.\" + key, `worker_threads.Worker option \"${key}\" is not implemented.`);\n this.#worker = new WebWorker(filename, options), this.#worker.addEventListener(\"close\", this.#onClose.bind(this)), this.#worker.addEventListener(\"error\", this.#onError.bind(this)), this.#worker.addEventListener(\"message\", this.#onMessage.bind(this)), this.#worker.addEventListener(\"messageerror\", this.#onMessageError.bind(this)), this.#worker.addEventListener(\"open\", this.#onOpen.bind(this));\n }\n get threadId() {\n return this.#worker.threadId;\n }\n ref() {\n this.#worker.ref();\n }\n unref() {\n this.#worker.unref();\n }\n get stdin() {\n return null;\n }\n get stdout() {\n return null;\n }\n get stderr() {\n return null;\n }\n get performance() {\n return this.#performance \?\?= {\n eventLoopUtilization() {\n return emitWarning(\"performance\", \"worker_threads.Worker.performance is not implemented.\"), {\n idle: 0,\n active: 0,\n utilization: 0\n };\n }\n };\n }\n terminate() {\n const onExitPromise = this.#onExitPromise;\n if (onExitPromise)\n return @isPromise(onExitPromise) \? onExitPromise : @Promise.resolve(onExitPromise);\n const { resolve, promise } = @Promise.withResolvers();\n return this.#worker.addEventListener(\"close\", (event) => {\n resolve(event.code);\n }, { once: !0 }), this.#worker.terminate(), this.#onExitPromise = promise;\n }\n postMessage(...args) {\n return this.#worker.postMessage(...args);\n }\n #onClose(e) {\n this.#onExitPromise = e.code, this.emit(\"exit\", e.code);\n }\n #onError(error) {\n this.emit(\"error\", error);\n }\n #onMessage(event) {\n this.emit(\"message\", event.data);\n }\n #onMessageError(event) {\n this.emit(\"messageerror\", event.error \?\? event.data \?\? event);\n }\n #onOpen() {\n this.emit(\"online\");\n }\n async getHeapSnapshot() {\n throwNotImplemented(\"worker_threads.Worker.getHeapSnapshot\");\n }\n}\n$ = {\n Worker,\n workerData,\n parentPort,\n resourceLimits,\n isMainThread,\n MessageChannel,\n BroadcastChannel,\n MessagePort,\n getEnvironmentData,\n setEnvironmentData,\n getHeapSnapshot() {\n return {};\n },\n markAsUntransferable,\n moveMessagePortToContext,\n receiveMessageOnPort,\n SHARE_ENV,\n threadId\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral NodeZlibCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/node/zlib.ts\nvar assert = @getInternalField(@internalModuleRegistry, 8) || @createInternalModuleById(8), BufferModule = @requireNativeModule(\"buffer\"), StreamModule = @getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39), Util = @getInternalField(@internalModuleRegistry, 48) || @createInternalModuleById(48), __getOwnPropNames = Object.getOwnPropertyNames, __commonJS = (cb, mod) => function __require() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n}, require_zstream = __commonJS({\n \"node_modules/pako/lib/zlib/zstream.js\"(exports, module2) {\n function ZStream() {\n this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = \"\", this.state = null, this.data_type = 2, this.adler = 0;\n }\n module2.exports = ZStream;\n }\n}), require_common = __commonJS({\n \"node_modules/pako/lib/utils/common.js\"(exports) {\n var TYPED_OK = typeof @Uint8Array !== \"undefined\" && typeof Uint16Array !== \"undefined\" && typeof Int32Array !== \"undefined\";\n function _has(obj, key) {\n return Object.prototype.hasOwnProperty.@call(obj, key);\n }\n exports.assign = function(obj) {\n var sources = @Array.prototype.slice.@call(arguments, 1);\n while (sources.length) {\n var source = sources.shift();\n if (!source)\n continue;\n if (typeof source !== \"object\")\n @throwTypeError(source + \"must be non-object\");\n for (var p in source)\n if (_has(source, p))\n obj[p] = source[p];\n }\n return obj;\n }, exports.shrinkBuf = function(buf, size) {\n if (buf.length === size)\n return buf;\n if (buf.subarray)\n return buf.subarray(0, size);\n return buf.length = size, buf;\n };\n var fnTyped = {\n arraySet: function(dest, src, src_offs, len, dest_offs) {\n if (src.subarray && dest.subarray) {\n dest.set(src.subarray(src_offs, src_offs + len), dest_offs);\n return;\n }\n for (var i = 0;i < len; i++)\n dest[dest_offs + i] = src[src_offs + i];\n },\n flattenChunks: function(chunks) {\n var i, l, len, pos, chunk, result;\n len = 0;\n for (i = 0, l = chunks.length;i < l; i++)\n len += chunks[i].length;\n result = new @Uint8Array(len), pos = 0;\n for (i = 0, l = chunks.length;i < l; i++)\n chunk = chunks[i], result.set(chunk, pos), pos += chunk.length;\n return result;\n }\n }, fnUntyped = {\n arraySet: function(dest, src, src_offs, len, dest_offs) {\n for (var i = 0;i < len; i++)\n dest[dest_offs + i] = src[src_offs + i];\n },\n flattenChunks: function(chunks) {\n return [].concat.@apply([], chunks);\n }\n };\n exports.setTyped = function(on) {\n if (on)\n exports.Buf8 = @Uint8Array, exports.Buf16 = Uint16Array, exports.Buf32 = Int32Array, exports.assign(exports, fnTyped);\n else\n exports.Buf8 = @Array, exports.Buf16 = @Array, exports.Buf32 = @Array, exports.assign(exports, fnUntyped);\n }, exports.setTyped(TYPED_OK);\n }\n}), require_trees = __commonJS({\n \"node_modules/pako/lib/zlib/trees.js\"(exports) {\n var utils = require_common(), Z_FIXED = 4, Z_BINARY = 0, Z_TEXT = 1, Z_UNKNOWN = 2;\n function zero(buf) {\n var len = buf.length;\n while (--len >= 0)\n buf[len] = 0;\n }\n var STORED_BLOCK = 0, STATIC_TREES = 1, DYN_TREES = 2, MIN_MATCH = 3, MAX_MATCH = 258, LENGTH_CODES = 29, LITERALS = 256, L_CODES = LITERALS + 1 + LENGTH_CODES, D_CODES = 30, BL_CODES = 19, HEAP_SIZE = 2 * L_CODES + 1, MAX_BITS = 15, Buf_size = 16, MAX_BL_BITS = 7, END_BLOCK = 256, REP_3_6 = 16, REPZ_3_10 = 17, REPZ_11_138 = 18, extra_lbits = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0], extra_dbits = [\n 0,\n 0,\n 0,\n 0,\n 1,\n 1,\n 2,\n 2,\n 3,\n 3,\n 4,\n 4,\n 5,\n 5,\n 6,\n 6,\n 7,\n 7,\n 8,\n 8,\n 9,\n 9,\n 10,\n 10,\n 11,\n 11,\n 12,\n 12,\n 13,\n 13\n ], extra_blbits = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7], bl_order = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], DIST_CODE_LEN = 512, static_ltree = new @Array((L_CODES + 2) * 2);\n zero(static_ltree);\n var static_dtree = new @Array(D_CODES * 2);\n zero(static_dtree);\n var _dist_code = new @Array(DIST_CODE_LEN);\n zero(_dist_code);\n var _length_code = new @Array(MAX_MATCH - MIN_MATCH + 1);\n zero(_length_code);\n var base_length = new @Array(LENGTH_CODES);\n zero(base_length);\n var base_dist = new @Array(D_CODES);\n zero(base_dist);\n function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {\n this.static_tree = static_tree, this.extra_bits = extra_bits, this.extra_base = extra_base, this.elems = elems, this.max_length = max_length, this.has_stree = static_tree && static_tree.length;\n }\n var static_l_desc, static_d_desc, static_bl_desc;\n function TreeDesc(dyn_tree, stat_desc) {\n this.dyn_tree = dyn_tree, this.max_code = 0, this.stat_desc = stat_desc;\n }\n function d_code(dist) {\n return dist < 256 \? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];\n }\n function put_short(s, w) {\n s.pending_buf[s.pending++] = w & 255, s.pending_buf[s.pending++] = w >>> 8 & 255;\n }\n function send_bits(s, value, length) {\n if (s.bi_valid > Buf_size - length)\n s.bi_buf |= value << s.bi_valid & 65535, put_short(s, s.bi_buf), s.bi_buf = value >> Buf_size - s.bi_valid, s.bi_valid += length - Buf_size;\n else\n s.bi_buf |= value << s.bi_valid & 65535, s.bi_valid += length;\n }\n function send_code(s, c, tree) {\n send_bits(s, tree[c * 2], tree[c * 2 + 1]);\n }\n function bi_reverse(code, len) {\n var res = 0;\n do\n res |= code & 1, code >>>= 1, res <<= 1;\n while (--len > 0);\n return res >>> 1;\n }\n function bi_flush(s) {\n if (s.bi_valid === 16)\n put_short(s, s.bi_buf), s.bi_buf = 0, s.bi_valid = 0;\n else if (s.bi_valid >= 8)\n s.pending_buf[s.pending++] = s.bi_buf & 255, s.bi_buf >>= 8, s.bi_valid -= 8;\n }\n function gen_bitlen(s, desc) {\n var { dyn_tree: tree, max_code } = desc, stree = desc.stat_desc.static_tree, has_stree = desc.stat_desc.has_stree, extra = desc.stat_desc.extra_bits, base = desc.stat_desc.extra_base, max_length = desc.stat_desc.max_length, h, n, m, bits, xbits, f, overflow = 0;\n for (bits = 0;bits <= MAX_BITS; bits++)\n s.bl_count[bits] = 0;\n tree[s.heap[s.heap_max] * 2 + 1] = 0;\n for (h = s.heap_max + 1;h < HEAP_SIZE; h++) {\n if (n = s.heap[h], bits = tree[tree[n * 2 + 1] * 2 + 1] + 1, bits > max_length)\n bits = max_length, overflow++;\n if (tree[n * 2 + 1] = bits, n > max_code)\n continue;\n if (s.bl_count[bits]++, xbits = 0, n >= base)\n xbits = extra[n - base];\n if (f = tree[n * 2], s.opt_len += f * (bits + xbits), has_stree)\n s.static_len += f * (stree[n * 2 + 1] + xbits);\n }\n if (overflow === 0)\n return;\n do {\n bits = max_length - 1;\n while (s.bl_count[bits] === 0)\n bits--;\n s.bl_count[bits]--, s.bl_count[bits + 1] += 2, s.bl_count[max_length]--, overflow -= 2;\n } while (overflow > 0);\n for (bits = max_length;bits !== 0; bits--) {\n n = s.bl_count[bits];\n while (n !== 0) {\n if (m = s.heap[--h], m > max_code)\n continue;\n if (tree[m * 2 + 1] !== bits)\n s.opt_len += (bits - tree[m * 2 + 1]) * tree[m * 2], tree[m * 2 + 1] = bits;\n n--;\n }\n }\n }\n function gen_codes(tree, max_code, bl_count) {\n var next_code = new @Array(MAX_BITS + 1), code = 0, bits, n;\n for (bits = 1;bits <= MAX_BITS; bits++)\n next_code[bits] = code = code + bl_count[bits - 1] << 1;\n for (n = 0;n <= max_code; n++) {\n var len = tree[n * 2 + 1];\n if (len === 0)\n continue;\n tree[n * 2] = bi_reverse(next_code[len]++, len);\n }\n }\n function tr_static_init() {\n var n, bits, length, code, dist, bl_count = new @Array(MAX_BITS + 1);\n length = 0;\n for (code = 0;code < LENGTH_CODES - 1; code++) {\n base_length[code] = length;\n for (n = 0;n < 1 << extra_lbits[code]; n++)\n _length_code[length++] = code;\n }\n _length_code[length - 1] = code, dist = 0;\n for (code = 0;code < 16; code++) {\n base_dist[code] = dist;\n for (n = 0;n < 1 << extra_dbits[code]; n++)\n _dist_code[dist++] = code;\n }\n dist >>= 7;\n for (;code < D_CODES; code++) {\n base_dist[code] = dist << 7;\n for (n = 0;n < 1 << extra_dbits[code] - 7; n++)\n _dist_code[256 + dist++] = code;\n }\n for (bits = 0;bits <= MAX_BITS; bits++)\n bl_count[bits] = 0;\n n = 0;\n while (n <= 143)\n static_ltree[n * 2 + 1] = 8, n++, bl_count[8]++;\n while (n <= 255)\n static_ltree[n * 2 + 1] = 9, n++, bl_count[9]++;\n while (n <= 279)\n static_ltree[n * 2 + 1] = 7, n++, bl_count[7]++;\n while (n <= 287)\n static_ltree[n * 2 + 1] = 8, n++, bl_count[8]++;\n gen_codes(static_ltree, L_CODES + 1, bl_count);\n for (n = 0;n < D_CODES; n++)\n static_dtree[n * 2 + 1] = 5, static_dtree[n * 2] = bi_reverse(n, 5);\n static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS), static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS), static_bl_desc = new StaticTreeDesc(new @Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS);\n }\n function init_block(s) {\n var n;\n for (n = 0;n < L_CODES; n++)\n s.dyn_ltree[n * 2] = 0;\n for (n = 0;n < D_CODES; n++)\n s.dyn_dtree[n * 2] = 0;\n for (n = 0;n < BL_CODES; n++)\n s.bl_tree[n * 2] = 0;\n s.dyn_ltree[END_BLOCK * 2] = 1, s.opt_len = s.static_len = 0, s.last_lit = s.matches = 0;\n }\n function bi_windup(s) {\n if (s.bi_valid > 8)\n put_short(s, s.bi_buf);\n else if (s.bi_valid > 0)\n s.pending_buf[s.pending++] = s.bi_buf;\n s.bi_buf = 0, s.bi_valid = 0;\n }\n function copy_block(s, buf, len, header) {\n if (bi_windup(s), header)\n put_short(s, len), put_short(s, ~len);\n utils.arraySet(s.pending_buf, s.window, buf, len, s.pending), s.pending += len;\n }\n function smaller(tree, n, m, depth) {\n var _n2 = n * 2, _m2 = m * 2;\n return tree[_n2] < tree[_m2] || tree[_n2] === tree[_m2] && depth[n] <= depth[m];\n }\n function pqdownheap(s, tree, k) {\n var v = s.heap[k], j = k << 1;\n while (j <= s.heap_len) {\n if (j < s.heap_len && smaller(tree, s.heap[j + 1], s.heap[j], s.depth))\n j++;\n if (smaller(tree, v, s.heap[j], s.depth))\n break;\n s.heap[k] = s.heap[j], k = j, j <<= 1;\n }\n s.heap[k] = v;\n }\n function compress_block(s, ltree, dtree) {\n var dist, lc, lx = 0, code, extra;\n if (s.last_lit !== 0)\n do\n if (dist = s.pending_buf[s.d_buf + lx * 2] << 8 | s.pending_buf[s.d_buf + lx * 2 + 1], lc = s.pending_buf[s.l_buf + lx], lx++, dist === 0)\n send_code(s, lc, ltree);\n else {\n if (code = _length_code[lc], send_code(s, code + LITERALS + 1, ltree), extra = extra_lbits[code], extra !== 0)\n lc -= base_length[code], send_bits(s, lc, extra);\n if (dist--, code = d_code(dist), send_code(s, code, dtree), extra = extra_dbits[code], extra !== 0)\n dist -= base_dist[code], send_bits(s, dist, extra);\n }\n while (lx < s.last_lit);\n send_code(s, END_BLOCK, ltree);\n }\n function build_tree(s, desc) {\n var tree = desc.dyn_tree, stree = desc.stat_desc.static_tree, has_stree = desc.stat_desc.has_stree, elems = desc.stat_desc.elems, n, m, max_code = -1, node;\n s.heap_len = 0, s.heap_max = HEAP_SIZE;\n for (n = 0;n < elems; n++)\n if (tree[n * 2] !== 0)\n s.heap[++s.heap_len] = max_code = n, s.depth[n] = 0;\n else\n tree[n * 2 + 1] = 0;\n while (s.heap_len < 2)\n if (node = s.heap[++s.heap_len] = max_code < 2 \? ++max_code : 0, tree[node * 2] = 1, s.depth[node] = 0, s.opt_len--, has_stree)\n s.static_len -= stree[node * 2 + 1];\n desc.max_code = max_code;\n for (n = s.heap_len >> 1;n >= 1; n--)\n pqdownheap(s, tree, n);\n node = elems;\n do\n n = s.heap[1], s.heap[1] = s.heap[s.heap_len--], pqdownheap(s, tree, 1), m = s.heap[1], s.heap[--s.heap_max] = n, s.heap[--s.heap_max] = m, tree[node * 2] = tree[n * 2] + tree[m * 2], s.depth[node] = (s.depth[n] >= s.depth[m] \? s.depth[n] : s.depth[m]) + 1, tree[n * 2 + 1] = tree[m * 2 + 1] = node, s.heap[1] = node++, pqdownheap(s, tree, 1);\n while (s.heap_len >= 2);\n s.heap[--s.heap_max] = s.heap[1], gen_bitlen(s, desc), gen_codes(tree, max_code, s.bl_count);\n }\n function scan_tree(s, tree, max_code) {\n var n, prevlen = -1, curlen, nextlen = tree[1], count = 0, max_count = 7, min_count = 4;\n if (nextlen === 0)\n max_count = 138, min_count = 3;\n tree[(max_code + 1) * 2 + 1] = 65535;\n for (n = 0;n <= max_code; n++) {\n if (curlen = nextlen, nextlen = tree[(n + 1) * 2 + 1], ++count < max_count && curlen === nextlen)\n continue;\n else if (count < min_count)\n s.bl_tree[curlen * 2] += count;\n else if (curlen !== 0) {\n if (curlen !== prevlen)\n s.bl_tree[curlen * 2]++;\n s.bl_tree[REP_3_6 * 2]++;\n } else if (count <= 10)\n s.bl_tree[REPZ_3_10 * 2]++;\n else\n s.bl_tree[REPZ_11_138 * 2]++;\n if (count = 0, prevlen = curlen, nextlen === 0)\n max_count = 138, min_count = 3;\n else if (curlen === nextlen)\n max_count = 6, min_count = 3;\n else\n max_count = 7, min_count = 4;\n }\n }\n function send_tree(s, tree, max_code) {\n var n, prevlen = -1, curlen, nextlen = tree[1], count = 0, max_count = 7, min_count = 4;\n if (nextlen === 0)\n max_count = 138, min_count = 3;\n for (n = 0;n <= max_code; n++) {\n if (curlen = nextlen, nextlen = tree[(n + 1) * 2 + 1], ++count < max_count && curlen === nextlen)\n continue;\n else if (count < min_count)\n do\n send_code(s, curlen, s.bl_tree);\n while (--count !== 0);\n else if (curlen !== 0) {\n if (curlen !== prevlen)\n send_code(s, curlen, s.bl_tree), count--;\n send_code(s, REP_3_6, s.bl_tree), send_bits(s, count - 3, 2);\n } else if (count <= 10)\n send_code(s, REPZ_3_10, s.bl_tree), send_bits(s, count - 3, 3);\n else\n send_code(s, REPZ_11_138, s.bl_tree), send_bits(s, count - 11, 7);\n if (count = 0, prevlen = curlen, nextlen === 0)\n max_count = 138, min_count = 3;\n else if (curlen === nextlen)\n max_count = 6, min_count = 3;\n else\n max_count = 7, min_count = 4;\n }\n }\n function build_bl_tree(s) {\n var max_blindex;\n scan_tree(s, s.dyn_ltree, s.l_desc.max_code), scan_tree(s, s.dyn_dtree, s.d_desc.max_code), build_tree(s, s.bl_desc);\n for (max_blindex = BL_CODES - 1;max_blindex >= 3; max_blindex--)\n if (s.bl_tree[bl_order[max_blindex] * 2 + 1] !== 0)\n break;\n return s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4, max_blindex;\n }\n function send_all_trees(s, lcodes, dcodes, blcodes) {\n var rank;\n send_bits(s, lcodes - 257, 5), send_bits(s, dcodes - 1, 5), send_bits(s, blcodes - 4, 4);\n for (rank = 0;rank < blcodes; rank++)\n send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1], 3);\n send_tree(s, s.dyn_ltree, lcodes - 1), send_tree(s, s.dyn_dtree, dcodes - 1);\n }\n function detect_data_type(s) {\n var black_mask = 4093624447, n;\n for (n = 0;n <= 31; n++, black_mask >>>= 1)\n if (black_mask & 1 && s.dyn_ltree[n * 2] !== 0)\n return Z_BINARY;\n if (s.dyn_ltree[18] !== 0 || s.dyn_ltree[20] !== 0 || s.dyn_ltree[26] !== 0)\n return Z_TEXT;\n for (n = 32;n < LITERALS; n++)\n if (s.dyn_ltree[n * 2] !== 0)\n return Z_TEXT;\n return Z_BINARY;\n }\n var static_init_done = !1;\n function _tr_init(s) {\n if (!static_init_done)\n tr_static_init(), static_init_done = !0;\n s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc), s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc), s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc), s.bi_buf = 0, s.bi_valid = 0, init_block(s);\n }\n function _tr_stored_block(s, buf, stored_len, last) {\n send_bits(s, (STORED_BLOCK << 1) + (last \? 1 : 0), 3), copy_block(s, buf, stored_len, !0);\n }\n function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3), send_code(s, END_BLOCK, static_ltree), bi_flush(s);\n }\n function _tr_flush_block(s, buf, stored_len, last) {\n var opt_lenb, static_lenb, max_blindex = 0;\n if (s.level > 0) {\n if (s.strm.data_type === Z_UNKNOWN)\n s.strm.data_type = detect_data_type(s);\n if (build_tree(s, s.l_desc), build_tree(s, s.d_desc), max_blindex = build_bl_tree(s), opt_lenb = s.opt_len + 3 + 7 >>> 3, static_lenb = s.static_len + 3 + 7 >>> 3, static_lenb <= opt_lenb)\n opt_lenb = static_lenb;\n } else\n opt_lenb = static_lenb = stored_len + 5;\n if (stored_len + 4 <= opt_lenb && buf !== -1)\n _tr_stored_block(s, buf, stored_len, last);\n else if (s.strategy === Z_FIXED || static_lenb === opt_lenb)\n send_bits(s, (STATIC_TREES << 1) + (last \? 1 : 0), 3), compress_block(s, static_ltree, static_dtree);\n else\n send_bits(s, (DYN_TREES << 1) + (last \? 1 : 0), 3), send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1), compress_block(s, s.dyn_ltree, s.dyn_dtree);\n if (init_block(s), last)\n bi_windup(s);\n }\n function _tr_tally(s, dist, lc) {\n if (s.pending_buf[s.d_buf + s.last_lit * 2] = dist >>> 8 & 255, s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 255, s.pending_buf[s.l_buf + s.last_lit] = lc & 255, s.last_lit++, dist === 0)\n s.dyn_ltree[lc * 2]++;\n else\n s.matches++, dist--, s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]++, s.dyn_dtree[d_code(dist) * 2]++;\n return s.last_lit === s.lit_bufsize - 1;\n }\n exports._tr_init = _tr_init, exports._tr_stored_block = _tr_stored_block, exports._tr_flush_block = _tr_flush_block, exports._tr_tally = _tr_tally, exports._tr_align = _tr_align;\n }\n}), require_adler32 = __commonJS({\n \"node_modules/pako/lib/zlib/adler32.js\"(exports, module2) {\n function adler32(adler, buf, len, pos) {\n var s1 = adler & 65535 | 0, s2 = adler >>> 16 & 65535 | 0, n = 0;\n while (len !== 0) {\n n = len > 2000 \? 2000 : len, len -= n;\n do\n s1 = s1 + buf[pos++] | 0, s2 = s2 + s1 | 0;\n while (--n);\n s1 %= 65521, s2 %= 65521;\n }\n return s1 | s2 << 16 | 0;\n }\n module2.exports = adler32;\n }\n}), require_crc32 = __commonJS({\n \"node_modules/pako/lib/zlib/crc32.js\"(exports, module2) {\n function makeTable() {\n var c, table = [];\n for (var n = 0;n < 256; n++) {\n c = n;\n for (var k = 0;k < 8; k++)\n c = c & 1 \? 3988292384 ^ c >>> 1 : c >>> 1;\n table[n] = c;\n }\n return table;\n }\n var crcTable = makeTable();\n function crc32(crc, buf, len, pos) {\n var t = crcTable, end = pos + len;\n crc ^= -1;\n for (var i = pos;i < end; i++)\n crc = crc >>> 8 ^ t[(crc ^ buf[i]) & 255];\n return crc ^ -1;\n }\n module2.exports = crc32;\n }\n}), require_messages = __commonJS({\n \"node_modules/pako/lib/zlib/messages.js\"(exports, module2) {\n module2.exports = {\n 2: \"need dictionary\",\n 1: \"stream end\",\n 0: \"\",\n \"-1\": \"file error\",\n \"-2\": \"stream error\",\n \"-3\": \"data error\",\n \"-4\": \"insufficient memory\",\n \"-5\": \"buffer error\",\n \"-6\": \"incompatible version\"\n };\n }\n}), require_deflate = __commonJS({\n \"node_modules/pako/lib/zlib/deflate.js\"(exports) {\n var utils = require_common(), trees = require_trees(), adler32 = require_adler32(), crc32 = require_crc32(), msg = require_messages(), Z_NO_FLUSH = 0, Z_PARTIAL_FLUSH = 1, Z_FULL_FLUSH = 3, Z_FINISH = 4, Z_BLOCK = 5, Z_OK = 0, Z_STREAM_END = 1, Z_STREAM_ERROR = -2, Z_DATA_ERROR = -3, Z_BUF_ERROR = -5, Z_DEFAULT_COMPRESSION = -1, Z_FILTERED = 1, Z_HUFFMAN_ONLY = 2, Z_RLE = 3, Z_FIXED = 4, Z_DEFAULT_STRATEGY = 0, Z_UNKNOWN = 2, Z_DEFLATED = 8, MAX_MEM_LEVEL = 9, MAX_WBITS = 15, DEF_MEM_LEVEL = 8, LENGTH_CODES = 29, LITERALS = 256, L_CODES = LITERALS + 1 + LENGTH_CODES, D_CODES = 30, BL_CODES = 19, HEAP_SIZE = 2 * L_CODES + 1, MAX_BITS = 15, MIN_MATCH = 3, MAX_MATCH = 258, MIN_LOOKAHEAD = MAX_MATCH + MIN_MATCH + 1, PRESET_DICT = 32, INIT_STATE = 42, EXTRA_STATE = 69, NAME_STATE = 73, COMMENT_STATE = 91, HCRC_STATE = 103, BUSY_STATE = 113, FINISH_STATE = 666, BS_NEED_MORE = 1, BS_BLOCK_DONE = 2, BS_FINISH_STARTED = 3, BS_FINISH_DONE = 4, OS_CODE = 3;\n function err(strm, errorCode) {\n return strm.msg = msg[errorCode], errorCode;\n }\n function rank(f) {\n return (f << 1) - (f > 4 \? 9 : 0);\n }\n function zero(buf) {\n var len = buf.length;\n while (--len >= 0)\n buf[len] = 0;\n }\n function flush_pending(strm) {\n var s = strm.state, len = s.pending;\n if (len > strm.avail_out)\n len = strm.avail_out;\n if (len === 0)\n return;\n if (utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out), strm.next_out += len, s.pending_out += len, strm.total_out += len, strm.avail_out -= len, s.pending -= len, s.pending === 0)\n s.pending_out = 0;\n }\n function flush_block_only(s, last) {\n trees._tr_flush_block(s, s.block_start >= 0 \? s.block_start : -1, s.strstart - s.block_start, last), s.block_start = s.strstart, flush_pending(s.strm);\n }\n function put_byte(s, b) {\n s.pending_buf[s.pending++] = b;\n }\n function putShortMSB(s, b) {\n s.pending_buf[s.pending++] = b >>> 8 & 255, s.pending_buf[s.pending++] = b & 255;\n }\n function read_buf(strm, buf, start, size) {\n var len = strm.avail_in;\n if (len > size)\n len = size;\n if (len === 0)\n return 0;\n if (strm.avail_in -= len, utils.arraySet(buf, strm.input, strm.next_in, len, start), strm.state.wrap === 1)\n strm.adler = adler32(strm.adler, buf, len, start);\n else if (strm.state.wrap === 2)\n strm.adler = crc32(strm.adler, buf, len, start);\n return strm.next_in += len, strm.total_in += len, len;\n }\n function longest_match(s, cur_match) {\n var { max_chain_length: chain_length, strstart: scan } = s, match, len, best_len = s.prev_length, nice_match = s.nice_match, limit = s.strstart > s.w_size - MIN_LOOKAHEAD \? s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0, _win = s.window, wmask = s.w_mask, prev = s.prev, strend = s.strstart + MAX_MATCH, scan_end1 = _win[scan + best_len - 1], scan_end = _win[scan + best_len];\n if (s.prev_length >= s.good_match)\n chain_length >>= 2;\n if (nice_match > s.lookahead)\n nice_match = s.lookahead;\n do {\n if (match = cur_match, _win[match + best_len] !== scan_end || _win[match + best_len - 1] !== scan_end1 || _win[match] !== _win[scan] || _win[++match] !== _win[scan + 1])\n continue;\n scan += 2, match++;\n do\n ;\n while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && scan < strend);\n if (len = MAX_MATCH - (strend - scan), scan = strend - MAX_MATCH, len > best_len) {\n if (s.match_start = cur_match, best_len = len, len >= nice_match)\n break;\n scan_end1 = _win[scan + best_len - 1], scan_end = _win[scan + best_len];\n }\n } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);\n if (best_len <= s.lookahead)\n return best_len;\n return s.lookahead;\n }\n function fill_window(s) {\n var _w_size = s.w_size, p, n, m, more, str;\n do {\n if (more = s.window_size - s.lookahead - s.strstart, s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {\n utils.arraySet(s.window, s.window, _w_size, _w_size, 0), s.match_start -= _w_size, s.strstart -= _w_size, s.block_start -= _w_size, n = s.hash_size, p = n;\n do\n m = s.head[--p], s.head[p] = m >= _w_size \? m - _w_size : 0;\n while (--n);\n n = _w_size, p = n;\n do\n m = s.prev[--p], s.prev[p] = m >= _w_size \? m - _w_size : 0;\n while (--n);\n more += _w_size;\n }\n if (s.strm.avail_in === 0)\n break;\n if (n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more), s.lookahead += n, s.lookahead + s.insert >= MIN_MATCH) {\n str = s.strstart - s.insert, s.ins_h = s.window[str], s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + 1]) & s.hash_mask;\n while (s.insert)\n if (s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask, s.prev[str & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = str, str++, s.insert--, s.lookahead + s.insert < MIN_MATCH)\n break;\n }\n } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);\n }\n function deflate_stored(s, flush) {\n var max_block_size = 65535;\n if (max_block_size > s.pending_buf_size - 5)\n max_block_size = s.pending_buf_size - 5;\n for (;; ) {\n if (s.lookahead <= 1) {\n if (fill_window(s), s.lookahead === 0 && flush === Z_NO_FLUSH)\n return BS_NEED_MORE;\n if (s.lookahead === 0)\n break;\n }\n s.strstart += s.lookahead, s.lookahead = 0;\n var max_start = s.block_start + max_block_size;\n if (s.strstart === 0 || s.strstart >= max_start) {\n if (s.lookahead = s.strstart - max_start, s.strstart = max_start, flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n if (s.strstart - s.block_start >= s.w_size - MIN_LOOKAHEAD) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n }\n if (s.insert = 0, flush === Z_FINISH) {\n if (flush_block_only(s, !0), s.strm.avail_out === 0)\n return BS_FINISH_STARTED;\n return BS_FINISH_DONE;\n }\n if (s.strstart > s.block_start) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n return BS_NEED_MORE;\n }\n function deflate_fast(s, flush) {\n var hash_head, bflush;\n for (;; ) {\n if (s.lookahead < MIN_LOOKAHEAD) {\n if (fill_window(s), s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH)\n return BS_NEED_MORE;\n if (s.lookahead === 0)\n break;\n }\n if (hash_head = 0, s.lookahead >= MIN_MATCH)\n s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask, hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = s.strstart;\n if (hash_head !== 0 && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD)\n s.match_length = longest_match(s, hash_head);\n if (s.match_length >= MIN_MATCH)\n if (bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH), s.lookahead -= s.match_length, s.match_length <= s.max_lazy_match && s.lookahead >= MIN_MATCH) {\n s.match_length--;\n do\n s.strstart++, s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask, hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = s.strstart;\n while (--s.match_length !== 0);\n s.strstart++;\n } else\n s.strstart += s.match_length, s.match_length = 0, s.ins_h = s.window[s.strstart], s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + 1]) & s.hash_mask;\n else\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]), s.lookahead--, s.strstart++;\n if (bflush) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n }\n if (s.insert = s.strstart < MIN_MATCH - 1 \? s.strstart : MIN_MATCH - 1, flush === Z_FINISH) {\n if (flush_block_only(s, !0), s.strm.avail_out === 0)\n return BS_FINISH_STARTED;\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n return BS_BLOCK_DONE;\n }\n function deflate_slow(s, flush) {\n var hash_head, bflush, max_insert;\n for (;; ) {\n if (s.lookahead < MIN_LOOKAHEAD) {\n if (fill_window(s), s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH)\n return BS_NEED_MORE;\n if (s.lookahead === 0)\n break;\n }\n if (hash_head = 0, s.lookahead >= MIN_MATCH)\n s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask, hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = s.strstart;\n if (s.prev_length = s.match_length, s.prev_match = s.match_start, s.match_length = MIN_MATCH - 1, hash_head !== 0 && s.prev_length < s.max_lazy_match && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD) {\n if (s.match_length = longest_match(s, hash_head), s.match_length <= 5 && (s.strategy === Z_FILTERED || s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096))\n s.match_length = MIN_MATCH - 1;\n }\n if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {\n max_insert = s.strstart + s.lookahead - MIN_MATCH, bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH), s.lookahead -= s.prev_length - 1, s.prev_length -= 2;\n do\n if (++s.strstart <= max_insert)\n s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask, hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = s.strstart;\n while (--s.prev_length !== 0);\n if (s.match_available = 0, s.match_length = MIN_MATCH - 1, s.strstart++, bflush) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n } else if (s.match_available) {\n if (bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]), bflush)\n flush_block_only(s, !1);\n if (s.strstart++, s.lookahead--, s.strm.avail_out === 0)\n return BS_NEED_MORE;\n } else\n s.match_available = 1, s.strstart++, s.lookahead--;\n }\n if (s.match_available)\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]), s.match_available = 0;\n if (s.insert = s.strstart < MIN_MATCH - 1 \? s.strstart : MIN_MATCH - 1, flush === Z_FINISH) {\n if (flush_block_only(s, !0), s.strm.avail_out === 0)\n return BS_FINISH_STARTED;\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n return BS_BLOCK_DONE;\n }\n function deflate_rle(s, flush) {\n var bflush, prev, scan, strend, _win = s.window;\n for (;; ) {\n if (s.lookahead <= MAX_MATCH) {\n if (fill_window(s), s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH)\n return BS_NEED_MORE;\n if (s.lookahead === 0)\n break;\n }\n if (s.match_length = 0, s.lookahead >= MIN_MATCH && s.strstart > 0) {\n if (scan = s.strstart - 1, prev = _win[scan], prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {\n strend = s.strstart + MAX_MATCH;\n do\n ;\n while (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && scan < strend);\n if (s.match_length = MAX_MATCH - (strend - scan), s.match_length > s.lookahead)\n s.match_length = s.lookahead;\n }\n }\n if (s.match_length >= MIN_MATCH)\n bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH), s.lookahead -= s.match_length, s.strstart += s.match_length, s.match_length = 0;\n else\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]), s.lookahead--, s.strstart++;\n if (bflush) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n }\n if (s.insert = 0, flush === Z_FINISH) {\n if (flush_block_only(s, !0), s.strm.avail_out === 0)\n return BS_FINISH_STARTED;\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n return BS_BLOCK_DONE;\n }\n function deflate_huff(s, flush) {\n var bflush;\n for (;; ) {\n if (s.lookahead === 0) {\n if (fill_window(s), s.lookahead === 0) {\n if (flush === Z_NO_FLUSH)\n return BS_NEED_MORE;\n break;\n }\n }\n if (s.match_length = 0, bflush = trees._tr_tally(s, 0, s.window[s.strstart]), s.lookahead--, s.strstart++, bflush) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n }\n if (s.insert = 0, flush === Z_FINISH) {\n if (flush_block_only(s, !0), s.strm.avail_out === 0)\n return BS_FINISH_STARTED;\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n if (flush_block_only(s, !1), s.strm.avail_out === 0)\n return BS_NEED_MORE;\n }\n return BS_BLOCK_DONE;\n }\n function Config(good_length, max_lazy, nice_length, max_chain, func) {\n this.good_length = good_length, this.max_lazy = max_lazy, this.nice_length = nice_length, this.max_chain = max_chain, this.func = func;\n }\n var configuration_table = [\n new Config(0, 0, 0, 0, deflate_stored),\n new Config(4, 4, 8, 4, deflate_fast),\n new Config(4, 5, 16, 8, deflate_fast),\n new Config(4, 6, 32, 32, deflate_fast),\n new Config(4, 4, 16, 16, deflate_slow),\n new Config(8, 16, 32, 32, deflate_slow),\n new Config(8, 16, 128, 128, deflate_slow),\n new Config(8, 32, 128, 256, deflate_slow),\n new Config(32, 128, 258, 1024, deflate_slow),\n new Config(32, 258, 258, 4096, deflate_slow)\n ];\n function lm_init(s) {\n s.window_size = 2 * s.w_size, zero(s.head), s.max_lazy_match = configuration_table[s.level].max_lazy, s.good_match = configuration_table[s.level].good_length, s.nice_match = configuration_table[s.level].nice_length, s.max_chain_length = configuration_table[s.level].max_chain, s.strstart = 0, s.block_start = 0, s.lookahead = 0, s.insert = 0, s.match_length = s.prev_length = MIN_MATCH - 1, s.match_available = 0, s.ins_h = 0;\n }\n function DeflateState() {\n this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = Z_DEFLATED, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2), this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2), this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2), zero(this.dyn_ltree), zero(this.dyn_dtree), zero(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new utils.Buf16(MAX_BITS + 1), this.heap = new utils.Buf16(2 * L_CODES + 1), zero(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new utils.Buf16(2 * L_CODES + 1), zero(this.depth), this.l_buf = 0, this.lit_bufsize = 0, this.last_lit = 0, this.d_buf = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0;\n }\n function deflateResetKeep(strm) {\n var s;\n if (!strm || !strm.state)\n return err(strm, Z_STREAM_ERROR);\n if (strm.total_in = strm.total_out = 0, strm.data_type = Z_UNKNOWN, s = strm.state, s.pending = 0, s.pending_out = 0, s.wrap < 0)\n s.wrap = -s.wrap;\n return s.status = s.wrap \? INIT_STATE : BUSY_STATE, strm.adler = s.wrap === 2 \? 0 : 1, s.last_flush = Z_NO_FLUSH, trees._tr_init(s), Z_OK;\n }\n function deflateReset(strm) {\n var ret = deflateResetKeep(strm);\n if (ret === Z_OK)\n lm_init(strm.state);\n return ret;\n }\n function deflateSetHeader(strm, head) {\n if (!strm || !strm.state)\n return Z_STREAM_ERROR;\n if (strm.state.wrap !== 2)\n return Z_STREAM_ERROR;\n return strm.state.gzhead = head, Z_OK;\n }\n function deflateInit2(strm, level, method, windowBits, memLevel, strategy) {\n if (!strm)\n return Z_STREAM_ERROR;\n var wrap = 1;\n if (level === Z_DEFAULT_COMPRESSION)\n level = 6;\n if (windowBits < 0)\n wrap = 0, windowBits = -windowBits;\n else if (windowBits > 15)\n wrap = 2, windowBits -= 16;\n if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED)\n return err(strm, Z_STREAM_ERROR);\n if (windowBits === 8)\n windowBits = 9;\n var s = new DeflateState;\n return strm.state = s, s.strm = strm, s.wrap = wrap, s.gzhead = null, s.w_bits = windowBits, s.w_size = 1 << s.w_bits, s.w_mask = s.w_size - 1, s.hash_bits = memLevel + 7, s.hash_size = 1 << s.hash_bits, s.hash_mask = s.hash_size - 1, s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH), s.window = new utils.Buf8(s.w_size * 2), s.head = new utils.Buf16(s.hash_size), s.prev = new utils.Buf16(s.w_size), s.lit_bufsize = 1 << memLevel + 6, s.pending_buf_size = s.lit_bufsize * 4, s.pending_buf = new utils.Buf8(s.pending_buf_size), s.d_buf = 1 * s.lit_bufsize, s.l_buf = 3 * s.lit_bufsize, s.level = level, s.strategy = strategy, s.method = method, deflateReset(strm);\n }\n function deflateInit(strm, level) {\n return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);\n }\n function deflate(strm, flush) {\n var old_flush, s, beg, val;\n if (!strm || !strm.state || flush > Z_BLOCK || flush < 0)\n return strm \? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;\n if (s = strm.state, !strm.output || !strm.input && strm.avail_in !== 0 || s.status === FINISH_STATE && flush !== Z_FINISH)\n return err(strm, strm.avail_out === 0 \? Z_BUF_ERROR : Z_STREAM_ERROR);\n if (s.strm = strm, old_flush = s.last_flush, s.last_flush = flush, s.status === INIT_STATE)\n if (s.wrap === 2)\n if (strm.adler = 0, put_byte(s, 31), put_byte(s, 139), put_byte(s, 8), !s.gzhead)\n put_byte(s, 0), put_byte(s, 0), put_byte(s, 0), put_byte(s, 0), put_byte(s, 0), put_byte(s, s.level === 9 \? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 \? 4 : 0), put_byte(s, OS_CODE), s.status = BUSY_STATE;\n else {\n if (put_byte(s, (s.gzhead.text \? 1 : 0) + (s.gzhead.hcrc \? 2 : 0) + (!s.gzhead.extra \? 0 : 4) + (!s.gzhead.name \? 0 : 8) + (!s.gzhead.comment \? 0 : 16)), put_byte(s, s.gzhead.time & 255), put_byte(s, s.gzhead.time >> 8 & 255), put_byte(s, s.gzhead.time >> 16 & 255), put_byte(s, s.gzhead.time >> 24 & 255), put_byte(s, s.level === 9 \? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 \? 4 : 0), put_byte(s, s.gzhead.os & 255), s.gzhead.extra && s.gzhead.extra.length)\n put_byte(s, s.gzhead.extra.length & 255), put_byte(s, s.gzhead.extra.length >> 8 & 255);\n if (s.gzhead.hcrc)\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);\n s.gzindex = 0, s.status = EXTRA_STATE;\n }\n else {\n var header = Z_DEFLATED + (s.w_bits - 8 << 4) << 8, level_flags = -1;\n if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2)\n level_flags = 0;\n else if (s.level < 6)\n level_flags = 1;\n else if (s.level === 6)\n level_flags = 2;\n else\n level_flags = 3;\n if (header |= level_flags << 6, s.strstart !== 0)\n header |= PRESET_DICT;\n if (header += 31 - header % 31, s.status = BUSY_STATE, putShortMSB(s, header), s.strstart !== 0)\n putShortMSB(s, strm.adler >>> 16), putShortMSB(s, strm.adler & 65535);\n strm.adler = 1;\n }\n if (s.status === EXTRA_STATE)\n if (s.gzhead.extra) {\n beg = s.pending;\n while (s.gzindex < (s.gzhead.extra.length & 65535)) {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg)\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n if (flush_pending(strm), beg = s.pending, s.pending === s.pending_buf_size)\n break;\n }\n put_byte(s, s.gzhead.extra[s.gzindex] & 255), s.gzindex++;\n }\n if (s.gzhead.hcrc && s.pending > beg)\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n if (s.gzindex === s.gzhead.extra.length)\n s.gzindex = 0, s.status = NAME_STATE;\n } else\n s.status = NAME_STATE;\n if (s.status === NAME_STATE)\n if (s.gzhead.name) {\n beg = s.pending;\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg)\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n if (flush_pending(strm), beg = s.pending, s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n if (s.gzindex < s.gzhead.name.length)\n val = s.gzhead.name.charCodeAt(s.gzindex++) & 255;\n else\n val = 0;\n put_byte(s, val);\n } while (val !== 0);\n if (s.gzhead.hcrc && s.pending > beg)\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n if (val === 0)\n s.gzindex = 0, s.status = COMMENT_STATE;\n } else\n s.status = COMMENT_STATE;\n if (s.status === COMMENT_STATE)\n if (s.gzhead.comment) {\n beg = s.pending;\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg)\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n if (flush_pending(strm), beg = s.pending, s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n if (s.gzindex < s.gzhead.comment.length)\n val = s.gzhead.comment.charCodeAt(s.gzindex++) & 255;\n else\n val = 0;\n put_byte(s, val);\n } while (val !== 0);\n if (s.gzhead.hcrc && s.pending > beg)\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n if (val === 0)\n s.status = HCRC_STATE;\n } else\n s.status = HCRC_STATE;\n if (s.status === HCRC_STATE)\n if (s.gzhead.hcrc) {\n if (s.pending + 2 > s.pending_buf_size)\n flush_pending(strm);\n if (s.pending + 2 <= s.pending_buf_size)\n put_byte(s, strm.adler & 255), put_byte(s, strm.adler >> 8 & 255), strm.adler = 0, s.status = BUSY_STATE;\n } else\n s.status = BUSY_STATE;\n if (s.pending !== 0) {\n if (flush_pending(strm), strm.avail_out === 0)\n return s.last_flush = -1, Z_OK;\n } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && flush !== Z_FINISH)\n return err(strm, Z_BUF_ERROR);\n if (s.status === FINISH_STATE && strm.avail_in !== 0)\n return err(strm, Z_BUF_ERROR);\n if (strm.avail_in !== 0 || s.lookahead !== 0 || flush !== Z_NO_FLUSH && s.status !== FINISH_STATE) {\n var bstate = s.strategy === Z_HUFFMAN_ONLY \? deflate_huff(s, flush) : s.strategy === Z_RLE \? deflate_rle(s, flush) : configuration_table[s.level].func(s, flush);\n if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE)\n s.status = FINISH_STATE;\n if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {\n if (strm.avail_out === 0)\n s.last_flush = -1;\n return Z_OK;\n }\n if (bstate === BS_BLOCK_DONE) {\n if (flush === Z_PARTIAL_FLUSH)\n trees._tr_align(s);\n else if (flush !== Z_BLOCK) {\n if (trees._tr_stored_block(s, 0, 0, !1), flush === Z_FULL_FLUSH) {\n if (zero(s.head), s.lookahead === 0)\n s.strstart = 0, s.block_start = 0, s.insert = 0;\n }\n }\n if (flush_pending(strm), strm.avail_out === 0)\n return s.last_flush = -1, Z_OK;\n }\n }\n if (flush !== Z_FINISH)\n return Z_OK;\n if (s.wrap <= 0)\n return Z_STREAM_END;\n if (s.wrap === 2)\n put_byte(s, strm.adler & 255), put_byte(s, strm.adler >> 8 & 255), put_byte(s, strm.adler >> 16 & 255), put_byte(s, strm.adler >> 24 & 255), put_byte(s, strm.total_in & 255), put_byte(s, strm.total_in >> 8 & 255), put_byte(s, strm.total_in >> 16 & 255), put_byte(s, strm.total_in >> 24 & 255);\n else\n putShortMSB(s, strm.adler >>> 16), putShortMSB(s, strm.adler & 65535);\n if (flush_pending(strm), s.wrap > 0)\n s.wrap = -s.wrap;\n return s.pending !== 0 \? Z_OK : Z_STREAM_END;\n }\n function deflateEnd(strm) {\n var status;\n if (!strm || !strm.state)\n return Z_STREAM_ERROR;\n if (status = strm.state.status, status !== INIT_STATE && status !== EXTRA_STATE && status !== NAME_STATE && status !== COMMENT_STATE && status !== HCRC_STATE && status !== BUSY_STATE && status !== FINISH_STATE)\n return err(strm, Z_STREAM_ERROR);\n return strm.state = null, status === BUSY_STATE \? err(strm, Z_DATA_ERROR) : Z_OK;\n }\n function deflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length, s, str, n, wrap, avail, next, input, tmpDict;\n if (!strm || !strm.state)\n return Z_STREAM_ERROR;\n if (s = strm.state, wrap = s.wrap, wrap === 2 || wrap === 1 && s.status !== INIT_STATE || s.lookahead)\n return Z_STREAM_ERROR;\n if (wrap === 1)\n strm.adler = adler32(strm.adler, dictionary, dictLength, 0);\n if (s.wrap = 0, dictLength >= s.w_size) {\n if (wrap === 0)\n zero(s.head), s.strstart = 0, s.block_start = 0, s.insert = 0;\n tmpDict = new utils.Buf8(s.w_size), utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0), dictionary = tmpDict, dictLength = s.w_size;\n }\n avail = strm.avail_in, next = strm.next_in, input = strm.input, strm.avail_in = dictLength, strm.next_in = 0, strm.input = dictionary, fill_window(s);\n while (s.lookahead >= MIN_MATCH) {\n str = s.strstart, n = s.lookahead - (MIN_MATCH - 1);\n do\n s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask, s.prev[str & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = str, str++;\n while (--n);\n s.strstart = str, s.lookahead = MIN_MATCH - 1, fill_window(s);\n }\n return s.strstart += s.lookahead, s.block_start = s.strstart, s.insert = s.lookahead, s.lookahead = 0, s.match_length = s.prev_length = MIN_MATCH - 1, s.match_available = 0, strm.next_in = next, strm.input = input, strm.avail_in = avail, s.wrap = wrap, Z_OK;\n }\n exports.deflateInit = deflateInit, exports.deflateInit2 = deflateInit2, exports.deflateReset = deflateReset, exports.deflateResetKeep = deflateResetKeep, exports.deflateSetHeader = deflateSetHeader, exports.deflate = deflate, exports.deflateEnd = deflateEnd, exports.deflateSetDictionary = deflateSetDictionary, exports.deflateInfo = \"pako deflate (from Nodeca project)\";\n }\n}), require_inffast = __commonJS({\n \"node_modules/pako/lib/zlib/inffast.js\"(exports, module2) {\n var BAD = 30, TYPE = 12;\n module2.exports = function inflate_fast(strm, start) {\n var state, _in, last, _out, beg, end, dmax, wsize, whave, wnext, s_window, hold, bits, lcode, dcode, lmask, dmask, here, op, len, dist, from, from_source, input, output;\n state = strm.state, _in = strm.next_in, input = strm.input, last = _in + (strm.avail_in - 5), _out = strm.next_out, output = strm.output, beg = _out - (start - strm.avail_out), end = _out + (strm.avail_out - 257), dmax = state.dmax, wsize = state.wsize, whave = state.whave, wnext = state.wnext, s_window = state.window, hold = state.hold, bits = state.bits, lcode = state.lencode, dcode = state.distcode, lmask = (1 << state.lenbits) - 1, dmask = (1 << state.distbits) - 1;\n top:\n do {\n if (bits < 15)\n hold += input[_in++] << bits, bits += 8, hold += input[_in++] << bits, bits += 8;\n here = lcode[hold & lmask];\n dolen:\n for (;; ) {\n if (op = here >>> 24, hold >>>= op, bits -= op, op = here >>> 16 & 255, op === 0)\n output[_out++] = here & 65535;\n else if (op & 16) {\n if (len = here & 65535, op &= 15, op) {\n if (bits < op)\n hold += input[_in++] << bits, bits += 8;\n len += hold & (1 << op) - 1, hold >>>= op, bits -= op;\n }\n if (bits < 15)\n hold += input[_in++] << bits, bits += 8, hold += input[_in++] << bits, bits += 8;\n here = dcode[hold & dmask];\n dodist:\n for (;; ) {\n if (op = here >>> 24, hold >>>= op, bits -= op, op = here >>> 16 & 255, op & 16) {\n if (dist = here & 65535, op &= 15, bits < op) {\n if (hold += input[_in++] << bits, bits += 8, bits < op)\n hold += input[_in++] << bits, bits += 8;\n }\n if (dist += hold & (1 << op) - 1, dist > dmax) {\n strm.msg = \"invalid distance too far back\", state.mode = BAD;\n break top;\n }\n if (hold >>>= op, bits -= op, op = _out - beg, dist > op) {\n if (op = dist - op, op > whave) {\n if (state.sane) {\n strm.msg = \"invalid distance too far back\", state.mode = BAD;\n break top;\n }\n }\n if (from = 0, from_source = s_window, wnext === 0) {\n if (from += wsize - op, op < len) {\n len -= op;\n do\n output[_out++] = s_window[from++];\n while (--op);\n from = _out - dist, from_source = output;\n }\n } else if (wnext < op) {\n if (from += wsize + wnext - op, op -= wnext, op < len) {\n len -= op;\n do\n output[_out++] = s_window[from++];\n while (--op);\n if (from = 0, wnext < len) {\n op = wnext, len -= op;\n do\n output[_out++] = s_window[from++];\n while (--op);\n from = _out - dist, from_source = output;\n }\n }\n } else if (from += wnext - op, op < len) {\n len -= op;\n do\n output[_out++] = s_window[from++];\n while (--op);\n from = _out - dist, from_source = output;\n }\n while (len > 2)\n output[_out++] = from_source[from++], output[_out++] = from_source[from++], output[_out++] = from_source[from++], len -= 3;\n if (len) {\n if (output[_out++] = from_source[from++], len > 1)\n output[_out++] = from_source[from++];\n }\n } else {\n from = _out - dist;\n do\n output[_out++] = output[from++], output[_out++] = output[from++], output[_out++] = output[from++], len -= 3;\n while (len > 2);\n if (len) {\n if (output[_out++] = output[from++], len > 1)\n output[_out++] = output[from++];\n }\n }\n } else if ((op & 64) === 0) {\n here = dcode[(here & 65535) + (hold & (1 << op) - 1)];\n continue dodist;\n } else {\n strm.msg = \"invalid distance code\", state.mode = BAD;\n break top;\n }\n break;\n }\n } else if ((op & 64) === 0) {\n here = lcode[(here & 65535) + (hold & (1 << op) - 1)];\n continue dolen;\n } else if (op & 32) {\n state.mode = TYPE;\n break top;\n } else {\n strm.msg = \"invalid literal/length code\", state.mode = BAD;\n break top;\n }\n break;\n }\n } while (_in < last && _out < end);\n len = bits >> 3, _in -= len, bits -= len << 3, hold &= (1 << bits) - 1, strm.next_in = _in, strm.next_out = _out, strm.avail_in = _in < last \? 5 + (last - _in) : 5 - (_in - last), strm.avail_out = _out < end \? 257 + (end - _out) : 257 - (_out - end), state.hold = hold, state.bits = bits;\n return;\n };\n }\n}), require_inftrees = __commonJS({\n \"node_modules/pako/lib/zlib/inftrees.js\"(exports, module2) {\n var utils = require_common(), MAXBITS = 15, ENOUGH_LENS = 852, ENOUGH_DISTS = 592, CODES = 0, LENS = 1, DISTS = 2, lbase = [\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 13,\n 15,\n 17,\n 19,\n 23,\n 27,\n 31,\n 35,\n 43,\n 51,\n 59,\n 67,\n 83,\n 99,\n 115,\n 131,\n 163,\n 195,\n 227,\n 258,\n 0,\n 0\n ], lext = [\n 16,\n 16,\n 16,\n 16,\n 16,\n 16,\n 16,\n 16,\n 17,\n 17,\n 17,\n 17,\n 18,\n 18,\n 18,\n 18,\n 19,\n 19,\n 19,\n 19,\n 20,\n 20,\n 20,\n 20,\n 21,\n 21,\n 21,\n 21,\n 16,\n 72,\n 78\n ], dbase = [\n 1,\n 2,\n 3,\n 4,\n 5,\n 7,\n 9,\n 13,\n 17,\n 25,\n 33,\n 49,\n 65,\n 97,\n 129,\n 193,\n 257,\n 385,\n 513,\n 769,\n 1025,\n 1537,\n 2049,\n 3073,\n 4097,\n 6145,\n 8193,\n 12289,\n 16385,\n 24577,\n 0,\n 0\n ], dext = [\n 16,\n 16,\n 16,\n 16,\n 17,\n 17,\n 18,\n 18,\n 19,\n 19,\n 20,\n 20,\n 21,\n 21,\n 22,\n 22,\n 23,\n 23,\n 24,\n 24,\n 25,\n 25,\n 26,\n 26,\n 27,\n 27,\n 28,\n 28,\n 29,\n 29,\n 64,\n 64\n ];\n module2.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) {\n var bits = opts.bits, len = 0, sym = 0, min = 0, max = 0, root = 0, curr = 0, drop = 0, left = 0, used = 0, huff = 0, incr, fill, low, mask, next, base = null, base_index = 0, end, count = new utils.Buf16(MAXBITS + 1), offs = new utils.Buf16(MAXBITS + 1), extra = null, extra_index = 0, here_bits, here_op, here_val;\n for (len = 0;len <= MAXBITS; len++)\n count[len] = 0;\n for (sym = 0;sym < codes; sym++)\n count[lens[lens_index + sym]]++;\n root = bits;\n for (max = MAXBITS;max >= 1; max--)\n if (count[max] !== 0)\n break;\n if (root > max)\n root = max;\n if (max === 0)\n return table[table_index++] = 1 << 24 | 64 << 16 | 0, table[table_index++] = 1 << 24 | 64 << 16 | 0, opts.bits = 1, 0;\n for (min = 1;min < max; min++)\n if (count[min] !== 0)\n break;\n if (root < min)\n root = min;\n left = 1;\n for (len = 1;len <= MAXBITS; len++)\n if (left <<= 1, left -= count[len], left < 0)\n return -1;\n if (left > 0 && (type === CODES || max !== 1))\n return -1;\n offs[1] = 0;\n for (len = 1;len < MAXBITS; len++)\n offs[len + 1] = offs[len] + count[len];\n for (sym = 0;sym < codes; sym++)\n if (lens[lens_index + sym] !== 0)\n work[offs[lens[lens_index + sym]]++] = sym;\n if (type === CODES)\n base = extra = work, end = 19;\n else if (type === LENS)\n base = lbase, base_index -= 257, extra = lext, extra_index -= 257, end = 256;\n else\n base = dbase, extra = dext, end = -1;\n if (huff = 0, sym = 0, len = min, next = table_index, curr = root, drop = 0, low = -1, used = 1 << root, mask = used - 1, type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS)\n return 1;\n for (;; ) {\n if (here_bits = len - drop, work[sym] < end)\n here_op = 0, here_val = work[sym];\n else if (work[sym] > end)\n here_op = extra[extra_index + work[sym]], here_val = base[base_index + work[sym]];\n else\n here_op = 96, here_val = 0;\n incr = 1 << len - drop, fill = 1 << curr, min = fill;\n do\n fill -= incr, table[next + (huff >> drop) + fill] = here_bits << 24 | here_op << 16 | here_val | 0;\n while (fill !== 0);\n incr = 1 << len - 1;\n while (huff & incr)\n incr >>= 1;\n if (incr !== 0)\n huff &= incr - 1, huff += incr;\n else\n huff = 0;\n if (sym++, --count[len] === 0) {\n if (len === max)\n break;\n len = lens[lens_index + work[sym]];\n }\n if (len > root && (huff & mask) !== low) {\n if (drop === 0)\n drop = root;\n next += min, curr = len - drop, left = 1 << curr;\n while (curr + drop < max) {\n if (left -= count[curr + drop], left <= 0)\n break;\n curr++, left <<= 1;\n }\n if (used += 1 << curr, type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS)\n return 1;\n low = huff & mask, table[low] = root << 24 | curr << 16 | next - table_index | 0;\n }\n }\n if (huff !== 0)\n table[next + huff] = len - drop << 24 | 64 << 16 | 0;\n return opts.bits = root, 0;\n };\n }\n}), require_inflate = __commonJS({\n \"node_modules/pako/lib/zlib/inflate.js\"(exports) {\n var utils = require_common(), adler32 = require_adler32(), crc32 = require_crc32(), inflate_fast = require_inffast(), inflate_table = require_inftrees(), CODES = 0, LENS = 1, DISTS = 2, Z_FINISH = 4, Z_BLOCK = 5, Z_TREES = 6, Z_OK = 0, Z_STREAM_END = 1, Z_NEED_DICT = 2, Z_STREAM_ERROR = -2, Z_DATA_ERROR = -3, Z_MEM_ERROR = -4, Z_BUF_ERROR = -5, Z_DEFLATED = 8, HEAD = 1, FLAGS = 2, TIME = 3, OS = 4, EXLEN = 5, EXTRA = 6, NAME = 7, COMMENT = 8, HCRC = 9, DICTID = 10, DICT = 11, TYPE = 12, TYPEDO = 13, STORED = 14, COPY_ = 15, COPY = 16, TABLE = 17, LENLENS = 18, CODELENS = 19, LEN_ = 20, LEN = 21, LENEXT = 22, DIST = 23, DISTEXT = 24, MATCH = 25, LIT = 26, CHECK = 27, LENGTH = 28, DONE = 29, BAD = 30, MEM = 31, SYNC = 32, ENOUGH_LENS = 852, ENOUGH_DISTS = 592, MAX_WBITS = 15, DEF_WBITS = MAX_WBITS;\n function zswap32(q) {\n return (q >>> 24 & 255) + (q >>> 8 & 65280) + ((q & 65280) << 8) + ((q & 255) << 24);\n }\n function InflateState() {\n this.mode = 0, this.last = !1, this.wrap = 0, this.havedict = !1, this.flags = 0, this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0, this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0, this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null, this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0, this.ndist = 0, this.have = 0, this.next = null, this.lens = new utils.Buf16(320), this.work = new utils.Buf16(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0;\n }\n function inflateResetKeep(strm) {\n var state;\n if (!strm || !strm.state)\n return Z_STREAM_ERROR;\n if (state = strm.state, strm.total_in = strm.total_out = state.total = 0, strm.msg = \"\", state.wrap)\n strm.adler = state.wrap & 1;\n return state.mode = HEAD, state.last = 0, state.havedict = 0, state.dmax = 32768, state.head = null, state.hold = 0, state.bits = 0, state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS), state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS), state.sane = 1, state.back = -1, Z_OK;\n }\n function inflateReset(strm) {\n var state;\n if (!strm || !strm.state)\n return Z_STREAM_ERROR;\n return state = strm.state, state.wsize = 0, state.whave = 0, state.wnext = 0, inflateResetKeep(strm);\n }\n function inflateReset2(strm, windowBits) {\n var wrap, state;\n if (!strm || !strm.state)\n return Z_STREAM_ERROR;\n if (state = strm.state, windowBits < 0)\n wrap = 0, windowBits = -windowBits;\n else if (wrap = (windowBits >> 4) + 1, windowBits < 48)\n windowBits &= 15;\n if (windowBits && (windowBits < 8 || windowBits > 15))\n return Z_STREAM_ERROR;\n if (state.window !== null && state.wbits !== windowBits)\n state.window = null;\n return state.wrap = wrap, state.wbits = windowBits, inflateReset(strm);\n }\n function inflateInit2(strm, windowBits) {\n var ret, state;\n if (!strm)\n return Z_STREAM_ERROR;\n if (state = new InflateState, strm.state = state, state.window = null, ret = inflateReset2(strm, windowBits), ret !== Z_OK)\n strm.state = null;\n return ret;\n }\n function inflateInit(strm) {\n return inflateInit2(strm, DEF_WBITS);\n }\n var virgin = !0, lenfix, distfix;\n function fixedtables(state) {\n if (virgin) {\n var sym;\n lenfix = new utils.Buf32(512), distfix = new utils.Buf32(32), sym = 0;\n while (sym < 144)\n state.lens[sym++] = 8;\n while (sym < 256)\n state.lens[sym++] = 9;\n while (sym < 280)\n state.lens[sym++] = 7;\n while (sym < 288)\n state.lens[sym++] = 8;\n inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, {\n bits: 9\n }), sym = 0;\n while (sym < 32)\n state.lens[sym++] = 5;\n inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, {\n bits: 5\n }), virgin = !1;\n }\n state.lencode = lenfix, state.lenbits = 9, state.distcode = distfix, state.distbits = 5;\n }\n function updatewindow(strm, src, end, copy) {\n var dist, state = strm.state;\n if (state.window === null)\n state.wsize = 1 << state.wbits, state.wnext = 0, state.whave = 0, state.window = new utils.Buf8(state.wsize);\n if (copy >= state.wsize)\n utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0), state.wnext = 0, state.whave = state.wsize;\n else {\n if (dist = state.wsize - state.wnext, dist > copy)\n dist = copy;\n if (utils.arraySet(state.window, src, end - copy, dist, state.wnext), copy -= dist, copy)\n utils.arraySet(state.window, src, end - copy, copy, 0), state.wnext = copy, state.whave = state.wsize;\n else {\n if (state.wnext += dist, state.wnext === state.wsize)\n state.wnext = 0;\n if (state.whave < state.wsize)\n state.whave += dist;\n }\n }\n return 0;\n }\n function inflate(strm, flush) {\n var state, input, output, next, put, have, left, hold, bits, _in, _out, copy, from, from_source, here = 0, here_bits, here_op, here_val, last_bits, last_op, last_val, len, ret, hbuf = new utils.Buf8(4), opts, n, order = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];\n if (!strm || !strm.state || !strm.output || !strm.input && strm.avail_in !== 0)\n return Z_STREAM_ERROR;\n if (state = strm.state, state.mode === TYPE)\n state.mode = TYPEDO;\n put = strm.next_out, output = strm.output, left = strm.avail_out, next = strm.next_in, input = strm.input, have = strm.avail_in, hold = state.hold, bits = state.bits, _in = have, _out = left, ret = Z_OK;\n inf_leave:\n for (;; )\n switch (state.mode) {\n case HEAD:\n if (state.wrap === 0) {\n state.mode = TYPEDO;\n break;\n }\n while (bits < 16) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (state.wrap & 2 && hold === 35615) {\n state.check = 0, hbuf[0] = hold & 255, hbuf[1] = hold >>> 8 & 255, state.check = crc32(state.check, hbuf, 2, 0), hold = 0, bits = 0, state.mode = FLAGS;\n break;\n }\n if (state.flags = 0, state.head)\n state.head.done = !1;\n if (!(state.wrap & 1) || (((hold & 255) << 8) + (hold >> 8)) % 31) {\n strm.msg = \"incorrect header check\", state.mode = BAD;\n break;\n }\n if ((hold & 15) !== Z_DEFLATED) {\n strm.msg = \"unknown compression method\", state.mode = BAD;\n break;\n }\n if (hold >>>= 4, bits -= 4, len = (hold & 15) + 8, state.wbits === 0)\n state.wbits = len;\n else if (len > state.wbits) {\n strm.msg = \"invalid window size\", state.mode = BAD;\n break;\n }\n state.dmax = 1 << len, strm.adler = state.check = 1, state.mode = hold & 512 \? DICTID : TYPE, hold = 0, bits = 0;\n break;\n case FLAGS:\n while (bits < 16) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (state.flags = hold, (state.flags & 255) !== Z_DEFLATED) {\n strm.msg = \"unknown compression method\", state.mode = BAD;\n break;\n }\n if (state.flags & 57344) {\n strm.msg = \"unknown header flags set\", state.mode = BAD;\n break;\n }\n if (state.head)\n state.head.text = hold >> 8 & 1;\n if (state.flags & 512)\n hbuf[0] = hold & 255, hbuf[1] = hold >>> 8 & 255, state.check = crc32(state.check, hbuf, 2, 0);\n hold = 0, bits = 0, state.mode = TIME;\n case TIME:\n while (bits < 32) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (state.head)\n state.head.time = hold;\n if (state.flags & 512)\n hbuf[0] = hold & 255, hbuf[1] = hold >>> 8 & 255, hbuf[2] = hold >>> 16 & 255, hbuf[3] = hold >>> 24 & 255, state.check = crc32(state.check, hbuf, 4, 0);\n hold = 0, bits = 0, state.mode = OS;\n case OS:\n while (bits < 16) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (state.head)\n state.head.xflags = hold & 255, state.head.os = hold >> 8;\n if (state.flags & 512)\n hbuf[0] = hold & 255, hbuf[1] = hold >>> 8 & 255, state.check = crc32(state.check, hbuf, 2, 0);\n hold = 0, bits = 0, state.mode = EXLEN;\n case EXLEN:\n if (state.flags & 1024) {\n while (bits < 16) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (state.length = hold, state.head)\n state.head.extra_len = hold;\n if (state.flags & 512)\n hbuf[0] = hold & 255, hbuf[1] = hold >>> 8 & 255, state.check = crc32(state.check, hbuf, 2, 0);\n hold = 0, bits = 0;\n } else if (state.head)\n state.head.extra = null;\n state.mode = EXTRA;\n case EXTRA:\n if (state.flags & 1024) {\n if (copy = state.length, copy > have)\n copy = have;\n if (copy) {\n if (state.head) {\n if (len = state.head.extra_len - state.length, !state.head.extra)\n state.head.extra = new @Array(state.head.extra_len);\n utils.arraySet(state.head.extra, input, next, copy, len);\n }\n if (state.flags & 512)\n state.check = crc32(state.check, input, copy, next);\n have -= copy, next += copy, state.length -= copy;\n }\n if (state.length)\n break inf_leave;\n }\n state.length = 0, state.mode = NAME;\n case NAME:\n if (state.flags & 2048) {\n if (have === 0)\n break inf_leave;\n copy = 0;\n do\n if (len = input[next + copy++], state.head && len && state.length < 65536)\n state.head.name += @String.fromCharCode(len);\n while (len && copy < have);\n if (state.flags & 512)\n state.check = crc32(state.check, input, copy, next);\n if (have -= copy, next += copy, len)\n break inf_leave;\n } else if (state.head)\n state.head.name = null;\n state.length = 0, state.mode = COMMENT;\n case COMMENT:\n if (state.flags & 4096) {\n if (have === 0)\n break inf_leave;\n copy = 0;\n do\n if (len = input[next + copy++], state.head && len && state.length < 65536)\n state.head.comment += @String.fromCharCode(len);\n while (len && copy < have);\n if (state.flags & 512)\n state.check = crc32(state.check, input, copy, next);\n if (have -= copy, next += copy, len)\n break inf_leave;\n } else if (state.head)\n state.head.comment = null;\n state.mode = HCRC;\n case HCRC:\n if (state.flags & 512) {\n while (bits < 16) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (hold !== (state.check & 65535)) {\n strm.msg = \"header crc mismatch\", state.mode = BAD;\n break;\n }\n hold = 0, bits = 0;\n }\n if (state.head)\n state.head.hcrc = state.flags >> 9 & 1, state.head.done = !0;\n strm.adler = state.check = 0, state.mode = TYPE;\n break;\n case DICTID:\n while (bits < 32) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n strm.adler = state.check = zswap32(hold), hold = 0, bits = 0, state.mode = DICT;\n case DICT:\n if (state.havedict === 0)\n return strm.next_out = put, strm.avail_out = left, strm.next_in = next, strm.avail_in = have, state.hold = hold, state.bits = bits, Z_NEED_DICT;\n strm.adler = state.check = 1, state.mode = TYPE;\n case TYPE:\n if (flush === Z_BLOCK || flush === Z_TREES)\n break inf_leave;\n case TYPEDO:\n if (state.last) {\n hold >>>= bits & 7, bits -= bits & 7, state.mode = CHECK;\n break;\n }\n while (bits < 3) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n switch (state.last = hold & 1, hold >>>= 1, bits -= 1, hold & 3) {\n case 0:\n state.mode = STORED;\n break;\n case 1:\n if (fixedtables(state), state.mode = LEN_, flush === Z_TREES) {\n hold >>>= 2, bits -= 2;\n break inf_leave;\n }\n break;\n case 2:\n state.mode = TABLE;\n break;\n case 3:\n strm.msg = \"invalid block type\", state.mode = BAD;\n }\n hold >>>= 2, bits -= 2;\n break;\n case STORED:\n hold >>>= bits & 7, bits -= bits & 7;\n while (bits < 32) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if ((hold & 65535) !== (hold >>> 16 ^ 65535)) {\n strm.msg = \"invalid stored block lengths\", state.mode = BAD;\n break;\n }\n if (state.length = hold & 65535, hold = 0, bits = 0, state.mode = COPY_, flush === Z_TREES)\n break inf_leave;\n case COPY_:\n state.mode = COPY;\n case COPY:\n if (copy = state.length, copy) {\n if (copy > have)\n copy = have;\n if (copy > left)\n copy = left;\n if (copy === 0)\n break inf_leave;\n utils.arraySet(output, input, next, copy, put), have -= copy, next += copy, left -= copy, put += copy, state.length -= copy;\n break;\n }\n state.mode = TYPE;\n break;\n case TABLE:\n while (bits < 14) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (state.nlen = (hold & 31) + 257, hold >>>= 5, bits -= 5, state.ndist = (hold & 31) + 1, hold >>>= 5, bits -= 5, state.ncode = (hold & 15) + 4, hold >>>= 4, bits -= 4, state.nlen > 286 || state.ndist > 30) {\n strm.msg = \"too many length or distance symbols\", state.mode = BAD;\n break;\n }\n state.have = 0, state.mode = LENLENS;\n case LENLENS:\n while (state.have < state.ncode) {\n while (bits < 3) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n state.lens[order[state.have++]] = hold & 7, hold >>>= 3, bits -= 3;\n }\n while (state.have < 19)\n state.lens[order[state.have++]] = 0;\n if (state.lencode = state.lendyn, state.lenbits = 7, opts = { bits: state.lenbits }, ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts), state.lenbits = opts.bits, ret) {\n strm.msg = \"invalid code lengths set\", state.mode = BAD;\n break;\n }\n state.have = 0, state.mode = CODELENS;\n case CODELENS:\n while (state.have < state.nlen + state.ndist) {\n for (;; ) {\n if (here = state.lencode[hold & (1 << state.lenbits) - 1], here_bits = here >>> 24, here_op = here >>> 16 & 255, here_val = here & 65535, here_bits <= bits)\n break;\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (here_val < 16)\n hold >>>= here_bits, bits -= here_bits, state.lens[state.have++] = here_val;\n else {\n if (here_val === 16) {\n n = here_bits + 2;\n while (bits < n) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (hold >>>= here_bits, bits -= here_bits, state.have === 0) {\n strm.msg = \"invalid bit length repeat\", state.mode = BAD;\n break;\n }\n len = state.lens[state.have - 1], copy = 3 + (hold & 3), hold >>>= 2, bits -= 2;\n } else if (here_val === 17) {\n n = here_bits + 3;\n while (bits < n) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n hold >>>= here_bits, bits -= here_bits, len = 0, copy = 3 + (hold & 7), hold >>>= 3, bits -= 3;\n } else {\n n = here_bits + 7;\n while (bits < n) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n hold >>>= here_bits, bits -= here_bits, len = 0, copy = 11 + (hold & 127), hold >>>= 7, bits -= 7;\n }\n if (state.have + copy > state.nlen + state.ndist) {\n strm.msg = \"invalid bit length repeat\", state.mode = BAD;\n break;\n }\n while (copy--)\n state.lens[state.have++] = len;\n }\n }\n if (state.mode === BAD)\n break;\n if (state.lens[256] === 0) {\n strm.msg = \"invalid code -- missing end-of-block\", state.mode = BAD;\n break;\n }\n if (state.lenbits = 9, opts = { bits: state.lenbits }, ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts), state.lenbits = opts.bits, ret) {\n strm.msg = \"invalid literal/lengths set\", state.mode = BAD;\n break;\n }\n if (state.distbits = 6, state.distcode = state.distdyn, opts = { bits: state.distbits }, ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts), state.distbits = opts.bits, ret) {\n strm.msg = \"invalid distances set\", state.mode = BAD;\n break;\n }\n if (state.mode = LEN_, flush === Z_TREES)\n break inf_leave;\n case LEN_:\n state.mode = LEN;\n case LEN:\n if (have >= 6 && left >= 258) {\n if (strm.next_out = put, strm.avail_out = left, strm.next_in = next, strm.avail_in = have, state.hold = hold, state.bits = bits, inflate_fast(strm, _out), put = strm.next_out, output = strm.output, left = strm.avail_out, next = strm.next_in, input = strm.input, have = strm.avail_in, hold = state.hold, bits = state.bits, state.mode === TYPE)\n state.back = -1;\n break;\n }\n state.back = 0;\n for (;; ) {\n if (here = state.lencode[hold & (1 << state.lenbits) - 1], here_bits = here >>> 24, here_op = here >>> 16 & 255, here_val = here & 65535, here_bits <= bits)\n break;\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (here_op && (here_op & 240) === 0) {\n last_bits = here_bits, last_op = here_op, last_val = here_val;\n for (;; ) {\n if (here = state.lencode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)], here_bits = here >>> 24, here_op = here >>> 16 & 255, here_val = here & 65535, last_bits + here_bits <= bits)\n break;\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n hold >>>= last_bits, bits -= last_bits, state.back += last_bits;\n }\n if (hold >>>= here_bits, bits -= here_bits, state.back += here_bits, state.length = here_val, here_op === 0) {\n state.mode = LIT;\n break;\n }\n if (here_op & 32) {\n state.back = -1, state.mode = TYPE;\n break;\n }\n if (here_op & 64) {\n strm.msg = \"invalid literal/length code\", state.mode = BAD;\n break;\n }\n state.extra = here_op & 15, state.mode = LENEXT;\n case LENEXT:\n if (state.extra) {\n n = state.extra;\n while (bits < n) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n state.length += hold & (1 << state.extra) - 1, hold >>>= state.extra, bits -= state.extra, state.back += state.extra;\n }\n state.was = state.length, state.mode = DIST;\n case DIST:\n for (;; ) {\n if (here = state.distcode[hold & (1 << state.distbits) - 1], here_bits = here >>> 24, here_op = here >>> 16 & 255, here_val = here & 65535, here_bits <= bits)\n break;\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if ((here_op & 240) === 0) {\n last_bits = here_bits, last_op = here_op, last_val = here_val;\n for (;; ) {\n if (here = state.distcode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)], here_bits = here >>> 24, here_op = here >>> 16 & 255, here_val = here & 65535, last_bits + here_bits <= bits)\n break;\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n hold >>>= last_bits, bits -= last_bits, state.back += last_bits;\n }\n if (hold >>>= here_bits, bits -= here_bits, state.back += here_bits, here_op & 64) {\n strm.msg = \"invalid distance code\", state.mode = BAD;\n break;\n }\n state.offset = here_val, state.extra = here_op & 15, state.mode = DISTEXT;\n case DISTEXT:\n if (state.extra) {\n n = state.extra;\n while (bits < n) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n state.offset += hold & (1 << state.extra) - 1, hold >>>= state.extra, bits -= state.extra, state.back += state.extra;\n }\n if (state.offset > state.dmax) {\n strm.msg = \"invalid distance too far back\", state.mode = BAD;\n break;\n }\n state.mode = MATCH;\n case MATCH:\n if (left === 0)\n break inf_leave;\n if (copy = _out - left, state.offset > copy) {\n if (copy = state.offset - copy, copy > state.whave) {\n if (state.sane) {\n strm.msg = \"invalid distance too far back\", state.mode = BAD;\n break;\n }\n }\n if (copy > state.wnext)\n copy -= state.wnext, from = state.wsize - copy;\n else\n from = state.wnext - copy;\n if (copy > state.length)\n copy = state.length;\n from_source = state.window;\n } else\n from_source = output, from = put - state.offset, copy = state.length;\n if (copy > left)\n copy = left;\n left -= copy, state.length -= copy;\n do\n output[put++] = from_source[from++];\n while (--copy);\n if (state.length === 0)\n state.mode = LEN;\n break;\n case LIT:\n if (left === 0)\n break inf_leave;\n output[put++] = state.length, left--, state.mode = LEN;\n break;\n case CHECK:\n if (state.wrap) {\n while (bits < 32) {\n if (have === 0)\n break inf_leave;\n have--, hold |= input[next++] << bits, bits += 8;\n }\n if (_out -= left, strm.total_out += _out, state.total += _out, _out)\n strm.adler = state.check = state.flags \? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out);\n if (_out = left, (state.flags \? hold : zswap32(hold)) !== state.check) {\n strm.msg = \"incorrect data check\", state.mode = BAD;\n break;\n }\n hold = 0, bits = 0;\n }\n state.mode = LENGTH;\n case LENGTH:\n if (state.wrap && state.flags) {\n while (bits < 32) {\n if (have === 0)\n break inf_leave;\n have--, hold += input[next++] << bits, bits += 8;\n }\n if (hold !== (state.total & 4294967295)) {\n strm.msg = \"incorrect length check\", state.mode = BAD;\n break;\n }\n hold = 0, bits = 0;\n }\n state.mode = DONE;\n case DONE:\n ret = Z_STREAM_END;\n break inf_leave;\n case BAD:\n ret = Z_DATA_ERROR;\n break inf_leave;\n case MEM:\n return Z_MEM_ERROR;\n case SYNC:\n default:\n return Z_STREAM_ERROR;\n }\n if (strm.next_out = put, strm.avail_out = left, strm.next_in = next, strm.avail_in = have, state.hold = hold, state.bits = bits, state.wsize || _out !== strm.avail_out && state.mode < BAD && (state.mode < CHECK || flush !== Z_FINISH)) {\n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out))\n return state.mode = MEM, Z_MEM_ERROR;\n }\n if (_in -= strm.avail_in, _out -= strm.avail_out, strm.total_in += _in, strm.total_out += _out, state.total += _out, state.wrap && _out)\n strm.adler = state.check = state.flags \? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out);\n if (strm.data_type = state.bits + (state.last \? 64 : 0) + (state.mode === TYPE \? 128 : 0) + (state.mode === LEN_ || state.mode === COPY_ \? 256 : 0), (_in === 0 && _out === 0 || flush === Z_FINISH) && ret === Z_OK)\n ret = Z_BUF_ERROR;\n return ret;\n }\n function inflateEnd(strm) {\n if (!strm || !strm.state)\n return Z_STREAM_ERROR;\n var state = strm.state;\n if (state.window)\n state.window = null;\n return strm.state = null, Z_OK;\n }\n function inflateGetHeader(strm, head) {\n var state;\n if (!strm || !strm.state)\n return Z_STREAM_ERROR;\n if (state = strm.state, (state.wrap & 2) === 0)\n return Z_STREAM_ERROR;\n return state.head = head, head.done = !1, Z_OK;\n }\n function inflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length, state, dictid, ret;\n if (!strm || !strm.state)\n return Z_STREAM_ERROR;\n if (state = strm.state, state.wrap !== 0 && state.mode !== DICT)\n return Z_STREAM_ERROR;\n if (state.mode === DICT) {\n if (dictid = 1, dictid = adler32(dictid, dictionary, dictLength, 0), dictid !== state.check)\n return Z_DATA_ERROR;\n }\n if (ret = updatewindow(strm, dictionary, dictLength, dictLength), ret)\n return state.mode = MEM, Z_MEM_ERROR;\n return state.havedict = 1, Z_OK;\n }\n exports.inflateReset = inflateReset, exports.inflateReset2 = inflateReset2, exports.inflateResetKeep = inflateResetKeep, exports.inflateInit = inflateInit, exports.inflateInit2 = inflateInit2, exports.inflate = inflate, exports.inflateEnd = inflateEnd, exports.inflateGetHeader = inflateGetHeader, exports.inflateSetDictionary = inflateSetDictionary, exports.inflateInfo = \"pako inflate (from Nodeca project)\";\n }\n}), require_constants = __commonJS({\n \"node_modules/pako/lib/zlib/constants.js\"(exports, module2) {\n module2.exports = {\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_TREES: 6,\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n Z_BUF_ERROR: -5,\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n Z_BINARY: 0,\n Z_TEXT: 1,\n Z_UNKNOWN: 2,\n Z_DEFLATED: 8\n };\n }\n}), require_binding = __commonJS({\n \"node_modules/browserify-zlib/lib/binding.js\"(exports) {\n var Zstream = require_zstream(), zlib_deflate = require_deflate(), zlib_inflate = require_inflate(), constants = require_constants();\n for (key in constants)\n exports[key] = constants[key];\n var key;\n exports.NONE = 0, exports.DEFLATE = 1, exports.INFLATE = 2, exports.GZIP = 3, exports.GUNZIP = 4, exports.DEFLATERAW = 5, exports.INFLATERAW = 6, exports.UNZIP = 7;\n var GZIP_HEADER_ID1 = 31, GZIP_HEADER_ID2 = 139;\n function Zlib(mode) {\n if (typeof mode !== \"number\" || mode < exports.DEFLATE || mode > exports.UNZIP)\n @throwTypeError(\"Bad argument\");\n this.dictionary = null, this.err = 0, this.flush = 0, this.init_done = !1, this.level = 0, this.memLevel = 0, this.mode = mode, this.strategy = 0, this.windowBits = 0, this.write_in_progress = !1, this.pending_close = !1, this.gzip_id_bytes_read = 0;\n }\n Zlib.prototype = {}, Zlib.prototype.close = function() {\n if (this.write_in_progress) {\n this.pending_close = !0;\n return;\n }\n if (this.pending_close = !1, assert(this.init_done, \"close before init\"), assert(this.mode <= exports.UNZIP), this.mode === exports.DEFLATE || this.mode === exports.GZIP || this.mode === exports.DEFLATERAW)\n zlib_deflate.deflateEnd(this.strm);\n else if (this.mode === exports.INFLATE || this.mode === exports.GUNZIP || this.mode === exports.INFLATERAW || this.mode === exports.UNZIP)\n zlib_inflate.inflateEnd(this.strm);\n this.mode = exports.NONE, this.dictionary = null;\n }, Zlib.prototype.write = function(flush, input, in_off, in_len, out, out_off, out_len) {\n return this._write(!0, flush, input, in_off, in_len, out, out_off, out_len);\n }, Zlib.prototype.writeSync = function(flush, input, in_off, in_len, out, out_off, out_len) {\n return this._write(!1, flush, input, in_off, in_len, out, out_off, out_len);\n }, Zlib.prototype._write = function(async, flush, input, in_off, in_len, out, out_off, out_len) {\n if (assert.equal(arguments.length, 8), assert(this.init_done, \"write before init\"), assert(this.mode !== exports.NONE, \"already finalized\"), assert.equal(!1, this.write_in_progress, \"write already in progress\"), assert.equal(!1, this.pending_close, \"close is pending\"), this.write_in_progress = !0, assert.equal(!1, flush === void 0, \"must provide flush value\"), this.write_in_progress = !0, flush !== exports.Z_NO_FLUSH && flush !== exports.Z_PARTIAL_FLUSH && flush !== exports.Z_SYNC_FLUSH && flush !== exports.Z_FULL_FLUSH && flush !== exports.Z_FINISH && flush !== exports.Z_BLOCK)\n throw new Error(\"Invalid flush value\");\n if (input == null)\n input = @Buffer.alloc(0), in_len = 0, in_off = 0;\n if (this.strm.avail_in = in_len, this.strm.input = input, this.strm.next_in = in_off, this.strm.avail_out = out_len, this.strm.output = out, this.strm.next_out = out_off, this.flush = flush, !async) {\n if (this._process(), this._checkError())\n return this._afterSync();\n return;\n }\n var self = this;\n return process.nextTick(function() {\n self._process(), self._after();\n }), this;\n }, Zlib.prototype._afterSync = function() {\n var avail_out = this.strm.avail_out, avail_in = this.strm.avail_in;\n return this.write_in_progress = !1, [avail_in, avail_out];\n }, Zlib.prototype._process = function() {\n var next_expected_header_byte = null;\n switch (this.mode) {\n case exports.DEFLATE:\n case exports.GZIP:\n case exports.DEFLATERAW:\n this.err = zlib_deflate.deflate(this.strm, this.flush);\n break;\n case exports.UNZIP:\n if (this.strm.avail_in > 0)\n next_expected_header_byte = this.strm.next_in;\n switch (this.gzip_id_bytes_read) {\n case 0:\n if (next_expected_header_byte === null)\n break;\n if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID1) {\n if (this.gzip_id_bytes_read = 1, next_expected_header_byte++, this.strm.avail_in === 1)\n break;\n } else {\n this.mode = exports.INFLATE;\n break;\n }\n case 1:\n if (next_expected_header_byte === null)\n break;\n if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID2)\n this.gzip_id_bytes_read = 2, this.mode = exports.GUNZIP;\n else\n this.mode = exports.INFLATE;\n break;\n default:\n throw new Error(\"invalid number of gzip magic number bytes read\");\n }\n case exports.INFLATE:\n case exports.GUNZIP:\n case exports.INFLATERAW:\n if (this.err = zlib_inflate.inflate(this.strm, this.flush), this.err === exports.Z_NEED_DICT && this.dictionary) {\n if (this.err = zlib_inflate.inflateSetDictionary(this.strm, this.dictionary), this.err === exports.Z_OK)\n this.err = zlib_inflate.inflate(this.strm, this.flush);\n else if (this.err === exports.Z_DATA_ERROR)\n this.err = exports.Z_NEED_DICT;\n }\n while (this.strm.avail_in > 0 && this.mode === exports.GUNZIP && this.err === exports.Z_STREAM_END && this.strm.next_in[0] !== 0)\n this.reset(), this.err = zlib_inflate.inflate(this.strm, this.flush);\n break;\n default:\n throw new Error(\"Unknown mode \" + this.mode);\n }\n }, Zlib.prototype._checkError = function() {\n switch (this.err) {\n case exports.Z_OK:\n case exports.Z_BUF_ERROR:\n if (this.strm.avail_out !== 0 && this.flush === exports.Z_FINISH)\n return this._error(\"unexpected end of file\"), !1;\n break;\n case exports.Z_STREAM_END:\n break;\n case exports.Z_NEED_DICT:\n if (this.dictionary == null)\n this._error(\"Missing dictionary\");\n else\n this._error(\"Bad dictionary\");\n return !1;\n default:\n return this._error(\"Zlib error\"), !1;\n }\n return !0;\n }, Zlib.prototype._after = function() {\n if (!this._checkError())\n return;\n var avail_out = this.strm.avail_out, avail_in = this.strm.avail_in;\n if (this.write_in_progress = !1, this.callback(avail_in, avail_out), this.pending_close)\n this.close();\n }, Zlib.prototype._error = function(message) {\n if (this.strm.msg)\n message = this.strm.msg;\n if (this.onerror(message, this.err), this.write_in_progress = !1, this.pending_close)\n this.close();\n }, Zlib.prototype.init = function(windowBits, level, memLevel, strategy, dictionary) {\n assert(arguments.length === 4 || arguments.length === 5, \"init(windowBits, level, memLevel, strategy, [dictionary])\"), assert(windowBits >= 8 && windowBits <= 15, \"invalid windowBits\"), assert(level >= -1 && level <= 9, \"invalid compression level\"), assert(memLevel >= 1 && memLevel <= 9, \"invalid memlevel\"), assert(strategy === exports.Z_FILTERED || strategy === exports.Z_HUFFMAN_ONLY || strategy === exports.Z_RLE || strategy === exports.Z_FIXED || strategy === exports.Z_DEFAULT_STRATEGY, \"invalid strategy\"), this._init(level, windowBits, memLevel, strategy, dictionary), this._setDictionary();\n }, Zlib.prototype.params = function() {\n throw new Error(\"deflateParams Not supported\");\n }, Zlib.prototype.reset = function() {\n this._reset(), this._setDictionary();\n }, Zlib.prototype._init = function(level, windowBits, memLevel, strategy, dictionary) {\n if (this.level = level, this.windowBits = windowBits, this.memLevel = memLevel, this.strategy = strategy, this.flush = exports.Z_NO_FLUSH, this.err = exports.Z_OK, this.mode === exports.GZIP || this.mode === exports.GUNZIP)\n this.windowBits += 16;\n if (this.mode === exports.UNZIP)\n this.windowBits += 32;\n if (this.mode === exports.DEFLATERAW || this.mode === exports.INFLATERAW)\n this.windowBits = -1 * this.windowBits;\n switch (this.strm = new Zstream, this.mode) {\n case exports.DEFLATE:\n case exports.GZIP:\n case exports.DEFLATERAW:\n this.err = zlib_deflate.deflateInit2(this.strm, this.level, exports.Z_DEFLATED, this.windowBits, this.memLevel, this.strategy);\n break;\n case exports.INFLATE:\n case exports.GUNZIP:\n case exports.INFLATERAW:\n case exports.UNZIP:\n this.err = zlib_inflate.inflateInit2(this.strm, this.windowBits);\n break;\n default:\n throw new Error(\"Unknown mode \" + this.mode);\n }\n if (this.err !== exports.Z_OK)\n this._error(\"Init error\");\n this.dictionary = dictionary, this.write_in_progress = !1, this.init_done = !0;\n }, Zlib.prototype._setDictionary = function() {\n if (this.dictionary == null)\n return;\n switch (this.err = exports.Z_OK, this.mode) {\n case exports.DEFLATE:\n case exports.DEFLATERAW:\n this.err = zlib_deflate.deflateSetDictionary(this.strm, this.dictionary);\n break;\n default:\n break;\n }\n if (this.err !== exports.Z_OK)\n this._error(\"Failed to set dictionary\");\n }, Zlib.prototype._reset = function() {\n switch (this.err = exports.Z_OK, this.mode) {\n case exports.DEFLATE:\n case exports.DEFLATERAW:\n case exports.GZIP:\n this.err = zlib_deflate.deflateReset(this.strm);\n break;\n case exports.INFLATE:\n case exports.INFLATERAW:\n case exports.GUNZIP:\n this.err = zlib_inflate.inflateReset(this.strm);\n break;\n default:\n break;\n }\n if (this.err !== exports.Z_OK)\n this._error(\"Failed to reset stream\");\n }, exports.Zlib = Zlib;\n }\n}), require_lib = __commonJS({\n \"node_modules/browserify-zlib/lib/index.js\"(exports) {\n var Buffer2 = BufferModule.Buffer, Transform = StreamModule.Transform, binding = require_binding(), util = Util, kMaxLength = BufferModule.kMaxLength, kRangeErrorMessage = \"Cannot create final Buffer. It would be larger than 0x\" + kMaxLength.toString(16) + \" bytes\";\n binding.Z_MIN_WINDOWBITS = 8, binding.Z_MAX_WINDOWBITS = 15, binding.Z_DEFAULT_WINDOWBITS = 15, binding.Z_MIN_CHUNK = 64, binding.Z_MAX_CHUNK = @Infinity, binding.Z_DEFAULT_CHUNK = 16384, binding.Z_MIN_MEMLEVEL = 1, binding.Z_MAX_MEMLEVEL = 9, binding.Z_DEFAULT_MEMLEVEL = 8, binding.Z_MIN_LEVEL = -1, binding.Z_MAX_LEVEL = 9, binding.Z_DEFAULT_LEVEL = binding.Z_DEFAULT_COMPRESSION;\n var bkeys = Object.keys(binding);\n for (bk = 0;bk < bkeys.length; bk++)\n if (bkey = bkeys[bk], bkey.match(/^Z/))\n Object.defineProperty(exports, bkey, {\n enumerable: !0,\n value: binding[bkey],\n writable: !1\n });\n var bkey, bk, codes = {\n Z_OK: binding.Z_OK,\n Z_STREAM_END: binding.Z_STREAM_END,\n Z_NEED_DICT: binding.Z_NEED_DICT,\n Z_ERRNO: binding.Z_ERRNO,\n Z_STREAM_ERROR: binding.Z_STREAM_ERROR,\n Z_DATA_ERROR: binding.Z_DATA_ERROR,\n Z_MEM_ERROR: binding.Z_MEM_ERROR,\n Z_BUF_ERROR: binding.Z_BUF_ERROR,\n Z_VERSION_ERROR: binding.Z_VERSION_ERROR\n }, ckeys = Object.keys(codes);\n for (ck = 0;ck < ckeys.length; ck++)\n ckey = ckeys[ck], codes[codes[ckey]] = ckey;\n var ckey, ck;\n Object.defineProperty(exports, \"codes\", {\n enumerable: !0,\n value: Object.freeze(codes),\n writable: !1\n }), exports.constants = require_constants(), exports.Deflate = Deflate, exports.Inflate = Inflate, exports.Gzip = Gzip, exports.Gunzip = Gunzip, exports.DeflateRaw = DeflateRaw, exports.InflateRaw = InflateRaw, exports.Unzip = Unzip, exports.createDeflate = function(o) {\n return new Deflate(o);\n }, exports.createInflate = function(o) {\n return new Inflate(o);\n }, exports.createDeflateRaw = function(o) {\n return new DeflateRaw(o);\n }, exports.createInflateRaw = function(o) {\n return new InflateRaw(o);\n }, exports.createGzip = function(o) {\n return new Gzip(o);\n }, exports.createGunzip = function(o) {\n return new Gunzip(o);\n }, exports.createUnzip = function(o) {\n return new Unzip(o);\n }, exports.deflate = function(buffer, opts, callback) {\n if (typeof opts === \"function\")\n callback = opts, opts = {};\n return zlibBuffer(new Deflate(opts), buffer, callback);\n }, exports.deflateSync = function(buffer, opts) {\n return zlibBufferSync(new Deflate(opts), buffer);\n }, exports.gzip = function(buffer, opts, callback) {\n if (typeof opts === \"function\")\n callback = opts, opts = {};\n return zlibBuffer(new Gzip(opts), buffer, callback);\n }, exports.gzipSync = function(buffer, opts) {\n return zlibBufferSync(new Gzip(opts), buffer);\n }, exports.deflateRaw = function(buffer, opts, callback) {\n if (typeof opts === \"function\")\n callback = opts, opts = {};\n return zlibBuffer(new DeflateRaw(opts), buffer, callback);\n }, exports.deflateRawSync = function(buffer, opts) {\n return zlibBufferSync(new DeflateRaw(opts), buffer);\n }, exports.unzip = function(buffer, opts, callback) {\n if (typeof opts === \"function\")\n callback = opts, opts = {};\n return zlibBuffer(new Unzip(opts), buffer, callback);\n }, exports.unzipSync = function(buffer, opts) {\n return zlibBufferSync(new Unzip(opts), buffer);\n }, exports.inflate = function(buffer, opts, callback) {\n if (typeof opts === \"function\")\n callback = opts, opts = {};\n return zlibBuffer(new Inflate(opts), buffer, callback);\n }, exports.inflateSync = function(buffer, opts) {\n return zlibBufferSync(new Inflate(opts), buffer);\n }, exports.gunzip = function(buffer, opts, callback) {\n if (typeof opts === \"function\")\n callback = opts, opts = {};\n return zlibBuffer(new Gunzip(opts), buffer, callback);\n }, exports.gunzipSync = function(buffer, opts) {\n return zlibBufferSync(new Gunzip(opts), buffer);\n }, exports.inflateRaw = function(buffer, opts, callback) {\n if (typeof opts === \"function\")\n callback = opts, opts = {};\n return zlibBuffer(new InflateRaw(opts), buffer, callback);\n }, exports.inflateRawSync = function(buffer, opts) {\n return zlibBufferSync(new InflateRaw(opts), buffer);\n }, exports.brotliCompress = function(buffer, opts, callback) {\n throw new Error(\"zlib.brotliCompress is not implemented\");\n };\n function zlibBuffer(engine, buffer, callback) {\n var buffers = [], nread = 0;\n engine.on(\"error\", onError), engine.on(\"end\", onEnd), engine.end(buffer), flow();\n function flow() {\n var chunk;\n while ((chunk = engine.read()) !== null)\n buffers.push(chunk), nread += chunk.length;\n engine.once(\"readable\", flow);\n }\n function onError(err) {\n engine.removeListener(\"end\", onEnd), engine.removeListener(\"readable\", flow), callback(err);\n }\n function onEnd() {\n var buf, err = null;\n if (nread >= kMaxLength)\n err = new RangeError(kRangeErrorMessage);\n else\n buf = Buffer2.concat(buffers, nread);\n buffers = [], engine.close(), callback(err, buf);\n }\n }\n function zlibBufferSync(engine, buffer) {\n if (typeof buffer === \"string\")\n buffer = Buffer2.from(buffer);\n if (!Buffer2.isBuffer(buffer))\n @throwTypeError(\"Not a string or buffer\");\n var flushFlag = engine._finishFlushFlag;\n return engine._processChunk(buffer, flushFlag);\n }\n function Deflate(opts) {\n if (!(this instanceof Deflate))\n return new Deflate(opts);\n Zlib.@call(this, opts, binding.DEFLATE);\n }\n function Inflate(opts) {\n if (!(this instanceof Inflate))\n return new Inflate(opts);\n Zlib.@call(this, opts, binding.INFLATE);\n }\n function Gzip(opts) {\n if (!(this instanceof Gzip))\n return new Gzip(opts);\n Zlib.@call(this, opts, binding.GZIP);\n }\n function Gunzip(opts) {\n if (!(this instanceof Gunzip))\n return new Gunzip(opts);\n Zlib.@call(this, opts, binding.GUNZIP);\n }\n function DeflateRaw(opts) {\n if (!(this instanceof DeflateRaw))\n return new DeflateRaw(opts);\n Zlib.@call(this, opts, binding.DEFLATERAW);\n }\n function InflateRaw(opts) {\n if (!(this instanceof InflateRaw))\n return new InflateRaw(opts);\n Zlib.@call(this, opts, binding.INFLATERAW);\n }\n function Unzip(opts) {\n if (!(this instanceof Unzip))\n return new Unzip(opts);\n Zlib.@call(this, opts, binding.UNZIP);\n }\n function isValidFlushFlag(flag) {\n return flag === binding.Z_NO_FLUSH || flag === binding.Z_PARTIAL_FLUSH || flag === binding.Z_SYNC_FLUSH || flag === binding.Z_FULL_FLUSH || flag === binding.Z_FINISH || flag === binding.Z_BLOCK;\n }\n function Zlib(opts, mode) {\n var _this = this;\n if (this._opts = opts = opts || {}, this._chunkSize = opts.chunkSize || exports.Z_DEFAULT_CHUNK, Transform.@call(this, opts), opts.flush && !isValidFlushFlag(opts.flush))\n throw new Error(\"Invalid flush flag: \" + opts.flush);\n if (opts.finishFlush && !isValidFlushFlag(opts.finishFlush))\n throw new Error(\"Invalid flush flag: \" + opts.finishFlush);\n if (this._flushFlag = opts.flush || binding.Z_NO_FLUSH, this._finishFlushFlag = typeof opts.finishFlush !== \"undefined\" \? opts.finishFlush : binding.Z_FINISH, opts.chunkSize) {\n if (opts.chunkSize < exports.Z_MIN_CHUNK || opts.chunkSize > exports.Z_MAX_CHUNK)\n throw new Error(\"Invalid chunk size: \" + opts.chunkSize);\n }\n if (opts.windowBits) {\n if (opts.windowBits < exports.Z_MIN_WINDOWBITS || opts.windowBits > exports.Z_MAX_WINDOWBITS)\n throw new Error(\"Invalid windowBits: \" + opts.windowBits);\n }\n if (opts.level) {\n if (opts.level < exports.Z_MIN_LEVEL || opts.level > exports.Z_MAX_LEVEL)\n throw new Error(\"Invalid compression level: \" + opts.level);\n }\n if (opts.memLevel) {\n if (opts.memLevel < exports.Z_MIN_MEMLEVEL || opts.memLevel > exports.Z_MAX_MEMLEVEL)\n throw new Error(\"Invalid memLevel: \" + opts.memLevel);\n }\n if (opts.strategy) {\n if (opts.strategy != exports.Z_FILTERED && opts.strategy != exports.Z_HUFFMAN_ONLY && opts.strategy != exports.Z_RLE && opts.strategy != exports.Z_FIXED && opts.strategy != exports.Z_DEFAULT_STRATEGY)\n throw new Error(\"Invalid strategy: \" + opts.strategy);\n }\n if (opts.dictionary) {\n if (!Buffer2.isBuffer(opts.dictionary))\n throw new Error(\"Invalid dictionary: it should be a Buffer instance\");\n }\n this._handle = new binding.Zlib(mode);\n var self = this;\n this._hadError = !1, this._handle.onerror = function(message, errno) {\n _close(self), self._hadError = !0;\n var error = new Error(message);\n error.errno = errno, error.code = exports.codes[errno], self.emit(\"error\", error);\n };\n var level = exports.Z_DEFAULT_COMPRESSION;\n if (typeof opts.level === \"number\")\n level = opts.level;\n var strategy = exports.Z_DEFAULT_STRATEGY;\n if (typeof opts.strategy === \"number\")\n strategy = opts.strategy;\n this._handle.init(opts.windowBits || exports.Z_DEFAULT_WINDOWBITS, level, opts.memLevel || exports.Z_DEFAULT_MEMLEVEL, strategy, opts.dictionary), this._buffer = Buffer2.allocUnsafe(this._chunkSize), this._offset = 0, this._level = level, this._strategy = strategy, this.once(\"end\", this.close), Object.defineProperty(this, \"_closed\", {\n get: function() {\n return !_this._handle;\n },\n configurable: !0,\n enumerable: !0\n });\n }\n util.inherits(Zlib, Transform), Zlib.prototype.params = function(level, strategy, callback) {\n if (level < exports.Z_MIN_LEVEL || level > exports.Z_MAX_LEVEL)\n @throwRangeError(\"Invalid compression level: \" + level);\n if (strategy != exports.Z_FILTERED && strategy != exports.Z_HUFFMAN_ONLY && strategy != exports.Z_RLE && strategy != exports.Z_FIXED && strategy != exports.Z_DEFAULT_STRATEGY)\n @throwTypeError(\"Invalid strategy: \" + strategy);\n if (this._level !== level || this._strategy !== strategy) {\n var self = this;\n this.flush(binding.Z_SYNC_FLUSH, function() {\n if (assert(self._handle, \"zlib binding closed\"), self._handle.params(level, strategy), !self._hadError) {\n if (self._level = level, self._strategy = strategy, callback)\n callback();\n }\n });\n } else\n process.nextTick(callback);\n }, Zlib.prototype.reset = function() {\n return assert(this._handle, \"zlib binding closed\"), this._handle.reset();\n }, Zlib.prototype._flush = function(callback) {\n this._transform(Buffer2.alloc(0), \"\", callback);\n }, Zlib.prototype.flush = function(kind, callback) {\n var _this2 = this, ws = this._writableState;\n if (typeof kind === \"function\" || kind === void 0 && !callback)\n callback = kind, kind = binding.Z_FULL_FLUSH;\n if (ws.ended) {\n if (callback)\n process.nextTick(callback);\n } else if (ws.ending) {\n if (callback)\n this.once(\"end\", callback);\n } else if (ws.needDrain) {\n if (callback)\n this.once(\"drain\", function() {\n return _this2.flush(kind, callback);\n });\n } else\n this._flushFlag = kind, this.write(Buffer2.alloc(0), \"\", callback);\n }, Zlib.prototype.close = function(callback) {\n _close(this, callback), process.nextTick(emitCloseNT, this);\n };\n function _close(engine, callback) {\n if (callback)\n process.nextTick(callback);\n if (!engine._handle)\n return;\n engine._handle.close(), engine._handle = null;\n }\n function emitCloseNT(self) {\n self.emit(\"close\");\n }\n Zlib.prototype._transform = function(chunk, encoding, cb) {\n var flushFlag, ws = this._writableState, ending = ws.ending || ws.ended, last = ending && (!chunk || ws.length === chunk.length);\n if (chunk !== null && !Buffer2.isBuffer(chunk))\n return cb(new Error(\"invalid input\"));\n if (!this._handle)\n return cb(new Error(\"zlib binding closed\"));\n if (last)\n flushFlag = this._finishFlushFlag;\n else if (flushFlag = this._flushFlag, chunk.length >= ws.length)\n this._flushFlag = this._opts.flush || binding.Z_NO_FLUSH;\n this._processChunk(chunk, flushFlag, cb);\n }, Zlib.prototype._processChunk = function(chunk, flushFlag, cb) {\n var availInBefore = chunk && chunk.length, availOutBefore = this._chunkSize - this._offset, inOff = 0, self = this, async = typeof cb === \"function\";\n if (!async) {\n var buffers = [], nread = 0, error;\n this.on(\"error\", function(er) {\n error = er;\n }), assert(this._handle, \"zlib binding closed\");\n do\n var res = this._handle.writeSync(flushFlag, chunk, inOff, availInBefore, this._buffer, this._offset, availOutBefore);\n while (!this._hadError && callback(res[0], res[1]));\n if (this._hadError)\n throw error;\n if (nread >= kMaxLength)\n _close(this), @throwRangeError(kRangeErrorMessage);\n var buf = Buffer2.concat(buffers, nread);\n return _close(this), buf;\n }\n assert(this._handle, \"zlib binding closed\");\n var req = this._handle.write(flushFlag, chunk, inOff, availInBefore, this._buffer, this._offset, availOutBefore);\n req.buffer = chunk, req.callback = callback;\n function callback(availInAfter, availOutAfter) {\n if (this)\n this.buffer = null, this.callback = null;\n if (self._hadError)\n return;\n var have = availOutBefore - availOutAfter;\n if (assert(have >= 0, \"have should not go down\"), have > 0) {\n var out = self._buffer.slice(self._offset, self._offset + have);\n if (self._offset += have, async)\n self.push(out);\n else\n buffers.push(out), nread += out.length;\n }\n if (availOutAfter === 0 || self._offset >= self._chunkSize)\n availOutBefore = self._chunkSize, self._offset = 0, self._buffer = Buffer2.allocUnsafe(self._chunkSize);\n if (availOutAfter === 0) {\n if (inOff += availInBefore - availInAfter, availInBefore = availInAfter, !async)\n return !0;\n var newReq = self._handle.write(flushFlag, chunk, inOff, availInBefore, self._buffer, self._offset, self._chunkSize);\n newReq.callback = callback, newReq.buffer = chunk;\n return;\n }\n if (!async)\n return !1;\n cb();\n }\n }, util.inherits(Deflate, Zlib), util.inherits(Inflate, Zlib), util.inherits(Gzip, Zlib), util.inherits(Gunzip, Zlib), util.inherits(DeflateRaw, Zlib), util.inherits(InflateRaw, Zlib), util.inherits(Unzip, Zlib);\n }\n});\nreturn require_lib()})\n"); -// - -// -static constexpr ASCIILiteral ThirdpartyDepdCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/thirdparty/depd.ts\nvar wrapfunction = function(fn, message) {\n if (typeof fn !== \"function\")\n @throwTypeError(\"argument fn must be a function\");\n return fn;\n}, wrapproperty = function(obj, prop, message) {\n if (!obj || typeof obj !== \"object\" && typeof obj !== \"function\")\n @throwTypeError(\"argument obj must be object\");\n var descriptor = Object.getOwnPropertyDescriptor(obj, prop);\n if (!descriptor)\n @throwTypeError(\"must call property on owner object\");\n if (!descriptor.configurable)\n @throwTypeError(\"property must be configurable\");\n}, $;\n$ = function depd(namespace) {\n if (!namespace)\n @throwTypeError(\"argument namespace is required\");\n function deprecate(message) {\n }\n return deprecate._file = void 0, deprecate._ignored = !0, deprecate._namespace = namespace, deprecate._traced = !1, deprecate._warned = Object.create(null), deprecate.function = wrapfunction, deprecate.property = wrapproperty, deprecate;\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral ThirdpartyDetectLibcCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/thirdparty/detect-libc.ts\nvar family = function() {\n return @Promise.resolve(familySync());\n}, familySync = function() {\n return null;\n}, version = function() {\n return @Promise.resolve(versionSync());\n}, versionSync = function() {\n return null;\n}, isNonGlibcLinuxSync = function() {\n return !1;\n}, isNonGlibcLinux = function() {\n return @Promise.resolve(isNonGlibcLinuxSync());\n}, $, GLIBC = \"glibc\", MUSL = \"musl\";\n$ = {\n GLIBC,\n MUSL,\n family,\n familySync,\n isNonGlibcLinux,\n isNonGlibcLinuxSync,\n version,\n versionSync\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral ThirdpartyDetectLibcLinuxCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/thirdparty/detect-libc.linux.ts\nvar family = function() {\n return @Promise.resolve(familySync());\n}, familySync = function() {\n return GLIBC;\n}, version = function() {\n return @Promise.resolve(versionSync());\n}, versionSync = function() {\n return \"2.29\";\n}, isNonGlibcLinuxSync = function() {\n return !1;\n}, isNonGlibcLinux = function() {\n return @Promise.resolve(isNonGlibcLinuxSync());\n}, $, GLIBC = \"glibc\", MUSL = \"musl\";\n$ = {\n GLIBC,\n MUSL,\n family,\n familySync,\n isNonGlibcLinux,\n isNonGlibcLinuxSync,\n version,\n versionSync\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral ThirdpartyIsomorphicFetchCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/thirdparty/isomorphic-fetch.ts\nvar bunFetch = Bun.fetch, fetch = (...args) => bunFetch(...args);\nfetch.default = fetch;\nfetch.fetch = fetch;\nreturn fetch})\n"); -// - -// -static constexpr ASCIILiteral ThirdpartyNodeFetchCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/thirdparty/node-fetch.ts\nasync function fetch(url, init) {\n let body = init\?.body;\n if (body) {\n const chunks = [];\n if (body instanceof Readable) {\n for await (let chunk of body)\n chunks.push(chunk);\n init = { ...init, body: new Blob(chunks) };\n }\n }\n const response = await nativeFetch(url, init);\n return Object.setPrototypeOf(response, Response.prototype), response;\n}\nvar blobFrom = function(path, options) {\n return @Promise.resolve(Bun.file(path, options));\n}, blobFromSync = function(path, options) {\n return Bun.file(path, options);\n}, isRedirect = function(code) {\n return code === 301 || code === 302 || code === 303 || code === 307 || code === 308;\n}, $, { Headers, Request, Response: WebResponse, Blob, File = Blob, FormData } = globalThis, nativeFetch = Bun.fetch, { Readable } = @getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39);\n\nclass Response extends WebResponse {\n constructor() {\n super(...arguments);\n }\n _body;\n get body() {\n return this._body \?\? (this._body = Readable.fromWeb(super.body));\n }\n}\n\nclass AbortError extends DOMException {\n constructor(message) {\n super(message, \"AbortError\");\n }\n}\n\nclass FetchBaseError extends Error {\n type;\n constructor(message, type) {\n super(message);\n this.type = type;\n }\n}\n\nclass FetchError extends FetchBaseError {\n constructor(message, type, systemError) {\n super(message, type);\n this.code = systemError\?.code;\n }\n}\nvar fileFrom = blobFrom, fileFromSync = blobFromSync;\n$ = Object.assign(fetch, {\n AbortError,\n Blob,\n FetchBaseError,\n FetchError,\n File,\n FormData,\n Headers,\n Request,\n Response,\n blobFrom,\n blobFromSync,\n fileFrom,\n fileFromSync,\n isRedirect,\n fetch,\n default: fetch\n});\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral ThirdpartyUndiciCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/thirdparty/undici.ts\nvar notImplemented = function() {\n throw new Error(\"Not implemented in bun\");\n};\nasync function request(url, options = {\n method: \"GET\",\n signal: null,\n headers: null,\n query: null,\n reset: !1,\n throwOnError: !1,\n body: null\n}) {\n let {\n method = \"GET\",\n headers: inputHeaders,\n query,\n signal,\n reset = !1,\n throwOnError = !1,\n body: inputBody,\n maxRedirections\n } = options;\n if (typeof url === \"string\") {\n if (query)\n url = new URL(url);\n } else if (typeof url === \"object\" && url !== null) {\n if (!(url instanceof URL))\n throw new Error(\"not implemented\");\n } else\n @throwTypeError(\"url must be a string, URL, or UrlObject\");\n if (typeof url === \"string\" && query)\n url = new URL(url);\n if (typeof url === \"object\" && url !== null && query) {\n if (query)\n url.search = new URLSearchParams(query).toString();\n }\n if (method = method && typeof method === \"string\" \? method.toUpperCase() : null, inputBody && (method === \"GET\" || method === \"HEAD\"))\n throw new Error(\"Body not allowed for GET or HEAD requests\");\n if (inputBody && inputBody.read && inputBody instanceof Readable) {\n let data = \"\";\n inputBody.setEncoding(\"utf8\");\n for await (let chunk of stream)\n data += chunk;\n inputBody = (new TextEncoder()).encode(data);\n }\n if (maxRedirections !== @undefined && Number.isNaN(maxRedirections))\n throw new Error(\"maxRedirections must be a number if defined\");\n if (signal && !(signal instanceof @AbortSignal))\n throw new Error(\"signal must be an instance of AbortSignal\");\n let resp;\n const {\n status: statusCode,\n headers,\n trailers\n } = resp = await fetch(url, {\n signal,\n mode: \"cors\",\n method,\n headers: inputHeaders || kEmptyObject,\n body: inputBody,\n redirect: maxRedirections === \"undefined\" || maxRedirections > 0 \? \"follow\" : \"manual\",\n keepalive: !reset\n });\n if (throwOnError && statusCode >= 400 && statusCode < 600)\n throw new Error(`Request failed with status code ${statusCode}`);\n const body = resp.body \? new BodyReadable(resp) : null;\n return { statusCode, headers: headers.toJSON(), body, trailers, opaque: kEmptyObject, context: kEmptyObject };\n}\nvar stream = function() {\n throw new Error(\"Not implemented in bun\");\n}, pipeline = function() {\n throw new Error(\"Not implemented in bun\");\n}, connect = function() {\n throw new Error(\"Not implemented in bun\");\n}, upgrade = function() {\n throw new Error(\"Not implemented in bun\");\n}, mockErrors = function() {\n throw new Error(\"Not implemented in bun\");\n}, Undici = function() {\n throw new Error(\"Not implemented in bun\");\n}, $, EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20), StreamModule = @getInternalField(@internalModuleRegistry, 39) || @createInternalModuleById(39), { Readable } = StreamModule, { _ReadableFromWebForUndici: ReadableFromWeb } = StreamModule[Symbol.for(\"::bunternal::\")], ObjectCreate = Object.create, kEmptyObject = ObjectCreate(null), fetch = Bun.fetch, Response = globalThis.Response, Headers = globalThis.Headers, Request = globalThis.Request, URLSearchParams = globalThis.URLSearchParams, URL = globalThis.URL;\n\nclass File extends Blob {\n constructor() {\n super(...arguments);\n }\n}\n\nclass FileReader extends EventTarget {\n constructor() {\n throw new Error(\"Not implemented yet!\");\n }\n}\nvar FormData = globalThis.FormData;\n\nclass BodyReadable extends ReadableFromWeb {\n #response;\n #bodyUsed;\n constructor(response, options = {}) {\n var { body } = response;\n if (!body)\n throw new Error(\"Response body is null\");\n super(options, body);\n this.#response = response, this.#bodyUsed = response.bodyUsed;\n }\n get bodyUsed() {\n return this.#bodyUsed;\n }\n #consume() {\n if (this.#bodyUsed)\n @throwTypeError(\"unusable\");\n this.#bodyUsed = !0;\n }\n async arrayBuffer() {\n return this.#consume(), await this.#response.arrayBuffer();\n }\n async blob() {\n return this.#consume(), await this.#response.blob();\n }\n async formData() {\n return this.#consume(), await this.#response.formData();\n }\n async json() {\n return this.#consume(), await this.#response.json();\n }\n async text() {\n return this.#consume(), await this.#response.text();\n }\n}\n\nclass MockClient {\n constructor() {\n throw new Error(\"Not implemented in bun\");\n }\n}\n\nclass MockPool {\n constructor() {\n throw new Error(\"Not implemented in bun\");\n }\n}\n\nclass MockAgent {\n constructor() {\n throw new Error(\"Not implemented in bun\");\n }\n}\n\nclass Dispatcher extends EventEmitter {\n constructor() {\n super(...arguments);\n }\n}\n\nclass Agent extends Dispatcher {\n constructor() {\n super(...arguments);\n }\n}\n\nclass Pool extends Dispatcher {\n constructor() {\n super(...arguments);\n }\n request() {\n throw new Error(\"Not implemented in bun\");\n }\n}\n\nclass BalancedPool extends Dispatcher {\n constructor() {\n super(...arguments);\n }\n}\n\nclass Client extends Dispatcher {\n constructor() {\n super(...arguments);\n }\n request() {\n throw new Error(\"Not implemented in bun\");\n }\n}\nUndici.Dispatcher = Dispatcher;\nUndici.Pool = Pool;\nUndici.BalancedPool = BalancedPool;\nUndici.Client = Client;\nUndici.Agent = Agent;\nUndici.buildConnector = Undici.errors = Undici.setGlobalDispatcher = Undici.getGlobalDispatcher = Undici.request = Undici.stream = Undici.pipeline = Undici.connect = Undici.upgrade = Undici.MockClient = Undici.MockPool = Undici.MockAgent = Undici.mockErrors = notImplemented;\nUndici.fetch = fetch;\n$ = {\n fetch,\n Response,\n Headers,\n Request,\n URLSearchParams,\n URL,\n File,\n FileReader,\n FormData,\n request,\n stream,\n pipeline,\n connect,\n upgrade,\n MockClient,\n MockPool,\n MockAgent,\n mockErrors,\n Dispatcher,\n Pool,\n BalancedPool,\n Client,\n Agent,\n Undici\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral ThirdpartyVercelFetchCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/thirdparty/vercel_fetch.ts\nvar $;\n$ = (wrapper = Bun.fetch) => {\n async function vercelFetch(url, opts = {}) {\n if (opts.body && typeof opts.body === \"object\" && (!(\"buffer\" in opts.body) || typeof opts.body.buffer !== \"object\" || !(opts.body.buffer instanceof @ArrayBuffer))) {\n if (opts.body = JSON.stringify(opts.body), !opts.headers)\n opts.headers = new Headers;\n opts.headers.set(\"Content-Type\", \"application/json\");\n }\n try {\n return await wrapper(url, opts);\n } catch (err) {\n if (typeof err === \"string\")\n err = new Error(err);\n throw err.url = url, err.opts = opts, err;\n }\n }\n return vercelFetch.default = vercelFetch, vercelFetch;\n};\nreturn $})\n"); -// - -// -static constexpr ASCIILiteral ThirdpartyWSCode = ASCIILiteral::fromLiteralUnsafe("(function (){\"use strict\";// src/js/out/tmp/thirdparty/ws.ts\nvar emitWarning = function(type, message) {\n if (emittedWarnings.has(type))\n return;\n emittedWarnings.add(type), console.warn(\"[bun] Warning:\", message);\n}, subprotocolParse = function(header) {\n const protocols = new Set;\n let start = -1, end = -1, i = 0;\n for (i;i < header.length; i++) {\n const code = header.charCodeAt(i);\n if (end === -1 && wsTokenChars[code] === 1) {\n if (start === -1)\n start = i;\n } else if (i !== 0 && (code === 32 || code === 9)) {\n if (end === -1 && start !== -1)\n end = i;\n } else if (code === 44) {\n if (start === -1)\n throw new SyntaxError(`Unexpected character at index ${i}`);\n if (end === -1)\n end = i;\n const protocol2 = header.slice(start, end);\n if (protocols.has(protocol2))\n throw new SyntaxError(`The \"${protocol2}\" subprotocol is duplicated`);\n protocols.add(protocol2), start = end = -1;\n } else\n throw new SyntaxError(`Unexpected character at index ${i}`);\n }\n if (start === -1 || end !== -1)\n throw new SyntaxError(\"Unexpected end of input\");\n const protocol = header.slice(start, i);\n if (protocols.has(protocol))\n throw new SyntaxError(`The \"${protocol}\" subprotocol is duplicated`);\n return protocols.add(protocol), protocols;\n}, wsEmitClose = function(server) {\n server._state = CLOSED, server.emit(\"close\");\n}, abortHandshake = function(response, code, message, headers) {\n message = message || http.STATUS_CODES[code], headers = {\n Connection: \"close\",\n \"Content-Type\": \"text/html\",\n \"Content-Length\": @Buffer.byteLength(message),\n ...headers\n }, response.writeHead(code, headers), response.write(message), response.end();\n}, abortHandshakeOrEmitwsClientError = function(server, req, response, socket, code, message) {\n if (server.listenerCount(\"wsClientError\")) {\n const err = new Error(message);\n Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError), server.emit(\"wsClientError\", err, socket, req);\n } else\n abortHandshake(response, code, message);\n}, $, EventEmitter = @getInternalField(@internalModuleRegistry, 20) || @createInternalModuleById(20), http = @getInternalField(@internalModuleRegistry, 23) || @createInternalModuleById(23), kBunInternals = Symbol.for(\"::bunternal::\"), readyStates = [\"CONNECTING\", \"OPEN\", \"CLOSING\", \"CLOSED\"], encoder = new TextEncoder, eventIds = {\n open: 1,\n close: 2,\n message: 3,\n error: 4,\n ping: 5,\n pong: 6\n}, emittedWarnings = new Set;\n\nclass BunWebSocket extends EventEmitter {\n static CONNECTING = 0;\n static OPEN = 1;\n static CLOSING = 2;\n static CLOSED = 3;\n #ws;\n #paused = !1;\n #fragments = !1;\n #binaryType = \"nodebuffer\";\n #eventId = 0;\n constructor(url, protocols, options) {\n super();\n let ws = this.#ws = new WebSocket(url, protocols);\n ws.binaryType = \"nodebuffer\";\n }\n on(event, listener) {\n if (event === \"unexpected-response\" || event === \"upgrade\" || event === \"redirect\")\n emitWarning(event, \"ws.WebSocket '\" + event + \"' event is not implemented in bun\");\n const mask = 1 << eventIds[event];\n if (mask && (this.#eventId & mask) !== mask) {\n if (this.#eventId |= mask, event === \"open\")\n this.#ws.addEventListener(\"open\", () => {\n this.emit(\"open\");\n });\n else if (event === \"close\")\n this.#ws.addEventListener(\"close\", ({ code, reason, wasClean }) => {\n this.emit(\"close\", code, reason, wasClean);\n });\n else if (event === \"message\")\n this.#ws.addEventListener(\"message\", ({ data }) => {\n const isBinary = typeof data !== \"string\";\n if (isBinary)\n this.emit(\"message\", this.#fragments \? [data] : data, isBinary);\n else {\n let encoded = encoder.encode(data);\n if (this.#binaryType !== \"arraybuffer\")\n encoded = @Buffer.from(encoded.buffer, encoded.byteOffset, encoded.byteLength);\n this.emit(\"message\", this.#fragments \? [encoded] : encoded, isBinary);\n }\n });\n else if (event === \"error\")\n this.#ws.addEventListener(\"error\", (err) => {\n this.emit(\"error\", err);\n });\n else if (event === \"ping\")\n this.#ws.addEventListener(\"ping\", ({ data }) => {\n this.emit(\"ping\", data);\n });\n else if (event === \"pong\")\n this.#ws.addEventListener(\"pong\", ({ data }) => {\n this.emit(\"pong\", data);\n });\n }\n return super.on(event, listener);\n }\n send(data, opts, cb) {\n try {\n this.#ws.send(data, opts\?.compress);\n } catch (error) {\n typeof cb === \"function\" && cb(error);\n return;\n }\n typeof cb === \"function\" && cb();\n }\n close(code, reason) {\n this.#ws.close(code, reason);\n }\n terminate() {\n this.#ws.terminate();\n }\n get url() {\n return this.#ws.url;\n }\n get readyState() {\n return this.#ws.readyState;\n }\n get binaryType() {\n return this.#binaryType;\n }\n set binaryType(value) {\n if (value === \"nodebuffer\" || value === \"arraybuffer\")\n this.#ws.binaryType = this.#binaryType = value, this.#fragments = !1;\n else if (value === \"fragments\")\n this.#ws.binaryType = \"nodebuffer\", this.#binaryType = \"fragments\", this.#fragments = !0;\n else\n throw new Error(`Invalid binaryType: ${value}`);\n }\n get protocol() {\n return this.#ws.protocol;\n }\n get extensions() {\n return this.#ws.extensions;\n }\n addEventListener(type, listener, options) {\n this.#ws.addEventListener(type, listener, options);\n }\n removeEventListener(type, listener) {\n this.#ws.removeEventListener(type, listener);\n }\n get onopen() {\n return this.#ws.onopen;\n }\n set onopen(value) {\n this.#ws.onopen = value;\n }\n get onerror() {\n return this.#ws.onerror;\n }\n set onerror(value) {\n this.#ws.onerror = value;\n }\n get onclose() {\n return this.#ws.onclose;\n }\n set onclose(value) {\n this.#ws.onclose = value;\n }\n get onmessage() {\n return this.#ws.onmessage;\n }\n set onmessage(value) {\n this.#ws.onmessage = value;\n }\n get bufferedAmount() {\n return this.#ws.bufferedAmount;\n }\n get isPaused() {\n return this.#paused;\n }\n ping(data, mask, cb) {\n if (typeof data === \"function\")\n cb = data, data = mask = @undefined;\n else if (typeof mask === \"function\")\n cb = mask, mask = @undefined;\n if (typeof data === \"number\")\n data = data.toString();\n try {\n this.#ws.ping(data);\n } catch (error) {\n typeof cb === \"function\" && cb(error);\n return;\n }\n typeof cb === \"function\" && cb();\n }\n pong(data, mask, cb) {\n if (typeof data === \"function\")\n cb = data, data = mask = @undefined;\n else if (typeof mask === \"function\")\n cb = mask, mask = @undefined;\n if (typeof data === \"number\")\n data = data.toString();\n try {\n this.#ws.pong(data);\n } catch (error) {\n typeof cb === \"function\" && cb(error);\n return;\n }\n typeof cb === \"function\" && cb();\n }\n pause() {\n switch (this.readyState) {\n case WebSocket.CONNECTING:\n case WebSocket.CLOSED:\n return;\n }\n this.#paused = !0, emitWarning(\"pause()\", \"ws.WebSocket.pause() is not implemented in bun\");\n }\n resume() {\n switch (this.readyState) {\n case WebSocket.CONNECTING:\n case WebSocket.CLOSED:\n return;\n }\n this.#paused = !1, emitWarning(\"resume()\", \"ws.WebSocket.resume() is not implemented in bun\");\n }\n}\nObject.defineProperty(BunWebSocket, \"name\", { value: \"WebSocket\" });\nvar wsKeyRegex = /^[+/0-9A-Za-z]{22}==$/, wsTokenChars = [\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 1,\n 1,\n 1,\n 1,\n 1,\n 0,\n 0,\n 1,\n 1,\n 0,\n 1,\n 1,\n 0,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 0,\n 0,\n 0,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 0,\n 1,\n 0,\n 1,\n 0\n], RUNNING = 0, CLOSING = 1, CLOSED = 2;\n\nclass BunWebSocketMocked extends EventEmitter {\n #ws;\n #state;\n #enquedMessages = [];\n #url;\n #protocol;\n #extensions;\n #bufferedAmount = 0;\n #binaryType = \"arraybuffer\";\n #onclose;\n #onerror;\n #onmessage;\n #onopen;\n constructor(url, protocol, extensions, binaryType) {\n super();\n if (this.#ws = null, this.#state = 0, this.#url = url, this.#bufferedAmount = 0, binaryType = binaryType || \"arraybuffer\", binaryType !== \"nodebuffer\" && binaryType !== \"blob\" && binaryType !== \"arraybuffer\")\n @throwTypeError(\"binaryType must be either 'blob', 'arraybuffer' or 'nodebuffer'\");\n this.#binaryType = binaryType, this.#protocol = protocol, this.#extensions = extensions;\n const message = this.#message.bind(this), open = this.#open.bind(this), close = this.#close.bind(this), drain = this.#drain.bind(this);\n this[kBunInternals] = {\n message,\n open,\n close,\n drain\n };\n }\n #message(ws, message) {\n this.#ws = ws;\n let isBinary = !1;\n if (typeof message === \"string\")\n if (this.#binaryType === \"arraybuffer\")\n message = encoder.encode(message).buffer;\n else if (this.#binaryType === \"blob\")\n message = new Blob([message], { type: \"text/plain\" });\n else\n message = @Buffer.from(message);\n else if (isBinary = !0, this.#binaryType !== \"nodebuffer\") {\n if (this.#binaryType === \"arraybuffer\")\n message = new @Uint8Array(message);\n else if (this.#binaryType === \"blob\")\n message = new Blob([message]);\n }\n this.emit(\"message\", message, isBinary);\n }\n #open(ws) {\n this.#ws = ws, this.#state = 1, this.emit(\"open\", this), this.#drain(ws);\n }\n #close(ws, code, reason) {\n this.#state = 3, this.#ws = null, this.emit(\"close\", code, reason);\n }\n #drain(ws) {\n const chunk = this.#enquedMessages[0];\n if (chunk) {\n const [data, compress, cb] = chunk;\n if (ws.send(data, compress) == -1)\n return;\n typeof cb === \"function\" && cb(), this.#bufferedAmount -= chunk.length, this.#enquedMessages.shift();\n }\n }\n send(data, opts, cb) {\n if (this.#state === 1) {\n const compress = opts\?.compress;\n if (this.#ws.send(data, compress) == -1) {\n this.#enquedMessages.push([data, compress, cb]), this.#bufferedAmount += data.length;\n return;\n }\n typeof cb === \"function\" && cb();\n } else if (this.#state === 0)\n this.#enquedMessages.push([data, opts\?.compress, cb]), this.#bufferedAmount += data.length;\n }\n close(code, reason) {\n if (this.#state === 1)\n this.#state = 2, this.#ws.close(code, reason);\n }\n get binaryType() {\n return this.#binaryType;\n }\n set binaryType(type) {\n if (type !== \"nodebuffer\" && type !== \"blob\" && type !== \"arraybuffer\")\n @throwTypeError(\"binaryType must be either 'blob', 'arraybuffer' or 'nodebuffer'\");\n this.#binaryType = type;\n }\n get readyState() {\n return this.#state;\n }\n get url() {\n return this.#url;\n }\n get protocol() {\n return this.#protocol;\n }\n get extensions() {\n return this.#extensions;\n }\n get bufferedAmount() {\n return this.#bufferedAmount \?\? 0;\n }\n setSocket(socket, head, options) {\n throw new Error(\"Not implemented\");\n }\n set onclose(cb) {\n if (this.#onclose)\n this.removeListener(\"close\", this.#onclose);\n this.on(\"close\", cb), this.#onclose = cb;\n }\n set onerror(cb) {\n if (this.#onerror)\n this.removeListener(\"error\", this.#onerror);\n this.on(\"error\", cb), this.#onerror = cb;\n }\n set onmessage(cb) {\n if (this.#onmessage)\n this.removeListener(\"message\", this.#onmessage);\n this.on(\"message\", cb), this.#onmessage = cb;\n }\n set onopen(cb) {\n if (this.#onopen)\n this.removeListener(\"open\", this.#onopen);\n this.on(\"open\", cb), this.#onopen = cb;\n }\n get onclose() {\n return this.#onclose;\n }\n get onerror() {\n return this.#onerror;\n }\n get onmessage() {\n return this.#onmessage;\n }\n get onopen() {\n return this.#onopen;\n }\n addEventListener(type, listener, options) {\n if (type === \"message\") {\n const l = (data) => listener({ data });\n l.listener = listener, this.on(type, l);\n return;\n }\n this.on(type, listener);\n }\n removeEventListener(type, listener) {\n this.off(type, listener);\n }\n}\n\nclass WebSocketServer extends EventEmitter {\n _server;\n options;\n clients;\n _shouldEmitClose;\n _state;\n _removeListeners;\n constructor(options, callback) {\n super();\n if (options = {\n maxPayload: 104857600,\n skipUTF8Validation: !1,\n perMessageDeflate: !1,\n handleProtocols: null,\n clientTracking: !0,\n verifyClient: null,\n noServer: !1,\n backlog: null,\n server: null,\n host: null,\n path: null,\n port: null,\n ...options\n }, options.port == null && !options.server && !options.noServer || options.port != null && (options.server || options.noServer) || options.server && options.noServer)\n @throwTypeError('One and only one of the \"port\", \"server\", or \"noServer\" options must be specified');\n if (options.port != null)\n this._server = http.createServer((req, res) => {\n const body = http.STATUS_CODES[426];\n res.writeHead(426, {\n \"Content-Length\": body.length,\n \"Content-Type\": \"text/plain\"\n }), res.end(body);\n }), this._server.listen(options.port, options.host, options.backlog, callback);\n else if (options.server)\n this._server = options.server;\n if (this._server) {\n const emitConnection = this.emit.bind(this, \"connection\"), emitListening = this.emit.bind(this, \"listening\"), emitError = this.emit.bind(this, \"error\"), doUpgrade = (req, socket, head) => {\n this.handleUpgrade(req, socket, head, emitConnection);\n };\n this._server.on(\"listening\", emitListening), this._server.on(\"error\", emitError), this._server.on(\"upgrade\", doUpgrade), this._removeListeners = () => {\n this._server.removeListener(\"upgrade\", doUpgrade), this._server.removeListener(\"listening\", emitListening), this._server.removeListener(\"error\", emitError);\n };\n }\n if (options.perMessageDeflate === !0)\n options.perMessageDeflate = {};\n if (options.clientTracking)\n this.clients = new Set, this._shouldEmitClose = !1;\n this.options = options, this._state = RUNNING;\n }\n address() {\n if (this.options.noServer)\n throw new Error('The server is operating in \"noServer\" mode');\n if (!this._server)\n return null;\n return this._server.address();\n }\n close(cb) {\n if (this._state === CLOSED) {\n if (cb)\n this.once(\"close\", () => {\n cb(new Error(\"The server is not running\"));\n });\n process.nextTick((server) => {\n server._state = CLOSED, server.emit(\"close\");\n }, this);\n return;\n }\n if (cb)\n this.once(\"close\", cb);\n if (this._state === CLOSING)\n return;\n if (this._state = CLOSING, this.options.noServer || this.options.server) {\n if (this._server)\n this._removeListeners(), this._removeListeners = this._server = null;\n if (this.clients)\n if (!this.clients.size)\n process.nextTick((server) => {\n server._state = CLOSED, server.emit(\"close\");\n }, this);\n else\n this._shouldEmitClose = !0;\n else\n process.nextTick((server) => {\n server._state = CLOSED, server.emit(\"close\");\n }, this);\n } else {\n const server = this._server;\n this._removeListeners(), this._removeListeners = this._server = null, server.close(() => {\n this._state = CLOSED, this.emit(\"close\");\n });\n }\n }\n shouldHandle(req) {\n if (this.options.path) {\n const index = req.url.indexOf(\"\?\");\n if ((index !== -1 \? req.url.slice(0, index) : req.url) !== this.options.path)\n return !1;\n }\n return !0;\n }\n completeUpgrade(extensions, key, protocols, request, socket, head, cb) {\n const [server, response, req] = socket[kBunInternals];\n if (this._state > RUNNING)\n return abortHandshake(response, 503);\n let protocol = \"\";\n if (protocols.size)\n protocol = this.options.handleProtocols \? this.options.handleProtocols(protocols, request) : protocols.values().next().value;\n const ws = new BunWebSocketMocked(request.url, protocol, extensions, \"nodebuffer\"), headers = [\"HTTP/1.1 101 Switching Protocols\", \"Upgrade: websocket\", \"Connection: Upgrade\"];\n if (this.emit(\"headers\", headers, request), server.upgrade(req, {\n data: ws[kBunInternals]\n })) {\n if (response._reply(@undefined), this.clients)\n this.clients.add(ws), ws.on(\"close\", () => {\n if (this.clients.delete(ws), this._shouldEmitClose && !this.clients.size)\n process.nextTick(wsEmitClose, this);\n });\n cb(ws, request);\n } else\n abortHandshake(response, 500);\n }\n handleUpgrade(req, socket, head, cb) {\n const [_, response] = socket[kBunInternals], key = req.headers[\"sec-websocket-key\"], version = +req.headers[\"sec-websocket-version\"];\n if (req.method !== \"GET\") {\n abortHandshakeOrEmitwsClientError(this, req, response, socket, 405, \"Invalid HTTP method\");\n return;\n }\n if (req.headers.upgrade.toLowerCase() !== \"websocket\") {\n abortHandshakeOrEmitwsClientError(this, req, response, socket, 400, \"Invalid Upgrade header\");\n return;\n }\n if (!key || !wsKeyRegex.test(key)) {\n abortHandshakeOrEmitwsClientError(this, req, response, socket, 400, \"Missing or invalid Sec-WebSocket-Key header\");\n return;\n }\n if (version !== 8 && version !== 13) {\n abortHandshakeOrEmitwsClientError(this, req, response, socket, 400, \"Missing or invalid Sec-WebSocket-Version header\");\n return;\n }\n if (!this.shouldHandle(req)) {\n abortHandshake(response, 400);\n return;\n }\n const secWebSocketProtocol = req.headers[\"sec-websocket-protocol\"];\n let protocols = new Set;\n if (secWebSocketProtocol !== @undefined)\n try {\n protocols = subprotocolParse(secWebSocketProtocol);\n } catch (err) {\n abortHandshakeOrEmitwsClientError(this, req, response, socket, 400, \"Invalid Sec-WebSocket-Protocol header\");\n return;\n }\n const extensions = {};\n if (this.options.verifyClient) {\n const info = {\n origin: req.headers[`${version === 8 \? \"sec-websocket-origin\" : \"origin\"}`],\n secure: !!(req.socket.authorized || req.socket.encrypted),\n req\n };\n if (this.options.verifyClient.length === 2) {\n this.options.verifyClient(info, (verified, code, message, headers) => {\n if (!verified)\n return abortHandshake(response, code || 401, message, headers);\n this.completeUpgrade(extensions, key, protocols, req, socket, head, cb);\n });\n return;\n }\n if (!this.options.verifyClient(info))\n return abortHandshake(response, 401);\n }\n this.completeUpgrade(extensions, key, protocols, req, socket, head, cb);\n }\n}\nObject.defineProperty(BunWebSocket, \"CONNECTING\", {\n enumerable: !0,\n value: readyStates.indexOf(\"CONNECTING\")\n});\nObject.defineProperty(BunWebSocket.prototype, \"CONNECTING\", {\n enumerable: !0,\n value: readyStates.indexOf(\"CONNECTING\")\n});\nObject.defineProperty(BunWebSocket, \"OPEN\", {\n enumerable: !0,\n value: readyStates.indexOf(\"OPEN\")\n});\nObject.defineProperty(BunWebSocket.prototype, \"OPEN\", {\n enumerable: !0,\n value: readyStates.indexOf(\"OPEN\")\n});\nObject.defineProperty(BunWebSocket, \"CLOSING\", {\n enumerable: !0,\n value: readyStates.indexOf(\"CLOSING\")\n});\nObject.defineProperty(BunWebSocket.prototype, \"CLOSING\", {\n enumerable: !0,\n value: readyStates.indexOf(\"CLOSING\")\n});\nObject.defineProperty(BunWebSocket, \"CLOSED\", {\n enumerable: !0,\n value: readyStates.indexOf(\"CLOSED\")\n});\nObject.defineProperty(BunWebSocket.prototype, \"CLOSED\", {\n enumerable: !0,\n value: readyStates.indexOf(\"CLOSED\")\n});\n\nclass Sender {\n constructor() {\n throw new Error(\"Not supported yet in Bun\");\n }\n}\n\nclass Receiver {\n constructor() {\n throw new Error(\"Not supported yet in Bun\");\n }\n}\nvar createWebSocketStream = (ws) => {\n throw new Error(\"Not supported yet in Bun\");\n};\n$ = Object.assign(BunWebSocket, {\n createWebSocketStream,\n Receiver,\n Sender,\n WebSocket: BunWebSocket,\n Server: WebSocketServer,\n WebSocketServer\n});\nreturn $})\n"); -// - -#endif - -} -} \ No newline at end of file diff --git a/src/js/out/NativeModuleImpl.h b/src/js/out/NativeModuleImpl.h deleted file mode 100644 index 8bb70d5cb8b9d..0000000000000 --- a/src/js/out/NativeModuleImpl.h +++ /dev/null @@ -1,9 +0,0 @@ -#include "../../bun.js/modules/BunObjectModule.h" -#include "../../bun.js/modules/BunJSCModule.h" -#include "../../bun.js/modules/NodeBufferModule.h" -#include "../../bun.js/modules/NodeConstantsModule.h" -#include "../../bun.js/modules/NodeModuleModule.h" -#include "../../bun.js/modules/NodeProcessModule.h" -#include "../../bun.js/modules/NodeStringDecoderModule.h" -#include "../../bun.js/modules/NodeUtilTypesModule.h" -#include "../../bun.js/modules/UTF8ValidateModule.h" diff --git a/src/js/out/ResolvedSourceTag.zig b/src/js/out/ResolvedSourceTag.zig deleted file mode 100644 index cf115736c12be..0000000000000 --- a/src/js/out/ResolvedSourceTag.zig +++ /dev/null @@ -1,86 +0,0 @@ -// zig fmt: off -pub const ResolvedSourceTag = enum(u32) { - // Predefined - javascript = 0, - package_json_type_module = 1, - wasm = 2, - object = 3, - file = 4, - esm = 5, - json_for_object_loader = 6, - - // Built in modules are loaded through InternalModuleRegistry by numerical ID. - // In this enum are represented as `(1 << 9) & id` - @"bun:ffi" = 512, - @"bun:sqlite" = 513, - @"internal:debugger" = 514, - @"internal:fs/cp-sync" = 515, - @"internal:fs/cp" = 516, - @"internal:primordials" = 517, - @"internal:shared" = 518, - @"internal:util/inspect" = 519, - @"node:assert" = 520, - @"node:assert/strict" = 521, - @"node:async_hooks" = 522, - @"node:child_process" = 523, - @"node:cluster" = 524, - @"node:console" = 525, - @"node:crypto" = 526, - @"node:dgram" = 527, - @"node:diagnostics_channel" = 528, - @"node:dns" = 529, - @"node:dns/promises" = 530, - @"node:domain" = 531, - @"node:events" = 532, - @"node:fs" = 533, - @"node:fs/promises" = 534, - @"node:http" = 535, - @"node:http2" = 536, - @"node:https" = 537, - @"node:inspector" = 538, - @"node:net" = 539, - @"node:os" = 540, - @"node:path/posix" = 541, - @"node:path" = 542, - @"node:path/win32" = 543, - @"node:perf_hooks" = 544, - @"node:punycode" = 545, - @"node:querystring" = 546, - @"node:readline" = 547, - @"node:readline/promises" = 548, - @"node:repl" = 549, - @"node:stream/consumers" = 550, - @"node:stream" = 551, - @"node:stream/promises" = 552, - @"node:stream/web" = 553, - @"node:timers" = 554, - @"node:timers/promises" = 555, - @"node:tls" = 556, - @"node:trace_events" = 557, - @"node:tty" = 558, - @"node:url" = 559, - @"node:util" = 560, - @"node:v8" = 561, - @"node:vm" = 562, - @"node:wasi" = 563, - @"node:worker_threads" = 564, - @"node:zlib" = 565, - @"depd" = 566, - @"detect-libc" = 567, - @"detect-libc/linux" = 568, - @"isomorphic-fetch" = 569, - @"node-fetch" = 570, - @"undici" = 571, - @"vercel_fetch" = 572, - @"ws" = 573, - // Native modules run through a different system using ESM registry. - @"bun" = 1024, - @"bun:jsc" = 1025, - @"node:buffer" = 1026, - @"node:constants" = 1027, - @"node:module" = 1028, - @"node:process" = 1029, - @"node:string_decoder" = 1030, - @"node:util/types" = 1031, - @"utf-8-validate" = 1032, -}; diff --git a/src/js/out/SyntheticModuleType.h b/src/js/out/SyntheticModuleType.h deleted file mode 100644 index 0990be0cb8db2..0000000000000 --- a/src/js/out/SyntheticModuleType.h +++ /dev/null @@ -1,89 +0,0 @@ -enum SyntheticModuleType : uint32_t { - JavaScript = 0, - PackageJSONTypeModule = 1, - Wasm = 2, - ObjectModule = 3, - File = 4, - ESM = 5, - JSONForObjectLoader = 6, - - // Built in modules are loaded through InternalModuleRegistry by numerical ID. - // In this enum are represented as `(1 << 9) & id` - InternalModuleRegistryFlag = 1 << 9, - BunFFI = 512, - BunSqlite = 513, - InternalDebugger = 514, - InternalFSCpSync = 515, - InternalFSCp = 516, - InternalPrimordials = 517, - InternalShared = 518, - InternalUtilInspect = 519, - NodeAssert = 520, - NodeAssertStrict = 521, - NodeAsyncHooks = 522, - NodeChildProcess = 523, - NodeCluster = 524, - NodeConsole = 525, - NodeCrypto = 526, - NodeDgram = 527, - NodeDiagnosticsChannel = 528, - NodeDNS = 529, - NodeDNSPromises = 530, - NodeDomain = 531, - NodeEvents = 532, - NodeFS = 533, - NodeFSPromises = 534, - NodeHttp = 535, - NodeHttp2 = 536, - NodeHttps = 537, - NodeInspector = 538, - NodeNet = 539, - NodeOS = 540, - NodePathPosix = 541, - NodePath = 542, - NodePathWin32 = 543, - NodePerfHooks = 544, - NodePunycode = 545, - NodeQuerystring = 546, - NodeReadline = 547, - NodeReadlinePromises = 548, - NodeRepl = 549, - NodeStreamConsumers = 550, - NodeStream = 551, - NodeStreamPromises = 552, - NodeStreamWeb = 553, - NodeTimers = 554, - NodeTimersPromises = 555, - NodeTLS = 556, - NodeTraceEvents = 557, - NodeTty = 558, - NodeUrl = 559, - NodeUtil = 560, - NodeV8 = 561, - NodeVM = 562, - NodeWasi = 563, - NodeWorkerThreads = 564, - NodeZlib = 565, - ThirdpartyDepd = 566, - ThirdpartyDetectLibc = 567, - ThirdpartyDetectLibcLinux = 568, - ThirdpartyIsomorphicFetch = 569, - ThirdpartyNodeFetch = 570, - ThirdpartyUndici = 571, - ThirdpartyVercelFetch = 572, - ThirdpartyWS = 573, - - // Native modules run through the same system, but with different underlying initializers. - // They also have bit 10 set to differentiate them from JS builtins. - NativeModuleFlag = (1 << 10) | (1 << 9), - BunObject = 1024, - BunJSC = 1025, - NodeBuffer = 1026, - NodeConstants = 1027, - NodeModule = 1028, - NodeProcess = 1029, - NodeStringDecoder = 1030, - NodeUtilTypes = 1031, - UTF8Validate = 1032, -}; - diff --git a/src/js/out/WebCoreJSBuiltins.cpp b/src/js/out/WebCoreJSBuiltins.cpp deleted file mode 100644 index c8cc13889e61a..0000000000000 --- a/src/js/out/WebCoreJSBuiltins.cpp +++ /dev/null @@ -1,3111 +0,0 @@ -// Generated by `bun src/js/builtins/codegen` -// Do not edit by hand. -namespace Zig { class GlobalObject; } -#include "root.h" -#include "config.h" -#include "JSDOMGlobalObject.h" -#include "WebCoreJSClientData.h" -#include - -namespace WebCore { - -/* BundlerPlugin.ts */ -// runOnLoadPlugins -const JSC::ConstructAbility s_bundlerPluginRunOnLoadPluginsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_bundlerPluginRunOnLoadPluginsCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_bundlerPluginRunOnLoadPluginsCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_bundlerPluginRunOnLoadPluginsCodeLength = 2268; -static const JSC::Intrinsic s_bundlerPluginRunOnLoadPluginsCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_bundlerPluginRunOnLoadPluginsCode = "(function (internalID, path, namespace, defaultLoaderId) {\"use strict\";\n const LOADERS_MAP = { jsx: 0, js: 1, ts: 2, tsx: 3, css: 4, file: 5, json: 6, toml: 7, wasm: 8, napi: 9, base64: 10, dataurl: 11, text: 12 }, loaderName = [\"jsx\", \"js\", \"ts\", \"tsx\", \"css\", \"file\", \"json\", \"toml\", \"wasm\", \"napi\", \"base64\", \"dataurl\", \"text\"][defaultLoaderId];\n var promiseResult = (async (internalID2, path2, namespace2, defaultLoader) => {\n var results = this.onLoad.@get(namespace2);\n if (!results)\n return this.onLoadAsync(internalID2, null, null), null;\n for (let [filter, callback] of results)\n if (filter.test(path2)) {\n var result = callback({\n path: path2,\n namespace: namespace2,\n loader: defaultLoader\n });\n while (result && @isPromise(result) && (@getPromiseInternalField(result, @promiseFieldFlags) & @promiseStateMask) === @promiseStateFulfilled)\n result = @getPromiseInternalField(result, @promiseFieldReactionsOrResult);\n if (result && @isPromise(result))\n result = await result;\n if (!result || !@isObject(result))\n continue;\n var { contents, loader = defaultLoader } = result;\n if (typeof contents !== \"string\" && !@isTypedArrayView(contents))\n @throwTypeError('onLoad plugins must return an object with \"contents\" as a string or Uint8Array');\n if (typeof loader !== \"string\")\n @throwTypeError('onLoad plugins must return an object with \"loader\" as a string');\n const chosenLoader = LOADERS_MAP[loader];\n if (chosenLoader === @undefined)\n @throwTypeError(`Loader ${loader} is not supported.`);\n return this.onLoadAsync(internalID2, contents, chosenLoader), null;\n }\n return this.onLoadAsync(internalID2, null, null), null;\n })(internalID, path, namespace, loaderName);\n while (promiseResult && @isPromise(promiseResult) && (@getPromiseInternalField(promiseResult, @promiseFieldFlags) & @promiseStateMask) === @promiseStateFulfilled)\n promiseResult = @getPromiseInternalField(promiseResult, @promiseFieldReactionsOrResult);\n if (promiseResult && @isPromise(promiseResult))\n promiseResult.then(() => {\n }, (e) => {\n this.addError(internalID, e, 1);\n });\n})\n"; - -// runOnResolvePlugins -const JSC::ConstructAbility s_bundlerPluginRunOnResolvePluginsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_bundlerPluginRunOnResolvePluginsCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_bundlerPluginRunOnResolvePluginsCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_bundlerPluginRunOnResolvePluginsCodeLength = 3000; -static const JSC::Intrinsic s_bundlerPluginRunOnResolvePluginsCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_bundlerPluginRunOnResolvePluginsCode = "(function (specifier, inputNamespace, importer, internalID, kindId) {\"use strict\";\n const kind = [\"entry-point\", \"import-statement\", \"require-call\", \"dynamic-import\", \"require-resolve\", \"import-rule\", \"url-token\", \"internal\"][kindId];\n var promiseResult = (async (inputPath, inputNamespace2, importer2, kind2) => {\n var { onResolve, onLoad } = this, results = onResolve.@get(inputNamespace2);\n if (!results)\n return this.onResolveAsync(internalID, null, null, null), null;\n for (let [filter, callback] of results)\n if (filter.test(inputPath)) {\n var result = callback({\n path: inputPath,\n importer: importer2,\n namespace: inputNamespace2,\n kind: kind2\n });\n while (result && @isPromise(result) && (@getPromiseInternalField(result, @promiseFieldFlags) & @promiseStateMask) === @promiseStateFulfilled)\n result = @getPromiseInternalField(result, @promiseFieldReactionsOrResult);\n if (result && @isPromise(result))\n result = await result;\n if (!result || !@isObject(result))\n continue;\n var { path, namespace: userNamespace = inputNamespace2, external } = result;\n if (typeof path !== \"string\" || typeof userNamespace !== \"string\")\n @throwTypeError(\"onResolve plugins must return an object with a string 'path' and string 'loader' field\");\n if (!path)\n continue;\n if (!userNamespace)\n userNamespace = inputNamespace2;\n if (typeof external !== \"boolean\" && !@isUndefinedOrNull(external))\n @throwTypeError('onResolve plugins \"external\" field must be boolean or unspecified');\n if (!external) {\n if (userNamespace === \"file\") {\n if (process.platform !== \"win32\") {\n if (path[0] !== \"/\" || path.includes(\"..\"))\n @throwTypeError('onResolve plugin \"path\" must be absolute when the namespace is \"file\"');\n }\n }\n if (userNamespace === \"dataurl\") {\n if (!path.startsWith(\"data:\"))\n @throwTypeError('onResolve plugin \"path\" must start with \"data:\" when the namespace is \"dataurl\"');\n }\n if (userNamespace && userNamespace !== \"file\" && (!onLoad || !onLoad.@has(userNamespace)))\n @throwTypeError(`Expected onLoad plugin for namespace ${userNamespace} to exist`);\n }\n return this.onResolveAsync(internalID, path, userNamespace, external), null;\n }\n return this.onResolveAsync(internalID, null, null, null), null;\n })(specifier, inputNamespace, importer, kind);\n while (promiseResult && @isPromise(promiseResult) && (@getPromiseInternalField(promiseResult, @promiseFieldFlags) & @promiseStateMask) === @promiseStateFulfilled)\n promiseResult = @getPromiseInternalField(promiseResult, @promiseFieldReactionsOrResult);\n if (promiseResult && @isPromise(promiseResult))\n promiseResult.then(() => {\n }, (e) => {\n this.addError(internalID, e, 0);\n });\n})\n"; - -// runSetupFunction -const JSC::ConstructAbility s_bundlerPluginRunSetupFunctionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_bundlerPluginRunSetupFunctionCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_bundlerPluginRunSetupFunctionCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_bundlerPluginRunSetupFunctionCodeLength = 4133; -static const JSC::Intrinsic s_bundlerPluginRunSetupFunctionCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_bundlerPluginRunSetupFunctionCode = "(function (setup, config) {\"use strict\";\n var onLoadPlugins = new Map, onResolvePlugins = new Map;\n function validate(filterObject, callback, map) {\n if (!filterObject || !@isObject(filterObject))\n @throwTypeError('Expected an object with \"filter\" RegExp');\n if (!callback || !@isCallable(callback))\n @throwTypeError(\"callback must be a function\");\n var { filter, namespace = \"file\" } = filterObject;\n if (!filter)\n @throwTypeError('Expected an object with \"filter\" RegExp');\n if (!@isRegExpObject(filter))\n @throwTypeError(\"filter must be a RegExp\");\n if (namespace && typeof namespace !== \"string\")\n @throwTypeError(\"namespace must be a string\");\n if ((namespace\?.length \?\? 0) === 0)\n namespace = \"file\";\n if (!/^([/@a-zA-Z0-9_\\\\-]+)$/.test(namespace))\n @throwTypeError(\"namespace can only contain $a-zA-Z0-9_\\\\-\");\n var callbacks = map.@get(namespace);\n if (!callbacks)\n map.@set(namespace, [[filter, callback]]);\n else\n @arrayPush(callbacks, [filter, callback]);\n }\n function onLoad(filterObject, callback) {\n validate(filterObject, callback, onLoadPlugins);\n }\n function onResolve(filterObject, callback) {\n validate(filterObject, callback, onResolvePlugins);\n }\n const processSetupResult = () => {\n var anyOnLoad = !1, anyOnResolve = !1;\n for (var [namespace, callbacks] of onLoadPlugins.entries())\n for (var [filter] of callbacks)\n this.addFilter(filter, namespace, 1), anyOnLoad = !0;\n for (var [namespace, callbacks] of onResolvePlugins.entries())\n for (var [filter] of callbacks)\n this.addFilter(filter, namespace, 0), anyOnResolve = !0;\n if (anyOnResolve) {\n var onResolveObject = this.onResolve;\n if (!onResolveObject)\n this.onResolve = onResolvePlugins;\n else\n for (var [namespace, callbacks] of onResolvePlugins.entries()) {\n var existing = onResolveObject.@get(namespace);\n if (!existing)\n onResolveObject.@set(namespace, callbacks);\n else\n onResolveObject.@set(namespace, existing.concat(callbacks));\n }\n }\n if (anyOnLoad) {\n var onLoadObject = this.onLoad;\n if (!onLoadObject)\n this.onLoad = onLoadPlugins;\n else\n for (var [namespace, callbacks] of onLoadPlugins.entries()) {\n var existing = onLoadObject.@get(namespace);\n if (!existing)\n onLoadObject.@set(namespace, callbacks);\n else\n onLoadObject.@set(namespace, existing.concat(callbacks));\n }\n }\n return anyOnLoad || anyOnResolve;\n };\n var setupResult = setup({\n config,\n onDispose: () => @throwTypeError(\"@{@2} is not implemented yet. See https://github.com/oven-sh/bun/issues/@1\"),\n onEnd: () => @throwTypeError(\"@{@2} is not implemented yet. See https://github.com/oven-sh/bun/issues/@1\"),\n onLoad,\n onResolve,\n onStart: () => @throwTypeError(\"@{@2} is not implemented yet. See https://github.com/oven-sh/bun/issues/@1\"),\n resolve: () => @throwTypeError(\"@{@2} is not implemented yet. See https://github.com/oven-sh/bun/issues/@1\"),\n module: () => {\n @throwTypeError(\"module() is not supported in Bun.build() yet. Only via Bun.plugin() at runtime\");\n },\n initialOptions: {\n ...config,\n bundle: !0,\n entryPoints: config.entrypoints \?\? config.entryPoints \?\? [],\n minify: typeof config.minify === \"boolean\" \? config.minify : !1,\n minifyIdentifiers: config.minify === !0 || config.minify\?.identifiers,\n minifyWhitespace: config.minify === !0 || config.minify\?.whitespace,\n minifySyntax: config.minify === !0 || config.minify\?.syntax,\n outbase: config.root,\n platform: config.target === \"bun\" \? \"node\" : config.target\n },\n esbuild: {}\n });\n if (setupResult && @isPromise(setupResult))\n if (@getPromiseInternalField(setupResult, @promiseFieldFlags) & @promiseStateFulfilled)\n setupResult = @getPromiseInternalField(setupResult, @promiseFieldReactionsOrResult);\n else\n return setupResult.@then(processSetupResult);\n return processSetupResult();\n})\n"; - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast(vm.clientData); \ - return clientData->builtinFunctions().bundlerPluginBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().bundlerPluginBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - -/* ByteLengthQueuingStrategy.ts */ -// highWaterMark -const JSC::ConstructAbility s_byteLengthQueuingStrategyHighWaterMarkCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_byteLengthQueuingStrategyHighWaterMarkCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_byteLengthQueuingStrategyHighWaterMarkCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_byteLengthQueuingStrategyHighWaterMarkCodeLength = 269; -static const JSC::Intrinsic s_byteLengthQueuingStrategyHighWaterMarkCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_byteLengthQueuingStrategyHighWaterMarkCode = "(function () {\"use strict\";\n const highWaterMark = @getByIdDirectPrivate(this, \"highWaterMark\");\n if (highWaterMark === @undefined)\n @throwTypeError(\"ByteLengthQueuingStrategy.highWaterMark getter called on incompatible |this| value.\");\n return highWaterMark;\n})\n"; - -// initializeByteLengthQueuingStrategy -const JSC::ConstructAbility s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCodeLength = 147; -static const JSC::Intrinsic s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCode = "(function (parameters) {\"use strict\";\n @putByIdDirectPrivate(this, \"highWaterMark\", @extractHighWaterMarkFromQueuingStrategyInit(parameters));\n})\n"; - -// size -const JSC::ConstructAbility s_byteLengthQueuingStrategySizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_byteLengthQueuingStrategySizeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_byteLengthQueuingStrategySizeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_byteLengthQueuingStrategySizeCodeLength = 63; -static const JSC::Intrinsic s_byteLengthQueuingStrategySizeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_byteLengthQueuingStrategySizeCode = "(function (chunk) {\"use strict\";\n return chunk.byteLength;\n})\n"; - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast(vm.clientData); \ - return clientData->builtinFunctions().byteLengthQueuingStrategyBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().byteLengthQueuingStrategyBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - -/* ConsoleObject.ts */ -// asyncIterator -const JSC::ConstructAbility s_consoleObjectAsyncIteratorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_consoleObjectAsyncIteratorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_consoleObjectAsyncIteratorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_consoleObjectAsyncIteratorCodeLength = 2154; -static const JSC::Intrinsic s_consoleObjectAsyncIteratorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_consoleObjectAsyncIteratorCode = "(function () {\"use strict\";\n var stream = Bun.stdin.stream(), decoder = new TextDecoder(\"utf-8\", { fatal: !1 }), indexOf = Bun.indexOfLine, actualChunk, i = -1, idx, last, done, value, value_len, pendingChunk;\n async function* ConsoleAsyncIterator() {\n var reader = stream.getReader(), deferredError;\n try {\n if (i !== -1) {\n last = i + 1, i = indexOf(actualChunk, last);\n while (i !== -1)\n yield decoder.decode(actualChunk.subarray(last, i)), last = i + 1, i = indexOf(actualChunk, last);\n for (idx++;idx < value_len; idx++) {\n if (actualChunk = value[idx], pendingChunk)\n actualChunk = @Buffer.concat([pendingChunk, actualChunk]), pendingChunk = @undefined;\n last = 0, i = indexOf(actualChunk, last);\n while (i !== -1)\n yield decoder.decode(actualChunk.subarray(last, i)), last = i + 1, i = indexOf(actualChunk, last);\n i = -1, pendingChunk = actualChunk.subarray(last);\n }\n actualChunk = @undefined;\n }\n while (!0) {\n const firstResult = reader.readMany();\n if (@isPromise(firstResult))\n ({ done, value } = await firstResult);\n else\n ({ done, value } = firstResult);\n if (done) {\n if (pendingChunk)\n yield decoder.decode(pendingChunk);\n return;\n }\n for (idx = 0, value_len = value.length;idx < value_len; idx++) {\n if (actualChunk = value[idx], pendingChunk)\n actualChunk = @Buffer.concat([pendingChunk, actualChunk]), pendingChunk = @undefined;\n last = 0, i = indexOf(actualChunk, last);\n while (i !== -1)\n yield decoder.decode(actualChunk.subarray(last, i)), last = i + 1, i = indexOf(actualChunk, last);\n i = -1, pendingChunk = actualChunk.subarray(last);\n }\n actualChunk = @undefined;\n }\n } catch (e) {\n deferredError = e;\n } finally {\n if (reader.releaseLock(), deferredError)\n throw deferredError;\n }\n }\n const symbol = globalThis.Symbol.asyncIterator;\n return this[symbol] = ConsoleAsyncIterator, ConsoleAsyncIterator();\n})\n"; - -// createConsoleConstructor -const JSC::ConstructAbility s_consoleObjectCreateConsoleConstructorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_consoleObjectCreateConsoleConstructorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_consoleObjectCreateConsoleConstructorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_consoleObjectCreateConsoleConstructorCodeLength = 18551; -static const JSC::Intrinsic s_consoleObjectCreateConsoleConstructorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_consoleObjectCreateConsoleConstructorCode = "(function (console) {\"use strict\";\n const { inspect, formatWithOptions } = @getInternalField(@internalModuleRegistry, 48) || @createInternalModuleById(48), { isBuffer } = @requireNativeModule(\"buffer\"), StringPrototypeIncludes = @String.prototype.includes, RegExpPrototypeSymbolReplace = @RegExp.prototype[Symbol.replace], ArrayPrototypeUnshift = @Array.prototype.unshift, StringPrototypeRepeat = @String.prototype.repeat, StringPrototypeSlice = @String.prototype.slice, ObjectPrototypeHasOwnProperty = Object.prototype.hasOwnProperty, StringPrototypePadStart = @String.prototype.padStart, StringPrototypeSplit = @String.prototype.split, NumberPrototypeToFixed = Number.prototype.toFixed, StringPrototypeNormalize = @String.prototype.normalize, StringPrototypeCodePointAt = @String.prototype.codePointAt, ArrayPrototypeMap = @Array.prototype.map, ArrayPrototypeJoin = @Array.prototype.join, ArrayPrototypePush = @Array.prototype.push, kCounts = Symbol(\"counts\");\n var ansiPattern = \"[\\\\u001B\\\\u009B][[\\\\]()#;\?]*(\?:(\?:(\?:(\?:;[-a-zA-Z\\\\d\\\\/#&.:=\?%@~_]+)*|[a-zA-Z\\\\d]+(\?:;[-a-zA-Z\\\\d\\\\/#&.:=\?%@~_]*)*)\?\\\\u0007)|(\?:(\?:\\\\d{1,4}(\?:;\\\\d{0,4})*)\?[\\\\dA-PR-TZcf-ntqry=><~]))\", ansi = new @RegExp(ansiPattern, \"g\"), isFullWidthCodePoint = (code) => {\n return code >= 4352 && (code <= 4447 || code === 9001 || code === 9002 || code >= 11904 && code <= 12871 && code !== 12351 || code >= 12880 && code <= 19903 || code >= 19968 && code <= 42182 || code >= 43360 && code <= 43388 || code >= 44032 && code <= 55203 || code >= 63744 && code <= 64255 || code >= 65040 && code <= 65049 || code >= 65072 && code <= 65131 || code >= 65281 && code <= 65376 || code >= 65504 && code <= 65510 || code >= 110592 && code <= 110593 || code >= 127488 && code <= 127569 || code >= 127744 && code <= 128591 || code >= 131072 && code <= 262141);\n }, isZeroWidthCodePoint = (code) => {\n return code <= 31 || code >= 127 && code <= 159 || code >= 768 && code <= 879 || code >= 8203 && code <= 8207 || code >= 8400 && code <= 8447 || code >= 65024 && code <= 65039 || code >= 65056 && code <= 65071 || code >= 917760 && code <= 917999;\n };\n function stripVTControlCharacters(str) {\n return RegExpPrototypeSymbolReplace.@call(ansi, str, \"\");\n }\n var getStringWidth = function getStringWidth(str, removeControlChars = !0) {\n var width = 0;\n if (removeControlChars)\n str = stripVTControlCharacters(str);\n str = StringPrototypeNormalize.@call(str, \"NFC\");\n for (var char of str) {\n var code = StringPrototypeCodePointAt.@call(char, 0);\n if (isFullWidthCodePoint(code))\n width += 2;\n else if (!isZeroWidthCodePoint(code))\n width++;\n }\n return width;\n };\n const tableChars = {\n middleMiddle: \"\\u2500\",\n rowMiddle: \"\\u253C\",\n topRight: \"\\u2510\",\n topLeft: \"\\u250C\",\n leftMiddle: \"\\u251C\",\n topMiddle: \"\\u252C\",\n bottomRight: \"\\u2518\",\n bottomLeft: \"\\u2514\",\n bottomMiddle: \"\\u2534\",\n rightMiddle: \"\\u2524\",\n left: \"\\u2502 \",\n right: \" \\u2502\",\n middle: \" \\u2502 \"\n }, renderRow = (row, columnWidths) => {\n let out = tableChars.left;\n for (let i = 0;i < row.length; i++) {\n const cell = row[i], len = getStringWidth(cell), needed = (columnWidths[i] - len) / 2;\n if (out += StringPrototypeRepeat.@call(\" \", needed) + cell + StringPrototypeRepeat.@call(\" \", Math.ceil(needed)), i !== row.length - 1)\n out += tableChars.middle;\n }\n return out += tableChars.right, out;\n }, table = (head, columns) => {\n const columnWidths = ArrayPrototypeMap.@call(head, (h) => getStringWidth(h)), longestColumn = Math.max(...ArrayPrototypeMap.@call(columns, (a) => a.length)), rows = @newArrayWithSize(longestColumn);\n for (let i = 0;i < head.length; i++) {\n const column = columns[i];\n for (let j = 0;j < longestColumn; j++) {\n if (rows[j] === @undefined)\n rows[j] = [];\n const value = rows[j][i] = ObjectPrototypeHasOwnProperty.@call(column, j) \? column[j] : \"\", width = columnWidths[i] || 0, counted = getStringWidth(value);\n columnWidths[i] = Math.max(width, counted);\n }\n }\n const divider = ArrayPrototypeMap.@call(columnWidths, (i) => StringPrototypeRepeat.@call(tableChars.middleMiddle, i + 2));\n let result = tableChars.topLeft + ArrayPrototypeJoin.@call(divider, tableChars.topMiddle) + tableChars.topRight + \"\\n\" + renderRow(head, columnWidths) + \"\\n\" + tableChars.leftMiddle + ArrayPrototypeJoin.@call(divider, tableChars.rowMiddle) + tableChars.rightMiddle + \"\\n\";\n for (let row of rows)\n result += `${renderRow(row, columnWidths)}\\n`;\n return result += tableChars.bottomLeft + ArrayPrototypeJoin.@call(divider, tableChars.bottomMiddle) + tableChars.bottomRight, result;\n }, kGroupIndent = Symbol(\"kGroupIndent\"), kGroupIndentationWidth = Symbol(\"kGroupIndentWidth\"), kFormatForStderr = Symbol(\"kFormatForStderr\"), kFormatForStdout = Symbol(\"kFormatForStdout\"), kGetInspectOptions = Symbol(\"kGetInspectOptions\"), kColorMode = Symbol(\"kColorMode\"), kIsConsole = Symbol(\"kIsConsole\"), kWriteToConsole = Symbol(\"kWriteToConsole\"), kBindProperties = Symbol(\"kBindProperties\"), kBindStreamsEager = Symbol(\"kBindStreamsEager\"), kBindStreamsLazy = Symbol(\"kBindStreamsLazy\"), kUseStdout = Symbol(\"kUseStdout\"), kUseStderr = Symbol(\"kUseStderr\"), optionsMap = new WeakMap;\n function Console(options) {\n if (new.target === @undefined)\n return Reflect.construct(Console, arguments);\n if (!options || typeof options.write === \"function\")\n options = {\n stdout: options,\n stderr: arguments[1],\n ignoreErrors: arguments[2]\n };\n const {\n stdout,\n stderr = stdout,\n ignoreErrors = !0,\n colorMode = \"auto\",\n inspectOptions,\n groupIndentation\n } = options;\n if (!stdout || typeof stdout.write !== \"function\")\n @throwTypeError(\"stdout is not a writable stream\");\n if (!stderr || typeof stderr.write !== \"function\")\n @throwTypeError(\"stderr is not a writable stream\");\n if (typeof colorMode !== \"boolean\" && colorMode !== \"auto\")\n @throwTypeError(\"colorMode must be a boolean or 'auto'\");\n if (inspectOptions !== @undefined) {\n if (inspectOptions.colors !== @undefined && options.colorMode !== @undefined)\n ;\n optionsMap.set(this, inspectOptions);\n }\n Object.keys(Console.prototype).forEach((key) => {\n this[key] = this[key].bind(this), Object.defineProperty(this[key], \"name\", {\n value: key\n });\n }), this[kBindStreamsEager](stdout, stderr), this[kBindProperties](ignoreErrors, colorMode, groupIndentation);\n }\n const consolePropAttributes = {\n writable: !0,\n enumerable: !1,\n configurable: !0\n };\n Object.defineProperty(Console, Symbol.hasInstance, {\n value(instance) {\n return instance[kIsConsole] || instance === console;\n }\n });\n const kColorInspectOptions = { colors: !0 }, kNoColorInspectOptions = {};\n Object.defineProperties(Console.prototype = {}, {\n [kBindStreamsEager]: {\n ...consolePropAttributes,\n value: function(stdout, stderr) {\n Object.defineProperties(this, {\n _stdout: { ...consolePropAttributes, value: stdout },\n _stderr: { ...consolePropAttributes, value: stderr }\n });\n }\n },\n [kBindStreamsLazy]: {\n ...consolePropAttributes,\n value: function(object) {\n let stdout, stderr;\n Object.defineProperties(this, {\n _stdout: {\n enumerable: !1,\n configurable: !0,\n get() {\n if (!stdout)\n stdout = object.stdout;\n return stdout;\n },\n set(value) {\n stdout = value;\n }\n },\n _stderr: {\n enumerable: !1,\n configurable: !0,\n get() {\n if (!stderr)\n stderr = object.stderr;\n return stderr;\n },\n set(value) {\n stderr = value;\n }\n }\n });\n }\n },\n [kBindProperties]: {\n ...consolePropAttributes,\n value: function(ignoreErrors, colorMode, groupIndentation = 2) {\n Object.defineProperties(this, {\n _stdoutErrorHandler: {\n ...consolePropAttributes,\n value: createWriteErrorHandler(this, kUseStdout)\n },\n _stderrErrorHandler: {\n ...consolePropAttributes,\n value: createWriteErrorHandler(this, kUseStderr)\n },\n _ignoreErrors: {\n ...consolePropAttributes,\n value: Boolean(ignoreErrors)\n },\n _times: { ...consolePropAttributes, value: new Map },\n [kCounts]: { ...consolePropAttributes, value: new Map },\n [kColorMode]: { ...consolePropAttributes, value: colorMode },\n [kIsConsole]: { ...consolePropAttributes, value: !0 },\n [kGroupIndent]: { ...consolePropAttributes, value: \"\" },\n [kGroupIndentationWidth]: {\n ...consolePropAttributes,\n value: groupIndentation\n },\n [Symbol.toStringTag]: {\n writable: !1,\n enumerable: !1,\n configurable: !0,\n value: \"console\"\n }\n });\n }\n },\n [kWriteToConsole]: {\n ...consolePropAttributes,\n value: function(streamSymbol, string) {\n const ignoreErrors = this._ignoreErrors, groupIndent = this[kGroupIndent], useStdout = streamSymbol === kUseStdout, stream = useStdout \? this._stdout : this._stderr, errorHandler = useStdout \? this._stdoutErrorHandler : this._stderrErrorHandler;\n if (groupIndent.length !== 0) {\n if (StringPrototypeIncludes.@call(string, \"\\n\"))\n string = RegExpPrototypeSymbolReplace.@call(/\\n/g, string, `\\n${groupIndent}`);\n string = groupIndent + string;\n }\n if (string += \"\\n\", ignoreErrors === !1)\n return stream.write(string);\n try {\n if (stream.listenerCount(\"error\") === 0)\n stream.once(\"error\", noop);\n stream.write(string, errorHandler);\n } catch (e) {\n } finally {\n stream.removeListener(\"error\", noop);\n }\n }\n },\n [kGetInspectOptions]: {\n ...consolePropAttributes,\n value: function(stream) {\n let color = this[kColorMode];\n if (color === \"auto\")\n if (process.env.FORCE_COLOR !== @undefined)\n color = Bun.enableANSIColors;\n else\n color = stream.isTTY && (typeof stream.getColorDepth === \"function\" \? stream.getColorDepth() > 2 : !0);\n const options = optionsMap.get(this);\n if (options) {\n if (options.colors === @undefined)\n options.colors = color;\n return options;\n }\n return color \? kColorInspectOptions : kNoColorInspectOptions;\n }\n },\n [kFormatForStdout]: {\n ...consolePropAttributes,\n value: function(args) {\n const opts = this[kGetInspectOptions](this._stdout);\n return formatWithOptions(opts, ...args);\n }\n },\n [kFormatForStderr]: {\n ...consolePropAttributes,\n value: function(args) {\n const opts = this[kGetInspectOptions](this._stderr);\n return formatWithOptions(opts, ...args);\n }\n }\n });\n function createWriteErrorHandler(instance, streamSymbol) {\n return (err) => {\n const stream = streamSymbol === kUseStdout \? instance._stdout : instance._stderr;\n if (err !== null && !stream._writableState.errorEmitted) {\n if (stream.listenerCount(\"error\") === 0)\n stream.once(\"error\", noop);\n }\n };\n }\n const consoleMethods = {\n log(...args) {\n this[kWriteToConsole](kUseStdout, this[kFormatForStdout](args));\n },\n warn(...args) {\n this[kWriteToConsole](kUseStderr, this[kFormatForStderr](args));\n },\n dir(object, options) {\n this[kWriteToConsole](kUseStdout, inspect(object, {\n customInspect: !1,\n ...this[kGetInspectOptions](this._stdout),\n ...options\n }));\n },\n time(label = \"default\") {\n if (label = `${label}`, this._times.has(label)) {\n process.emitWarning(`Label '${label}' already exists for console.time()`);\n return;\n }\n this._times.set(label, process.hrtime());\n },\n timeEnd(label = \"default\") {\n if (label = `${label}`, timeLogImpl(this, \"timeEnd\", label))\n this._times.delete(label);\n },\n timeLog(label = \"default\", ...data) {\n label = `${label}`, timeLogImpl(this, \"timeLog\", label, data);\n },\n trace: function trace(...args) {\n const err = {\n name: \"Trace\",\n message: this[kFormatForStderr](args)\n };\n Error.captureStackTrace(err, trace), this.error(err.stack);\n },\n assert(expression, ...args) {\n if (!expression)\n args[0] = `Assertion failed${args.length === 0 \? \"\" : `: ${args[0]}`}`, this.warn.@apply(this, args);\n },\n clear() {\n if (this._stdout.isTTY && process.env.TERM !== \"dumb\")\n this._stdout.write(\"\\x1B[2J\"), this._stdout.write(\"\\x1B[0f\");\n },\n count(label = \"default\") {\n label = `${label}`;\n const counts = this[kCounts];\n let count = counts.get(label);\n if (count === @undefined)\n count = 1;\n else\n count++;\n counts.set(label, count), this.log(`${label}: ${count}`);\n },\n countReset(label = \"default\") {\n const counts = this[kCounts];\n if (!counts.has(label)) {\n process.emitWarning(`Count for '${label}' does not exist`);\n return;\n }\n counts.delete(`${label}`);\n },\n group(...data) {\n if (data.length > 0)\n this.log.@apply(this, data);\n this[kGroupIndent] += StringPrototypeRepeat.@call(\" \", this[kGroupIndentationWidth]);\n },\n groupEnd() {\n this[kGroupIndent] = StringPrototypeSlice.@call(this[kGroupIndent], 0, this[kGroupIndent].length - this[kGroupIndentationWidth]);\n },\n table(tabularData, properties) {\n if (tabularData === null || typeof tabularData !== \"object\")\n return this.log(tabularData);\n const final = (k, v) => this.log(table(k, v)), _inspect = (v) => {\n const opt = {\n depth: v !== null && typeof v === \"object\" && !isArray(v) && Object.keys(v).length > 2 \? -1 : 0,\n maxArrayLength: 3,\n breakLength: @Infinity,\n ...this[kGetInspectOptions](this._stdout)\n };\n return inspect(v, opt);\n }, getIndexArray = (length) => @Array.from({ length }, (_, i2) => _inspect(i2)), mapIter = @isMapIterator(tabularData);\n let isKeyValue = !1, i = 0;\n if (isKeyValue || @isMap(tabularData)) {\n const keys2 = [], values2 = [];\n let length = 0;\n if (mapIter)\n for (;i < tabularData.length / 2; ++i)\n ArrayPrototypePush.@call(keys2, _inspect(tabularData[i * 2])), ArrayPrototypePush.@call(values2, _inspect(tabularData[i * 2 + 1])), length++;\n else\n for (let { 0: k, 1: v } of tabularData)\n ArrayPrototypePush.@call(keys2, _inspect(k)), ArrayPrototypePush.@call(values2, _inspect(v)), length++;\n return final([iterKey, keyKey, valuesKey], [getIndexArray(length), keys2, values2]);\n }\n if (@isSetIterator(tabularData) || mapIter || @isSet(tabularData)) {\n const values2 = [];\n let length = 0;\n for (let v of tabularData)\n ArrayPrototypePush.@call(values2, _inspect(v)), length++;\n return final([iterKey, valuesKey], [getIndexArray(length), values2]);\n }\n const map = { __proto__: null };\n let hasPrimitives = !1;\n const valuesKeyArray = [], indexKeyArray = Object.keys(tabularData);\n for (;i < indexKeyArray.length; i++) {\n const item = tabularData[indexKeyArray[i]], primitive = item === null || typeof item !== \"function\" && typeof item !== \"object\";\n if (properties === @undefined && primitive)\n hasPrimitives = !0, valuesKeyArray[i] = _inspect(item);\n else {\n const keys2 = properties || Object.keys(item);\n for (let key of keys2)\n if (map[key] \?\?= [], primitive && properties || !ObjectPrototypeHasOwnProperty.@call(item, key))\n map[key][i] = \"\";\n else\n map[key][i] = _inspect(item[key]);\n }\n }\n const keys = Object.keys(map), values = Object.values(map);\n if (hasPrimitives)\n ArrayPrototypePush.@call(keys, valuesKey), ArrayPrototypePush.@call(values, valuesKeyArray);\n return ArrayPrototypeUnshift.@call(keys, indexKey), ArrayPrototypeUnshift.@call(values, indexKeyArray), final(keys, values);\n }\n };\n function timeLogImpl(self, name, label, data) {\n const time = self._times.get(label);\n if (time === @undefined)\n return process.emitWarning(`No such label '${label}' for console.${name}()`), !1;\n const duration = process.hrtime(time), ms = duration[0] * 1000 + duration[1] / 1e6, formatted = formatTime(ms);\n if (data === @undefined)\n self.log(\"%s: %s\", label, formatted);\n else\n self.log(\"%s: %s\", label, formatted, ...data);\n return !0;\n }\n function pad(value) {\n return StringPrototypePadStart.@call(`${value}`, 2, \"0\");\n }\n function formatTime(ms) {\n let hours = 0, minutes = 0, seconds = 0;\n if (ms >= 1000) {\n if (ms >= 60000) {\n if (ms >= 3600000)\n hours = Math.floor(ms / 3600000), ms = ms % 3600000;\n minutes = Math.floor(ms / 60000), ms = ms % 60000;\n }\n seconds = ms / 1000;\n }\n if (hours !== 0 || minutes !== 0)\n return { 0: seconds, 1: ms } = StringPrototypeSplit.@call(NumberPrototypeToFixed.@call(seconds, 3), \".\"), `${hours !== 0 \? `${hours}:${pad(minutes)}` : minutes}:${pad(seconds)}.${ms} (${hours !== 0 \? \"h:m\" : \"\"}m:ss.mmm)`;\n if (seconds !== 0)\n return `${NumberPrototypeToFixed.@call(seconds, 3)}s`;\n return `${Number(NumberPrototypeToFixed.@call(ms, 3))}ms`;\n }\n const keyKey = \"Key\", valuesKey = \"Values\", indexKey = \"(index)\", iterKey = \"(iteration index)\", isArray = (v) => @isJSArray(v) || @isTypedArrayView(v) || isBuffer(v);\n function noop() {\n }\n for (let method of Reflect.ownKeys(consoleMethods))\n Console.prototype[method] = consoleMethods[method];\n return Console.prototype.debug = Console.prototype.log, Console.prototype.info = Console.prototype.log, Console.prototype.dirxml = Console.prototype.log, Console.prototype.error = Console.prototype.warn, Console.prototype.groupCollapsed = Console.prototype.group, Console;\n})\n"; - -// write -const JSC::ConstructAbility s_consoleObjectWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_consoleObjectWriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_consoleObjectWriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_consoleObjectWriteCodeLength = 467; -static const JSC::Intrinsic s_consoleObjectWriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_consoleObjectWriteCode = "(function (input) {\"use strict\";\n var writer = @getByIdDirectPrivate(this, \"writer\");\n if (!writer) {\n var length = @toLength(input\?.length \?\? 0);\n writer = Bun.stdout.writer({ highWaterMark: length > 65536 \? length : 65536 }), @putByIdDirectPrivate(this, \"writer\", writer);\n }\n var wrote = writer.write(input);\n const count = @argumentCount();\n for (var i = 1;i < count; i++)\n wrote += writer.write(arguments[i]);\n return writer.flush(!0), wrote;\n})\n"; - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast(vm.clientData); \ - return clientData->builtinFunctions().consoleObjectBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().consoleObjectBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_CONSOLEOBJECT_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - -/* CountQueuingStrategy.ts */ -// highWaterMark -const JSC::ConstructAbility s_countQueuingStrategyHighWaterMarkCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_countQueuingStrategyHighWaterMarkCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_countQueuingStrategyHighWaterMarkCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_countQueuingStrategyHighWaterMarkCodeLength = 264; -static const JSC::Intrinsic s_countQueuingStrategyHighWaterMarkCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_countQueuingStrategyHighWaterMarkCode = "(function () {\"use strict\";\n const highWaterMark = @getByIdDirectPrivate(this, \"highWaterMark\");\n if (highWaterMark === @undefined)\n @throwTypeError(\"CountQueuingStrategy.highWaterMark getter called on incompatible |this| value.\");\n return highWaterMark;\n})\n"; - -// initializeCountQueuingStrategy -const JSC::ConstructAbility s_countQueuingStrategyInitializeCountQueuingStrategyCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_countQueuingStrategyInitializeCountQueuingStrategyCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_countQueuingStrategyInitializeCountQueuingStrategyCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_countQueuingStrategyInitializeCountQueuingStrategyCodeLength = 147; -static const JSC::Intrinsic s_countQueuingStrategyInitializeCountQueuingStrategyCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_countQueuingStrategyInitializeCountQueuingStrategyCode = "(function (parameters) {\"use strict\";\n @putByIdDirectPrivate(this, \"highWaterMark\", @extractHighWaterMarkFromQueuingStrategyInit(parameters));\n})\n"; - -// size -const JSC::ConstructAbility s_countQueuingStrategySizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_countQueuingStrategySizeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_countQueuingStrategySizeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_countQueuingStrategySizeCodeLength = 43; -static const JSC::Intrinsic s_countQueuingStrategySizeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_countQueuingStrategySizeCode = "(function () {\"use strict\";\n return 1;\n})\n"; - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast(vm.clientData); \ - return clientData->builtinFunctions().countQueuingStrategyBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().countQueuingStrategyBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_COUNTQUEUINGSTRATEGY_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - -/* EventSource.ts */ -// getEventSource -const JSC::ConstructAbility s_eventSourceGetEventSourceCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_eventSourceGetEventSourceCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_eventSourceGetEventSourceCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_eventSourceGetEventSourceCodeLength = 12373; -static const JSC::Intrinsic s_eventSourceGetEventSourceCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_eventSourceGetEventSourceCode = "(function () {\"use strict\";\n\n class EventSource extends EventTarget {\n #url;\n #state;\n #onerror;\n #onmessage;\n #onopen;\n #is_tls = !1;\n #socket = null;\n #data_buffer = \"\";\n #send_buffer = \"\";\n #lastEventID = \"\";\n #reconnect = !0;\n #content_length = 0;\n #received_length = 0;\n #reconnection_time = 0;\n #reconnection_timer = null;\n static #ConnectNextTick(self) {\n self.#connect();\n }\n static #SendRequest(socket, url) {\n const self = socket.data, last_event_header = self.#lastEventID \? `Last-Event-ID: ${self.#lastEventID}\\r\\n` : \"\", request = `GET ${url.pathname}${url.search} HTTP/1.1\\r\\nHost: bun\\r\\nContent-type: text/event-stream\\r\\nContent-length: 0\\r\\n${last_event_header}\\r\\n`, sended = socket.write(request);\n if (sended !== request.length)\n self.#send_buffer = request.substring(sended);\n }\n static #ProcessChunk(self, chunks, offset) {\n for (;; ) {\n if (offset >= chunks.length)\n return;\n let chunk_end_idx = -1, start_idx = chunks.indexOf(\"\\r\\n\", offset);\n const chunk_start_idx = start_idx + 2;\n if (start_idx > 0)\n if (self.#content_length === 0) {\n const chunk_size = parseInt(chunks.substring(offset, start_idx), 16);\n if (chunk_size === 0) {\n self.#state = 2, self.#socket\?.end();\n return;\n }\n chunk_end_idx = chunk_start_idx + chunk_size;\n } else\n chunk_end_idx = chunks.length;\n else {\n if (self.#data_buffer.length === 0) {\n self.#data_buffer += chunks.substring(offset);\n return;\n }\n chunk_end_idx = chunks.length;\n }\n let chunk = chunks.substring(chunk_start_idx, chunk_end_idx);\n offset = chunk_end_idx + 2;\n let chunk_offset = 0, event_idx = chunk.indexOf(\"\\n\\n\");\n if (event_idx == -1) {\n self.#data_buffer += chunks.substring(chunk_start_idx);\n return;\n }\n if (self.#data_buffer.length)\n self.#data_buffer += chunk, chunk = self.#data_buffer, self.#data_buffer = \"\";\n let more_events = !0;\n while (more_events) {\n const event_data = chunk.substring(chunk_offset, event_idx);\n let type, data = \"\", id, event_line_idx = 0, retry = -1;\n for (;; ) {\n let idx = event_data.indexOf(\"\\n\", event_line_idx);\n if (idx === -1) {\n if (event_line_idx >= event_data.length)\n break;\n idx = event_data.length;\n }\n const line = event_data.substring(event_line_idx, idx);\n if (line.startsWith(\"data:\"))\n if (data.length)\n data += `\\n${line.substring(5).trim()}`;\n else\n data = line.substring(5).trim();\n else if (line.startsWith(\"event:\"))\n type = line.substring(6).trim();\n else if (line.startsWith(\"id:\"))\n id = line.substring(3).trim();\n else if (line.startsWith(\"retry:\")) {\n if (retry = parseInt(line.substring(6).trim(), 10), retry !== retry)\n retry = -1;\n }\n event_line_idx = idx + 1;\n }\n if (self.#lastEventID = id || \"\", retry >= 0)\n self.#reconnection_time = retry;\n if (data || id || type)\n self.dispatchEvent(new MessageEvent(type || \"message\", {\n data: data || \"\",\n origin: self.#url.origin,\n source: self,\n lastEventId: id\n }));\n if (chunk.length === event_idx + 2) {\n more_events = !1;\n break;\n }\n const next_event_idx = chunk.indexOf(\"\\n\\n\", event_idx + 1);\n if (next_event_idx === -1)\n break;\n chunk_offset = event_idx, event_idx = next_event_idx;\n }\n }\n }\n static #Handlers = {\n open(socket) {\n const self = socket.data;\n if (self.#socket = socket, !self.#is_tls)\n EventSource.#SendRequest(socket, self.#url);\n },\n handshake(socket, success, verifyError) {\n const self = socket.data;\n if (success)\n EventSource.#SendRequest(socket, self.#url);\n else\n self.#state = 2, self.dispatchEvent(new ErrorEvent(\"error\", { error: verifyError })), socket.end();\n },\n data(socket, buffer) {\n const self = socket.data;\n switch (self.#state) {\n case 0: {\n let text = buffer.toString();\n const headers_idx = text.indexOf(\"\\r\\n\\r\\n\");\n if (headers_idx === -1) {\n self.#data_buffer += text;\n return;\n }\n if (self.#data_buffer.length)\n self.#data_buffer += text, text = self.#data_buffer, self.#data_buffer = \"\";\n const headers = text.substring(0, headers_idx), status_idx = headers.indexOf(\"\\r\\n\");\n if (status_idx === -1) {\n self.#state = 2, self.dispatchEvent(new ErrorEvent(\"error\", { error: new Error(\"Invalid HTTP request\") })), socket.end();\n return;\n }\n const status = headers.substring(0, status_idx);\n if (status !== \"HTTP/1.1 200 OK\") {\n self.#state = 2, self.dispatchEvent(new ErrorEvent(\"error\", { error: new Error(status) })), socket.end();\n return;\n }\n let start_idx = status_idx + 1, mime_type_ok = !1, content_length = -1;\n for (;; ) {\n let header_idx = headers.indexOf(\"\\r\\n\", start_idx);\n if (header_idx === -1) {\n if (start_idx >= headers.length) {\n if (!mime_type_ok)\n self.#state = 2, self.dispatchEvent(new ErrorEvent(\"error\", {\n error: new Error(`EventSource's response has no MIME type and \"text/event-stream\" is required. Aborting the connection.`)\n })), socket.end();\n return;\n }\n header_idx = headers.length;\n }\n const header = headers.substring(start_idx + 1, header_idx), header_name_idx = header.indexOf(\":\"), header_name = header.substring(0, header_name_idx), is_content_type = header_name.localeCompare(\"content-type\", @undefined, { sensitivity: \"accent\" }) === 0;\n if (start_idx = header_idx + 1, is_content_type)\n if (header.endsWith(\" text/event-stream\"))\n mime_type_ok = !0;\n else {\n self.#state = 2, self.dispatchEvent(new ErrorEvent(\"error\", {\n error: new Error(`EventSource's response has a MIME type that is not \"text/event-stream\". Aborting the connection.`)\n })), socket.end();\n return;\n }\n else if (header_name.localeCompare(\"content-length\", @undefined, { sensitivity: \"accent\" }) === 0) {\n if (content_length = parseInt(header.substring(header_name_idx + 1).trim(), 10), content_length !== content_length || content_length <= 0) {\n self.dispatchEvent(new ErrorEvent(\"error\", {\n error: new Error(\"EventSource's Content-Length is invalid. Aborting the connection.\")\n })), socket.end();\n return;\n }\n if (mime_type_ok)\n break;\n } else if (header_name.localeCompare(\"transfer-encoding\", @undefined, { sensitivity: \"accent\" }) === 0) {\n if (header.substring(header_name_idx + 1).trim() !== \"chunked\") {\n self.dispatchEvent(new ErrorEvent(\"error\", {\n error: new Error(\"EventSource's Transfer-Encoding is invalid. Aborting the connection.\")\n })), socket.end();\n return;\n }\n if (content_length = 0, mime_type_ok)\n break;\n }\n }\n self.#content_length = content_length, self.#state = 1, self.dispatchEvent(new Event(\"open\"));\n const chunks = text.substring(headers_idx + 4);\n if (EventSource.#ProcessChunk(self, chunks, 0), self.#content_length > 0) {\n if (self.#received_length += chunks.length, self.#received_length >= self.#content_length)\n self.#state = 2, socket.end();\n }\n return;\n }\n case 1:\n if (EventSource.#ProcessChunk(self, buffer.toString(), 2), self.#content_length > 0) {\n if (self.#received_length += buffer.byteLength, self.#received_length >= self.#content_length)\n self.#state = 2, socket.end();\n }\n return;\n default:\n break;\n }\n },\n drain(socket) {\n const self = socket.data;\n if (self.#state === 0) {\n const request = self.#data_buffer;\n if (request.length) {\n const sended = socket.write(request);\n if (sended !== request.length)\n socket.data.#send_buffer = request.substring(sended);\n else\n socket.data.#send_buffer = \"\";\n }\n }\n },\n close: EventSource.#Close,\n end(socket) {\n EventSource.#Close(socket).dispatchEvent(new ErrorEvent(\"error\", { error: new Error(\"Connection closed by server\") }));\n },\n timeout(socket) {\n EventSource.#Close(socket).dispatchEvent(new ErrorEvent(\"error\", { error: new Error(\"Timeout\") }));\n },\n binaryType: \"buffer\"\n };\n static #Close(socket) {\n const self = socket.data;\n if (self.#socket = null, self.#received_length = 0, self.#state = 2, self.#reconnect) {\n if (self.#reconnection_timer)\n clearTimeout(self.#reconnection_timer);\n self.#reconnection_timer = setTimeout(EventSource.#ConnectNextTick, self.#reconnection_time, self);\n }\n return self;\n }\n constructor(url, options = @undefined) {\n super();\n const uri = new URL(url);\n this.#is_tls = uri.protocol === \"https:\", this.#url = uri, this.#state = 2, process.nextTick(EventSource.#ConnectNextTick, this);\n }\n ref() {\n this.#reconnection_timer\?.ref(), this.#socket\?.ref();\n }\n unref() {\n this.#reconnection_timer\?.unref(), this.#socket\?.unref();\n }\n #connect() {\n if (this.#state !== 2)\n return;\n const uri = this.#url, is_tls = this.#is_tls;\n this.#state = 0, Bun.connect({\n data: this,\n socket: EventSource.#Handlers,\n hostname: uri.hostname,\n port: parseInt(uri.port || (is_tls \? \"443\" : \"80\"), 10),\n tls: is_tls \? {\n requestCert: !0,\n rejectUnauthorized: !1\n } : !1\n }).catch((err) => {\n if (super.dispatchEvent(new ErrorEvent(\"error\", { error: err })), this.#reconnect) {\n if (this.#reconnection_timer)\n this.#reconnection_timer.unref\?.();\n this.#reconnection_timer = setTimeout(EventSource.#ConnectNextTick, 1000, this);\n }\n });\n }\n get url() {\n return this.#url.href;\n }\n get readyState() {\n return this.#state;\n }\n close() {\n this.#reconnect = !1, this.#state = 2, this.#socket\?.unref(), this.#socket\?.end();\n }\n get onopen() {\n return this.#onopen;\n }\n get onerror() {\n return this.#onerror;\n }\n get onmessage() {\n return this.#onmessage;\n }\n set onopen(cb) {\n if (this.#onopen)\n super.removeEventListener(\"close\", this.#onopen);\n super.addEventListener(\"open\", cb), this.#onopen = cb;\n }\n set onerror(cb) {\n if (this.#onerror)\n super.removeEventListener(\"error\", this.#onerror);\n super.addEventListener(\"error\", cb), this.#onerror = cb;\n }\n set onmessage(cb) {\n if (this.#onmessage)\n super.removeEventListener(\"message\", this.#onmessage);\n super.addEventListener(\"message\", cb), this.#onmessage = cb;\n }\n }\n return Object.defineProperty(EventSource.prototype, \"CONNECTING\", {\n enumerable: !0,\n value: 0\n }), Object.defineProperty(EventSource.prototype, \"OPEN\", {\n enumerable: !0,\n value: 1\n }), Object.defineProperty(EventSource.prototype, \"CLOSED\", {\n enumerable: !0,\n value: 2\n }), EventSource;\n})\n"; - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast(vm.clientData); \ - return clientData->builtinFunctions().eventSourceBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().eventSourceBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_EVENTSOURCE_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - -/* ImportMetaObject.ts */ -// createRequireCache -const JSC::ConstructAbility s_importMetaObjectCreateRequireCacheCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_importMetaObjectCreateRequireCacheCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_importMetaObjectCreateRequireCacheCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_importMetaObjectCreateRequireCacheCodeLength = 1353; -static const JSC::Intrinsic s_importMetaObjectCreateRequireCacheCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_importMetaObjectCreateRequireCacheCode = "(function () {\"use strict\";\n var moduleMap = new Map, inner = {};\n return new Proxy(inner, {\n get(target, key) {\n const entry = @requireMap.@get(key);\n if (entry)\n return entry;\n const esm = @Loader.registry.@get(key);\n if (esm\?.evaluated) {\n const namespace = @Loader.getModuleNamespaceObject(esm.module), mod = @createCommonJSModule(key, namespace, !0, @undefined);\n return @requireMap.@set(key, mod), mod;\n }\n return inner[key];\n },\n set(target, key, value) {\n return @requireMap.@set(key, value), !0;\n },\n has(target, key) {\n return @requireMap.@has(key) || Boolean(@Loader.registry.@get(key)\?.evaluated);\n },\n deleteProperty(target, key) {\n return moduleMap.@delete(key), @requireMap.@delete(key), @Loader.registry.@delete(key), !0;\n },\n ownKeys(target) {\n var array = [...@requireMap.@keys()];\n for (let key of @Loader.registry.@keys())\n if (!array.includes(key) && @Loader.registry.@get(key)\?.evaluated)\n @arrayPush(array, key);\n return array;\n },\n getPrototypeOf(target) {\n return null;\n },\n getOwnPropertyDescriptor(target, key) {\n if (@requireMap.@has(key) || @Loader.registry.@get(key)\?.evaluated)\n return {\n configurable: !0,\n enumerable: !0\n };\n }\n });\n})\n"; - -// internalRequire -const JSC::ConstructAbility s_importMetaObjectInternalRequireCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_importMetaObjectInternalRequireCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_importMetaObjectInternalRequireCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_importMetaObjectInternalRequireCodeLength = 1058; -static const JSC::Intrinsic s_importMetaObjectInternalRequireCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_importMetaObjectInternalRequireCode = "(function (id) {\"use strict\";\n var cached = @requireMap.@get(id);\n const last5 = id.substring(id.length - 5);\n if (cached)\n return cached.exports;\n if (last5 === \".json\") {\n var fs = globalThis[Symbol.for(\"_fs\")] ||= Bun.fs(), exports = JSON.parse(fs.readFileSync(id, \"utf8\"));\n return @requireMap.@set(id, @createCommonJSModule(id, exports, !0, @undefined)), exports;\n } else if (last5 === \".node\") {\n const module = @createCommonJSModule(id, {}, !0, @undefined);\n return process.dlopen(module, id), @requireMap.@set(id, module), module.exports;\n } else if (last5 === \".toml\") {\n var fs = globalThis[Symbol.for(\"_fs\")] ||= Bun.fs(), exports = Bun.TOML.parse(fs.readFileSync(id, \"utf8\"));\n return @requireMap.@set(id, @createCommonJSModule(id, exports, !0, @undefined)), exports;\n } else {\n var exports = @requireESM(id);\n const cachedModule = @requireMap.@get(id);\n if (cachedModule)\n return cachedModule.exports;\n return @requireMap.@set(id, @createCommonJSModule(id, exports, !0, @undefined)), exports;\n }\n})\n"; - -// loadCJS2ESM -const JSC::ConstructAbility s_importMetaObjectLoadCJS2ESMCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_importMetaObjectLoadCJS2ESMCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_importMetaObjectLoadCJS2ESMCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_importMetaObjectLoadCJS2ESMCodeLength = 2569; -static const JSC::Intrinsic s_importMetaObjectLoadCJS2ESMCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_importMetaObjectLoadCJS2ESMCode = "(function (resolvedSpecifier) {\"use strict\";\n var loader = @Loader, queue = @createFIFO(), key = resolvedSpecifier;\n while (key) {\n var entry = loader.registry.@get(key);\n if ((entry\?.state \?\? 0) <= @ModuleFetch)\n @fulfillModuleSync(key), entry = loader.registry.@get(key);\n var sourceCodeObject = @getPromiseInternalField(entry.fetch, @promiseFieldReactionsOrResult), moduleRecordPromise = loader.parseModule(key, sourceCodeObject), mod = entry.module;\n if (moduleRecordPromise && @isPromise(moduleRecordPromise)) {\n var reactionsOrResult = @getPromiseInternalField(moduleRecordPromise, @promiseFieldReactionsOrResult), flags = @getPromiseInternalField(moduleRecordPromise, @promiseFieldFlags), state = flags & @promiseStateMask;\n if (state === @promiseStatePending || reactionsOrResult && @isPromise(reactionsOrResult))\n @throwTypeError(`require() async module \"${key}\" is unsupported. use \"await import()\" instead.`);\n else if (state === @promiseStateRejected) {\n if (!reactionsOrResult\?.message)\n @throwTypeError(`${reactionsOrResult + \"\" \? reactionsOrResult : \"An error occurred\"} occurred while parsing module \\\"${key}\\\"`);\n throw reactionsOrResult;\n }\n entry.module = mod = reactionsOrResult;\n } else if (moduleRecordPromise && !mod)\n entry.module = mod = moduleRecordPromise;\n @setStateToMax(entry, @ModuleLink);\n var dependenciesMap = mod.dependenciesMap, requestedModules = loader.requestedModules(mod), dependencies = @newArrayWithSize(requestedModules.length);\n for (var i = 0, length = requestedModules.length;i < length; ++i) {\n var depName = requestedModules[i], depKey = depName[0] === \"/\" \? depName : loader.resolve(depName, key), depEntry = loader.ensureRegistered(depKey);\n if (depEntry.state < @ModuleLink)\n queue.push(depKey);\n @putByValDirect(dependencies, i, depEntry), dependenciesMap.@set(depName, depEntry);\n }\n entry.dependencies = dependencies, entry.instantiate = @Promise.@resolve(entry), entry.satisfy = @Promise.@resolve(entry), entry.isSatisfied = !0, key = queue.shift();\n while (key && (loader.registry.@get(key)\?.state \?\? @ModuleFetch) >= @ModuleLink)\n key = queue.shift();\n }\n var linkAndEvaluateResult = loader.linkAndEvaluateModule(resolvedSpecifier, @undefined);\n if (linkAndEvaluateResult && @isPromise(linkAndEvaluateResult))\n @throwTypeError(`require() async module \\\"${resolvedSpecifier}\\\" is unsupported. use \"await import()\" instead.`);\n return loader.registry.@get(resolvedSpecifier);\n})\n"; - -// main -const JSC::ConstructAbility s_importMetaObjectMainCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_importMetaObjectMainCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_importMetaObjectMainCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_importMetaObjectMainCodeLength = 84; -static const JSC::Intrinsic s_importMetaObjectMainCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_importMetaObjectMainCode = "(function () {\"use strict\";\n return this.path === Bun.main && Bun.isMainThread;\n})\n"; - -// requireESM -const JSC::ConstructAbility s_importMetaObjectRequireESMCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_importMetaObjectRequireESMCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_importMetaObjectRequireESMCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_importMetaObjectRequireESMCodeLength = 406; -static const JSC::Intrinsic s_importMetaObjectRequireESMCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_importMetaObjectRequireESMCode = "(function (resolved) {\"use strict\";\n var entry = @Loader.registry.@get(resolved);\n if (!entry || !entry.evaluated)\n entry = @loadCJS2ESM(resolved);\n if (!entry || !entry.evaluated || !entry.module)\n @throwTypeError(`require() failed to evaluate module \"${resolved}\". This is an internal consistentency error.`);\n var exports = @Loader.getModuleNamespaceObject(entry.module);\n return exports;\n})\n"; - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast(vm.clientData); \ - return clientData->builtinFunctions().importMetaObjectBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().importMetaObjectBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_IMPORTMETAOBJECT_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - -/* JSBufferConstructor.ts */ -// from -const JSC::ConstructAbility s_jsBufferConstructorFromCodeConstructAbility = JSC::ConstructAbility::CanConstruct; -const JSC::ConstructorKind s_jsBufferConstructorFromCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferConstructorFromCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferConstructorFromCodeLength = 1538; -static const JSC::Intrinsic s_jsBufferConstructorFromCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferConstructorFromCode = "(function (items) {\"use strict\";\n if (@isUndefinedOrNull(items))\n @throwTypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object.\");\n if (typeof items === \"string\" || typeof items === \"object\" && (@isTypedArrayView(items) || items instanceof @ArrayBuffer || items instanceof SharedArrayBuffer || items instanceof @String))\n switch (@argumentCount()) {\n case 1:\n return new @Buffer(items);\n case 2:\n return new @Buffer(items, @argument(1));\n default:\n return new @Buffer(items, @argument(1), @argument(2));\n }\n var arrayLike = @toObject(items, \"The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object.\");\n if (!@isJSArray(arrayLike)) {\n const toPrimitive = @tryGetByIdWithWellKnownSymbol(items, \"toPrimitive\");\n if (toPrimitive) {\n const primitive = toPrimitive.@call(items, \"string\");\n if (typeof primitive === \"string\")\n switch (@argumentCount()) {\n case 1:\n return new @Buffer(primitive);\n case 2:\n return new @Buffer(primitive, @argument(1));\n default:\n return new @Buffer(primitive, @argument(1), @argument(2));\n }\n }\n if (!(\"length\" in arrayLike) || @isCallable(arrayLike))\n @throwTypeError(\"The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object.\");\n }\n return new @Buffer(@Uint8Array.from(arrayLike).buffer);\n})\n"; - -// isBuffer -const JSC::ConstructAbility s_jsBufferConstructorIsBufferCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferConstructorIsBufferCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferConstructorIsBufferCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferConstructorIsBufferCodeLength = 81; -static const JSC::Intrinsic s_jsBufferConstructorIsBufferCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferConstructorIsBufferCode = "(function (bufferlike) {\"use strict\";\n return bufferlike instanceof @Buffer;\n})\n"; - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast(vm.clientData); \ - return clientData->builtinFunctions().jsBufferConstructorBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().jsBufferConstructorBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_JSBUFFERCONSTRUCTOR_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - -/* JSBufferPrototype.ts */ -// asciiSlice -const JSC::ConstructAbility s_jsBufferPrototypeAsciiSliceCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeAsciiSliceCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeAsciiSliceCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeAsciiSliceCodeLength = 86; -static const JSC::Intrinsic s_jsBufferPrototypeAsciiSliceCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeAsciiSliceCode = "(function (start, end) {\"use strict\";\n return this.toString(\"ascii\", start, end);\n})\n"; - -// asciiWrite -const JSC::ConstructAbility s_jsBufferPrototypeAsciiWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeAsciiWriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeAsciiWriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeAsciiWriteCodeLength = 103; -static const JSC::Intrinsic s_jsBufferPrototypeAsciiWriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeAsciiWriteCode = "(function (text, offset, length) {\"use strict\";\n return this.write(text, offset, length, \"ascii\");\n})\n"; - -// base64Slice -const JSC::ConstructAbility s_jsBufferPrototypeBase64SliceCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeBase64SliceCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeBase64SliceCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeBase64SliceCodeLength = 87; -static const JSC::Intrinsic s_jsBufferPrototypeBase64SliceCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeBase64SliceCode = "(function (start, end) {\"use strict\";\n return this.toString(\"base64\", start, end);\n})\n"; - -// base64urlSlice -const JSC::ConstructAbility s_jsBufferPrototypeBase64urlSliceCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeBase64urlSliceCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeBase64urlSliceCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeBase64urlSliceCodeLength = 90; -static const JSC::Intrinsic s_jsBufferPrototypeBase64urlSliceCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeBase64urlSliceCode = "(function (start, end) {\"use strict\";\n return this.toString(\"base64url\", start, end);\n})\n"; - -// base64urlWrite -const JSC::ConstructAbility s_jsBufferPrototypeBase64urlWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeBase64urlWriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeBase64urlWriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeBase64urlWriteCodeLength = 107; -static const JSC::Intrinsic s_jsBufferPrototypeBase64urlWriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeBase64urlWriteCode = "(function (text, offset, length) {\"use strict\";\n return this.write(text, offset, length, \"base64url\");\n})\n"; - -// base64Write -const JSC::ConstructAbility s_jsBufferPrototypeBase64WriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeBase64WriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeBase64WriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeBase64WriteCodeLength = 104; -static const JSC::Intrinsic s_jsBufferPrototypeBase64WriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeBase64WriteCode = "(function (text, offset, length) {\"use strict\";\n return this.write(text, offset, length, \"base64\");\n})\n"; - -// hexSlice -const JSC::ConstructAbility s_jsBufferPrototypeHexSliceCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeHexSliceCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeHexSliceCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeHexSliceCodeLength = 84; -static const JSC::Intrinsic s_jsBufferPrototypeHexSliceCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeHexSliceCode = "(function (start, end) {\"use strict\";\n return this.toString(\"hex\", start, end);\n})\n"; - -// hexWrite -const JSC::ConstructAbility s_jsBufferPrototypeHexWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeHexWriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeHexWriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeHexWriteCodeLength = 101; -static const JSC::Intrinsic s_jsBufferPrototypeHexWriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeHexWriteCode = "(function (text, offset, length) {\"use strict\";\n return this.write(text, offset, length, \"hex\");\n})\n"; - -// inspect -const JSC::ConstructAbility s_jsBufferPrototypeInspectCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeInspectCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeInspectCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeInspectCodeLength = 76; -static const JSC::Intrinsic s_jsBufferPrototypeInspectCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeInspectCode = "(function (recurseTimes, ctx) {\"use strict\";\n return Bun.inspect(this);\n})\n"; - -// latin1Slice -const JSC::ConstructAbility s_jsBufferPrototypeLatin1SliceCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeLatin1SliceCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeLatin1SliceCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeLatin1SliceCodeLength = 87; -static const JSC::Intrinsic s_jsBufferPrototypeLatin1SliceCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeLatin1SliceCode = "(function (start, end) {\"use strict\";\n return this.toString(\"latin1\", start, end);\n})\n"; - -// latin1Write -const JSC::ConstructAbility s_jsBufferPrototypeLatin1WriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeLatin1WriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeLatin1WriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeLatin1WriteCodeLength = 104; -static const JSC::Intrinsic s_jsBufferPrototypeLatin1WriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeLatin1WriteCode = "(function (text, offset, length) {\"use strict\";\n return this.write(text, offset, length, \"latin1\");\n})\n"; - -// offset -const JSC::ConstructAbility s_jsBufferPrototypeOffsetCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeOffsetCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeOffsetCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeOffsetCodeLength = 115; -static const JSC::Intrinsic s_jsBufferPrototypeOffsetCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeOffsetCode = "(function () {\"use strict\";\n return @isObject(this) && this instanceof @Buffer \? this.byteOffset : @undefined;\n})\n"; - -// parent -const JSC::ConstructAbility s_jsBufferPrototypeParentCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeParentCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeParentCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeParentCodeLength = 111; -static const JSC::Intrinsic s_jsBufferPrototypeParentCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeParentCode = "(function () {\"use strict\";\n return @isObject(this) && this instanceof @Buffer \? this.buffer : @undefined;\n})\n"; - -// readBigInt64BE -const JSC::ConstructAbility s_jsBufferPrototypeReadBigInt64BECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadBigInt64BECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadBigInt64BECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadBigInt64BECodeLength = 152; -static const JSC::Intrinsic s_jsBufferPrototypeReadBigInt64BECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadBigInt64BECode = "(function (offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getBigInt64(offset, !1);\n})\n"; - -// readBigInt64LE -const JSC::ConstructAbility s_jsBufferPrototypeReadBigInt64LECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadBigInt64LECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadBigInt64LECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadBigInt64LECodeLength = 152; -static const JSC::Intrinsic s_jsBufferPrototypeReadBigInt64LECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadBigInt64LECode = "(function (offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getBigInt64(offset, !0);\n})\n"; - -// readBigUInt64BE -const JSC::ConstructAbility s_jsBufferPrototypeReadBigUInt64BECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadBigUInt64BECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadBigUInt64BECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadBigUInt64BECodeLength = 153; -static const JSC::Intrinsic s_jsBufferPrototypeReadBigUInt64BECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadBigUInt64BECode = "(function (offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getBigUint64(offset, !1);\n})\n"; - -// readBigUInt64LE -const JSC::ConstructAbility s_jsBufferPrototypeReadBigUInt64LECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadBigUInt64LECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadBigUInt64LECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadBigUInt64LECodeLength = 153; -static const JSC::Intrinsic s_jsBufferPrototypeReadBigUInt64LECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadBigUInt64LECode = "(function (offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getBigUint64(offset, !0);\n})\n"; - -// readDoubleBE -const JSC::ConstructAbility s_jsBufferPrototypeReadDoubleBECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadDoubleBECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadDoubleBECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadDoubleBECodeLength = 151; -static const JSC::Intrinsic s_jsBufferPrototypeReadDoubleBECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadDoubleBECode = "(function (offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getFloat64(offset, !1);\n})\n"; - -// readDoubleLE -const JSC::ConstructAbility s_jsBufferPrototypeReadDoubleLECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadDoubleLECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadDoubleLECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadDoubleLECodeLength = 151; -static const JSC::Intrinsic s_jsBufferPrototypeReadDoubleLECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadDoubleLECode = "(function (offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getFloat64(offset, !0);\n})\n"; - -// readFloatBE -const JSC::ConstructAbility s_jsBufferPrototypeReadFloatBECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadFloatBECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadFloatBECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadFloatBECodeLength = 151; -static const JSC::Intrinsic s_jsBufferPrototypeReadFloatBECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadFloatBECode = "(function (offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getFloat32(offset, !1);\n})\n"; - -// readFloatLE -const JSC::ConstructAbility s_jsBufferPrototypeReadFloatLECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadFloatLECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadFloatLECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadFloatLECodeLength = 151; -static const JSC::Intrinsic s_jsBufferPrototypeReadFloatLECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadFloatLECode = "(function (offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getFloat32(offset, !0);\n})\n"; - -// readInt16BE -const JSC::ConstructAbility s_jsBufferPrototypeReadInt16BECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadInt16BECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadInt16BECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadInt16BECodeLength = 149; -static const JSC::Intrinsic s_jsBufferPrototypeReadInt16BECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadInt16BECode = "(function (offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getInt16(offset, !1);\n})\n"; - -// readInt16LE -const JSC::ConstructAbility s_jsBufferPrototypeReadInt16LECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadInt16LECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadInt16LECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadInt16LECodeLength = 149; -static const JSC::Intrinsic s_jsBufferPrototypeReadInt16LECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadInt16LECode = "(function (offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getInt16(offset, !0);\n})\n"; - -// readInt32BE -const JSC::ConstructAbility s_jsBufferPrototypeReadInt32BECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadInt32BECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadInt32BECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadInt32BECodeLength = 149; -static const JSC::Intrinsic s_jsBufferPrototypeReadInt32BECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadInt32BECode = "(function (offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getInt32(offset, !1);\n})\n"; - -// readInt32LE -const JSC::ConstructAbility s_jsBufferPrototypeReadInt32LECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadInt32LECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadInt32LECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadInt32LECodeLength = 149; -static const JSC::Intrinsic s_jsBufferPrototypeReadInt32LECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadInt32LECode = "(function (offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getInt32(offset, !0);\n})\n"; - -// readInt8 -const JSC::ConstructAbility s_jsBufferPrototypeReadInt8CodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadInt8CodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadInt8CodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadInt8CodeLength = 144; -static const JSC::Intrinsic s_jsBufferPrototypeReadInt8CodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadInt8Code = "(function (offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getInt8(offset);\n})\n"; - -// readIntBE -const JSC::ConstructAbility s_jsBufferPrototypeReadIntBECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadIntBECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadIntBECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadIntBECodeLength = 838; -static const JSC::Intrinsic s_jsBufferPrototypeReadIntBECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadIntBECode = "(function (offset, byteLength) {\"use strict\";\n const view = this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength);\n switch (byteLength) {\n case 1:\n return view.getInt8(offset);\n case 2:\n return view.getInt16(offset, !1);\n case 3: {\n const val = view.getUint16(offset + 1, !1) + view.getUint8(offset) * 65536;\n return val | (val & 8388608) * 510;\n }\n case 4:\n return view.getInt32(offset, !1);\n case 5: {\n const last = view.getUint8(offset);\n return (last | (last & 128) * 33554430) * 4294967296 + view.getUint32(offset + 1, !1);\n }\n case 6: {\n const last = view.getUint16(offset, !1);\n return (last | (last & 32768) * 131070) * 4294967296 + view.getUint32(offset + 2, !1);\n }\n }\n @throwRangeError(\"byteLength must be >= 1 and <= 6\");\n})\n"; - -// readIntLE -const JSC::ConstructAbility s_jsBufferPrototypeReadIntLECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadIntLECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadIntLECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadIntLECodeLength = 838; -static const JSC::Intrinsic s_jsBufferPrototypeReadIntLECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadIntLECode = "(function (offset, byteLength) {\"use strict\";\n const view = this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength);\n switch (byteLength) {\n case 1:\n return view.getInt8(offset);\n case 2:\n return view.getInt16(offset, !0);\n case 3: {\n const val = view.getUint16(offset, !0) + view.getUint8(offset + 2) * 65536;\n return val | (val & 8388608) * 510;\n }\n case 4:\n return view.getInt32(offset, !0);\n case 5: {\n const last = view.getUint8(offset + 4);\n return (last | (last & 128) * 33554430) * 4294967296 + view.getUint32(offset, !0);\n }\n case 6: {\n const last = view.getUint16(offset + 4, !0);\n return (last | (last & 32768) * 131070) * 4294967296 + view.getUint32(offset, !0);\n }\n }\n @throwRangeError(\"byteLength must be >= 1 and <= 6\");\n})\n"; - -// readUInt16BE -const JSC::ConstructAbility s_jsBufferPrototypeReadUInt16BECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadUInt16BECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadUInt16BECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadUInt16BECodeLength = 150; -static const JSC::Intrinsic s_jsBufferPrototypeReadUInt16BECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadUInt16BECode = "(function (offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getUint16(offset, !1);\n})\n"; - -// readUInt16LE -const JSC::ConstructAbility s_jsBufferPrototypeReadUInt16LECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadUInt16LECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadUInt16LECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadUInt16LECodeLength = 150; -static const JSC::Intrinsic s_jsBufferPrototypeReadUInt16LECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadUInt16LECode = "(function (offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getUint16(offset, !0);\n})\n"; - -// readUInt32BE -const JSC::ConstructAbility s_jsBufferPrototypeReadUInt32BECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadUInt32BECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadUInt32BECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadUInt32BECodeLength = 150; -static const JSC::Intrinsic s_jsBufferPrototypeReadUInt32BECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadUInt32BECode = "(function (offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getUint32(offset, !1);\n})\n"; - -// readUInt32LE -const JSC::ConstructAbility s_jsBufferPrototypeReadUInt32LECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadUInt32LECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadUInt32LECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadUInt32LECodeLength = 150; -static const JSC::Intrinsic s_jsBufferPrototypeReadUInt32LECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadUInt32LECode = "(function (offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getUint32(offset, !0);\n})\n"; - -// readUInt8 -const JSC::ConstructAbility s_jsBufferPrototypeReadUInt8CodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadUInt8CodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadUInt8CodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadUInt8CodeLength = 145; -static const JSC::Intrinsic s_jsBufferPrototypeReadUInt8CodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadUInt8Code = "(function (offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getUint8(offset);\n})\n"; - -// readUIntBE -const JSC::ConstructAbility s_jsBufferPrototypeReadUIntBECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadUIntBECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadUIntBECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadUIntBECodeLength = 786; -static const JSC::Intrinsic s_jsBufferPrototypeReadUIntBECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadUIntBECode = "(function (offset, byteLength) {\"use strict\";\n const view = this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength);\n switch (byteLength) {\n case 1:\n return view.getUint8(offset);\n case 2:\n return view.getUint16(offset, !1);\n case 3:\n return view.getUint16(offset + 1, !1) + view.getUint8(offset) * 65536;\n case 4:\n return view.getUint32(offset, !1);\n case 5: {\n const last = view.getUint8(offset);\n return (last | (last & 128) * 33554430) * 4294967296 + view.getUint32(offset + 1, !1);\n }\n case 6: {\n const last = view.getUint16(offset, !1);\n return (last | (last & 32768) * 131070) * 4294967296 + view.getUint32(offset + 2, !1);\n }\n }\n @throwRangeError(\"byteLength must be >= 1 and <= 6\");\n})\n"; - -// readUIntLE -const JSC::ConstructAbility s_jsBufferPrototypeReadUIntLECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadUIntLECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadUIntLECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadUIntLECodeLength = 664; -static const JSC::Intrinsic s_jsBufferPrototypeReadUIntLECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadUIntLECode = "(function (offset, byteLength) {\"use strict\";\n const view = this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength);\n switch (byteLength) {\n case 1:\n return view.getUint8(offset);\n case 2:\n return view.getUint16(offset, !0);\n case 3:\n return view.getUint16(offset, !0) + view.getUint8(offset + 2) * 65536;\n case 4:\n return view.getUint32(offset, !0);\n case 5:\n return view.getUint8(offset + 4) * 4294967296 + view.getUint32(offset, !0);\n case 6:\n return view.getUint16(offset + 4, !0) * 4294967296 + view.getUint32(offset, !0);\n }\n @throwRangeError(\"byteLength must be >= 1 and <= 6\");\n})\n"; - -// setBigUint64 -const JSC::ConstructAbility s_jsBufferPrototypeSetBigUint64CodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeSetBigUint64CodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeSetBigUint64CodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeSetBigUint64CodeLength = 171; -static const JSC::Intrinsic s_jsBufferPrototypeSetBigUint64CodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeSetBigUint64Code = "(function (offset, value, le) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setBigUint64(offset, value, le);\n})\n"; - -// slice -const JSC::ConstructAbility s_jsBufferPrototypeSliceCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeSliceCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeSliceCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeSliceCodeLength = 564; -static const JSC::Intrinsic s_jsBufferPrototypeSliceCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeSliceCode = "(function (start, end) {\"use strict\";\n var { buffer, byteOffset, byteLength } = this;\n function adjustOffset(offset, length) {\n if (offset = @trunc(offset), offset === 0 || offset !== offset)\n return 0;\n else if (offset < 0)\n return offset += length, offset > 0 \? offset : 0;\n else\n return offset < length \? offset : length;\n }\n var start_ = adjustOffset(start, byteLength), end_ = end !== @undefined \? adjustOffset(end, byteLength) : byteLength;\n return new @Buffer(buffer, byteOffset + start_, end_ > start_ \? end_ - start_ : 0);\n})\n"; - -// toJSON -const JSC::ConstructAbility s_jsBufferPrototypeToJSONCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeToJSONCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeToJSONCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeToJSONCodeLength = 85; -static const JSC::Intrinsic s_jsBufferPrototypeToJSONCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeToJSONCode = "(function () {\"use strict\";\n return { type: \"Buffer\", data: @Array.from(this) };\n})\n"; - -// ucs2Slice -const JSC::ConstructAbility s_jsBufferPrototypeUcs2SliceCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeUcs2SliceCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeUcs2SliceCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeUcs2SliceCodeLength = 85; -static const JSC::Intrinsic s_jsBufferPrototypeUcs2SliceCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeUcs2SliceCode = "(function (start, end) {\"use strict\";\n return this.toString(\"ucs2\", start, end);\n})\n"; - -// ucs2Write -const JSC::ConstructAbility s_jsBufferPrototypeUcs2WriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeUcs2WriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeUcs2WriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeUcs2WriteCodeLength = 102; -static const JSC::Intrinsic s_jsBufferPrototypeUcs2WriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeUcs2WriteCode = "(function (text, offset, length) {\"use strict\";\n return this.write(text, offset, length, \"ucs2\");\n})\n"; - -// utf16leSlice -const JSC::ConstructAbility s_jsBufferPrototypeUtf16leSliceCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeUtf16leSliceCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeUtf16leSliceCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeUtf16leSliceCodeLength = 88; -static const JSC::Intrinsic s_jsBufferPrototypeUtf16leSliceCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeUtf16leSliceCode = "(function (start, end) {\"use strict\";\n return this.toString(\"utf16le\", start, end);\n})\n"; - -// utf16leWrite -const JSC::ConstructAbility s_jsBufferPrototypeUtf16leWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeUtf16leWriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeUtf16leWriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeUtf16leWriteCodeLength = 105; -static const JSC::Intrinsic s_jsBufferPrototypeUtf16leWriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeUtf16leWriteCode = "(function (text, offset, length) {\"use strict\";\n return this.write(text, offset, length, \"utf16le\");\n})\n"; - -// utf8Slice -const JSC::ConstructAbility s_jsBufferPrototypeUtf8SliceCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeUtf8SliceCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeUtf8SliceCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeUtf8SliceCodeLength = 85; -static const JSC::Intrinsic s_jsBufferPrototypeUtf8SliceCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeUtf8SliceCode = "(function (start, end) {\"use strict\";\n return this.toString(\"utf8\", start, end);\n})\n"; - -// utf8Write -const JSC::ConstructAbility s_jsBufferPrototypeUtf8WriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeUtf8WriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeUtf8WriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeUtf8WriteCodeLength = 102; -static const JSC::Intrinsic s_jsBufferPrototypeUtf8WriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeUtf8WriteCode = "(function (text, offset, length) {\"use strict\";\n return this.write(text, offset, length, \"utf8\");\n})\n"; - -// writeBigInt64BE -const JSC::ConstructAbility s_jsBufferPrototypeWriteBigInt64BECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteBigInt64BECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteBigInt64BECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteBigInt64BECodeLength = 178; -static const JSC::Intrinsic s_jsBufferPrototypeWriteBigInt64BECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteBigInt64BECode = "(function (value, offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setBigInt64(offset, value, !1), offset + 8;\n})\n"; - -// writeBigInt64LE -const JSC::ConstructAbility s_jsBufferPrototypeWriteBigInt64LECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteBigInt64LECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteBigInt64LECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteBigInt64LECodeLength = 178; -static const JSC::Intrinsic s_jsBufferPrototypeWriteBigInt64LECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteBigInt64LECode = "(function (value, offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setBigInt64(offset, value, !0), offset + 8;\n})\n"; - -// writeBigUInt64BE -const JSC::ConstructAbility s_jsBufferPrototypeWriteBigUInt64BECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteBigUInt64BECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteBigUInt64BECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteBigUInt64BECodeLength = 179; -static const JSC::Intrinsic s_jsBufferPrototypeWriteBigUInt64BECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteBigUInt64BECode = "(function (value, offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setBigUint64(offset, value, !1), offset + 8;\n})\n"; - -// writeBigUInt64LE -const JSC::ConstructAbility s_jsBufferPrototypeWriteBigUInt64LECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteBigUInt64LECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteBigUInt64LECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteBigUInt64LECodeLength = 179; -static const JSC::Intrinsic s_jsBufferPrototypeWriteBigUInt64LECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteBigUInt64LECode = "(function (value, offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setBigUint64(offset, value, !0), offset + 8;\n})\n"; - -// writeDoubleBE -const JSC::ConstructAbility s_jsBufferPrototypeWriteDoubleBECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteDoubleBECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteDoubleBECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteDoubleBECodeLength = 177; -static const JSC::Intrinsic s_jsBufferPrototypeWriteDoubleBECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteDoubleBECode = "(function (value, offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setFloat64(offset, value, !1), offset + 8;\n})\n"; - -// writeDoubleLE -const JSC::ConstructAbility s_jsBufferPrototypeWriteDoubleLECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteDoubleLECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteDoubleLECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteDoubleLECodeLength = 177; -static const JSC::Intrinsic s_jsBufferPrototypeWriteDoubleLECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteDoubleLECode = "(function (value, offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setFloat64(offset, value, !0), offset + 8;\n})\n"; - -// writeFloatBE -const JSC::ConstructAbility s_jsBufferPrototypeWriteFloatBECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteFloatBECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteFloatBECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteFloatBECodeLength = 177; -static const JSC::Intrinsic s_jsBufferPrototypeWriteFloatBECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteFloatBECode = "(function (value, offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setFloat32(offset, value, !1), offset + 4;\n})\n"; - -// writeFloatLE -const JSC::ConstructAbility s_jsBufferPrototypeWriteFloatLECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteFloatLECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteFloatLECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteFloatLECodeLength = 177; -static const JSC::Intrinsic s_jsBufferPrototypeWriteFloatLECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteFloatLECode = "(function (value, offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setFloat32(offset, value, !0), offset + 4;\n})\n"; - -// writeInt16BE -const JSC::ConstructAbility s_jsBufferPrototypeWriteInt16BECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteInt16BECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteInt16BECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteInt16BECodeLength = 175; -static const JSC::Intrinsic s_jsBufferPrototypeWriteInt16BECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteInt16BECode = "(function (value, offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setInt16(offset, value, !1), offset + 2;\n})\n"; - -// writeInt16LE -const JSC::ConstructAbility s_jsBufferPrototypeWriteInt16LECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteInt16LECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteInt16LECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteInt16LECodeLength = 175; -static const JSC::Intrinsic s_jsBufferPrototypeWriteInt16LECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteInt16LECode = "(function (value, offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setInt16(offset, value, !0), offset + 2;\n})\n"; - -// writeInt32BE -const JSC::ConstructAbility s_jsBufferPrototypeWriteInt32BECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteInt32BECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteInt32BECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteInt32BECodeLength = 175; -static const JSC::Intrinsic s_jsBufferPrototypeWriteInt32BECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteInt32BECode = "(function (value, offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setInt32(offset, value, !1), offset + 4;\n})\n"; - -// writeInt32LE -const JSC::ConstructAbility s_jsBufferPrototypeWriteInt32LECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteInt32LECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteInt32LECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteInt32LECodeLength = 175; -static const JSC::Intrinsic s_jsBufferPrototypeWriteInt32LECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteInt32LECode = "(function (value, offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setInt32(offset, value, !0), offset + 4;\n})\n"; - -// writeInt8 -const JSC::ConstructAbility s_jsBufferPrototypeWriteInt8CodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteInt8CodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteInt8CodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteInt8CodeLength = 170; -static const JSC::Intrinsic s_jsBufferPrototypeWriteInt8CodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteInt8Code = "(function (value, offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setInt8(offset, value), offset + 1;\n})\n"; - -// writeIntBE -const JSC::ConstructAbility s_jsBufferPrototypeWriteIntBECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteIntBECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteIntBECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteIntBECodeLength = 957; -static const JSC::Intrinsic s_jsBufferPrototypeWriteIntBECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteIntBECode = "(function (value, offset, byteLength) {\"use strict\";\n const view = this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength);\n switch (byteLength) {\n case 1: {\n view.setInt8(offset, value);\n break;\n }\n case 2: {\n view.setInt16(offset, value, !1);\n break;\n }\n case 3: {\n view.setUint16(offset + 1, value & 65535, !1), view.setInt8(offset, Math.floor(value * 0.0000152587890625));\n break;\n }\n case 4: {\n view.setInt32(offset, value, !1);\n break;\n }\n case 5: {\n view.setUint32(offset + 1, value | 0, !1), view.setInt8(offset, Math.floor(value * 0.00000000023283064365386964));\n break;\n }\n case 6: {\n view.setUint32(offset + 2, value | 0, !1), view.setInt16(offset, Math.floor(value * 0.00000000023283064365386964), !1);\n break;\n }\n default:\n @throwRangeError(\"byteLength must be >= 1 and <= 6\");\n }\n return offset + byteLength;\n})\n"; - -// writeIntLE -const JSC::ConstructAbility s_jsBufferPrototypeWriteIntLECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteIntLECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteIntLECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteIntLECodeLength = 957; -static const JSC::Intrinsic s_jsBufferPrototypeWriteIntLECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteIntLECode = "(function (value, offset, byteLength) {\"use strict\";\n const view = this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength);\n switch (byteLength) {\n case 1: {\n view.setInt8(offset, value);\n break;\n }\n case 2: {\n view.setInt16(offset, value, !0);\n break;\n }\n case 3: {\n view.setUint16(offset, value & 65535, !0), view.setInt8(offset + 2, Math.floor(value * 0.0000152587890625));\n break;\n }\n case 4: {\n view.setInt32(offset, value, !0);\n break;\n }\n case 5: {\n view.setUint32(offset, value | 0, !0), view.setInt8(offset + 4, Math.floor(value * 0.00000000023283064365386964));\n break;\n }\n case 6: {\n view.setUint32(offset, value | 0, !0), view.setInt16(offset + 4, Math.floor(value * 0.00000000023283064365386964), !0);\n break;\n }\n default:\n @throwRangeError(\"byteLength must be >= 1 and <= 6\");\n }\n return offset + byteLength;\n})\n"; - -// writeUInt16BE -const JSC::ConstructAbility s_jsBufferPrototypeWriteUInt16BECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteUInt16BECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUInt16BECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteUInt16BECodeLength = 176; -static const JSC::Intrinsic s_jsBufferPrototypeWriteUInt16BECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteUInt16BECode = "(function (value, offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setUint16(offset, value, !1), offset + 2;\n})\n"; - -// writeUInt16LE -const JSC::ConstructAbility s_jsBufferPrototypeWriteUInt16LECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteUInt16LECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUInt16LECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteUInt16LECodeLength = 176; -static const JSC::Intrinsic s_jsBufferPrototypeWriteUInt16LECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteUInt16LECode = "(function (value, offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setUint16(offset, value, !0), offset + 2;\n})\n"; - -// writeUInt32BE -const JSC::ConstructAbility s_jsBufferPrototypeWriteUInt32BECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteUInt32BECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUInt32BECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteUInt32BECodeLength = 176; -static const JSC::Intrinsic s_jsBufferPrototypeWriteUInt32BECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteUInt32BECode = "(function (value, offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setUint32(offset, value, !1), offset + 4;\n})\n"; - -// writeUInt32LE -const JSC::ConstructAbility s_jsBufferPrototypeWriteUInt32LECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteUInt32LECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUInt32LECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteUInt32LECodeLength = 176; -static const JSC::Intrinsic s_jsBufferPrototypeWriteUInt32LECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteUInt32LECode = "(function (value, offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setUint32(offset, value, !0), offset + 4;\n})\n"; - -// writeUInt8 -const JSC::ConstructAbility s_jsBufferPrototypeWriteUInt8CodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteUInt8CodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUInt8CodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteUInt8CodeLength = 171; -static const JSC::Intrinsic s_jsBufferPrototypeWriteUInt8CodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteUInt8Code = "(function (value, offset) {\"use strict\";\n return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setUint8(offset, value), offset + 1;\n})\n"; - -// writeUIntBE -const JSC::ConstructAbility s_jsBufferPrototypeWriteUIntBECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteUIntBECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUIntBECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteUIntBECodeLength = 963; -static const JSC::Intrinsic s_jsBufferPrototypeWriteUIntBECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteUIntBECode = "(function (value, offset, byteLength) {\"use strict\";\n const view = this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength);\n switch (byteLength) {\n case 1: {\n view.setUint8(offset, value);\n break;\n }\n case 2: {\n view.setUint16(offset, value, !1);\n break;\n }\n case 3: {\n view.setUint16(offset + 1, value & 65535, !1), view.setUint8(offset, Math.floor(value * 0.0000152587890625));\n break;\n }\n case 4: {\n view.setUint32(offset, value, !1);\n break;\n }\n case 5: {\n view.setUint32(offset + 1, value | 0, !1), view.setUint8(offset, Math.floor(value * 0.00000000023283064365386964));\n break;\n }\n case 6: {\n view.setUint32(offset + 2, value | 0, !1), view.setUint16(offset, Math.floor(value * 0.00000000023283064365386964), !1);\n break;\n }\n default:\n @throwRangeError(\"byteLength must be >= 1 and <= 6\");\n }\n return offset + byteLength;\n})\n"; - -// writeUIntLE -const JSC::ConstructAbility s_jsBufferPrototypeWriteUIntLECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteUIntLECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUIntLECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteUIntLECodeLength = 963; -static const JSC::Intrinsic s_jsBufferPrototypeWriteUIntLECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteUIntLECode = "(function (value, offset, byteLength) {\"use strict\";\n const view = this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength);\n switch (byteLength) {\n case 1: {\n view.setUint8(offset, value);\n break;\n }\n case 2: {\n view.setUint16(offset, value, !0);\n break;\n }\n case 3: {\n view.setUint16(offset, value & 65535, !0), view.setUint8(offset + 2, Math.floor(value * 0.0000152587890625));\n break;\n }\n case 4: {\n view.setUint32(offset, value, !0);\n break;\n }\n case 5: {\n view.setUint32(offset, value | 0, !0), view.setUint8(offset + 4, Math.floor(value * 0.00000000023283064365386964));\n break;\n }\n case 6: {\n view.setUint32(offset, value | 0, !0), view.setUint16(offset + 4, Math.floor(value * 0.00000000023283064365386964), !0);\n break;\n }\n default:\n @throwRangeError(\"byteLength must be >= 1 and <= 6\");\n }\n return offset + byteLength;\n})\n"; - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast(vm.clientData); \ - return clientData->builtinFunctions().jsBufferPrototypeBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().jsBufferPrototypeBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - -/* Module.ts */ -// main -const JSC::ConstructAbility s_moduleMainCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_moduleMainCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_moduleMainCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_moduleMainCodeLength = 68; -static const JSC::Intrinsic s_moduleMainCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_moduleMainCode = "(function () {\"use strict\";\n return @requireMap.@get(Bun.main);\n})\n"; - -// overridableRequire -const JSC::ConstructAbility s_moduleOverridableRequireCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_moduleOverridableRequireCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_moduleOverridableRequireCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_moduleOverridableRequireCodeLength = 888; -static const JSC::Intrinsic s_moduleOverridableRequireCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_moduleOverridableRequireCode = "(function (id) {\"use strict\";\n const existing = @requireMap.@get(id) || @requireMap.@get(id = @resolveSync(id, this.path, !1));\n if (existing)\n return @evaluateCommonJSModule(existing), existing.exports;\n if (id.endsWith(\".node\"))\n return @internalRequire(id);\n const mod = @createCommonJSModule(id, {}, !1, this);\n @requireMap.@set(id, mod);\n var out = this.@require(id, mod);\n if (out === -1) {\n try {\n out = @requireESM(id);\n } catch (exception) {\n throw @requireMap.@delete(id), exception;\n }\n const esm = @Loader.registry.@get(id);\n if (esm\?.evaluated && (esm.state \?\? 0) >= @ModuleReady) {\n const namespace = @Loader.getModuleNamespaceObject(esm.module);\n return mod.exports = namespace.__esModule \? namespace : Object.create(namespace, { __esModule: { value: !0 } });\n }\n }\n return @evaluateCommonJSModule(mod), mod.exports;\n})\n"; - -// require -const JSC::ConstructAbility s_moduleRequireCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_moduleRequireCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_moduleRequireCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_moduleRequireCodeLength = 79; -static const JSC::Intrinsic s_moduleRequireCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_moduleRequireCode = "(function (id) {\"use strict\";\n return @overridableRequire.@call(this, id);\n})\n"; - -// requireNativeModule -const JSC::ConstructAbility s_moduleRequireNativeModuleCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_moduleRequireNativeModuleCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_moduleRequireNativeModuleCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_moduleRequireNativeModuleCodeLength = 229; -static const JSC::Intrinsic s_moduleRequireNativeModuleCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_moduleRequireNativeModuleCode = "(function (id) {\"use strict\";\n let esm = @Loader.registry.@get(id);\n if (esm\?.evaluated && (esm.state \?\? 0) >= @ModuleReady)\n return @Loader.getModuleNamespaceObject(esm.module).default;\n return @requireESM(id).default;\n})\n"; - -// requireResolve -const JSC::ConstructAbility s_moduleRequireResolveCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_moduleRequireResolveCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_moduleRequireResolveCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_moduleRequireResolveCodeLength = 110; -static const JSC::Intrinsic s_moduleRequireResolveCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_moduleRequireResolveCode = "(function (id) {\"use strict\";\n return @resolveSync(id, typeof this === \"string\" \? this : this\?.path, !1);\n})\n"; - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast(vm.clientData); \ - return clientData->builtinFunctions().moduleBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().moduleBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_MODULE_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - -/* ProcessObjectInternals.ts */ -// getStdinStream -const JSC::ConstructAbility s_processObjectInternalsGetStdinStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_processObjectInternalsGetStdinStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_processObjectInternalsGetStdinStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_processObjectInternalsGetStdinStreamCodeLength = 2090; -static const JSC::Intrinsic s_processObjectInternalsGetStdinStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_processObjectInternalsGetStdinStreamCode = "(function (fd) {\"use strict\";\n var reader, readerRef;\n function ref() {\n reader \?\?= Bun.stdin.stream().getReader(), readerRef \?\?= setInterval(() => {\n }, 1 << 30);\n }\n function unref() {\n if (readerRef)\n clearInterval(readerRef), readerRef = @undefined;\n if (reader)\n reader.cancel(), reader = @undefined;\n }\n const tty = @getInternalField(@internalModuleRegistry, 46) || @createInternalModuleById(46), stream = new ((tty.isatty(fd)) \? tty.ReadStream : ((@getInternalField(@internalModuleRegistry, 21)) || (@createInternalModuleById(21))).ReadStream)(fd), originalOn = stream.on;\n let stream_destroyed = !1;\n stream.on = function(event, listener) {\n if (event === \"readable\")\n ref();\n return originalOn.@call(this, event, listener);\n }, stream.fd = fd;\n const originalPause = stream.pause;\n stream.pause = function() {\n return unref(), originalPause.@call(this);\n };\n const originalResume = stream.resume;\n stream.resume = function() {\n return ref(), originalResume.@call(this);\n };\n async function internalRead(stream2) {\n try {\n var done, value;\n const read = reader\?.readMany();\n if (@isPromise(read))\n ({ done, value } = await read);\n else\n ({ done, value } = read);\n if (!done) {\n stream2.push(value[0]);\n const length = value.length;\n for (let i = 1;i < length; i++)\n stream2.push(value[i]);\n } else if (stream2.emit(\"end\"), !stream_destroyed)\n stream_destroyed = !0, stream2.destroy(), unref();\n } catch (err) {\n stream2.destroy(err);\n }\n }\n return stream._read = function(size) {\n internalRead(this);\n }, stream.on(\"resume\", () => {\n ref(), stream._undestroy();\n }), stream._readableState.reading = !1, stream.on(\"pause\", () => {\n process.nextTick(() => {\n if (!stream.readableFlowing)\n stream._readableState.reading = !1;\n });\n }), stream.on(\"close\", () => {\n if (!stream_destroyed)\n stream_destroyed = !0, process.nextTick(() => {\n stream.destroy(), unref();\n });\n }), stream;\n})\n"; - -// getStdioWriteStream -const JSC::ConstructAbility s_processObjectInternalsGetStdioWriteStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_processObjectInternalsGetStdioWriteStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_processObjectInternalsGetStdioWriteStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_processObjectInternalsGetStdioWriteStreamCodeLength = 789; -static const JSC::Intrinsic s_processObjectInternalsGetStdioWriteStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_processObjectInternalsGetStdioWriteStreamCode = "(function (fd) {\"use strict\";\n const stream = (@getInternalField(@internalModuleRegistry, 46) || @createInternalModuleById(46)).WriteStream(fd);\n if (process.on(\"SIGWINCH\", () => {\n stream._refreshSize();\n }), fd === 1)\n stream.destroySoon = stream.destroy, stream._destroy = function(err, cb) {\n if (cb(err), this._undestroy(), !this._writableState.emitClose)\n process.nextTick(() => {\n this.emit(\"close\");\n });\n };\n else if (fd === 2)\n stream.destroySoon = stream.destroy, stream._destroy = function(err, cb) {\n if (cb(err), this._undestroy(), !this._writableState.emitClose)\n process.nextTick(() => {\n this.emit(\"close\");\n });\n };\n return stream._type = \"tty\", stream._isStdio = !0, stream.fd = fd, stream;\n})\n"; - -// initializeNextTickQueue -const JSC::ConstructAbility s_processObjectInternalsInitializeNextTickQueueCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_processObjectInternalsInitializeNextTickQueueCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_processObjectInternalsInitializeNextTickQueueCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_processObjectInternalsInitializeNextTickQueueCodeLength = 3648; -static const JSC::Intrinsic s_processObjectInternalsInitializeNextTickQueueCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_processObjectInternalsInitializeNextTickQueueCode = "(function (process, nextTickQueue, drainMicrotasksFn, reportUncaughtExceptionFn) {\"use strict\";\n var queue, process, nextTickQueue = nextTickQueue, drainMicrotasks = drainMicrotasksFn, reportUncaughtException = reportUncaughtExceptionFn;\n function validateFunction(cb) {\n if (typeof cb !== \"function\") {\n const err = @makeTypeError(`The \"callback\" argument must be of type \"function\". Received type ${typeof cb}`);\n throw err.code = \"ERR_INVALID_ARG_TYPE\", err;\n }\n }\n var setup = () => {\n queue = function createQueue() {\n\n class FixedCircularBuffer {\n top;\n bottom;\n list;\n next;\n constructor() {\n this.bottom = 0, this.top = 0, this.list = @newArrayWithSize(2048), this.next = null;\n }\n isEmpty() {\n return this.top === this.bottom;\n }\n isFull() {\n return (this.top + 1 & 2047) === this.bottom;\n }\n push(data) {\n this.list[this.top] = data, this.top = this.top + 1 & 2047;\n }\n shift() {\n var { list, bottom } = this;\n const nextItem = list[bottom];\n if (nextItem === @undefined)\n return null;\n return list[bottom] = @undefined, this.bottom = bottom + 1 & 2047, nextItem;\n }\n }\n\n class FixedQueue {\n head;\n tail;\n constructor() {\n this.head = this.tail = new FixedCircularBuffer;\n }\n isEmpty() {\n return this.head.isEmpty();\n }\n push(data) {\n if (this.head.isFull())\n this.head = this.head.next = new FixedCircularBuffer;\n this.head.push(data);\n }\n shift() {\n const tail = this.tail, next = tail.shift();\n if (tail.isEmpty() && tail.next !== null)\n this.tail = tail.next, tail.next = null;\n return next;\n }\n }\n return new FixedQueue;\n }();\n function processTicksAndRejections() {\n var tock;\n do {\n while ((tock = queue.shift()) !== null) {\n var { callback, args, frame } = tock, restore = @getInternalField(@asyncContext, 0);\n @putInternalField(@asyncContext, 0, frame);\n try {\n if (args === @undefined)\n callback();\n else\n switch (args.length) {\n case 1:\n callback(args[0]);\n break;\n case 2:\n callback(args[0], args[1]);\n break;\n case 3:\n callback(args[0], args[1], args[2]);\n break;\n case 4:\n callback(args[0], args[1], args[2], args[3]);\n break;\n default:\n callback(...args);\n break;\n }\n } catch (e) {\n reportUncaughtException(e);\n } finally {\n @putInternalField(@asyncContext, 0, restore);\n }\n }\n drainMicrotasks();\n } while (!queue.isEmpty());\n }\n @putInternalField(nextTickQueue, 0, 0), @putInternalField(nextTickQueue, 1, queue), @putInternalField(nextTickQueue, 2, processTicksAndRejections), setup = @undefined;\n };\n function nextTick(cb, args) {\n if (validateFunction(cb), setup)\n setup(), process = globalThis.process;\n if (process._exiting)\n return;\n queue.push({\n callback: cb,\n args: @argumentCount() > 1 \? @Array.prototype.slice.@call(arguments, 1) : @undefined,\n frame: @getInternalField(@asyncContext, 0)\n }), @putInternalField(nextTickQueue, 0, 1);\n }\n return nextTick;\n})\n"; - -// mainModule -const JSC::ConstructAbility s_processObjectInternalsMainModuleCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_processObjectInternalsMainModuleCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_processObjectInternalsMainModuleCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_processObjectInternalsMainModuleCodeLength = 68; -static const JSC::Intrinsic s_processObjectInternalsMainModuleCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_processObjectInternalsMainModuleCode = "(function () {\"use strict\";\n return @requireMap.@get(Bun.main);\n})\n"; - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast(vm.clientData); \ - return clientData->builtinFunctions().processObjectInternalsBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().processObjectInternalsBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - -/* ReadableByteStreamController.ts */ -// byobRequest -const JSC::ConstructAbility s_readableByteStreamControllerByobRequestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamControllerByobRequestCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamControllerByobRequestCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamControllerByobRequestCodeLength = 738; -static const JSC::Intrinsic s_readableByteStreamControllerByobRequestCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamControllerByobRequestCode = "(function () {\"use strict\";\n if (!@isReadableByteStreamController(this))\n throw @makeGetterTypeError(\"ReadableByteStreamController\", \"byobRequest\");\n var request = @getByIdDirectPrivate(this, \"byobRequest\");\n if (request === @undefined) {\n var pending = @getByIdDirectPrivate(this, \"pendingPullIntos\");\n const firstDescriptor = pending.peek();\n if (firstDescriptor) {\n const view = new @Uint8Array(firstDescriptor.buffer, firstDescriptor.byteOffset + firstDescriptor.bytesFilled, firstDescriptor.byteLength - firstDescriptor.bytesFilled);\n @putByIdDirectPrivate(this, \"byobRequest\", new @ReadableStreamBYOBRequest(this, view, @isReadableStream));\n }\n }\n return @getByIdDirectPrivate(this, \"byobRequest\");\n})\n"; - -// close -const JSC::ConstructAbility s_readableByteStreamControllerCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamControllerCloseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamControllerCloseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamControllerCloseCodeLength = 458; -static const JSC::Intrinsic s_readableByteStreamControllerCloseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamControllerCloseCode = "(function () {\"use strict\";\n if (!@isReadableByteStreamController(this))\n throw @makeThisTypeError(\"ReadableByteStreamController\", \"close\");\n if (@getByIdDirectPrivate(this, \"closeRequested\"))\n @throwTypeError(\"Close has already been requested\");\n if (@getByIdDirectPrivate(@getByIdDirectPrivate(this, \"controlledReadableStream\"), \"state\") !== 4)\n @throwTypeError(\"ReadableStream is not readable\");\n @readableByteStreamControllerClose(this);\n})\n"; - -// desiredSize -const JSC::ConstructAbility s_readableByteStreamControllerDesiredSizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamControllerDesiredSizeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamControllerDesiredSizeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamControllerDesiredSizeCodeLength = 216; -static const JSC::Intrinsic s_readableByteStreamControllerDesiredSizeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamControllerDesiredSizeCode = "(function () {\"use strict\";\n if (!@isReadableByteStreamController(this))\n throw @makeGetterTypeError(\"ReadableByteStreamController\", \"desiredSize\");\n return @readableByteStreamControllerGetDesiredSize(this);\n})\n"; - -// enqueue -const JSC::ConstructAbility s_readableByteStreamControllerEnqueueCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamControllerEnqueueCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamControllerEnqueueCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamControllerEnqueueCodeLength = 615; -static const JSC::Intrinsic s_readableByteStreamControllerEnqueueCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamControllerEnqueueCode = "(function (chunk) {\"use strict\";\n if (!@isReadableByteStreamController(this))\n throw @makeThisTypeError(\"ReadableByteStreamController\", \"enqueue\");\n if (@getByIdDirectPrivate(this, \"closeRequested\"))\n @throwTypeError(\"ReadableByteStreamController is requested to close\");\n if (@getByIdDirectPrivate(@getByIdDirectPrivate(this, \"controlledReadableStream\"), \"state\") !== 4)\n @throwTypeError(\"ReadableStream is not readable\");\n if (!@isObject(chunk) || !@ArrayBuffer.@isView(chunk))\n @throwTypeError(\"Provided chunk is not a TypedArray\");\n return @readableByteStreamControllerEnqueue(this, chunk);\n})\n"; - -// error -const JSC::ConstructAbility s_readableByteStreamControllerErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamControllerErrorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamControllerErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamControllerErrorCodeLength = 360; -static const JSC::Intrinsic s_readableByteStreamControllerErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamControllerErrorCode = "(function (error) {\"use strict\";\n if (!@isReadableByteStreamController(this))\n throw @makeThisTypeError(\"ReadableByteStreamController\", \"error\");\n if (@getByIdDirectPrivate(@getByIdDirectPrivate(this, \"controlledReadableStream\"), \"state\") !== 4)\n @throwTypeError(\"ReadableStream is not readable\");\n @readableByteStreamControllerError(this, error);\n})\n"; - -// initializeReadableByteStreamController -const JSC::ConstructAbility s_readableByteStreamControllerInitializeReadableByteStreamControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamControllerInitializeReadableByteStreamControllerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamControllerInitializeReadableByteStreamControllerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamControllerInitializeReadableByteStreamControllerCodeLength = 351; -static const JSC::Intrinsic s_readableByteStreamControllerInitializeReadableByteStreamControllerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamControllerInitializeReadableByteStreamControllerCode = "(function (stream, underlyingByteSource, highWaterMark) {\"use strict\";\n if (arguments.length !== 4 && arguments[3] !== @isReadableStream)\n @throwTypeError(\"ReadableByteStreamController constructor should not be called directly\");\n return @privateInitializeReadableByteStreamController.@call(this, stream, underlyingByteSource, highWaterMark);\n})\n"; - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast(vm.clientData); \ - return clientData->builtinFunctions().readableByteStreamControllerBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().readableByteStreamControllerBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_READABLEBYTESTREAMCONTROLLER_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - -/* ReadableByteStreamInternals.ts */ -// isReadableByteStreamController -const JSC::ConstructAbility s_readableByteStreamInternalsIsReadableByteStreamControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsIsReadableByteStreamControllerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsIsReadableByteStreamControllerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsIsReadableByteStreamControllerCodeLength = 136; -static const JSC::Intrinsic s_readableByteStreamInternalsIsReadableByteStreamControllerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsIsReadableByteStreamControllerCode = "(function (controller) {\"use strict\";\n return @isObject(controller) && !!@getByIdDirectPrivate(controller, \"underlyingByteSource\");\n})\n"; - -// isReadableStreamBYOBReader -const JSC::ConstructAbility s_readableByteStreamInternalsIsReadableStreamBYOBReaderCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsIsReadableStreamBYOBReaderCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsIsReadableStreamBYOBReaderCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsIsReadableStreamBYOBReaderCodeLength = 120; -static const JSC::Intrinsic s_readableByteStreamInternalsIsReadableStreamBYOBReaderCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsIsReadableStreamBYOBReaderCode = "(function (reader) {\"use strict\";\n return @isObject(reader) && !!@getByIdDirectPrivate(reader, \"readIntoRequests\");\n})\n"; - -// isReadableStreamBYOBRequest -const JSC::ConstructAbility s_readableByteStreamInternalsIsReadableStreamBYOBRequestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsIsReadableStreamBYOBRequestCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsIsReadableStreamBYOBRequestCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsIsReadableStreamBYOBRequestCodeLength = 157; -static const JSC::Intrinsic s_readableByteStreamInternalsIsReadableStreamBYOBRequestCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsIsReadableStreamBYOBRequestCode = "(function (byobRequest) {\"use strict\";\n return @isObject(byobRequest) && !!@getByIdDirectPrivate(byobRequest, \"associatedReadableByteStreamController\");\n})\n"; - -// privateInitializeReadableByteStreamController -const JSC::ConstructAbility s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeLength = 2063; -static const JSC::Intrinsic s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCode = "(function (stream, underlyingByteSource, highWaterMark) {\"use strict\";\n if (!@isReadableStream(stream))\n @throwTypeError(\"ReadableByteStreamController needs a ReadableStream\");\n if (@getByIdDirectPrivate(stream, \"readableStreamController\") !== null)\n @throwTypeError(\"ReadableStream already has a controller\");\n @putByIdDirectPrivate(this, \"controlledReadableStream\", stream), @putByIdDirectPrivate(this, \"underlyingByteSource\", underlyingByteSource), @putByIdDirectPrivate(this, \"pullAgain\", !1), @putByIdDirectPrivate(this, \"pulling\", !1), @readableByteStreamControllerClearPendingPullIntos(this), @putByIdDirectPrivate(this, \"queue\", @newQueue()), @putByIdDirectPrivate(this, \"started\", 0), @putByIdDirectPrivate(this, \"closeRequested\", !1);\n let hwm = @toNumber(highWaterMark);\n if (hwm !== hwm || hwm < 0)\n @throwRangeError(\"highWaterMark value is negative or not a number\");\n @putByIdDirectPrivate(this, \"strategyHWM\", hwm);\n let autoAllocateChunkSize = underlyingByteSource.autoAllocateChunkSize;\n if (autoAllocateChunkSize !== @undefined) {\n if (autoAllocateChunkSize = @toNumber(autoAllocateChunkSize), autoAllocateChunkSize <= 0 || autoAllocateChunkSize === @Infinity || autoAllocateChunkSize === -@Infinity)\n @throwRangeError(\"autoAllocateChunkSize value is negative or equal to positive or negative infinity\");\n }\n @putByIdDirectPrivate(this, \"autoAllocateChunkSize\", autoAllocateChunkSize), @putByIdDirectPrivate(this, \"pendingPullIntos\", @createFIFO());\n const controller = this;\n return @promiseInvokeOrNoopNoCatch(@getByIdDirectPrivate(controller, \"underlyingByteSource\"), \"start\", [controller]).@then(() => {\n @putByIdDirectPrivate(controller, \"started\", 1), @readableByteStreamControllerCallPullIfNeeded(controller);\n }, (error) => {\n if (@getByIdDirectPrivate(stream, \"state\") === 4)\n @readableByteStreamControllerError(controller, error);\n }), @putByIdDirectPrivate(this, \"cancel\", @readableByteStreamControllerCancel), @putByIdDirectPrivate(this, \"pull\", @readableByteStreamControllerPull), this;\n})\n"; - -// privateInitializeReadableStreamBYOBRequest -const JSC::ConstructAbility s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCodeLength = 175; -static const JSC::Intrinsic s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCode = "(function (controller, view) {\"use strict\";\n @putByIdDirectPrivate(this, \"associatedReadableByteStreamController\", controller), @putByIdDirectPrivate(this, \"view\", view);\n})\n"; - -// readableByteStreamControllerCallPullIfNeeded -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeededCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeededCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeededCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeededCodeLength = 828; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeededCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeededCode = "(function (controller) {\"use strict\";\n if (!@readableByteStreamControllerShouldCallPull(controller))\n return;\n if (@getByIdDirectPrivate(controller, \"pulling\")) {\n @putByIdDirectPrivate(controller, \"pullAgain\", !0);\n return;\n }\n @putByIdDirectPrivate(controller, \"pulling\", !0), @promiseInvokeOrNoop(@getByIdDirectPrivate(controller, \"underlyingByteSource\"), \"pull\", [controller]).@then(() => {\n if (@putByIdDirectPrivate(controller, \"pulling\", !1), @getByIdDirectPrivate(controller, \"pullAgain\"))\n @putByIdDirectPrivate(controller, \"pullAgain\", !1), @readableByteStreamControllerCallPullIfNeeded(controller);\n }, (error) => {\n if (@getByIdDirectPrivate(@getByIdDirectPrivate(controller, \"controlledReadableStream\"), \"state\") === 4)\n @readableByteStreamControllerError(controller, error);\n });\n})\n"; - -// readableByteStreamControllerCancel -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerCancelCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerCancelCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerCancelCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerCancelCodeLength = 369; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerCancelCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerCancelCode = "(function (controller, reason) {\"use strict\";\n var pendingPullIntos = @getByIdDirectPrivate(controller, \"pendingPullIntos\"), first = pendingPullIntos.peek();\n if (first)\n first.bytesFilled = 0;\n return @putByIdDirectPrivate(controller, \"queue\", @newQueue()), @promiseInvokeOrNoop(@getByIdDirectPrivate(controller, \"underlyingByteSource\"), \"cancel\", [reason]);\n})\n"; - -// readableByteStreamControllerClearPendingPullIntos -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntosCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntosCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntosCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntosCodeLength = 313; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntosCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntosCode = "(function (controller) {\"use strict\";\n @readableByteStreamControllerInvalidateBYOBRequest(controller);\n var existing = @getByIdDirectPrivate(controller, \"pendingPullIntos\");\n if (existing !== @undefined)\n existing.clear();\n else\n @putByIdDirectPrivate(controller, \"pendingPullIntos\", @createFIFO());\n})\n"; - -// readableByteStreamControllerClose -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerCloseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerCloseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerCloseCodeLength = 551; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerCloseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerCloseCode = "(function (controller) {\"use strict\";\n if (@getByIdDirectPrivate(controller, \"queue\").size > 0) {\n @putByIdDirectPrivate(controller, \"closeRequested\", !0);\n return;\n }\n var first = @getByIdDirectPrivate(controller, \"pendingPullIntos\")\?.peek();\n if (first) {\n if (first.bytesFilled > 0) {\n const e = @makeTypeError(\"Close requested while there remain pending bytes\");\n throw @readableByteStreamControllerError(controller, e), e;\n }\n }\n @readableStreamClose(@getByIdDirectPrivate(controller, \"controlledReadableStream\"));\n})\n"; - -// readableByteStreamControllerCommitDescriptor -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerCommitDescriptorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerCommitDescriptorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerCommitDescriptorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerCommitDescriptorCodeLength = 420; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerCommitDescriptorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerCommitDescriptorCode = "(function (stream, pullIntoDescriptor) {\"use strict\";\n let done = !1;\n if (@getByIdDirectPrivate(stream, \"state\") === 1)\n done = !0;\n let filledView = @readableByteStreamControllerConvertDescriptor(pullIntoDescriptor);\n if (pullIntoDescriptor.readerType === \"default\")\n @readableStreamFulfillReadRequest(stream, filledView, done);\n else\n @readableStreamFulfillReadIntoRequest(stream, filledView, done);\n})\n"; - -// readableByteStreamControllerConvertDescriptor -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerConvertDescriptorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerConvertDescriptorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerConvertDescriptorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerConvertDescriptorCodeLength = 210; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerConvertDescriptorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerConvertDescriptorCode = "(function (pullIntoDescriptor) {\"use strict\";\n return new pullIntoDescriptor.ctor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, pullIntoDescriptor.bytesFilled / pullIntoDescriptor.elementSize);\n})\n"; - -// readableByteStreamControllerEnqueue -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerEnqueueCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerEnqueueCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerEnqueueCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerEnqueueCodeLength = 1217; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerEnqueueCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerEnqueueCode = "(function (controller, chunk) {\"use strict\";\n const stream = @getByIdDirectPrivate(controller, \"controlledReadableStream\");\n switch (@getByIdDirectPrivate(stream, \"reader\") \? @readableStreamReaderKind(@getByIdDirectPrivate(stream, \"reader\")) : 0) {\n case 1: {\n if (!@getByIdDirectPrivate(@getByIdDirectPrivate(stream, \"reader\"), \"readRequests\")\?.isNotEmpty())\n @readableByteStreamControllerEnqueueChunk(controller, @transferBufferToCurrentRealm(chunk.buffer), chunk.byteOffset, chunk.byteLength);\n else {\n const transferredView = chunk.constructor === @Uint8Array \? chunk : new @Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);\n @readableStreamFulfillReadRequest(stream, transferredView, !1);\n }\n break;\n }\n case 2: {\n @readableByteStreamControllerEnqueueChunk(controller, @transferBufferToCurrentRealm(chunk.buffer), chunk.byteOffset, chunk.byteLength), @readableByteStreamControllerProcessPullDescriptors(controller);\n break;\n }\n case 3:\n break;\n default: {\n @readableByteStreamControllerEnqueueChunk(controller, @transferBufferToCurrentRealm(chunk.buffer), chunk.byteOffset, chunk.byteLength);\n break;\n }\n }\n})\n"; - -// readableByteStreamControllerEnqueueChunk -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerEnqueueChunkCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerEnqueueChunkCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerEnqueueChunkCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerEnqueueChunkCodeLength = 245; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerEnqueueChunkCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerEnqueueChunkCode = "(function (controller, buffer, byteOffset, byteLength) {\"use strict\";\n @getByIdDirectPrivate(controller, \"queue\").content.push({\n buffer,\n byteOffset,\n byteLength\n }), @getByIdDirectPrivate(controller, \"queue\").size += byteLength;\n})\n"; - -// readableByteStreamControllerError -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerErrorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerErrorCodeLength = 255; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerErrorCode = "(function (controller, e) {\"use strict\";\n @readableByteStreamControllerClearPendingPullIntos(controller), @putByIdDirectPrivate(controller, \"queue\", @newQueue()), @readableStreamError(@getByIdDirectPrivate(controller, \"controlledReadableStream\"), e);\n})\n"; - -// readableByteStreamControllerFillDescriptorFromQueue -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueueCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueueCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueueCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueueCodeLength = 1695; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueueCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueueCode = "(function (controller, pullIntoDescriptor) {\"use strict\";\n const currentAlignedBytes = pullIntoDescriptor.bytesFilled - pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize, maxBytesToCopy = @getByIdDirectPrivate(controller, \"queue\").size < pullIntoDescriptor.byteLength - pullIntoDescriptor.bytesFilled \? @getByIdDirectPrivate(controller, \"queue\").size : pullIntoDescriptor.byteLength - pullIntoDescriptor.bytesFilled, maxBytesFilled = pullIntoDescriptor.bytesFilled + maxBytesToCopy, maxAlignedBytes = maxBytesFilled - maxBytesFilled % pullIntoDescriptor.elementSize;\n let totalBytesToCopyRemaining = maxBytesToCopy, ready = !1;\n if (maxAlignedBytes > currentAlignedBytes)\n totalBytesToCopyRemaining = maxAlignedBytes - pullIntoDescriptor.bytesFilled, ready = !0;\n while (totalBytesToCopyRemaining > 0) {\n let headOfQueue = @getByIdDirectPrivate(controller, \"queue\").content.peek();\n const bytesToCopy = totalBytesToCopyRemaining < headOfQueue.byteLength \? totalBytesToCopyRemaining : headOfQueue.byteLength, destStart = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;\n if (new @Uint8Array(pullIntoDescriptor.buffer).set(new @Uint8Array(headOfQueue.buffer, headOfQueue.byteOffset, bytesToCopy), destStart), headOfQueue.byteLength === bytesToCopy)\n @getByIdDirectPrivate(controller, \"queue\").content.shift();\n else\n headOfQueue.byteOffset += bytesToCopy, headOfQueue.byteLength -= bytesToCopy;\n @getByIdDirectPrivate(controller, \"queue\").size -= bytesToCopy, @readableByteStreamControllerInvalidateBYOBRequest(controller), pullIntoDescriptor.bytesFilled += bytesToCopy, totalBytesToCopyRemaining -= bytesToCopy;\n }\n return ready;\n})\n"; - -// readableByteStreamControllerGetDesiredSize -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerGetDesiredSizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerGetDesiredSizeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerGetDesiredSizeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerGetDesiredSizeCodeLength = 347; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerGetDesiredSizeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerGetDesiredSizeCode = "(function (controller) {\"use strict\";\n const stream = @getByIdDirectPrivate(controller, \"controlledReadableStream\"), state = @getByIdDirectPrivate(stream, \"state\");\n if (state === 3)\n return null;\n if (state === 1)\n return 0;\n return @getByIdDirectPrivate(controller, \"strategyHWM\") - @getByIdDirectPrivate(controller, \"queue\").size;\n})\n"; - -// readableByteStreamControllerHandleQueueDrain -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrainCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrainCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrainCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrainCodeLength = 311; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrainCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrainCode = "(function (controller) {\"use strict\";\n if (!@getByIdDirectPrivate(controller, \"queue\").size && @getByIdDirectPrivate(controller, \"closeRequested\"))\n @readableStreamClose(@getByIdDirectPrivate(controller, \"controlledReadableStream\"));\n else\n @readableByteStreamControllerCallPullIfNeeded(controller);\n})\n"; - -// readableByteStreamControllerInvalidateBYOBRequest -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequestCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequestCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequestCodeLength = 406; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequestCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequestCode = "(function (controller) {\"use strict\";\n if (@getByIdDirectPrivate(controller, \"byobRequest\") === @undefined)\n return;\n const byobRequest = @getByIdDirectPrivate(controller, \"byobRequest\");\n @putByIdDirectPrivate(byobRequest, \"associatedReadableByteStreamController\", @undefined), @putByIdDirectPrivate(byobRequest, \"view\", @undefined), @putByIdDirectPrivate(controller, \"byobRequest\", @undefined);\n})\n"; - -// readableByteStreamControllerProcessPullDescriptors -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptorsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptorsCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptorsCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptorsCodeLength = 587; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptorsCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptorsCode = "(function (controller) {\"use strict\";\n while (@getByIdDirectPrivate(controller, \"pendingPullIntos\").isNotEmpty()) {\n if (@getByIdDirectPrivate(controller, \"queue\").size === 0)\n return;\n let pullIntoDescriptor = @getByIdDirectPrivate(controller, \"pendingPullIntos\").peek();\n if (@readableByteStreamControllerFillDescriptorFromQueue(controller, pullIntoDescriptor))\n @readableByteStreamControllerShiftPendingDescriptor(controller), @readableByteStreamControllerCommitDescriptor(@getByIdDirectPrivate(controller, \"controlledReadableStream\"), pullIntoDescriptor);\n }\n})\n"; - -// readableByteStreamControllerPull -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerPullCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerPullCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerPullCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerPullCodeLength = 1397; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerPullCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerPullCode = "(function (controller) {\"use strict\";\n const stream = @getByIdDirectPrivate(controller, \"controlledReadableStream\");\n if (@getByIdDirectPrivate(controller, \"queue\").content\?.isNotEmpty()) {\n const entry = @getByIdDirectPrivate(controller, \"queue\").content.shift();\n @getByIdDirectPrivate(controller, \"queue\").size -= entry.byteLength, @readableByteStreamControllerHandleQueueDrain(controller);\n let view;\n try {\n view = new @Uint8Array(entry.buffer, entry.byteOffset, entry.byteLength);\n } catch (error) {\n return @Promise.@reject(error);\n }\n return @createFulfilledPromise({ value: view, done: !1 });\n }\n if (@getByIdDirectPrivate(controller, \"autoAllocateChunkSize\") !== @undefined) {\n let buffer;\n try {\n buffer = @createUninitializedArrayBuffer(@getByIdDirectPrivate(controller, \"autoAllocateChunkSize\"));\n } catch (error) {\n return @Promise.@reject(error);\n }\n const pullIntoDescriptor = {\n buffer,\n byteOffset: 0,\n byteLength: @getByIdDirectPrivate(controller, \"autoAllocateChunkSize\"),\n bytesFilled: 0,\n elementSize: 1,\n ctor: @Uint8Array,\n readerType: \"default\"\n };\n @getByIdDirectPrivate(controller, \"pendingPullIntos\").push(pullIntoDescriptor);\n }\n const promise = @readableStreamAddReadRequest(stream);\n return @readableByteStreamControllerCallPullIfNeeded(controller), promise;\n})\n"; - -// readableByteStreamControllerPullInto -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerPullIntoCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerPullIntoCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerPullIntoCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerPullIntoCodeLength = 1871; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerPullIntoCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerPullIntoCode = "(function (controller, view) {\"use strict\";\n const stream = @getByIdDirectPrivate(controller, \"controlledReadableStream\");\n let elementSize = 1;\n if (view.BYTES_PER_ELEMENT !== @undefined)\n elementSize = view.BYTES_PER_ELEMENT;\n const ctor = view.constructor, pullIntoDescriptor = {\n buffer: view.buffer,\n byteOffset: view.byteOffset,\n byteLength: view.byteLength,\n bytesFilled: 0,\n elementSize,\n ctor,\n readerType: \"byob\"\n };\n var pending = @getByIdDirectPrivate(controller, \"pendingPullIntos\");\n if (pending\?.isNotEmpty())\n return pullIntoDescriptor.buffer = @transferBufferToCurrentRealm(pullIntoDescriptor.buffer), pending.push(pullIntoDescriptor), @readableStreamAddReadIntoRequest(stream);\n if (@getByIdDirectPrivate(stream, \"state\") === 1) {\n const emptyView = new ctor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, 0);\n return @createFulfilledPromise({ value: emptyView, done: !0 });\n }\n if (@getByIdDirectPrivate(controller, \"queue\").size > 0) {\n if (@readableByteStreamControllerFillDescriptorFromQueue(controller, pullIntoDescriptor)) {\n const filledView = @readableByteStreamControllerConvertDescriptor(pullIntoDescriptor);\n return @readableByteStreamControllerHandleQueueDrain(controller), @createFulfilledPromise({ value: filledView, done: !1 });\n }\n if (@getByIdDirectPrivate(controller, \"closeRequested\")) {\n const e = @makeTypeError(\"Closing stream has been requested\");\n return @readableByteStreamControllerError(controller, e), @Promise.@reject(e);\n }\n }\n pullIntoDescriptor.buffer = @transferBufferToCurrentRealm(pullIntoDescriptor.buffer), @getByIdDirectPrivate(controller, \"pendingPullIntos\").push(pullIntoDescriptor);\n const promise = @readableStreamAddReadIntoRequest(stream);\n return @readableByteStreamControllerCallPullIfNeeded(controller), promise;\n})\n"; - -// readableByteStreamControllerRespond -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerRespondCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerRespondCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerRespondCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerRespondCodeLength = 317; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerRespondCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerRespondCode = "(function (controller, bytesWritten) {\"use strict\";\n if (bytesWritten = @toNumber(bytesWritten), bytesWritten !== bytesWritten || bytesWritten === @Infinity || bytesWritten < 0)\n @throwRangeError(\"bytesWritten has an incorrect value\");\n @readableByteStreamControllerRespondInternal(controller, bytesWritten);\n})\n"; - -// readableByteStreamControllerRespondInClosedState -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerRespondInClosedStateCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerRespondInClosedStateCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerRespondInClosedStateCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerRespondInClosedStateCodeLength = 641; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerRespondInClosedStateCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerRespondInClosedStateCode = "(function (controller, firstDescriptor) {\"use strict\";\n if (firstDescriptor.buffer = @transferBufferToCurrentRealm(firstDescriptor.buffer), @readableStreamHasBYOBReader(@getByIdDirectPrivate(controller, \"controlledReadableStream\")))\n while (@getByIdDirectPrivate(@getByIdDirectPrivate(@getByIdDirectPrivate(controller, \"controlledReadableStream\"), \"reader\"), \"readIntoRequests\")\?.isNotEmpty()) {\n let pullIntoDescriptor = @readableByteStreamControllerShiftPendingDescriptor(controller);\n @readableByteStreamControllerCommitDescriptor(@getByIdDirectPrivate(controller, \"controlledReadableStream\"), pullIntoDescriptor);\n }\n})\n"; - -// readableByteStreamControllerRespondInReadableState -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerRespondInReadableStateCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerRespondInReadableStateCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerRespondInReadableStateCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerRespondInReadableStateCodeLength = 1200; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerRespondInReadableStateCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerRespondInReadableStateCode = "(function (controller, bytesWritten, pullIntoDescriptor) {\"use strict\";\n if (pullIntoDescriptor.bytesFilled + bytesWritten > pullIntoDescriptor.byteLength)\n @throwRangeError(\"bytesWritten value is too great\");\n if (@readableByteStreamControllerInvalidateBYOBRequest(controller), pullIntoDescriptor.bytesFilled += bytesWritten, pullIntoDescriptor.bytesFilled < pullIntoDescriptor.elementSize)\n return;\n @readableByteStreamControllerShiftPendingDescriptor(controller);\n const remainderSize = pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize;\n if (remainderSize > 0) {\n const end = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled, remainder = @cloneArrayBuffer(pullIntoDescriptor.buffer, end - remainderSize, remainderSize);\n @readableByteStreamControllerEnqueueChunk(controller, remainder, 0, remainder.byteLength);\n }\n pullIntoDescriptor.buffer = @transferBufferToCurrentRealm(pullIntoDescriptor.buffer), pullIntoDescriptor.bytesFilled -= remainderSize, @readableByteStreamControllerCommitDescriptor(@getByIdDirectPrivate(controller, \"controlledReadableStream\"), pullIntoDescriptor), @readableByteStreamControllerProcessPullDescriptors(controller);\n})\n"; - -// readableByteStreamControllerRespondInternal -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerRespondInternalCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerRespondInternalCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerRespondInternalCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerRespondInternalCodeLength = 576; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerRespondInternalCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerRespondInternalCode = "(function (controller, bytesWritten) {\"use strict\";\n let firstDescriptor = @getByIdDirectPrivate(controller, \"pendingPullIntos\").peek(), stream = @getByIdDirectPrivate(controller, \"controlledReadableStream\");\n if (@getByIdDirectPrivate(stream, \"state\") === 1) {\n if (bytesWritten !== 0)\n @throwTypeError(\"bytesWritten is different from 0 even though stream is closed\");\n @readableByteStreamControllerRespondInClosedState(controller, firstDescriptor);\n } else\n @readableByteStreamControllerRespondInReadableState(controller, bytesWritten, firstDescriptor);\n})\n"; - -// readableByteStreamControllerRespondWithNewView -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerRespondWithNewViewCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerRespondWithNewViewCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerRespondWithNewViewCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerRespondWithNewViewCodeLength = 504; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerRespondWithNewViewCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerRespondWithNewViewCode = "(function (controller, view) {\"use strict\";\n let firstDescriptor = @getByIdDirectPrivate(controller, \"pendingPullIntos\").peek();\n if (firstDescriptor.byteOffset + firstDescriptor.bytesFilled !== view.byteOffset)\n @throwRangeError(\"Invalid value for view.byteOffset\");\n if (firstDescriptor.byteLength !== view.byteLength)\n @throwRangeError(\"Invalid value for view.byteLength\");\n firstDescriptor.buffer = view.buffer, @readableByteStreamControllerRespondInternal(controller, view.byteLength);\n})\n"; - -// readableByteStreamControllerShiftPendingDescriptor -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptorCodeLength = 208; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptorCode = "(function (controller) {\"use strict\";\n let descriptor = @getByIdDirectPrivate(controller, \"pendingPullIntos\").shift();\n return @readableByteStreamControllerInvalidateBYOBRequest(controller), descriptor;\n})\n"; - -// readableByteStreamControllerShouldCallPull -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCodeLength = 793; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCode = "(function (controller) {\"use strict\";\n const stream = @getByIdDirectPrivate(controller, \"controlledReadableStream\");\n if (@getByIdDirectPrivate(stream, \"state\") !== 4)\n return !1;\n if (@getByIdDirectPrivate(controller, \"closeRequested\"))\n return !1;\n if (!(@getByIdDirectPrivate(controller, \"started\") > 0))\n return !1;\n const reader = @getByIdDirectPrivate(stream, \"reader\");\n if (reader && (@getByIdDirectPrivate(reader, \"readRequests\")\?.isNotEmpty() || !!@getByIdDirectPrivate(reader, \"bunNativePtr\")))\n return !0;\n if (@readableStreamHasBYOBReader(stream) && @getByIdDirectPrivate(@getByIdDirectPrivate(stream, \"reader\"), \"readIntoRequests\")\?.isNotEmpty())\n return !0;\n if (@readableByteStreamControllerGetDesiredSize(controller) > 0)\n return !0;\n return !1;\n})\n"; - -// readableStreamAddReadIntoRequest -const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamAddReadIntoRequestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamAddReadIntoRequestCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamAddReadIntoRequestCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableStreamAddReadIntoRequestCodeLength = 198; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableStreamAddReadIntoRequestCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableStreamAddReadIntoRequestCode = "(function (stream) {\"use strict\";\n const readRequest = @newPromise();\n return @getByIdDirectPrivate(@getByIdDirectPrivate(stream, \"reader\"), \"readIntoRequests\").push(readRequest), readRequest;\n})\n"; - -// readableStreamBYOBReaderRead -const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamBYOBReaderReadCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamBYOBReaderReadCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamBYOBReaderReadCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableStreamBYOBReaderReadCodeLength = 402; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableStreamBYOBReaderReadCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableStreamBYOBReaderReadCode = "(function (reader, view) {\"use strict\";\n const stream = @getByIdDirectPrivate(reader, \"ownerReadableStream\");\n if (@putByIdDirectPrivate(stream, \"disturbed\", !0), @getByIdDirectPrivate(stream, \"state\") === 3)\n return @Promise.@reject(@getByIdDirectPrivate(stream, \"storedError\"));\n return @readableByteStreamControllerPullInto(@getByIdDirectPrivate(stream, \"readableStreamController\"), view);\n})\n"; - -// readableStreamByteStreamControllerStart -const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeLength = 99; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCode = "(function (controller) {\"use strict\";\n @putByIdDirectPrivate(controller, \"start\", @undefined);\n})\n"; - -// readableStreamFulfillReadIntoRequest -const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamFulfillReadIntoRequestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamFulfillReadIntoRequestCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamFulfillReadIntoRequestCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableStreamFulfillReadIntoRequestCodeLength = 228; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableStreamFulfillReadIntoRequestCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableStreamFulfillReadIntoRequestCode = "(function (stream, chunk, done) {\"use strict\";\n const readIntoRequest = @getByIdDirectPrivate(@getByIdDirectPrivate(stream, \"reader\"), \"readIntoRequests\").shift();\n @fulfillPromise(readIntoRequest, { value: chunk, done });\n})\n"; - -// readableStreamHasBYOBReader -const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamHasBYOBReaderCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamHasBYOBReaderCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamHasBYOBReaderCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableStreamHasBYOBReaderCodeLength = 166; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableStreamHasBYOBReaderCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableStreamHasBYOBReaderCode = "(function (stream) {\"use strict\";\n const reader = @getByIdDirectPrivate(stream, \"reader\");\n return reader !== @undefined && @isReadableStreamBYOBReader(reader);\n})\n"; - -// readableStreamHasDefaultReader -const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamHasDefaultReaderCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamHasDefaultReaderCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamHasDefaultReaderCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableStreamHasDefaultReaderCodeLength = 169; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableStreamHasDefaultReaderCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableStreamHasDefaultReaderCode = "(function (stream) {\"use strict\";\n const reader = @getByIdDirectPrivate(stream, \"reader\");\n return reader !== @undefined && @isReadableStreamDefaultReader(reader);\n})\n"; - -// readableStreamReaderKind -const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamReaderKindCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamReaderKindCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamReaderKindCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableStreamReaderKindCodeLength = 239; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableStreamReaderKindCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableStreamReaderKindCode = "(function (reader) {\"use strict\";\n if (@getByIdDirectPrivate(reader, \"readRequests\"))\n return @getByIdDirectPrivate(reader, \"bunNativePtr\") \? 3 : 1;\n if (@getByIdDirectPrivate(reader, \"readIntoRequests\"))\n return 2;\n return 0;\n})\n"; - -// transferBufferToCurrentRealm -const JSC::ConstructAbility s_readableByteStreamInternalsTransferBufferToCurrentRealmCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsTransferBufferToCurrentRealmCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsTransferBufferToCurrentRealmCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsTransferBufferToCurrentRealmCodeLength = 54; -static const JSC::Intrinsic s_readableByteStreamInternalsTransferBufferToCurrentRealmCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsTransferBufferToCurrentRealmCode = "(function (buffer) {\"use strict\";\n return buffer;\n})\n"; - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast(vm.clientData); \ - return clientData->builtinFunctions().readableByteStreamInternalsBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().readableByteStreamInternalsBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - -/* ReadableStream.ts */ -// cancel -const JSC::ConstructAbility s_readableStreamCancelCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamCancelCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamCancelCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamCancelCodeLength = 302; -static const JSC::Intrinsic s_readableStreamCancelCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamCancelCode = "(function (reason) {\"use strict\";\n if (!@isReadableStream(this))\n return @Promise.@reject(@makeThisTypeError(\"ReadableStream\", \"cancel\"));\n if (@isReadableStreamLocked(this))\n return @Promise.@reject(@makeTypeError(\"ReadableStream is locked\"));\n return @readableStreamCancel(this, reason);\n})\n"; - -// consumeReadableStream -const JSC::ConstructAbility s_readableStreamConsumeReadableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamConsumeReadableStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamConsumeReadableStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Private; -const int s_readableStreamConsumeReadableStreamCodeLength = 2830; -static const JSC::Intrinsic s_readableStreamConsumeReadableStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamConsumeReadableStreamCode = "(function (nativePtr, nativeType, inputStream) {\"use strict\";\n const symbol = globalThis.Symbol.for(\"Bun.consumeReadableStreamPrototype\");\n var cached = globalThis[symbol];\n if (!cached)\n cached = globalThis[symbol] = [];\n var Prototype = cached[nativeType];\n if (Prototype === @undefined) {\n var [doRead, doError, doReadMany, doClose, onClose, deinit] = @lazy(nativeType);\n Prototype = class NativeReadableStreamSink {\n handleError;\n handleClosed;\n processResult;\n constructor(reader, ptr) {\n this.#ptr = ptr, this.#reader = reader, this.#didClose = !1, this.handleError = this._handleError.bind(this), this.handleClosed = this._handleClosed.bind(this), this.processResult = this._processResult.bind(this), reader.closed.then(this.handleClosed, this.handleError);\n }\n _handleClosed() {\n if (this.#didClose)\n return;\n this.#didClose = !0;\n var ptr = this.#ptr;\n this.#ptr = 0, doClose(ptr), deinit(ptr);\n }\n _handleError(error) {\n if (this.#didClose)\n return;\n this.#didClose = !0;\n var ptr = this.#ptr;\n this.#ptr = 0, doError(ptr, error), deinit(ptr);\n }\n #ptr;\n #didClose = !1;\n #reader;\n _handleReadMany({ value, done, size }) {\n if (done) {\n this.handleClosed();\n return;\n }\n if (this.#didClose)\n return;\n doReadMany(this.#ptr, value, done, size);\n }\n read() {\n if (!this.#ptr)\n return @throwTypeError(\"ReadableStreamSink is already closed\");\n return this.processResult(this.#reader.read());\n }\n _processResult(result) {\n if (result && @isPromise(result)) {\n if (@getPromiseInternalField(result, @promiseFieldFlags) & @promiseStateFulfilled) {\n const fulfilledValue = @getPromiseInternalField(result, @promiseFieldReactionsOrResult);\n if (fulfilledValue)\n result = fulfilledValue;\n }\n }\n if (result && @isPromise(result))\n return result.then(this.processResult, this.handleError), null;\n if (result.done)\n return this.handleClosed(), 0;\n else if (result.value)\n return result.value;\n else\n return -1;\n }\n readMany() {\n if (!this.#ptr)\n return @throwTypeError(\"ReadableStreamSink is already closed\");\n return this.processResult(this.#reader.readMany());\n }\n };\n const minlength = nativeType + 1;\n if (cached.length < minlength)\n cached.length = minlength;\n @putByValDirect(cached, nativeType, Prototype);\n }\n if (@isReadableStreamLocked(inputStream))\n @throwTypeError(\"Cannot start reading from a locked stream\");\n return new Prototype(inputStream.getReader(), nativePtr);\n})\n"; - -// createEmptyReadableStream -const JSC::ConstructAbility s_readableStreamCreateEmptyReadableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamCreateEmptyReadableStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamCreateEmptyReadableStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Private; -const int s_readableStreamCreateEmptyReadableStreamCodeLength = 140; -static const JSC::Intrinsic s_readableStreamCreateEmptyReadableStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamCreateEmptyReadableStreamCode = "(function () {\"use strict\";\n var stream = new @ReadableStream({\n pull() {\n }\n });\n return @readableStreamClose(stream), stream;\n})\n"; - -// createNativeReadableStream -const JSC::ConstructAbility s_readableStreamCreateNativeReadableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamCreateNativeReadableStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamCreateNativeReadableStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Private; -const int s_readableStreamCreateNativeReadableStreamCodeLength = 215; -static const JSC::Intrinsic s_readableStreamCreateNativeReadableStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamCreateNativeReadableStreamCode = "(function (nativePtr, nativeType, autoAllocateChunkSize) {\"use strict\";\n return new @ReadableStream({\n @lazy: !0,\n @bunNativeType: nativeType,\n @bunNativePtr: nativePtr,\n autoAllocateChunkSize\n });\n})\n"; - -// createUsedReadableStream -const JSC::ConstructAbility s_readableStreamCreateUsedReadableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamCreateUsedReadableStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamCreateUsedReadableStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Private; -const int s_readableStreamCreateUsedReadableStreamCodeLength = 130; -static const JSC::Intrinsic s_readableStreamCreateUsedReadableStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamCreateUsedReadableStreamCode = "(function () {\"use strict\";\n var stream = new @ReadableStream({\n pull() {\n }\n });\n return stream.getReader(), stream;\n})\n"; - -// getReader -const JSC::ConstructAbility s_readableStreamGetReaderCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamGetReaderCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamGetReaderCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamGetReaderCodeLength = 580; -static const JSC::Intrinsic s_readableStreamGetReaderCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamGetReaderCode = "(function (options) {\"use strict\";\n if (!@isReadableStream(this))\n throw @makeThisTypeError(\"ReadableStream\", \"getReader\");\n const mode = @toDictionary(options, {}, \"ReadableStream.getReader takes an object as first argument\").mode;\n if (mode === @undefined) {\n var start_ = @getByIdDirectPrivate(this, \"start\");\n if (start_)\n @putByIdDirectPrivate(this, \"start\", @undefined), start_();\n return new @ReadableStreamDefaultReader(this);\n }\n if (mode == \"byob\")\n return new @ReadableStreamBYOBReader(this);\n @throwTypeError(\"Invalid mode is specified\");\n})\n"; - -// initializeReadableStream -const JSC::ConstructAbility s_readableStreamInitializeReadableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInitializeReadableStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInitializeReadableStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInitializeReadableStreamCodeLength = 2962; -static const JSC::Intrinsic s_readableStreamInitializeReadableStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInitializeReadableStreamCode = "(function (underlyingSource, strategy) {\"use strict\";\n if (underlyingSource === @undefined)\n underlyingSource = { @bunNativeType: 0, @bunNativePtr: 0, @lazy: !1 };\n if (strategy === @undefined)\n strategy = {};\n if (!@isObject(underlyingSource))\n @throwTypeError(\"ReadableStream constructor takes an object as first argument\");\n if (strategy !== @undefined && !@isObject(strategy))\n @throwTypeError(\"ReadableStream constructor takes an object as second argument, if any\");\n @putByIdDirectPrivate(this, \"state\", 4), @putByIdDirectPrivate(this, \"reader\", @undefined), @putByIdDirectPrivate(this, \"storedError\", @undefined), @putByIdDirectPrivate(this, \"disturbed\", !1), @putByIdDirectPrivate(this, \"readableStreamController\", null), @putByIdDirectPrivate(this, \"bunNativeType\", @getByIdDirectPrivate(underlyingSource, \"bunNativeType\") \?\? 0), @putByIdDirectPrivate(this, \"bunNativePtr\", @getByIdDirectPrivate(underlyingSource, \"bunNativePtr\") \?\? 0), @putByIdDirectPrivate(this, \"asyncContext\", @getInternalField(@asyncContext, 0));\n const isDirect = underlyingSource.type === \"direct\", isUnderlyingSourceLazy = !!underlyingSource.@lazy, isLazy = isDirect || isUnderlyingSourceLazy;\n if (@getByIdDirectPrivate(underlyingSource, \"pull\") !== @undefined && !isLazy) {\n const size = @getByIdDirectPrivate(strategy, \"size\"), highWaterMark = @getByIdDirectPrivate(strategy, \"highWaterMark\");\n return @putByIdDirectPrivate(this, \"highWaterMark\", highWaterMark), @putByIdDirectPrivate(this, \"underlyingSource\", @undefined), @setupReadableStreamDefaultController(this, underlyingSource, size, highWaterMark !== @undefined \? highWaterMark : 1, @getByIdDirectPrivate(underlyingSource, \"start\"), @getByIdDirectPrivate(underlyingSource, \"pull\"), @getByIdDirectPrivate(underlyingSource, \"cancel\")), this;\n }\n if (isDirect)\n @putByIdDirectPrivate(this, \"underlyingSource\", underlyingSource), @putByIdDirectPrivate(this, \"highWaterMark\", @getByIdDirectPrivate(strategy, \"highWaterMark\")), @putByIdDirectPrivate(this, \"start\", () => @createReadableStreamController(this, underlyingSource, strategy));\n else if (isLazy) {\n const autoAllocateChunkSize = underlyingSource.autoAllocateChunkSize;\n @putByIdDirectPrivate(this, \"highWaterMark\", @undefined), @putByIdDirectPrivate(this, \"underlyingSource\", @undefined), @putByIdDirectPrivate(this, \"highWaterMark\", autoAllocateChunkSize || @getByIdDirectPrivate(strategy, \"highWaterMark\")), @putByIdDirectPrivate(this, \"start\", () => {\n const instance = @lazyLoadStream(this, autoAllocateChunkSize);\n if (instance)\n @createReadableStreamController(this, instance, strategy);\n });\n } else\n @putByIdDirectPrivate(this, \"underlyingSource\", @undefined), @putByIdDirectPrivate(this, \"highWaterMark\", @getByIdDirectPrivate(strategy, \"highWaterMark\")), @putByIdDirectPrivate(this, \"start\", @undefined), @createReadableStreamController(this, underlyingSource, strategy);\n return this;\n})\n"; - -// lazyAsyncIterator -const JSC::ConstructAbility s_readableStreamLazyAsyncIteratorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamLazyAsyncIteratorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamLazyAsyncIteratorCodeImplementationVisibility = JSC::ImplementationVisibility::Private; -const int s_readableStreamLazyAsyncIteratorCodeLength = 188; -static const JSC::Intrinsic s_readableStreamLazyAsyncIteratorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamLazyAsyncIteratorCode = "(function () {\"use strict\";\n var prototype = @ReadableStream.prototype;\n return @readableStreamDefineLazyIterators(prototype), prototype[globalThis.Symbol.asyncIterator].@call(this);\n})\n"; - -// locked -const JSC::ConstructAbility s_readableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamLockedCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamLockedCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamLockedCodeLength = 163; -static const JSC::Intrinsic s_readableStreamLockedCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamLockedCode = "(function () {\"use strict\";\n if (!@isReadableStream(this))\n throw @makeGetterTypeError(\"ReadableStream\", \"locked\");\n return @isReadableStreamLocked(this);\n})\n"; - -// pipeThrough -const JSC::ConstructAbility s_readableStreamPipeThroughCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamPipeThroughCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamPipeThroughCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamPipeThroughCodeLength = 1300; -static const JSC::Intrinsic s_readableStreamPipeThroughCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamPipeThroughCode = "(function (streams, options) {\"use strict\";\n const transforms = streams, readable = transforms.readable;\n if (!@isReadableStream(readable))\n throw @makeTypeError(\"readable should be ReadableStream\");\n const writable = transforms.writable, internalWritable = @getInternalWritableStream(writable);\n if (!@isWritableStream(internalWritable))\n throw @makeTypeError(\"writable should be WritableStream\");\n let preventClose = !1, preventAbort = !1, preventCancel = !1, signal;\n if (!@isUndefinedOrNull(options)) {\n if (!@isObject(options))\n throw @makeTypeError(\"options must be an object\");\n if (preventAbort = !!options.preventAbort, preventCancel = !!options.preventCancel, preventClose = !!options.preventClose, signal = options.signal, signal !== @undefined && !@isAbortSignal(signal))\n throw @makeTypeError(\"options.signal must be AbortSignal\");\n }\n if (!@isReadableStream(this))\n throw @makeThisTypeError(\"ReadableStream\", \"pipeThrough\");\n if (@isReadableStreamLocked(this))\n throw @makeTypeError(\"ReadableStream is locked\");\n if (@isWritableStreamLocked(internalWritable))\n throw @makeTypeError(\"WritableStream is locked\");\n return @readableStreamPipeToWritableStream(this, internalWritable, preventClose, preventAbort, preventCancel, signal), readable;\n})\n"; - -// pipeTo -const JSC::ConstructAbility s_readableStreamPipeToCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamPipeToCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamPipeToCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamPipeToCodeLength = 1328; -static const JSC::Intrinsic s_readableStreamPipeToCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamPipeToCode = "(function (destination) {\"use strict\";\n if (!@isReadableStream(this))\n return @Promise.@reject(@makeThisTypeError(\"ReadableStream\", \"pipeTo\"));\n if (@isReadableStreamLocked(this))\n return @Promise.@reject(@makeTypeError(\"ReadableStream is locked\"));\n let options = @argument(1), preventClose = !1, preventAbort = !1, preventCancel = !1, signal;\n if (!@isUndefinedOrNull(options)) {\n if (!@isObject(options))\n return @Promise.@reject(@makeTypeError(\"options must be an object\"));\n try {\n preventAbort = !!options.preventAbort, preventCancel = !!options.preventCancel, preventClose = !!options.preventClose, signal = options.signal;\n } catch (e) {\n return @Promise.@reject(e);\n }\n if (signal !== @undefined && !@isAbortSignal(signal))\n return @Promise.@reject(@makeTypeError(\"options.signal must be AbortSignal\"));\n }\n const internalDestination = @getInternalWritableStream(destination);\n if (!@isWritableStream(internalDestination))\n return @Promise.@reject(@makeTypeError(\"ReadableStream pipeTo requires a WritableStream\"));\n if (@isWritableStreamLocked(internalDestination))\n return @Promise.@reject(@makeTypeError(\"WritableStream is locked\"));\n return @readableStreamPipeToWritableStream(this, internalDestination, preventClose, preventAbort, preventCancel, signal);\n})\n"; - -// readableStreamToArray -const JSC::ConstructAbility s_readableStreamReadableStreamToArrayCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamReadableStreamToArrayCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamReadableStreamToArrayCodeImplementationVisibility = JSC::ImplementationVisibility::Private; -const int s_readableStreamReadableStreamToArrayCodeLength = 262; -static const JSC::Intrinsic s_readableStreamReadableStreamToArrayCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamReadableStreamToArrayCode = "(function (stream) {\"use strict\";\n var underlyingSource = @getByIdDirectPrivate(stream, \"underlyingSource\");\n if (underlyingSource !== @undefined)\n return @readableStreamToArrayDirect(stream, underlyingSource);\n return @readableStreamIntoArray(stream);\n})\n"; - -// readableStreamToArrayBuffer -const JSC::ConstructAbility s_readableStreamReadableStreamToArrayBufferCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamReadableStreamToArrayBufferCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamReadableStreamToArrayBufferCodeImplementationVisibility = JSC::ImplementationVisibility::Private; -const int s_readableStreamReadableStreamToArrayBufferCodeLength = 390; -static const JSC::Intrinsic s_readableStreamReadableStreamToArrayBufferCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamReadableStreamToArrayBufferCode = "(function (stream) {\"use strict\";\n var underlyingSource = @getByIdDirectPrivate(stream, \"underlyingSource\");\n if (underlyingSource !== @undefined)\n return @readableStreamToArrayBufferDirect(stream, underlyingSource);\n var result = Bun.readableStreamToArray(stream);\n if (@isPromise(result))\n return result.then(Bun.concatArrayBuffers);\n return Bun.concatArrayBuffers(result);\n})\n"; - -// readableStreamToBlob -const JSC::ConstructAbility s_readableStreamReadableStreamToBlobCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamReadableStreamToBlobCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamReadableStreamToBlobCodeImplementationVisibility = JSC::ImplementationVisibility::Private; -const int s_readableStreamReadableStreamToBlobCodeLength = 133; -static const JSC::Intrinsic s_readableStreamReadableStreamToBlobCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamReadableStreamToBlobCode = "(function (stream) {\"use strict\";\n return @Promise.resolve(Bun.readableStreamToArray(stream)).@then((array) => new Blob(array));\n})\n"; - -// readableStreamToFormData -const JSC::ConstructAbility s_readableStreamReadableStreamToFormDataCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamReadableStreamToFormDataCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamReadableStreamToFormDataCodeImplementationVisibility = JSC::ImplementationVisibility::Private; -const int s_readableStreamReadableStreamToFormDataCodeLength = 160; -static const JSC::Intrinsic s_readableStreamReadableStreamToFormDataCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamReadableStreamToFormDataCode = "(function (stream, contentType) {\"use strict\";\n return Bun.readableStreamToBlob(stream).then((blob) => {\n return FormData.from(blob, contentType);\n });\n})\n"; - -// readableStreamToJSON -const JSC::ConstructAbility s_readableStreamReadableStreamToJSONCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamReadableStreamToJSONCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamReadableStreamToJSONCodeImplementationVisibility = JSC::ImplementationVisibility::Private; -const int s_readableStreamReadableStreamToJSONCodeLength = 109; -static const JSC::Intrinsic s_readableStreamReadableStreamToJSONCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamReadableStreamToJSONCode = "(function (stream) {\"use strict\";\n return Bun.readableStreamToText(stream).@then(globalThis.JSON.parse);\n})\n"; - -// readableStreamToText -const JSC::ConstructAbility s_readableStreamReadableStreamToTextCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamReadableStreamToTextCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamReadableStreamToTextCodeImplementationVisibility = JSC::ImplementationVisibility::Private; -const int s_readableStreamReadableStreamToTextCodeLength = 260; -static const JSC::Intrinsic s_readableStreamReadableStreamToTextCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamReadableStreamToTextCode = "(function (stream) {\"use strict\";\n var underlyingSource = @getByIdDirectPrivate(stream, \"underlyingSource\");\n if (underlyingSource !== @undefined)\n return @readableStreamToTextDirect(stream, underlyingSource);\n return @readableStreamIntoText(stream);\n})\n"; - -// tee -const JSC::ConstructAbility s_readableStreamTeeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamTeeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamTeeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamTeeCodeLength = 157; -static const JSC::Intrinsic s_readableStreamTeeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamTeeCode = "(function () {\"use strict\";\n if (!@isReadableStream(this))\n throw @makeThisTypeError(\"ReadableStream\", \"tee\");\n return @readableStreamTee(this, !1);\n})\n"; - -// values -const JSC::ConstructAbility s_readableStreamValuesCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamValuesCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamValuesCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamValuesCodeLength = 178; -static const JSC::Intrinsic s_readableStreamValuesCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamValuesCode = "(function (options) {\"use strict\";\n var prototype = @ReadableStream.prototype;\n return @readableStreamDefineLazyIterators(prototype), prototype.values.@call(this, options);\n})\n"; - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast(vm.clientData); \ - return clientData->builtinFunctions().readableStreamBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().readableStreamBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_READABLESTREAM_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - -/* ReadableStreamBYOBReader.ts */ -// cancel -const JSC::ConstructAbility s_readableStreamBYOBReaderCancelCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamBYOBReaderCancelCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamBYOBReaderCancelCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamBYOBReaderCancelCodeLength = 388; -static const JSC::Intrinsic s_readableStreamBYOBReaderCancelCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamBYOBReaderCancelCode = "(function (reason) {\"use strict\";\n if (!@isReadableStreamBYOBReader(this))\n return @Promise.@reject(@makeThisTypeError(\"ReadableStreamBYOBReader\", \"cancel\"));\n if (!@getByIdDirectPrivate(this, \"ownerReadableStream\"))\n return @Promise.@reject(@makeTypeError(\"cancel() called on a reader owned by no readable stream\"));\n return @readableStreamReaderGenericCancel(this, reason);\n})\n"; - -// closed -const JSC::ConstructAbility s_readableStreamBYOBReaderClosedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamBYOBReaderClosedCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamBYOBReaderClosedCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamBYOBReaderClosedCodeLength = 235; -static const JSC::Intrinsic s_readableStreamBYOBReaderClosedCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamBYOBReaderClosedCode = "(function () {\"use strict\";\n if (!@isReadableStreamBYOBReader(this))\n return @Promise.@reject(@makeGetterTypeError(\"ReadableStreamBYOBReader\", \"closed\"));\n return @getByIdDirectPrivate(this, \"closedPromiseCapability\").promise;\n})\n"; - -// initializeReadableStreamBYOBReader -const JSC::ConstructAbility s_readableStreamBYOBReaderInitializeReadableStreamBYOBReaderCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamBYOBReaderInitializeReadableStreamBYOBReaderCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamBYOBReaderInitializeReadableStreamBYOBReaderCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamBYOBReaderInitializeReadableStreamBYOBReaderCodeLength = 549; -static const JSC::Intrinsic s_readableStreamBYOBReaderInitializeReadableStreamBYOBReaderCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamBYOBReaderInitializeReadableStreamBYOBReaderCode = "(function (stream) {\"use strict\";\n if (!@isReadableStream(stream))\n @throwTypeError(\"ReadableStreamBYOBReader needs a ReadableStream\");\n if (!@isReadableByteStreamController(@getByIdDirectPrivate(stream, \"readableStreamController\")))\n @throwTypeError(\"ReadableStreamBYOBReader needs a ReadableByteStreamController\");\n if (@isReadableStreamLocked(stream))\n @throwTypeError(\"ReadableStream is locked\");\n return @readableStreamReaderGenericInitialize(this, stream), @putByIdDirectPrivate(this, \"readIntoRequests\", @createFIFO()), this;\n})\n"; - -// read -const JSC::ConstructAbility s_readableStreamBYOBReaderReadCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamBYOBReaderReadCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamBYOBReaderReadCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamBYOBReaderReadCodeLength = 719; -static const JSC::Intrinsic s_readableStreamBYOBReaderReadCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamBYOBReaderReadCode = "(function (view) {\"use strict\";\n if (!@isReadableStreamBYOBReader(this))\n return @Promise.@reject(@makeThisTypeError(\"ReadableStreamBYOBReader\", \"read\"));\n if (!@getByIdDirectPrivate(this, \"ownerReadableStream\"))\n return @Promise.@reject(@makeTypeError(\"read() called on a reader owned by no readable stream\"));\n if (!@isObject(view))\n return @Promise.@reject(@makeTypeError(\"Provided view is not an object\"));\n if (!@ArrayBuffer.@isView(view))\n return @Promise.@reject(@makeTypeError(\"Provided view is not an ArrayBufferView\"));\n if (view.byteLength === 0)\n return @Promise.@reject(@makeTypeError(\"Provided view cannot have a 0 byteLength\"));\n return @readableStreamBYOBReaderRead(this, view);\n})\n"; - -// releaseLock -const JSC::ConstructAbility s_readableStreamBYOBReaderReleaseLockCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamBYOBReaderReleaseLockCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamBYOBReaderReleaseLockCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamBYOBReaderReleaseLockCodeLength = 418; -static const JSC::Intrinsic s_readableStreamBYOBReaderReleaseLockCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamBYOBReaderReleaseLockCode = "(function () {\"use strict\";\n if (!@isReadableStreamBYOBReader(this))\n throw @makeThisTypeError(\"ReadableStreamBYOBReader\", \"releaseLock\");\n if (!@getByIdDirectPrivate(this, \"ownerReadableStream\"))\n return;\n if (@getByIdDirectPrivate(this, \"readIntoRequests\")\?.isNotEmpty())\n @throwTypeError(\"There are still pending read requests, cannot release the lock\");\n @readableStreamReaderGenericRelease(this);\n})\n"; - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast(vm.clientData); \ - return clientData->builtinFunctions().readableStreamBYOBReaderBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().readableStreamBYOBReaderBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_READABLESTREAMBYOBREADER_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - -/* ReadableStreamBYOBRequest.ts */ -// initializeReadableStreamBYOBRequest -const JSC::ConstructAbility s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCodeLength = 291; -static const JSC::Intrinsic s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCode = "(function (controller, view) {\"use strict\";\n if (arguments.length !== 3 && arguments[2] !== @isReadableStream)\n @throwTypeError(\"ReadableStreamBYOBRequest constructor should not be called directly\");\n return @privateInitializeReadableStreamBYOBRequest.@call(this, controller, view);\n})\n"; - -// respond -const JSC::ConstructAbility s_readableStreamBYOBRequestRespondCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamBYOBRequestRespondCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamBYOBRequestRespondCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamBYOBRequestRespondCodeLength = 482; -static const JSC::Intrinsic s_readableStreamBYOBRequestRespondCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamBYOBRequestRespondCode = "(function (bytesWritten) {\"use strict\";\n if (!@isReadableStreamBYOBRequest(this))\n throw @makeThisTypeError(\"ReadableStreamBYOBRequest\", \"respond\");\n if (@getByIdDirectPrivate(this, \"associatedReadableByteStreamController\") === @undefined)\n @throwTypeError(\"ReadableStreamBYOBRequest.associatedReadableByteStreamController is undefined\");\n return @readableByteStreamControllerRespond(@getByIdDirectPrivate(this, \"associatedReadableByteStreamController\"), bytesWritten);\n})\n"; - -// respondWithNewView -const JSC::ConstructAbility s_readableStreamBYOBRequestRespondWithNewViewCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamBYOBRequestRespondWithNewViewCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamBYOBRequestRespondWithNewViewCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamBYOBRequestRespondWithNewViewCodeLength = 655; -static const JSC::Intrinsic s_readableStreamBYOBRequestRespondWithNewViewCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamBYOBRequestRespondWithNewViewCode = "(function (view) {\"use strict\";\n if (!@isReadableStreamBYOBRequest(this))\n throw @makeThisTypeError(\"ReadableStreamBYOBRequest\", \"respond\");\n if (@getByIdDirectPrivate(this, \"associatedReadableByteStreamController\") === @undefined)\n @throwTypeError(\"ReadableStreamBYOBRequest.associatedReadableByteStreamController is undefined\");\n if (!@isObject(view))\n @throwTypeError(\"Provided view is not an object\");\n if (!@ArrayBuffer.@isView(view))\n @throwTypeError(\"Provided view is not an ArrayBufferView\");\n return @readableByteStreamControllerRespondWithNewView(@getByIdDirectPrivate(this, \"associatedReadableByteStreamController\"), view);\n})\n"; - -// view -const JSC::ConstructAbility s_readableStreamBYOBRequestViewCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamBYOBRequestViewCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamBYOBRequestViewCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamBYOBRequestViewCodeLength = 189; -static const JSC::Intrinsic s_readableStreamBYOBRequestViewCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamBYOBRequestViewCode = "(function () {\"use strict\";\n if (!@isReadableStreamBYOBRequest(this))\n throw @makeGetterTypeError(\"ReadableStreamBYOBRequest\", \"view\");\n return @getByIdDirectPrivate(this, \"view\");\n})\n"; - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast(vm.clientData); \ - return clientData->builtinFunctions().readableStreamBYOBRequestBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().readableStreamBYOBRequestBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_READABLESTREAMBYOBREQUEST_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - -/* ReadableStreamDefaultController.ts */ -// close -const JSC::ConstructAbility s_readableStreamDefaultControllerCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamDefaultControllerCloseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamDefaultControllerCloseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamDefaultControllerCloseCodeLength = 362; -static const JSC::Intrinsic s_readableStreamDefaultControllerCloseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamDefaultControllerCloseCode = "(function () {\"use strict\";\n if (!@isReadableStreamDefaultController(this))\n throw @makeThisTypeError(\"ReadableStreamDefaultController\", \"close\");\n if (!@readableStreamDefaultControllerCanCloseOrEnqueue(this))\n @throwTypeError(\"ReadableStreamDefaultController is not in a state where it can be closed\");\n @readableStreamDefaultControllerClose(this);\n})\n"; - -// desiredSize -const JSC::ConstructAbility s_readableStreamDefaultControllerDesiredSizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamDefaultControllerDesiredSizeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamDefaultControllerDesiredSizeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamDefaultControllerDesiredSizeCodeLength = 225; -static const JSC::Intrinsic s_readableStreamDefaultControllerDesiredSizeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamDefaultControllerDesiredSizeCode = "(function () {\"use strict\";\n if (!@isReadableStreamDefaultController(this))\n throw @makeGetterTypeError(\"ReadableStreamDefaultController\", \"desiredSize\");\n return @readableStreamDefaultControllerGetDesiredSize(this);\n})\n"; - -// enqueue -const JSC::ConstructAbility s_readableStreamDefaultControllerEnqueueCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamDefaultControllerEnqueueCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamDefaultControllerEnqueueCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamDefaultControllerEnqueueCodeLength = 390; -static const JSC::Intrinsic s_readableStreamDefaultControllerEnqueueCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamDefaultControllerEnqueueCode = "(function (chunk) {\"use strict\";\n if (!@isReadableStreamDefaultController(this))\n throw @makeThisTypeError(\"ReadableStreamDefaultController\", \"enqueue\");\n if (!@readableStreamDefaultControllerCanCloseOrEnqueue(this))\n @throwTypeError(\"ReadableStreamDefaultController is not in a state where chunk can be enqueued\");\n return @readableStreamDefaultControllerEnqueue(this, chunk);\n})\n"; - -// error -const JSC::ConstructAbility s_readableStreamDefaultControllerErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamDefaultControllerErrorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamDefaultControllerErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamDefaultControllerErrorCodeLength = 209; -static const JSC::Intrinsic s_readableStreamDefaultControllerErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamDefaultControllerErrorCode = "(function (err) {\"use strict\";\n if (!@isReadableStreamDefaultController(this))\n throw @makeThisTypeError(\"ReadableStreamDefaultController\", \"error\");\n @readableStreamDefaultControllerError(this, err);\n})\n"; - -// initializeReadableStreamDefaultController -const JSC::ConstructAbility s_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCodeLength = 361; -static const JSC::Intrinsic s_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCode = "(function (stream, underlyingSource, size, highWaterMark) {\"use strict\";\n if (arguments.length !== 5 && arguments[4] !== @isReadableStream)\n @throwTypeError(\"ReadableStreamDefaultController constructor should not be called directly\");\n return @privateInitializeReadableStreamDefaultController.@call(this, stream, underlyingSource, size, highWaterMark);\n})\n"; - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast(vm.clientData); \ - return clientData->builtinFunctions().readableStreamDefaultControllerBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().readableStreamDefaultControllerBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - -/* ReadableStreamDefaultReader.ts */ -// cancel -const JSC::ConstructAbility s_readableStreamDefaultReaderCancelCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamDefaultReaderCancelCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamDefaultReaderCancelCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamDefaultReaderCancelCodeLength = 394; -static const JSC::Intrinsic s_readableStreamDefaultReaderCancelCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamDefaultReaderCancelCode = "(function (reason) {\"use strict\";\n if (!@isReadableStreamDefaultReader(this))\n return @Promise.@reject(@makeThisTypeError(\"ReadableStreamDefaultReader\", \"cancel\"));\n if (!@getByIdDirectPrivate(this, \"ownerReadableStream\"))\n return @Promise.@reject(@makeTypeError(\"cancel() called on a reader owned by no readable stream\"));\n return @readableStreamReaderGenericCancel(this, reason);\n})\n"; - -// closed -const JSC::ConstructAbility s_readableStreamDefaultReaderClosedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamDefaultReaderClosedCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamDefaultReaderClosedCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamDefaultReaderClosedCodeLength = 241; -static const JSC::Intrinsic s_readableStreamDefaultReaderClosedCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamDefaultReaderClosedCode = "(function () {\"use strict\";\n if (!@isReadableStreamDefaultReader(this))\n return @Promise.@reject(@makeGetterTypeError(\"ReadableStreamDefaultReader\", \"closed\"));\n return @getByIdDirectPrivate(this, \"closedPromiseCapability\").promise;\n})\n"; - -// initializeReadableStreamDefaultReader -const JSC::ConstructAbility s_readableStreamDefaultReaderInitializeReadableStreamDefaultReaderCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamDefaultReaderInitializeReadableStreamDefaultReaderCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamDefaultReaderInitializeReadableStreamDefaultReaderCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamDefaultReaderInitializeReadableStreamDefaultReaderCodeLength = 363; -static const JSC::Intrinsic s_readableStreamDefaultReaderInitializeReadableStreamDefaultReaderCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamDefaultReaderInitializeReadableStreamDefaultReaderCode = "(function (stream) {\"use strict\";\n if (!@isReadableStream(stream))\n @throwTypeError(\"ReadableStreamDefaultReader needs a ReadableStream\");\n if (@isReadableStreamLocked(stream))\n @throwTypeError(\"ReadableStream is locked\");\n return @readableStreamReaderGenericInitialize(this, stream), @putByIdDirectPrivate(this, \"readRequests\", @createFIFO()), this;\n})\n"; - -// read -const JSC::ConstructAbility s_readableStreamDefaultReaderReadCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamDefaultReaderReadCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamDefaultReaderReadCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamDefaultReaderReadCodeLength = 374; -static const JSC::Intrinsic s_readableStreamDefaultReaderReadCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamDefaultReaderReadCode = "(function () {\"use strict\";\n if (!@isReadableStreamDefaultReader(this))\n return @Promise.@reject(@makeThisTypeError(\"ReadableStreamDefaultReader\", \"read\"));\n if (!@getByIdDirectPrivate(this, \"ownerReadableStream\"))\n return @Promise.@reject(@makeTypeError(\"read() called on a reader owned by no readable stream\"));\n return @readableStreamDefaultReaderRead(this);\n})\n"; - -// readMany -const JSC::ConstructAbility s_readableStreamDefaultReaderReadManyCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamDefaultReaderReadManyCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamDefaultReaderReadManyCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamDefaultReaderReadManyCodeLength = 3873; -static const JSC::Intrinsic s_readableStreamDefaultReaderReadManyCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamDefaultReaderReadManyCode = "(function () {\"use strict\";\n if (!@isReadableStreamDefaultReader(this))\n @throwTypeError(\"ReadableStreamDefaultReader.readMany() should not be called directly\");\n const stream = @getByIdDirectPrivate(this, \"ownerReadableStream\");\n if (!stream)\n @throwTypeError(\"readMany() called on a reader owned by no readable stream\");\n const state = @getByIdDirectPrivate(stream, \"state\");\n if (@putByIdDirectPrivate(stream, \"disturbed\", !0), state === 1)\n return { value: [], size: 0, done: !0 };\n else if (state === 3)\n throw @getByIdDirectPrivate(stream, \"storedError\");\n var controller = @getByIdDirectPrivate(stream, \"readableStreamController\"), queue = @getByIdDirectPrivate(controller, \"queue\");\n if (!queue)\n return controller.@pull(controller).@then(function({ done, value }) {\n return done \? { done: !0, value: [], size: 0 } : { value: [value], size: 1, done: !1 };\n });\n const content = queue.content;\n var size = queue.size, values = content.toArray(!1), length = values.length;\n if (length > 0) {\n var outValues = @newArrayWithSize(length);\n if (@isReadableByteStreamController(controller)) {\n {\n const buf = values[0];\n if (!(@ArrayBuffer.@isView(buf) || buf instanceof @ArrayBuffer))\n @putByValDirect(outValues, 0, new @Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength));\n else\n @putByValDirect(outValues, 0, buf);\n }\n for (var i = 1;i < length; i++) {\n const buf = values[i];\n if (!(@ArrayBuffer.@isView(buf) || buf instanceof @ArrayBuffer))\n @putByValDirect(outValues, i, new @Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength));\n else\n @putByValDirect(outValues, i, buf);\n }\n } else {\n @putByValDirect(outValues, 0, values[0].value);\n for (var i = 1;i < length; i++)\n @putByValDirect(outValues, i, values[i].value);\n }\n if (@resetQueue(@getByIdDirectPrivate(controller, \"queue\")), @getByIdDirectPrivate(controller, \"closeRequested\"))\n @readableStreamClose(@getByIdDirectPrivate(controller, \"controlledReadableStream\"));\n else if (@isReadableStreamDefaultController(controller))\n @readableStreamDefaultControllerCallPullIfNeeded(controller);\n else if (@isReadableByteStreamController(controller))\n @readableByteStreamControllerCallPullIfNeeded(controller);\n return { value: outValues, size, done: !1 };\n }\n var onPullMany = (result) => {\n if (result.done)\n return { value: [], size: 0, done: !0 };\n var controller2 = @getByIdDirectPrivate(stream, \"readableStreamController\"), queue2 = @getByIdDirectPrivate(controller2, \"queue\"), value = [result.value].concat(queue2.content.toArray(!1)), length2 = value.length;\n if (@isReadableByteStreamController(controller2))\n for (var i2 = 0;i2 < length2; i2++) {\n const buf = value[i2];\n if (!(@ArrayBuffer.@isView(buf) || buf instanceof @ArrayBuffer)) {\n const { buffer, byteOffset, byteLength } = buf;\n @putByValDirect(value, i2, new @Uint8Array(buffer, byteOffset, byteLength));\n }\n }\n else\n for (var i2 = 1;i2 < length2; i2++)\n @putByValDirect(value, i2, value[i2].value);\n var size2 = queue2.size;\n if (@resetQueue(queue2), @getByIdDirectPrivate(controller2, \"closeRequested\"))\n @readableStreamClose(@getByIdDirectPrivate(controller2, \"controlledReadableStream\"));\n else if (@isReadableStreamDefaultController(controller2))\n @readableStreamDefaultControllerCallPullIfNeeded(controller2);\n else if (@isReadableByteStreamController(controller2))\n @readableByteStreamControllerCallPullIfNeeded(controller2);\n return { value, size: size2, done: !1 };\n }, pullResult = controller.@pull(controller);\n if (pullResult && @isPromise(pullResult))\n return pullResult.@then(onPullMany);\n return onPullMany(pullResult);\n})\n"; - -// releaseLock -const JSC::ConstructAbility s_readableStreamDefaultReaderReleaseLockCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamDefaultReaderReleaseLockCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamDefaultReaderReleaseLockCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamDefaultReaderReleaseLockCodeLength = 420; -static const JSC::Intrinsic s_readableStreamDefaultReaderReleaseLockCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamDefaultReaderReleaseLockCode = "(function () {\"use strict\";\n if (!@isReadableStreamDefaultReader(this))\n throw @makeThisTypeError(\"ReadableStreamDefaultReader\", \"releaseLock\");\n if (!@getByIdDirectPrivate(this, \"ownerReadableStream\"))\n return;\n if (@getByIdDirectPrivate(this, \"readRequests\")\?.isNotEmpty())\n @throwTypeError(\"There are still pending read requests, cannot release the lock\");\n @readableStreamReaderGenericRelease(this);\n})\n"; - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast(vm.clientData); \ - return clientData->builtinFunctions().readableStreamDefaultReaderBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().readableStreamDefaultReaderBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_READABLESTREAMDEFAULTREADER_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - -/* ReadableStreamInternals.ts */ -// acquireReadableStreamDefaultReader -const JSC::ConstructAbility s_readableStreamInternalsAcquireReadableStreamDefaultReaderCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsAcquireReadableStreamDefaultReaderCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsAcquireReadableStreamDefaultReaderCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsAcquireReadableStreamDefaultReaderCodeLength = 180; -static const JSC::Intrinsic s_readableStreamInternalsAcquireReadableStreamDefaultReaderCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsAcquireReadableStreamDefaultReaderCode = "(function (stream) {\"use strict\";\n var start = @getByIdDirectPrivate(stream, \"start\");\n if (start)\n start.@call(stream);\n return new @ReadableStreamDefaultReader(stream);\n})\n"; - -// assignToStream -const JSC::ConstructAbility s_readableStreamInternalsAssignToStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsAssignToStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsAssignToStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Private; -const int s_readableStreamInternalsAssignToStreamCodeLength = 397; -static const JSC::Intrinsic s_readableStreamInternalsAssignToStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsAssignToStreamCode = "(function (stream, sink) {\"use strict\";\n var underlyingSource = @getByIdDirectPrivate(stream, \"underlyingSource\");\n if (underlyingSource)\n try {\n return @readDirectStream(stream, sink, underlyingSource);\n } catch (e) {\n throw e;\n } finally {\n underlyingSource = @undefined, stream = @undefined, sink = @undefined;\n }\n return @readStreamIntoSink(stream, sink, !0);\n})\n"; - -// createReadableStreamController -const JSC::ConstructAbility s_readableStreamInternalsCreateReadableStreamControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsCreateReadableStreamControllerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsCreateReadableStreamControllerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsCreateReadableStreamControllerCodeLength = 1077; -static const JSC::Intrinsic s_readableStreamInternalsCreateReadableStreamControllerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsCreateReadableStreamControllerCode = "(function (stream, underlyingSource, strategy) {\"use strict\";\n const type = underlyingSource.type, typeString = @toString(type);\n if (typeString === \"bytes\") {\n if (strategy.highWaterMark === @undefined)\n strategy.highWaterMark = 0;\n if (strategy.size !== @undefined)\n @throwRangeError(\"Strategy for a ReadableByteStreamController cannot have a size\");\n @putByIdDirectPrivate(stream, \"readableStreamController\", new @ReadableByteStreamController(stream, underlyingSource, strategy.highWaterMark, @isReadableStream));\n } else if (typeString === \"direct\") {\n var highWaterMark = strategy\?.highWaterMark;\n @initializeArrayBufferStream.@call(stream, underlyingSource, highWaterMark);\n } else if (type === @undefined) {\n if (strategy.highWaterMark === @undefined)\n strategy.highWaterMark = 1;\n @setupReadableStreamDefaultController(stream, underlyingSource, strategy.size, strategy.highWaterMark, underlyingSource.start, underlyingSource.pull, underlyingSource.cancel);\n } else\n @throwRangeError(\"Invalid type for underlying source\");\n})\n"; - -// createTextStream -const JSC::ConstructAbility s_readableStreamInternalsCreateTextStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsCreateTextStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsCreateTextStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsCreateTextStreamCodeLength = 2045; -static const JSC::Intrinsic s_readableStreamInternalsCreateTextStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsCreateTextStreamCode = "(function (highWaterMark) {\"use strict\";\n var sink, array = [], hasString = !1, hasBuffer = !1, rope = \"\", estimatedLength = @toLength(0), capability = @newPromiseCapability(@Promise), calledDone = !1;\n return sink = {\n start() {\n },\n write(chunk) {\n if (typeof chunk === \"string\") {\n var chunkLength = @toLength(chunk.length);\n if (chunkLength > 0)\n rope += chunk, hasString = !0, estimatedLength += chunkLength;\n return chunkLength;\n }\n if (!chunk || !(@ArrayBuffer.@isView(chunk) || chunk instanceof @ArrayBuffer))\n @throwTypeError(\"Expected text, ArrayBuffer or ArrayBufferView\");\n const byteLength = @toLength(chunk.byteLength);\n if (byteLength > 0)\n if (hasBuffer = !0, rope.length > 0)\n @arrayPush(array, rope), @arrayPush(array, chunk), rope = \"\";\n else\n @arrayPush(array, chunk);\n return estimatedLength += byteLength, byteLength;\n },\n flush() {\n return 0;\n },\n end() {\n if (calledDone)\n return \"\";\n return sink.fulfill();\n },\n fulfill() {\n calledDone = !0;\n const result = sink.finishInternal();\n return @fulfillPromise(capability.promise, result), result;\n },\n finishInternal() {\n if (!hasString && !hasBuffer)\n return \"\";\n if (hasString && !hasBuffer)\n return rope;\n if (hasBuffer && !hasString)\n return new globalThis.TextDecoder().decode(Bun.concatArrayBuffers(array));\n var arrayBufferSink = new Bun.ArrayBufferSink;\n arrayBufferSink.start({\n highWaterMark: estimatedLength,\n asUint8Array: !0\n });\n for (let item of array)\n arrayBufferSink.write(item);\n if (array.length = 0, rope.length > 0)\n arrayBufferSink.write(rope), rope = \"\";\n return new globalThis.TextDecoder().decode(arrayBufferSink.end());\n },\n close() {\n try {\n if (!calledDone)\n calledDone = !0, sink.fulfill();\n } catch (e) {\n }\n }\n }, [sink, capability];\n})\n"; - -// handleDirectStreamError -const JSC::ConstructAbility s_readableStreamInternalsHandleDirectStreamErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsHandleDirectStreamErrorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsHandleDirectStreamErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsHandleDirectStreamErrorCodeLength = 735; -static const JSC::Intrinsic s_readableStreamInternalsHandleDirectStreamErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsHandleDirectStreamErrorCode = "(function (e) {\"use strict\";\n var controller = this, sink = controller.@sink;\n if (sink) {\n @putByIdDirectPrivate(controller, \"sink\", @undefined);\n try {\n sink.close(e);\n } catch (f) {\n }\n }\n if (this.error = this.flush = this.write = this.close = this.end = @onReadableStreamDirectControllerClosed, typeof this.@underlyingSource.close === \"function\")\n try {\n this.@underlyingSource.close.@call(this.@underlyingSource, e);\n } catch (e2) {\n }\n try {\n var pend = controller._pendingRead;\n if (pend)\n controller._pendingRead = @undefined, @rejectPromise(pend, e);\n } catch (f) {\n }\n var stream = controller.@controlledReadableStream;\n if (stream)\n @readableStreamError(stream, e);\n})\n"; - -// handleDirectStreamErrorReject -const JSC::ConstructAbility s_readableStreamInternalsHandleDirectStreamErrorRejectCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsHandleDirectStreamErrorRejectCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsHandleDirectStreamErrorRejectCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsHandleDirectStreamErrorRejectCodeLength = 103; -static const JSC::Intrinsic s_readableStreamInternalsHandleDirectStreamErrorRejectCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsHandleDirectStreamErrorRejectCode = "(function (e) {\"use strict\";\n return @handleDirectStreamError.@call(this, e), @Promise.@reject(e);\n})\n"; - -// initializeArrayBufferStream -const JSC::ConstructAbility s_readableStreamInternalsInitializeArrayBufferStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsInitializeArrayBufferStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsInitializeArrayBufferStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsInitializeArrayBufferStreamCodeLength = 935; -static const JSC::Intrinsic s_readableStreamInternalsInitializeArrayBufferStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsInitializeArrayBufferStreamCode = "(function (underlyingSource, highWaterMark) {\"use strict\";\n var opts = highWaterMark && typeof highWaterMark === \"number\" \? { highWaterMark, stream: !0, asUint8Array: !0 } : { stream: !0, asUint8Array: !0 }, sink = new Bun.ArrayBufferSink;\n sink.start(opts);\n var controller = {\n @underlyingSource: underlyingSource,\n @pull: @onPullDirectStream,\n @controlledReadableStream: this,\n @sink: sink,\n close: @onCloseDirectStream,\n write: sink.write.bind(sink),\n error: @handleDirectStreamError,\n end: @onCloseDirectStream,\n @close: @onCloseDirectStream,\n flush: @onFlushDirectStream,\n _pendingRead: @undefined,\n _deferClose: 0,\n _deferFlush: 0,\n _deferCloseReason: @undefined,\n _handleError: @undefined\n };\n @putByIdDirectPrivate(this, \"readableStreamController\", controller), @putByIdDirectPrivate(this, \"underlyingSource\", @undefined), @putByIdDirectPrivate(this, \"start\", @undefined);\n})\n"; - -// initializeArrayStream -const JSC::ConstructAbility s_readableStreamInternalsInitializeArrayStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsInitializeArrayStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsInitializeArrayStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsInitializeArrayStreamCodeLength = 1258; -static const JSC::Intrinsic s_readableStreamInternalsInitializeArrayStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsInitializeArrayStreamCode = "(function (underlyingSource, highWaterMark) {\"use strict\";\n var array = [], closingPromise = @newPromiseCapability(@Promise), calledDone = !1;\n function fulfill() {\n return calledDone = !0, closingPromise.resolve.@call(@undefined, array), array;\n }\n var sink = {\n start() {\n },\n write(chunk) {\n return @arrayPush(array, chunk), chunk.byteLength || chunk.length;\n },\n flush() {\n return 0;\n },\n end() {\n if (calledDone)\n return [];\n return fulfill();\n },\n close() {\n if (!calledDone)\n fulfill();\n }\n }, controller = {\n @underlyingSource: underlyingSource,\n @pull: @onPullDirectStream,\n @controlledReadableStream: this,\n @sink: sink,\n close: @onCloseDirectStream,\n write: sink.write,\n error: @handleDirectStreamError,\n end: @onCloseDirectStream,\n @close: @onCloseDirectStream,\n flush: @onFlushDirectStream,\n _pendingRead: @undefined,\n _deferClose: 0,\n _deferFlush: 0,\n _deferCloseReason: @undefined,\n _handleError: @undefined\n };\n return @putByIdDirectPrivate(this, \"readableStreamController\", controller), @putByIdDirectPrivate(this, \"underlyingSource\", @undefined), @putByIdDirectPrivate(this, \"start\", @undefined), closingPromise;\n})\n"; - -// initializeTextStream -const JSC::ConstructAbility s_readableStreamInternalsInitializeTextStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsInitializeTextStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsInitializeTextStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsInitializeTextStreamCodeLength = 804; -static const JSC::Intrinsic s_readableStreamInternalsInitializeTextStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsInitializeTextStreamCode = "(function (underlyingSource, highWaterMark) {\"use strict\";\n var [sink, closingPromise] = @createTextStream(highWaterMark), controller = {\n @underlyingSource: underlyingSource,\n @pull: @onPullDirectStream,\n @controlledReadableStream: this,\n @sink: sink,\n close: @onCloseDirectStream,\n write: sink.write,\n error: @handleDirectStreamError,\n end: @onCloseDirectStream,\n @close: @onCloseDirectStream,\n flush: @onFlushDirectStream,\n _pendingRead: @undefined,\n _deferClose: 0,\n _deferFlush: 0,\n _deferCloseReason: @undefined,\n _handleError: @undefined\n };\n return @putByIdDirectPrivate(this, \"readableStreamController\", controller), @putByIdDirectPrivate(this, \"underlyingSource\", @undefined), @putByIdDirectPrivate(this, \"start\", @undefined), closingPromise;\n})\n"; - -// isReadableStream -const JSC::ConstructAbility s_readableStreamInternalsIsReadableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsIsReadableStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsIsReadableStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsIsReadableStreamCodeLength = 141; -static const JSC::Intrinsic s_readableStreamInternalsIsReadableStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsIsReadableStreamCode = "(function (stream) {\"use strict\";\n return @isObject(stream) && @getByIdDirectPrivate(stream, \"readableStreamController\") !== @undefined;\n})\n"; - -// isReadableStreamDefaultController -const JSC::ConstructAbility s_readableStreamInternalsIsReadableStreamDefaultControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsIsReadableStreamDefaultControllerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsIsReadableStreamDefaultControllerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsIsReadableStreamDefaultControllerCodeLength = 132; -static const JSC::Intrinsic s_readableStreamInternalsIsReadableStreamDefaultControllerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsIsReadableStreamDefaultControllerCode = "(function (controller) {\"use strict\";\n return @isObject(controller) && !!@getByIdDirectPrivate(controller, \"underlyingSource\");\n})\n"; - -// isReadableStreamDefaultReader -const JSC::ConstructAbility s_readableStreamInternalsIsReadableStreamDefaultReaderCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsIsReadableStreamDefaultReaderCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsIsReadableStreamDefaultReaderCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsIsReadableStreamDefaultReaderCodeLength = 116; -static const JSC::Intrinsic s_readableStreamInternalsIsReadableStreamDefaultReaderCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsIsReadableStreamDefaultReaderCode = "(function (reader) {\"use strict\";\n return @isObject(reader) && !!@getByIdDirectPrivate(reader, \"readRequests\");\n})\n"; - -// isReadableStreamDisturbed -const JSC::ConstructAbility s_readableStreamInternalsIsReadableStreamDisturbedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsIsReadableStreamDisturbedCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsIsReadableStreamDisturbedCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsIsReadableStreamDisturbedCodeLength = 90; -static const JSC::Intrinsic s_readableStreamInternalsIsReadableStreamDisturbedCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsIsReadableStreamDisturbedCode = "(function (stream) {\"use strict\";\n return @getByIdDirectPrivate(stream, \"disturbed\");\n})\n"; - -// isReadableStreamLocked -const JSC::ConstructAbility s_readableStreamInternalsIsReadableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsIsReadableStreamLockedCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsIsReadableStreamLockedCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsIsReadableStreamLockedCodeLength = 89; -static const JSC::Intrinsic s_readableStreamInternalsIsReadableStreamLockedCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsIsReadableStreamLockedCode = "(function (stream) {\"use strict\";\n return !!@getByIdDirectPrivate(stream, \"reader\");\n})\n"; - -// lazyLoadStream -const JSC::ConstructAbility s_readableStreamInternalsLazyLoadStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsLazyLoadStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsLazyLoadStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsLazyLoadStreamCodeLength = 3907; -static const JSC::Intrinsic s_readableStreamInternalsLazyLoadStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsLazyLoadStreamCode = "(function (stream, autoAllocateChunkSize) {\"use strict\";\n var nativeType = @getByIdDirectPrivate(stream, \"bunNativeType\"), nativePtr = @getByIdDirectPrivate(stream, \"bunNativePtr\"), Prototype = @lazyStreamPrototypeMap.@get(nativeType);\n if (Prototype === @undefined) {\n let handleNativeReadableStreamPromiseResult2 = function(val) {\n var { c, v } = this;\n this.c = @undefined, this.v = @undefined, handleResult(val, c, v);\n }, callClose2 = function(controller) {\n try {\n if (@getByIdDirectPrivate(@getByIdDirectPrivate(controller, \"controlledReadableStream\"), \"state\") === 4)\n controller.close();\n } catch (e) {\n globalThis.reportError(e);\n }\n }, createResult2 = function(tag, controller, view, closer2) {\n closer2[0] = !1;\n var result;\n try {\n result = pull(tag, view, closer2);\n } catch (err) {\n return controller.error(err);\n }\n return handleResult(result, controller, view);\n };\n var handleNativeReadableStreamPromiseResult = handleNativeReadableStreamPromiseResult2, callClose = callClose2, createResult = createResult2, [pull, start, cancel, setClose, deinit, setRefOrUnref, drain] = @lazy(nativeType), closer = [!1], handleResult;\n handleResult = function handleResult(result, controller, view) {\n if (result && @isPromise(result))\n return result.then(handleNativeReadableStreamPromiseResult2.bind({\n c: controller,\n v: view\n }), (err) => controller.error(err));\n else if (typeof result === \"number\")\n if (view && view.byteLength === result && view.buffer === controller.byobRequest\?.view\?.buffer)\n controller.byobRequest.respondWithNewView(view);\n else\n controller.byobRequest.respond(result);\n else if (result.constructor === @Uint8Array)\n controller.enqueue(result);\n if (closer[0] || result === !1)\n @enqueueJob(callClose2, controller), closer[0] = !1;\n };\n const registry = deinit \? new FinalizationRegistry(deinit) : null;\n Prototype = class NativeReadableStreamSource {\n constructor(tag, autoAllocateChunkSize2, drainValue2) {\n if (this.#tag = tag, this.#cancellationToken = {}, this.pull = this.#pull.bind(this), this.cancel = this.#cancel.bind(this), this.autoAllocateChunkSize = autoAllocateChunkSize2, drainValue2 !== @undefined)\n this.start = (controller) => {\n controller.enqueue(drainValue2);\n };\n if (registry)\n registry.register(this, tag, this.#cancellationToken);\n }\n #cancellationToken;\n pull;\n cancel;\n start;\n #tag;\n type = \"bytes\";\n autoAllocateChunkSize = 0;\n static startSync = start;\n #pull(controller) {\n var tag = this.#tag;\n if (!tag) {\n controller.close();\n return;\n }\n createResult2(tag, controller, controller.byobRequest.view, closer);\n }\n #cancel(reason) {\n var tag = this.#tag;\n registry && registry.unregister(this.#cancellationToken), setRefOrUnref && setRefOrUnref(tag, !1), cancel(tag, reason);\n }\n static deinit = deinit;\n static drain = drain;\n }, @lazyStreamPrototypeMap.@set(nativeType, Prototype);\n }\n const chunkSize = Prototype.startSync(nativePtr, autoAllocateChunkSize);\n var drainValue;\n const { drain: drainFn, deinit: deinitFn } = Prototype;\n if (drainFn)\n drainValue = drainFn(nativePtr);\n if (chunkSize === 0) {\n if (deinit && nativePtr && @enqueueJob(deinit, nativePtr), (drainValue\?.byteLength \?\? 0) > 0)\n return {\n start(controller) {\n controller.enqueue(drainValue), controller.close();\n },\n type: \"bytes\"\n };\n return {\n start(controller) {\n controller.close();\n },\n type: \"bytes\"\n };\n }\n return new Prototype(nativePtr, chunkSize, drainValue);\n})\n"; - -// noopDoneFunction -const JSC::ConstructAbility s_readableStreamInternalsNoopDoneFunctionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsNoopDoneFunctionCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsNoopDoneFunctionCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsNoopDoneFunctionCodeLength = 92; -static const JSC::Intrinsic s_readableStreamInternalsNoopDoneFunctionCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsNoopDoneFunctionCode = "(function () {\"use strict\";\n return @Promise.@resolve({ value: @undefined, done: !0 });\n})\n"; - -// onCloseDirectStream -const JSC::ConstructAbility s_readableStreamInternalsOnCloseDirectStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsOnCloseDirectStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsOnCloseDirectStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsOnCloseDirectStreamCodeLength = 2038; -static const JSC::Intrinsic s_readableStreamInternalsOnCloseDirectStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsOnCloseDirectStreamCode = "(function (reason) {\"use strict\";\n var stream = this.@controlledReadableStream;\n if (!stream || @getByIdDirectPrivate(stream, \"state\") !== 4)\n return;\n if (this._deferClose !== 0) {\n this._deferClose = 1, this._deferCloseReason = reason;\n return;\n }\n if (@putByIdDirectPrivate(stream, \"state\", 2), typeof this.@underlyingSource.close === \"function\")\n try {\n this.@underlyingSource.close.@call(this.@underlyingSource, reason);\n } catch (e) {\n }\n var flushed;\n try {\n flushed = this.@sink.end(), @putByIdDirectPrivate(this, \"sink\", @undefined);\n } catch (e) {\n if (this._pendingRead) {\n var read = this._pendingRead;\n this._pendingRead = @undefined, @rejectPromise(read, e);\n }\n @readableStreamError(stream, e);\n return;\n }\n this.error = this.flush = this.write = this.close = this.end = @onReadableStreamDirectControllerClosed;\n var reader = @getByIdDirectPrivate(stream, \"reader\");\n if (reader && @isReadableStreamDefaultReader(reader)) {\n var _pendingRead = this._pendingRead;\n if (_pendingRead && @isPromise(_pendingRead) && flushed\?.byteLength) {\n this._pendingRead = @undefined, @fulfillPromise(_pendingRead, { value: flushed, done: !1 }), @readableStreamClose(stream);\n return;\n }\n }\n if (flushed\?.byteLength) {\n var requests = @getByIdDirectPrivate(reader, \"readRequests\");\n if (requests\?.isNotEmpty()) {\n @readableStreamFulfillReadRequest(stream, flushed, !1), @readableStreamClose(stream);\n return;\n }\n @putByIdDirectPrivate(stream, \"state\", 4), this.@pull = () => {\n var thisResult = @createFulfilledPromise({\n value: flushed,\n done: !1\n });\n return flushed = @undefined, @readableStreamClose(stream), stream = @undefined, thisResult;\n };\n } else if (this._pendingRead) {\n var read = this._pendingRead;\n this._pendingRead = @undefined, @putByIdDirectPrivate(this, \"pull\", @noopDoneFunction), @fulfillPromise(read, { value: @undefined, done: !0 });\n }\n @readableStreamClose(stream);\n})\n"; - -// onFlushDirectStream -const JSC::ConstructAbility s_readableStreamInternalsOnFlushDirectStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsOnFlushDirectStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsOnFlushDirectStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsOnFlushDirectStreamCodeLength = 848; -static const JSC::Intrinsic s_readableStreamInternalsOnFlushDirectStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsOnFlushDirectStreamCode = "(function () {\"use strict\";\n var stream = this.@controlledReadableStream, reader = @getByIdDirectPrivate(stream, \"reader\");\n if (!reader || !@isReadableStreamDefaultReader(reader))\n return;\n var _pendingRead = this._pendingRead;\n if (this._pendingRead = @undefined, _pendingRead && @isPromise(_pendingRead)) {\n var flushed = this.@sink.flush();\n if (flushed\?.byteLength)\n this._pendingRead = @getByIdDirectPrivate(stream, \"readRequests\")\?.shift(), @fulfillPromise(_pendingRead, { value: flushed, done: !1 });\n else\n this._pendingRead = _pendingRead;\n } else if (@getByIdDirectPrivate(stream, \"readRequests\")\?.isNotEmpty()) {\n var flushed = this.@sink.flush();\n if (flushed\?.byteLength)\n @readableStreamFulfillReadRequest(stream, flushed, !1);\n } else if (this._deferFlush === -1)\n this._deferFlush = 1;\n})\n"; - -// onPullDirectStream -const JSC::ConstructAbility s_readableStreamInternalsOnPullDirectStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsOnPullDirectStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsOnPullDirectStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsOnPullDirectStreamCodeLength = 1586; -static const JSC::Intrinsic s_readableStreamInternalsOnPullDirectStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsOnPullDirectStreamCode = "(function (controller) {\"use strict\";\n var stream = controller.@controlledReadableStream;\n if (!stream || @getByIdDirectPrivate(stream, \"state\") !== 4)\n return;\n if (controller._deferClose === -1)\n return;\n controller._deferClose = -1, controller._deferFlush = -1;\n var deferClose, deferFlush, asyncContext = stream.@asyncContext;\n if (asyncContext) {\n var prev = @getInternalField(@asyncContext, 0);\n @putInternalField(@asyncContext, 0, asyncContext);\n }\n try {\n var result = controller.@underlyingSource.pull(controller);\n if (result && @isPromise(result)) {\n if (controller._handleError === @undefined)\n controller._handleError = @handleDirectStreamErrorReject.bind(controller);\n @Promise.prototype.catch.@call(result, controller._handleError);\n }\n } catch (e) {\n return @handleDirectStreamErrorReject.@call(controller, e);\n } finally {\n if (deferClose = controller._deferClose, deferFlush = controller._deferFlush, controller._deferFlush = controller._deferClose = 0, asyncContext)\n @putInternalField(@asyncContext, 0, prev);\n }\n var promiseToReturn;\n if (controller._pendingRead === @undefined)\n controller._pendingRead = promiseToReturn = @newPromise();\n else\n promiseToReturn = @readableStreamAddReadRequest(stream);\n if (deferClose === 1) {\n var reason = controller._deferCloseReason;\n return controller._deferCloseReason = @undefined, @onCloseDirectStream.@call(controller, reason), promiseToReturn;\n }\n if (deferFlush === 1)\n @onFlushDirectStream.@call(controller);\n return promiseToReturn;\n})\n"; - -// onReadableStreamDirectControllerClosed -const JSC::ConstructAbility s_readableStreamInternalsOnReadableStreamDirectControllerClosedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsOnReadableStreamDirectControllerClosedCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsOnReadableStreamDirectControllerClosedCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsOnReadableStreamDirectControllerClosedCodeLength = 104; -static const JSC::Intrinsic s_readableStreamInternalsOnReadableStreamDirectControllerClosedCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsOnReadableStreamDirectControllerClosedCode = "(function (reason) {\"use strict\";\n @throwTypeError(\"ReadableStreamDirectController is now closed\");\n})\n"; - -// pipeToClosingMustBePropagatedBackward -const JSC::ConstructAbility s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCodeLength = 446; -static const JSC::Intrinsic s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCode = "(function (pipeState) {\"use strict\";\n if (!@writableStreamCloseQueuedOrInFlight(pipeState.destination) && @getByIdDirectPrivate(pipeState.destination, \"state\") !== \"closed\")\n return;\n const error = @makeTypeError(\"closing is propagated backward\");\n if (!pipeState.preventCancel) {\n @pipeToShutdownWithAction(pipeState, () => @readableStreamCancel(pipeState.source, error), error);\n return;\n }\n @pipeToShutdown(pipeState, error);\n})\n"; - -// pipeToClosingMustBePropagatedForward -const JSC::ConstructAbility s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeLength = 548; -static const JSC::Intrinsic s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCode = "(function (pipeState) {\"use strict\";\n const action = () => {\n if (pipeState.pendingReadPromiseCapability.resolve.@call(@undefined, !1), !pipeState.preventClose) {\n @pipeToShutdownWithAction(pipeState, () => @writableStreamDefaultWriterCloseWithErrorPropagation(pipeState.writer));\n return;\n }\n @pipeToShutdown(pipeState);\n };\n if (@getByIdDirectPrivate(pipeState.source, \"state\") === 1) {\n action();\n return;\n }\n @getByIdDirectPrivate(pipeState.reader, \"closedPromiseCapability\").promise.@then(action, @undefined);\n})\n"; - -// pipeToDoReadWrite -const JSC::ConstructAbility s_readableStreamInternalsPipeToDoReadWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsPipeToDoReadWriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsPipeToDoReadWriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsPipeToDoReadWriteCodeLength = 971; -static const JSC::Intrinsic s_readableStreamInternalsPipeToDoReadWriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsPipeToDoReadWriteCode = "(function (pipeState) {\"use strict\";\n return pipeState.pendingReadPromiseCapability = @newPromiseCapability(@Promise), @getByIdDirectPrivate(pipeState.writer, \"readyPromise\").promise.@then(() => {\n if (pipeState.shuttingDown) {\n pipeState.pendingReadPromiseCapability.resolve.@call(@undefined, !1);\n return;\n }\n @readableStreamDefaultReaderRead(pipeState.reader).@then((result) => {\n const canWrite = !result.done && @getByIdDirectPrivate(pipeState.writer, \"stream\") !== @undefined;\n if (pipeState.pendingReadPromiseCapability.resolve.@call(@undefined, canWrite), !canWrite)\n return;\n pipeState.pendingWritePromise = @writableStreamDefaultWriterWrite(pipeState.writer, result.value);\n }, (e) => {\n pipeState.pendingReadPromiseCapability.resolve.@call(@undefined, !1);\n });\n }, (e) => {\n pipeState.pendingReadPromiseCapability.resolve.@call(@undefined, !1);\n }), pipeState.pendingReadPromiseCapability.promise;\n})\n"; - -// pipeToErrorsMustBePropagatedBackward -const JSC::ConstructAbility s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCodeLength = 550; -static const JSC::Intrinsic s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCode = "(function (pipeState) {\"use strict\";\n const action = () => {\n const error = @getByIdDirectPrivate(pipeState.destination, \"storedError\");\n if (!pipeState.preventCancel) {\n @pipeToShutdownWithAction(pipeState, () => @readableStreamCancel(pipeState.source, error), error);\n return;\n }\n @pipeToShutdown(pipeState, error);\n };\n if (@getByIdDirectPrivate(pipeState.destination, \"state\") === \"errored\") {\n action();\n return;\n }\n @getByIdDirectPrivate(pipeState.writer, \"closedPromise\").promise.@then(@undefined, action);\n})\n"; - -// pipeToErrorsMustBePropagatedForward -const JSC::ConstructAbility s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeLength = 619; -static const JSC::Intrinsic s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCode = "(function (pipeState) {\"use strict\";\n const action = () => {\n pipeState.pendingReadPromiseCapability.resolve.@call(@undefined, !1);\n const error = @getByIdDirectPrivate(pipeState.source, \"storedError\");\n if (!pipeState.preventAbort) {\n @pipeToShutdownWithAction(pipeState, () => @writableStreamAbort(pipeState.destination, error), error);\n return;\n }\n @pipeToShutdown(pipeState, error);\n };\n if (@getByIdDirectPrivate(pipeState.source, \"state\") === 3) {\n action();\n return;\n }\n @getByIdDirectPrivate(pipeState.reader, \"closedPromiseCapability\").promise.@then(@undefined, action);\n})\n"; - -// pipeToFinalize -const JSC::ConstructAbility s_readableStreamInternalsPipeToFinalizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsPipeToFinalizeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsPipeToFinalizeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsPipeToFinalizeCodeLength = 332; -static const JSC::Intrinsic s_readableStreamInternalsPipeToFinalizeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsPipeToFinalizeCode = "(function (pipeState) {\"use strict\";\n if (@writableStreamDefaultWriterRelease(pipeState.writer), @readableStreamReaderGenericRelease(pipeState.reader), pipeState.finalized = !0, arguments.length > 1)\n pipeState.promiseCapability.reject.@call(@undefined, arguments[1]);\n else\n pipeState.promiseCapability.resolve.@call();\n})\n"; - -// pipeToLoop -const JSC::ConstructAbility s_readableStreamInternalsPipeToLoopCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsPipeToLoopCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsPipeToLoopCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsPipeToLoopCodeLength = 186; -static const JSC::Intrinsic s_readableStreamInternalsPipeToLoopCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsPipeToLoopCode = "(function (pipeState) {\"use strict\";\n if (pipeState.shuttingDown)\n return;\n @pipeToDoReadWrite(pipeState).@then((result) => {\n if (result)\n @pipeToLoop(pipeState);\n });\n})\n"; - -// pipeToShutdown -const JSC::ConstructAbility s_readableStreamInternalsPipeToShutdownCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsPipeToShutdownCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsPipeToShutdownCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsPipeToShutdownCodeLength = 648; -static const JSC::Intrinsic s_readableStreamInternalsPipeToShutdownCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsPipeToShutdownCode = "(function (pipeState) {\"use strict\";\n if (pipeState.shuttingDown)\n return;\n pipeState.shuttingDown = !0;\n const hasError = arguments.length > 1, error = arguments[1], finalize = () => {\n if (hasError)\n @pipeToFinalize(pipeState, error);\n else\n @pipeToFinalize(pipeState);\n };\n if (@getByIdDirectPrivate(pipeState.destination, \"state\") === \"writable\" && !@writableStreamCloseQueuedOrInFlight(pipeState.destination)) {\n pipeState.pendingReadPromiseCapability.promise.@then(() => {\n pipeState.pendingWritePromise.@then(finalize, finalize);\n }, (e) => @pipeToFinalize(pipeState, e));\n return;\n }\n finalize();\n})\n"; - -// pipeToShutdownWithAction -const JSC::ConstructAbility s_readableStreamInternalsPipeToShutdownWithActionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsPipeToShutdownWithActionCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsPipeToShutdownWithActionCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsPipeToShutdownWithActionCodeLength = 752; -static const JSC::Intrinsic s_readableStreamInternalsPipeToShutdownWithActionCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsPipeToShutdownWithActionCode = "(function (pipeState, action) {\"use strict\";\n if (pipeState.shuttingDown)\n return;\n pipeState.shuttingDown = !0;\n const hasError = arguments.length > 2, error = arguments[2], finalize = () => {\n action().@then(() => {\n if (hasError)\n @pipeToFinalize(pipeState, error);\n else\n @pipeToFinalize(pipeState);\n }, (e) => {\n @pipeToFinalize(pipeState, e);\n });\n };\n if (@getByIdDirectPrivate(pipeState.destination, \"state\") === \"writable\" && !@writableStreamCloseQueuedOrInFlight(pipeState.destination)) {\n pipeState.pendingReadPromiseCapability.promise.@then(() => {\n pipeState.pendingWritePromise.@then(finalize, finalize);\n }, (e) => @pipeToFinalize(pipeState, e));\n return;\n }\n finalize();\n})\n"; - -// privateInitializeReadableStreamDefaultController -const JSC::ConstructAbility s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeLength = 810; -static const JSC::Intrinsic s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCode = "(function (stream, underlyingSource, size, highWaterMark) {\"use strict\";\n if (!@isReadableStream(stream))\n @throwTypeError(\"ReadableStreamDefaultController needs a ReadableStream\");\n if (@getByIdDirectPrivate(stream, \"readableStreamController\") !== null)\n @throwTypeError(\"ReadableStream already has a controller\");\n return @putByIdDirectPrivate(this, \"controlledReadableStream\", stream), @putByIdDirectPrivate(this, \"underlyingSource\", underlyingSource), @putByIdDirectPrivate(this, \"queue\", @newQueue()), @putByIdDirectPrivate(this, \"started\", -1), @putByIdDirectPrivate(this, \"closeRequested\", !1), @putByIdDirectPrivate(this, \"pullAgain\", !1), @putByIdDirectPrivate(this, \"pulling\", !1), @putByIdDirectPrivate(this, \"strategy\", @validateAndNormalizeQueuingStrategy(size, highWaterMark)), this;\n})\n"; - -// readableStreamAddReadRequest -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamAddReadRequestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamAddReadRequestCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamAddReadRequestCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamAddReadRequestCodeLength = 194; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamAddReadRequestCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamAddReadRequestCode = "(function (stream) {\"use strict\";\n const readRequest = @newPromise();\n return @getByIdDirectPrivate(@getByIdDirectPrivate(stream, \"reader\"), \"readRequests\").push(readRequest), readRequest;\n})\n"; - -// readableStreamCancel -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamCancelCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamCancelCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamCancelCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamCancelCodeLength = 692; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamCancelCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamCancelCode = "(function (stream, reason) {\"use strict\";\n @putByIdDirectPrivate(stream, \"disturbed\", !0);\n const state = @getByIdDirectPrivate(stream, \"state\");\n if (state === 1)\n return @Promise.@resolve();\n if (state === 3)\n return @Promise.@reject(@getByIdDirectPrivate(stream, \"storedError\"));\n @readableStreamClose(stream);\n var controller = @getByIdDirectPrivate(stream, \"readableStreamController\"), cancel = controller.@cancel;\n if (cancel)\n return cancel(controller, reason).@then(function() {\n });\n var close = controller.close;\n if (close)\n return @Promise.@resolve(controller.close(reason));\n @throwTypeError(\"ReadableStreamController has no cancel or close method\");\n})\n"; - -// readableStreamClose -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamCloseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamCloseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamCloseCodeLength = 721; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamCloseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamCloseCode = "(function (stream) {\"use strict\";\n if (@putByIdDirectPrivate(stream, \"state\", 1), !@getByIdDirectPrivate(stream, \"reader\"))\n return;\n if (@isReadableStreamDefaultReader(@getByIdDirectPrivate(stream, \"reader\"))) {\n const requests = @getByIdDirectPrivate(@getByIdDirectPrivate(stream, \"reader\"), \"readRequests\");\n if (requests.isNotEmpty()) {\n @putByIdDirectPrivate(@getByIdDirectPrivate(stream, \"reader\"), \"readRequests\", @createFIFO());\n for (var request = requests.shift();request; request = requests.shift())\n @fulfillPromise(request, { value: @undefined, done: !0 });\n }\n }\n @getByIdDirectPrivate(@getByIdDirectPrivate(stream, \"reader\"), \"closedPromiseCapability\").resolve.@call();\n})\n"; - -// readableStreamDefaultControllerCallPullIfNeeded -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCodeLength = 1074; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCode = "(function (controller) {\"use strict\";\n const stream = @getByIdDirectPrivate(controller, \"controlledReadableStream\");\n if (!@readableStreamDefaultControllerCanCloseOrEnqueue(controller))\n return;\n if (@getByIdDirectPrivate(controller, \"started\") !== 1)\n return;\n if ((!@isReadableStreamLocked(stream) || !@getByIdDirectPrivate(@getByIdDirectPrivate(stream, \"reader\"), \"readRequests\")\?.isNotEmpty()) && @readableStreamDefaultControllerGetDesiredSize(controller) <= 0)\n return;\n if (@getByIdDirectPrivate(controller, \"pulling\")) {\n @putByIdDirectPrivate(controller, \"pullAgain\", !0);\n return;\n }\n @putByIdDirectPrivate(controller, \"pulling\", !0), @getByIdDirectPrivate(controller, \"pullAlgorithm\").@call(@undefined).@then(function() {\n if (@putByIdDirectPrivate(controller, \"pulling\", !1), @getByIdDirectPrivate(controller, \"pullAgain\"))\n @putByIdDirectPrivate(controller, \"pullAgain\", !1), @readableStreamDefaultControllerCallPullIfNeeded(controller);\n }, function(error) {\n @readableStreamDefaultControllerError(controller, error);\n });\n})\n"; - -// readableStreamDefaultControllerCancel -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerCancelCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerCancelCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerCancelCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamDefaultControllerCancelCodeLength = 195; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultControllerCancelCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamDefaultControllerCancelCode = "(function (controller, reason) {\"use strict\";\n return @putByIdDirectPrivate(controller, \"queue\", @newQueue()), @getByIdDirectPrivate(controller, \"cancelAlgorithm\").@call(@undefined, reason);\n})\n"; - -// readableStreamDefaultControllerCanCloseOrEnqueue -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueueCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueueCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueueCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueueCodeLength = 207; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueueCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueueCode = "(function (controller) {\"use strict\";\n return !@getByIdDirectPrivate(controller, \"closeRequested\") && @getByIdDirectPrivate(@getByIdDirectPrivate(controller, \"controlledReadableStream\"), \"state\") === 4;\n})\n"; - -// readableStreamDefaultControllerClose -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerCloseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerCloseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamDefaultControllerCloseCodeLength = 257; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultControllerCloseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamDefaultControllerCloseCode = "(function (controller) {\"use strict\";\n if (@putByIdDirectPrivate(controller, \"closeRequested\", !0), @getByIdDirectPrivate(controller, \"queue\")\?.content\?.isEmpty())\n @readableStreamClose(@getByIdDirectPrivate(controller, \"controlledReadableStream\"));\n})\n"; - -// readableStreamDefaultControllerEnqueue -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerEnqueueCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerEnqueueCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerEnqueueCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamDefaultControllerEnqueueCodeLength = 836; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultControllerEnqueueCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamDefaultControllerEnqueueCode = "(function (controller, chunk) {\"use strict\";\n const stream = @getByIdDirectPrivate(controller, \"controlledReadableStream\");\n if (@isReadableStreamLocked(stream) && @getByIdDirectPrivate(@getByIdDirectPrivate(stream, \"reader\"), \"readRequests\")\?.isNotEmpty()) {\n @readableStreamFulfillReadRequest(stream, chunk, !1), @readableStreamDefaultControllerCallPullIfNeeded(controller);\n return;\n }\n try {\n let chunkSize = 1;\n if (@getByIdDirectPrivate(controller, \"strategy\").size !== @undefined)\n chunkSize = @getByIdDirectPrivate(controller, \"strategy\").size(chunk);\n @enqueueValueWithSize(@getByIdDirectPrivate(controller, \"queue\"), chunk, chunkSize);\n } catch (error) {\n throw @readableStreamDefaultControllerError(controller, error), error;\n }\n @readableStreamDefaultControllerCallPullIfNeeded(controller);\n})\n"; - -// readableStreamDefaultControllerError -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerErrorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamDefaultControllerErrorCodeLength = 288; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultControllerErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamDefaultControllerErrorCode = "(function (controller, error) {\"use strict\";\n const stream = @getByIdDirectPrivate(controller, \"controlledReadableStream\");\n if (@getByIdDirectPrivate(stream, \"state\") !== 4)\n return;\n @putByIdDirectPrivate(controller, \"queue\", @newQueue()), @readableStreamError(stream, error);\n})\n"; - -// readableStreamDefaultControllerGetDesiredSize -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCodeLength = 358; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCode = "(function (controller) {\"use strict\";\n const stream = @getByIdDirectPrivate(controller, \"controlledReadableStream\"), state = @getByIdDirectPrivate(stream, \"state\");\n if (state === 3)\n return null;\n if (state === 1)\n return 0;\n return @getByIdDirectPrivate(controller, \"strategy\").highWaterMark - @getByIdDirectPrivate(controller, \"queue\").size;\n})\n"; - -// readableStreamDefaultControllerPull -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerPullCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerPullCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerPullCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamDefaultControllerPullCodeLength = 705; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultControllerPullCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamDefaultControllerPullCode = "(function (controller) {\"use strict\";\n var queue = @getByIdDirectPrivate(controller, \"queue\");\n if (queue.content.isNotEmpty()) {\n const chunk = @dequeueValue(queue);\n if (@getByIdDirectPrivate(controller, \"closeRequested\") && queue.content.isEmpty())\n @readableStreamClose(@getByIdDirectPrivate(controller, \"controlledReadableStream\"));\n else\n @readableStreamDefaultControllerCallPullIfNeeded(controller);\n return @createFulfilledPromise({ value: chunk, done: !1 });\n }\n const pendingPromise = @readableStreamAddReadRequest(@getByIdDirectPrivate(controller, \"controlledReadableStream\"));\n return @readableStreamDefaultControllerCallPullIfNeeded(controller), pendingPromise;\n})\n"; - -// readableStreamDefaultControllerShouldCallPull -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCodeLength = 573; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCode = "(function (controller) {\"use strict\";\n const stream = @getByIdDirectPrivate(controller, \"controlledReadableStream\");\n if (!@readableStreamDefaultControllerCanCloseOrEnqueue(controller))\n return !1;\n if (@getByIdDirectPrivate(controller, \"started\") !== 1)\n return !1;\n if ((!@isReadableStreamLocked(stream) || !@getByIdDirectPrivate(@getByIdDirectPrivate(stream, \"reader\"), \"readRequests\")\?.isNotEmpty()) && @readableStreamDefaultControllerGetDesiredSize(controller) <= 0)\n return !1;\n return @readableStreamDefaultControllerGetDesiredSize(controller) > 0;\n})\n"; - -// readableStreamDefaultControllerStart -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerStartCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerStartCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerStartCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamDefaultControllerStartCodeLength = 577; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultControllerStartCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamDefaultControllerStartCode = "(function (controller) {\"use strict\";\n if (@getByIdDirectPrivate(controller, \"started\") !== -1)\n return;\n const underlyingSource = @getByIdDirectPrivate(controller, \"underlyingSource\"), startMethod = underlyingSource.start;\n @putByIdDirectPrivate(controller, \"started\", 0), @promiseInvokeOrNoopMethodNoCatch(underlyingSource, startMethod, [controller]).@then(() => {\n @putByIdDirectPrivate(controller, \"started\", 1), @readableStreamDefaultControllerCallPullIfNeeded(controller);\n }, (error) => {\n @readableStreamDefaultControllerError(controller, error);\n });\n})\n"; - -// readableStreamDefaultReaderRead -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultReaderReadCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultReaderReadCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultReaderReadCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamDefaultReaderReadCodeLength = 519; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultReaderReadCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamDefaultReaderReadCode = "(function (reader) {\"use strict\";\n const stream = @getByIdDirectPrivate(reader, \"ownerReadableStream\"), state = @getByIdDirectPrivate(stream, \"state\");\n if (@putByIdDirectPrivate(stream, \"disturbed\", !0), state === 1)\n return @createFulfilledPromise({ value: @undefined, done: !0 });\n if (state === 3)\n return @Promise.@reject(@getByIdDirectPrivate(stream, \"storedError\"));\n return @getByIdDirectPrivate(stream, \"readableStreamController\").@pull(@getByIdDirectPrivate(stream, \"readableStreamController\"));\n})\n"; - -// readableStreamDefineLazyIterators -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefineLazyIteratorsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefineLazyIteratorsCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefineLazyIteratorsCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamDefineLazyIteratorsCodeLength = 1190; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefineLazyIteratorsCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamDefineLazyIteratorsCode = "(function (prototype) {\"use strict\";\n var asyncIterator = globalThis.Symbol.asyncIterator, ReadableStreamAsyncIterator = async function* ReadableStreamAsyncIterator(stream, preventCancel) {\n var reader = stream.getReader(), deferredError;\n try {\n while (!0) {\n var done, value;\n const firstResult = reader.readMany();\n if (@isPromise(firstResult))\n ({ done, value } = await firstResult);\n else\n ({ done, value } = firstResult);\n if (done)\n return;\n yield* value;\n }\n } catch (e) {\n deferredError = e;\n } finally {\n if (reader.releaseLock(), !preventCancel)\n stream.cancel(deferredError);\n if (deferredError)\n throw deferredError;\n }\n }, createAsyncIterator = function asyncIterator() {\n return ReadableStreamAsyncIterator(this, !1);\n }, createValues = function values({ preventCancel = !1 } = { preventCancel: !1 }) {\n return ReadableStreamAsyncIterator(this, preventCancel);\n };\n return @Object.@defineProperty(prototype, asyncIterator, { value: createAsyncIterator }), @Object.@defineProperty(prototype, \"values\", { value: createValues }), prototype;\n})\n"; - -// readableStreamError -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamErrorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamErrorCodeLength = 1006; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamErrorCode = "(function (stream, error) {\"use strict\";\n @putByIdDirectPrivate(stream, \"state\", 3), @putByIdDirectPrivate(stream, \"storedError\", error);\n const reader = @getByIdDirectPrivate(stream, \"reader\");\n if (!reader)\n return;\n if (@isReadableStreamDefaultReader(reader)) {\n const requests = @getByIdDirectPrivate(reader, \"readRequests\");\n @putByIdDirectPrivate(reader, \"readRequests\", @createFIFO());\n for (var request = requests.shift();request; request = requests.shift())\n @rejectPromise(request, error);\n } else {\n const requests = @getByIdDirectPrivate(reader, \"readIntoRequests\");\n @putByIdDirectPrivate(reader, \"readIntoRequests\", @createFIFO());\n for (var request = requests.shift();request; request = requests.shift())\n @rejectPromise(request, error);\n }\n @getByIdDirectPrivate(reader, \"closedPromiseCapability\").reject.@call(@undefined, error);\n const promise = @getByIdDirectPrivate(reader, \"closedPromiseCapability\").promise;\n @markPromiseAsHandled(promise);\n})\n"; - -// readableStreamFulfillReadRequest -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamFulfillReadRequestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamFulfillReadRequestCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamFulfillReadRequestCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamFulfillReadRequestCodeLength = 216; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamFulfillReadRequestCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamFulfillReadRequestCode = "(function (stream, chunk, done) {\"use strict\";\n const readRequest = @getByIdDirectPrivate(@getByIdDirectPrivate(stream, \"reader\"), \"readRequests\").shift();\n @fulfillPromise(readRequest, { value: chunk, done });\n})\n"; - -// readableStreamIntoArray -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamIntoArrayCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamIntoArrayCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamIntoArrayCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamIntoArrayCodeLength = 536; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamIntoArrayCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamIntoArrayCode = "(function (stream) {\"use strict\";\n var reader = stream.getReader(), manyResult = reader.readMany();\n async function processManyResult(result) {\n if (result.done)\n return [];\n var chunks = result.value || [];\n while (!0) {\n var thisResult = await reader.read();\n if (thisResult.done)\n break;\n chunks = chunks.concat(thisResult.value);\n }\n return chunks;\n }\n if (manyResult && @isPromise(manyResult))\n return manyResult.@then(processManyResult);\n return processManyResult(manyResult);\n})\n"; - -// readableStreamIntoText -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamIntoTextCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamIntoTextCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamIntoTextCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamIntoTextCodeLength = 302; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamIntoTextCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamIntoTextCode = "(function (stream) {\"use strict\";\n const [textStream, closer] = @createTextStream(@getByIdDirectPrivate(stream, \"highWaterMark\")), prom = @readStreamIntoSink(stream, textStream, !1);\n if (prom && @isPromise(prom))\n return @Promise.@resolve(prom).@then(closer.promise);\n return closer.promise;\n})\n"; - -// readableStreamPipeTo -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamPipeToCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamPipeToCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamPipeToCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamPipeToCodeLength = 633; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamPipeToCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamPipeToCode = "(function (stream, sink) {\"use strict\";\n const reader = new @ReadableStreamDefaultReader(stream);\n @getByIdDirectPrivate(reader, \"closedPromiseCapability\").promise.@then(() => {\n }, (e) => {\n sink.error(e);\n });\n function doPipe() {\n @readableStreamDefaultReaderRead(reader).@then(function(result) {\n if (result.done) {\n sink.close();\n return;\n }\n try {\n sink.enqueue(result.value);\n } catch (e) {\n sink.error(\"ReadableStream chunk enqueueing in the sink failed\");\n return;\n }\n doPipe();\n }, function(e) {\n sink.error(e);\n });\n }\n doPipe();\n})\n"; - -// readableStreamPipeToWritableStream -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamPipeToWritableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamPipeToWritableStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamPipeToWritableStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamPipeToWritableStreamCodeLength = 2342; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamPipeToWritableStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamPipeToWritableStreamCode = "(function (source, destination, preventClose, preventAbort, preventCancel, signal) {\"use strict\";\n if (@getByIdDirectPrivate(source, \"underlyingByteSource\") !== @undefined)\n return @Promise.@reject(\"Piping to a readable bytestream is not supported\");\n let pipeState = {\n source,\n destination,\n preventAbort,\n preventCancel,\n preventClose,\n signal\n };\n if (pipeState.reader = @acquireReadableStreamDefaultReader(source), pipeState.writer = @acquireWritableStreamDefaultWriter(destination), @putByIdDirectPrivate(source, \"disturbed\", !0), pipeState.finalized = !1, pipeState.shuttingDown = !1, pipeState.promiseCapability = @newPromiseCapability(@Promise), pipeState.pendingReadPromiseCapability = @newPromiseCapability(@Promise), pipeState.pendingReadPromiseCapability.resolve.@call(), pipeState.pendingWritePromise = @Promise.@resolve(), signal !== @undefined) {\n const algorithm = (reason) => {\n if (pipeState.finalized)\n return;\n @pipeToShutdownWithAction(pipeState, () => {\n const promiseDestination = !pipeState.preventAbort && @getByIdDirectPrivate(pipeState.destination, \"state\") === \"writable\" \? @writableStreamAbort(pipeState.destination, reason) : @Promise.@resolve(), promiseSource = !pipeState.preventCancel && @getByIdDirectPrivate(pipeState.source, \"state\") === 4 \? @readableStreamCancel(pipeState.source, reason) : @Promise.@resolve();\n let promiseCapability = @newPromiseCapability(@Promise), shouldWait = !0, handleResolvedPromise = () => {\n if (shouldWait) {\n shouldWait = !1;\n return;\n }\n promiseCapability.resolve.@call();\n }, handleRejectedPromise = (e) => {\n promiseCapability.reject.@call(@undefined, e);\n };\n return promiseDestination.@then(handleResolvedPromise, handleRejectedPromise), promiseSource.@then(handleResolvedPromise, handleRejectedPromise), promiseCapability.promise;\n }, reason);\n };\n if (@whenSignalAborted(signal, algorithm))\n return pipeState.promiseCapability.promise;\n }\n return @pipeToErrorsMustBePropagatedForward(pipeState), @pipeToErrorsMustBePropagatedBackward(pipeState), @pipeToClosingMustBePropagatedForward(pipeState), @pipeToClosingMustBePropagatedBackward(pipeState), @pipeToLoop(pipeState), pipeState.promiseCapability.promise;\n})\n"; - -// readableStreamReaderGenericCancel -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamReaderGenericCancelCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamReaderGenericCancelCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamReaderGenericCancelCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamReaderGenericCancelCodeLength = 164; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamReaderGenericCancelCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamReaderGenericCancelCode = "(function (reader, reason) {\"use strict\";\n const stream = @getByIdDirectPrivate(reader, \"ownerReadableStream\");\n return @readableStreamCancel(stream, reason);\n})\n"; - -// readableStreamReaderGenericInitialize -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamReaderGenericInitializeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamReaderGenericInitializeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamReaderGenericInitializeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamReaderGenericInitializeCodeLength = 632; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamReaderGenericInitializeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamReaderGenericInitializeCode = "(function (reader, stream) {\"use strict\";\n if (@putByIdDirectPrivate(reader, \"ownerReadableStream\", stream), @putByIdDirectPrivate(stream, \"reader\", reader), @getByIdDirectPrivate(stream, \"state\") === 4)\n @putByIdDirectPrivate(reader, \"closedPromiseCapability\", @newPromiseCapability(@Promise));\n else if (@getByIdDirectPrivate(stream, \"state\") === 1)\n @putByIdDirectPrivate(reader, \"closedPromiseCapability\", {\n promise: @Promise.@resolve()\n });\n else\n @putByIdDirectPrivate(reader, \"closedPromiseCapability\", {\n promise: @newHandledRejectedPromise(@getByIdDirectPrivate(stream, \"storedError\"))\n });\n})\n"; - -// readableStreamReaderGenericRelease -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamReaderGenericReleaseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamReaderGenericReleaseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamReaderGenericReleaseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamReaderGenericReleaseCodeLength = 749; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamReaderGenericReleaseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamReaderGenericReleaseCode = "(function (reader) {\"use strict\";\n if (@getByIdDirectPrivate(@getByIdDirectPrivate(reader, \"ownerReadableStream\"), \"state\") === 4)\n @getByIdDirectPrivate(reader, \"closedPromiseCapability\").reject.@call(@undefined, @makeTypeError(\"releasing lock of reader whose stream is still in readable state\"));\n else\n @putByIdDirectPrivate(reader, \"closedPromiseCapability\", {\n promise: @newHandledRejectedPromise(@makeTypeError(\"reader released lock\"))\n });\n const promise = @getByIdDirectPrivate(reader, \"closedPromiseCapability\").promise;\n @markPromiseAsHandled(promise), @putByIdDirectPrivate(@getByIdDirectPrivate(reader, \"ownerReadableStream\"), \"reader\", @undefined), @putByIdDirectPrivate(reader, \"ownerReadableStream\", @undefined);\n})\n"; - -// readableStreamTee -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamTeeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamTeeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamTeeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamTeeCodeLength = 1545; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamTeeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamTeeCode = "(function (stream, shouldClone) {\"use strict\";\n var start_ = @getByIdDirectPrivate(stream, \"start\");\n if (start_)\n @putByIdDirectPrivate(stream, \"start\", @undefined), start_();\n const reader = new @ReadableStreamDefaultReader(stream), teeState = {\n closedOrErrored: !1,\n canceled1: !1,\n canceled2: !1,\n reason1: @undefined,\n reason2: @undefined\n };\n teeState.cancelPromiseCapability = @newPromiseCapability(@Promise);\n const pullFunction = @readableStreamTeePullFunction(teeState, reader, shouldClone), branch1Source = {};\n @putByIdDirectPrivate(branch1Source, \"pull\", pullFunction), @putByIdDirectPrivate(branch1Source, \"cancel\", @readableStreamTeeBranch1CancelFunction(teeState, stream));\n const branch2Source = {};\n @putByIdDirectPrivate(branch2Source, \"pull\", pullFunction), @putByIdDirectPrivate(branch2Source, \"cancel\", @readableStreamTeeBranch2CancelFunction(teeState, stream));\n const branch1 = new @ReadableStream(branch1Source), branch2 = new @ReadableStream(branch2Source);\n return @getByIdDirectPrivate(reader, \"closedPromiseCapability\").promise.@then(@undefined, function(e) {\n if (teeState.closedOrErrored)\n return;\n if (@readableStreamDefaultControllerError(branch1.@readableStreamController, e), @readableStreamDefaultControllerError(branch2.@readableStreamController, e), teeState.closedOrErrored = !0, !teeState.canceled1 || !teeState.canceled2)\n teeState.cancelPromiseCapability.resolve.@call();\n }), teeState.branch1 = branch1, teeState.branch2 = branch2, [branch1, branch2];\n})\n"; - -// readableStreamTeeBranch1CancelFunction -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCodeLength = 369; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCode = "(function (teeState, stream) {\"use strict\";\n return function(r) {\n if (teeState.canceled1 = !0, teeState.reason1 = r, teeState.canceled2)\n @readableStreamCancel(stream, [teeState.reason1, teeState.reason2]).@then(teeState.cancelPromiseCapability.@resolve, teeState.cancelPromiseCapability.@reject);\n return teeState.cancelPromiseCapability.promise;\n };\n})\n"; - -// readableStreamTeeBranch2CancelFunction -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCodeLength = 369; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCode = "(function (teeState, stream) {\"use strict\";\n return function(r) {\n if (teeState.canceled2 = !0, teeState.reason2 = r, teeState.canceled1)\n @readableStreamCancel(stream, [teeState.reason1, teeState.reason2]).@then(teeState.cancelPromiseCapability.@resolve, teeState.cancelPromiseCapability.@reject);\n return teeState.cancelPromiseCapability.promise;\n };\n})\n"; - -// readableStreamTeePullFunction -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamTeePullFunctionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamTeePullFunctionCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamTeePullFunctionCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamTeePullFunctionCodeLength = 1036; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamTeePullFunctionCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamTeePullFunctionCode = "(function (teeState, reader, shouldClone) {\"use strict\";\n return function() {\n @Promise.prototype.@then.@call(@readableStreamDefaultReaderRead(reader), function(result) {\n if (result.done && !teeState.closedOrErrored) {\n if (!teeState.canceled1)\n @readableStreamDefaultControllerClose(teeState.branch1.@readableStreamController);\n if (!teeState.canceled2)\n @readableStreamDefaultControllerClose(teeState.branch2.@readableStreamController);\n if (teeState.closedOrErrored = !0, !teeState.canceled1 || !teeState.canceled2)\n teeState.cancelPromiseCapability.resolve.@call();\n }\n if (teeState.closedOrErrored)\n return;\n if (!teeState.canceled1)\n @readableStreamDefaultControllerEnqueue(teeState.branch1.@readableStreamController, result.value);\n if (!teeState.canceled2)\n @readableStreamDefaultControllerEnqueue(teeState.branch2.@readableStreamController, shouldClone \? @structuredCloneForStream(result.value) : result.value);\n });\n };\n})\n"; - -// readableStreamToArrayBufferDirect -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamToArrayBufferDirectCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamToArrayBufferDirectCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamToArrayBufferDirectCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamToArrayBufferDirectCodeLength = 1422; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamToArrayBufferDirectCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamToArrayBufferDirectCode = "(function (stream, underlyingSource) {\"use strict\";\n var sink = new Bun.ArrayBufferSink;\n @putByIdDirectPrivate(stream, \"underlyingSource\", @undefined);\n var highWaterMark = @getByIdDirectPrivate(stream, \"highWaterMark\");\n sink.start(highWaterMark \? { highWaterMark } : {});\n var capability = @newPromiseCapability(@Promise), ended = !1, pull = underlyingSource.pull, close = underlyingSource.close, controller = {\n start() {\n },\n close(reason) {\n if (!ended) {\n if (ended = !0, close)\n close();\n @fulfillPromise(capability.promise, sink.end());\n }\n },\n end() {\n if (!ended) {\n if (ended = !0, close)\n close();\n @fulfillPromise(capability.promise, sink.end());\n }\n },\n flush() {\n return 0;\n },\n write: sink.write.bind(sink)\n }, didError = !1;\n try {\n const firstPull = pull(controller);\n if (firstPull && @isObject(firstPull) && @isPromise(firstPull))\n return async function(controller2, promise2, pull2) {\n while (!ended)\n await pull2(controller2);\n return await promise2;\n }(controller, promise, pull);\n return capability.promise;\n } catch (e) {\n return didError = !0, @readableStreamError(stream, e), @Promise.@reject(e);\n } finally {\n if (!didError && stream)\n @readableStreamClose(stream);\n controller = close = sink = pull = stream = @undefined;\n }\n})\n"; - -// readableStreamToArrayDirect -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamToArrayDirectCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamToArrayDirectCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamToArrayDirectCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamToArrayDirectCodeLength = 603; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamToArrayDirectCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamToArrayDirectCode = "(async function (stream, underlyingSource) {\"use strict\";\n const capability = @initializeArrayStream.@call(stream, underlyingSource, @undefined);\n underlyingSource = @undefined;\n var reader = stream.getReader();\n try {\n while (@getByIdDirectPrivate(stream, \"state\") === 4) {\n var thisResult = await reader.read();\n if (thisResult.done)\n break;\n }\n try {\n reader.releaseLock();\n } catch (e) {\n }\n return reader = @undefined, @Promise.@resolve(capability.promise);\n } catch (e) {\n throw e;\n } finally {\n stream = @undefined, reader = @undefined;\n }\n})\n"; - -// readableStreamToTextDirect -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamToTextDirectCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamToTextDirectCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamToTextDirectCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamToTextDirectCodeLength = 450; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamToTextDirectCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamToTextDirectCode = "(async function (stream, underlyingSource) {\"use strict\";\n const capability = @initializeTextStream.@call(stream, underlyingSource, @undefined);\n var reader = stream.getReader();\n while (@getByIdDirectPrivate(stream, \"state\") === 4) {\n var thisResult = await reader.read();\n if (thisResult.done)\n break;\n }\n try {\n reader.releaseLock();\n } catch (e) {\n }\n return reader = @undefined, stream = @undefined, capability.promise;\n})\n"; - -// readDirectStream -const JSC::ConstructAbility s_readableStreamInternalsReadDirectStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadDirectStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadDirectStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadDirectStreamCodeLength = 1518; -static const JSC::Intrinsic s_readableStreamInternalsReadDirectStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadDirectStreamCode = "(function (stream, sink, underlyingSource) {\"use strict\";\n @putByIdDirectPrivate(stream, \"underlyingSource\", @undefined), @putByIdDirectPrivate(stream, \"start\", @undefined);\n function close(stream2, reason) {\n if (reason && underlyingSource\?.cancel) {\n try {\n var prom = underlyingSource.cancel(reason);\n @markPromiseAsHandled(prom);\n } catch (e) {\n }\n underlyingSource = @undefined;\n }\n if (stream2) {\n if (@putByIdDirectPrivate(stream2, \"readableStreamController\", @undefined), @putByIdDirectPrivate(stream2, \"reader\", @undefined), reason)\n @putByIdDirectPrivate(stream2, \"state\", 3), @putByIdDirectPrivate(stream2, \"storedError\", reason);\n else\n @putByIdDirectPrivate(stream2, \"state\", 1);\n stream2 = @undefined;\n }\n }\n if (!underlyingSource.pull) {\n close();\n return;\n }\n if (!@isCallable(underlyingSource.pull)) {\n close(), @throwTypeError(\"pull is not a function\");\n return;\n }\n @putByIdDirectPrivate(stream, \"readableStreamController\", sink);\n const highWaterMark = @getByIdDirectPrivate(stream, \"highWaterMark\");\n sink.start({\n highWaterMark: !highWaterMark || highWaterMark < 64 \? 64 : highWaterMark\n }), @startDirectStream.@call(sink, stream, underlyingSource.pull, close, stream.@asyncContext), @putByIdDirectPrivate(stream, \"reader\", {});\n var maybePromise = underlyingSource.pull(sink);\n if (sink = @undefined, maybePromise && @isPromise(maybePromise))\n return maybePromise.@then(() => {\n });\n})\n"; - -// readStreamIntoSink -const JSC::ConstructAbility s_readableStreamInternalsReadStreamIntoSinkCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadStreamIntoSinkCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadStreamIntoSinkCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadStreamIntoSinkCodeLength = 2487; -static const JSC::Intrinsic s_readableStreamInternalsReadStreamIntoSinkCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadStreamIntoSinkCode = "(async function (stream, sink, isNative) {\"use strict\";\n var didClose = !1, didThrow = !1;\n try {\n var reader = stream.getReader(), many = reader.readMany();\n if (many && @isPromise(many))\n many = await many;\n if (many.done)\n return didClose = !0, sink.end();\n var wroteCount = many.value.length;\n const highWaterMark = @getByIdDirectPrivate(stream, \"highWaterMark\");\n if (isNative)\n @startDirectStream.@call(sink, stream, @undefined, () => !didThrow && @markPromiseAsHandled(stream.cancel()), stream.@asyncContext);\n sink.start({ highWaterMark: highWaterMark || 0 });\n for (var i = 0, values = many.value, length = many.value.length;i < length; i++)\n sink.write(values[i]);\n var streamState = @getByIdDirectPrivate(stream, \"state\");\n if (streamState === 1)\n return didClose = !0, sink.end();\n while (!0) {\n var { value, done } = await reader.read();\n if (done)\n return didClose = !0, sink.end();\n sink.write(value);\n }\n } catch (e) {\n didThrow = !0;\n try {\n reader = @undefined;\n const prom = stream.cancel(e);\n @markPromiseAsHandled(prom);\n } catch (j) {\n }\n if (sink && !didClose) {\n didClose = !0;\n try {\n sink.close(e);\n } catch (j) {\n throw new globalThis.AggregateError([e, j]);\n }\n }\n throw e;\n } finally {\n if (reader) {\n try {\n reader.releaseLock();\n } catch (e) {\n }\n reader = @undefined;\n }\n sink = @undefined;\n var streamState = @getByIdDirectPrivate(stream, \"state\");\n if (stream) {\n var readableStreamController = @getByIdDirectPrivate(stream, \"readableStreamController\");\n if (readableStreamController) {\n if (@getByIdDirectPrivate(readableStreamController, \"underlyingSource\"))\n @putByIdDirectPrivate(readableStreamController, \"underlyingSource\", @undefined);\n if (@getByIdDirectPrivate(readableStreamController, \"controlledReadableStream\"))\n @putByIdDirectPrivate(readableStreamController, \"controlledReadableStream\", @undefined);\n if (@putByIdDirectPrivate(stream, \"readableStreamController\", null), @getByIdDirectPrivate(stream, \"underlyingSource\"))\n @putByIdDirectPrivate(stream, \"underlyingSource\", @undefined);\n readableStreamController = @undefined;\n }\n if (!didThrow && streamState !== 1 && streamState !== 3)\n @readableStreamClose(stream);\n stream = @undefined;\n }\n }\n})\n"; - -// setupReadableStreamDefaultController -const JSC::ConstructAbility s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeLength = 1204; -static const JSC::Intrinsic s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsSetupReadableStreamDefaultControllerCode = "(function (stream, underlyingSource, size, highWaterMark, startMethod, pullMethod, cancelMethod) {\"use strict\";\n const controller = new @ReadableStreamDefaultController(stream, underlyingSource, size, highWaterMark, @isReadableStream);\n var asyncContext = stream.@asyncContext;\n const pullAlgorithm = () => @promiseInvokeOrNoopMethod(underlyingSource, pullMethod, [controller]), cancelAlgorithm = asyncContext \? (reason) => {\n var prev = @getInternalField(@asyncContext, 0);\n @putInternalField(@asyncContext, 0, asyncContext);\n var result = @promiseInvokeOrNoopMethod(underlyingSource, cancelMethod, [reason]);\n return @putInternalField(@asyncContext, 0, prev), result;\n } : (reason) => @promiseInvokeOrNoopMethod(underlyingSource, cancelMethod, [reason]);\n @putByIdDirectPrivate(controller, \"pullAlgorithm\", pullAlgorithm), @putByIdDirectPrivate(controller, \"cancelAlgorithm\", cancelAlgorithm), @putByIdDirectPrivate(controller, \"pull\", @readableStreamDefaultControllerPull), @putByIdDirectPrivate(controller, \"cancel\", @readableStreamDefaultControllerCancel), @putByIdDirectPrivate(stream, \"readableStreamController\", controller), @readableStreamDefaultControllerStart(controller);\n})\n"; - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast(vm.clientData); \ - return clientData->builtinFunctions().readableStreamInternalsBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().readableStreamInternalsBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - -/* StreamInternals.ts */ -// createFIFO -const JSC::ConstructAbility s_streamInternalsCreateFIFOCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsCreateFIFOCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsCreateFIFOCodeImplementationVisibility = JSC::ImplementationVisibility::Private; -const int s_streamInternalsCreateFIFOCodeLength = 2276; -static const JSC::Intrinsic s_streamInternalsCreateFIFOCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsCreateFIFOCode = "(function () {\"use strict\";\n var slice = @Array.prototype.slice;\n\n class Denqueue {\n constructor() {\n this._head = 0, this._tail = 0, this._capacityMask = 3, this._list = @newArrayWithSize(4);\n }\n _head;\n _tail;\n _capacityMask;\n _list;\n size() {\n if (this._head === this._tail)\n return 0;\n if (this._head < this._tail)\n return this._tail - this._head;\n else\n return this._capacityMask + 1 - (this._head - this._tail);\n }\n isEmpty() {\n return this.size() == 0;\n }\n isNotEmpty() {\n return this.size() > 0;\n }\n shift() {\n var { _head: head, _tail, _list, _capacityMask } = this;\n if (head === _tail)\n return @undefined;\n var item = _list[head];\n if (@putByValDirect(_list, head, @undefined), head = this._head = head + 1 & _capacityMask, head < 2 && _tail > 1e4 && _tail <= _list.length >>> 2)\n this._shrinkArray();\n return item;\n }\n peek() {\n if (this._head === this._tail)\n return @undefined;\n return this._list[this._head];\n }\n push(item) {\n var tail = this._tail;\n if (@putByValDirect(this._list, tail, item), this._tail = tail + 1 & this._capacityMask, this._tail === this._head)\n this._growArray();\n }\n toArray(fullCopy) {\n var list = this._list, len = @toLength(list.length);\n if (fullCopy || this._head > this._tail) {\n var _head = @toLength(this._head), _tail = @toLength(this._tail), total = @toLength(len - _head + _tail), array = @newArrayWithSize(total), j = 0;\n for (var i = _head;i < len; i++)\n @putByValDirect(array, j++, list[i]);\n for (var i = 0;i < _tail; i++)\n @putByValDirect(array, j++, list[i]);\n return array;\n } else\n return slice.@call(list, this._head, this._tail);\n }\n clear() {\n this._head = 0, this._tail = 0, this._list.fill(@undefined);\n }\n _growArray() {\n if (this._head)\n this._list = this.toArray(!0), this._head = 0;\n this._tail = @toLength(this._list.length), this._list.length <<= 1, this._capacityMask = this._capacityMask << 1 | 1;\n }\n _shrinkArray() {\n this._list.length >>>= 1, this._capacityMask >>>= 1;\n }\n }\n return new Denqueue;\n})\n"; - -// createFulfilledPromise -const JSC::ConstructAbility s_streamInternalsCreateFulfilledPromiseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsCreateFulfilledPromiseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsCreateFulfilledPromiseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsCreateFulfilledPromiseCodeLength = 120; -static const JSC::Intrinsic s_streamInternalsCreateFulfilledPromiseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsCreateFulfilledPromiseCode = "(function (value) {\"use strict\";\n const promise = @newPromise();\n return @fulfillPromise(promise, value), promise;\n})\n"; - -// dequeueValue -const JSC::ConstructAbility s_streamInternalsDequeueValueCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsDequeueValueCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsDequeueValueCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsDequeueValueCodeLength = 168; -static const JSC::Intrinsic s_streamInternalsDequeueValueCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsDequeueValueCode = "(function (queue) {\"use strict\";\n const record = queue.content.shift();\n if (queue.size -= record.size, queue.size < 0)\n queue.size = 0;\n return record.value;\n})\n"; - -// enqueueValueWithSize -const JSC::ConstructAbility s_streamInternalsEnqueueValueWithSizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsEnqueueValueWithSizeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsEnqueueValueWithSizeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsEnqueueValueWithSizeCodeLength = 221; -static const JSC::Intrinsic s_streamInternalsEnqueueValueWithSizeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsEnqueueValueWithSizeCode = "(function (queue, value, size) {\"use strict\";\n if (size = @toNumber(size), !@isFinite(size) || size < 0)\n @throwRangeError(\"size has an incorrect value\");\n queue.content.push({ value, size }), queue.size += size;\n})\n"; - -// extractHighWaterMark -const JSC::ConstructAbility s_streamInternalsExtractHighWaterMarkCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsExtractHighWaterMarkCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsExtractHighWaterMarkCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsExtractHighWaterMarkCodeLength = 326; -static const JSC::Intrinsic s_streamInternalsExtractHighWaterMarkCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsExtractHighWaterMarkCode = "(function (strategy, defaultHWM) {\"use strict\";\n const highWaterMark = strategy.highWaterMark;\n if (highWaterMark === @undefined)\n return defaultHWM;\n if (highWaterMark !== highWaterMark || highWaterMark < 0)\n @throwRangeError(\"highWaterMark value is negative or not a number\");\n return @toNumber(highWaterMark);\n})\n"; - -// extractHighWaterMarkFromQueuingStrategyInit -const JSC::ConstructAbility s_streamInternalsExtractHighWaterMarkFromQueuingStrategyInitCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsExtractHighWaterMarkFromQueuingStrategyInitCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsExtractHighWaterMarkFromQueuingStrategyInitCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsExtractHighWaterMarkFromQueuingStrategyInitCodeLength = 314; -static const JSC::Intrinsic s_streamInternalsExtractHighWaterMarkFromQueuingStrategyInitCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsExtractHighWaterMarkFromQueuingStrategyInitCode = "(function (init) {\"use strict\";\n if (!@isObject(init))\n @throwTypeError(\"QueuingStrategyInit argument must be an object.\");\n const { highWaterMark } = init;\n if (highWaterMark === @undefined)\n @throwTypeError(\"QueuingStrategyInit.highWaterMark member is required.\");\n return @toNumber(highWaterMark);\n})\n"; - -// extractSizeAlgorithm -const JSC::ConstructAbility s_streamInternalsExtractSizeAlgorithmCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsExtractSizeAlgorithmCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsExtractSizeAlgorithmCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsExtractSizeAlgorithmCodeLength = 294; -static const JSC::Intrinsic s_streamInternalsExtractSizeAlgorithmCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsExtractSizeAlgorithmCode = "(function (strategy) {\"use strict\";\n const sizeAlgorithm = strategy.size;\n if (sizeAlgorithm === @undefined)\n return () => 1;\n if (typeof sizeAlgorithm !== \"function\")\n @throwTypeError(\"strategy.size must be a function\");\n return (chunk) => {\n return sizeAlgorithm(chunk);\n };\n})\n"; - -// markPromiseAsHandled -const JSC::ConstructAbility s_streamInternalsMarkPromiseAsHandledCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsMarkPromiseAsHandledCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsMarkPromiseAsHandledCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsMarkPromiseAsHandledCodeLength = 175; -static const JSC::Intrinsic s_streamInternalsMarkPromiseAsHandledCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsMarkPromiseAsHandledCode = "(function (promise) {\"use strict\";\n @putPromiseInternalField(promise, @promiseFieldFlags, @getPromiseInternalField(promise, @promiseFieldFlags) | @promiseFlagsIsHandled);\n})\n"; - -// newQueue -const JSC::ConstructAbility s_streamInternalsNewQueueCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsNewQueueCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsNewQueueCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsNewQueueCodeLength = 77; -static const JSC::Intrinsic s_streamInternalsNewQueueCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsNewQueueCode = "(function () {\"use strict\";\n return { content: @createFIFO(), size: 0 };\n})\n"; - -// peekQueueValue -const JSC::ConstructAbility s_streamInternalsPeekQueueValueCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsPeekQueueValueCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsPeekQueueValueCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsPeekQueueValueCodeLength = 74; -static const JSC::Intrinsic s_streamInternalsPeekQueueValueCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsPeekQueueValueCode = "(function (queue) {\"use strict\";\n return queue.content.peek()\?.value;\n})\n"; - -// promiseInvokeOrFallbackOrNoop -const JSC::ConstructAbility s_streamInternalsPromiseInvokeOrFallbackOrNoopCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsPromiseInvokeOrFallbackOrNoopCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsPromiseInvokeOrFallbackOrNoopCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsPromiseInvokeOrFallbackOrNoopCodeLength = 325; -static const JSC::Intrinsic s_streamInternalsPromiseInvokeOrFallbackOrNoopCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsPromiseInvokeOrFallbackOrNoopCode = "(function (object, key1, args1, key2, args2) {\"use strict\";\n try {\n const method = object[key1];\n if (method === @undefined)\n return @promiseInvokeOrNoopNoCatch(object, key2, args2);\n return @shieldingPromiseResolve(method.@apply(object, args1));\n } catch (error) {\n return @Promise.@reject(error);\n }\n})\n"; - -// promiseInvokeOrNoop -const JSC::ConstructAbility s_streamInternalsPromiseInvokeOrNoopCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsPromiseInvokeOrNoopCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsPromiseInvokeOrNoopCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsPromiseInvokeOrNoopCodeLength = 175; -static const JSC::Intrinsic s_streamInternalsPromiseInvokeOrNoopCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsPromiseInvokeOrNoopCode = "(function (object, key, args) {\"use strict\";\n try {\n return @promiseInvokeOrNoopNoCatch(object, key, args);\n } catch (error) {\n return @Promise.@reject(error);\n }\n})\n"; - -// promiseInvokeOrNoopMethod -const JSC::ConstructAbility s_streamInternalsPromiseInvokeOrNoopMethodCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsPromiseInvokeOrNoopMethodCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsPromiseInvokeOrNoopMethodCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsPromiseInvokeOrNoopMethodCodeLength = 187; -static const JSC::Intrinsic s_streamInternalsPromiseInvokeOrNoopMethodCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsPromiseInvokeOrNoopMethodCode = "(function (object, method, args) {\"use strict\";\n try {\n return @promiseInvokeOrNoopMethodNoCatch(object, method, args);\n } catch (error) {\n return @Promise.@reject(error);\n }\n})\n"; - -// promiseInvokeOrNoopMethodNoCatch -const JSC::ConstructAbility s_streamInternalsPromiseInvokeOrNoopMethodNoCatchCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsPromiseInvokeOrNoopMethodNoCatchCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsPromiseInvokeOrNoopMethodNoCatchCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsPromiseInvokeOrNoopMethodNoCatchCodeLength = 176; -static const JSC::Intrinsic s_streamInternalsPromiseInvokeOrNoopMethodNoCatchCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsPromiseInvokeOrNoopMethodNoCatchCode = "(function (object, method, args) {\"use strict\";\n if (method === @undefined)\n return @Promise.@resolve();\n return @shieldingPromiseResolve(method.@apply(object, args));\n})\n"; - -// promiseInvokeOrNoopNoCatch -const JSC::ConstructAbility s_streamInternalsPromiseInvokeOrNoopNoCatchCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsPromiseInvokeOrNoopNoCatchCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsPromiseInvokeOrNoopNoCatchCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsPromiseInvokeOrNoopNoCatchCodeLength = 119; -static const JSC::Intrinsic s_streamInternalsPromiseInvokeOrNoopNoCatchCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsPromiseInvokeOrNoopNoCatchCode = "(function (object, key, args) {\"use strict\";\n return @promiseInvokeOrNoopMethodNoCatch(object, object[key], args);\n})\n"; - -// resetQueue -const JSC::ConstructAbility s_streamInternalsResetQueueCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsResetQueueCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsResetQueueCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsResetQueueCodeLength = 77; -static const JSC::Intrinsic s_streamInternalsResetQueueCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsResetQueueCode = "(function (queue) {\"use strict\";\n queue.content.clear(), queue.size = 0;\n})\n"; - -// shieldingPromiseResolve -const JSC::ConstructAbility s_streamInternalsShieldingPromiseResolveCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsShieldingPromiseResolveCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsShieldingPromiseResolveCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsShieldingPromiseResolveCodeLength = 182; -static const JSC::Intrinsic s_streamInternalsShieldingPromiseResolveCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsShieldingPromiseResolveCode = "(function (result) {\"use strict\";\n const promise = @Promise.@resolve(result);\n if (promise.@then === @undefined)\n promise.@then = @Promise.prototype.@then;\n return promise;\n})\n"; - -// toDictionary -const JSC::ConstructAbility s_streamInternalsToDictionaryCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsToDictionaryCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsToDictionaryCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsToDictionaryCodeLength = 211; -static const JSC::Intrinsic s_streamInternalsToDictionaryCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsToDictionaryCode = "(function (value, defaultValue, errorMessage) {\"use strict\";\n if (value === @undefined || value === null)\n return defaultValue;\n if (!@isObject(value))\n @throwTypeError(errorMessage);\n return value;\n})\n"; - -// validateAndNormalizeQueuingStrategy -const JSC::ConstructAbility s_streamInternalsValidateAndNormalizeQueuingStrategyCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsValidateAndNormalizeQueuingStrategyCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsValidateAndNormalizeQueuingStrategyCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsValidateAndNormalizeQueuingStrategyCodeLength = 412; -static const JSC::Intrinsic s_streamInternalsValidateAndNormalizeQueuingStrategyCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsValidateAndNormalizeQueuingStrategyCode = "(function (size, highWaterMark) {\"use strict\";\n if (size !== @undefined && typeof size !== \"function\")\n @throwTypeError(\"size parameter must be a function\");\n const newHighWaterMark = @toNumber(highWaterMark);\n if (newHighWaterMark !== newHighWaterMark || newHighWaterMark < 0)\n @throwRangeError(\"highWaterMark value is negative or not a number\");\n return { size, highWaterMark: newHighWaterMark };\n})\n"; - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast(vm.clientData); \ - return clientData->builtinFunctions().streamInternalsBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().streamInternalsBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - -/* TransformStream.ts */ -// initializeTransformStream -const JSC::ConstructAbility s_transformStreamInitializeTransformStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInitializeTransformStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInitializeTransformStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInitializeTransformStreamCodeLength = 2355; -static const JSC::Intrinsic s_transformStreamInitializeTransformStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInitializeTransformStreamCode = "(function () {\"use strict\";\n let transformer = arguments[0];\n if (@isObject(transformer) && @getByIdDirectPrivate(transformer, \"TransformStream\"))\n return this;\n let writableStrategy = arguments[1], readableStrategy = arguments[2];\n if (transformer === @undefined)\n transformer = null;\n if (readableStrategy === @undefined)\n readableStrategy = {};\n if (writableStrategy === @undefined)\n writableStrategy = {};\n let transformerDict = {};\n if (transformer !== null) {\n if (\"start\" in transformer) {\n if (transformerDict.start = transformer.start, typeof transformerDict.start !== \"function\")\n @throwTypeError(\"transformer.start should be a function\");\n }\n if (\"transform\" in transformer) {\n if (transformerDict.transform = transformer.transform, typeof transformerDict.transform !== \"function\")\n @throwTypeError(\"transformer.transform should be a function\");\n }\n if (\"flush\" in transformer) {\n if (transformerDict.flush = transformer.flush, typeof transformerDict.flush !== \"function\")\n @throwTypeError(\"transformer.flush should be a function\");\n }\n if (\"readableType\" in transformer)\n @throwRangeError(\"TransformStream transformer has a readableType\");\n if (\"writableType\" in transformer)\n @throwRangeError(\"TransformStream transformer has a writableType\");\n }\n const readableHighWaterMark = @extractHighWaterMark(readableStrategy, 0), readableSizeAlgorithm = @extractSizeAlgorithm(readableStrategy), writableHighWaterMark = @extractHighWaterMark(writableStrategy, 1), writableSizeAlgorithm = @extractSizeAlgorithm(writableStrategy), startPromiseCapability = @newPromiseCapability(@Promise);\n if (@initializeTransformStream(this, startPromiseCapability.promise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm), @setUpTransformStreamDefaultControllerFromTransformer(this, transformer, transformerDict), (\"start\" in transformerDict)) {\n const controller = @getByIdDirectPrivate(this, \"controller\");\n (() => @promiseInvokeOrNoopMethodNoCatch(transformer, transformerDict.start, [controller]))().@then(() => {\n startPromiseCapability.resolve.@call();\n }, (error) => {\n startPromiseCapability.reject.@call(@undefined, error);\n });\n } else\n startPromiseCapability.resolve.@call();\n return this;\n})\n"; - -// readable -const JSC::ConstructAbility s_transformStreamReadableCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamReadableCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamReadableCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamReadableCodeLength = 175; -static const JSC::Intrinsic s_transformStreamReadableCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamReadableCode = "(function () {\"use strict\";\n if (!@isTransformStream(this))\n throw @makeThisTypeError(\"TransformStream\", \"readable\");\n return @getByIdDirectPrivate(this, \"readable\");\n})\n"; - -// writable -const JSC::ConstructAbility s_transformStreamWritableCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamWritableCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamWritableCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamWritableCodeLength = 175; -static const JSC::Intrinsic s_transformStreamWritableCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamWritableCode = "(function () {\"use strict\";\n if (!@isTransformStream(this))\n throw @makeThisTypeError(\"TransformStream\", \"writable\");\n return @getByIdDirectPrivate(this, \"writable\");\n})\n"; - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast(vm.clientData); \ - return clientData->builtinFunctions().transformStreamBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().transformStreamBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_TRANSFORMSTREAM_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - -/* TransformStreamDefaultController.ts */ -// desiredSize -const JSC::ConstructAbility s_transformStreamDefaultControllerDesiredSizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamDefaultControllerDesiredSizeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamDefaultControllerDesiredSizeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamDefaultControllerDesiredSizeCodeLength = 427; -static const JSC::Intrinsic s_transformStreamDefaultControllerDesiredSizeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamDefaultControllerDesiredSizeCode = "(function () {\"use strict\";\n if (!@isTransformStreamDefaultController(this))\n throw @makeThisTypeError(\"TransformStreamDefaultController\", \"enqueue\");\n const stream = @getByIdDirectPrivate(this, \"stream\"), readable = @getByIdDirectPrivate(stream, \"readable\"), readableController = @getByIdDirectPrivate(readable, \"readableStreamController\");\n return @readableStreamDefaultControllerGetDesiredSize(readableController);\n})\n"; - -// enqueue -const JSC::ConstructAbility s_transformStreamDefaultControllerEnqueueCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamDefaultControllerEnqueueCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamDefaultControllerEnqueueCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamDefaultControllerEnqueueCodeLength = 220; -static const JSC::Intrinsic s_transformStreamDefaultControllerEnqueueCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamDefaultControllerEnqueueCode = "(function (chunk) {\"use strict\";\n if (!@isTransformStreamDefaultController(this))\n throw @makeThisTypeError(\"TransformStreamDefaultController\", \"enqueue\");\n @transformStreamDefaultControllerEnqueue(this, chunk);\n})\n"; - -// error -const JSC::ConstructAbility s_transformStreamDefaultControllerErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamDefaultControllerErrorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamDefaultControllerErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamDefaultControllerErrorCodeLength = 208; -static const JSC::Intrinsic s_transformStreamDefaultControllerErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamDefaultControllerErrorCode = "(function (e) {\"use strict\";\n if (!@isTransformStreamDefaultController(this))\n throw @makeThisTypeError(\"TransformStreamDefaultController\", \"error\");\n @transformStreamDefaultControllerError(this, e);\n})\n"; - -// initializeTransformStreamDefaultController -const JSC::ConstructAbility s_transformStreamDefaultControllerInitializeTransformStreamDefaultControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamDefaultControllerInitializeTransformStreamDefaultControllerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamDefaultControllerInitializeTransformStreamDefaultControllerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamDefaultControllerInitializeTransformStreamDefaultControllerCodeLength = 46; -static const JSC::Intrinsic s_transformStreamDefaultControllerInitializeTransformStreamDefaultControllerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamDefaultControllerInitializeTransformStreamDefaultControllerCode = "(function () {\"use strict\";\n return this;\n})\n"; - -// terminate -const JSC::ConstructAbility s_transformStreamDefaultControllerTerminateCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamDefaultControllerTerminateCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamDefaultControllerTerminateCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamDefaultControllerTerminateCodeLength = 212; -static const JSC::Intrinsic s_transformStreamDefaultControllerTerminateCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamDefaultControllerTerminateCode = "(function () {\"use strict\";\n if (!@isTransformStreamDefaultController(this))\n throw @makeThisTypeError(\"TransformStreamDefaultController\", \"terminate\");\n @transformStreamDefaultControllerTerminate(this);\n})\n"; - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast(vm.clientData); \ - return clientData->builtinFunctions().transformStreamDefaultControllerBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().transformStreamDefaultControllerBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_TRANSFORMSTREAMDEFAULTCONTROLLER_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - -/* TransformStreamInternals.ts */ -// createTransformStream -const JSC::ConstructAbility s_transformStreamInternalsCreateTransformStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsCreateTransformStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsCreateTransformStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsCreateTransformStreamCodeLength = 1170; -static const JSC::Intrinsic s_transformStreamInternalsCreateTransformStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsCreateTransformStreamCode = "(function (startAlgorithm, transformAlgorithm, flushAlgorithm, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm) {\"use strict\";\n if (writableHighWaterMark === @undefined)\n writableHighWaterMark = 1;\n if (writableSizeAlgorithm === @undefined)\n writableSizeAlgorithm = () => 1;\n if (readableHighWaterMark === @undefined)\n readableHighWaterMark = 0;\n if (readableSizeAlgorithm === @undefined)\n readableSizeAlgorithm = () => 1;\n const transform = {};\n @putByIdDirectPrivate(transform, \"TransformStream\", !0);\n const stream = new @TransformStream(transform), startPromiseCapability = @newPromiseCapability(@Promise);\n @initializeTransformStream(stream, startPromiseCapability.promise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm);\n const controller = new @TransformStreamDefaultController;\n return @setUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm), startAlgorithm().@then(() => {\n startPromiseCapability.resolve.@call();\n }, (error) => {\n startPromiseCapability.reject.@call(@undefined, error);\n }), stream;\n})\n"; - -// initializeTransformStream -const JSC::ConstructAbility s_transformStreamInternalsInitializeTransformStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsInitializeTransformStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsInitializeTransformStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsInitializeTransformStreamCodeLength = 1754; -static const JSC::Intrinsic s_transformStreamInternalsInitializeTransformStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsInitializeTransformStreamCode = "(function (stream, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm) {\"use strict\";\n const startAlgorithm = () => {\n return startPromise;\n }, writeAlgorithm = (chunk) => {\n return @transformStreamDefaultSinkWriteAlgorithm(stream, chunk);\n }, abortAlgorithm = (reason) => {\n return @transformStreamDefaultSinkAbortAlgorithm(stream, reason);\n }, closeAlgorithm = () => {\n return @transformStreamDefaultSinkCloseAlgorithm(stream);\n }, writable = @createWritableStream(startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, writableHighWaterMark, writableSizeAlgorithm), pullAlgorithm = () => {\n return @transformStreamDefaultSourcePullAlgorithm(stream);\n }, cancelAlgorithm = (reason) => {\n return @transformStreamErrorWritableAndUnblockWrite(stream, reason), @Promise.@resolve();\n }, underlyingSource = {};\n @putByIdDirectPrivate(underlyingSource, \"start\", startAlgorithm), @putByIdDirectPrivate(underlyingSource, \"pull\", pullAlgorithm), @putByIdDirectPrivate(underlyingSource, \"cancel\", cancelAlgorithm);\n const options = {};\n @putByIdDirectPrivate(options, \"size\", readableSizeAlgorithm), @putByIdDirectPrivate(options, \"highWaterMark\", readableHighWaterMark);\n const readable = new @ReadableStream(underlyingSource, options);\n @putByIdDirectPrivate(stream, \"writable\", writable), @putByIdDirectPrivate(stream, \"internalWritable\", @getInternalWritableStream(writable)), @putByIdDirectPrivate(stream, \"readable\", readable), @putByIdDirectPrivate(stream, \"backpressure\", @undefined), @putByIdDirectPrivate(stream, \"backpressureChangePromise\", @undefined), @transformStreamSetBackpressure(stream, !0), @putByIdDirectPrivate(stream, \"controller\", @undefined);\n})\n"; - -// isTransformStream -const JSC::ConstructAbility s_transformStreamInternalsIsTransformStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsIsTransformStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsIsTransformStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsIsTransformStreamCodeLength = 112; -static const JSC::Intrinsic s_transformStreamInternalsIsTransformStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsIsTransformStreamCode = "(function (stream) {\"use strict\";\n return @isObject(stream) && !!@getByIdDirectPrivate(stream, \"readable\");\n})\n"; - -// isTransformStreamDefaultController -const JSC::ConstructAbility s_transformStreamInternalsIsTransformStreamDefaultControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsIsTransformStreamDefaultControllerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsIsTransformStreamDefaultControllerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsIsTransformStreamDefaultControllerCodeLength = 134; -static const JSC::Intrinsic s_transformStreamInternalsIsTransformStreamDefaultControllerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsIsTransformStreamDefaultControllerCode = "(function (controller) {\"use strict\";\n return @isObject(controller) && !!@getByIdDirectPrivate(controller, \"transformAlgorithm\");\n})\n"; - -// setUpTransformStreamDefaultController -const JSC::ConstructAbility s_transformStreamInternalsSetUpTransformStreamDefaultControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsSetUpTransformStreamDefaultControllerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsSetUpTransformStreamDefaultControllerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsSetUpTransformStreamDefaultControllerCodeLength = 343; -static const JSC::Intrinsic s_transformStreamInternalsSetUpTransformStreamDefaultControllerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsSetUpTransformStreamDefaultControllerCode = "(function (stream, controller, transformAlgorithm, flushAlgorithm) {\"use strict\";\n @putByIdDirectPrivate(controller, \"stream\", stream), @putByIdDirectPrivate(stream, \"controller\", controller), @putByIdDirectPrivate(controller, \"transformAlgorithm\", transformAlgorithm), @putByIdDirectPrivate(controller, \"flushAlgorithm\", flushAlgorithm);\n})\n"; - -// setUpTransformStreamDefaultControllerFromTransformer -const JSC::ConstructAbility s_transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformerCodeLength = 845; -static const JSC::Intrinsic s_transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformerCode = "(function (stream, transformer, transformerDict) {\"use strict\";\n const controller = new @TransformStreamDefaultController;\n let transformAlgorithm = (chunk) => {\n try {\n @transformStreamDefaultControllerEnqueue(controller, chunk);\n } catch (e) {\n return @Promise.@reject(e);\n }\n return @Promise.@resolve();\n }, flushAlgorithm = () => {\n return @Promise.@resolve();\n };\n if (\"transform\" in transformerDict)\n transformAlgorithm = (chunk) => {\n return @promiseInvokeOrNoopMethod(transformer, transformerDict.transform, [chunk, controller]);\n };\n if (\"flush\" in transformerDict)\n flushAlgorithm = () => {\n return @promiseInvokeOrNoopMethod(transformer, transformerDict.flush, [controller]);\n };\n @setUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm);\n})\n"; - -// transformStreamDefaultControllerClearAlgorithms -const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultControllerClearAlgorithmsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultControllerClearAlgorithmsCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultControllerClearAlgorithmsCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamDefaultControllerClearAlgorithmsCodeLength = 169; -static const JSC::Intrinsic s_transformStreamInternalsTransformStreamDefaultControllerClearAlgorithmsCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamDefaultControllerClearAlgorithmsCode = "(function (controller) {\"use strict\";\n @putByIdDirectPrivate(controller, \"transformAlgorithm\", !0), @putByIdDirectPrivate(controller, \"flushAlgorithm\", @undefined);\n})\n"; - -// transformStreamDefaultControllerEnqueue -const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultControllerEnqueueCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultControllerEnqueueCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultControllerEnqueueCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamDefaultControllerEnqueueCodeLength = 786; -static const JSC::Intrinsic s_transformStreamInternalsTransformStreamDefaultControllerEnqueueCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamDefaultControllerEnqueueCode = "(function (controller, chunk) {\"use strict\";\n const stream = @getByIdDirectPrivate(controller, \"stream\"), readable = @getByIdDirectPrivate(stream, \"readable\"), readableController = @getByIdDirectPrivate(readable, \"readableStreamController\");\n if (!@readableStreamDefaultControllerCanCloseOrEnqueue(readableController))\n @throwTypeError(\"TransformStream.readable cannot close or enqueue\");\n try {\n @readableStreamDefaultControllerEnqueue(readableController, chunk);\n } catch (e) {\n throw @transformStreamErrorWritableAndUnblockWrite(stream, e), @getByIdDirectPrivate(readable, \"storedError\");\n }\n if (!@readableStreamDefaultControllerShouldCallPull(readableController) !== @getByIdDirectPrivate(stream, \"backpressure\"))\n @transformStreamSetBackpressure(stream, !0);\n})\n"; - -// transformStreamDefaultControllerError -const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultControllerErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultControllerErrorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultControllerErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamDefaultControllerErrorCodeLength = 117; -static const JSC::Intrinsic s_transformStreamInternalsTransformStreamDefaultControllerErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamDefaultControllerErrorCode = "(function (controller, e) {\"use strict\";\n @transformStreamError(@getByIdDirectPrivate(controller, \"stream\"), e);\n})\n"; - -// transformStreamDefaultControllerPerformTransform -const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCodeLength = 415; -static const JSC::Intrinsic s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCode = "(function (controller, chunk) {\"use strict\";\n const promiseCapability = @newPromiseCapability(@Promise);\n return @getByIdDirectPrivate(controller, \"transformAlgorithm\").@call(@undefined, chunk).@then(() => {\n promiseCapability.resolve();\n }, (r) => {\n @transformStreamError(@getByIdDirectPrivate(controller, \"stream\"), r), promiseCapability.reject.@call(@undefined, r);\n }), promiseCapability.promise;\n})\n"; - -// transformStreamDefaultControllerTerminate -const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultControllerTerminateCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultControllerTerminateCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultControllerTerminateCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamDefaultControllerTerminateCodeLength = 508; -static const JSC::Intrinsic s_transformStreamInternalsTransformStreamDefaultControllerTerminateCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamDefaultControllerTerminateCode = "(function (controller) {\"use strict\";\n const stream = @getByIdDirectPrivate(controller, \"stream\"), readable = @getByIdDirectPrivate(stream, \"readable\"), readableController = @getByIdDirectPrivate(readable, \"readableStreamController\");\n if (@readableStreamDefaultControllerCanCloseOrEnqueue(readableController))\n @readableStreamDefaultControllerClose(readableController);\n const error = @makeTypeError(\"the stream has been terminated\");\n @transformStreamErrorWritableAndUnblockWrite(stream, error);\n})\n"; - -// transformStreamDefaultSinkAbortAlgorithm -const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithmCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithmCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithmCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithmCodeLength = 114; -static const JSC::Intrinsic s_transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithmCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithmCode = "(function (stream, reason) {\"use strict\";\n return @transformStreamError(stream, reason), @Promise.@resolve();\n})\n"; - -// transformStreamDefaultSinkCloseAlgorithm -const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCodeLength = 1113; -static const JSC::Intrinsic s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCode = "(function (stream) {\"use strict\";\n const readable = @getByIdDirectPrivate(stream, \"readable\"), controller = @getByIdDirectPrivate(stream, \"controller\"), readableController = @getByIdDirectPrivate(readable, \"readableStreamController\"), flushAlgorithm = @getByIdDirectPrivate(controller, \"flushAlgorithm\"), flushPromise = @getByIdDirectPrivate(controller, \"flushAlgorithm\").@call();\n @transformStreamDefaultControllerClearAlgorithms(controller);\n const promiseCapability = @newPromiseCapability(@Promise);\n return flushPromise.@then(() => {\n if (@getByIdDirectPrivate(readable, \"state\") === 3) {\n promiseCapability.reject.@call(@undefined, @getByIdDirectPrivate(readable, \"storedError\"));\n return;\n }\n if (@readableStreamDefaultControllerCanCloseOrEnqueue(readableController))\n @readableStreamDefaultControllerClose(readableController);\n promiseCapability.resolve();\n }, (r) => {\n @transformStreamError(@getByIdDirectPrivate(controller, \"stream\"), r), promiseCapability.reject.@call(@undefined, @getByIdDirectPrivate(readable, \"storedError\"));\n }), promiseCapability.promise;\n})\n"; - -// transformStreamDefaultSinkWriteAlgorithm -const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCodeLength = 971; -static const JSC::Intrinsic s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCode = "(function (stream, chunk) {\"use strict\";\n const writable = @getByIdDirectPrivate(stream, \"internalWritable\"), controller = @getByIdDirectPrivate(stream, \"controller\");\n if (@getByIdDirectPrivate(stream, \"backpressure\")) {\n const promiseCapability = @newPromiseCapability(@Promise);\n return @getByIdDirectPrivate(stream, \"backpressureChangePromise\").promise.@then(() => {\n if (@getByIdDirectPrivate(writable, \"state\") === \"erroring\") {\n promiseCapability.reject.@call(@undefined, @getByIdDirectPrivate(writable, \"storedError\"));\n return;\n }\n @transformStreamDefaultControllerPerformTransform(controller, chunk).@then(() => {\n promiseCapability.resolve();\n }, (e) => {\n promiseCapability.reject.@call(@undefined, e);\n });\n }, (e) => {\n promiseCapability.reject.@call(@undefined, e);\n }), promiseCapability.promise;\n }\n return @transformStreamDefaultControllerPerformTransform(controller, chunk);\n})\n"; - -// transformStreamDefaultSourcePullAlgorithm -const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCodeLength = 159; -static const JSC::Intrinsic s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCode = "(function (stream) {\"use strict\";\n return @transformStreamSetBackpressure(stream, !1), @getByIdDirectPrivate(stream, \"backpressureChangePromise\").promise;\n})\n"; - -// transformStreamError -const JSC::ConstructAbility s_transformStreamInternalsTransformStreamErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsTransformStreamErrorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamErrorCodeLength = 305; -static const JSC::Intrinsic s_transformStreamInternalsTransformStreamErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamErrorCode = "(function (stream, e) {\"use strict\";\n const readable = @getByIdDirectPrivate(stream, \"readable\"), readableController = @getByIdDirectPrivate(readable, \"readableStreamController\");\n @readableStreamDefaultControllerError(readableController, e), @transformStreamErrorWritableAndUnblockWrite(stream, e);\n})\n"; - -// transformStreamErrorWritableAndUnblockWrite -const JSC::ConstructAbility s_transformStreamInternalsTransformStreamErrorWritableAndUnblockWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsTransformStreamErrorWritableAndUnblockWriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamErrorWritableAndUnblockWriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamErrorWritableAndUnblockWriteCodeLength = 406; -static const JSC::Intrinsic s_transformStreamInternalsTransformStreamErrorWritableAndUnblockWriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamErrorWritableAndUnblockWriteCode = "(function (stream, e) {\"use strict\";\n @transformStreamDefaultControllerClearAlgorithms(@getByIdDirectPrivate(stream, \"controller\"));\n const writable = @getByIdDirectPrivate(stream, \"internalWritable\");\n if (@writableStreamDefaultControllerErrorIfNeeded(@getByIdDirectPrivate(writable, \"controller\"), e), @getByIdDirectPrivate(stream, \"backpressure\"))\n @transformStreamSetBackpressure(stream, !1);\n})\n"; - -// transformStreamSetBackpressure -const JSC::ConstructAbility s_transformStreamInternalsTransformStreamSetBackpressureCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsTransformStreamSetBackpressureCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamSetBackpressureCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamSetBackpressureCodeLength = 398; -static const JSC::Intrinsic s_transformStreamInternalsTransformStreamSetBackpressureCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamSetBackpressureCode = "(function (stream, backpressure) {\"use strict\";\n const backpressureChangePromise = @getByIdDirectPrivate(stream, \"backpressureChangePromise\");\n if (backpressureChangePromise !== @undefined)\n backpressureChangePromise.resolve.@call();\n @putByIdDirectPrivate(stream, \"backpressureChangePromise\", @newPromiseCapability(@Promise)), @putByIdDirectPrivate(stream, \"backpressure\", backpressure);\n})\n"; - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast(vm.clientData); \ - return clientData->builtinFunctions().transformStreamInternalsBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().transformStreamInternalsBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - -/* UtilInspect.ts */ -// getStylizeWithColor -const JSC::ConstructAbility s_utilInspectGetStylizeWithColorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_utilInspectGetStylizeWithColorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_utilInspectGetStylizeWithColorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_utilInspectGetStylizeWithColorCodeLength = 329; -static const JSC::Intrinsic s_utilInspectGetStylizeWithColorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_utilInspectGetStylizeWithColorCode = "(function (inspect) {\"use strict\";\n return function stylizeWithColor(str, styleType) {\n const style = inspect.styles[styleType];\n if (style !== @undefined) {\n const color = inspect.colors[style];\n if (color !== @undefined)\n return `\\x1B[${color[0]}m${str}\\x1B[${color[1]}m`;\n }\n return str;\n };\n})\n"; - -// stylizeWithNoColor -const JSC::ConstructAbility s_utilInspectStylizeWithNoColorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_utilInspectStylizeWithNoColorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_utilInspectStylizeWithNoColorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_utilInspectStylizeWithNoColorCodeLength = 48; -static const JSC::Intrinsic s_utilInspectStylizeWithNoColorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_utilInspectStylizeWithNoColorCode = "(function (str) {\"use strict\";\n return str;\n})\n"; - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast(vm.clientData); \ - return clientData->builtinFunctions().utilInspectBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().utilInspectBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_UTILINSPECT_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - -/* WritableStreamDefaultController.ts */ -// error -const JSC::ConstructAbility s_writableStreamDefaultControllerErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamDefaultControllerErrorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamDefaultControllerErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamDefaultControllerErrorCodeLength = 349; -static const JSC::Intrinsic s_writableStreamDefaultControllerErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamDefaultControllerErrorCode = "(function (e) {\"use strict\";\n if (@getByIdDirectPrivate(this, \"abortSteps\") === @undefined)\n throw @makeThisTypeError(\"WritableStreamDefaultController\", \"error\");\n const stream = @getByIdDirectPrivate(this, \"stream\");\n if (@getByIdDirectPrivate(stream, \"state\") !== \"writable\")\n return;\n @writableStreamDefaultControllerError(this, e);\n})\n"; - -// initializeWritableStreamDefaultController -const JSC::ConstructAbility s_writableStreamDefaultControllerInitializeWritableStreamDefaultControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamDefaultControllerInitializeWritableStreamDefaultControllerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamDefaultControllerInitializeWritableStreamDefaultControllerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamDefaultControllerInitializeWritableStreamDefaultControllerCodeLength = 436; -static const JSC::Intrinsic s_writableStreamDefaultControllerInitializeWritableStreamDefaultControllerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamDefaultControllerInitializeWritableStreamDefaultControllerCode = "(function () {\"use strict\";\n return @putByIdDirectPrivate(this, \"queue\", @newQueue()), @putByIdDirectPrivate(this, \"abortSteps\", (reason) => {\n const result = @getByIdDirectPrivate(this, \"abortAlgorithm\").@call(@undefined, reason);\n return @writableStreamDefaultControllerClearAlgorithms(this), result;\n }), @putByIdDirectPrivate(this, \"errorSteps\", () => {\n @resetQueue(@getByIdDirectPrivate(this, \"queue\"));\n }), this;\n})\n"; - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast(vm.clientData); \ - return clientData->builtinFunctions().writableStreamDefaultControllerBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().writableStreamDefaultControllerBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_WRITABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - -/* WritableStreamDefaultWriter.ts */ -// abort -const JSC::ConstructAbility s_writableStreamDefaultWriterAbortCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamDefaultWriterAbortCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamDefaultWriterAbortCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamDefaultWriterAbortCodeLength = 379; -static const JSC::Intrinsic s_writableStreamDefaultWriterAbortCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamDefaultWriterAbortCode = "(function (reason) {\"use strict\";\n if (!@isWritableStreamDefaultWriter(this))\n return @Promise.@reject(@makeThisTypeError(\"WritableStreamDefaultWriter\", \"abort\"));\n if (@getByIdDirectPrivate(this, \"stream\") === @undefined)\n return @Promise.@reject(@makeTypeError(\"WritableStreamDefaultWriter has no stream\"));\n return @writableStreamDefaultWriterAbort(this, reason);\n})\n"; - -// close -const JSC::ConstructAbility s_writableStreamDefaultWriterCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamDefaultWriterCloseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamDefaultWriterCloseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamDefaultWriterCloseCodeLength = 534; -static const JSC::Intrinsic s_writableStreamDefaultWriterCloseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamDefaultWriterCloseCode = "(function () {\"use strict\";\n if (!@isWritableStreamDefaultWriter(this))\n return @Promise.@reject(@makeThisTypeError(\"WritableStreamDefaultWriter\", \"close\"));\n const stream = @getByIdDirectPrivate(this, \"stream\");\n if (stream === @undefined)\n return @Promise.@reject(@makeTypeError(\"WritableStreamDefaultWriter has no stream\"));\n if (@writableStreamCloseQueuedOrInFlight(stream))\n return @Promise.@reject(@makeTypeError(\"WritableStreamDefaultWriter is being closed\"));\n return @writableStreamDefaultWriterClose(this);\n})\n"; - -// closed -const JSC::ConstructAbility s_writableStreamDefaultWriterClosedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamDefaultWriterClosedCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamDefaultWriterClosedCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamDefaultWriterClosedCodeLength = 231; -static const JSC::Intrinsic s_writableStreamDefaultWriterClosedCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamDefaultWriterClosedCode = "(function () {\"use strict\";\n if (!@isWritableStreamDefaultWriter(this))\n return @Promise.@reject(@makeGetterTypeError(\"WritableStreamDefaultWriter\", \"closed\"));\n return @getByIdDirectPrivate(this, \"closedPromise\").promise;\n})\n"; - -// desiredSize -const JSC::ConstructAbility s_writableStreamDefaultWriterDesiredSizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamDefaultWriterDesiredSizeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamDefaultWriterDesiredSizeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamDefaultWriterDesiredSizeCodeLength = 337; -static const JSC::Intrinsic s_writableStreamDefaultWriterDesiredSizeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamDefaultWriterDesiredSizeCode = "(function () {\"use strict\";\n if (!@isWritableStreamDefaultWriter(this))\n throw @makeThisTypeError(\"WritableStreamDefaultWriter\", \"desiredSize\");\n if (@getByIdDirectPrivate(this, \"stream\") === @undefined)\n @throwTypeError(\"WritableStreamDefaultWriter has no stream\");\n return @writableStreamDefaultWriterGetDesiredSize(this);\n})\n"; - -// initializeWritableStreamDefaultWriter -const JSC::ConstructAbility s_writableStreamDefaultWriterInitializeWritableStreamDefaultWriterCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamDefaultWriterInitializeWritableStreamDefaultWriterCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamDefaultWriterInitializeWritableStreamDefaultWriterCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamDefaultWriterInitializeWritableStreamDefaultWriterCodeLength = 334; -static const JSC::Intrinsic s_writableStreamDefaultWriterInitializeWritableStreamDefaultWriterCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamDefaultWriterInitializeWritableStreamDefaultWriterCode = "(function (stream) {\"use strict\";\n const internalStream = @getInternalWritableStream(stream);\n if (internalStream)\n stream = internalStream;\n if (!@isWritableStream(stream))\n @throwTypeError(\"WritableStreamDefaultWriter constructor takes a WritableStream\");\n return @setUpWritableStreamDefaultWriter(this, stream), this;\n})\n"; - -// ready -const JSC::ConstructAbility s_writableStreamDefaultWriterReadyCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamDefaultWriterReadyCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamDefaultWriterReadyCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamDefaultWriterReadyCodeLength = 227; -static const JSC::Intrinsic s_writableStreamDefaultWriterReadyCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamDefaultWriterReadyCode = "(function () {\"use strict\";\n if (!@isWritableStreamDefaultWriter(this))\n return @Promise.@reject(@makeThisTypeError(\"WritableStreamDefaultWriter\", \"ready\"));\n return @getByIdDirectPrivate(this, \"readyPromise\").promise;\n})\n"; - -// releaseLock -const JSC::ConstructAbility s_writableStreamDefaultWriterReleaseLockCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamDefaultWriterReleaseLockCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamDefaultWriterReleaseLockCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamDefaultWriterReleaseLockCodeLength = 269; -static const JSC::Intrinsic s_writableStreamDefaultWriterReleaseLockCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamDefaultWriterReleaseLockCode = "(function () {\"use strict\";\n if (!@isWritableStreamDefaultWriter(this))\n throw @makeThisTypeError(\"WritableStreamDefaultWriter\", \"releaseLock\");\n if (@getByIdDirectPrivate(this, \"stream\") === @undefined)\n return;\n @writableStreamDefaultWriterRelease(this);\n})\n"; - -// write -const JSC::ConstructAbility s_writableStreamDefaultWriterWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamDefaultWriterWriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamDefaultWriterWriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamDefaultWriterWriteCodeLength = 377; -static const JSC::Intrinsic s_writableStreamDefaultWriterWriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamDefaultWriterWriteCode = "(function (chunk) {\"use strict\";\n if (!@isWritableStreamDefaultWriter(this))\n return @Promise.@reject(@makeThisTypeError(\"WritableStreamDefaultWriter\", \"write\"));\n if (@getByIdDirectPrivate(this, \"stream\") === @undefined)\n return @Promise.@reject(@makeTypeError(\"WritableStreamDefaultWriter has no stream\"));\n return @writableStreamDefaultWriterWrite(this, chunk);\n})\n"; - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast(vm.clientData); \ - return clientData->builtinFunctions().writableStreamDefaultWriterBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().writableStreamDefaultWriterBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_WRITABLESTREAMDEFAULTWRITER_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - -/* WritableStreamInternals.ts */ -// acquireWritableStreamDefaultWriter -const JSC::ConstructAbility s_writableStreamInternalsAcquireWritableStreamDefaultWriterCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsAcquireWritableStreamDefaultWriterCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsAcquireWritableStreamDefaultWriterCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsAcquireWritableStreamDefaultWriterCodeLength = 88; -static const JSC::Intrinsic s_writableStreamInternalsAcquireWritableStreamDefaultWriterCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsAcquireWritableStreamDefaultWriterCode = "(function (stream) {\"use strict\";\n return new @WritableStreamDefaultWriter(stream);\n})\n"; - -// createInternalWritableStreamFromUnderlyingSink -const JSC::ConstructAbility s_writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSinkCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSinkCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSinkCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSinkCodeLength = 1576; -static const JSC::Intrinsic s_writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSinkCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSinkCode = "(function (underlyingSink, strategy) {\"use strict\";\n const stream = {};\n if (underlyingSink === @undefined)\n underlyingSink = {};\n if (strategy === @undefined)\n strategy = {};\n if (!@isObject(underlyingSink))\n @throwTypeError(\"WritableStream constructor takes an object as first argument\");\n if (\"type\" in underlyingSink)\n @throwRangeError(\"Invalid type is specified\");\n const sizeAlgorithm = @extractSizeAlgorithm(strategy), highWaterMark = @extractHighWaterMark(strategy, 1), underlyingSinkDict = {};\n if (\"start\" in underlyingSink) {\n if (underlyingSinkDict.start = underlyingSink.start, typeof underlyingSinkDict.start !== \"function\")\n @throwTypeError(\"underlyingSink.start should be a function\");\n }\n if (\"write\" in underlyingSink) {\n if (underlyingSinkDict.write = underlyingSink.write, typeof underlyingSinkDict.write !== \"function\")\n @throwTypeError(\"underlyingSink.write should be a function\");\n }\n if (\"close\" in underlyingSink) {\n if (underlyingSinkDict.close = underlyingSink.close, typeof underlyingSinkDict.close !== \"function\")\n @throwTypeError(\"underlyingSink.close should be a function\");\n }\n if (\"abort\" in underlyingSink) {\n if (underlyingSinkDict.abort = underlyingSink.abort, typeof underlyingSinkDict.abort !== \"function\")\n @throwTypeError(\"underlyingSink.abort should be a function\");\n }\n return @initializeWritableStreamSlots(stream, underlyingSink), @setUpWritableStreamDefaultControllerFromUnderlyingSink(stream, underlyingSink, underlyingSinkDict, highWaterMark, sizeAlgorithm), stream;\n})\n"; - -// createWritableStream -const JSC::ConstructAbility s_writableStreamInternalsCreateWritableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsCreateWritableStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsCreateWritableStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsCreateWritableStreamCodeLength = 486; -static const JSC::Intrinsic s_writableStreamInternalsCreateWritableStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsCreateWritableStreamCode = "(function (startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm) {\"use strict\";\n const internalStream = {};\n @initializeWritableStreamSlots(internalStream, {});\n const controller = new @WritableStreamDefaultController;\n return @setUpWritableStreamDefaultController(internalStream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm), @createWritableStreamFromInternal(internalStream);\n})\n"; - -// initializeWritableStreamSlots -const JSC::ConstructAbility s_writableStreamInternalsInitializeWritableStreamSlotsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsInitializeWritableStreamSlotsCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsInitializeWritableStreamSlotsCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsInitializeWritableStreamSlotsCodeLength = 713; -static const JSC::Intrinsic s_writableStreamInternalsInitializeWritableStreamSlotsCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsInitializeWritableStreamSlotsCode = "(function (stream, underlyingSink) {\"use strict\";\n @putByIdDirectPrivate(stream, \"state\", \"writable\"), @putByIdDirectPrivate(stream, \"storedError\", @undefined), @putByIdDirectPrivate(stream, \"writer\", @undefined), @putByIdDirectPrivate(stream, \"controller\", @undefined), @putByIdDirectPrivate(stream, \"inFlightWriteRequest\", @undefined), @putByIdDirectPrivate(stream, \"closeRequest\", @undefined), @putByIdDirectPrivate(stream, \"inFlightCloseRequest\", @undefined), @putByIdDirectPrivate(stream, \"pendingAbortRequest\", @undefined), @putByIdDirectPrivate(stream, \"writeRequests\", @createFIFO()), @putByIdDirectPrivate(stream, \"backpressure\", !1), @putByIdDirectPrivate(stream, \"underlyingSink\", underlyingSink);\n})\n"; - -// isCloseSentinel -const JSC::ConstructAbility s_writableStreamInternalsIsCloseSentinelCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsIsCloseSentinelCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsIsCloseSentinelCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsIsCloseSentinelCodeLength = 31; -static const JSC::Intrinsic s_writableStreamInternalsIsCloseSentinelCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsIsCloseSentinelCode = "(function () {\"use strict\";\n})\n"; - -// isWritableStream -const JSC::ConstructAbility s_writableStreamInternalsIsWritableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsIsWritableStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsIsWritableStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsIsWritableStreamCodeLength = 118; -static const JSC::Intrinsic s_writableStreamInternalsIsWritableStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsIsWritableStreamCode = "(function (stream) {\"use strict\";\n return @isObject(stream) && !!@getByIdDirectPrivate(stream, \"underlyingSink\");\n})\n"; - -// isWritableStreamDefaultWriter -const JSC::ConstructAbility s_writableStreamInternalsIsWritableStreamDefaultWriterCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsIsWritableStreamDefaultWriterCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsIsWritableStreamDefaultWriterCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsIsWritableStreamDefaultWriterCodeLength = 117; -static const JSC::Intrinsic s_writableStreamInternalsIsWritableStreamDefaultWriterCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsIsWritableStreamDefaultWriterCode = "(function (writer) {\"use strict\";\n return @isObject(writer) && !!@getByIdDirectPrivate(writer, \"closedPromise\");\n})\n"; - -// isWritableStreamLocked -const JSC::ConstructAbility s_writableStreamInternalsIsWritableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsIsWritableStreamLockedCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsIsWritableStreamLockedCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsIsWritableStreamLockedCodeLength = 102; -static const JSC::Intrinsic s_writableStreamInternalsIsWritableStreamLockedCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsIsWritableStreamLockedCode = "(function (stream) {\"use strict\";\n return @getByIdDirectPrivate(stream, \"writer\") !== @undefined;\n})\n"; - -// setUpWritableStreamDefaultController -const JSC::ConstructAbility s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeLength = 972; -static const JSC::Intrinsic s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsSetUpWritableStreamDefaultControllerCode = "(function (stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm) {\"use strict\";\n @putByIdDirectPrivate(controller, \"stream\", stream), @putByIdDirectPrivate(stream, \"controller\", controller), @resetQueue(@getByIdDirectPrivate(controller, \"queue\")), @putByIdDirectPrivate(controller, \"started\", -1), @putByIdDirectPrivate(controller, \"startAlgorithm\", startAlgorithm), @putByIdDirectPrivate(controller, \"strategySizeAlgorithm\", sizeAlgorithm), @putByIdDirectPrivate(controller, \"strategyHWM\", highWaterMark), @putByIdDirectPrivate(controller, \"writeAlgorithm\", writeAlgorithm), @putByIdDirectPrivate(controller, \"closeAlgorithm\", closeAlgorithm), @putByIdDirectPrivate(controller, \"abortAlgorithm\", abortAlgorithm);\n const backpressure = @writableStreamDefaultControllerGetBackpressure(controller);\n @writableStreamUpdateBackpressure(stream, backpressure), @writableStreamDefaultControllerStart(controller);\n})\n"; - -// setUpWritableStreamDefaultControllerFromUnderlyingSink -const JSC::ConstructAbility s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeLength = 1314; -static const JSC::Intrinsic s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCode = "(function (stream, underlyingSink, underlyingSinkDict, highWaterMark, sizeAlgorithm) {\"use strict\";\n const controller = new @WritableStreamDefaultController;\n let startAlgorithm = () => {\n }, writeAlgorithm = () => {\n return @Promise.@resolve();\n }, closeAlgorithm = () => {\n return @Promise.@resolve();\n }, abortAlgorithm = () => {\n return @Promise.@resolve();\n };\n if (\"start\" in underlyingSinkDict) {\n const startMethod = underlyingSinkDict.start;\n startAlgorithm = () => @promiseInvokeOrNoopMethodNoCatch(underlyingSink, startMethod, [controller]);\n }\n if (\"write\" in underlyingSinkDict) {\n const writeMethod = underlyingSinkDict.write;\n writeAlgorithm = (chunk) => @promiseInvokeOrNoopMethod(underlyingSink, writeMethod, [chunk, controller]);\n }\n if (\"close\" in underlyingSinkDict) {\n const closeMethod = underlyingSinkDict.close;\n closeAlgorithm = () => @promiseInvokeOrNoopMethod(underlyingSink, closeMethod, []);\n }\n if (\"abort\" in underlyingSinkDict) {\n const abortMethod = underlyingSinkDict.abort;\n abortAlgorithm = (reason) => @promiseInvokeOrNoopMethod(underlyingSink, abortMethod, [reason]);\n }\n @setUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm);\n})\n"; - -// setUpWritableStreamDefaultWriter -const JSC::ConstructAbility s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeLength = 1368; -static const JSC::Intrinsic s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsSetUpWritableStreamDefaultWriterCode = "(function (writer, stream) {\"use strict\";\n if (@isWritableStreamLocked(stream))\n @throwTypeError(\"WritableStream is locked\");\n @putByIdDirectPrivate(writer, \"stream\", stream), @putByIdDirectPrivate(stream, \"writer\", writer);\n const readyPromiseCapability = @newPromiseCapability(@Promise), closedPromiseCapability = @newPromiseCapability(@Promise);\n @putByIdDirectPrivate(writer, \"readyPromise\", readyPromiseCapability), @putByIdDirectPrivate(writer, \"closedPromise\", closedPromiseCapability);\n const state = @getByIdDirectPrivate(stream, \"state\");\n if (state === \"writable\") {\n if (@writableStreamCloseQueuedOrInFlight(stream) || !@getByIdDirectPrivate(stream, \"backpressure\"))\n readyPromiseCapability.resolve.@call();\n } else if (state === \"erroring\")\n readyPromiseCapability.reject.@call(@undefined, @getByIdDirectPrivate(stream, \"storedError\")), @markPromiseAsHandled(readyPromiseCapability.promise);\n else if (state === \"closed\")\n readyPromiseCapability.resolve.@call(), closedPromiseCapability.resolve.@call();\n else {\n const storedError = @getByIdDirectPrivate(stream, \"storedError\");\n readyPromiseCapability.reject.@call(@undefined, storedError), @markPromiseAsHandled(readyPromiseCapability.promise), closedPromiseCapability.reject.@call(@undefined, storedError), @markPromiseAsHandled(closedPromiseCapability.promise);\n }\n})\n"; - -// writableStreamAbort -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamAbortCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamAbortCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamAbortCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamAbortCodeLength = 782; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamAbortCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamAbortCode = "(function (stream, reason) {\"use strict\";\n const state = @getByIdDirectPrivate(stream, \"state\");\n if (state === \"closed\" || state === \"errored\")\n return @Promise.@resolve();\n const pendingAbortRequest = @getByIdDirectPrivate(stream, \"pendingAbortRequest\");\n if (pendingAbortRequest !== @undefined)\n return pendingAbortRequest.promise.promise;\n let wasAlreadyErroring = !1;\n if (state === \"erroring\")\n wasAlreadyErroring = !0, reason = @undefined;\n const abortPromiseCapability = @newPromiseCapability(@Promise);\n if (@putByIdDirectPrivate(stream, \"pendingAbortRequest\", {\n promise: abortPromiseCapability,\n reason,\n wasAlreadyErroring\n }), !wasAlreadyErroring)\n @writableStreamStartErroring(stream, reason);\n return abortPromiseCapability.promise;\n})\n"; - -// writableStreamAbortForBindings -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamAbortForBindingsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamAbortForBindingsCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamAbortForBindingsCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamAbortForBindingsCodeLength = 253; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamAbortForBindingsCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamAbortForBindingsCode = "(function (stream, reason) {\"use strict\";\n if (@isWritableStreamLocked(stream))\n return @Promise.@reject(@makeTypeError(\"WritableStream.abort method can only be used on non locked WritableStream\"));\n return @writableStreamAbort(stream, reason);\n})\n"; - -// writableStreamAddWriteRequest -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamAddWriteRequestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamAddWriteRequestCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamAddWriteRequestCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamAddWriteRequestCodeLength = 221; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamAddWriteRequestCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamAddWriteRequestCode = "(function (stream) {\"use strict\";\n const writePromiseCapability = @newPromiseCapability(@Promise);\n return @getByIdDirectPrivate(stream, \"writeRequests\").push(writePromiseCapability), writePromiseCapability.promise;\n})\n"; - -// writableStreamClose -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamCloseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamCloseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamCloseCodeLength = 738; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamCloseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamCloseCode = "(function (stream) {\"use strict\";\n const state = @getByIdDirectPrivate(stream, \"state\");\n if (state === \"closed\" || state === \"errored\")\n return @Promise.@reject(@makeTypeError(\"Cannot close a writable stream that is closed or errored\"));\n const closePromiseCapability = @newPromiseCapability(@Promise);\n @putByIdDirectPrivate(stream, \"closeRequest\", closePromiseCapability);\n const writer = @getByIdDirectPrivate(stream, \"writer\");\n if (writer !== @undefined && @getByIdDirectPrivate(stream, \"backpressure\") && state === \"writable\")\n @getByIdDirectPrivate(writer, \"readyPromise\").resolve.@call();\n return @writableStreamDefaultControllerClose(@getByIdDirectPrivate(stream, \"controller\")), closePromiseCapability.promise;\n})\n"; - -// writableStreamCloseForBindings -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamCloseForBindingsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamCloseForBindingsCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamCloseForBindingsCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamCloseForBindingsCodeLength = 414; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamCloseForBindingsCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamCloseForBindingsCode = "(function (stream) {\"use strict\";\n if (@isWritableStreamLocked(stream))\n return @Promise.@reject(@makeTypeError(\"WritableStream.close method can only be used on non locked WritableStream\"));\n if (@writableStreamCloseQueuedOrInFlight(stream))\n return @Promise.@reject(@makeTypeError(\"WritableStream.close method can only be used on a being close WritableStream\"));\n return @writableStreamClose(stream);\n})\n"; - -// writableStreamCloseQueuedOrInFlight -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCodeLength = 180; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCode = "(function (stream) {\"use strict\";\n return @getByIdDirectPrivate(stream, \"closeRequest\") !== @undefined || @getByIdDirectPrivate(stream, \"inFlightCloseRequest\") !== @undefined;\n})\n"; - -// writableStreamDealWithRejection -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDealWithRejectionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDealWithRejectionCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDealWithRejectionCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDealWithRejectionCodeLength = 213; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDealWithRejectionCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDealWithRejectionCode = "(function (stream, error) {\"use strict\";\n if (@getByIdDirectPrivate(stream, \"state\") === \"writable\") {\n @writableStreamStartErroring(stream, error);\n return;\n }\n @writableStreamFinishErroring(stream);\n})\n"; - -// writableStreamDefaultControllerAdvanceQueueIfNeeded -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCodeLength = 705; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCode = "(function (controller) {\"use strict\";\n const stream = @getByIdDirectPrivate(controller, \"stream\");\n if (@getByIdDirectPrivate(controller, \"started\") !== 1)\n return;\n if (@getByIdDirectPrivate(stream, \"inFlightWriteRequest\") !== @undefined)\n return;\n if (@getByIdDirectPrivate(stream, \"state\") === \"erroring\") {\n @writableStreamFinishErroring(stream);\n return;\n }\n const queue = @getByIdDirectPrivate(controller, \"queue\");\n if (queue.content\?.isEmpty() \?\? !1)\n return;\n const value = @peekQueueValue(queue);\n if (value === @isCloseSentinel)\n @writableStreamDefaultControllerProcessClose(controller);\n else\n @writableStreamDefaultControllerProcessWrite(controller, value);\n})\n"; - -// writableStreamDefaultControllerClearAlgorithms -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCodeLength = 310; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCode = "(function (controller) {\"use strict\";\n @putByIdDirectPrivate(controller, \"writeAlgorithm\", @undefined), @putByIdDirectPrivate(controller, \"closeAlgorithm\", @undefined), @putByIdDirectPrivate(controller, \"abortAlgorithm\", @undefined), @putByIdDirectPrivate(controller, \"strategySizeAlgorithm\", @undefined);\n})\n"; - -// writableStreamDefaultControllerClose -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerCloseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerCloseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultControllerCloseCodeLength = 197; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerCloseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultControllerCloseCode = "(function (controller) {\"use strict\";\n @enqueueValueWithSize(@getByIdDirectPrivate(controller, \"queue\"), @isCloseSentinel, 0), @writableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n})\n"; - -// writableStreamDefaultControllerError -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerErrorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultControllerErrorCodeLength = 218; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultControllerErrorCode = "(function (controller, error) {\"use strict\";\n const stream = @getByIdDirectPrivate(controller, \"stream\");\n @writableStreamDefaultControllerClearAlgorithms(controller), @writableStreamStartErroring(stream, error);\n})\n"; - -// writableStreamDefaultControllerErrorIfNeeded -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCodeLength = 233; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCode = "(function (controller, error) {\"use strict\";\n const stream = @getByIdDirectPrivate(controller, \"stream\");\n if (@getByIdDirectPrivate(stream, \"state\") === \"writable\")\n @writableStreamDefaultControllerError(controller, error);\n})\n"; - -// writableStreamDefaultControllerGetBackpressure -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCodeLength = 115; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCode = "(function (controller) {\"use strict\";\n return @writableStreamDefaultControllerGetDesiredSize(controller) <= 0;\n})\n"; - -// writableStreamDefaultControllerGetChunkSize -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCodeLength = 248; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCode = "(function (controller, chunk) {\"use strict\";\n try {\n return @getByIdDirectPrivate(controller, \"strategySizeAlgorithm\").@call(@undefined, chunk);\n } catch (e) {\n return @writableStreamDefaultControllerErrorIfNeeded(controller, e), 1;\n }\n})\n"; - -// writableStreamDefaultControllerGetDesiredSize -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCodeLength = 150; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCode = "(function (controller) {\"use strict\";\n return @getByIdDirectPrivate(controller, \"strategyHWM\") - @getByIdDirectPrivate(controller, \"queue\").size;\n})\n"; - -// writableStreamDefaultControllerProcessClose -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCodeLength = 533; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCode = "(function (controller) {\"use strict\";\n const stream = @getByIdDirectPrivate(controller, \"stream\");\n @writableStreamMarkCloseRequestInFlight(stream), @dequeueValue(@getByIdDirectPrivate(controller, \"queue\"));\n const sinkClosePromise = @getByIdDirectPrivate(controller, \"closeAlgorithm\").@call();\n @writableStreamDefaultControllerClearAlgorithms(controller), sinkClosePromise.@then(() => {\n @writableStreamFinishInFlightClose(stream);\n }, (reason) => {\n @writableStreamFinishInFlightCloseWithError(stream, reason);\n });\n})\n"; - -// writableStreamDefaultControllerProcessWrite -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCodeLength = 950; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCode = "(function (controller, chunk) {\"use strict\";\n const stream = @getByIdDirectPrivate(controller, \"stream\");\n @writableStreamMarkFirstWriteRequestInFlight(stream), @getByIdDirectPrivate(controller, \"writeAlgorithm\").@call(@undefined, chunk).@then(() => {\n @writableStreamFinishInFlightWrite(stream);\n const state = @getByIdDirectPrivate(stream, \"state\");\n if (@dequeueValue(@getByIdDirectPrivate(controller, \"queue\")), !@writableStreamCloseQueuedOrInFlight(stream) && state === \"writable\") {\n const backpressure = @writableStreamDefaultControllerGetBackpressure(controller);\n @writableStreamUpdateBackpressure(stream, backpressure);\n }\n @writableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n }, (reason) => {\n if (@getByIdDirectPrivate(stream, \"state\") === \"writable\")\n @writableStreamDefaultControllerClearAlgorithms(controller);\n @writableStreamFinishInFlightWriteWithError(stream, reason);\n });\n})\n"; - -// writableStreamDefaultControllerStart -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerStartCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerStartCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerStartCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultControllerStartCodeLength = 796; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerStartCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultControllerStartCode = "(function (controller) {\"use strict\";\n if (@getByIdDirectPrivate(controller, \"started\") !== -1)\n return;\n @putByIdDirectPrivate(controller, \"started\", 0);\n const startAlgorithm = @getByIdDirectPrivate(controller, \"startAlgorithm\");\n @putByIdDirectPrivate(controller, \"startAlgorithm\", @undefined);\n const stream = @getByIdDirectPrivate(controller, \"stream\");\n return @Promise.@resolve(startAlgorithm.@call()).@then(() => {\n const state = @getByIdDirectPrivate(stream, \"state\");\n @putByIdDirectPrivate(controller, \"started\", 1), @writableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n }, (error) => {\n const state = @getByIdDirectPrivate(stream, \"state\");\n @putByIdDirectPrivate(controller, \"started\", 1), @writableStreamDealWithRejection(stream, error);\n });\n})\n"; - -// writableStreamDefaultControllerWrite -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerWriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerWriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultControllerWriteCodeLength = 662; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerWriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultControllerWriteCode = "(function (controller, chunk, chunkSize) {\"use strict\";\n try {\n @enqueueValueWithSize(@getByIdDirectPrivate(controller, \"queue\"), chunk, chunkSize);\n const stream = @getByIdDirectPrivate(controller, \"stream\"), state = @getByIdDirectPrivate(stream, \"state\");\n if (!@writableStreamCloseQueuedOrInFlight(stream) && state === \"writable\") {\n const backpressure = @writableStreamDefaultControllerGetBackpressure(controller);\n @writableStreamUpdateBackpressure(stream, backpressure);\n }\n @writableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n } catch (e) {\n @writableStreamDefaultControllerErrorIfNeeded(controller, e);\n }\n})\n"; - -// writableStreamDefaultWriterAbort -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterAbortCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterAbortCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterAbortCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultWriterAbortCodeLength = 150; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultWriterAbortCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultWriterAbortCode = "(function (writer, reason) {\"use strict\";\n const stream = @getByIdDirectPrivate(writer, \"stream\");\n return @writableStreamAbort(stream, reason);\n})\n"; - -// writableStreamDefaultWriterClose -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterCloseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterCloseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultWriterCloseCodeLength = 134; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultWriterCloseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultWriterCloseCode = "(function (writer) {\"use strict\";\n const stream = @getByIdDirectPrivate(writer, \"stream\");\n return @writableStreamClose(stream);\n})\n"; - -// writableStreamDefaultWriterCloseWithErrorPropagation -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCodeLength = 403; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCode = "(function (writer) {\"use strict\";\n const stream = @getByIdDirectPrivate(writer, \"stream\"), state = @getByIdDirectPrivate(stream, \"state\");\n if (@writableStreamCloseQueuedOrInFlight(stream) || state === \"closed\")\n return @Promise.@resolve();\n if (state === \"errored\")\n return @Promise.@reject(@getByIdDirectPrivate(stream, \"storedError\"));\n return @writableStreamDefaultWriterClose(writer);\n})\n"; - -// writableStreamDefaultWriterEnsureClosedPromiseRejected -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeLength = 569; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCode = "(function (writer, error) {\"use strict\";\n let closedPromiseCapability = @getByIdDirectPrivate(writer, \"closedPromise\"), closedPromise = closedPromiseCapability.promise;\n if ((@getPromiseInternalField(closedPromise, @promiseFieldFlags) & @promiseStateMask) !== @promiseStatePending)\n closedPromiseCapability = @newPromiseCapability(@Promise), closedPromise = closedPromiseCapability.promise, @putByIdDirectPrivate(writer, \"closedPromise\", closedPromiseCapability);\n closedPromiseCapability.reject.@call(@undefined, error), @markPromiseAsHandled(closedPromise);\n})\n"; - -// writableStreamDefaultWriterEnsureReadyPromiseRejected -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeLength = 557; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCode = "(function (writer, error) {\"use strict\";\n let readyPromiseCapability = @getByIdDirectPrivate(writer, \"readyPromise\"), readyPromise = readyPromiseCapability.promise;\n if ((@getPromiseInternalField(readyPromise, @promiseFieldFlags) & @promiseStateMask) !== @promiseStatePending)\n readyPromiseCapability = @newPromiseCapability(@Promise), readyPromise = readyPromiseCapability.promise, @putByIdDirectPrivate(writer, \"readyPromise\", readyPromiseCapability);\n readyPromiseCapability.reject.@call(@undefined, error), @markPromiseAsHandled(readyPromise);\n})\n"; - -// writableStreamDefaultWriterGetDesiredSize -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCodeLength = 353; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCode = "(function (writer) {\"use strict\";\n const stream = @getByIdDirectPrivate(writer, \"stream\"), state = @getByIdDirectPrivate(stream, \"state\");\n if (state === \"errored\" || state === \"erroring\")\n return null;\n if (state === \"closed\")\n return 0;\n return @writableStreamDefaultControllerGetDesiredSize(@getByIdDirectPrivate(stream, \"controller\"));\n})\n"; - -// writableStreamDefaultWriterRelease -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterReleaseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterReleaseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterReleaseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultWriterReleaseCodeLength = 432; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultWriterReleaseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultWriterReleaseCode = "(function (writer) {\"use strict\";\n const stream = @getByIdDirectPrivate(writer, \"stream\"), releasedError = @makeTypeError(\"writableStreamDefaultWriterRelease\");\n @writableStreamDefaultWriterEnsureReadyPromiseRejected(writer, releasedError), @writableStreamDefaultWriterEnsureClosedPromiseRejected(writer, releasedError), @putByIdDirectPrivate(stream, \"writer\", @undefined), @putByIdDirectPrivate(writer, \"stream\", @undefined);\n})\n"; - -// writableStreamDefaultWriterWrite -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterWriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterWriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultWriterWriteCodeLength = 1079; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultWriterWriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultWriterWriteCode = "(function (writer, chunk) {\"use strict\";\n const stream = @getByIdDirectPrivate(writer, \"stream\"), controller = @getByIdDirectPrivate(stream, \"controller\"), chunkSize = @writableStreamDefaultControllerGetChunkSize(controller, chunk);\n if (stream !== @getByIdDirectPrivate(writer, \"stream\"))\n return @Promise.@reject(@makeTypeError(\"writer is not stream's writer\"));\n const state = @getByIdDirectPrivate(stream, \"state\");\n if (state === \"errored\")\n return @Promise.@reject(@getByIdDirectPrivate(stream, \"storedError\"));\n if (@writableStreamCloseQueuedOrInFlight(stream) || state === \"closed\")\n return @Promise.@reject(@makeTypeError(\"stream is closing or closed\"));\n if (@writableStreamCloseQueuedOrInFlight(stream) || state === \"closed\")\n return @Promise.@reject(@makeTypeError(\"stream is closing or closed\"));\n if (state === \"erroring\")\n return @Promise.@reject(@getByIdDirectPrivate(stream, \"storedError\"));\n const promise = @writableStreamAddWriteRequest(stream);\n return @writableStreamDefaultControllerWrite(controller, chunk, chunkSize), promise;\n})\n"; - -// writableStreamFinishErroring -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishErroringCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishErroringCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamFinishErroringCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamFinishErroringCodeLength = 1323; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamFinishErroringCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamFinishErroringCode = "(function (stream) {\"use strict\";\n @putByIdDirectPrivate(stream, \"state\", \"errored\");\n const controller = @getByIdDirectPrivate(stream, \"controller\");\n @getByIdDirectPrivate(controller, \"errorSteps\").@call();\n const storedError = @getByIdDirectPrivate(stream, \"storedError\"), requests = @getByIdDirectPrivate(stream, \"writeRequests\");\n for (var request = requests.shift();request; request = requests.shift())\n request.reject.@call(@undefined, storedError);\n @putByIdDirectPrivate(stream, \"writeRequests\", @createFIFO());\n const abortRequest = @getByIdDirectPrivate(stream, \"pendingAbortRequest\");\n if (abortRequest === @undefined) {\n @writableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n return;\n }\n if (@putByIdDirectPrivate(stream, \"pendingAbortRequest\", @undefined), abortRequest.wasAlreadyErroring) {\n abortRequest.promise.reject.@call(@undefined, storedError), @writableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n return;\n }\n @getByIdDirectPrivate(controller, \"abortSteps\").@call(@undefined, abortRequest.reason).@then(() => {\n abortRequest.promise.resolve.@call(), @writableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n }, (reason) => {\n abortRequest.promise.reject.@call(@undefined, reason), @writableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n });\n})\n"; - -// writableStreamFinishInFlightClose -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeLength = 737; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamFinishInFlightCloseCode = "(function (stream) {\"use strict\";\n if (@getByIdDirectPrivate(stream, \"inFlightCloseRequest\").resolve.@call(), @putByIdDirectPrivate(stream, \"inFlightCloseRequest\", @undefined), @getByIdDirectPrivate(stream, \"state\") === \"erroring\") {\n @putByIdDirectPrivate(stream, \"storedError\", @undefined);\n const abortRequest = @getByIdDirectPrivate(stream, \"pendingAbortRequest\");\n if (abortRequest !== @undefined)\n abortRequest.promise.resolve.@call(), @putByIdDirectPrivate(stream, \"pendingAbortRequest\", @undefined);\n }\n @putByIdDirectPrivate(stream, \"state\", \"closed\");\n const writer = @getByIdDirectPrivate(stream, \"writer\");\n if (writer !== @undefined)\n @getByIdDirectPrivate(writer, \"closedPromise\").resolve.@call();\n})\n"; - -// writableStreamFinishInFlightCloseWithError -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeLength = 535; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCode = "(function (stream, error) {\"use strict\";\n @getByIdDirectPrivate(stream, \"inFlightCloseRequest\").reject.@call(@undefined, error), @putByIdDirectPrivate(stream, \"inFlightCloseRequest\", @undefined);\n const state = @getByIdDirectPrivate(stream, \"state\"), abortRequest = @getByIdDirectPrivate(stream, \"pendingAbortRequest\");\n if (abortRequest !== @undefined)\n abortRequest.promise.reject.@call(@undefined, error), @putByIdDirectPrivate(stream, \"pendingAbortRequest\", @undefined);\n @writableStreamDealWithRejection(stream, error);\n})\n"; - -// writableStreamFinishInFlightWrite -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeLength = 177; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamFinishInFlightWriteCode = "(function (stream) {\"use strict\";\n @getByIdDirectPrivate(stream, \"inFlightWriteRequest\").resolve.@call(), @putByIdDirectPrivate(stream, \"inFlightWriteRequest\", @undefined);\n})\n"; - -// writableStreamFinishInFlightWriteWithError -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeLength = 307; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCode = "(function (stream, error) {\"use strict\";\n @getByIdDirectPrivate(stream, \"inFlightWriteRequest\").reject.@call(@undefined, error), @putByIdDirectPrivate(stream, \"inFlightWriteRequest\", @undefined);\n const state = @getByIdDirectPrivate(stream, \"state\");\n @writableStreamDealWithRejection(stream, error);\n})\n"; - -// writableStreamHasOperationMarkedInFlight -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCodeLength = 188; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCode = "(function (stream) {\"use strict\";\n return @getByIdDirectPrivate(stream, \"inFlightWriteRequest\") !== @undefined || @getByIdDirectPrivate(stream, \"inFlightCloseRequest\") !== @undefined;\n})\n"; - -// writableStreamMarkCloseRequestInFlight -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCodeLength = 237; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCode = "(function (stream) {\"use strict\";\n const closeRequest = @getByIdDirectPrivate(stream, \"closeRequest\");\n @putByIdDirectPrivate(stream, \"inFlightCloseRequest\", closeRequest), @putByIdDirectPrivate(stream, \"closeRequest\", @undefined);\n})\n"; - -// writableStreamMarkFirstWriteRequestInFlight -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCodeLength = 187; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCode = "(function (stream) {\"use strict\";\n const writeRequest = @getByIdDirectPrivate(stream, \"writeRequests\").shift();\n @putByIdDirectPrivate(stream, \"inFlightWriteRequest\", writeRequest);\n})\n"; - -// writableStreamRejectCloseAndClosedPromiseIfNeeded -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeLength = 587; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCode = "(function (stream) {\"use strict\";\n const storedError = @getByIdDirectPrivate(stream, \"storedError\"), closeRequest = @getByIdDirectPrivate(stream, \"closeRequest\");\n if (closeRequest !== @undefined)\n closeRequest.reject.@call(@undefined, storedError), @putByIdDirectPrivate(stream, \"closeRequest\", @undefined);\n const writer = @getByIdDirectPrivate(stream, \"writer\");\n if (writer !== @undefined) {\n const closedPromise = @getByIdDirectPrivate(writer, \"closedPromise\");\n closedPromise.reject.@call(@undefined, storedError), @markPromiseAsHandled(closedPromise.promise);\n }\n})\n"; - -// writableStreamStartErroring -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamStartErroringCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamStartErroringCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamStartErroringCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamStartErroringCodeLength = 537; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamStartErroringCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamStartErroringCode = "(function (stream, reason) {\"use strict\";\n const controller = @getByIdDirectPrivate(stream, \"controller\");\n @putByIdDirectPrivate(stream, \"state\", \"erroring\"), @putByIdDirectPrivate(stream, \"storedError\", reason);\n const writer = @getByIdDirectPrivate(stream, \"writer\");\n if (writer !== @undefined)\n @writableStreamDefaultWriterEnsureReadyPromiseRejected(writer, reason);\n if (!@writableStreamHasOperationMarkedInFlight(stream) && @getByIdDirectPrivate(controller, \"started\") === 1)\n @writableStreamFinishErroring(stream);\n})\n"; - -// writableStreamUpdateBackpressure -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamUpdateBackpressureCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamUpdateBackpressureCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamUpdateBackpressureCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamUpdateBackpressureCodeLength = 453; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamUpdateBackpressureCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamUpdateBackpressureCode = "(function (stream, backpressure) {\"use strict\";\n const writer = @getByIdDirectPrivate(stream, \"writer\");\n if (writer !== @undefined && backpressure !== @getByIdDirectPrivate(stream, \"backpressure\"))\n if (backpressure)\n @putByIdDirectPrivate(writer, \"readyPromise\", @newPromiseCapability(@Promise));\n else\n @getByIdDirectPrivate(writer, \"readyPromise\").resolve.@call();\n @putByIdDirectPrivate(stream, \"backpressure\", backpressure);\n})\n"; - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast(vm.clientData); \ - return clientData->builtinFunctions().writableStreamInternalsBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().writableStreamInternalsBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - - - -JSBuiltinInternalFunctions::JSBuiltinInternalFunctions(JSC::VM& vm) - : m_vm(vm) - , m_readableByteStreamInternals(vm) - , m_readableStreamInternals(vm) - , m_streamInternals(vm) - , m_transformStreamInternals(vm) - , m_writableStreamInternals(vm) - -{ - UNUSED_PARAM(vm); -} - -template -void JSBuiltinInternalFunctions::visit(Visitor& visitor) -{ - m_readableByteStreamInternals.visit(visitor); - m_readableStreamInternals.visit(visitor); - m_streamInternals.visit(visitor); - m_transformStreamInternals.visit(visitor); - m_writableStreamInternals.visit(visitor); - - UNUSED_PARAM(visitor); -} - -template void JSBuiltinInternalFunctions::visit(AbstractSlotVisitor&); -template void JSBuiltinInternalFunctions::visit(SlotVisitor&); - -SUPPRESS_ASAN void JSBuiltinInternalFunctions::initialize(Zig::GlobalObject& globalObject) -{ - UNUSED_PARAM(globalObject); - m_readableByteStreamInternals.init(globalObject); - m_readableStreamInternals.init(globalObject); - m_streamInternals.init(globalObject); - m_transformStreamInternals.init(globalObject); - m_writableStreamInternals.init(globalObject); - - JSVMClientData& clientData = *static_cast(m_vm.clientData); - Zig::GlobalObject::GlobalPropertyInfo staticGlobals[] = { -#define DECLARE_GLOBAL_STATIC(name) \ - Zig::GlobalObject::GlobalPropertyInfo( \ - clientData.builtinFunctions().readableByteStreamInternalsBuiltins().name##PrivateName(), readableByteStreamInternals().m_##name##Function.get() , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly), - WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_GLOBAL_STATIC) - #undef DECLARE_GLOBAL_STATIC - #define DECLARE_GLOBAL_STATIC(name) \ - Zig::GlobalObject::GlobalPropertyInfo( \ - clientData.builtinFunctions().readableStreamInternalsBuiltins().name##PrivateName(), readableStreamInternals().m_##name##Function.get() , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly), - WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_GLOBAL_STATIC) - #undef DECLARE_GLOBAL_STATIC - #define DECLARE_GLOBAL_STATIC(name) \ - Zig::GlobalObject::GlobalPropertyInfo( \ - clientData.builtinFunctions().streamInternalsBuiltins().name##PrivateName(), streamInternals().m_##name##Function.get() , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly), - WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_GLOBAL_STATIC) - #undef DECLARE_GLOBAL_STATIC - #define DECLARE_GLOBAL_STATIC(name) \ - Zig::GlobalObject::GlobalPropertyInfo( \ - clientData.builtinFunctions().transformStreamInternalsBuiltins().name##PrivateName(), transformStreamInternals().m_##name##Function.get() , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly), - WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_GLOBAL_STATIC) - #undef DECLARE_GLOBAL_STATIC - #define DECLARE_GLOBAL_STATIC(name) \ - Zig::GlobalObject::GlobalPropertyInfo( \ - clientData.builtinFunctions().writableStreamInternalsBuiltins().name##PrivateName(), writableStreamInternals().m_##name##Function.get() , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly), - WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_GLOBAL_STATIC) - #undef DECLARE_GLOBAL_STATIC - - }; - globalObject.addStaticGlobals(staticGlobals, std::size(staticGlobals)); - UNUSED_PARAM(clientData); -} - -} // namespace WebCore diff --git a/src/js/out/WebCoreJSBuiltins.d.ts b/src/js/out/WebCoreJSBuiltins.d.ts deleted file mode 100644 index f984624984bc7..0000000000000 --- a/src/js/out/WebCoreJSBuiltins.d.ts +++ /dev/null @@ -1,199 +0,0 @@ -// Generated by `bun src/js/builtins/codegen` -// Do not edit by hand. -type RemoveThis = F extends (this: infer T, ...args: infer A) => infer R ? (...args: A) => R : F; - -// ReadableByteStreamInternals.ts -declare const $isReadableByteStreamController: RemoveThis; -declare const $isReadableStreamBYOBReader: RemoveThis; -declare const $isReadableStreamBYOBRequest: RemoveThis; -declare const $privateInitializeReadableByteStreamController: RemoveThis; -declare const $privateInitializeReadableStreamBYOBRequest: RemoveThis; -declare const $readableByteStreamControllerCallPullIfNeeded: RemoveThis; -declare const $readableByteStreamControllerCancel: RemoveThis; -declare const $readableByteStreamControllerClearPendingPullIntos: RemoveThis; -declare const $readableByteStreamControllerClose: RemoveThis; -declare const $readableByteStreamControllerCommitDescriptor: RemoveThis; -declare const $readableByteStreamControllerConvertDescriptor: RemoveThis; -declare const $readableByteStreamControllerEnqueue: RemoveThis; -declare const $readableByteStreamControllerEnqueueChunk: RemoveThis; -declare const $readableByteStreamControllerError: RemoveThis; -declare const $readableByteStreamControllerFillDescriptorFromQueue: RemoveThis; -declare const $readableByteStreamControllerGetDesiredSize: RemoveThis; -declare const $readableByteStreamControllerHandleQueueDrain: RemoveThis; -declare const $readableByteStreamControllerInvalidateBYOBRequest: RemoveThis; -declare const $readableByteStreamControllerProcessPullDescriptors: RemoveThis; -declare const $readableByteStreamControllerPull: RemoveThis; -declare const $readableByteStreamControllerPullInto: RemoveThis; -declare const $readableByteStreamControllerRespond: RemoveThis; -declare const $readableByteStreamControllerRespondInClosedState: RemoveThis; -declare const $readableByteStreamControllerRespondInReadableState: RemoveThis; -declare const $readableByteStreamControllerRespondInternal: RemoveThis; -declare const $readableByteStreamControllerRespondWithNewView: RemoveThis; -declare const $readableByteStreamControllerShiftPendingDescriptor: RemoveThis; -declare const $readableByteStreamControllerShouldCallPull: RemoveThis; -declare const $readableStreamAddReadIntoRequest: RemoveThis; -declare const $readableStreamBYOBReaderRead: RemoveThis; -declare const $readableStreamByteStreamControllerStart: RemoveThis; -declare const $readableStreamFulfillReadIntoRequest: RemoveThis; -declare const $readableStreamHasBYOBReader: RemoveThis; -declare const $readableStreamHasDefaultReader: RemoveThis; -declare const $readableStreamReaderKind: RemoveThis; -declare const $transferBufferToCurrentRealm: RemoveThis; - -// ReadableStreamInternals.ts -declare const $acquireReadableStreamDefaultReader: RemoveThis; -declare const $assignToStream: RemoveThis; -declare const $createReadableStreamController: RemoveThis; -declare const $createTextStream: RemoveThis; -declare const $handleDirectStreamError: RemoveThis; -declare const $handleDirectStreamErrorReject: RemoveThis; -declare const $initializeArrayBufferStream: RemoveThis; -declare const $initializeArrayStream: RemoveThis; -declare const $initializeTextStream: RemoveThis; -declare const $isReadableStream: RemoveThis; -declare const $isReadableStreamDefaultController: RemoveThis; -declare const $isReadableStreamDefaultReader: RemoveThis; -declare const $isReadableStreamDisturbed: RemoveThis; -declare const $isReadableStreamLocked: RemoveThis; -declare const $lazyLoadStream: RemoveThis; -declare const $noopDoneFunction: RemoveThis; -declare const $onCloseDirectStream: RemoveThis; -declare const $onFlushDirectStream: RemoveThis; -declare const $onPullDirectStream: RemoveThis; -declare const $onReadableStreamDirectControllerClosed: RemoveThis; -declare const $pipeToClosingMustBePropagatedBackward: RemoveThis; -declare const $pipeToClosingMustBePropagatedForward: RemoveThis; -declare const $pipeToDoReadWrite: RemoveThis; -declare const $pipeToErrorsMustBePropagatedBackward: RemoveThis; -declare const $pipeToErrorsMustBePropagatedForward: RemoveThis; -declare const $pipeToFinalize: RemoveThis; -declare const $pipeToLoop: RemoveThis; -declare const $pipeToShutdown: RemoveThis; -declare const $pipeToShutdownWithAction: RemoveThis; -declare const $privateInitializeReadableStreamDefaultController: RemoveThis; -declare const $readableStreamAddReadRequest: RemoveThis; -declare const $readableStreamCancel: RemoveThis; -declare const $readableStreamClose: RemoveThis; -declare const $readableStreamDefaultControllerCallPullIfNeeded: RemoveThis; -declare const $readableStreamDefaultControllerCancel: RemoveThis; -declare const $readableStreamDefaultControllerCanCloseOrEnqueue: RemoveThis; -declare const $readableStreamDefaultControllerClose: RemoveThis; -declare const $readableStreamDefaultControllerEnqueue: RemoveThis; -declare const $readableStreamDefaultControllerError: RemoveThis; -declare const $readableStreamDefaultControllerGetDesiredSize: RemoveThis; -declare const $readableStreamDefaultControllerPull: RemoveThis; -declare const $readableStreamDefaultControllerShouldCallPull: RemoveThis; -declare const $readableStreamDefaultControllerStart: RemoveThis; -declare const $readableStreamDefaultReaderRead: RemoveThis; -declare const $readableStreamDefineLazyIterators: RemoveThis; -declare const $readableStreamError: RemoveThis; -declare const $readableStreamFulfillReadRequest: RemoveThis; -declare const $readableStreamIntoArray: RemoveThis; -declare const $readableStreamIntoText: RemoveThis; -declare const $readableStreamPipeTo: RemoveThis; -declare const $readableStreamPipeToWritableStream: RemoveThis; -declare const $readableStreamReaderGenericCancel: RemoveThis; -declare const $readableStreamReaderGenericInitialize: RemoveThis; -declare const $readableStreamReaderGenericRelease: RemoveThis; -declare const $readableStreamTee: RemoveThis; -declare const $readableStreamTeeBranch1CancelFunction: RemoveThis; -declare const $readableStreamTeeBranch2CancelFunction: RemoveThis; -declare const $readableStreamTeePullFunction: RemoveThis; -declare const $readableStreamToArrayBufferDirect: RemoveThis; -declare const $readableStreamToArrayDirect: RemoveThis; -declare const $readableStreamToTextDirect: RemoveThis; -declare const $readDirectStream: RemoveThis; -declare const $readStreamIntoSink: RemoveThis; -declare const $setupReadableStreamDefaultController: RemoveThis; - -// StreamInternals.ts -declare const $createFIFO: RemoveThis; -declare const $createFulfilledPromise: RemoveThis; -declare const $dequeueValue: RemoveThis; -declare const $enqueueValueWithSize: RemoveThis; -declare const $extractHighWaterMark: RemoveThis; -declare const $extractHighWaterMarkFromQueuingStrategyInit: RemoveThis; -declare const $extractSizeAlgorithm: RemoveThis; -declare const $markPromiseAsHandled: RemoveThis; -declare const $newQueue: RemoveThis; -declare const $peekQueueValue: RemoveThis; -declare const $promiseInvokeOrFallbackOrNoop: RemoveThis; -declare const $promiseInvokeOrNoop: RemoveThis; -declare const $promiseInvokeOrNoopMethod: RemoveThis; -declare const $promiseInvokeOrNoopMethodNoCatch: RemoveThis; -declare const $promiseInvokeOrNoopNoCatch: RemoveThis; -declare const $resetQueue: RemoveThis; -declare const $shieldingPromiseResolve: RemoveThis; -declare const $toDictionary: RemoveThis; -declare const $validateAndNormalizeQueuingStrategy: RemoveThis; - -// TransformStreamInternals.ts -declare const $createTransformStream: RemoveThis; -declare const $initializeTransformStream: RemoveThis; -declare const $isTransformStream: RemoveThis; -declare const $isTransformStreamDefaultController: RemoveThis; -declare const $setUpTransformStreamDefaultController: RemoveThis; -declare const $setUpTransformStreamDefaultControllerFromTransformer: RemoveThis; -declare const $transformStreamDefaultControllerClearAlgorithms: RemoveThis; -declare const $transformStreamDefaultControllerEnqueue: RemoveThis; -declare const $transformStreamDefaultControllerError: RemoveThis; -declare const $transformStreamDefaultControllerPerformTransform: RemoveThis; -declare const $transformStreamDefaultControllerTerminate: RemoveThis; -declare const $transformStreamDefaultSinkAbortAlgorithm: RemoveThis; -declare const $transformStreamDefaultSinkCloseAlgorithm: RemoveThis; -declare const $transformStreamDefaultSinkWriteAlgorithm: RemoveThis; -declare const $transformStreamDefaultSourcePullAlgorithm: RemoveThis; -declare const $transformStreamError: RemoveThis; -declare const $transformStreamErrorWritableAndUnblockWrite: RemoveThis; -declare const $transformStreamSetBackpressure: RemoveThis; - -// WritableStreamInternals.ts -declare const $acquireWritableStreamDefaultWriter: RemoveThis; -declare const $createInternalWritableStreamFromUnderlyingSink: RemoveThis; -declare const $createWritableStream: RemoveThis; -declare const $initializeWritableStreamSlots: RemoveThis; -declare const $isCloseSentinel: RemoveThis; -declare const $isWritableStream: RemoveThis; -declare const $isWritableStreamDefaultWriter: RemoveThis; -declare const $isWritableStreamLocked: RemoveThis; -declare const $setUpWritableStreamDefaultController: RemoveThis; -declare const $setUpWritableStreamDefaultControllerFromUnderlyingSink: RemoveThis; -declare const $setUpWritableStreamDefaultWriter: RemoveThis; -declare const $writableStreamAbort: RemoveThis; -declare const $writableStreamAbortForBindings: RemoveThis; -declare const $writableStreamAddWriteRequest: RemoveThis; -declare const $writableStreamClose: RemoveThis; -declare const $writableStreamCloseForBindings: RemoveThis; -declare const $writableStreamCloseQueuedOrInFlight: RemoveThis; -declare const $writableStreamDealWithRejection: RemoveThis; -declare const $writableStreamDefaultControllerAdvanceQueueIfNeeded: RemoveThis; -declare const $writableStreamDefaultControllerClearAlgorithms: RemoveThis; -declare const $writableStreamDefaultControllerClose: RemoveThis; -declare const $writableStreamDefaultControllerError: RemoveThis; -declare const $writableStreamDefaultControllerErrorIfNeeded: RemoveThis; -declare const $writableStreamDefaultControllerGetBackpressure: RemoveThis; -declare const $writableStreamDefaultControllerGetChunkSize: RemoveThis; -declare const $writableStreamDefaultControllerGetDesiredSize: RemoveThis; -declare const $writableStreamDefaultControllerProcessClose: RemoveThis; -declare const $writableStreamDefaultControllerProcessWrite: RemoveThis; -declare const $writableStreamDefaultControllerStart: RemoveThis; -declare const $writableStreamDefaultControllerWrite: RemoveThis; -declare const $writableStreamDefaultWriterAbort: RemoveThis; -declare const $writableStreamDefaultWriterClose: RemoveThis; -declare const $writableStreamDefaultWriterCloseWithErrorPropagation: RemoveThis; -declare const $writableStreamDefaultWriterEnsureClosedPromiseRejected: RemoveThis; -declare const $writableStreamDefaultWriterEnsureReadyPromiseRejected: RemoveThis; -declare const $writableStreamDefaultWriterGetDesiredSize: RemoveThis; -declare const $writableStreamDefaultWriterRelease: RemoveThis; -declare const $writableStreamDefaultWriterWrite: RemoveThis; -declare const $writableStreamFinishErroring: RemoveThis; -declare const $writableStreamFinishInFlightClose: RemoveThis; -declare const $writableStreamFinishInFlightCloseWithError: RemoveThis; -declare const $writableStreamFinishInFlightWrite: RemoveThis; -declare const $writableStreamFinishInFlightWriteWithError: RemoveThis; -declare const $writableStreamHasOperationMarkedInFlight: RemoveThis; -declare const $writableStreamMarkCloseRequestInFlight: RemoveThis; -declare const $writableStreamMarkFirstWriteRequestInFlight: RemoveThis; -declare const $writableStreamRejectCloseAndClosedPromiseIfNeeded: RemoveThis; -declare const $writableStreamStartErroring: RemoveThis; -declare const $writableStreamUpdateBackpressure: RemoveThis; diff --git a/src/js/out/WebCoreJSBuiltins.h b/src/js/out/WebCoreJSBuiltins.h deleted file mode 100644 index 8319d6c4ad0e0..0000000000000 --- a/src/js/out/WebCoreJSBuiltins.h +++ /dev/null @@ -1,5854 +0,0 @@ -// Generated by `bun src/js/builtins/codegen` -// Do not edit by hand. -#pragma once -namespace Zig { class GlobalObject; } -#include "root.h" -#include -#include -#include -#include -#include -#include - -namespace JSC { -class FunctionExecutable; -} - -namespace WebCore { -/* BundlerPlugin.ts */ -// runOnLoadPlugins -#define WEBCORE_BUILTIN_BUNDLERPLUGIN_RUNONLOADPLUGINS 1 -extern const char* const s_bundlerPluginRunOnLoadPluginsCode; -extern const int s_bundlerPluginRunOnLoadPluginsCodeLength; -extern const JSC::ConstructAbility s_bundlerPluginRunOnLoadPluginsCodeConstructAbility; -extern const JSC::ConstructorKind s_bundlerPluginRunOnLoadPluginsCodeConstructorKind; -extern const JSC::ImplementationVisibility s_bundlerPluginRunOnLoadPluginsCodeImplementationVisibility; - -// runOnResolvePlugins -#define WEBCORE_BUILTIN_BUNDLERPLUGIN_RUNONRESOLVEPLUGINS 1 -extern const char* const s_bundlerPluginRunOnResolvePluginsCode; -extern const int s_bundlerPluginRunOnResolvePluginsCodeLength; -extern const JSC::ConstructAbility s_bundlerPluginRunOnResolvePluginsCodeConstructAbility; -extern const JSC::ConstructorKind s_bundlerPluginRunOnResolvePluginsCodeConstructorKind; -extern const JSC::ImplementationVisibility s_bundlerPluginRunOnResolvePluginsCodeImplementationVisibility; - -// runSetupFunction -#define WEBCORE_BUILTIN_BUNDLERPLUGIN_RUNSETUPFUNCTION 1 -extern const char* const s_bundlerPluginRunSetupFunctionCode; -extern const int s_bundlerPluginRunSetupFunctionCodeLength; -extern const JSC::ConstructAbility s_bundlerPluginRunSetupFunctionCodeConstructAbility; -extern const JSC::ConstructorKind s_bundlerPluginRunSetupFunctionCodeConstructorKind; -extern const JSC::ImplementationVisibility s_bundlerPluginRunSetupFunctionCodeImplementationVisibility; - -#define WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_DATA(macro) \ - macro(runOnLoadPlugins, bundlerPluginRunOnLoadPlugins, 4) \ - macro(runOnResolvePlugins, bundlerPluginRunOnResolvePlugins, 5) \ - macro(runSetupFunction, bundlerPluginRunSetupFunction, 2) \ - -#define WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_CODE(macro) \ - macro(bundlerPluginRunOnLoadPluginsCode, runOnLoadPlugins, ASCIILiteral(), s_bundlerPluginRunOnLoadPluginsCodeLength) \ - macro(bundlerPluginRunOnResolvePluginsCode, runOnResolvePlugins, ASCIILiteral(), s_bundlerPluginRunOnResolvePluginsCodeLength) \ - macro(bundlerPluginRunSetupFunctionCode, runSetupFunction, ASCIILiteral(), s_bundlerPluginRunSetupFunctionCodeLength) \ - -#define WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_FUNCTION_NAME(macro) \ - macro(runOnLoadPlugins) \ - macro(runOnResolvePlugins) \ - macro(runSetupFunction) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class BundlerPluginBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit BundlerPluginBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { }, JSC::SourceTaintedOrigin::Untainted)) - WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak m_##name##Executable; - WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* BundlerPluginBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void BundlerPluginBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} -/* ByteLengthQueuingStrategy.ts */ -// highWaterMark -#define WEBCORE_BUILTIN_BYTELENGTHQUEUINGSTRATEGY_HIGHWATERMARK 1 -extern const char* const s_byteLengthQueuingStrategyHighWaterMarkCode; -extern const int s_byteLengthQueuingStrategyHighWaterMarkCodeLength; -extern const JSC::ConstructAbility s_byteLengthQueuingStrategyHighWaterMarkCodeConstructAbility; -extern const JSC::ConstructorKind s_byteLengthQueuingStrategyHighWaterMarkCodeConstructorKind; -extern const JSC::ImplementationVisibility s_byteLengthQueuingStrategyHighWaterMarkCodeImplementationVisibility; - -// initializeByteLengthQueuingStrategy -#define WEBCORE_BUILTIN_BYTELENGTHQUEUINGSTRATEGY_INITIALIZEBYTELENGTHQUEUINGSTRATEGY 1 -extern const char* const s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCode; -extern const int s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCodeLength; -extern const JSC::ConstructAbility s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCodeConstructAbility; -extern const JSC::ConstructorKind s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCodeConstructorKind; -extern const JSC::ImplementationVisibility s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCodeImplementationVisibility; - -// size -#define WEBCORE_BUILTIN_BYTELENGTHQUEUINGSTRATEGY_SIZE 1 -extern const char* const s_byteLengthQueuingStrategySizeCode; -extern const int s_byteLengthQueuingStrategySizeCodeLength; -extern const JSC::ConstructAbility s_byteLengthQueuingStrategySizeCodeConstructAbility; -extern const JSC::ConstructorKind s_byteLengthQueuingStrategySizeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_byteLengthQueuingStrategySizeCodeImplementationVisibility; - -#define WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_DATA(macro) \ - macro(highWaterMark, byteLengthQueuingStrategyHighWaterMark, 0) \ - macro(initializeByteLengthQueuingStrategy, byteLengthQueuingStrategyInitializeByteLengthQueuingStrategy, 1) \ - macro(size, byteLengthQueuingStrategySize, 1) \ - -#define WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_CODE(macro) \ - macro(byteLengthQueuingStrategyHighWaterMarkCode, highWaterMark, "get highWaterMark"_s, s_byteLengthQueuingStrategyHighWaterMarkCodeLength) \ - macro(byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCode, initializeByteLengthQueuingStrategy, ASCIILiteral(), s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCodeLength) \ - macro(byteLengthQueuingStrategySizeCode, size, ASCIILiteral(), s_byteLengthQueuingStrategySizeCodeLength) \ - -#define WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_FUNCTION_NAME(macro) \ - macro(highWaterMark) \ - macro(initializeByteLengthQueuingStrategy) \ - macro(size) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class ByteLengthQueuingStrategyBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit ByteLengthQueuingStrategyBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { }, JSC::SourceTaintedOrigin::Untainted)) - WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak m_##name##Executable; - WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* ByteLengthQueuingStrategyBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void ByteLengthQueuingStrategyBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} -/* ConsoleObject.ts */ -// asyncIterator -#define WEBCORE_BUILTIN_CONSOLEOBJECT_ASYNCITERATOR 1 -extern const char* const s_consoleObjectAsyncIteratorCode; -extern const int s_consoleObjectAsyncIteratorCodeLength; -extern const JSC::ConstructAbility s_consoleObjectAsyncIteratorCodeConstructAbility; -extern const JSC::ConstructorKind s_consoleObjectAsyncIteratorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_consoleObjectAsyncIteratorCodeImplementationVisibility; - -// createConsoleConstructor -#define WEBCORE_BUILTIN_CONSOLEOBJECT_CREATECONSOLECONSTRUCTOR 1 -extern const char* const s_consoleObjectCreateConsoleConstructorCode; -extern const int s_consoleObjectCreateConsoleConstructorCodeLength; -extern const JSC::ConstructAbility s_consoleObjectCreateConsoleConstructorCodeConstructAbility; -extern const JSC::ConstructorKind s_consoleObjectCreateConsoleConstructorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_consoleObjectCreateConsoleConstructorCodeImplementationVisibility; - -// write -#define WEBCORE_BUILTIN_CONSOLEOBJECT_WRITE 1 -extern const char* const s_consoleObjectWriteCode; -extern const int s_consoleObjectWriteCodeLength; -extern const JSC::ConstructAbility s_consoleObjectWriteCodeConstructAbility; -extern const JSC::ConstructorKind s_consoleObjectWriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_consoleObjectWriteCodeImplementationVisibility; - -#define WEBCORE_FOREACH_CONSOLEOBJECT_BUILTIN_DATA(macro) \ - macro(asyncIterator, consoleObjectAsyncIterator, 0) \ - macro(createConsoleConstructor, consoleObjectCreateConsoleConstructor, 1) \ - macro(write, consoleObjectWrite, 1) \ - -#define WEBCORE_FOREACH_CONSOLEOBJECT_BUILTIN_CODE(macro) \ - macro(consoleObjectAsyncIteratorCode, asyncIterator, "[Symbol.asyncIterator]"_s, s_consoleObjectAsyncIteratorCodeLength) \ - macro(consoleObjectCreateConsoleConstructorCode, createConsoleConstructor, ASCIILiteral(), s_consoleObjectCreateConsoleConstructorCodeLength) \ - macro(consoleObjectWriteCode, write, ASCIILiteral(), s_consoleObjectWriteCodeLength) \ - -#define WEBCORE_FOREACH_CONSOLEOBJECT_BUILTIN_FUNCTION_NAME(macro) \ - macro(asyncIterator) \ - macro(createConsoleConstructor) \ - macro(write) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_CONSOLEOBJECT_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class ConsoleObjectBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit ConsoleObjectBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_CONSOLEOBJECT_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { }, JSC::SourceTaintedOrigin::Untainted)) - WEBCORE_FOREACH_CONSOLEOBJECT_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_CONSOLEOBJECT_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_CONSOLEOBJECT_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_CONSOLEOBJECT_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak m_##name##Executable; - WEBCORE_FOREACH_CONSOLEOBJECT_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* ConsoleObjectBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_CONSOLEOBJECT_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void ConsoleObjectBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_CONSOLEOBJECT_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} -/* CountQueuingStrategy.ts */ -// highWaterMark -#define WEBCORE_BUILTIN_COUNTQUEUINGSTRATEGY_HIGHWATERMARK 1 -extern const char* const s_countQueuingStrategyHighWaterMarkCode; -extern const int s_countQueuingStrategyHighWaterMarkCodeLength; -extern const JSC::ConstructAbility s_countQueuingStrategyHighWaterMarkCodeConstructAbility; -extern const JSC::ConstructorKind s_countQueuingStrategyHighWaterMarkCodeConstructorKind; -extern const JSC::ImplementationVisibility s_countQueuingStrategyHighWaterMarkCodeImplementationVisibility; - -// initializeCountQueuingStrategy -#define WEBCORE_BUILTIN_COUNTQUEUINGSTRATEGY_INITIALIZECOUNTQUEUINGSTRATEGY 1 -extern const char* const s_countQueuingStrategyInitializeCountQueuingStrategyCode; -extern const int s_countQueuingStrategyInitializeCountQueuingStrategyCodeLength; -extern const JSC::ConstructAbility s_countQueuingStrategyInitializeCountQueuingStrategyCodeConstructAbility; -extern const JSC::ConstructorKind s_countQueuingStrategyInitializeCountQueuingStrategyCodeConstructorKind; -extern const JSC::ImplementationVisibility s_countQueuingStrategyInitializeCountQueuingStrategyCodeImplementationVisibility; - -// size -#define WEBCORE_BUILTIN_COUNTQUEUINGSTRATEGY_SIZE 1 -extern const char* const s_countQueuingStrategySizeCode; -extern const int s_countQueuingStrategySizeCodeLength; -extern const JSC::ConstructAbility s_countQueuingStrategySizeCodeConstructAbility; -extern const JSC::ConstructorKind s_countQueuingStrategySizeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_countQueuingStrategySizeCodeImplementationVisibility; - -#define WEBCORE_FOREACH_COUNTQUEUINGSTRATEGY_BUILTIN_DATA(macro) \ - macro(highWaterMark, countQueuingStrategyHighWaterMark, 0) \ - macro(initializeCountQueuingStrategy, countQueuingStrategyInitializeCountQueuingStrategy, 1) \ - macro(size, countQueuingStrategySize, 0) \ - -#define WEBCORE_FOREACH_COUNTQUEUINGSTRATEGY_BUILTIN_CODE(macro) \ - macro(countQueuingStrategyHighWaterMarkCode, highWaterMark, "get highWaterMark"_s, s_countQueuingStrategyHighWaterMarkCodeLength) \ - macro(countQueuingStrategyInitializeCountQueuingStrategyCode, initializeCountQueuingStrategy, ASCIILiteral(), s_countQueuingStrategyInitializeCountQueuingStrategyCodeLength) \ - macro(countQueuingStrategySizeCode, size, ASCIILiteral(), s_countQueuingStrategySizeCodeLength) \ - -#define WEBCORE_FOREACH_COUNTQUEUINGSTRATEGY_BUILTIN_FUNCTION_NAME(macro) \ - macro(highWaterMark) \ - macro(initializeCountQueuingStrategy) \ - macro(size) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_COUNTQUEUINGSTRATEGY_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class CountQueuingStrategyBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit CountQueuingStrategyBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_COUNTQUEUINGSTRATEGY_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { }, JSC::SourceTaintedOrigin::Untainted)) - WEBCORE_FOREACH_COUNTQUEUINGSTRATEGY_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_COUNTQUEUINGSTRATEGY_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_COUNTQUEUINGSTRATEGY_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_COUNTQUEUINGSTRATEGY_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak m_##name##Executable; - WEBCORE_FOREACH_COUNTQUEUINGSTRATEGY_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* CountQueuingStrategyBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_COUNTQUEUINGSTRATEGY_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void CountQueuingStrategyBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_COUNTQUEUINGSTRATEGY_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} -/* EventSource.ts */ -// getEventSource -#define WEBCORE_BUILTIN_EVENTSOURCE_GETEVENTSOURCE 1 -extern const char* const s_eventSourceGetEventSourceCode; -extern const int s_eventSourceGetEventSourceCodeLength; -extern const JSC::ConstructAbility s_eventSourceGetEventSourceCodeConstructAbility; -extern const JSC::ConstructorKind s_eventSourceGetEventSourceCodeConstructorKind; -extern const JSC::ImplementationVisibility s_eventSourceGetEventSourceCodeImplementationVisibility; - -#define WEBCORE_FOREACH_EVENTSOURCE_BUILTIN_DATA(macro) \ - macro(getEventSource, eventSourceGetEventSource, 0) \ - -#define WEBCORE_FOREACH_EVENTSOURCE_BUILTIN_CODE(macro) \ - macro(eventSourceGetEventSourceCode, getEventSource, ASCIILiteral(), s_eventSourceGetEventSourceCodeLength) \ - -#define WEBCORE_FOREACH_EVENTSOURCE_BUILTIN_FUNCTION_NAME(macro) \ - macro(getEventSource) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_EVENTSOURCE_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class EventSourceBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit EventSourceBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_EVENTSOURCE_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { }, JSC::SourceTaintedOrigin::Untainted)) - WEBCORE_FOREACH_EVENTSOURCE_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_EVENTSOURCE_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_EVENTSOURCE_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_EVENTSOURCE_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak m_##name##Executable; - WEBCORE_FOREACH_EVENTSOURCE_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* EventSourceBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_EVENTSOURCE_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void EventSourceBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_EVENTSOURCE_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} -/* ImportMetaObject.ts */ -// createRequireCache -#define WEBCORE_BUILTIN_IMPORTMETAOBJECT_CREATEREQUIRECACHE 1 -extern const char* const s_importMetaObjectCreateRequireCacheCode; -extern const int s_importMetaObjectCreateRequireCacheCodeLength; -extern const JSC::ConstructAbility s_importMetaObjectCreateRequireCacheCodeConstructAbility; -extern const JSC::ConstructorKind s_importMetaObjectCreateRequireCacheCodeConstructorKind; -extern const JSC::ImplementationVisibility s_importMetaObjectCreateRequireCacheCodeImplementationVisibility; - -// internalRequire -#define WEBCORE_BUILTIN_IMPORTMETAOBJECT_INTERNALREQUIRE 1 -extern const char* const s_importMetaObjectInternalRequireCode; -extern const int s_importMetaObjectInternalRequireCodeLength; -extern const JSC::ConstructAbility s_importMetaObjectInternalRequireCodeConstructAbility; -extern const JSC::ConstructorKind s_importMetaObjectInternalRequireCodeConstructorKind; -extern const JSC::ImplementationVisibility s_importMetaObjectInternalRequireCodeImplementationVisibility; - -// loadCJS2ESM -#define WEBCORE_BUILTIN_IMPORTMETAOBJECT_LOADCJS2ESM 1 -extern const char* const s_importMetaObjectLoadCJS2ESMCode; -extern const int s_importMetaObjectLoadCJS2ESMCodeLength; -extern const JSC::ConstructAbility s_importMetaObjectLoadCJS2ESMCodeConstructAbility; -extern const JSC::ConstructorKind s_importMetaObjectLoadCJS2ESMCodeConstructorKind; -extern const JSC::ImplementationVisibility s_importMetaObjectLoadCJS2ESMCodeImplementationVisibility; - -// main -#define WEBCORE_BUILTIN_IMPORTMETAOBJECT_MAIN 1 -extern const char* const s_importMetaObjectMainCode; -extern const int s_importMetaObjectMainCodeLength; -extern const JSC::ConstructAbility s_importMetaObjectMainCodeConstructAbility; -extern const JSC::ConstructorKind s_importMetaObjectMainCodeConstructorKind; -extern const JSC::ImplementationVisibility s_importMetaObjectMainCodeImplementationVisibility; - -// requireESM -#define WEBCORE_BUILTIN_IMPORTMETAOBJECT_REQUIREESM 1 -extern const char* const s_importMetaObjectRequireESMCode; -extern const int s_importMetaObjectRequireESMCodeLength; -extern const JSC::ConstructAbility s_importMetaObjectRequireESMCodeConstructAbility; -extern const JSC::ConstructorKind s_importMetaObjectRequireESMCodeConstructorKind; -extern const JSC::ImplementationVisibility s_importMetaObjectRequireESMCodeImplementationVisibility; - -#define WEBCORE_FOREACH_IMPORTMETAOBJECT_BUILTIN_DATA(macro) \ - macro(createRequireCache, importMetaObjectCreateRequireCache, 0) \ - macro(internalRequire, importMetaObjectInternalRequire, 1) \ - macro(loadCJS2ESM, importMetaObjectLoadCJS2ESM, 1) \ - macro(main, importMetaObjectMain, 0) \ - macro(requireESM, importMetaObjectRequireESM, 1) \ - -#define WEBCORE_FOREACH_IMPORTMETAOBJECT_BUILTIN_CODE(macro) \ - macro(importMetaObjectCreateRequireCacheCode, createRequireCache, ASCIILiteral(), s_importMetaObjectCreateRequireCacheCodeLength) \ - macro(importMetaObjectInternalRequireCode, internalRequire, ASCIILiteral(), s_importMetaObjectInternalRequireCodeLength) \ - macro(importMetaObjectLoadCJS2ESMCode, loadCJS2ESM, ASCIILiteral(), s_importMetaObjectLoadCJS2ESMCodeLength) \ - macro(importMetaObjectMainCode, main, "get main"_s, s_importMetaObjectMainCodeLength) \ - macro(importMetaObjectRequireESMCode, requireESM, ASCIILiteral(), s_importMetaObjectRequireESMCodeLength) \ - -#define WEBCORE_FOREACH_IMPORTMETAOBJECT_BUILTIN_FUNCTION_NAME(macro) \ - macro(createRequireCache) \ - macro(internalRequire) \ - macro(loadCJS2ESM) \ - macro(main) \ - macro(requireESM) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_IMPORTMETAOBJECT_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class ImportMetaObjectBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit ImportMetaObjectBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_IMPORTMETAOBJECT_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { }, JSC::SourceTaintedOrigin::Untainted)) - WEBCORE_FOREACH_IMPORTMETAOBJECT_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_IMPORTMETAOBJECT_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_IMPORTMETAOBJECT_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_IMPORTMETAOBJECT_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak m_##name##Executable; - WEBCORE_FOREACH_IMPORTMETAOBJECT_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* ImportMetaObjectBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_IMPORTMETAOBJECT_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void ImportMetaObjectBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_IMPORTMETAOBJECT_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} -/* JSBufferConstructor.ts */ -// from -#define WEBCORE_BUILTIN_JSBUFFERCONSTRUCTOR_FROM 1 -extern const char* const s_jsBufferConstructorFromCode; -extern const int s_jsBufferConstructorFromCodeLength; -extern const JSC::ConstructAbility s_jsBufferConstructorFromCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferConstructorFromCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferConstructorFromCodeImplementationVisibility; - -// isBuffer -#define WEBCORE_BUILTIN_JSBUFFERCONSTRUCTOR_ISBUFFER 1 -extern const char* const s_jsBufferConstructorIsBufferCode; -extern const int s_jsBufferConstructorIsBufferCodeLength; -extern const JSC::ConstructAbility s_jsBufferConstructorIsBufferCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferConstructorIsBufferCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferConstructorIsBufferCodeImplementationVisibility; - -#define WEBCORE_FOREACH_JSBUFFERCONSTRUCTOR_BUILTIN_DATA(macro) \ - macro(from, jsBufferConstructorFrom, 1) \ - macro(isBuffer, jsBufferConstructorIsBuffer, 1) \ - -#define WEBCORE_FOREACH_JSBUFFERCONSTRUCTOR_BUILTIN_CODE(macro) \ - macro(jsBufferConstructorFromCode, from, ASCIILiteral(), s_jsBufferConstructorFromCodeLength) \ - macro(jsBufferConstructorIsBufferCode, isBuffer, ASCIILiteral(), s_jsBufferConstructorIsBufferCodeLength) \ - -#define WEBCORE_FOREACH_JSBUFFERCONSTRUCTOR_BUILTIN_FUNCTION_NAME(macro) \ - macro(from) \ - macro(isBuffer) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_JSBUFFERCONSTRUCTOR_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class JSBufferConstructorBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit JSBufferConstructorBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_JSBUFFERCONSTRUCTOR_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { }, JSC::SourceTaintedOrigin::Untainted)) - WEBCORE_FOREACH_JSBUFFERCONSTRUCTOR_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_JSBUFFERCONSTRUCTOR_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_JSBUFFERCONSTRUCTOR_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_JSBUFFERCONSTRUCTOR_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak m_##name##Executable; - WEBCORE_FOREACH_JSBUFFERCONSTRUCTOR_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* JSBufferConstructorBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_JSBUFFERCONSTRUCTOR_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void JSBufferConstructorBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_JSBUFFERCONSTRUCTOR_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} -/* JSBufferPrototype.ts */ -// asciiSlice -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_ASCIISLICE 1 -extern const char* const s_jsBufferPrototypeAsciiSliceCode; -extern const int s_jsBufferPrototypeAsciiSliceCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeAsciiSliceCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeAsciiSliceCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeAsciiSliceCodeImplementationVisibility; - -// asciiWrite -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_ASCIIWRITE 1 -extern const char* const s_jsBufferPrototypeAsciiWriteCode; -extern const int s_jsBufferPrototypeAsciiWriteCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeAsciiWriteCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeAsciiWriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeAsciiWriteCodeImplementationVisibility; - -// base64Slice -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_BASE64SLICE 1 -extern const char* const s_jsBufferPrototypeBase64SliceCode; -extern const int s_jsBufferPrototypeBase64SliceCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeBase64SliceCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeBase64SliceCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeBase64SliceCodeImplementationVisibility; - -// base64urlSlice -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_BASE64URLSLICE 1 -extern const char* const s_jsBufferPrototypeBase64urlSliceCode; -extern const int s_jsBufferPrototypeBase64urlSliceCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeBase64urlSliceCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeBase64urlSliceCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeBase64urlSliceCodeImplementationVisibility; - -// base64urlWrite -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_BASE64URLWRITE 1 -extern const char* const s_jsBufferPrototypeBase64urlWriteCode; -extern const int s_jsBufferPrototypeBase64urlWriteCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeBase64urlWriteCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeBase64urlWriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeBase64urlWriteCodeImplementationVisibility; - -// base64Write -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_BASE64WRITE 1 -extern const char* const s_jsBufferPrototypeBase64WriteCode; -extern const int s_jsBufferPrototypeBase64WriteCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeBase64WriteCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeBase64WriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeBase64WriteCodeImplementationVisibility; - -// hexSlice -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_HEXSLICE 1 -extern const char* const s_jsBufferPrototypeHexSliceCode; -extern const int s_jsBufferPrototypeHexSliceCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeHexSliceCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeHexSliceCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeHexSliceCodeImplementationVisibility; - -// hexWrite -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_HEXWRITE 1 -extern const char* const s_jsBufferPrototypeHexWriteCode; -extern const int s_jsBufferPrototypeHexWriteCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeHexWriteCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeHexWriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeHexWriteCodeImplementationVisibility; - -// inspect -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_INSPECT 1 -extern const char* const s_jsBufferPrototypeInspectCode; -extern const int s_jsBufferPrototypeInspectCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeInspectCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeInspectCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeInspectCodeImplementationVisibility; - -// latin1Slice -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_LATIN1SLICE 1 -extern const char* const s_jsBufferPrototypeLatin1SliceCode; -extern const int s_jsBufferPrototypeLatin1SliceCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeLatin1SliceCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeLatin1SliceCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeLatin1SliceCodeImplementationVisibility; - -// latin1Write -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_LATIN1WRITE 1 -extern const char* const s_jsBufferPrototypeLatin1WriteCode; -extern const int s_jsBufferPrototypeLatin1WriteCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeLatin1WriteCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeLatin1WriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeLatin1WriteCodeImplementationVisibility; - -// offset -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_OFFSET 1 -extern const char* const s_jsBufferPrototypeOffsetCode; -extern const int s_jsBufferPrototypeOffsetCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeOffsetCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeOffsetCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeOffsetCodeImplementationVisibility; - -// parent -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_PARENT 1 -extern const char* const s_jsBufferPrototypeParentCode; -extern const int s_jsBufferPrototypeParentCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeParentCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeParentCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeParentCodeImplementationVisibility; - -// readBigInt64BE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READBIGINT64BE 1 -extern const char* const s_jsBufferPrototypeReadBigInt64BECode; -extern const int s_jsBufferPrototypeReadBigInt64BECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadBigInt64BECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadBigInt64BECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadBigInt64BECodeImplementationVisibility; - -// readBigInt64LE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READBIGINT64LE 1 -extern const char* const s_jsBufferPrototypeReadBigInt64LECode; -extern const int s_jsBufferPrototypeReadBigInt64LECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadBigInt64LECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadBigInt64LECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadBigInt64LECodeImplementationVisibility; - -// readBigUInt64BE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READBIGUINT64BE 1 -extern const char* const s_jsBufferPrototypeReadBigUInt64BECode; -extern const int s_jsBufferPrototypeReadBigUInt64BECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadBigUInt64BECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadBigUInt64BECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadBigUInt64BECodeImplementationVisibility; - -// readBigUInt64LE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READBIGUINT64LE 1 -extern const char* const s_jsBufferPrototypeReadBigUInt64LECode; -extern const int s_jsBufferPrototypeReadBigUInt64LECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadBigUInt64LECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadBigUInt64LECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadBigUInt64LECodeImplementationVisibility; - -// readDoubleBE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READDOUBLEBE 1 -extern const char* const s_jsBufferPrototypeReadDoubleBECode; -extern const int s_jsBufferPrototypeReadDoubleBECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadDoubleBECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadDoubleBECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadDoubleBECodeImplementationVisibility; - -// readDoubleLE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READDOUBLELE 1 -extern const char* const s_jsBufferPrototypeReadDoubleLECode; -extern const int s_jsBufferPrototypeReadDoubleLECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadDoubleLECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadDoubleLECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadDoubleLECodeImplementationVisibility; - -// readFloatBE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READFLOATBE 1 -extern const char* const s_jsBufferPrototypeReadFloatBECode; -extern const int s_jsBufferPrototypeReadFloatBECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadFloatBECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadFloatBECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadFloatBECodeImplementationVisibility; - -// readFloatLE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READFLOATLE 1 -extern const char* const s_jsBufferPrototypeReadFloatLECode; -extern const int s_jsBufferPrototypeReadFloatLECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadFloatLECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadFloatLECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadFloatLECodeImplementationVisibility; - -// readInt16BE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READINT16BE 1 -extern const char* const s_jsBufferPrototypeReadInt16BECode; -extern const int s_jsBufferPrototypeReadInt16BECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadInt16BECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadInt16BECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadInt16BECodeImplementationVisibility; - -// readInt16LE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READINT16LE 1 -extern const char* const s_jsBufferPrototypeReadInt16LECode; -extern const int s_jsBufferPrototypeReadInt16LECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadInt16LECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadInt16LECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadInt16LECodeImplementationVisibility; - -// readInt32BE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READINT32BE 1 -extern const char* const s_jsBufferPrototypeReadInt32BECode; -extern const int s_jsBufferPrototypeReadInt32BECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadInt32BECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadInt32BECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadInt32BECodeImplementationVisibility; - -// readInt32LE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READINT32LE 1 -extern const char* const s_jsBufferPrototypeReadInt32LECode; -extern const int s_jsBufferPrototypeReadInt32LECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadInt32LECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadInt32LECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadInt32LECodeImplementationVisibility; - -// readInt8 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READINT8 1 -extern const char* const s_jsBufferPrototypeReadInt8Code; -extern const int s_jsBufferPrototypeReadInt8CodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadInt8CodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadInt8CodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadInt8CodeImplementationVisibility; - -// readIntBE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READINTBE 1 -extern const char* const s_jsBufferPrototypeReadIntBECode; -extern const int s_jsBufferPrototypeReadIntBECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadIntBECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadIntBECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadIntBECodeImplementationVisibility; - -// readIntLE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READINTLE 1 -extern const char* const s_jsBufferPrototypeReadIntLECode; -extern const int s_jsBufferPrototypeReadIntLECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadIntLECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadIntLECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadIntLECodeImplementationVisibility; - -// readUInt16BE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READUINT16BE 1 -extern const char* const s_jsBufferPrototypeReadUInt16BECode; -extern const int s_jsBufferPrototypeReadUInt16BECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadUInt16BECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadUInt16BECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadUInt16BECodeImplementationVisibility; - -// readUInt16LE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READUINT16LE 1 -extern const char* const s_jsBufferPrototypeReadUInt16LECode; -extern const int s_jsBufferPrototypeReadUInt16LECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadUInt16LECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadUInt16LECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadUInt16LECodeImplementationVisibility; - -// readUInt32BE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READUINT32BE 1 -extern const char* const s_jsBufferPrototypeReadUInt32BECode; -extern const int s_jsBufferPrototypeReadUInt32BECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadUInt32BECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadUInt32BECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadUInt32BECodeImplementationVisibility; - -// readUInt32LE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READUINT32LE 1 -extern const char* const s_jsBufferPrototypeReadUInt32LECode; -extern const int s_jsBufferPrototypeReadUInt32LECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadUInt32LECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadUInt32LECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadUInt32LECodeImplementationVisibility; - -// readUInt8 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READUINT8 1 -extern const char* const s_jsBufferPrototypeReadUInt8Code; -extern const int s_jsBufferPrototypeReadUInt8CodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadUInt8CodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadUInt8CodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadUInt8CodeImplementationVisibility; - -// readUIntBE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READUINTBE 1 -extern const char* const s_jsBufferPrototypeReadUIntBECode; -extern const int s_jsBufferPrototypeReadUIntBECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadUIntBECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadUIntBECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadUIntBECodeImplementationVisibility; - -// readUIntLE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READUINTLE 1 -extern const char* const s_jsBufferPrototypeReadUIntLECode; -extern const int s_jsBufferPrototypeReadUIntLECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadUIntLECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadUIntLECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadUIntLECodeImplementationVisibility; - -// setBigUint64 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_SETBIGUINT64 1 -extern const char* const s_jsBufferPrototypeSetBigUint64Code; -extern const int s_jsBufferPrototypeSetBigUint64CodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeSetBigUint64CodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeSetBigUint64CodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeSetBigUint64CodeImplementationVisibility; - -// slice -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_SLICE 1 -extern const char* const s_jsBufferPrototypeSliceCode; -extern const int s_jsBufferPrototypeSliceCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeSliceCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeSliceCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeSliceCodeImplementationVisibility; - -// toJSON -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_TOJSON 1 -extern const char* const s_jsBufferPrototypeToJSONCode; -extern const int s_jsBufferPrototypeToJSONCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeToJSONCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeToJSONCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeToJSONCodeImplementationVisibility; - -// ucs2Slice -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_UCS2SLICE 1 -extern const char* const s_jsBufferPrototypeUcs2SliceCode; -extern const int s_jsBufferPrototypeUcs2SliceCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeUcs2SliceCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeUcs2SliceCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeUcs2SliceCodeImplementationVisibility; - -// ucs2Write -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_UCS2WRITE 1 -extern const char* const s_jsBufferPrototypeUcs2WriteCode; -extern const int s_jsBufferPrototypeUcs2WriteCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeUcs2WriteCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeUcs2WriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeUcs2WriteCodeImplementationVisibility; - -// utf16leSlice -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_UTF16LESLICE 1 -extern const char* const s_jsBufferPrototypeUtf16leSliceCode; -extern const int s_jsBufferPrototypeUtf16leSliceCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeUtf16leSliceCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeUtf16leSliceCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeUtf16leSliceCodeImplementationVisibility; - -// utf16leWrite -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_UTF16LEWRITE 1 -extern const char* const s_jsBufferPrototypeUtf16leWriteCode; -extern const int s_jsBufferPrototypeUtf16leWriteCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeUtf16leWriteCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeUtf16leWriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeUtf16leWriteCodeImplementationVisibility; - -// utf8Slice -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_UTF8SLICE 1 -extern const char* const s_jsBufferPrototypeUtf8SliceCode; -extern const int s_jsBufferPrototypeUtf8SliceCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeUtf8SliceCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeUtf8SliceCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeUtf8SliceCodeImplementationVisibility; - -// utf8Write -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_UTF8WRITE 1 -extern const char* const s_jsBufferPrototypeUtf8WriteCode; -extern const int s_jsBufferPrototypeUtf8WriteCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeUtf8WriteCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeUtf8WriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeUtf8WriteCodeImplementationVisibility; - -// writeBigInt64BE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEBIGINT64BE 1 -extern const char* const s_jsBufferPrototypeWriteBigInt64BECode; -extern const int s_jsBufferPrototypeWriteBigInt64BECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteBigInt64BECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteBigInt64BECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteBigInt64BECodeImplementationVisibility; - -// writeBigInt64LE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEBIGINT64LE 1 -extern const char* const s_jsBufferPrototypeWriteBigInt64LECode; -extern const int s_jsBufferPrototypeWriteBigInt64LECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteBigInt64LECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteBigInt64LECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteBigInt64LECodeImplementationVisibility; - -// writeBigUInt64BE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEBIGUINT64BE 1 -extern const char* const s_jsBufferPrototypeWriteBigUInt64BECode; -extern const int s_jsBufferPrototypeWriteBigUInt64BECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteBigUInt64BECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteBigUInt64BECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteBigUInt64BECodeImplementationVisibility; - -// writeBigUInt64LE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEBIGUINT64LE 1 -extern const char* const s_jsBufferPrototypeWriteBigUInt64LECode; -extern const int s_jsBufferPrototypeWriteBigUInt64LECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteBigUInt64LECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteBigUInt64LECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteBigUInt64LECodeImplementationVisibility; - -// writeDoubleBE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEDOUBLEBE 1 -extern const char* const s_jsBufferPrototypeWriteDoubleBECode; -extern const int s_jsBufferPrototypeWriteDoubleBECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteDoubleBECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteDoubleBECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteDoubleBECodeImplementationVisibility; - -// writeDoubleLE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEDOUBLELE 1 -extern const char* const s_jsBufferPrototypeWriteDoubleLECode; -extern const int s_jsBufferPrototypeWriteDoubleLECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteDoubleLECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteDoubleLECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteDoubleLECodeImplementationVisibility; - -// writeFloatBE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEFLOATBE 1 -extern const char* const s_jsBufferPrototypeWriteFloatBECode; -extern const int s_jsBufferPrototypeWriteFloatBECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteFloatBECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteFloatBECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteFloatBECodeImplementationVisibility; - -// writeFloatLE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEFLOATLE 1 -extern const char* const s_jsBufferPrototypeWriteFloatLECode; -extern const int s_jsBufferPrototypeWriteFloatLECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteFloatLECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteFloatLECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteFloatLECodeImplementationVisibility; - -// writeInt16BE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEINT16BE 1 -extern const char* const s_jsBufferPrototypeWriteInt16BECode; -extern const int s_jsBufferPrototypeWriteInt16BECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteInt16BECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteInt16BECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteInt16BECodeImplementationVisibility; - -// writeInt16LE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEINT16LE 1 -extern const char* const s_jsBufferPrototypeWriteInt16LECode; -extern const int s_jsBufferPrototypeWriteInt16LECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteInt16LECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteInt16LECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteInt16LECodeImplementationVisibility; - -// writeInt32BE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEINT32BE 1 -extern const char* const s_jsBufferPrototypeWriteInt32BECode; -extern const int s_jsBufferPrototypeWriteInt32BECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteInt32BECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteInt32BECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteInt32BECodeImplementationVisibility; - -// writeInt32LE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEINT32LE 1 -extern const char* const s_jsBufferPrototypeWriteInt32LECode; -extern const int s_jsBufferPrototypeWriteInt32LECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteInt32LECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteInt32LECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteInt32LECodeImplementationVisibility; - -// writeInt8 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEINT8 1 -extern const char* const s_jsBufferPrototypeWriteInt8Code; -extern const int s_jsBufferPrototypeWriteInt8CodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteInt8CodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteInt8CodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteInt8CodeImplementationVisibility; - -// writeIntBE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEINTBE 1 -extern const char* const s_jsBufferPrototypeWriteIntBECode; -extern const int s_jsBufferPrototypeWriteIntBECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteIntBECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteIntBECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteIntBECodeImplementationVisibility; - -// writeIntLE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEINTLE 1 -extern const char* const s_jsBufferPrototypeWriteIntLECode; -extern const int s_jsBufferPrototypeWriteIntLECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteIntLECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteIntLECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteIntLECodeImplementationVisibility; - -// writeUInt16BE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEUINT16BE 1 -extern const char* const s_jsBufferPrototypeWriteUInt16BECode; -extern const int s_jsBufferPrototypeWriteUInt16BECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteUInt16BECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteUInt16BECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUInt16BECodeImplementationVisibility; - -// writeUInt16LE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEUINT16LE 1 -extern const char* const s_jsBufferPrototypeWriteUInt16LECode; -extern const int s_jsBufferPrototypeWriteUInt16LECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteUInt16LECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteUInt16LECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUInt16LECodeImplementationVisibility; - -// writeUInt32BE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEUINT32BE 1 -extern const char* const s_jsBufferPrototypeWriteUInt32BECode; -extern const int s_jsBufferPrototypeWriteUInt32BECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteUInt32BECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteUInt32BECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUInt32BECodeImplementationVisibility; - -// writeUInt32LE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEUINT32LE 1 -extern const char* const s_jsBufferPrototypeWriteUInt32LECode; -extern const int s_jsBufferPrototypeWriteUInt32LECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteUInt32LECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteUInt32LECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUInt32LECodeImplementationVisibility; - -// writeUInt8 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEUINT8 1 -extern const char* const s_jsBufferPrototypeWriteUInt8Code; -extern const int s_jsBufferPrototypeWriteUInt8CodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteUInt8CodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteUInt8CodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUInt8CodeImplementationVisibility; - -// writeUIntBE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEUINTBE 1 -extern const char* const s_jsBufferPrototypeWriteUIntBECode; -extern const int s_jsBufferPrototypeWriteUIntBECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteUIntBECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteUIntBECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUIntBECodeImplementationVisibility; - -// writeUIntLE -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEUINTLE 1 -extern const char* const s_jsBufferPrototypeWriteUIntLECode; -extern const int s_jsBufferPrototypeWriteUIntLECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteUIntLECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteUIntLECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUIntLECodeImplementationVisibility; - -#define WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_DATA(macro) \ - macro(asciiSlice, jsBufferPrototypeAsciiSlice, 2) \ - macro(asciiWrite, jsBufferPrototypeAsciiWrite, 3) \ - macro(base64Slice, jsBufferPrototypeBase64Slice, 2) \ - macro(base64urlSlice, jsBufferPrototypeBase64urlSlice, 2) \ - macro(base64urlWrite, jsBufferPrototypeBase64urlWrite, 3) \ - macro(base64Write, jsBufferPrototypeBase64Write, 3) \ - macro(hexSlice, jsBufferPrototypeHexSlice, 2) \ - macro(hexWrite, jsBufferPrototypeHexWrite, 3) \ - macro(inspect, jsBufferPrototypeInspect, 2) \ - macro(latin1Slice, jsBufferPrototypeLatin1Slice, 2) \ - macro(latin1Write, jsBufferPrototypeLatin1Write, 3) \ - macro(offset, jsBufferPrototypeOffset, 0) \ - macro(parent, jsBufferPrototypeParent, 0) \ - macro(readBigInt64BE, jsBufferPrototypeReadBigInt64BE, 1) \ - macro(readBigInt64LE, jsBufferPrototypeReadBigInt64LE, 1) \ - macro(readBigUInt64BE, jsBufferPrototypeReadBigUInt64BE, 1) \ - macro(readBigUInt64LE, jsBufferPrototypeReadBigUInt64LE, 1) \ - macro(readDoubleBE, jsBufferPrototypeReadDoubleBE, 1) \ - macro(readDoubleLE, jsBufferPrototypeReadDoubleLE, 1) \ - macro(readFloatBE, jsBufferPrototypeReadFloatBE, 1) \ - macro(readFloatLE, jsBufferPrototypeReadFloatLE, 1) \ - macro(readInt16BE, jsBufferPrototypeReadInt16BE, 1) \ - macro(readInt16LE, jsBufferPrototypeReadInt16LE, 1) \ - macro(readInt32BE, jsBufferPrototypeReadInt32BE, 1) \ - macro(readInt32LE, jsBufferPrototypeReadInt32LE, 1) \ - macro(readInt8, jsBufferPrototypeReadInt8, 1) \ - macro(readIntBE, jsBufferPrototypeReadIntBE, 2) \ - macro(readIntLE, jsBufferPrototypeReadIntLE, 2) \ - macro(readUInt16BE, jsBufferPrototypeReadUInt16BE, 1) \ - macro(readUInt16LE, jsBufferPrototypeReadUInt16LE, 1) \ - macro(readUInt32BE, jsBufferPrototypeReadUInt32BE, 1) \ - macro(readUInt32LE, jsBufferPrototypeReadUInt32LE, 1) \ - macro(readUInt8, jsBufferPrototypeReadUInt8, 1) \ - macro(readUIntBE, jsBufferPrototypeReadUIntBE, 2) \ - macro(readUIntLE, jsBufferPrototypeReadUIntLE, 2) \ - macro(setBigUint64, jsBufferPrototypeSetBigUint64, 3) \ - macro(slice, jsBufferPrototypeSlice, 2) \ - macro(toJSON, jsBufferPrototypeToJSON, 0) \ - macro(ucs2Slice, jsBufferPrototypeUcs2Slice, 2) \ - macro(ucs2Write, jsBufferPrototypeUcs2Write, 3) \ - macro(utf16leSlice, jsBufferPrototypeUtf16leSlice, 2) \ - macro(utf16leWrite, jsBufferPrototypeUtf16leWrite, 3) \ - macro(utf8Slice, jsBufferPrototypeUtf8Slice, 2) \ - macro(utf8Write, jsBufferPrototypeUtf8Write, 3) \ - macro(writeBigInt64BE, jsBufferPrototypeWriteBigInt64BE, 2) \ - macro(writeBigInt64LE, jsBufferPrototypeWriteBigInt64LE, 2) \ - macro(writeBigUInt64BE, jsBufferPrototypeWriteBigUInt64BE, 2) \ - macro(writeBigUInt64LE, jsBufferPrototypeWriteBigUInt64LE, 2) \ - macro(writeDoubleBE, jsBufferPrototypeWriteDoubleBE, 2) \ - macro(writeDoubleLE, jsBufferPrototypeWriteDoubleLE, 2) \ - macro(writeFloatBE, jsBufferPrototypeWriteFloatBE, 2) \ - macro(writeFloatLE, jsBufferPrototypeWriteFloatLE, 2) \ - macro(writeInt16BE, jsBufferPrototypeWriteInt16BE, 2) \ - macro(writeInt16LE, jsBufferPrototypeWriteInt16LE, 2) \ - macro(writeInt32BE, jsBufferPrototypeWriteInt32BE, 2) \ - macro(writeInt32LE, jsBufferPrototypeWriteInt32LE, 2) \ - macro(writeInt8, jsBufferPrototypeWriteInt8, 2) \ - macro(writeIntBE, jsBufferPrototypeWriteIntBE, 3) \ - macro(writeIntLE, jsBufferPrototypeWriteIntLE, 3) \ - macro(writeUInt16BE, jsBufferPrototypeWriteUInt16BE, 2) \ - macro(writeUInt16LE, jsBufferPrototypeWriteUInt16LE, 2) \ - macro(writeUInt32BE, jsBufferPrototypeWriteUInt32BE, 2) \ - macro(writeUInt32LE, jsBufferPrototypeWriteUInt32LE, 2) \ - macro(writeUInt8, jsBufferPrototypeWriteUInt8, 2) \ - macro(writeUIntBE, jsBufferPrototypeWriteUIntBE, 3) \ - macro(writeUIntLE, jsBufferPrototypeWriteUIntLE, 3) \ - -#define WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_CODE(macro) \ - macro(jsBufferPrototypeAsciiSliceCode, asciiSlice, ASCIILiteral(), s_jsBufferPrototypeAsciiSliceCodeLength) \ - macro(jsBufferPrototypeAsciiWriteCode, asciiWrite, ASCIILiteral(), s_jsBufferPrototypeAsciiWriteCodeLength) \ - macro(jsBufferPrototypeBase64SliceCode, base64Slice, ASCIILiteral(), s_jsBufferPrototypeBase64SliceCodeLength) \ - macro(jsBufferPrototypeBase64urlSliceCode, base64urlSlice, ASCIILiteral(), s_jsBufferPrototypeBase64urlSliceCodeLength) \ - macro(jsBufferPrototypeBase64urlWriteCode, base64urlWrite, ASCIILiteral(), s_jsBufferPrototypeBase64urlWriteCodeLength) \ - macro(jsBufferPrototypeBase64WriteCode, base64Write, ASCIILiteral(), s_jsBufferPrototypeBase64WriteCodeLength) \ - macro(jsBufferPrototypeHexSliceCode, hexSlice, ASCIILiteral(), s_jsBufferPrototypeHexSliceCodeLength) \ - macro(jsBufferPrototypeHexWriteCode, hexWrite, ASCIILiteral(), s_jsBufferPrototypeHexWriteCodeLength) \ - macro(jsBufferPrototypeInspectCode, inspect, ASCIILiteral(), s_jsBufferPrototypeInspectCodeLength) \ - macro(jsBufferPrototypeLatin1SliceCode, latin1Slice, ASCIILiteral(), s_jsBufferPrototypeLatin1SliceCodeLength) \ - macro(jsBufferPrototypeLatin1WriteCode, latin1Write, ASCIILiteral(), s_jsBufferPrototypeLatin1WriteCodeLength) \ - macro(jsBufferPrototypeOffsetCode, offset, "get offset"_s, s_jsBufferPrototypeOffsetCodeLength) \ - macro(jsBufferPrototypeParentCode, parent, "get parent"_s, s_jsBufferPrototypeParentCodeLength) \ - macro(jsBufferPrototypeReadBigInt64BECode, readBigInt64BE, ASCIILiteral(), s_jsBufferPrototypeReadBigInt64BECodeLength) \ - macro(jsBufferPrototypeReadBigInt64LECode, readBigInt64LE, ASCIILiteral(), s_jsBufferPrototypeReadBigInt64LECodeLength) \ - macro(jsBufferPrototypeReadBigUInt64BECode, readBigUInt64BE, ASCIILiteral(), s_jsBufferPrototypeReadBigUInt64BECodeLength) \ - macro(jsBufferPrototypeReadBigUInt64LECode, readBigUInt64LE, ASCIILiteral(), s_jsBufferPrototypeReadBigUInt64LECodeLength) \ - macro(jsBufferPrototypeReadDoubleBECode, readDoubleBE, ASCIILiteral(), s_jsBufferPrototypeReadDoubleBECodeLength) \ - macro(jsBufferPrototypeReadDoubleLECode, readDoubleLE, ASCIILiteral(), s_jsBufferPrototypeReadDoubleLECodeLength) \ - macro(jsBufferPrototypeReadFloatBECode, readFloatBE, ASCIILiteral(), s_jsBufferPrototypeReadFloatBECodeLength) \ - macro(jsBufferPrototypeReadFloatLECode, readFloatLE, ASCIILiteral(), s_jsBufferPrototypeReadFloatLECodeLength) \ - macro(jsBufferPrototypeReadInt16BECode, readInt16BE, ASCIILiteral(), s_jsBufferPrototypeReadInt16BECodeLength) \ - macro(jsBufferPrototypeReadInt16LECode, readInt16LE, ASCIILiteral(), s_jsBufferPrototypeReadInt16LECodeLength) \ - macro(jsBufferPrototypeReadInt32BECode, readInt32BE, ASCIILiteral(), s_jsBufferPrototypeReadInt32BECodeLength) \ - macro(jsBufferPrototypeReadInt32LECode, readInt32LE, ASCIILiteral(), s_jsBufferPrototypeReadInt32LECodeLength) \ - macro(jsBufferPrototypeReadInt8Code, readInt8, ASCIILiteral(), s_jsBufferPrototypeReadInt8CodeLength) \ - macro(jsBufferPrototypeReadIntBECode, readIntBE, ASCIILiteral(), s_jsBufferPrototypeReadIntBECodeLength) \ - macro(jsBufferPrototypeReadIntLECode, readIntLE, ASCIILiteral(), s_jsBufferPrototypeReadIntLECodeLength) \ - macro(jsBufferPrototypeReadUInt16BECode, readUInt16BE, ASCIILiteral(), s_jsBufferPrototypeReadUInt16BECodeLength) \ - macro(jsBufferPrototypeReadUInt16LECode, readUInt16LE, ASCIILiteral(), s_jsBufferPrototypeReadUInt16LECodeLength) \ - macro(jsBufferPrototypeReadUInt32BECode, readUInt32BE, ASCIILiteral(), s_jsBufferPrototypeReadUInt32BECodeLength) \ - macro(jsBufferPrototypeReadUInt32LECode, readUInt32LE, ASCIILiteral(), s_jsBufferPrototypeReadUInt32LECodeLength) \ - macro(jsBufferPrototypeReadUInt8Code, readUInt8, ASCIILiteral(), s_jsBufferPrototypeReadUInt8CodeLength) \ - macro(jsBufferPrototypeReadUIntBECode, readUIntBE, ASCIILiteral(), s_jsBufferPrototypeReadUIntBECodeLength) \ - macro(jsBufferPrototypeReadUIntLECode, readUIntLE, ASCIILiteral(), s_jsBufferPrototypeReadUIntLECodeLength) \ - macro(jsBufferPrototypeSetBigUint64Code, setBigUint64, ASCIILiteral(), s_jsBufferPrototypeSetBigUint64CodeLength) \ - macro(jsBufferPrototypeSliceCode, slice, ASCIILiteral(), s_jsBufferPrototypeSliceCodeLength) \ - macro(jsBufferPrototypeToJSONCode, toJSON, ASCIILiteral(), s_jsBufferPrototypeToJSONCodeLength) \ - macro(jsBufferPrototypeUcs2SliceCode, ucs2Slice, ASCIILiteral(), s_jsBufferPrototypeUcs2SliceCodeLength) \ - macro(jsBufferPrototypeUcs2WriteCode, ucs2Write, ASCIILiteral(), s_jsBufferPrototypeUcs2WriteCodeLength) \ - macro(jsBufferPrototypeUtf16leSliceCode, utf16leSlice, ASCIILiteral(), s_jsBufferPrototypeUtf16leSliceCodeLength) \ - macro(jsBufferPrototypeUtf16leWriteCode, utf16leWrite, ASCIILiteral(), s_jsBufferPrototypeUtf16leWriteCodeLength) \ - macro(jsBufferPrototypeUtf8SliceCode, utf8Slice, ASCIILiteral(), s_jsBufferPrototypeUtf8SliceCodeLength) \ - macro(jsBufferPrototypeUtf8WriteCode, utf8Write, ASCIILiteral(), s_jsBufferPrototypeUtf8WriteCodeLength) \ - macro(jsBufferPrototypeWriteBigInt64BECode, writeBigInt64BE, ASCIILiteral(), s_jsBufferPrototypeWriteBigInt64BECodeLength) \ - macro(jsBufferPrototypeWriteBigInt64LECode, writeBigInt64LE, ASCIILiteral(), s_jsBufferPrototypeWriteBigInt64LECodeLength) \ - macro(jsBufferPrototypeWriteBigUInt64BECode, writeBigUInt64BE, ASCIILiteral(), s_jsBufferPrototypeWriteBigUInt64BECodeLength) \ - macro(jsBufferPrototypeWriteBigUInt64LECode, writeBigUInt64LE, ASCIILiteral(), s_jsBufferPrototypeWriteBigUInt64LECodeLength) \ - macro(jsBufferPrototypeWriteDoubleBECode, writeDoubleBE, ASCIILiteral(), s_jsBufferPrototypeWriteDoubleBECodeLength) \ - macro(jsBufferPrototypeWriteDoubleLECode, writeDoubleLE, ASCIILiteral(), s_jsBufferPrototypeWriteDoubleLECodeLength) \ - macro(jsBufferPrototypeWriteFloatBECode, writeFloatBE, ASCIILiteral(), s_jsBufferPrototypeWriteFloatBECodeLength) \ - macro(jsBufferPrototypeWriteFloatLECode, writeFloatLE, ASCIILiteral(), s_jsBufferPrototypeWriteFloatLECodeLength) \ - macro(jsBufferPrototypeWriteInt16BECode, writeInt16BE, ASCIILiteral(), s_jsBufferPrototypeWriteInt16BECodeLength) \ - macro(jsBufferPrototypeWriteInt16LECode, writeInt16LE, ASCIILiteral(), s_jsBufferPrototypeWriteInt16LECodeLength) \ - macro(jsBufferPrototypeWriteInt32BECode, writeInt32BE, ASCIILiteral(), s_jsBufferPrototypeWriteInt32BECodeLength) \ - macro(jsBufferPrototypeWriteInt32LECode, writeInt32LE, ASCIILiteral(), s_jsBufferPrototypeWriteInt32LECodeLength) \ - macro(jsBufferPrototypeWriteInt8Code, writeInt8, ASCIILiteral(), s_jsBufferPrototypeWriteInt8CodeLength) \ - macro(jsBufferPrototypeWriteIntBECode, writeIntBE, ASCIILiteral(), s_jsBufferPrototypeWriteIntBECodeLength) \ - macro(jsBufferPrototypeWriteIntLECode, writeIntLE, ASCIILiteral(), s_jsBufferPrototypeWriteIntLECodeLength) \ - macro(jsBufferPrototypeWriteUInt16BECode, writeUInt16BE, ASCIILiteral(), s_jsBufferPrototypeWriteUInt16BECodeLength) \ - macro(jsBufferPrototypeWriteUInt16LECode, writeUInt16LE, ASCIILiteral(), s_jsBufferPrototypeWriteUInt16LECodeLength) \ - macro(jsBufferPrototypeWriteUInt32BECode, writeUInt32BE, ASCIILiteral(), s_jsBufferPrototypeWriteUInt32BECodeLength) \ - macro(jsBufferPrototypeWriteUInt32LECode, writeUInt32LE, ASCIILiteral(), s_jsBufferPrototypeWriteUInt32LECodeLength) \ - macro(jsBufferPrototypeWriteUInt8Code, writeUInt8, ASCIILiteral(), s_jsBufferPrototypeWriteUInt8CodeLength) \ - macro(jsBufferPrototypeWriteUIntBECode, writeUIntBE, ASCIILiteral(), s_jsBufferPrototypeWriteUIntBECodeLength) \ - macro(jsBufferPrototypeWriteUIntLECode, writeUIntLE, ASCIILiteral(), s_jsBufferPrototypeWriteUIntLECodeLength) \ - -#define WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_FUNCTION_NAME(macro) \ - macro(asciiSlice) \ - macro(asciiWrite) \ - macro(base64Slice) \ - macro(base64urlSlice) \ - macro(base64urlWrite) \ - macro(base64Write) \ - macro(hexSlice) \ - macro(hexWrite) \ - macro(inspect) \ - macro(latin1Slice) \ - macro(latin1Write) \ - macro(offset) \ - macro(parent) \ - macro(readBigInt64BE) \ - macro(readBigInt64LE) \ - macro(readBigUInt64BE) \ - macro(readBigUInt64LE) \ - macro(readDoubleBE) \ - macro(readDoubleLE) \ - macro(readFloatBE) \ - macro(readFloatLE) \ - macro(readInt16BE) \ - macro(readInt16LE) \ - macro(readInt32BE) \ - macro(readInt32LE) \ - macro(readInt8) \ - macro(readIntBE) \ - macro(readIntLE) \ - macro(readUInt16BE) \ - macro(readUInt16LE) \ - macro(readUInt32BE) \ - macro(readUInt32LE) \ - macro(readUInt8) \ - macro(readUIntBE) \ - macro(readUIntLE) \ - macro(setBigUint64) \ - macro(slice) \ - macro(toJSON) \ - macro(ucs2Slice) \ - macro(ucs2Write) \ - macro(utf16leSlice) \ - macro(utf16leWrite) \ - macro(utf8Slice) \ - macro(utf8Write) \ - macro(writeBigInt64BE) \ - macro(writeBigInt64LE) \ - macro(writeBigUInt64BE) \ - macro(writeBigUInt64LE) \ - macro(writeDoubleBE) \ - macro(writeDoubleLE) \ - macro(writeFloatBE) \ - macro(writeFloatLE) \ - macro(writeInt16BE) \ - macro(writeInt16LE) \ - macro(writeInt32BE) \ - macro(writeInt32LE) \ - macro(writeInt8) \ - macro(writeIntBE) \ - macro(writeIntLE) \ - macro(writeUInt16BE) \ - macro(writeUInt16LE) \ - macro(writeUInt32BE) \ - macro(writeUInt32LE) \ - macro(writeUInt8) \ - macro(writeUIntBE) \ - macro(writeUIntLE) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class JSBufferPrototypeBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit JSBufferPrototypeBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { }, JSC::SourceTaintedOrigin::Untainted)) - WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak m_##name##Executable; - WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* JSBufferPrototypeBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void JSBufferPrototypeBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} -/* Module.ts */ -// main -#define WEBCORE_BUILTIN_MODULE_MAIN 1 -extern const char* const s_moduleMainCode; -extern const int s_moduleMainCodeLength; -extern const JSC::ConstructAbility s_moduleMainCodeConstructAbility; -extern const JSC::ConstructorKind s_moduleMainCodeConstructorKind; -extern const JSC::ImplementationVisibility s_moduleMainCodeImplementationVisibility; - -// overridableRequire -#define WEBCORE_BUILTIN_MODULE_OVERRIDABLEREQUIRE 1 -extern const char* const s_moduleOverridableRequireCode; -extern const int s_moduleOverridableRequireCodeLength; -extern const JSC::ConstructAbility s_moduleOverridableRequireCodeConstructAbility; -extern const JSC::ConstructorKind s_moduleOverridableRequireCodeConstructorKind; -extern const JSC::ImplementationVisibility s_moduleOverridableRequireCodeImplementationVisibility; - -// require -#define WEBCORE_BUILTIN_MODULE_REQUIRE 1 -extern const char* const s_moduleRequireCode; -extern const int s_moduleRequireCodeLength; -extern const JSC::ConstructAbility s_moduleRequireCodeConstructAbility; -extern const JSC::ConstructorKind s_moduleRequireCodeConstructorKind; -extern const JSC::ImplementationVisibility s_moduleRequireCodeImplementationVisibility; - -// requireNativeModule -#define WEBCORE_BUILTIN_MODULE_REQUIRENATIVEMODULE 1 -extern const char* const s_moduleRequireNativeModuleCode; -extern const int s_moduleRequireNativeModuleCodeLength; -extern const JSC::ConstructAbility s_moduleRequireNativeModuleCodeConstructAbility; -extern const JSC::ConstructorKind s_moduleRequireNativeModuleCodeConstructorKind; -extern const JSC::ImplementationVisibility s_moduleRequireNativeModuleCodeImplementationVisibility; - -// requireResolve -#define WEBCORE_BUILTIN_MODULE_REQUIRERESOLVE 1 -extern const char* const s_moduleRequireResolveCode; -extern const int s_moduleRequireResolveCodeLength; -extern const JSC::ConstructAbility s_moduleRequireResolveCodeConstructAbility; -extern const JSC::ConstructorKind s_moduleRequireResolveCodeConstructorKind; -extern const JSC::ImplementationVisibility s_moduleRequireResolveCodeImplementationVisibility; - -#define WEBCORE_FOREACH_MODULE_BUILTIN_DATA(macro) \ - macro(main, moduleMain, 0) \ - macro(overridableRequire, moduleOverridableRequire, 1) \ - macro(require, moduleRequire, 1) \ - macro(requireNativeModule, moduleRequireNativeModule, 1) \ - macro(requireResolve, moduleRequireResolve, 1) \ - -#define WEBCORE_FOREACH_MODULE_BUILTIN_CODE(macro) \ - macro(moduleMainCode, main, "get main"_s, s_moduleMainCodeLength) \ - macro(moduleOverridableRequireCode, overridableRequire, ASCIILiteral(), s_moduleOverridableRequireCodeLength) \ - macro(moduleRequireCode, require, ASCIILiteral(), s_moduleRequireCodeLength) \ - macro(moduleRequireNativeModuleCode, requireNativeModule, ASCIILiteral(), s_moduleRequireNativeModuleCodeLength) \ - macro(moduleRequireResolveCode, requireResolve, ASCIILiteral(), s_moduleRequireResolveCodeLength) \ - -#define WEBCORE_FOREACH_MODULE_BUILTIN_FUNCTION_NAME(macro) \ - macro(main) \ - macro(overridableRequire) \ - macro(require) \ - macro(requireNativeModule) \ - macro(requireResolve) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_MODULE_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class ModuleBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit ModuleBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_MODULE_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { }, JSC::SourceTaintedOrigin::Untainted)) - WEBCORE_FOREACH_MODULE_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_MODULE_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_MODULE_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_MODULE_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak m_##name##Executable; - WEBCORE_FOREACH_MODULE_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* ModuleBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_MODULE_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void ModuleBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_MODULE_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} -/* ProcessObjectInternals.ts */ -// getStdinStream -#define WEBCORE_BUILTIN_PROCESSOBJECTINTERNALS_GETSTDINSTREAM 1 -extern const char* const s_processObjectInternalsGetStdinStreamCode; -extern const int s_processObjectInternalsGetStdinStreamCodeLength; -extern const JSC::ConstructAbility s_processObjectInternalsGetStdinStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_processObjectInternalsGetStdinStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_processObjectInternalsGetStdinStreamCodeImplementationVisibility; - -// getStdioWriteStream -#define WEBCORE_BUILTIN_PROCESSOBJECTINTERNALS_GETSTDIOWRITESTREAM 1 -extern const char* const s_processObjectInternalsGetStdioWriteStreamCode; -extern const int s_processObjectInternalsGetStdioWriteStreamCodeLength; -extern const JSC::ConstructAbility s_processObjectInternalsGetStdioWriteStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_processObjectInternalsGetStdioWriteStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_processObjectInternalsGetStdioWriteStreamCodeImplementationVisibility; - -// initializeNextTickQueue -#define WEBCORE_BUILTIN_PROCESSOBJECTINTERNALS_INITIALIZENEXTTICKQUEUE 1 -extern const char* const s_processObjectInternalsInitializeNextTickQueueCode; -extern const int s_processObjectInternalsInitializeNextTickQueueCodeLength; -extern const JSC::ConstructAbility s_processObjectInternalsInitializeNextTickQueueCodeConstructAbility; -extern const JSC::ConstructorKind s_processObjectInternalsInitializeNextTickQueueCodeConstructorKind; -extern const JSC::ImplementationVisibility s_processObjectInternalsInitializeNextTickQueueCodeImplementationVisibility; - -// mainModule -#define WEBCORE_BUILTIN_PROCESSOBJECTINTERNALS_MAINMODULE 1 -extern const char* const s_processObjectInternalsMainModuleCode; -extern const int s_processObjectInternalsMainModuleCodeLength; -extern const JSC::ConstructAbility s_processObjectInternalsMainModuleCodeConstructAbility; -extern const JSC::ConstructorKind s_processObjectInternalsMainModuleCodeConstructorKind; -extern const JSC::ImplementationVisibility s_processObjectInternalsMainModuleCodeImplementationVisibility; - -#define WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_DATA(macro) \ - macro(getStdinStream, processObjectInternalsGetStdinStream, 1) \ - macro(getStdioWriteStream, processObjectInternalsGetStdioWriteStream, 1) \ - macro(initializeNextTickQueue, processObjectInternalsInitializeNextTickQueue, 4) \ - macro(mainModule, processObjectInternalsMainModule, 0) \ - -#define WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_CODE(macro) \ - macro(processObjectInternalsGetStdinStreamCode, getStdinStream, ASCIILiteral(), s_processObjectInternalsGetStdinStreamCodeLength) \ - macro(processObjectInternalsGetStdioWriteStreamCode, getStdioWriteStream, ASCIILiteral(), s_processObjectInternalsGetStdioWriteStreamCodeLength) \ - macro(processObjectInternalsInitializeNextTickQueueCode, initializeNextTickQueue, ASCIILiteral(), s_processObjectInternalsInitializeNextTickQueueCodeLength) \ - macro(processObjectInternalsMainModuleCode, mainModule, "get mainModule"_s, s_processObjectInternalsMainModuleCodeLength) \ - -#define WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_FUNCTION_NAME(macro) \ - macro(getStdinStream) \ - macro(getStdioWriteStream) \ - macro(initializeNextTickQueue) \ - macro(mainModule) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class ProcessObjectInternalsBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit ProcessObjectInternalsBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { }, JSC::SourceTaintedOrigin::Untainted)) - WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak m_##name##Executable; - WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* ProcessObjectInternalsBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void ProcessObjectInternalsBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} -/* ReadableByteStreamController.ts */ -// byobRequest -#define WEBCORE_BUILTIN_READABLEBYTESTREAMCONTROLLER_BYOBREQUEST 1 -extern const char* const s_readableByteStreamControllerByobRequestCode; -extern const int s_readableByteStreamControllerByobRequestCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamControllerByobRequestCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamControllerByobRequestCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamControllerByobRequestCodeImplementationVisibility; - -// close -#define WEBCORE_BUILTIN_READABLEBYTESTREAMCONTROLLER_CLOSE 1 -extern const char* const s_readableByteStreamControllerCloseCode; -extern const int s_readableByteStreamControllerCloseCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamControllerCloseCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamControllerCloseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamControllerCloseCodeImplementationVisibility; - -// desiredSize -#define WEBCORE_BUILTIN_READABLEBYTESTREAMCONTROLLER_DESIREDSIZE 1 -extern const char* const s_readableByteStreamControllerDesiredSizeCode; -extern const int s_readableByteStreamControllerDesiredSizeCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamControllerDesiredSizeCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamControllerDesiredSizeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamControllerDesiredSizeCodeImplementationVisibility; - -// enqueue -#define WEBCORE_BUILTIN_READABLEBYTESTREAMCONTROLLER_ENQUEUE 1 -extern const char* const s_readableByteStreamControllerEnqueueCode; -extern const int s_readableByteStreamControllerEnqueueCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamControllerEnqueueCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamControllerEnqueueCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamControllerEnqueueCodeImplementationVisibility; - -// error -#define WEBCORE_BUILTIN_READABLEBYTESTREAMCONTROLLER_ERROR 1 -extern const char* const s_readableByteStreamControllerErrorCode; -extern const int s_readableByteStreamControllerErrorCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamControllerErrorCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamControllerErrorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamControllerErrorCodeImplementationVisibility; - -// initializeReadableByteStreamController -#define WEBCORE_BUILTIN_READABLEBYTESTREAMCONTROLLER_INITIALIZEREADABLEBYTESTREAMCONTROLLER 1 -extern const char* const s_readableByteStreamControllerInitializeReadableByteStreamControllerCode; -extern const int s_readableByteStreamControllerInitializeReadableByteStreamControllerCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamControllerInitializeReadableByteStreamControllerCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamControllerInitializeReadableByteStreamControllerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamControllerInitializeReadableByteStreamControllerCodeImplementationVisibility; - -#define WEBCORE_FOREACH_READABLEBYTESTREAMCONTROLLER_BUILTIN_DATA(macro) \ - macro(byobRequest, readableByteStreamControllerByobRequest, 0) \ - macro(close, readableByteStreamControllerClose, 0) \ - macro(desiredSize, readableByteStreamControllerDesiredSize, 0) \ - macro(enqueue, readableByteStreamControllerEnqueue, 1) \ - macro(error, readableByteStreamControllerError, 1) \ - macro(initializeReadableByteStreamController, readableByteStreamControllerInitializeReadableByteStreamController, 3) \ - -#define WEBCORE_FOREACH_READABLEBYTESTREAMCONTROLLER_BUILTIN_CODE(macro) \ - macro(readableByteStreamControllerByobRequestCode, byobRequest, "get byobRequest"_s, s_readableByteStreamControllerByobRequestCodeLength) \ - macro(readableByteStreamControllerCloseCode, close, ASCIILiteral(), s_readableByteStreamControllerCloseCodeLength) \ - macro(readableByteStreamControllerDesiredSizeCode, desiredSize, "get desiredSize"_s, s_readableByteStreamControllerDesiredSizeCodeLength) \ - macro(readableByteStreamControllerEnqueueCode, enqueue, ASCIILiteral(), s_readableByteStreamControllerEnqueueCodeLength) \ - macro(readableByteStreamControllerErrorCode, error, ASCIILiteral(), s_readableByteStreamControllerErrorCodeLength) \ - macro(readableByteStreamControllerInitializeReadableByteStreamControllerCode, initializeReadableByteStreamController, ASCIILiteral(), s_readableByteStreamControllerInitializeReadableByteStreamControllerCodeLength) \ - -#define WEBCORE_FOREACH_READABLEBYTESTREAMCONTROLLER_BUILTIN_FUNCTION_NAME(macro) \ - macro(byobRequest) \ - macro(close) \ - macro(desiredSize) \ - macro(enqueue) \ - macro(error) \ - macro(initializeReadableByteStreamController) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_READABLEBYTESTREAMCONTROLLER_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class ReadableByteStreamControllerBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit ReadableByteStreamControllerBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_READABLEBYTESTREAMCONTROLLER_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { }, JSC::SourceTaintedOrigin::Untainted)) - WEBCORE_FOREACH_READABLEBYTESTREAMCONTROLLER_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_READABLEBYTESTREAMCONTROLLER_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_READABLEBYTESTREAMCONTROLLER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_READABLEBYTESTREAMCONTROLLER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak m_##name##Executable; - WEBCORE_FOREACH_READABLEBYTESTREAMCONTROLLER_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* ReadableByteStreamControllerBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_READABLEBYTESTREAMCONTROLLER_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void ReadableByteStreamControllerBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_READABLEBYTESTREAMCONTROLLER_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} -/* ReadableByteStreamInternals.ts */ -// isReadableByteStreamController -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_ISREADABLEBYTESTREAMCONTROLLER 1 -extern const char* const s_readableByteStreamInternalsIsReadableByteStreamControllerCode; -extern const int s_readableByteStreamInternalsIsReadableByteStreamControllerCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsIsReadableByteStreamControllerCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsIsReadableByteStreamControllerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsIsReadableByteStreamControllerCodeImplementationVisibility; - -// isReadableStreamBYOBReader -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_ISREADABLESTREAMBYOBREADER 1 -extern const char* const s_readableByteStreamInternalsIsReadableStreamBYOBReaderCode; -extern const int s_readableByteStreamInternalsIsReadableStreamBYOBReaderCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsIsReadableStreamBYOBReaderCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsIsReadableStreamBYOBReaderCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsIsReadableStreamBYOBReaderCodeImplementationVisibility; - -// isReadableStreamBYOBRequest -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_ISREADABLESTREAMBYOBREQUEST 1 -extern const char* const s_readableByteStreamInternalsIsReadableStreamBYOBRequestCode; -extern const int s_readableByteStreamInternalsIsReadableStreamBYOBRequestCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsIsReadableStreamBYOBRequestCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsIsReadableStreamBYOBRequestCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsIsReadableStreamBYOBRequestCodeImplementationVisibility; - -// privateInitializeReadableByteStreamController -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_PRIVATEINITIALIZEREADABLEBYTESTREAMCONTROLLER 1 -extern const char* const s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCode; -extern const int s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeImplementationVisibility; - -// privateInitializeReadableStreamBYOBRequest -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_PRIVATEINITIALIZEREADABLESTREAMBYOBREQUEST 1 -extern const char* const s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCode; -extern const int s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCodeImplementationVisibility; - -// readableByteStreamControllerCallPullIfNeeded -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERCALLPULLIFNEEDED 1 -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeededCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeededCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeededCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeededCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeededCodeImplementationVisibility; - -// readableByteStreamControllerCancel -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERCANCEL 1 -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerCancelCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerCancelCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerCancelCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerCancelCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerCancelCodeImplementationVisibility; - -// readableByteStreamControllerClearPendingPullIntos -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERCLEARPENDINGPULLINTOS 1 -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntosCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntosCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntosCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntosCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntosCodeImplementationVisibility; - -// readableByteStreamControllerClose -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERCLOSE 1 -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerCloseCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerCloseCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerCloseCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerCloseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerCloseCodeImplementationVisibility; - -// readableByteStreamControllerCommitDescriptor -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERCOMMITDESCRIPTOR 1 -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerCommitDescriptorCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerCommitDescriptorCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerCommitDescriptorCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerCommitDescriptorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerCommitDescriptorCodeImplementationVisibility; - -// readableByteStreamControllerConvertDescriptor -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERCONVERTDESCRIPTOR 1 -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerConvertDescriptorCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerConvertDescriptorCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerConvertDescriptorCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerConvertDescriptorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerConvertDescriptorCodeImplementationVisibility; - -// readableByteStreamControllerEnqueue -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERENQUEUE 1 -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerEnqueueCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerEnqueueCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerEnqueueCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerEnqueueCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerEnqueueCodeImplementationVisibility; - -// readableByteStreamControllerEnqueueChunk -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERENQUEUECHUNK 1 -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerEnqueueChunkCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerEnqueueChunkCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerEnqueueChunkCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerEnqueueChunkCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerEnqueueChunkCodeImplementationVisibility; - -// readableByteStreamControllerError -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERERROR 1 -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerErrorCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerErrorCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerErrorCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerErrorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerErrorCodeImplementationVisibility; - -// readableByteStreamControllerFillDescriptorFromQueue -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERFILLDESCRIPTORFROMQUEUE 1 -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueueCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueueCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueueCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueueCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueueCodeImplementationVisibility; - -// readableByteStreamControllerGetDesiredSize -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERGETDESIREDSIZE 1 -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerGetDesiredSizeCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerGetDesiredSizeCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerGetDesiredSizeCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerGetDesiredSizeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerGetDesiredSizeCodeImplementationVisibility; - -// readableByteStreamControllerHandleQueueDrain -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERHANDLEQUEUEDRAIN 1 -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrainCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrainCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrainCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrainCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrainCodeImplementationVisibility; - -// readableByteStreamControllerInvalidateBYOBRequest -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERINVALIDATEBYOBREQUEST 1 -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequestCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequestCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequestCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequestCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequestCodeImplementationVisibility; - -// readableByteStreamControllerProcessPullDescriptors -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERPROCESSPULLDESCRIPTORS 1 -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptorsCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptorsCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptorsCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptorsCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptorsCodeImplementationVisibility; - -// readableByteStreamControllerPull -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERPULL 1 -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerPullCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerPullCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerPullCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerPullCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerPullCodeImplementationVisibility; - -// readableByteStreamControllerPullInto -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERPULLINTO 1 -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerPullIntoCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerPullIntoCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerPullIntoCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerPullIntoCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerPullIntoCodeImplementationVisibility; - -// readableByteStreamControllerRespond -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERRESPOND 1 -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerRespondCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerRespondCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerRespondCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerRespondCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerRespondCodeImplementationVisibility; - -// readableByteStreamControllerRespondInClosedState -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERRESPONDINCLOSEDSTATE 1 -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerRespondInClosedStateCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerRespondInClosedStateCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerRespondInClosedStateCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerRespondInClosedStateCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerRespondInClosedStateCodeImplementationVisibility; - -// readableByteStreamControllerRespondInReadableState -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERRESPONDINREADABLESTATE 1 -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerRespondInReadableStateCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerRespondInReadableStateCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerRespondInReadableStateCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerRespondInReadableStateCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerRespondInReadableStateCodeImplementationVisibility; - -// readableByteStreamControllerRespondInternal -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERRESPONDINTERNAL 1 -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerRespondInternalCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerRespondInternalCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerRespondInternalCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerRespondInternalCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerRespondInternalCodeImplementationVisibility; - -// readableByteStreamControllerRespondWithNewView -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERRESPONDWITHNEWVIEW 1 -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerRespondWithNewViewCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerRespondWithNewViewCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerRespondWithNewViewCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerRespondWithNewViewCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerRespondWithNewViewCodeImplementationVisibility; - -// readableByteStreamControllerShiftPendingDescriptor -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERSHIFTPENDINGDESCRIPTOR 1 -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptorCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptorCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptorCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptorCodeImplementationVisibility; - -// readableByteStreamControllerShouldCallPull -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERSHOULDCALLPULL 1 -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCodeImplementationVisibility; - -// readableStreamAddReadIntoRequest -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLESTREAMADDREADINTOREQUEST 1 -extern const char* const s_readableByteStreamInternalsReadableStreamAddReadIntoRequestCode; -extern const int s_readableByteStreamInternalsReadableStreamAddReadIntoRequestCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamAddReadIntoRequestCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamAddReadIntoRequestCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamAddReadIntoRequestCodeImplementationVisibility; - -// readableStreamBYOBReaderRead -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLESTREAMBYOBREADERREAD 1 -extern const char* const s_readableByteStreamInternalsReadableStreamBYOBReaderReadCode; -extern const int s_readableByteStreamInternalsReadableStreamBYOBReaderReadCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamBYOBReaderReadCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamBYOBReaderReadCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamBYOBReaderReadCodeImplementationVisibility; - -// readableStreamByteStreamControllerStart -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLESTREAMBYTESTREAMCONTROLLERSTART 1 -extern const char* const s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCode; -extern const int s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeImplementationVisibility; - -// readableStreamFulfillReadIntoRequest -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLESTREAMFULFILLREADINTOREQUEST 1 -extern const char* const s_readableByteStreamInternalsReadableStreamFulfillReadIntoRequestCode; -extern const int s_readableByteStreamInternalsReadableStreamFulfillReadIntoRequestCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamFulfillReadIntoRequestCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamFulfillReadIntoRequestCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamFulfillReadIntoRequestCodeImplementationVisibility; - -// readableStreamHasBYOBReader -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLESTREAMHASBYOBREADER 1 -extern const char* const s_readableByteStreamInternalsReadableStreamHasBYOBReaderCode; -extern const int s_readableByteStreamInternalsReadableStreamHasBYOBReaderCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamHasBYOBReaderCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamHasBYOBReaderCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamHasBYOBReaderCodeImplementationVisibility; - -// readableStreamHasDefaultReader -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLESTREAMHASDEFAULTREADER 1 -extern const char* const s_readableByteStreamInternalsReadableStreamHasDefaultReaderCode; -extern const int s_readableByteStreamInternalsReadableStreamHasDefaultReaderCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamHasDefaultReaderCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamHasDefaultReaderCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamHasDefaultReaderCodeImplementationVisibility; - -// readableStreamReaderKind -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLESTREAMREADERKIND 1 -extern const char* const s_readableByteStreamInternalsReadableStreamReaderKindCode; -extern const int s_readableByteStreamInternalsReadableStreamReaderKindCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamReaderKindCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamReaderKindCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamReaderKindCodeImplementationVisibility; - -// transferBufferToCurrentRealm -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_TRANSFERBUFFERTOCURRENTREALM 1 -extern const char* const s_readableByteStreamInternalsTransferBufferToCurrentRealmCode; -extern const int s_readableByteStreamInternalsTransferBufferToCurrentRealmCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsTransferBufferToCurrentRealmCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsTransferBufferToCurrentRealmCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsTransferBufferToCurrentRealmCodeImplementationVisibility; - -#define WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_DATA(macro) \ - macro(isReadableByteStreamController, readableByteStreamInternalsIsReadableByteStreamController, 1) \ - macro(isReadableStreamBYOBReader, readableByteStreamInternalsIsReadableStreamBYOBReader, 1) \ - macro(isReadableStreamBYOBRequest, readableByteStreamInternalsIsReadableStreamBYOBRequest, 1) \ - macro(privateInitializeReadableByteStreamController, readableByteStreamInternalsPrivateInitializeReadableByteStreamController, 3) \ - macro(privateInitializeReadableStreamBYOBRequest, readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequest, 2) \ - macro(readableByteStreamControllerCallPullIfNeeded, readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeeded, 1) \ - macro(readableByteStreamControllerCancel, readableByteStreamInternalsReadableByteStreamControllerCancel, 2) \ - macro(readableByteStreamControllerClearPendingPullIntos, readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntos, 1) \ - macro(readableByteStreamControllerClose, readableByteStreamInternalsReadableByteStreamControllerClose, 1) \ - macro(readableByteStreamControllerCommitDescriptor, readableByteStreamInternalsReadableByteStreamControllerCommitDescriptor, 2) \ - macro(readableByteStreamControllerConvertDescriptor, readableByteStreamInternalsReadableByteStreamControllerConvertDescriptor, 1) \ - macro(readableByteStreamControllerEnqueue, readableByteStreamInternalsReadableByteStreamControllerEnqueue, 2) \ - macro(readableByteStreamControllerEnqueueChunk, readableByteStreamInternalsReadableByteStreamControllerEnqueueChunk, 4) \ - macro(readableByteStreamControllerError, readableByteStreamInternalsReadableByteStreamControllerError, 2) \ - macro(readableByteStreamControllerFillDescriptorFromQueue, readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueue, 2) \ - macro(readableByteStreamControllerGetDesiredSize, readableByteStreamInternalsReadableByteStreamControllerGetDesiredSize, 1) \ - macro(readableByteStreamControllerHandleQueueDrain, readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrain, 1) \ - macro(readableByteStreamControllerInvalidateBYOBRequest, readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequest, 1) \ - macro(readableByteStreamControllerProcessPullDescriptors, readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptors, 1) \ - macro(readableByteStreamControllerPull, readableByteStreamInternalsReadableByteStreamControllerPull, 1) \ - macro(readableByteStreamControllerPullInto, readableByteStreamInternalsReadableByteStreamControllerPullInto, 2) \ - macro(readableByteStreamControllerRespond, readableByteStreamInternalsReadableByteStreamControllerRespond, 2) \ - macro(readableByteStreamControllerRespondInClosedState, readableByteStreamInternalsReadableByteStreamControllerRespondInClosedState, 2) \ - macro(readableByteStreamControllerRespondInReadableState, readableByteStreamInternalsReadableByteStreamControllerRespondInReadableState, 3) \ - macro(readableByteStreamControllerRespondInternal, readableByteStreamInternalsReadableByteStreamControllerRespondInternal, 2) \ - macro(readableByteStreamControllerRespondWithNewView, readableByteStreamInternalsReadableByteStreamControllerRespondWithNewView, 2) \ - macro(readableByteStreamControllerShiftPendingDescriptor, readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptor, 1) \ - macro(readableByteStreamControllerShouldCallPull, readableByteStreamInternalsReadableByteStreamControllerShouldCallPull, 1) \ - macro(readableStreamAddReadIntoRequest, readableByteStreamInternalsReadableStreamAddReadIntoRequest, 1) \ - macro(readableStreamBYOBReaderRead, readableByteStreamInternalsReadableStreamBYOBReaderRead, 2) \ - macro(readableStreamByteStreamControllerStart, readableByteStreamInternalsReadableStreamByteStreamControllerStart, 1) \ - macro(readableStreamFulfillReadIntoRequest, readableByteStreamInternalsReadableStreamFulfillReadIntoRequest, 3) \ - macro(readableStreamHasBYOBReader, readableByteStreamInternalsReadableStreamHasBYOBReader, 1) \ - macro(readableStreamHasDefaultReader, readableByteStreamInternalsReadableStreamHasDefaultReader, 1) \ - macro(readableStreamReaderKind, readableByteStreamInternalsReadableStreamReaderKind, 1) \ - macro(transferBufferToCurrentRealm, readableByteStreamInternalsTransferBufferToCurrentRealm, 1) \ - -#define WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_CODE(macro) \ - macro(readableByteStreamInternalsIsReadableByteStreamControllerCode, isReadableByteStreamController, ASCIILiteral(), s_readableByteStreamInternalsIsReadableByteStreamControllerCodeLength) \ - macro(readableByteStreamInternalsIsReadableStreamBYOBReaderCode, isReadableStreamBYOBReader, ASCIILiteral(), s_readableByteStreamInternalsIsReadableStreamBYOBReaderCodeLength) \ - macro(readableByteStreamInternalsIsReadableStreamBYOBRequestCode, isReadableStreamBYOBRequest, ASCIILiteral(), s_readableByteStreamInternalsIsReadableStreamBYOBRequestCodeLength) \ - macro(readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCode, privateInitializeReadableByteStreamController, ASCIILiteral(), s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeLength) \ - macro(readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCode, privateInitializeReadableStreamBYOBRequest, ASCIILiteral(), s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeededCode, readableByteStreamControllerCallPullIfNeeded, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeededCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerCancelCode, readableByteStreamControllerCancel, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerCancelCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntosCode, readableByteStreamControllerClearPendingPullIntos, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntosCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerCloseCode, readableByteStreamControllerClose, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerCloseCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerCommitDescriptorCode, readableByteStreamControllerCommitDescriptor, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerCommitDescriptorCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerConvertDescriptorCode, readableByteStreamControllerConvertDescriptor, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerConvertDescriptorCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerEnqueueCode, readableByteStreamControllerEnqueue, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerEnqueueCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerEnqueueChunkCode, readableByteStreamControllerEnqueueChunk, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerEnqueueChunkCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerErrorCode, readableByteStreamControllerError, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerErrorCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueueCode, readableByteStreamControllerFillDescriptorFromQueue, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueueCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerGetDesiredSizeCode, readableByteStreamControllerGetDesiredSize, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerGetDesiredSizeCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrainCode, readableByteStreamControllerHandleQueueDrain, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrainCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequestCode, readableByteStreamControllerInvalidateBYOBRequest, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequestCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptorsCode, readableByteStreamControllerProcessPullDescriptors, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptorsCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerPullCode, readableByteStreamControllerPull, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerPullCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerPullIntoCode, readableByteStreamControllerPullInto, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerPullIntoCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerRespondCode, readableByteStreamControllerRespond, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerRespondCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerRespondInClosedStateCode, readableByteStreamControllerRespondInClosedState, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerRespondInClosedStateCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerRespondInReadableStateCode, readableByteStreamControllerRespondInReadableState, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerRespondInReadableStateCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerRespondInternalCode, readableByteStreamControllerRespondInternal, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerRespondInternalCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerRespondWithNewViewCode, readableByteStreamControllerRespondWithNewView, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerRespondWithNewViewCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptorCode, readableByteStreamControllerShiftPendingDescriptor, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptorCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCode, readableByteStreamControllerShouldCallPull, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCodeLength) \ - macro(readableByteStreamInternalsReadableStreamAddReadIntoRequestCode, readableStreamAddReadIntoRequest, ASCIILiteral(), s_readableByteStreamInternalsReadableStreamAddReadIntoRequestCodeLength) \ - macro(readableByteStreamInternalsReadableStreamBYOBReaderReadCode, readableStreamBYOBReaderRead, ASCIILiteral(), s_readableByteStreamInternalsReadableStreamBYOBReaderReadCodeLength) \ - macro(readableByteStreamInternalsReadableStreamByteStreamControllerStartCode, readableStreamByteStreamControllerStart, ASCIILiteral(), s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeLength) \ - macro(readableByteStreamInternalsReadableStreamFulfillReadIntoRequestCode, readableStreamFulfillReadIntoRequest, ASCIILiteral(), s_readableByteStreamInternalsReadableStreamFulfillReadIntoRequestCodeLength) \ - macro(readableByteStreamInternalsReadableStreamHasBYOBReaderCode, readableStreamHasBYOBReader, ASCIILiteral(), s_readableByteStreamInternalsReadableStreamHasBYOBReaderCodeLength) \ - macro(readableByteStreamInternalsReadableStreamHasDefaultReaderCode, readableStreamHasDefaultReader, ASCIILiteral(), s_readableByteStreamInternalsReadableStreamHasDefaultReaderCodeLength) \ - macro(readableByteStreamInternalsReadableStreamReaderKindCode, readableStreamReaderKind, ASCIILiteral(), s_readableByteStreamInternalsReadableStreamReaderKindCodeLength) \ - macro(readableByteStreamInternalsTransferBufferToCurrentRealmCode, transferBufferToCurrentRealm, ASCIILiteral(), s_readableByteStreamInternalsTransferBufferToCurrentRealmCodeLength) \ - -#define WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(macro) \ - macro(isReadableByteStreamController) \ - macro(isReadableStreamBYOBReader) \ - macro(isReadableStreamBYOBRequest) \ - macro(privateInitializeReadableByteStreamController) \ - macro(privateInitializeReadableStreamBYOBRequest) \ - macro(readableByteStreamControllerCallPullIfNeeded) \ - macro(readableByteStreamControllerCancel) \ - macro(readableByteStreamControllerClearPendingPullIntos) \ - macro(readableByteStreamControllerClose) \ - macro(readableByteStreamControllerCommitDescriptor) \ - macro(readableByteStreamControllerConvertDescriptor) \ - macro(readableByteStreamControllerEnqueue) \ - macro(readableByteStreamControllerEnqueueChunk) \ - macro(readableByteStreamControllerError) \ - macro(readableByteStreamControllerFillDescriptorFromQueue) \ - macro(readableByteStreamControllerGetDesiredSize) \ - macro(readableByteStreamControllerHandleQueueDrain) \ - macro(readableByteStreamControllerInvalidateBYOBRequest) \ - macro(readableByteStreamControllerProcessPullDescriptors) \ - macro(readableByteStreamControllerPull) \ - macro(readableByteStreamControllerPullInto) \ - macro(readableByteStreamControllerRespond) \ - macro(readableByteStreamControllerRespondInClosedState) \ - macro(readableByteStreamControllerRespondInReadableState) \ - macro(readableByteStreamControllerRespondInternal) \ - macro(readableByteStreamControllerRespondWithNewView) \ - macro(readableByteStreamControllerShiftPendingDescriptor) \ - macro(readableByteStreamControllerShouldCallPull) \ - macro(readableStreamAddReadIntoRequest) \ - macro(readableStreamBYOBReaderRead) \ - macro(readableStreamByteStreamControllerStart) \ - macro(readableStreamFulfillReadIntoRequest) \ - macro(readableStreamHasBYOBReader) \ - macro(readableStreamHasDefaultReader) \ - macro(readableStreamReaderKind) \ - macro(transferBufferToCurrentRealm) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class ReadableByteStreamInternalsBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit ReadableByteStreamInternalsBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { }, JSC::SourceTaintedOrigin::Untainted)) - WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak m_##name##Executable; - WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* ReadableByteStreamInternalsBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void ReadableByteStreamInternalsBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} -class ReadableByteStreamInternalsBuiltinFunctions { -public: - explicit ReadableByteStreamInternalsBuiltinFunctions(JSC::VM& vm) : m_vm(vm) { } - - void init(JSC::JSGlobalObject&); - template void visit(Visitor&); - -public: - JSC::VM& m_vm; - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \ - JSC::WriteBarrier m_##functionName##Function; - WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS -}; - -inline void ReadableByteStreamInternalsBuiltinFunctions::init(JSC::JSGlobalObject& globalObject) -{ -#define EXPORT_FUNCTION(codeName, functionName, overriddenName, length) \ - m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::create(m_vm, codeName##Generator(m_vm), &globalObject)); - WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_CODE(EXPORT_FUNCTION) -#undef EXPORT_FUNCTION -} - -template -inline void ReadableByteStreamInternalsBuiltinFunctions::visit(Visitor& visitor) -{ -#define VISIT_FUNCTION(name) visitor.append(m_##name##Function); - WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION) -#undef VISIT_FUNCTION -} - -template void ReadableByteStreamInternalsBuiltinFunctions::visit(JSC::AbstractSlotVisitor&); -template void ReadableByteStreamInternalsBuiltinFunctions::visit(JSC::SlotVisitor&); - /* ReadableStream.ts */ -// cancel -#define WEBCORE_BUILTIN_READABLESTREAM_CANCEL 1 -extern const char* const s_readableStreamCancelCode; -extern const int s_readableStreamCancelCodeLength; -extern const JSC::ConstructAbility s_readableStreamCancelCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamCancelCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamCancelCodeImplementationVisibility; - -// consumeReadableStream -#define WEBCORE_BUILTIN_READABLESTREAM_CONSUMEREADABLESTREAM 1 -extern const char* const s_readableStreamConsumeReadableStreamCode; -extern const int s_readableStreamConsumeReadableStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamConsumeReadableStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamConsumeReadableStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamConsumeReadableStreamCodeImplementationVisibility; - -// createEmptyReadableStream -#define WEBCORE_BUILTIN_READABLESTREAM_CREATEEMPTYREADABLESTREAM 1 -extern const char* const s_readableStreamCreateEmptyReadableStreamCode; -extern const int s_readableStreamCreateEmptyReadableStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamCreateEmptyReadableStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamCreateEmptyReadableStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamCreateEmptyReadableStreamCodeImplementationVisibility; - -// createNativeReadableStream -#define WEBCORE_BUILTIN_READABLESTREAM_CREATENATIVEREADABLESTREAM 1 -extern const char* const s_readableStreamCreateNativeReadableStreamCode; -extern const int s_readableStreamCreateNativeReadableStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamCreateNativeReadableStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamCreateNativeReadableStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamCreateNativeReadableStreamCodeImplementationVisibility; - -// createUsedReadableStream -#define WEBCORE_BUILTIN_READABLESTREAM_CREATEUSEDREADABLESTREAM 1 -extern const char* const s_readableStreamCreateUsedReadableStreamCode; -extern const int s_readableStreamCreateUsedReadableStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamCreateUsedReadableStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamCreateUsedReadableStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamCreateUsedReadableStreamCodeImplementationVisibility; - -// getReader -#define WEBCORE_BUILTIN_READABLESTREAM_GETREADER 1 -extern const char* const s_readableStreamGetReaderCode; -extern const int s_readableStreamGetReaderCodeLength; -extern const JSC::ConstructAbility s_readableStreamGetReaderCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamGetReaderCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamGetReaderCodeImplementationVisibility; - -// initializeReadableStream -#define WEBCORE_BUILTIN_READABLESTREAM_INITIALIZEREADABLESTREAM 1 -extern const char* const s_readableStreamInitializeReadableStreamCode; -extern const int s_readableStreamInitializeReadableStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamInitializeReadableStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInitializeReadableStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInitializeReadableStreamCodeImplementationVisibility; - -// lazyAsyncIterator -#define WEBCORE_BUILTIN_READABLESTREAM_LAZYASYNCITERATOR 1 -extern const char* const s_readableStreamLazyAsyncIteratorCode; -extern const int s_readableStreamLazyAsyncIteratorCodeLength; -extern const JSC::ConstructAbility s_readableStreamLazyAsyncIteratorCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamLazyAsyncIteratorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamLazyAsyncIteratorCodeImplementationVisibility; - -// locked -#define WEBCORE_BUILTIN_READABLESTREAM_LOCKED 1 -extern const char* const s_readableStreamLockedCode; -extern const int s_readableStreamLockedCodeLength; -extern const JSC::ConstructAbility s_readableStreamLockedCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamLockedCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamLockedCodeImplementationVisibility; - -// pipeThrough -#define WEBCORE_BUILTIN_READABLESTREAM_PIPETHROUGH 1 -extern const char* const s_readableStreamPipeThroughCode; -extern const int s_readableStreamPipeThroughCodeLength; -extern const JSC::ConstructAbility s_readableStreamPipeThroughCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamPipeThroughCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamPipeThroughCodeImplementationVisibility; - -// pipeTo -#define WEBCORE_BUILTIN_READABLESTREAM_PIPETO 1 -extern const char* const s_readableStreamPipeToCode; -extern const int s_readableStreamPipeToCodeLength; -extern const JSC::ConstructAbility s_readableStreamPipeToCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamPipeToCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamPipeToCodeImplementationVisibility; - -// readableStreamToArray -#define WEBCORE_BUILTIN_READABLESTREAM_READABLESTREAMTOARRAY 1 -extern const char* const s_readableStreamReadableStreamToArrayCode; -extern const int s_readableStreamReadableStreamToArrayCodeLength; -extern const JSC::ConstructAbility s_readableStreamReadableStreamToArrayCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamReadableStreamToArrayCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamReadableStreamToArrayCodeImplementationVisibility; - -// readableStreamToArrayBuffer -#define WEBCORE_BUILTIN_READABLESTREAM_READABLESTREAMTOARRAYBUFFER 1 -extern const char* const s_readableStreamReadableStreamToArrayBufferCode; -extern const int s_readableStreamReadableStreamToArrayBufferCodeLength; -extern const JSC::ConstructAbility s_readableStreamReadableStreamToArrayBufferCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamReadableStreamToArrayBufferCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamReadableStreamToArrayBufferCodeImplementationVisibility; - -// readableStreamToBlob -#define WEBCORE_BUILTIN_READABLESTREAM_READABLESTREAMTOBLOB 1 -extern const char* const s_readableStreamReadableStreamToBlobCode; -extern const int s_readableStreamReadableStreamToBlobCodeLength; -extern const JSC::ConstructAbility s_readableStreamReadableStreamToBlobCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamReadableStreamToBlobCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamReadableStreamToBlobCodeImplementationVisibility; - -// readableStreamToFormData -#define WEBCORE_BUILTIN_READABLESTREAM_READABLESTREAMTOFORMDATA 1 -extern const char* const s_readableStreamReadableStreamToFormDataCode; -extern const int s_readableStreamReadableStreamToFormDataCodeLength; -extern const JSC::ConstructAbility s_readableStreamReadableStreamToFormDataCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamReadableStreamToFormDataCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamReadableStreamToFormDataCodeImplementationVisibility; - -// readableStreamToJSON -#define WEBCORE_BUILTIN_READABLESTREAM_READABLESTREAMTOJSON 1 -extern const char* const s_readableStreamReadableStreamToJSONCode; -extern const int s_readableStreamReadableStreamToJSONCodeLength; -extern const JSC::ConstructAbility s_readableStreamReadableStreamToJSONCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamReadableStreamToJSONCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamReadableStreamToJSONCodeImplementationVisibility; - -// readableStreamToText -#define WEBCORE_BUILTIN_READABLESTREAM_READABLESTREAMTOTEXT 1 -extern const char* const s_readableStreamReadableStreamToTextCode; -extern const int s_readableStreamReadableStreamToTextCodeLength; -extern const JSC::ConstructAbility s_readableStreamReadableStreamToTextCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamReadableStreamToTextCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamReadableStreamToTextCodeImplementationVisibility; - -// tee -#define WEBCORE_BUILTIN_READABLESTREAM_TEE 1 -extern const char* const s_readableStreamTeeCode; -extern const int s_readableStreamTeeCodeLength; -extern const JSC::ConstructAbility s_readableStreamTeeCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamTeeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamTeeCodeImplementationVisibility; - -// values -#define WEBCORE_BUILTIN_READABLESTREAM_VALUES 1 -extern const char* const s_readableStreamValuesCode; -extern const int s_readableStreamValuesCodeLength; -extern const JSC::ConstructAbility s_readableStreamValuesCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamValuesCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamValuesCodeImplementationVisibility; - -#define WEBCORE_FOREACH_READABLESTREAM_BUILTIN_DATA(macro) \ - macro(cancel, readableStreamCancel, 1) \ - macro(consumeReadableStream, readableStreamConsumeReadableStream, 3) \ - macro(createEmptyReadableStream, readableStreamCreateEmptyReadableStream, 0) \ - macro(createNativeReadableStream, readableStreamCreateNativeReadableStream, 3) \ - macro(createUsedReadableStream, readableStreamCreateUsedReadableStream, 0) \ - macro(getReader, readableStreamGetReader, 1) \ - macro(initializeReadableStream, readableStreamInitializeReadableStream, 3) \ - macro(lazyAsyncIterator, readableStreamLazyAsyncIterator, 0) \ - macro(locked, readableStreamLocked, 0) \ - macro(pipeThrough, readableStreamPipeThrough, 2) \ - macro(pipeTo, readableStreamPipeTo, 1) \ - macro(readableStreamToArray, readableStreamReadableStreamToArray, 1) \ - macro(readableStreamToArrayBuffer, readableStreamReadableStreamToArrayBuffer, 1) \ - macro(readableStreamToBlob, readableStreamReadableStreamToBlob, 1) \ - macro(readableStreamToFormData, readableStreamReadableStreamToFormData, 3) \ - macro(readableStreamToJSON, readableStreamReadableStreamToJSON, 1) \ - macro(readableStreamToText, readableStreamReadableStreamToText, 1) \ - macro(tee, readableStreamTee, 0) \ - macro(values, readableStreamValues, 1) \ - -#define WEBCORE_FOREACH_READABLESTREAM_BUILTIN_CODE(macro) \ - macro(readableStreamCancelCode, cancel, ASCIILiteral(), s_readableStreamCancelCodeLength) \ - macro(readableStreamConsumeReadableStreamCode, consumeReadableStream, ASCIILiteral(), s_readableStreamConsumeReadableStreamCodeLength) \ - macro(readableStreamCreateEmptyReadableStreamCode, createEmptyReadableStream, ASCIILiteral(), s_readableStreamCreateEmptyReadableStreamCodeLength) \ - macro(readableStreamCreateNativeReadableStreamCode, createNativeReadableStream, ASCIILiteral(), s_readableStreamCreateNativeReadableStreamCodeLength) \ - macro(readableStreamCreateUsedReadableStreamCode, createUsedReadableStream, ASCIILiteral(), s_readableStreamCreateUsedReadableStreamCodeLength) \ - macro(readableStreamGetReaderCode, getReader, ASCIILiteral(), s_readableStreamGetReaderCodeLength) \ - macro(readableStreamInitializeReadableStreamCode, initializeReadableStream, ASCIILiteral(), s_readableStreamInitializeReadableStreamCodeLength) \ - macro(readableStreamLazyAsyncIteratorCode, lazyAsyncIterator, ASCIILiteral(), s_readableStreamLazyAsyncIteratorCodeLength) \ - macro(readableStreamLockedCode, locked, "get locked"_s, s_readableStreamLockedCodeLength) \ - macro(readableStreamPipeThroughCode, pipeThrough, ASCIILiteral(), s_readableStreamPipeThroughCodeLength) \ - macro(readableStreamPipeToCode, pipeTo, ASCIILiteral(), s_readableStreamPipeToCodeLength) \ - macro(readableStreamReadableStreamToArrayCode, readableStreamToArray, ASCIILiteral(), s_readableStreamReadableStreamToArrayCodeLength) \ - macro(readableStreamReadableStreamToArrayBufferCode, readableStreamToArrayBuffer, ASCIILiteral(), s_readableStreamReadableStreamToArrayBufferCodeLength) \ - macro(readableStreamReadableStreamToBlobCode, readableStreamToBlob, ASCIILiteral(), s_readableStreamReadableStreamToBlobCodeLength) \ - macro(readableStreamReadableStreamToFormDataCode, readableStreamToFormData, ASCIILiteral(), s_readableStreamReadableStreamToFormDataCodeLength) \ - macro(readableStreamReadableStreamToJSONCode, readableStreamToJSON, ASCIILiteral(), s_readableStreamReadableStreamToJSONCodeLength) \ - macro(readableStreamReadableStreamToTextCode, readableStreamToText, ASCIILiteral(), s_readableStreamReadableStreamToTextCodeLength) \ - macro(readableStreamTeeCode, tee, ASCIILiteral(), s_readableStreamTeeCodeLength) \ - macro(readableStreamValuesCode, values, ASCIILiteral(), s_readableStreamValuesCodeLength) \ - -#define WEBCORE_FOREACH_READABLESTREAM_BUILTIN_FUNCTION_NAME(macro) \ - macro(cancel) \ - macro(consumeReadableStream) \ - macro(createEmptyReadableStream) \ - macro(createNativeReadableStream) \ - macro(createUsedReadableStream) \ - macro(getReader) \ - macro(initializeReadableStream) \ - macro(lazyAsyncIterator) \ - macro(locked) \ - macro(pipeThrough) \ - macro(pipeTo) \ - macro(readableStreamToArray) \ - macro(readableStreamToArrayBuffer) \ - macro(readableStreamToBlob) \ - macro(readableStreamToFormData) \ - macro(readableStreamToJSON) \ - macro(readableStreamToText) \ - macro(tee) \ - macro(values) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_READABLESTREAM_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class ReadableStreamBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit ReadableStreamBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_READABLESTREAM_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { }, JSC::SourceTaintedOrigin::Untainted)) - WEBCORE_FOREACH_READABLESTREAM_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_READABLESTREAM_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_READABLESTREAM_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_READABLESTREAM_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak m_##name##Executable; - WEBCORE_FOREACH_READABLESTREAM_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* ReadableStreamBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_READABLESTREAM_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void ReadableStreamBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_READABLESTREAM_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} -/* ReadableStreamBYOBReader.ts */ -// cancel -#define WEBCORE_BUILTIN_READABLESTREAMBYOBREADER_CANCEL 1 -extern const char* const s_readableStreamBYOBReaderCancelCode; -extern const int s_readableStreamBYOBReaderCancelCodeLength; -extern const JSC::ConstructAbility s_readableStreamBYOBReaderCancelCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamBYOBReaderCancelCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamBYOBReaderCancelCodeImplementationVisibility; - -// closed -#define WEBCORE_BUILTIN_READABLESTREAMBYOBREADER_CLOSED 1 -extern const char* const s_readableStreamBYOBReaderClosedCode; -extern const int s_readableStreamBYOBReaderClosedCodeLength; -extern const JSC::ConstructAbility s_readableStreamBYOBReaderClosedCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamBYOBReaderClosedCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamBYOBReaderClosedCodeImplementationVisibility; - -// initializeReadableStreamBYOBReader -#define WEBCORE_BUILTIN_READABLESTREAMBYOBREADER_INITIALIZEREADABLESTREAMBYOBREADER 1 -extern const char* const s_readableStreamBYOBReaderInitializeReadableStreamBYOBReaderCode; -extern const int s_readableStreamBYOBReaderInitializeReadableStreamBYOBReaderCodeLength; -extern const JSC::ConstructAbility s_readableStreamBYOBReaderInitializeReadableStreamBYOBReaderCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamBYOBReaderInitializeReadableStreamBYOBReaderCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamBYOBReaderInitializeReadableStreamBYOBReaderCodeImplementationVisibility; - -// read -#define WEBCORE_BUILTIN_READABLESTREAMBYOBREADER_READ 1 -extern const char* const s_readableStreamBYOBReaderReadCode; -extern const int s_readableStreamBYOBReaderReadCodeLength; -extern const JSC::ConstructAbility s_readableStreamBYOBReaderReadCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamBYOBReaderReadCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamBYOBReaderReadCodeImplementationVisibility; - -// releaseLock -#define WEBCORE_BUILTIN_READABLESTREAMBYOBREADER_RELEASELOCK 1 -extern const char* const s_readableStreamBYOBReaderReleaseLockCode; -extern const int s_readableStreamBYOBReaderReleaseLockCodeLength; -extern const JSC::ConstructAbility s_readableStreamBYOBReaderReleaseLockCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamBYOBReaderReleaseLockCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamBYOBReaderReleaseLockCodeImplementationVisibility; - -#define WEBCORE_FOREACH_READABLESTREAMBYOBREADER_BUILTIN_DATA(macro) \ - macro(cancel, readableStreamBYOBReaderCancel, 1) \ - macro(closed, readableStreamBYOBReaderClosed, 0) \ - macro(initializeReadableStreamBYOBReader, readableStreamBYOBReaderInitializeReadableStreamBYOBReader, 1) \ - macro(read, readableStreamBYOBReaderRead, 1) \ - macro(releaseLock, readableStreamBYOBReaderReleaseLock, 0) \ - -#define WEBCORE_FOREACH_READABLESTREAMBYOBREADER_BUILTIN_CODE(macro) \ - macro(readableStreamBYOBReaderCancelCode, cancel, ASCIILiteral(), s_readableStreamBYOBReaderCancelCodeLength) \ - macro(readableStreamBYOBReaderClosedCode, closed, "get closed"_s, s_readableStreamBYOBReaderClosedCodeLength) \ - macro(readableStreamBYOBReaderInitializeReadableStreamBYOBReaderCode, initializeReadableStreamBYOBReader, ASCIILiteral(), s_readableStreamBYOBReaderInitializeReadableStreamBYOBReaderCodeLength) \ - macro(readableStreamBYOBReaderReadCode, read, ASCIILiteral(), s_readableStreamBYOBReaderReadCodeLength) \ - macro(readableStreamBYOBReaderReleaseLockCode, releaseLock, ASCIILiteral(), s_readableStreamBYOBReaderReleaseLockCodeLength) \ - -#define WEBCORE_FOREACH_READABLESTREAMBYOBREADER_BUILTIN_FUNCTION_NAME(macro) \ - macro(cancel) \ - macro(closed) \ - macro(initializeReadableStreamBYOBReader) \ - macro(read) \ - macro(releaseLock) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_READABLESTREAMBYOBREADER_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class ReadableStreamBYOBReaderBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit ReadableStreamBYOBReaderBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_READABLESTREAMBYOBREADER_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { }, JSC::SourceTaintedOrigin::Untainted)) - WEBCORE_FOREACH_READABLESTREAMBYOBREADER_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_READABLESTREAMBYOBREADER_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_READABLESTREAMBYOBREADER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_READABLESTREAMBYOBREADER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak m_##name##Executable; - WEBCORE_FOREACH_READABLESTREAMBYOBREADER_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* ReadableStreamBYOBReaderBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_READABLESTREAMBYOBREADER_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void ReadableStreamBYOBReaderBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_READABLESTREAMBYOBREADER_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} -/* ReadableStreamBYOBRequest.ts */ -// initializeReadableStreamBYOBRequest -#define WEBCORE_BUILTIN_READABLESTREAMBYOBREQUEST_INITIALIZEREADABLESTREAMBYOBREQUEST 1 -extern const char* const s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCode; -extern const int s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCodeLength; -extern const JSC::ConstructAbility s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCodeImplementationVisibility; - -// respond -#define WEBCORE_BUILTIN_READABLESTREAMBYOBREQUEST_RESPOND 1 -extern const char* const s_readableStreamBYOBRequestRespondCode; -extern const int s_readableStreamBYOBRequestRespondCodeLength; -extern const JSC::ConstructAbility s_readableStreamBYOBRequestRespondCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamBYOBRequestRespondCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamBYOBRequestRespondCodeImplementationVisibility; - -// respondWithNewView -#define WEBCORE_BUILTIN_READABLESTREAMBYOBREQUEST_RESPONDWITHNEWVIEW 1 -extern const char* const s_readableStreamBYOBRequestRespondWithNewViewCode; -extern const int s_readableStreamBYOBRequestRespondWithNewViewCodeLength; -extern const JSC::ConstructAbility s_readableStreamBYOBRequestRespondWithNewViewCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamBYOBRequestRespondWithNewViewCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamBYOBRequestRespondWithNewViewCodeImplementationVisibility; - -// view -#define WEBCORE_BUILTIN_READABLESTREAMBYOBREQUEST_VIEW 1 -extern const char* const s_readableStreamBYOBRequestViewCode; -extern const int s_readableStreamBYOBRequestViewCodeLength; -extern const JSC::ConstructAbility s_readableStreamBYOBRequestViewCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamBYOBRequestViewCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamBYOBRequestViewCodeImplementationVisibility; - -#define WEBCORE_FOREACH_READABLESTREAMBYOBREQUEST_BUILTIN_DATA(macro) \ - macro(initializeReadableStreamBYOBRequest, readableStreamBYOBRequestInitializeReadableStreamBYOBRequest, 2) \ - macro(respond, readableStreamBYOBRequestRespond, 1) \ - macro(respondWithNewView, readableStreamBYOBRequestRespondWithNewView, 1) \ - macro(view, readableStreamBYOBRequestView, 0) \ - -#define WEBCORE_FOREACH_READABLESTREAMBYOBREQUEST_BUILTIN_CODE(macro) \ - macro(readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCode, initializeReadableStreamBYOBRequest, ASCIILiteral(), s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCodeLength) \ - macro(readableStreamBYOBRequestRespondCode, respond, ASCIILiteral(), s_readableStreamBYOBRequestRespondCodeLength) \ - macro(readableStreamBYOBRequestRespondWithNewViewCode, respondWithNewView, ASCIILiteral(), s_readableStreamBYOBRequestRespondWithNewViewCodeLength) \ - macro(readableStreamBYOBRequestViewCode, view, "get view"_s, s_readableStreamBYOBRequestViewCodeLength) \ - -#define WEBCORE_FOREACH_READABLESTREAMBYOBREQUEST_BUILTIN_FUNCTION_NAME(macro) \ - macro(initializeReadableStreamBYOBRequest) \ - macro(respond) \ - macro(respondWithNewView) \ - macro(view) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_READABLESTREAMBYOBREQUEST_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class ReadableStreamBYOBRequestBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit ReadableStreamBYOBRequestBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_READABLESTREAMBYOBREQUEST_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { }, JSC::SourceTaintedOrigin::Untainted)) - WEBCORE_FOREACH_READABLESTREAMBYOBREQUEST_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_READABLESTREAMBYOBREQUEST_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_READABLESTREAMBYOBREQUEST_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_READABLESTREAMBYOBREQUEST_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak m_##name##Executable; - WEBCORE_FOREACH_READABLESTREAMBYOBREQUEST_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* ReadableStreamBYOBRequestBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_READABLESTREAMBYOBREQUEST_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void ReadableStreamBYOBRequestBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_READABLESTREAMBYOBREQUEST_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} -/* ReadableStreamDefaultController.ts */ -// close -#define WEBCORE_BUILTIN_READABLESTREAMDEFAULTCONTROLLER_CLOSE 1 -extern const char* const s_readableStreamDefaultControllerCloseCode; -extern const int s_readableStreamDefaultControllerCloseCodeLength; -extern const JSC::ConstructAbility s_readableStreamDefaultControllerCloseCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamDefaultControllerCloseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamDefaultControllerCloseCodeImplementationVisibility; - -// desiredSize -#define WEBCORE_BUILTIN_READABLESTREAMDEFAULTCONTROLLER_DESIREDSIZE 1 -extern const char* const s_readableStreamDefaultControllerDesiredSizeCode; -extern const int s_readableStreamDefaultControllerDesiredSizeCodeLength; -extern const JSC::ConstructAbility s_readableStreamDefaultControllerDesiredSizeCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamDefaultControllerDesiredSizeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamDefaultControllerDesiredSizeCodeImplementationVisibility; - -// enqueue -#define WEBCORE_BUILTIN_READABLESTREAMDEFAULTCONTROLLER_ENQUEUE 1 -extern const char* const s_readableStreamDefaultControllerEnqueueCode; -extern const int s_readableStreamDefaultControllerEnqueueCodeLength; -extern const JSC::ConstructAbility s_readableStreamDefaultControllerEnqueueCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamDefaultControllerEnqueueCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamDefaultControllerEnqueueCodeImplementationVisibility; - -// error -#define WEBCORE_BUILTIN_READABLESTREAMDEFAULTCONTROLLER_ERROR 1 -extern const char* const s_readableStreamDefaultControllerErrorCode; -extern const int s_readableStreamDefaultControllerErrorCodeLength; -extern const JSC::ConstructAbility s_readableStreamDefaultControllerErrorCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamDefaultControllerErrorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamDefaultControllerErrorCodeImplementationVisibility; - -// initializeReadableStreamDefaultController -#define WEBCORE_BUILTIN_READABLESTREAMDEFAULTCONTROLLER_INITIALIZEREADABLESTREAMDEFAULTCONTROLLER 1 -extern const char* const s_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCode; -extern const int s_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCodeLength; -extern const JSC::ConstructAbility s_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCodeImplementationVisibility; - -#define WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_DATA(macro) \ - macro(close, readableStreamDefaultControllerClose, 0) \ - macro(desiredSize, readableStreamDefaultControllerDesiredSize, 0) \ - macro(enqueue, readableStreamDefaultControllerEnqueue, 1) \ - macro(error, readableStreamDefaultControllerError, 1) \ - macro(initializeReadableStreamDefaultController, readableStreamDefaultControllerInitializeReadableStreamDefaultController, 4) \ - -#define WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(macro) \ - macro(readableStreamDefaultControllerCloseCode, close, ASCIILiteral(), s_readableStreamDefaultControllerCloseCodeLength) \ - macro(readableStreamDefaultControllerDesiredSizeCode, desiredSize, "get desiredSize"_s, s_readableStreamDefaultControllerDesiredSizeCodeLength) \ - macro(readableStreamDefaultControllerEnqueueCode, enqueue, ASCIILiteral(), s_readableStreamDefaultControllerEnqueueCodeLength) \ - macro(readableStreamDefaultControllerErrorCode, error, ASCIILiteral(), s_readableStreamDefaultControllerErrorCodeLength) \ - macro(readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCode, initializeReadableStreamDefaultController, ASCIILiteral(), s_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCodeLength) \ - -#define WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(macro) \ - macro(close) \ - macro(desiredSize) \ - macro(enqueue) \ - macro(error) \ - macro(initializeReadableStreamDefaultController) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class ReadableStreamDefaultControllerBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit ReadableStreamDefaultControllerBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { }, JSC::SourceTaintedOrigin::Untainted)) - WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak m_##name##Executable; - WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* ReadableStreamDefaultControllerBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void ReadableStreamDefaultControllerBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} -/* ReadableStreamDefaultReader.ts */ -// cancel -#define WEBCORE_BUILTIN_READABLESTREAMDEFAULTREADER_CANCEL 1 -extern const char* const s_readableStreamDefaultReaderCancelCode; -extern const int s_readableStreamDefaultReaderCancelCodeLength; -extern const JSC::ConstructAbility s_readableStreamDefaultReaderCancelCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamDefaultReaderCancelCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamDefaultReaderCancelCodeImplementationVisibility; - -// closed -#define WEBCORE_BUILTIN_READABLESTREAMDEFAULTREADER_CLOSED 1 -extern const char* const s_readableStreamDefaultReaderClosedCode; -extern const int s_readableStreamDefaultReaderClosedCodeLength; -extern const JSC::ConstructAbility s_readableStreamDefaultReaderClosedCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamDefaultReaderClosedCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamDefaultReaderClosedCodeImplementationVisibility; - -// initializeReadableStreamDefaultReader -#define WEBCORE_BUILTIN_READABLESTREAMDEFAULTREADER_INITIALIZEREADABLESTREAMDEFAULTREADER 1 -extern const char* const s_readableStreamDefaultReaderInitializeReadableStreamDefaultReaderCode; -extern const int s_readableStreamDefaultReaderInitializeReadableStreamDefaultReaderCodeLength; -extern const JSC::ConstructAbility s_readableStreamDefaultReaderInitializeReadableStreamDefaultReaderCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamDefaultReaderInitializeReadableStreamDefaultReaderCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamDefaultReaderInitializeReadableStreamDefaultReaderCodeImplementationVisibility; - -// read -#define WEBCORE_BUILTIN_READABLESTREAMDEFAULTREADER_READ 1 -extern const char* const s_readableStreamDefaultReaderReadCode; -extern const int s_readableStreamDefaultReaderReadCodeLength; -extern const JSC::ConstructAbility s_readableStreamDefaultReaderReadCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamDefaultReaderReadCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamDefaultReaderReadCodeImplementationVisibility; - -// readMany -#define WEBCORE_BUILTIN_READABLESTREAMDEFAULTREADER_READMANY 1 -extern const char* const s_readableStreamDefaultReaderReadManyCode; -extern const int s_readableStreamDefaultReaderReadManyCodeLength; -extern const JSC::ConstructAbility s_readableStreamDefaultReaderReadManyCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamDefaultReaderReadManyCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamDefaultReaderReadManyCodeImplementationVisibility; - -// releaseLock -#define WEBCORE_BUILTIN_READABLESTREAMDEFAULTREADER_RELEASELOCK 1 -extern const char* const s_readableStreamDefaultReaderReleaseLockCode; -extern const int s_readableStreamDefaultReaderReleaseLockCodeLength; -extern const JSC::ConstructAbility s_readableStreamDefaultReaderReleaseLockCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamDefaultReaderReleaseLockCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamDefaultReaderReleaseLockCodeImplementationVisibility; - -#define WEBCORE_FOREACH_READABLESTREAMDEFAULTREADER_BUILTIN_DATA(macro) \ - macro(cancel, readableStreamDefaultReaderCancel, 1) \ - macro(closed, readableStreamDefaultReaderClosed, 0) \ - macro(initializeReadableStreamDefaultReader, readableStreamDefaultReaderInitializeReadableStreamDefaultReader, 1) \ - macro(read, readableStreamDefaultReaderRead, 0) \ - macro(readMany, readableStreamDefaultReaderReadMany, 0) \ - macro(releaseLock, readableStreamDefaultReaderReleaseLock, 0) \ - -#define WEBCORE_FOREACH_READABLESTREAMDEFAULTREADER_BUILTIN_CODE(macro) \ - macro(readableStreamDefaultReaderCancelCode, cancel, ASCIILiteral(), s_readableStreamDefaultReaderCancelCodeLength) \ - macro(readableStreamDefaultReaderClosedCode, closed, "get closed"_s, s_readableStreamDefaultReaderClosedCodeLength) \ - macro(readableStreamDefaultReaderInitializeReadableStreamDefaultReaderCode, initializeReadableStreamDefaultReader, ASCIILiteral(), s_readableStreamDefaultReaderInitializeReadableStreamDefaultReaderCodeLength) \ - macro(readableStreamDefaultReaderReadCode, read, ASCIILiteral(), s_readableStreamDefaultReaderReadCodeLength) \ - macro(readableStreamDefaultReaderReadManyCode, readMany, ASCIILiteral(), s_readableStreamDefaultReaderReadManyCodeLength) \ - macro(readableStreamDefaultReaderReleaseLockCode, releaseLock, ASCIILiteral(), s_readableStreamDefaultReaderReleaseLockCodeLength) \ - -#define WEBCORE_FOREACH_READABLESTREAMDEFAULTREADER_BUILTIN_FUNCTION_NAME(macro) \ - macro(cancel) \ - macro(closed) \ - macro(initializeReadableStreamDefaultReader) \ - macro(read) \ - macro(readMany) \ - macro(releaseLock) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_READABLESTREAMDEFAULTREADER_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class ReadableStreamDefaultReaderBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit ReadableStreamDefaultReaderBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_READABLESTREAMDEFAULTREADER_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { }, JSC::SourceTaintedOrigin::Untainted)) - WEBCORE_FOREACH_READABLESTREAMDEFAULTREADER_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_READABLESTREAMDEFAULTREADER_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_READABLESTREAMDEFAULTREADER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_READABLESTREAMDEFAULTREADER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak m_##name##Executable; - WEBCORE_FOREACH_READABLESTREAMDEFAULTREADER_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* ReadableStreamDefaultReaderBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_READABLESTREAMDEFAULTREADER_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void ReadableStreamDefaultReaderBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_READABLESTREAMDEFAULTREADER_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} -/* ReadableStreamInternals.ts */ -// acquireReadableStreamDefaultReader -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_ACQUIREREADABLESTREAMDEFAULTREADER 1 -extern const char* const s_readableStreamInternalsAcquireReadableStreamDefaultReaderCode; -extern const int s_readableStreamInternalsAcquireReadableStreamDefaultReaderCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsAcquireReadableStreamDefaultReaderCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsAcquireReadableStreamDefaultReaderCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsAcquireReadableStreamDefaultReaderCodeImplementationVisibility; - -// assignToStream -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_ASSIGNTOSTREAM 1 -extern const char* const s_readableStreamInternalsAssignToStreamCode; -extern const int s_readableStreamInternalsAssignToStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsAssignToStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsAssignToStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsAssignToStreamCodeImplementationVisibility; - -// createReadableStreamController -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_CREATEREADABLESTREAMCONTROLLER 1 -extern const char* const s_readableStreamInternalsCreateReadableStreamControllerCode; -extern const int s_readableStreamInternalsCreateReadableStreamControllerCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsCreateReadableStreamControllerCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsCreateReadableStreamControllerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsCreateReadableStreamControllerCodeImplementationVisibility; - -// createTextStream -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_CREATETEXTSTREAM 1 -extern const char* const s_readableStreamInternalsCreateTextStreamCode; -extern const int s_readableStreamInternalsCreateTextStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsCreateTextStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsCreateTextStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsCreateTextStreamCodeImplementationVisibility; - -// handleDirectStreamError -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_HANDLEDIRECTSTREAMERROR 1 -extern const char* const s_readableStreamInternalsHandleDirectStreamErrorCode; -extern const int s_readableStreamInternalsHandleDirectStreamErrorCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsHandleDirectStreamErrorCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsHandleDirectStreamErrorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsHandleDirectStreamErrorCodeImplementationVisibility; - -// handleDirectStreamErrorReject -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_HANDLEDIRECTSTREAMERRORREJECT 1 -extern const char* const s_readableStreamInternalsHandleDirectStreamErrorRejectCode; -extern const int s_readableStreamInternalsHandleDirectStreamErrorRejectCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsHandleDirectStreamErrorRejectCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsHandleDirectStreamErrorRejectCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsHandleDirectStreamErrorRejectCodeImplementationVisibility; - -// initializeArrayBufferStream -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_INITIALIZEARRAYBUFFERSTREAM 1 -extern const char* const s_readableStreamInternalsInitializeArrayBufferStreamCode; -extern const int s_readableStreamInternalsInitializeArrayBufferStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsInitializeArrayBufferStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsInitializeArrayBufferStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsInitializeArrayBufferStreamCodeImplementationVisibility; - -// initializeArrayStream -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_INITIALIZEARRAYSTREAM 1 -extern const char* const s_readableStreamInternalsInitializeArrayStreamCode; -extern const int s_readableStreamInternalsInitializeArrayStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsInitializeArrayStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsInitializeArrayStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsInitializeArrayStreamCodeImplementationVisibility; - -// initializeTextStream -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_INITIALIZETEXTSTREAM 1 -extern const char* const s_readableStreamInternalsInitializeTextStreamCode; -extern const int s_readableStreamInternalsInitializeTextStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsInitializeTextStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsInitializeTextStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsInitializeTextStreamCodeImplementationVisibility; - -// isReadableStream -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_ISREADABLESTREAM 1 -extern const char* const s_readableStreamInternalsIsReadableStreamCode; -extern const int s_readableStreamInternalsIsReadableStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsIsReadableStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsIsReadableStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsIsReadableStreamCodeImplementationVisibility; - -// isReadableStreamDefaultController -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_ISREADABLESTREAMDEFAULTCONTROLLER 1 -extern const char* const s_readableStreamInternalsIsReadableStreamDefaultControllerCode; -extern const int s_readableStreamInternalsIsReadableStreamDefaultControllerCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsIsReadableStreamDefaultControllerCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsIsReadableStreamDefaultControllerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsIsReadableStreamDefaultControllerCodeImplementationVisibility; - -// isReadableStreamDefaultReader -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_ISREADABLESTREAMDEFAULTREADER 1 -extern const char* const s_readableStreamInternalsIsReadableStreamDefaultReaderCode; -extern const int s_readableStreamInternalsIsReadableStreamDefaultReaderCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsIsReadableStreamDefaultReaderCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsIsReadableStreamDefaultReaderCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsIsReadableStreamDefaultReaderCodeImplementationVisibility; - -// isReadableStreamDisturbed -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_ISREADABLESTREAMDISTURBED 1 -extern const char* const s_readableStreamInternalsIsReadableStreamDisturbedCode; -extern const int s_readableStreamInternalsIsReadableStreamDisturbedCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsIsReadableStreamDisturbedCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsIsReadableStreamDisturbedCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsIsReadableStreamDisturbedCodeImplementationVisibility; - -// isReadableStreamLocked -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_ISREADABLESTREAMLOCKED 1 -extern const char* const s_readableStreamInternalsIsReadableStreamLockedCode; -extern const int s_readableStreamInternalsIsReadableStreamLockedCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsIsReadableStreamLockedCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsIsReadableStreamLockedCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsIsReadableStreamLockedCodeImplementationVisibility; - -// lazyLoadStream -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_LAZYLOADSTREAM 1 -extern const char* const s_readableStreamInternalsLazyLoadStreamCode; -extern const int s_readableStreamInternalsLazyLoadStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsLazyLoadStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsLazyLoadStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsLazyLoadStreamCodeImplementationVisibility; - -// noopDoneFunction -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_NOOPDONEFUNCTION 1 -extern const char* const s_readableStreamInternalsNoopDoneFunctionCode; -extern const int s_readableStreamInternalsNoopDoneFunctionCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsNoopDoneFunctionCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsNoopDoneFunctionCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsNoopDoneFunctionCodeImplementationVisibility; - -// onCloseDirectStream -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_ONCLOSEDIRECTSTREAM 1 -extern const char* const s_readableStreamInternalsOnCloseDirectStreamCode; -extern const int s_readableStreamInternalsOnCloseDirectStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsOnCloseDirectStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsOnCloseDirectStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsOnCloseDirectStreamCodeImplementationVisibility; - -// onFlushDirectStream -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_ONFLUSHDIRECTSTREAM 1 -extern const char* const s_readableStreamInternalsOnFlushDirectStreamCode; -extern const int s_readableStreamInternalsOnFlushDirectStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsOnFlushDirectStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsOnFlushDirectStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsOnFlushDirectStreamCodeImplementationVisibility; - -// onPullDirectStream -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_ONPULLDIRECTSTREAM 1 -extern const char* const s_readableStreamInternalsOnPullDirectStreamCode; -extern const int s_readableStreamInternalsOnPullDirectStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsOnPullDirectStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsOnPullDirectStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsOnPullDirectStreamCodeImplementationVisibility; - -// onReadableStreamDirectControllerClosed -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_ONREADABLESTREAMDIRECTCONTROLLERCLOSED 1 -extern const char* const s_readableStreamInternalsOnReadableStreamDirectControllerClosedCode; -extern const int s_readableStreamInternalsOnReadableStreamDirectControllerClosedCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsOnReadableStreamDirectControllerClosedCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsOnReadableStreamDirectControllerClosedCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsOnReadableStreamDirectControllerClosedCodeImplementationVisibility; - -// pipeToClosingMustBePropagatedBackward -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_PIPETOCLOSINGMUSTBEPROPAGATEDBACKWARD 1 -extern const char* const s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCode; -extern const int s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCodeImplementationVisibility; - -// pipeToClosingMustBePropagatedForward -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_PIPETOCLOSINGMUSTBEPROPAGATEDFORWARD 1 -extern const char* const s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCode; -extern const int s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeImplementationVisibility; - -// pipeToDoReadWrite -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_PIPETODOREADWRITE 1 -extern const char* const s_readableStreamInternalsPipeToDoReadWriteCode; -extern const int s_readableStreamInternalsPipeToDoReadWriteCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsPipeToDoReadWriteCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsPipeToDoReadWriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsPipeToDoReadWriteCodeImplementationVisibility; - -// pipeToErrorsMustBePropagatedBackward -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_PIPETOERRORSMUSTBEPROPAGATEDBACKWARD 1 -extern const char* const s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCode; -extern const int s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCodeImplementationVisibility; - -// pipeToErrorsMustBePropagatedForward -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_PIPETOERRORSMUSTBEPROPAGATEDFORWARD 1 -extern const char* const s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCode; -extern const int s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeImplementationVisibility; - -// pipeToFinalize -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_PIPETOFINALIZE 1 -extern const char* const s_readableStreamInternalsPipeToFinalizeCode; -extern const int s_readableStreamInternalsPipeToFinalizeCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsPipeToFinalizeCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsPipeToFinalizeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsPipeToFinalizeCodeImplementationVisibility; - -// pipeToLoop -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_PIPETOLOOP 1 -extern const char* const s_readableStreamInternalsPipeToLoopCode; -extern const int s_readableStreamInternalsPipeToLoopCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsPipeToLoopCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsPipeToLoopCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsPipeToLoopCodeImplementationVisibility; - -// pipeToShutdown -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_PIPETOSHUTDOWN 1 -extern const char* const s_readableStreamInternalsPipeToShutdownCode; -extern const int s_readableStreamInternalsPipeToShutdownCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsPipeToShutdownCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsPipeToShutdownCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsPipeToShutdownCodeImplementationVisibility; - -// pipeToShutdownWithAction -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_PIPETOSHUTDOWNWITHACTION 1 -extern const char* const s_readableStreamInternalsPipeToShutdownWithActionCode; -extern const int s_readableStreamInternalsPipeToShutdownWithActionCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsPipeToShutdownWithActionCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsPipeToShutdownWithActionCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsPipeToShutdownWithActionCodeImplementationVisibility; - -// privateInitializeReadableStreamDefaultController -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_PRIVATEINITIALIZEREADABLESTREAMDEFAULTCONTROLLER 1 -extern const char* const s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCode; -extern const int s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeImplementationVisibility; - -// readableStreamAddReadRequest -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMADDREADREQUEST 1 -extern const char* const s_readableStreamInternalsReadableStreamAddReadRequestCode; -extern const int s_readableStreamInternalsReadableStreamAddReadRequestCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamAddReadRequestCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamAddReadRequestCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamAddReadRequestCodeImplementationVisibility; - -// readableStreamCancel -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMCANCEL 1 -extern const char* const s_readableStreamInternalsReadableStreamCancelCode; -extern const int s_readableStreamInternalsReadableStreamCancelCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamCancelCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamCancelCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamCancelCodeImplementationVisibility; - -// readableStreamClose -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMCLOSE 1 -extern const char* const s_readableStreamInternalsReadableStreamCloseCode; -extern const int s_readableStreamInternalsReadableStreamCloseCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamCloseCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamCloseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamCloseCodeImplementationVisibility; - -// readableStreamDefaultControllerCallPullIfNeeded -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMDEFAULTCONTROLLERCALLPULLIFNEEDED 1 -extern const char* const s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCode; -extern const int s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCodeImplementationVisibility; - -// readableStreamDefaultControllerCancel -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMDEFAULTCONTROLLERCANCEL 1 -extern const char* const s_readableStreamInternalsReadableStreamDefaultControllerCancelCode; -extern const int s_readableStreamInternalsReadableStreamDefaultControllerCancelCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerCancelCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerCancelCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerCancelCodeImplementationVisibility; - -// readableStreamDefaultControllerCanCloseOrEnqueue -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMDEFAULTCONTROLLERCANCLOSEORENQUEUE 1 -extern const char* const s_readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueueCode; -extern const int s_readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueueCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueueCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueueCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueueCodeImplementationVisibility; - -// readableStreamDefaultControllerClose -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMDEFAULTCONTROLLERCLOSE 1 -extern const char* const s_readableStreamInternalsReadableStreamDefaultControllerCloseCode; -extern const int s_readableStreamInternalsReadableStreamDefaultControllerCloseCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerCloseCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerCloseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerCloseCodeImplementationVisibility; - -// readableStreamDefaultControllerEnqueue -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMDEFAULTCONTROLLERENQUEUE 1 -extern const char* const s_readableStreamInternalsReadableStreamDefaultControllerEnqueueCode; -extern const int s_readableStreamInternalsReadableStreamDefaultControllerEnqueueCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerEnqueueCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerEnqueueCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerEnqueueCodeImplementationVisibility; - -// readableStreamDefaultControllerError -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMDEFAULTCONTROLLERERROR 1 -extern const char* const s_readableStreamInternalsReadableStreamDefaultControllerErrorCode; -extern const int s_readableStreamInternalsReadableStreamDefaultControllerErrorCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerErrorCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerErrorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerErrorCodeImplementationVisibility; - -// readableStreamDefaultControllerGetDesiredSize -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMDEFAULTCONTROLLERGETDESIREDSIZE 1 -extern const char* const s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCode; -extern const int s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCodeImplementationVisibility; - -// readableStreamDefaultControllerPull -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMDEFAULTCONTROLLERPULL 1 -extern const char* const s_readableStreamInternalsReadableStreamDefaultControllerPullCode; -extern const int s_readableStreamInternalsReadableStreamDefaultControllerPullCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerPullCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerPullCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerPullCodeImplementationVisibility; - -// readableStreamDefaultControllerShouldCallPull -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMDEFAULTCONTROLLERSHOULDCALLPULL 1 -extern const char* const s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCode; -extern const int s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCodeImplementationVisibility; - -// readableStreamDefaultControllerStart -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMDEFAULTCONTROLLERSTART 1 -extern const char* const s_readableStreamInternalsReadableStreamDefaultControllerStartCode; -extern const int s_readableStreamInternalsReadableStreamDefaultControllerStartCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerStartCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerStartCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerStartCodeImplementationVisibility; - -// readableStreamDefaultReaderRead -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMDEFAULTREADERREAD 1 -extern const char* const s_readableStreamInternalsReadableStreamDefaultReaderReadCode; -extern const int s_readableStreamInternalsReadableStreamDefaultReaderReadCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultReaderReadCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultReaderReadCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultReaderReadCodeImplementationVisibility; - -// readableStreamDefineLazyIterators -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMDEFINELAZYITERATORS 1 -extern const char* const s_readableStreamInternalsReadableStreamDefineLazyIteratorsCode; -extern const int s_readableStreamInternalsReadableStreamDefineLazyIteratorsCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefineLazyIteratorsCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefineLazyIteratorsCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefineLazyIteratorsCodeImplementationVisibility; - -// readableStreamError -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMERROR 1 -extern const char* const s_readableStreamInternalsReadableStreamErrorCode; -extern const int s_readableStreamInternalsReadableStreamErrorCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamErrorCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamErrorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamErrorCodeImplementationVisibility; - -// readableStreamFulfillReadRequest -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMFULFILLREADREQUEST 1 -extern const char* const s_readableStreamInternalsReadableStreamFulfillReadRequestCode; -extern const int s_readableStreamInternalsReadableStreamFulfillReadRequestCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamFulfillReadRequestCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamFulfillReadRequestCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamFulfillReadRequestCodeImplementationVisibility; - -// readableStreamIntoArray -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMINTOARRAY 1 -extern const char* const s_readableStreamInternalsReadableStreamIntoArrayCode; -extern const int s_readableStreamInternalsReadableStreamIntoArrayCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamIntoArrayCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamIntoArrayCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamIntoArrayCodeImplementationVisibility; - -// readableStreamIntoText -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMINTOTEXT 1 -extern const char* const s_readableStreamInternalsReadableStreamIntoTextCode; -extern const int s_readableStreamInternalsReadableStreamIntoTextCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamIntoTextCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamIntoTextCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamIntoTextCodeImplementationVisibility; - -// readableStreamPipeTo -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMPIPETO 1 -extern const char* const s_readableStreamInternalsReadableStreamPipeToCode; -extern const int s_readableStreamInternalsReadableStreamPipeToCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamPipeToCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamPipeToCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamPipeToCodeImplementationVisibility; - -// readableStreamPipeToWritableStream -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMPIPETOWRITABLESTREAM 1 -extern const char* const s_readableStreamInternalsReadableStreamPipeToWritableStreamCode; -extern const int s_readableStreamInternalsReadableStreamPipeToWritableStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamPipeToWritableStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamPipeToWritableStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamPipeToWritableStreamCodeImplementationVisibility; - -// readableStreamReaderGenericCancel -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMREADERGENERICCANCEL 1 -extern const char* const s_readableStreamInternalsReadableStreamReaderGenericCancelCode; -extern const int s_readableStreamInternalsReadableStreamReaderGenericCancelCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamReaderGenericCancelCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamReaderGenericCancelCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamReaderGenericCancelCodeImplementationVisibility; - -// readableStreamReaderGenericInitialize -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMREADERGENERICINITIALIZE 1 -extern const char* const s_readableStreamInternalsReadableStreamReaderGenericInitializeCode; -extern const int s_readableStreamInternalsReadableStreamReaderGenericInitializeCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamReaderGenericInitializeCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamReaderGenericInitializeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamReaderGenericInitializeCodeImplementationVisibility; - -// readableStreamReaderGenericRelease -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMREADERGENERICRELEASE 1 -extern const char* const s_readableStreamInternalsReadableStreamReaderGenericReleaseCode; -extern const int s_readableStreamInternalsReadableStreamReaderGenericReleaseCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamReaderGenericReleaseCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamReaderGenericReleaseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamReaderGenericReleaseCodeImplementationVisibility; - -// readableStreamTee -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMTEE 1 -extern const char* const s_readableStreamInternalsReadableStreamTeeCode; -extern const int s_readableStreamInternalsReadableStreamTeeCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamTeeCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamTeeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamTeeCodeImplementationVisibility; - -// readableStreamTeeBranch1CancelFunction -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMTEEBRANCH1CANCELFUNCTION 1 -extern const char* const s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCode; -extern const int s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCodeImplementationVisibility; - -// readableStreamTeeBranch2CancelFunction -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMTEEBRANCH2CANCELFUNCTION 1 -extern const char* const s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCode; -extern const int s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCodeImplementationVisibility; - -// readableStreamTeePullFunction -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMTEEPULLFUNCTION 1 -extern const char* const s_readableStreamInternalsReadableStreamTeePullFunctionCode; -extern const int s_readableStreamInternalsReadableStreamTeePullFunctionCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamTeePullFunctionCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamTeePullFunctionCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamTeePullFunctionCodeImplementationVisibility; - -// readableStreamToArrayBufferDirect -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMTOARRAYBUFFERDIRECT 1 -extern const char* const s_readableStreamInternalsReadableStreamToArrayBufferDirectCode; -extern const int s_readableStreamInternalsReadableStreamToArrayBufferDirectCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamToArrayBufferDirectCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamToArrayBufferDirectCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamToArrayBufferDirectCodeImplementationVisibility; - -// readableStreamToArrayDirect -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMTOARRAYDIRECT 1 -extern const char* const s_readableStreamInternalsReadableStreamToArrayDirectCode; -extern const int s_readableStreamInternalsReadableStreamToArrayDirectCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamToArrayDirectCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamToArrayDirectCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamToArrayDirectCodeImplementationVisibility; - -// readableStreamToTextDirect -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMTOTEXTDIRECT 1 -extern const char* const s_readableStreamInternalsReadableStreamToTextDirectCode; -extern const int s_readableStreamInternalsReadableStreamToTextDirectCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamToTextDirectCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamToTextDirectCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamToTextDirectCodeImplementationVisibility; - -// readDirectStream -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READDIRECTSTREAM 1 -extern const char* const s_readableStreamInternalsReadDirectStreamCode; -extern const int s_readableStreamInternalsReadDirectStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadDirectStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadDirectStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadDirectStreamCodeImplementationVisibility; - -// readStreamIntoSink -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READSTREAMINTOSINK 1 -extern const char* const s_readableStreamInternalsReadStreamIntoSinkCode; -extern const int s_readableStreamInternalsReadStreamIntoSinkCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadStreamIntoSinkCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadStreamIntoSinkCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadStreamIntoSinkCodeImplementationVisibility; - -// setupReadableStreamDefaultController -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_SETUPREADABLESTREAMDEFAULTCONTROLLER 1 -extern const char* const s_readableStreamInternalsSetupReadableStreamDefaultControllerCode; -extern const int s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeImplementationVisibility; - -#define WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_DATA(macro) \ - macro(acquireReadableStreamDefaultReader, readableStreamInternalsAcquireReadableStreamDefaultReader, 1) \ - macro(assignToStream, readableStreamInternalsAssignToStream, 2) \ - macro(createReadableStreamController, readableStreamInternalsCreateReadableStreamController, 3) \ - macro(createTextStream, readableStreamInternalsCreateTextStream, 1) \ - macro(handleDirectStreamError, readableStreamInternalsHandleDirectStreamError, 1) \ - macro(handleDirectStreamErrorReject, readableStreamInternalsHandleDirectStreamErrorReject, 1) \ - macro(initializeArrayBufferStream, readableStreamInternalsInitializeArrayBufferStream, 2) \ - macro(initializeArrayStream, readableStreamInternalsInitializeArrayStream, 2) \ - macro(initializeTextStream, readableStreamInternalsInitializeTextStream, 2) \ - macro(isReadableStream, readableStreamInternalsIsReadableStream, 1) \ - macro(isReadableStreamDefaultController, readableStreamInternalsIsReadableStreamDefaultController, 1) \ - macro(isReadableStreamDefaultReader, readableStreamInternalsIsReadableStreamDefaultReader, 1) \ - macro(isReadableStreamDisturbed, readableStreamInternalsIsReadableStreamDisturbed, 1) \ - macro(isReadableStreamLocked, readableStreamInternalsIsReadableStreamLocked, 1) \ - macro(lazyLoadStream, readableStreamInternalsLazyLoadStream, 2) \ - macro(noopDoneFunction, readableStreamInternalsNoopDoneFunction, 0) \ - macro(onCloseDirectStream, readableStreamInternalsOnCloseDirectStream, 1) \ - macro(onFlushDirectStream, readableStreamInternalsOnFlushDirectStream, 0) \ - macro(onPullDirectStream, readableStreamInternalsOnPullDirectStream, 1) \ - macro(onReadableStreamDirectControllerClosed, readableStreamInternalsOnReadableStreamDirectControllerClosed, 1) \ - macro(pipeToClosingMustBePropagatedBackward, readableStreamInternalsPipeToClosingMustBePropagatedBackward, 1) \ - macro(pipeToClosingMustBePropagatedForward, readableStreamInternalsPipeToClosingMustBePropagatedForward, 1) \ - macro(pipeToDoReadWrite, readableStreamInternalsPipeToDoReadWrite, 1) \ - macro(pipeToErrorsMustBePropagatedBackward, readableStreamInternalsPipeToErrorsMustBePropagatedBackward, 1) \ - macro(pipeToErrorsMustBePropagatedForward, readableStreamInternalsPipeToErrorsMustBePropagatedForward, 1) \ - macro(pipeToFinalize, readableStreamInternalsPipeToFinalize, 1) \ - macro(pipeToLoop, readableStreamInternalsPipeToLoop, 1) \ - macro(pipeToShutdown, readableStreamInternalsPipeToShutdown, 1) \ - macro(pipeToShutdownWithAction, readableStreamInternalsPipeToShutdownWithAction, 2) \ - macro(privateInitializeReadableStreamDefaultController, readableStreamInternalsPrivateInitializeReadableStreamDefaultController, 4) \ - macro(readableStreamAddReadRequest, readableStreamInternalsReadableStreamAddReadRequest, 1) \ - macro(readableStreamCancel, readableStreamInternalsReadableStreamCancel, 2) \ - macro(readableStreamClose, readableStreamInternalsReadableStreamClose, 1) \ - macro(readableStreamDefaultControllerCallPullIfNeeded, readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeeded, 1) \ - macro(readableStreamDefaultControllerCancel, readableStreamInternalsReadableStreamDefaultControllerCancel, 2) \ - macro(readableStreamDefaultControllerCanCloseOrEnqueue, readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueue, 1) \ - macro(readableStreamDefaultControllerClose, readableStreamInternalsReadableStreamDefaultControllerClose, 1) \ - macro(readableStreamDefaultControllerEnqueue, readableStreamInternalsReadableStreamDefaultControllerEnqueue, 2) \ - macro(readableStreamDefaultControllerError, readableStreamInternalsReadableStreamDefaultControllerError, 2) \ - macro(readableStreamDefaultControllerGetDesiredSize, readableStreamInternalsReadableStreamDefaultControllerGetDesiredSize, 1) \ - macro(readableStreamDefaultControllerPull, readableStreamInternalsReadableStreamDefaultControllerPull, 1) \ - macro(readableStreamDefaultControllerShouldCallPull, readableStreamInternalsReadableStreamDefaultControllerShouldCallPull, 1) \ - macro(readableStreamDefaultControllerStart, readableStreamInternalsReadableStreamDefaultControllerStart, 1) \ - macro(readableStreamDefaultReaderRead, readableStreamInternalsReadableStreamDefaultReaderRead, 1) \ - macro(readableStreamDefineLazyIterators, readableStreamInternalsReadableStreamDefineLazyIterators, 1) \ - macro(readableStreamError, readableStreamInternalsReadableStreamError, 2) \ - macro(readableStreamFulfillReadRequest, readableStreamInternalsReadableStreamFulfillReadRequest, 3) \ - macro(readableStreamIntoArray, readableStreamInternalsReadableStreamIntoArray, 1) \ - macro(readableStreamIntoText, readableStreamInternalsReadableStreamIntoText, 1) \ - macro(readableStreamPipeTo, readableStreamInternalsReadableStreamPipeTo, 2) \ - macro(readableStreamPipeToWritableStream, readableStreamInternalsReadableStreamPipeToWritableStream, 7) \ - macro(readableStreamReaderGenericCancel, readableStreamInternalsReadableStreamReaderGenericCancel, 2) \ - macro(readableStreamReaderGenericInitialize, readableStreamInternalsReadableStreamReaderGenericInitialize, 2) \ - macro(readableStreamReaderGenericRelease, readableStreamInternalsReadableStreamReaderGenericRelease, 1) \ - macro(readableStreamTee, readableStreamInternalsReadableStreamTee, 2) \ - macro(readableStreamTeeBranch1CancelFunction, readableStreamInternalsReadableStreamTeeBranch1CancelFunction, 2) \ - macro(readableStreamTeeBranch2CancelFunction, readableStreamInternalsReadableStreamTeeBranch2CancelFunction, 2) \ - macro(readableStreamTeePullFunction, readableStreamInternalsReadableStreamTeePullFunction, 3) \ - macro(readableStreamToArrayBufferDirect, readableStreamInternalsReadableStreamToArrayBufferDirect, 2) \ - macro(readableStreamToArrayDirect, readableStreamInternalsReadableStreamToArrayDirect, 2) \ - macro(readableStreamToTextDirect, readableStreamInternalsReadableStreamToTextDirect, 2) \ - macro(readDirectStream, readableStreamInternalsReadDirectStream, 3) \ - macro(readStreamIntoSink, readableStreamInternalsReadStreamIntoSink, 3) \ - macro(setupReadableStreamDefaultController, readableStreamInternalsSetupReadableStreamDefaultController, 8) \ - -#define WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_CODE(macro) \ - macro(readableStreamInternalsAcquireReadableStreamDefaultReaderCode, acquireReadableStreamDefaultReader, ASCIILiteral(), s_readableStreamInternalsAcquireReadableStreamDefaultReaderCodeLength) \ - macro(readableStreamInternalsAssignToStreamCode, assignToStream, ASCIILiteral(), s_readableStreamInternalsAssignToStreamCodeLength) \ - macro(readableStreamInternalsCreateReadableStreamControllerCode, createReadableStreamController, ASCIILiteral(), s_readableStreamInternalsCreateReadableStreamControllerCodeLength) \ - macro(readableStreamInternalsCreateTextStreamCode, createTextStream, ASCIILiteral(), s_readableStreamInternalsCreateTextStreamCodeLength) \ - macro(readableStreamInternalsHandleDirectStreamErrorCode, handleDirectStreamError, ASCIILiteral(), s_readableStreamInternalsHandleDirectStreamErrorCodeLength) \ - macro(readableStreamInternalsHandleDirectStreamErrorRejectCode, handleDirectStreamErrorReject, ASCIILiteral(), s_readableStreamInternalsHandleDirectStreamErrorRejectCodeLength) \ - macro(readableStreamInternalsInitializeArrayBufferStreamCode, initializeArrayBufferStream, ASCIILiteral(), s_readableStreamInternalsInitializeArrayBufferStreamCodeLength) \ - macro(readableStreamInternalsInitializeArrayStreamCode, initializeArrayStream, ASCIILiteral(), s_readableStreamInternalsInitializeArrayStreamCodeLength) \ - macro(readableStreamInternalsInitializeTextStreamCode, initializeTextStream, ASCIILiteral(), s_readableStreamInternalsInitializeTextStreamCodeLength) \ - macro(readableStreamInternalsIsReadableStreamCode, isReadableStream, ASCIILiteral(), s_readableStreamInternalsIsReadableStreamCodeLength) \ - macro(readableStreamInternalsIsReadableStreamDefaultControllerCode, isReadableStreamDefaultController, ASCIILiteral(), s_readableStreamInternalsIsReadableStreamDefaultControllerCodeLength) \ - macro(readableStreamInternalsIsReadableStreamDefaultReaderCode, isReadableStreamDefaultReader, ASCIILiteral(), s_readableStreamInternalsIsReadableStreamDefaultReaderCodeLength) \ - macro(readableStreamInternalsIsReadableStreamDisturbedCode, isReadableStreamDisturbed, ASCIILiteral(), s_readableStreamInternalsIsReadableStreamDisturbedCodeLength) \ - macro(readableStreamInternalsIsReadableStreamLockedCode, isReadableStreamLocked, ASCIILiteral(), s_readableStreamInternalsIsReadableStreamLockedCodeLength) \ - macro(readableStreamInternalsLazyLoadStreamCode, lazyLoadStream, ASCIILiteral(), s_readableStreamInternalsLazyLoadStreamCodeLength) \ - macro(readableStreamInternalsNoopDoneFunctionCode, noopDoneFunction, ASCIILiteral(), s_readableStreamInternalsNoopDoneFunctionCodeLength) \ - macro(readableStreamInternalsOnCloseDirectStreamCode, onCloseDirectStream, ASCIILiteral(), s_readableStreamInternalsOnCloseDirectStreamCodeLength) \ - macro(readableStreamInternalsOnFlushDirectStreamCode, onFlushDirectStream, ASCIILiteral(), s_readableStreamInternalsOnFlushDirectStreamCodeLength) \ - macro(readableStreamInternalsOnPullDirectStreamCode, onPullDirectStream, ASCIILiteral(), s_readableStreamInternalsOnPullDirectStreamCodeLength) \ - macro(readableStreamInternalsOnReadableStreamDirectControllerClosedCode, onReadableStreamDirectControllerClosed, ASCIILiteral(), s_readableStreamInternalsOnReadableStreamDirectControllerClosedCodeLength) \ - macro(readableStreamInternalsPipeToClosingMustBePropagatedBackwardCode, pipeToClosingMustBePropagatedBackward, ASCIILiteral(), s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCodeLength) \ - macro(readableStreamInternalsPipeToClosingMustBePropagatedForwardCode, pipeToClosingMustBePropagatedForward, ASCIILiteral(), s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeLength) \ - macro(readableStreamInternalsPipeToDoReadWriteCode, pipeToDoReadWrite, ASCIILiteral(), s_readableStreamInternalsPipeToDoReadWriteCodeLength) \ - macro(readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCode, pipeToErrorsMustBePropagatedBackward, ASCIILiteral(), s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCodeLength) \ - macro(readableStreamInternalsPipeToErrorsMustBePropagatedForwardCode, pipeToErrorsMustBePropagatedForward, ASCIILiteral(), s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeLength) \ - macro(readableStreamInternalsPipeToFinalizeCode, pipeToFinalize, ASCIILiteral(), s_readableStreamInternalsPipeToFinalizeCodeLength) \ - macro(readableStreamInternalsPipeToLoopCode, pipeToLoop, ASCIILiteral(), s_readableStreamInternalsPipeToLoopCodeLength) \ - macro(readableStreamInternalsPipeToShutdownCode, pipeToShutdown, ASCIILiteral(), s_readableStreamInternalsPipeToShutdownCodeLength) \ - macro(readableStreamInternalsPipeToShutdownWithActionCode, pipeToShutdownWithAction, ASCIILiteral(), s_readableStreamInternalsPipeToShutdownWithActionCodeLength) \ - macro(readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCode, privateInitializeReadableStreamDefaultController, ASCIILiteral(), s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeLength) \ - macro(readableStreamInternalsReadableStreamAddReadRequestCode, readableStreamAddReadRequest, ASCIILiteral(), s_readableStreamInternalsReadableStreamAddReadRequestCodeLength) \ - macro(readableStreamInternalsReadableStreamCancelCode, readableStreamCancel, ASCIILiteral(), s_readableStreamInternalsReadableStreamCancelCodeLength) \ - macro(readableStreamInternalsReadableStreamCloseCode, readableStreamClose, ASCIILiteral(), s_readableStreamInternalsReadableStreamCloseCodeLength) \ - macro(readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCode, readableStreamDefaultControllerCallPullIfNeeded, ASCIILiteral(), s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCodeLength) \ - macro(readableStreamInternalsReadableStreamDefaultControllerCancelCode, readableStreamDefaultControllerCancel, ASCIILiteral(), s_readableStreamInternalsReadableStreamDefaultControllerCancelCodeLength) \ - macro(readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueueCode, readableStreamDefaultControllerCanCloseOrEnqueue, ASCIILiteral(), s_readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueueCodeLength) \ - macro(readableStreamInternalsReadableStreamDefaultControllerCloseCode, readableStreamDefaultControllerClose, ASCIILiteral(), s_readableStreamInternalsReadableStreamDefaultControllerCloseCodeLength) \ - macro(readableStreamInternalsReadableStreamDefaultControllerEnqueueCode, readableStreamDefaultControllerEnqueue, ASCIILiteral(), s_readableStreamInternalsReadableStreamDefaultControllerEnqueueCodeLength) \ - macro(readableStreamInternalsReadableStreamDefaultControllerErrorCode, readableStreamDefaultControllerError, ASCIILiteral(), s_readableStreamInternalsReadableStreamDefaultControllerErrorCodeLength) \ - macro(readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCode, readableStreamDefaultControllerGetDesiredSize, ASCIILiteral(), s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCodeLength) \ - macro(readableStreamInternalsReadableStreamDefaultControllerPullCode, readableStreamDefaultControllerPull, ASCIILiteral(), s_readableStreamInternalsReadableStreamDefaultControllerPullCodeLength) \ - macro(readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCode, readableStreamDefaultControllerShouldCallPull, ASCIILiteral(), s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCodeLength) \ - macro(readableStreamInternalsReadableStreamDefaultControllerStartCode, readableStreamDefaultControllerStart, ASCIILiteral(), s_readableStreamInternalsReadableStreamDefaultControllerStartCodeLength) \ - macro(readableStreamInternalsReadableStreamDefaultReaderReadCode, readableStreamDefaultReaderRead, ASCIILiteral(), s_readableStreamInternalsReadableStreamDefaultReaderReadCodeLength) \ - macro(readableStreamInternalsReadableStreamDefineLazyIteratorsCode, readableStreamDefineLazyIterators, ASCIILiteral(), s_readableStreamInternalsReadableStreamDefineLazyIteratorsCodeLength) \ - macro(readableStreamInternalsReadableStreamErrorCode, readableStreamError, ASCIILiteral(), s_readableStreamInternalsReadableStreamErrorCodeLength) \ - macro(readableStreamInternalsReadableStreamFulfillReadRequestCode, readableStreamFulfillReadRequest, ASCIILiteral(), s_readableStreamInternalsReadableStreamFulfillReadRequestCodeLength) \ - macro(readableStreamInternalsReadableStreamIntoArrayCode, readableStreamIntoArray, ASCIILiteral(), s_readableStreamInternalsReadableStreamIntoArrayCodeLength) \ - macro(readableStreamInternalsReadableStreamIntoTextCode, readableStreamIntoText, ASCIILiteral(), s_readableStreamInternalsReadableStreamIntoTextCodeLength) \ - macro(readableStreamInternalsReadableStreamPipeToCode, readableStreamPipeTo, ASCIILiteral(), s_readableStreamInternalsReadableStreamPipeToCodeLength) \ - macro(readableStreamInternalsReadableStreamPipeToWritableStreamCode, readableStreamPipeToWritableStream, ASCIILiteral(), s_readableStreamInternalsReadableStreamPipeToWritableStreamCodeLength) \ - macro(readableStreamInternalsReadableStreamReaderGenericCancelCode, readableStreamReaderGenericCancel, ASCIILiteral(), s_readableStreamInternalsReadableStreamReaderGenericCancelCodeLength) \ - macro(readableStreamInternalsReadableStreamReaderGenericInitializeCode, readableStreamReaderGenericInitialize, ASCIILiteral(), s_readableStreamInternalsReadableStreamReaderGenericInitializeCodeLength) \ - macro(readableStreamInternalsReadableStreamReaderGenericReleaseCode, readableStreamReaderGenericRelease, ASCIILiteral(), s_readableStreamInternalsReadableStreamReaderGenericReleaseCodeLength) \ - macro(readableStreamInternalsReadableStreamTeeCode, readableStreamTee, ASCIILiteral(), s_readableStreamInternalsReadableStreamTeeCodeLength) \ - macro(readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCode, readableStreamTeeBranch1CancelFunction, ASCIILiteral(), s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCodeLength) \ - macro(readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCode, readableStreamTeeBranch2CancelFunction, ASCIILiteral(), s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCodeLength) \ - macro(readableStreamInternalsReadableStreamTeePullFunctionCode, readableStreamTeePullFunction, ASCIILiteral(), s_readableStreamInternalsReadableStreamTeePullFunctionCodeLength) \ - macro(readableStreamInternalsReadableStreamToArrayBufferDirectCode, readableStreamToArrayBufferDirect, ASCIILiteral(), s_readableStreamInternalsReadableStreamToArrayBufferDirectCodeLength) \ - macro(readableStreamInternalsReadableStreamToArrayDirectCode, readableStreamToArrayDirect, ASCIILiteral(), s_readableStreamInternalsReadableStreamToArrayDirectCodeLength) \ - macro(readableStreamInternalsReadableStreamToTextDirectCode, readableStreamToTextDirect, ASCIILiteral(), s_readableStreamInternalsReadableStreamToTextDirectCodeLength) \ - macro(readableStreamInternalsReadDirectStreamCode, readDirectStream, ASCIILiteral(), s_readableStreamInternalsReadDirectStreamCodeLength) \ - macro(readableStreamInternalsReadStreamIntoSinkCode, readStreamIntoSink, ASCIILiteral(), s_readableStreamInternalsReadStreamIntoSinkCodeLength) \ - macro(readableStreamInternalsSetupReadableStreamDefaultControllerCode, setupReadableStreamDefaultController, ASCIILiteral(), s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeLength) \ - -#define WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(macro) \ - macro(acquireReadableStreamDefaultReader) \ - macro(assignToStream) \ - macro(createReadableStreamController) \ - macro(createTextStream) \ - macro(handleDirectStreamError) \ - macro(handleDirectStreamErrorReject) \ - macro(initializeArrayBufferStream) \ - macro(initializeArrayStream) \ - macro(initializeTextStream) \ - macro(isReadableStream) \ - macro(isReadableStreamDefaultController) \ - macro(isReadableStreamDefaultReader) \ - macro(isReadableStreamDisturbed) \ - macro(isReadableStreamLocked) \ - macro(lazyLoadStream) \ - macro(noopDoneFunction) \ - macro(onCloseDirectStream) \ - macro(onFlushDirectStream) \ - macro(onPullDirectStream) \ - macro(onReadableStreamDirectControllerClosed) \ - macro(pipeToClosingMustBePropagatedBackward) \ - macro(pipeToClosingMustBePropagatedForward) \ - macro(pipeToDoReadWrite) \ - macro(pipeToErrorsMustBePropagatedBackward) \ - macro(pipeToErrorsMustBePropagatedForward) \ - macro(pipeToFinalize) \ - macro(pipeToLoop) \ - macro(pipeToShutdown) \ - macro(pipeToShutdownWithAction) \ - macro(privateInitializeReadableStreamDefaultController) \ - macro(readableStreamAddReadRequest) \ - macro(readableStreamCancel) \ - macro(readableStreamClose) \ - macro(readableStreamDefaultControllerCallPullIfNeeded) \ - macro(readableStreamDefaultControllerCancel) \ - macro(readableStreamDefaultControllerCanCloseOrEnqueue) \ - macro(readableStreamDefaultControllerClose) \ - macro(readableStreamDefaultControllerEnqueue) \ - macro(readableStreamDefaultControllerError) \ - macro(readableStreamDefaultControllerGetDesiredSize) \ - macro(readableStreamDefaultControllerPull) \ - macro(readableStreamDefaultControllerShouldCallPull) \ - macro(readableStreamDefaultControllerStart) \ - macro(readableStreamDefaultReaderRead) \ - macro(readableStreamDefineLazyIterators) \ - macro(readableStreamError) \ - macro(readableStreamFulfillReadRequest) \ - macro(readableStreamIntoArray) \ - macro(readableStreamIntoText) \ - macro(readableStreamPipeTo) \ - macro(readableStreamPipeToWritableStream) \ - macro(readableStreamReaderGenericCancel) \ - macro(readableStreamReaderGenericInitialize) \ - macro(readableStreamReaderGenericRelease) \ - macro(readableStreamTee) \ - macro(readableStreamTeeBranch1CancelFunction) \ - macro(readableStreamTeeBranch2CancelFunction) \ - macro(readableStreamTeePullFunction) \ - macro(readableStreamToArrayBufferDirect) \ - macro(readableStreamToArrayDirect) \ - macro(readableStreamToTextDirect) \ - macro(readDirectStream) \ - macro(readStreamIntoSink) \ - macro(setupReadableStreamDefaultController) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class ReadableStreamInternalsBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit ReadableStreamInternalsBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { }, JSC::SourceTaintedOrigin::Untainted)) - WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak m_##name##Executable; - WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* ReadableStreamInternalsBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void ReadableStreamInternalsBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} -class ReadableStreamInternalsBuiltinFunctions { -public: - explicit ReadableStreamInternalsBuiltinFunctions(JSC::VM& vm) : m_vm(vm) { } - - void init(JSC::JSGlobalObject&); - template void visit(Visitor&); - -public: - JSC::VM& m_vm; - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \ - JSC::WriteBarrier m_##functionName##Function; - WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS -}; - -inline void ReadableStreamInternalsBuiltinFunctions::init(JSC::JSGlobalObject& globalObject) -{ -#define EXPORT_FUNCTION(codeName, functionName, overriddenName, length) \ - m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::create(m_vm, codeName##Generator(m_vm), &globalObject)); - WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_CODE(EXPORT_FUNCTION) -#undef EXPORT_FUNCTION -} - -template -inline void ReadableStreamInternalsBuiltinFunctions::visit(Visitor& visitor) -{ -#define VISIT_FUNCTION(name) visitor.append(m_##name##Function); - WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION) -#undef VISIT_FUNCTION -} - -template void ReadableStreamInternalsBuiltinFunctions::visit(JSC::AbstractSlotVisitor&); -template void ReadableStreamInternalsBuiltinFunctions::visit(JSC::SlotVisitor&); - /* StreamInternals.ts */ -// createFIFO -#define WEBCORE_BUILTIN_STREAMINTERNALS_CREATEFIFO 1 -extern const char* const s_streamInternalsCreateFIFOCode; -extern const int s_streamInternalsCreateFIFOCodeLength; -extern const JSC::ConstructAbility s_streamInternalsCreateFIFOCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsCreateFIFOCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsCreateFIFOCodeImplementationVisibility; - -// createFulfilledPromise -#define WEBCORE_BUILTIN_STREAMINTERNALS_CREATEFULFILLEDPROMISE 1 -extern const char* const s_streamInternalsCreateFulfilledPromiseCode; -extern const int s_streamInternalsCreateFulfilledPromiseCodeLength; -extern const JSC::ConstructAbility s_streamInternalsCreateFulfilledPromiseCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsCreateFulfilledPromiseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsCreateFulfilledPromiseCodeImplementationVisibility; - -// dequeueValue -#define WEBCORE_BUILTIN_STREAMINTERNALS_DEQUEUEVALUE 1 -extern const char* const s_streamInternalsDequeueValueCode; -extern const int s_streamInternalsDequeueValueCodeLength; -extern const JSC::ConstructAbility s_streamInternalsDequeueValueCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsDequeueValueCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsDequeueValueCodeImplementationVisibility; - -// enqueueValueWithSize -#define WEBCORE_BUILTIN_STREAMINTERNALS_ENQUEUEVALUEWITHSIZE 1 -extern const char* const s_streamInternalsEnqueueValueWithSizeCode; -extern const int s_streamInternalsEnqueueValueWithSizeCodeLength; -extern const JSC::ConstructAbility s_streamInternalsEnqueueValueWithSizeCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsEnqueueValueWithSizeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsEnqueueValueWithSizeCodeImplementationVisibility; - -// extractHighWaterMark -#define WEBCORE_BUILTIN_STREAMINTERNALS_EXTRACTHIGHWATERMARK 1 -extern const char* const s_streamInternalsExtractHighWaterMarkCode; -extern const int s_streamInternalsExtractHighWaterMarkCodeLength; -extern const JSC::ConstructAbility s_streamInternalsExtractHighWaterMarkCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsExtractHighWaterMarkCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsExtractHighWaterMarkCodeImplementationVisibility; - -// extractHighWaterMarkFromQueuingStrategyInit -#define WEBCORE_BUILTIN_STREAMINTERNALS_EXTRACTHIGHWATERMARKFROMQUEUINGSTRATEGYINIT 1 -extern const char* const s_streamInternalsExtractHighWaterMarkFromQueuingStrategyInitCode; -extern const int s_streamInternalsExtractHighWaterMarkFromQueuingStrategyInitCodeLength; -extern const JSC::ConstructAbility s_streamInternalsExtractHighWaterMarkFromQueuingStrategyInitCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsExtractHighWaterMarkFromQueuingStrategyInitCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsExtractHighWaterMarkFromQueuingStrategyInitCodeImplementationVisibility; - -// extractSizeAlgorithm -#define WEBCORE_BUILTIN_STREAMINTERNALS_EXTRACTSIZEALGORITHM 1 -extern const char* const s_streamInternalsExtractSizeAlgorithmCode; -extern const int s_streamInternalsExtractSizeAlgorithmCodeLength; -extern const JSC::ConstructAbility s_streamInternalsExtractSizeAlgorithmCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsExtractSizeAlgorithmCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsExtractSizeAlgorithmCodeImplementationVisibility; - -// markPromiseAsHandled -#define WEBCORE_BUILTIN_STREAMINTERNALS_MARKPROMISEASHANDLED 1 -extern const char* const s_streamInternalsMarkPromiseAsHandledCode; -extern const int s_streamInternalsMarkPromiseAsHandledCodeLength; -extern const JSC::ConstructAbility s_streamInternalsMarkPromiseAsHandledCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsMarkPromiseAsHandledCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsMarkPromiseAsHandledCodeImplementationVisibility; - -// newQueue -#define WEBCORE_BUILTIN_STREAMINTERNALS_NEWQUEUE 1 -extern const char* const s_streamInternalsNewQueueCode; -extern const int s_streamInternalsNewQueueCodeLength; -extern const JSC::ConstructAbility s_streamInternalsNewQueueCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsNewQueueCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsNewQueueCodeImplementationVisibility; - -// peekQueueValue -#define WEBCORE_BUILTIN_STREAMINTERNALS_PEEKQUEUEVALUE 1 -extern const char* const s_streamInternalsPeekQueueValueCode; -extern const int s_streamInternalsPeekQueueValueCodeLength; -extern const JSC::ConstructAbility s_streamInternalsPeekQueueValueCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsPeekQueueValueCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsPeekQueueValueCodeImplementationVisibility; - -// promiseInvokeOrFallbackOrNoop -#define WEBCORE_BUILTIN_STREAMINTERNALS_PROMISEINVOKEORFALLBACKORNOOP 1 -extern const char* const s_streamInternalsPromiseInvokeOrFallbackOrNoopCode; -extern const int s_streamInternalsPromiseInvokeOrFallbackOrNoopCodeLength; -extern const JSC::ConstructAbility s_streamInternalsPromiseInvokeOrFallbackOrNoopCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsPromiseInvokeOrFallbackOrNoopCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsPromiseInvokeOrFallbackOrNoopCodeImplementationVisibility; - -// promiseInvokeOrNoop -#define WEBCORE_BUILTIN_STREAMINTERNALS_PROMISEINVOKEORNOOP 1 -extern const char* const s_streamInternalsPromiseInvokeOrNoopCode; -extern const int s_streamInternalsPromiseInvokeOrNoopCodeLength; -extern const JSC::ConstructAbility s_streamInternalsPromiseInvokeOrNoopCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsPromiseInvokeOrNoopCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsPromiseInvokeOrNoopCodeImplementationVisibility; - -// promiseInvokeOrNoopMethod -#define WEBCORE_BUILTIN_STREAMINTERNALS_PROMISEINVOKEORNOOPMETHOD 1 -extern const char* const s_streamInternalsPromiseInvokeOrNoopMethodCode; -extern const int s_streamInternalsPromiseInvokeOrNoopMethodCodeLength; -extern const JSC::ConstructAbility s_streamInternalsPromiseInvokeOrNoopMethodCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsPromiseInvokeOrNoopMethodCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsPromiseInvokeOrNoopMethodCodeImplementationVisibility; - -// promiseInvokeOrNoopMethodNoCatch -#define WEBCORE_BUILTIN_STREAMINTERNALS_PROMISEINVOKEORNOOPMETHODNOCATCH 1 -extern const char* const s_streamInternalsPromiseInvokeOrNoopMethodNoCatchCode; -extern const int s_streamInternalsPromiseInvokeOrNoopMethodNoCatchCodeLength; -extern const JSC::ConstructAbility s_streamInternalsPromiseInvokeOrNoopMethodNoCatchCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsPromiseInvokeOrNoopMethodNoCatchCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsPromiseInvokeOrNoopMethodNoCatchCodeImplementationVisibility; - -// promiseInvokeOrNoopNoCatch -#define WEBCORE_BUILTIN_STREAMINTERNALS_PROMISEINVOKEORNOOPNOCATCH 1 -extern const char* const s_streamInternalsPromiseInvokeOrNoopNoCatchCode; -extern const int s_streamInternalsPromiseInvokeOrNoopNoCatchCodeLength; -extern const JSC::ConstructAbility s_streamInternalsPromiseInvokeOrNoopNoCatchCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsPromiseInvokeOrNoopNoCatchCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsPromiseInvokeOrNoopNoCatchCodeImplementationVisibility; - -// resetQueue -#define WEBCORE_BUILTIN_STREAMINTERNALS_RESETQUEUE 1 -extern const char* const s_streamInternalsResetQueueCode; -extern const int s_streamInternalsResetQueueCodeLength; -extern const JSC::ConstructAbility s_streamInternalsResetQueueCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsResetQueueCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsResetQueueCodeImplementationVisibility; - -// shieldingPromiseResolve -#define WEBCORE_BUILTIN_STREAMINTERNALS_SHIELDINGPROMISERESOLVE 1 -extern const char* const s_streamInternalsShieldingPromiseResolveCode; -extern const int s_streamInternalsShieldingPromiseResolveCodeLength; -extern const JSC::ConstructAbility s_streamInternalsShieldingPromiseResolveCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsShieldingPromiseResolveCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsShieldingPromiseResolveCodeImplementationVisibility; - -// toDictionary -#define WEBCORE_BUILTIN_STREAMINTERNALS_TODICTIONARY 1 -extern const char* const s_streamInternalsToDictionaryCode; -extern const int s_streamInternalsToDictionaryCodeLength; -extern const JSC::ConstructAbility s_streamInternalsToDictionaryCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsToDictionaryCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsToDictionaryCodeImplementationVisibility; - -// validateAndNormalizeQueuingStrategy -#define WEBCORE_BUILTIN_STREAMINTERNALS_VALIDATEANDNORMALIZEQUEUINGSTRATEGY 1 -extern const char* const s_streamInternalsValidateAndNormalizeQueuingStrategyCode; -extern const int s_streamInternalsValidateAndNormalizeQueuingStrategyCodeLength; -extern const JSC::ConstructAbility s_streamInternalsValidateAndNormalizeQueuingStrategyCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsValidateAndNormalizeQueuingStrategyCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsValidateAndNormalizeQueuingStrategyCodeImplementationVisibility; - -#define WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_DATA(macro) \ - macro(createFIFO, streamInternalsCreateFIFO, 0) \ - macro(createFulfilledPromise, streamInternalsCreateFulfilledPromise, 1) \ - macro(dequeueValue, streamInternalsDequeueValue, 1) \ - macro(enqueueValueWithSize, streamInternalsEnqueueValueWithSize, 3) \ - macro(extractHighWaterMark, streamInternalsExtractHighWaterMark, 2) \ - macro(extractHighWaterMarkFromQueuingStrategyInit, streamInternalsExtractHighWaterMarkFromQueuingStrategyInit, 1) \ - macro(extractSizeAlgorithm, streamInternalsExtractSizeAlgorithm, 1) \ - macro(markPromiseAsHandled, streamInternalsMarkPromiseAsHandled, 1) \ - macro(newQueue, streamInternalsNewQueue, 0) \ - macro(peekQueueValue, streamInternalsPeekQueueValue, 1) \ - macro(promiseInvokeOrFallbackOrNoop, streamInternalsPromiseInvokeOrFallbackOrNoop, 5) \ - macro(promiseInvokeOrNoop, streamInternalsPromiseInvokeOrNoop, 3) \ - macro(promiseInvokeOrNoopMethod, streamInternalsPromiseInvokeOrNoopMethod, 3) \ - macro(promiseInvokeOrNoopMethodNoCatch, streamInternalsPromiseInvokeOrNoopMethodNoCatch, 3) \ - macro(promiseInvokeOrNoopNoCatch, streamInternalsPromiseInvokeOrNoopNoCatch, 3) \ - macro(resetQueue, streamInternalsResetQueue, 1) \ - macro(shieldingPromiseResolve, streamInternalsShieldingPromiseResolve, 1) \ - macro(toDictionary, streamInternalsToDictionary, 3) \ - macro(validateAndNormalizeQueuingStrategy, streamInternalsValidateAndNormalizeQueuingStrategy, 2) \ - -#define WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_CODE(macro) \ - macro(streamInternalsCreateFIFOCode, createFIFO, ASCIILiteral(), s_streamInternalsCreateFIFOCodeLength) \ - macro(streamInternalsCreateFulfilledPromiseCode, createFulfilledPromise, ASCIILiteral(), s_streamInternalsCreateFulfilledPromiseCodeLength) \ - macro(streamInternalsDequeueValueCode, dequeueValue, ASCIILiteral(), s_streamInternalsDequeueValueCodeLength) \ - macro(streamInternalsEnqueueValueWithSizeCode, enqueueValueWithSize, ASCIILiteral(), s_streamInternalsEnqueueValueWithSizeCodeLength) \ - macro(streamInternalsExtractHighWaterMarkCode, extractHighWaterMark, ASCIILiteral(), s_streamInternalsExtractHighWaterMarkCodeLength) \ - macro(streamInternalsExtractHighWaterMarkFromQueuingStrategyInitCode, extractHighWaterMarkFromQueuingStrategyInit, ASCIILiteral(), s_streamInternalsExtractHighWaterMarkFromQueuingStrategyInitCodeLength) \ - macro(streamInternalsExtractSizeAlgorithmCode, extractSizeAlgorithm, ASCIILiteral(), s_streamInternalsExtractSizeAlgorithmCodeLength) \ - macro(streamInternalsMarkPromiseAsHandledCode, markPromiseAsHandled, ASCIILiteral(), s_streamInternalsMarkPromiseAsHandledCodeLength) \ - macro(streamInternalsNewQueueCode, newQueue, ASCIILiteral(), s_streamInternalsNewQueueCodeLength) \ - macro(streamInternalsPeekQueueValueCode, peekQueueValue, ASCIILiteral(), s_streamInternalsPeekQueueValueCodeLength) \ - macro(streamInternalsPromiseInvokeOrFallbackOrNoopCode, promiseInvokeOrFallbackOrNoop, ASCIILiteral(), s_streamInternalsPromiseInvokeOrFallbackOrNoopCodeLength) \ - macro(streamInternalsPromiseInvokeOrNoopCode, promiseInvokeOrNoop, ASCIILiteral(), s_streamInternalsPromiseInvokeOrNoopCodeLength) \ - macro(streamInternalsPromiseInvokeOrNoopMethodCode, promiseInvokeOrNoopMethod, ASCIILiteral(), s_streamInternalsPromiseInvokeOrNoopMethodCodeLength) \ - macro(streamInternalsPromiseInvokeOrNoopMethodNoCatchCode, promiseInvokeOrNoopMethodNoCatch, ASCIILiteral(), s_streamInternalsPromiseInvokeOrNoopMethodNoCatchCodeLength) \ - macro(streamInternalsPromiseInvokeOrNoopNoCatchCode, promiseInvokeOrNoopNoCatch, ASCIILiteral(), s_streamInternalsPromiseInvokeOrNoopNoCatchCodeLength) \ - macro(streamInternalsResetQueueCode, resetQueue, ASCIILiteral(), s_streamInternalsResetQueueCodeLength) \ - macro(streamInternalsShieldingPromiseResolveCode, shieldingPromiseResolve, ASCIILiteral(), s_streamInternalsShieldingPromiseResolveCodeLength) \ - macro(streamInternalsToDictionaryCode, toDictionary, ASCIILiteral(), s_streamInternalsToDictionaryCodeLength) \ - macro(streamInternalsValidateAndNormalizeQueuingStrategyCode, validateAndNormalizeQueuingStrategy, ASCIILiteral(), s_streamInternalsValidateAndNormalizeQueuingStrategyCodeLength) \ - -#define WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_FUNCTION_NAME(macro) \ - macro(createFIFO) \ - macro(createFulfilledPromise) \ - macro(dequeueValue) \ - macro(enqueueValueWithSize) \ - macro(extractHighWaterMark) \ - macro(extractHighWaterMarkFromQueuingStrategyInit) \ - macro(extractSizeAlgorithm) \ - macro(markPromiseAsHandled) \ - macro(newQueue) \ - macro(peekQueueValue) \ - macro(promiseInvokeOrFallbackOrNoop) \ - macro(promiseInvokeOrNoop) \ - macro(promiseInvokeOrNoopMethod) \ - macro(promiseInvokeOrNoopMethodNoCatch) \ - macro(promiseInvokeOrNoopNoCatch) \ - macro(resetQueue) \ - macro(shieldingPromiseResolve) \ - macro(toDictionary) \ - macro(validateAndNormalizeQueuingStrategy) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class StreamInternalsBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit StreamInternalsBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { }, JSC::SourceTaintedOrigin::Untainted)) - WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak m_##name##Executable; - WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* StreamInternalsBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void StreamInternalsBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} -class StreamInternalsBuiltinFunctions { -public: - explicit StreamInternalsBuiltinFunctions(JSC::VM& vm) : m_vm(vm) { } - - void init(JSC::JSGlobalObject&); - template void visit(Visitor&); - -public: - JSC::VM& m_vm; - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \ - JSC::WriteBarrier m_##functionName##Function; - WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS -}; - -inline void StreamInternalsBuiltinFunctions::init(JSC::JSGlobalObject& globalObject) -{ -#define EXPORT_FUNCTION(codeName, functionName, overriddenName, length) \ - m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::create(m_vm, codeName##Generator(m_vm), &globalObject)); - WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_CODE(EXPORT_FUNCTION) -#undef EXPORT_FUNCTION -} - -template -inline void StreamInternalsBuiltinFunctions::visit(Visitor& visitor) -{ -#define VISIT_FUNCTION(name) visitor.append(m_##name##Function); - WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION) -#undef VISIT_FUNCTION -} - -template void StreamInternalsBuiltinFunctions::visit(JSC::AbstractSlotVisitor&); -template void StreamInternalsBuiltinFunctions::visit(JSC::SlotVisitor&); - /* TransformStream.ts */ -// initializeTransformStream -#define WEBCORE_BUILTIN_TRANSFORMSTREAM_INITIALIZETRANSFORMSTREAM 1 -extern const char* const s_transformStreamInitializeTransformStreamCode; -extern const int s_transformStreamInitializeTransformStreamCodeLength; -extern const JSC::ConstructAbility s_transformStreamInitializeTransformStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInitializeTransformStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInitializeTransformStreamCodeImplementationVisibility; - -// readable -#define WEBCORE_BUILTIN_TRANSFORMSTREAM_READABLE 1 -extern const char* const s_transformStreamReadableCode; -extern const int s_transformStreamReadableCodeLength; -extern const JSC::ConstructAbility s_transformStreamReadableCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamReadableCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamReadableCodeImplementationVisibility; - -// writable -#define WEBCORE_BUILTIN_TRANSFORMSTREAM_WRITABLE 1 -extern const char* const s_transformStreamWritableCode; -extern const int s_transformStreamWritableCodeLength; -extern const JSC::ConstructAbility s_transformStreamWritableCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamWritableCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamWritableCodeImplementationVisibility; - -#define WEBCORE_FOREACH_TRANSFORMSTREAM_BUILTIN_DATA(macro) \ - macro(initializeTransformStream, transformStreamInitializeTransformStream, 0) \ - macro(readable, transformStreamReadable, 0) \ - macro(writable, transformStreamWritable, 0) \ - -#define WEBCORE_FOREACH_TRANSFORMSTREAM_BUILTIN_CODE(macro) \ - macro(transformStreamInitializeTransformStreamCode, initializeTransformStream, ASCIILiteral(), s_transformStreamInitializeTransformStreamCodeLength) \ - macro(transformStreamReadableCode, readable, "get readable"_s, s_transformStreamReadableCodeLength) \ - macro(transformStreamWritableCode, writable, ASCIILiteral(), s_transformStreamWritableCodeLength) \ - -#define WEBCORE_FOREACH_TRANSFORMSTREAM_BUILTIN_FUNCTION_NAME(macro) \ - macro(initializeTransformStream) \ - macro(readable) \ - macro(writable) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_TRANSFORMSTREAM_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class TransformStreamBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit TransformStreamBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_TRANSFORMSTREAM_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { }, JSC::SourceTaintedOrigin::Untainted)) - WEBCORE_FOREACH_TRANSFORMSTREAM_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_TRANSFORMSTREAM_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_TRANSFORMSTREAM_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_TRANSFORMSTREAM_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak m_##name##Executable; - WEBCORE_FOREACH_TRANSFORMSTREAM_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* TransformStreamBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_TRANSFORMSTREAM_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void TransformStreamBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_TRANSFORMSTREAM_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} -/* TransformStreamDefaultController.ts */ -// desiredSize -#define WEBCORE_BUILTIN_TRANSFORMSTREAMDEFAULTCONTROLLER_DESIREDSIZE 1 -extern const char* const s_transformStreamDefaultControllerDesiredSizeCode; -extern const int s_transformStreamDefaultControllerDesiredSizeCodeLength; -extern const JSC::ConstructAbility s_transformStreamDefaultControllerDesiredSizeCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamDefaultControllerDesiredSizeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamDefaultControllerDesiredSizeCodeImplementationVisibility; - -// enqueue -#define WEBCORE_BUILTIN_TRANSFORMSTREAMDEFAULTCONTROLLER_ENQUEUE 1 -extern const char* const s_transformStreamDefaultControllerEnqueueCode; -extern const int s_transformStreamDefaultControllerEnqueueCodeLength; -extern const JSC::ConstructAbility s_transformStreamDefaultControllerEnqueueCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamDefaultControllerEnqueueCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamDefaultControllerEnqueueCodeImplementationVisibility; - -// error -#define WEBCORE_BUILTIN_TRANSFORMSTREAMDEFAULTCONTROLLER_ERROR 1 -extern const char* const s_transformStreamDefaultControllerErrorCode; -extern const int s_transformStreamDefaultControllerErrorCodeLength; -extern const JSC::ConstructAbility s_transformStreamDefaultControllerErrorCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamDefaultControllerErrorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamDefaultControllerErrorCodeImplementationVisibility; - -// initializeTransformStreamDefaultController -#define WEBCORE_BUILTIN_TRANSFORMSTREAMDEFAULTCONTROLLER_INITIALIZETRANSFORMSTREAMDEFAULTCONTROLLER 1 -extern const char* const s_transformStreamDefaultControllerInitializeTransformStreamDefaultControllerCode; -extern const int s_transformStreamDefaultControllerInitializeTransformStreamDefaultControllerCodeLength; -extern const JSC::ConstructAbility s_transformStreamDefaultControllerInitializeTransformStreamDefaultControllerCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamDefaultControllerInitializeTransformStreamDefaultControllerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamDefaultControllerInitializeTransformStreamDefaultControllerCodeImplementationVisibility; - -// terminate -#define WEBCORE_BUILTIN_TRANSFORMSTREAMDEFAULTCONTROLLER_TERMINATE 1 -extern const char* const s_transformStreamDefaultControllerTerminateCode; -extern const int s_transformStreamDefaultControllerTerminateCodeLength; -extern const JSC::ConstructAbility s_transformStreamDefaultControllerTerminateCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamDefaultControllerTerminateCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamDefaultControllerTerminateCodeImplementationVisibility; - -#define WEBCORE_FOREACH_TRANSFORMSTREAMDEFAULTCONTROLLER_BUILTIN_DATA(macro) \ - macro(desiredSize, transformStreamDefaultControllerDesiredSize, 0) \ - macro(enqueue, transformStreamDefaultControllerEnqueue, 1) \ - macro(error, transformStreamDefaultControllerError, 1) \ - macro(initializeTransformStreamDefaultController, transformStreamDefaultControllerInitializeTransformStreamDefaultController, 0) \ - macro(terminate, transformStreamDefaultControllerTerminate, 0) \ - -#define WEBCORE_FOREACH_TRANSFORMSTREAMDEFAULTCONTROLLER_BUILTIN_CODE(macro) \ - macro(transformStreamDefaultControllerDesiredSizeCode, desiredSize, "get desiredSize"_s, s_transformStreamDefaultControllerDesiredSizeCodeLength) \ - macro(transformStreamDefaultControllerEnqueueCode, enqueue, ASCIILiteral(), s_transformStreamDefaultControllerEnqueueCodeLength) \ - macro(transformStreamDefaultControllerErrorCode, error, ASCIILiteral(), s_transformStreamDefaultControllerErrorCodeLength) \ - macro(transformStreamDefaultControllerInitializeTransformStreamDefaultControllerCode, initializeTransformStreamDefaultController, ASCIILiteral(), s_transformStreamDefaultControllerInitializeTransformStreamDefaultControllerCodeLength) \ - macro(transformStreamDefaultControllerTerminateCode, terminate, ASCIILiteral(), s_transformStreamDefaultControllerTerminateCodeLength) \ - -#define WEBCORE_FOREACH_TRANSFORMSTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(macro) \ - macro(desiredSize) \ - macro(enqueue) \ - macro(error) \ - macro(initializeTransformStreamDefaultController) \ - macro(terminate) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_TRANSFORMSTREAMDEFAULTCONTROLLER_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class TransformStreamDefaultControllerBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit TransformStreamDefaultControllerBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_TRANSFORMSTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { }, JSC::SourceTaintedOrigin::Untainted)) - WEBCORE_FOREACH_TRANSFORMSTREAMDEFAULTCONTROLLER_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_TRANSFORMSTREAMDEFAULTCONTROLLER_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_TRANSFORMSTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_TRANSFORMSTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak m_##name##Executable; - WEBCORE_FOREACH_TRANSFORMSTREAMDEFAULTCONTROLLER_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* TransformStreamDefaultControllerBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_TRANSFORMSTREAMDEFAULTCONTROLLER_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void TransformStreamDefaultControllerBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_TRANSFORMSTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} -/* TransformStreamInternals.ts */ -// createTransformStream -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_CREATETRANSFORMSTREAM 1 -extern const char* const s_transformStreamInternalsCreateTransformStreamCode; -extern const int s_transformStreamInternalsCreateTransformStreamCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsCreateTransformStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsCreateTransformStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsCreateTransformStreamCodeImplementationVisibility; - -// initializeTransformStream -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_INITIALIZETRANSFORMSTREAM 1 -extern const char* const s_transformStreamInternalsInitializeTransformStreamCode; -extern const int s_transformStreamInternalsInitializeTransformStreamCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsInitializeTransformStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsInitializeTransformStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsInitializeTransformStreamCodeImplementationVisibility; - -// isTransformStream -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_ISTRANSFORMSTREAM 1 -extern const char* const s_transformStreamInternalsIsTransformStreamCode; -extern const int s_transformStreamInternalsIsTransformStreamCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsIsTransformStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsIsTransformStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsIsTransformStreamCodeImplementationVisibility; - -// isTransformStreamDefaultController -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_ISTRANSFORMSTREAMDEFAULTCONTROLLER 1 -extern const char* const s_transformStreamInternalsIsTransformStreamDefaultControllerCode; -extern const int s_transformStreamInternalsIsTransformStreamDefaultControllerCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsIsTransformStreamDefaultControllerCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsIsTransformStreamDefaultControllerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsIsTransformStreamDefaultControllerCodeImplementationVisibility; - -// setUpTransformStreamDefaultController -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_SETUPTRANSFORMSTREAMDEFAULTCONTROLLER 1 -extern const char* const s_transformStreamInternalsSetUpTransformStreamDefaultControllerCode; -extern const int s_transformStreamInternalsSetUpTransformStreamDefaultControllerCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsSetUpTransformStreamDefaultControllerCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsSetUpTransformStreamDefaultControllerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsSetUpTransformStreamDefaultControllerCodeImplementationVisibility; - -// setUpTransformStreamDefaultControllerFromTransformer -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_SETUPTRANSFORMSTREAMDEFAULTCONTROLLERFROMTRANSFORMER 1 -extern const char* const s_transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformerCode; -extern const int s_transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformerCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformerCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformerCodeImplementationVisibility; - -// transformStreamDefaultControllerClearAlgorithms -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_TRANSFORMSTREAMDEFAULTCONTROLLERCLEARALGORITHMS 1 -extern const char* const s_transformStreamInternalsTransformStreamDefaultControllerClearAlgorithmsCode; -extern const int s_transformStreamInternalsTransformStreamDefaultControllerClearAlgorithmsCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultControllerClearAlgorithmsCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultControllerClearAlgorithmsCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultControllerClearAlgorithmsCodeImplementationVisibility; - -// transformStreamDefaultControllerEnqueue -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_TRANSFORMSTREAMDEFAULTCONTROLLERENQUEUE 1 -extern const char* const s_transformStreamInternalsTransformStreamDefaultControllerEnqueueCode; -extern const int s_transformStreamInternalsTransformStreamDefaultControllerEnqueueCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultControllerEnqueueCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultControllerEnqueueCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultControllerEnqueueCodeImplementationVisibility; - -// transformStreamDefaultControllerError -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_TRANSFORMSTREAMDEFAULTCONTROLLERERROR 1 -extern const char* const s_transformStreamInternalsTransformStreamDefaultControllerErrorCode; -extern const int s_transformStreamInternalsTransformStreamDefaultControllerErrorCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultControllerErrorCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultControllerErrorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultControllerErrorCodeImplementationVisibility; - -// transformStreamDefaultControllerPerformTransform -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_TRANSFORMSTREAMDEFAULTCONTROLLERPERFORMTRANSFORM 1 -extern const char* const s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCode; -extern const int s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCodeImplementationVisibility; - -// transformStreamDefaultControllerTerminate -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_TRANSFORMSTREAMDEFAULTCONTROLLERTERMINATE 1 -extern const char* const s_transformStreamInternalsTransformStreamDefaultControllerTerminateCode; -extern const int s_transformStreamInternalsTransformStreamDefaultControllerTerminateCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultControllerTerminateCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultControllerTerminateCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultControllerTerminateCodeImplementationVisibility; - -// transformStreamDefaultSinkAbortAlgorithm -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_TRANSFORMSTREAMDEFAULTSINKABORTALGORITHM 1 -extern const char* const s_transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithmCode; -extern const int s_transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithmCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithmCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithmCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithmCodeImplementationVisibility; - -// transformStreamDefaultSinkCloseAlgorithm -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_TRANSFORMSTREAMDEFAULTSINKCLOSEALGORITHM 1 -extern const char* const s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCode; -extern const int s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCodeImplementationVisibility; - -// transformStreamDefaultSinkWriteAlgorithm -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_TRANSFORMSTREAMDEFAULTSINKWRITEALGORITHM 1 -extern const char* const s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCode; -extern const int s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCodeImplementationVisibility; - -// transformStreamDefaultSourcePullAlgorithm -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_TRANSFORMSTREAMDEFAULTSOURCEPULLALGORITHM 1 -extern const char* const s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCode; -extern const int s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCodeImplementationVisibility; - -// transformStreamError -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_TRANSFORMSTREAMERROR 1 -extern const char* const s_transformStreamInternalsTransformStreamErrorCode; -extern const int s_transformStreamInternalsTransformStreamErrorCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsTransformStreamErrorCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsTransformStreamErrorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamErrorCodeImplementationVisibility; - -// transformStreamErrorWritableAndUnblockWrite -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_TRANSFORMSTREAMERRORWRITABLEANDUNBLOCKWRITE 1 -extern const char* const s_transformStreamInternalsTransformStreamErrorWritableAndUnblockWriteCode; -extern const int s_transformStreamInternalsTransformStreamErrorWritableAndUnblockWriteCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsTransformStreamErrorWritableAndUnblockWriteCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsTransformStreamErrorWritableAndUnblockWriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamErrorWritableAndUnblockWriteCodeImplementationVisibility; - -// transformStreamSetBackpressure -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_TRANSFORMSTREAMSETBACKPRESSURE 1 -extern const char* const s_transformStreamInternalsTransformStreamSetBackpressureCode; -extern const int s_transformStreamInternalsTransformStreamSetBackpressureCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsTransformStreamSetBackpressureCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsTransformStreamSetBackpressureCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamSetBackpressureCodeImplementationVisibility; - -#define WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_DATA(macro) \ - macro(createTransformStream, transformStreamInternalsCreateTransformStream, 8) \ - macro(initializeTransformStream, transformStreamInternalsInitializeTransformStream, 7) \ - macro(isTransformStream, transformStreamInternalsIsTransformStream, 1) \ - macro(isTransformStreamDefaultController, transformStreamInternalsIsTransformStreamDefaultController, 1) \ - macro(setUpTransformStreamDefaultController, transformStreamInternalsSetUpTransformStreamDefaultController, 4) \ - macro(setUpTransformStreamDefaultControllerFromTransformer, transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformer, 3) \ - macro(transformStreamDefaultControllerClearAlgorithms, transformStreamInternalsTransformStreamDefaultControllerClearAlgorithms, 1) \ - macro(transformStreamDefaultControllerEnqueue, transformStreamInternalsTransformStreamDefaultControllerEnqueue, 2) \ - macro(transformStreamDefaultControllerError, transformStreamInternalsTransformStreamDefaultControllerError, 2) \ - macro(transformStreamDefaultControllerPerformTransform, transformStreamInternalsTransformStreamDefaultControllerPerformTransform, 2) \ - macro(transformStreamDefaultControllerTerminate, transformStreamInternalsTransformStreamDefaultControllerTerminate, 1) \ - macro(transformStreamDefaultSinkAbortAlgorithm, transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithm, 2) \ - macro(transformStreamDefaultSinkCloseAlgorithm, transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithm, 1) \ - macro(transformStreamDefaultSinkWriteAlgorithm, transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithm, 2) \ - macro(transformStreamDefaultSourcePullAlgorithm, transformStreamInternalsTransformStreamDefaultSourcePullAlgorithm, 1) \ - macro(transformStreamError, transformStreamInternalsTransformStreamError, 2) \ - macro(transformStreamErrorWritableAndUnblockWrite, transformStreamInternalsTransformStreamErrorWritableAndUnblockWrite, 2) \ - macro(transformStreamSetBackpressure, transformStreamInternalsTransformStreamSetBackpressure, 2) \ - -#define WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_CODE(macro) \ - macro(transformStreamInternalsCreateTransformStreamCode, createTransformStream, ASCIILiteral(), s_transformStreamInternalsCreateTransformStreamCodeLength) \ - macro(transformStreamInternalsInitializeTransformStreamCode, initializeTransformStream, ASCIILiteral(), s_transformStreamInternalsInitializeTransformStreamCodeLength) \ - macro(transformStreamInternalsIsTransformStreamCode, isTransformStream, ASCIILiteral(), s_transformStreamInternalsIsTransformStreamCodeLength) \ - macro(transformStreamInternalsIsTransformStreamDefaultControllerCode, isTransformStreamDefaultController, ASCIILiteral(), s_transformStreamInternalsIsTransformStreamDefaultControllerCodeLength) \ - macro(transformStreamInternalsSetUpTransformStreamDefaultControllerCode, setUpTransformStreamDefaultController, ASCIILiteral(), s_transformStreamInternalsSetUpTransformStreamDefaultControllerCodeLength) \ - macro(transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformerCode, setUpTransformStreamDefaultControllerFromTransformer, ASCIILiteral(), s_transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformerCodeLength) \ - macro(transformStreamInternalsTransformStreamDefaultControllerClearAlgorithmsCode, transformStreamDefaultControllerClearAlgorithms, ASCIILiteral(), s_transformStreamInternalsTransformStreamDefaultControllerClearAlgorithmsCodeLength) \ - macro(transformStreamInternalsTransformStreamDefaultControllerEnqueueCode, transformStreamDefaultControllerEnqueue, ASCIILiteral(), s_transformStreamInternalsTransformStreamDefaultControllerEnqueueCodeLength) \ - macro(transformStreamInternalsTransformStreamDefaultControllerErrorCode, transformStreamDefaultControllerError, ASCIILiteral(), s_transformStreamInternalsTransformStreamDefaultControllerErrorCodeLength) \ - macro(transformStreamInternalsTransformStreamDefaultControllerPerformTransformCode, transformStreamDefaultControllerPerformTransform, ASCIILiteral(), s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCodeLength) \ - macro(transformStreamInternalsTransformStreamDefaultControllerTerminateCode, transformStreamDefaultControllerTerminate, ASCIILiteral(), s_transformStreamInternalsTransformStreamDefaultControllerTerminateCodeLength) \ - macro(transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithmCode, transformStreamDefaultSinkAbortAlgorithm, ASCIILiteral(), s_transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithmCodeLength) \ - macro(transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCode, transformStreamDefaultSinkCloseAlgorithm, ASCIILiteral(), s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCodeLength) \ - macro(transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCode, transformStreamDefaultSinkWriteAlgorithm, ASCIILiteral(), s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCodeLength) \ - macro(transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCode, transformStreamDefaultSourcePullAlgorithm, ASCIILiteral(), s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCodeLength) \ - macro(transformStreamInternalsTransformStreamErrorCode, transformStreamError, ASCIILiteral(), s_transformStreamInternalsTransformStreamErrorCodeLength) \ - macro(transformStreamInternalsTransformStreamErrorWritableAndUnblockWriteCode, transformStreamErrorWritableAndUnblockWrite, ASCIILiteral(), s_transformStreamInternalsTransformStreamErrorWritableAndUnblockWriteCodeLength) \ - macro(transformStreamInternalsTransformStreamSetBackpressureCode, transformStreamSetBackpressure, ASCIILiteral(), s_transformStreamInternalsTransformStreamSetBackpressureCodeLength) \ - -#define WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_FUNCTION_NAME(macro) \ - macro(createTransformStream) \ - macro(initializeTransformStream) \ - macro(isTransformStream) \ - macro(isTransformStreamDefaultController) \ - macro(setUpTransformStreamDefaultController) \ - macro(setUpTransformStreamDefaultControllerFromTransformer) \ - macro(transformStreamDefaultControllerClearAlgorithms) \ - macro(transformStreamDefaultControllerEnqueue) \ - macro(transformStreamDefaultControllerError) \ - macro(transformStreamDefaultControllerPerformTransform) \ - macro(transformStreamDefaultControllerTerminate) \ - macro(transformStreamDefaultSinkAbortAlgorithm) \ - macro(transformStreamDefaultSinkCloseAlgorithm) \ - macro(transformStreamDefaultSinkWriteAlgorithm) \ - macro(transformStreamDefaultSourcePullAlgorithm) \ - macro(transformStreamError) \ - macro(transformStreamErrorWritableAndUnblockWrite) \ - macro(transformStreamSetBackpressure) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class TransformStreamInternalsBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit TransformStreamInternalsBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { }, JSC::SourceTaintedOrigin::Untainted)) - WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak m_##name##Executable; - WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* TransformStreamInternalsBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void TransformStreamInternalsBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} -class TransformStreamInternalsBuiltinFunctions { -public: - explicit TransformStreamInternalsBuiltinFunctions(JSC::VM& vm) : m_vm(vm) { } - - void init(JSC::JSGlobalObject&); - template void visit(Visitor&); - -public: - JSC::VM& m_vm; - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \ - JSC::WriteBarrier m_##functionName##Function; - WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS -}; - -inline void TransformStreamInternalsBuiltinFunctions::init(JSC::JSGlobalObject& globalObject) -{ -#define EXPORT_FUNCTION(codeName, functionName, overriddenName, length) \ - m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::create(m_vm, codeName##Generator(m_vm), &globalObject)); - WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_CODE(EXPORT_FUNCTION) -#undef EXPORT_FUNCTION -} - -template -inline void TransformStreamInternalsBuiltinFunctions::visit(Visitor& visitor) -{ -#define VISIT_FUNCTION(name) visitor.append(m_##name##Function); - WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION) -#undef VISIT_FUNCTION -} - -template void TransformStreamInternalsBuiltinFunctions::visit(JSC::AbstractSlotVisitor&); -template void TransformStreamInternalsBuiltinFunctions::visit(JSC::SlotVisitor&); - /* UtilInspect.ts */ -// getStylizeWithColor -#define WEBCORE_BUILTIN_UTILINSPECT_GETSTYLIZEWITHCOLOR 1 -extern const char* const s_utilInspectGetStylizeWithColorCode; -extern const int s_utilInspectGetStylizeWithColorCodeLength; -extern const JSC::ConstructAbility s_utilInspectGetStylizeWithColorCodeConstructAbility; -extern const JSC::ConstructorKind s_utilInspectGetStylizeWithColorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_utilInspectGetStylizeWithColorCodeImplementationVisibility; - -// stylizeWithNoColor -#define WEBCORE_BUILTIN_UTILINSPECT_STYLIZEWITHNOCOLOR 1 -extern const char* const s_utilInspectStylizeWithNoColorCode; -extern const int s_utilInspectStylizeWithNoColorCodeLength; -extern const JSC::ConstructAbility s_utilInspectStylizeWithNoColorCodeConstructAbility; -extern const JSC::ConstructorKind s_utilInspectStylizeWithNoColorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_utilInspectStylizeWithNoColorCodeImplementationVisibility; - -#define WEBCORE_FOREACH_UTILINSPECT_BUILTIN_DATA(macro) \ - macro(getStylizeWithColor, utilInspectGetStylizeWithColor, 1) \ - macro(stylizeWithNoColor, utilInspectStylizeWithNoColor, 1) \ - -#define WEBCORE_FOREACH_UTILINSPECT_BUILTIN_CODE(macro) \ - macro(utilInspectGetStylizeWithColorCode, getStylizeWithColor, ASCIILiteral(), s_utilInspectGetStylizeWithColorCodeLength) \ - macro(utilInspectStylizeWithNoColorCode, stylizeWithNoColor, ASCIILiteral(), s_utilInspectStylizeWithNoColorCodeLength) \ - -#define WEBCORE_FOREACH_UTILINSPECT_BUILTIN_FUNCTION_NAME(macro) \ - macro(getStylizeWithColor) \ - macro(stylizeWithNoColor) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_UTILINSPECT_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class UtilInspectBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit UtilInspectBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_UTILINSPECT_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { }, JSC::SourceTaintedOrigin::Untainted)) - WEBCORE_FOREACH_UTILINSPECT_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_UTILINSPECT_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_UTILINSPECT_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_UTILINSPECT_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak m_##name##Executable; - WEBCORE_FOREACH_UTILINSPECT_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* UtilInspectBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_UTILINSPECT_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void UtilInspectBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_UTILINSPECT_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} -/* WritableStreamDefaultController.ts */ -// error -#define WEBCORE_BUILTIN_WRITABLESTREAMDEFAULTCONTROLLER_ERROR 1 -extern const char* const s_writableStreamDefaultControllerErrorCode; -extern const int s_writableStreamDefaultControllerErrorCodeLength; -extern const JSC::ConstructAbility s_writableStreamDefaultControllerErrorCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamDefaultControllerErrorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamDefaultControllerErrorCodeImplementationVisibility; - -// initializeWritableStreamDefaultController -#define WEBCORE_BUILTIN_WRITABLESTREAMDEFAULTCONTROLLER_INITIALIZEWRITABLESTREAMDEFAULTCONTROLLER 1 -extern const char* const s_writableStreamDefaultControllerInitializeWritableStreamDefaultControllerCode; -extern const int s_writableStreamDefaultControllerInitializeWritableStreamDefaultControllerCodeLength; -extern const JSC::ConstructAbility s_writableStreamDefaultControllerInitializeWritableStreamDefaultControllerCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamDefaultControllerInitializeWritableStreamDefaultControllerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamDefaultControllerInitializeWritableStreamDefaultControllerCodeImplementationVisibility; - -#define WEBCORE_FOREACH_WRITABLESTREAMDEFAULTCONTROLLER_BUILTIN_DATA(macro) \ - macro(error, writableStreamDefaultControllerError, 1) \ - macro(initializeWritableStreamDefaultController, writableStreamDefaultControllerInitializeWritableStreamDefaultController, 0) \ - -#define WEBCORE_FOREACH_WRITABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(macro) \ - macro(writableStreamDefaultControllerErrorCode, error, ASCIILiteral(), s_writableStreamDefaultControllerErrorCodeLength) \ - macro(writableStreamDefaultControllerInitializeWritableStreamDefaultControllerCode, initializeWritableStreamDefaultController, ASCIILiteral(), s_writableStreamDefaultControllerInitializeWritableStreamDefaultControllerCodeLength) \ - -#define WEBCORE_FOREACH_WRITABLESTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(macro) \ - macro(error) \ - macro(initializeWritableStreamDefaultController) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_WRITABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class WritableStreamDefaultControllerBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit WritableStreamDefaultControllerBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { }, JSC::SourceTaintedOrigin::Untainted)) - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak m_##name##Executable; - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* WritableStreamDefaultControllerBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_WRITABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void WritableStreamDefaultControllerBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} -/* WritableStreamDefaultWriter.ts */ -// abort -#define WEBCORE_BUILTIN_WRITABLESTREAMDEFAULTWRITER_ABORT 1 -extern const char* const s_writableStreamDefaultWriterAbortCode; -extern const int s_writableStreamDefaultWriterAbortCodeLength; -extern const JSC::ConstructAbility s_writableStreamDefaultWriterAbortCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamDefaultWriterAbortCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamDefaultWriterAbortCodeImplementationVisibility; - -// close -#define WEBCORE_BUILTIN_WRITABLESTREAMDEFAULTWRITER_CLOSE 1 -extern const char* const s_writableStreamDefaultWriterCloseCode; -extern const int s_writableStreamDefaultWriterCloseCodeLength; -extern const JSC::ConstructAbility s_writableStreamDefaultWriterCloseCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamDefaultWriterCloseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamDefaultWriterCloseCodeImplementationVisibility; - -// closed -#define WEBCORE_BUILTIN_WRITABLESTREAMDEFAULTWRITER_CLOSED 1 -extern const char* const s_writableStreamDefaultWriterClosedCode; -extern const int s_writableStreamDefaultWriterClosedCodeLength; -extern const JSC::ConstructAbility s_writableStreamDefaultWriterClosedCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamDefaultWriterClosedCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamDefaultWriterClosedCodeImplementationVisibility; - -// desiredSize -#define WEBCORE_BUILTIN_WRITABLESTREAMDEFAULTWRITER_DESIREDSIZE 1 -extern const char* const s_writableStreamDefaultWriterDesiredSizeCode; -extern const int s_writableStreamDefaultWriterDesiredSizeCodeLength; -extern const JSC::ConstructAbility s_writableStreamDefaultWriterDesiredSizeCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamDefaultWriterDesiredSizeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamDefaultWriterDesiredSizeCodeImplementationVisibility; - -// initializeWritableStreamDefaultWriter -#define WEBCORE_BUILTIN_WRITABLESTREAMDEFAULTWRITER_INITIALIZEWRITABLESTREAMDEFAULTWRITER 1 -extern const char* const s_writableStreamDefaultWriterInitializeWritableStreamDefaultWriterCode; -extern const int s_writableStreamDefaultWriterInitializeWritableStreamDefaultWriterCodeLength; -extern const JSC::ConstructAbility s_writableStreamDefaultWriterInitializeWritableStreamDefaultWriterCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamDefaultWriterInitializeWritableStreamDefaultWriterCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamDefaultWriterInitializeWritableStreamDefaultWriterCodeImplementationVisibility; - -// ready -#define WEBCORE_BUILTIN_WRITABLESTREAMDEFAULTWRITER_READY 1 -extern const char* const s_writableStreamDefaultWriterReadyCode; -extern const int s_writableStreamDefaultWriterReadyCodeLength; -extern const JSC::ConstructAbility s_writableStreamDefaultWriterReadyCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamDefaultWriterReadyCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamDefaultWriterReadyCodeImplementationVisibility; - -// releaseLock -#define WEBCORE_BUILTIN_WRITABLESTREAMDEFAULTWRITER_RELEASELOCK 1 -extern const char* const s_writableStreamDefaultWriterReleaseLockCode; -extern const int s_writableStreamDefaultWriterReleaseLockCodeLength; -extern const JSC::ConstructAbility s_writableStreamDefaultWriterReleaseLockCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamDefaultWriterReleaseLockCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamDefaultWriterReleaseLockCodeImplementationVisibility; - -// write -#define WEBCORE_BUILTIN_WRITABLESTREAMDEFAULTWRITER_WRITE 1 -extern const char* const s_writableStreamDefaultWriterWriteCode; -extern const int s_writableStreamDefaultWriterWriteCodeLength; -extern const JSC::ConstructAbility s_writableStreamDefaultWriterWriteCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamDefaultWriterWriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamDefaultWriterWriteCodeImplementationVisibility; - -#define WEBCORE_FOREACH_WRITABLESTREAMDEFAULTWRITER_BUILTIN_DATA(macro) \ - macro(abort, writableStreamDefaultWriterAbort, 1) \ - macro(close, writableStreamDefaultWriterClose, 0) \ - macro(closed, writableStreamDefaultWriterClosed, 0) \ - macro(desiredSize, writableStreamDefaultWriterDesiredSize, 0) \ - macro(initializeWritableStreamDefaultWriter, writableStreamDefaultWriterInitializeWritableStreamDefaultWriter, 1) \ - macro(ready, writableStreamDefaultWriterReady, 0) \ - macro(releaseLock, writableStreamDefaultWriterReleaseLock, 0) \ - macro(write, writableStreamDefaultWriterWrite, 1) \ - -#define WEBCORE_FOREACH_WRITABLESTREAMDEFAULTWRITER_BUILTIN_CODE(macro) \ - macro(writableStreamDefaultWriterAbortCode, abort, ASCIILiteral(), s_writableStreamDefaultWriterAbortCodeLength) \ - macro(writableStreamDefaultWriterCloseCode, close, ASCIILiteral(), s_writableStreamDefaultWriterCloseCodeLength) \ - macro(writableStreamDefaultWriterClosedCode, closed, "get closed"_s, s_writableStreamDefaultWriterClosedCodeLength) \ - macro(writableStreamDefaultWriterDesiredSizeCode, desiredSize, "get desiredSize"_s, s_writableStreamDefaultWriterDesiredSizeCodeLength) \ - macro(writableStreamDefaultWriterInitializeWritableStreamDefaultWriterCode, initializeWritableStreamDefaultWriter, ASCIILiteral(), s_writableStreamDefaultWriterInitializeWritableStreamDefaultWriterCodeLength) \ - macro(writableStreamDefaultWriterReadyCode, ready, "get ready"_s, s_writableStreamDefaultWriterReadyCodeLength) \ - macro(writableStreamDefaultWriterReleaseLockCode, releaseLock, ASCIILiteral(), s_writableStreamDefaultWriterReleaseLockCodeLength) \ - macro(writableStreamDefaultWriterWriteCode, write, ASCIILiteral(), s_writableStreamDefaultWriterWriteCodeLength) \ - -#define WEBCORE_FOREACH_WRITABLESTREAMDEFAULTWRITER_BUILTIN_FUNCTION_NAME(macro) \ - macro(abort) \ - macro(close) \ - macro(closed) \ - macro(desiredSize) \ - macro(initializeWritableStreamDefaultWriter) \ - macro(ready) \ - macro(releaseLock) \ - macro(write) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_WRITABLESTREAMDEFAULTWRITER_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class WritableStreamDefaultWriterBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit WritableStreamDefaultWriterBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTWRITER_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { }, JSC::SourceTaintedOrigin::Untainted)) - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTWRITER_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTWRITER_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTWRITER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTWRITER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak m_##name##Executable; - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTWRITER_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* WritableStreamDefaultWriterBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_WRITABLESTREAMDEFAULTWRITER_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void WritableStreamDefaultWriterBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTWRITER_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} -/* WritableStreamInternals.ts */ -// acquireWritableStreamDefaultWriter -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_ACQUIREWRITABLESTREAMDEFAULTWRITER 1 -extern const char* const s_writableStreamInternalsAcquireWritableStreamDefaultWriterCode; -extern const int s_writableStreamInternalsAcquireWritableStreamDefaultWriterCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsAcquireWritableStreamDefaultWriterCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsAcquireWritableStreamDefaultWriterCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsAcquireWritableStreamDefaultWriterCodeImplementationVisibility; - -// createInternalWritableStreamFromUnderlyingSink -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_CREATEINTERNALWRITABLESTREAMFROMUNDERLYINGSINK 1 -extern const char* const s_writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSinkCode; -extern const int s_writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSinkCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSinkCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSinkCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSinkCodeImplementationVisibility; - -// createWritableStream -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_CREATEWRITABLESTREAM 1 -extern const char* const s_writableStreamInternalsCreateWritableStreamCode; -extern const int s_writableStreamInternalsCreateWritableStreamCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsCreateWritableStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsCreateWritableStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsCreateWritableStreamCodeImplementationVisibility; - -// initializeWritableStreamSlots -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_INITIALIZEWRITABLESTREAMSLOTS 1 -extern const char* const s_writableStreamInternalsInitializeWritableStreamSlotsCode; -extern const int s_writableStreamInternalsInitializeWritableStreamSlotsCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsInitializeWritableStreamSlotsCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsInitializeWritableStreamSlotsCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsInitializeWritableStreamSlotsCodeImplementationVisibility; - -// isCloseSentinel -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_ISCLOSESENTINEL 1 -extern const char* const s_writableStreamInternalsIsCloseSentinelCode; -extern const int s_writableStreamInternalsIsCloseSentinelCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsIsCloseSentinelCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsIsCloseSentinelCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsIsCloseSentinelCodeImplementationVisibility; - -// isWritableStream -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_ISWRITABLESTREAM 1 -extern const char* const s_writableStreamInternalsIsWritableStreamCode; -extern const int s_writableStreamInternalsIsWritableStreamCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsIsWritableStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsIsWritableStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsIsWritableStreamCodeImplementationVisibility; - -// isWritableStreamDefaultWriter -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_ISWRITABLESTREAMDEFAULTWRITER 1 -extern const char* const s_writableStreamInternalsIsWritableStreamDefaultWriterCode; -extern const int s_writableStreamInternalsIsWritableStreamDefaultWriterCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsIsWritableStreamDefaultWriterCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsIsWritableStreamDefaultWriterCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsIsWritableStreamDefaultWriterCodeImplementationVisibility; - -// isWritableStreamLocked -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_ISWRITABLESTREAMLOCKED 1 -extern const char* const s_writableStreamInternalsIsWritableStreamLockedCode; -extern const int s_writableStreamInternalsIsWritableStreamLockedCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsIsWritableStreamLockedCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsIsWritableStreamLockedCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsIsWritableStreamLockedCodeImplementationVisibility; - -// setUpWritableStreamDefaultController -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_SETUPWRITABLESTREAMDEFAULTCONTROLLER 1 -extern const char* const s_writableStreamInternalsSetUpWritableStreamDefaultControllerCode; -extern const int s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeImplementationVisibility; - -// setUpWritableStreamDefaultControllerFromUnderlyingSink -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_SETUPWRITABLESTREAMDEFAULTCONTROLLERFROMUNDERLYINGSINK 1 -extern const char* const s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCode; -extern const int s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeImplementationVisibility; - -// setUpWritableStreamDefaultWriter -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_SETUPWRITABLESTREAMDEFAULTWRITER 1 -extern const char* const s_writableStreamInternalsSetUpWritableStreamDefaultWriterCode; -extern const int s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeImplementationVisibility; - -// writableStreamAbort -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMABORT 1 -extern const char* const s_writableStreamInternalsWritableStreamAbortCode; -extern const int s_writableStreamInternalsWritableStreamAbortCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamAbortCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamAbortCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamAbortCodeImplementationVisibility; - -// writableStreamAbortForBindings -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMABORTFORBINDINGS 1 -extern const char* const s_writableStreamInternalsWritableStreamAbortForBindingsCode; -extern const int s_writableStreamInternalsWritableStreamAbortForBindingsCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamAbortForBindingsCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamAbortForBindingsCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamAbortForBindingsCodeImplementationVisibility; - -// writableStreamAddWriteRequest -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMADDWRITEREQUEST 1 -extern const char* const s_writableStreamInternalsWritableStreamAddWriteRequestCode; -extern const int s_writableStreamInternalsWritableStreamAddWriteRequestCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamAddWriteRequestCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamAddWriteRequestCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamAddWriteRequestCodeImplementationVisibility; - -// writableStreamClose -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMCLOSE 1 -extern const char* const s_writableStreamInternalsWritableStreamCloseCode; -extern const int s_writableStreamInternalsWritableStreamCloseCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamCloseCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamCloseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamCloseCodeImplementationVisibility; - -// writableStreamCloseForBindings -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMCLOSEFORBINDINGS 1 -extern const char* const s_writableStreamInternalsWritableStreamCloseForBindingsCode; -extern const int s_writableStreamInternalsWritableStreamCloseForBindingsCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamCloseForBindingsCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamCloseForBindingsCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamCloseForBindingsCodeImplementationVisibility; - -// writableStreamCloseQueuedOrInFlight -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMCLOSEQUEUEDORINFLIGHT 1 -extern const char* const s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCode; -extern const int s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCodeImplementationVisibility; - -// writableStreamDealWithRejection -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEALWITHREJECTION 1 -extern const char* const s_writableStreamInternalsWritableStreamDealWithRejectionCode; -extern const int s_writableStreamInternalsWritableStreamDealWithRejectionCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDealWithRejectionCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDealWithRejectionCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDealWithRejectionCodeImplementationVisibility; - -// writableStreamDefaultControllerAdvanceQueueIfNeeded -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTCONTROLLERADVANCEQUEUEIFNEEDED 1 -extern const char* const s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCode; -extern const int s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCodeImplementationVisibility; - -// writableStreamDefaultControllerClearAlgorithms -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTCONTROLLERCLEARALGORITHMS 1 -extern const char* const s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCode; -extern const int s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCodeImplementationVisibility; - -// writableStreamDefaultControllerClose -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTCONTROLLERCLOSE 1 -extern const char* const s_writableStreamInternalsWritableStreamDefaultControllerCloseCode; -extern const int s_writableStreamInternalsWritableStreamDefaultControllerCloseCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerCloseCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerCloseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerCloseCodeImplementationVisibility; - -// writableStreamDefaultControllerError -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTCONTROLLERERROR 1 -extern const char* const s_writableStreamInternalsWritableStreamDefaultControllerErrorCode; -extern const int s_writableStreamInternalsWritableStreamDefaultControllerErrorCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerErrorCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerErrorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerErrorCodeImplementationVisibility; - -// writableStreamDefaultControllerErrorIfNeeded -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTCONTROLLERERRORIFNEEDED 1 -extern const char* const s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCode; -extern const int s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCodeImplementationVisibility; - -// writableStreamDefaultControllerGetBackpressure -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTCONTROLLERGETBACKPRESSURE 1 -extern const char* const s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCode; -extern const int s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCodeImplementationVisibility; - -// writableStreamDefaultControllerGetChunkSize -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTCONTROLLERGETCHUNKSIZE 1 -extern const char* const s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCode; -extern const int s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCodeImplementationVisibility; - -// writableStreamDefaultControllerGetDesiredSize -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTCONTROLLERGETDESIREDSIZE 1 -extern const char* const s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCode; -extern const int s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCodeImplementationVisibility; - -// writableStreamDefaultControllerProcessClose -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTCONTROLLERPROCESSCLOSE 1 -extern const char* const s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCode; -extern const int s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCodeImplementationVisibility; - -// writableStreamDefaultControllerProcessWrite -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTCONTROLLERPROCESSWRITE 1 -extern const char* const s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCode; -extern const int s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCodeImplementationVisibility; - -// writableStreamDefaultControllerStart -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTCONTROLLERSTART 1 -extern const char* const s_writableStreamInternalsWritableStreamDefaultControllerStartCode; -extern const int s_writableStreamInternalsWritableStreamDefaultControllerStartCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerStartCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerStartCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerStartCodeImplementationVisibility; - -// writableStreamDefaultControllerWrite -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTCONTROLLERWRITE 1 -extern const char* const s_writableStreamInternalsWritableStreamDefaultControllerWriteCode; -extern const int s_writableStreamInternalsWritableStreamDefaultControllerWriteCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerWriteCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerWriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerWriteCodeImplementationVisibility; - -// writableStreamDefaultWriterAbort -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTWRITERABORT 1 -extern const char* const s_writableStreamInternalsWritableStreamDefaultWriterAbortCode; -extern const int s_writableStreamInternalsWritableStreamDefaultWriterAbortCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterAbortCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterAbortCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterAbortCodeImplementationVisibility; - -// writableStreamDefaultWriterClose -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTWRITERCLOSE 1 -extern const char* const s_writableStreamInternalsWritableStreamDefaultWriterCloseCode; -extern const int s_writableStreamInternalsWritableStreamDefaultWriterCloseCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterCloseCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterCloseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterCloseCodeImplementationVisibility; - -// writableStreamDefaultWriterCloseWithErrorPropagation -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTWRITERCLOSEWITHERRORPROPAGATION 1 -extern const char* const s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCode; -extern const int s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCodeImplementationVisibility; - -// writableStreamDefaultWriterEnsureClosedPromiseRejected -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTWRITERENSURECLOSEDPROMISEREJECTED 1 -extern const char* const s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCode; -extern const int s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeImplementationVisibility; - -// writableStreamDefaultWriterEnsureReadyPromiseRejected -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTWRITERENSUREREADYPROMISEREJECTED 1 -extern const char* const s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCode; -extern const int s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeImplementationVisibility; - -// writableStreamDefaultWriterGetDesiredSize -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTWRITERGETDESIREDSIZE 1 -extern const char* const s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCode; -extern const int s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCodeImplementationVisibility; - -// writableStreamDefaultWriterRelease -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTWRITERRELEASE 1 -extern const char* const s_writableStreamInternalsWritableStreamDefaultWriterReleaseCode; -extern const int s_writableStreamInternalsWritableStreamDefaultWriterReleaseCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterReleaseCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterReleaseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterReleaseCodeImplementationVisibility; - -// writableStreamDefaultWriterWrite -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTWRITERWRITE 1 -extern const char* const s_writableStreamInternalsWritableStreamDefaultWriterWriteCode; -extern const int s_writableStreamInternalsWritableStreamDefaultWriterWriteCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterWriteCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterWriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterWriteCodeImplementationVisibility; - -// writableStreamFinishErroring -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMFINISHERRORING 1 -extern const char* const s_writableStreamInternalsWritableStreamFinishErroringCode; -extern const int s_writableStreamInternalsWritableStreamFinishErroringCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishErroringCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishErroringCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamFinishErroringCodeImplementationVisibility; - -// writableStreamFinishInFlightClose -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMFINISHINFLIGHTCLOSE 1 -extern const char* const s_writableStreamInternalsWritableStreamFinishInFlightCloseCode; -extern const int s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeImplementationVisibility; - -// writableStreamFinishInFlightCloseWithError -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMFINISHINFLIGHTCLOSEWITHERROR 1 -extern const char* const s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCode; -extern const int s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeImplementationVisibility; - -// writableStreamFinishInFlightWrite -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMFINISHINFLIGHTWRITE 1 -extern const char* const s_writableStreamInternalsWritableStreamFinishInFlightWriteCode; -extern const int s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeImplementationVisibility; - -// writableStreamFinishInFlightWriteWithError -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMFINISHINFLIGHTWRITEWITHERROR 1 -extern const char* const s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCode; -extern const int s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeImplementationVisibility; - -// writableStreamHasOperationMarkedInFlight -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMHASOPERATIONMARKEDINFLIGHT 1 -extern const char* const s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCode; -extern const int s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCodeImplementationVisibility; - -// writableStreamMarkCloseRequestInFlight -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMMARKCLOSEREQUESTINFLIGHT 1 -extern const char* const s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCode; -extern const int s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCodeImplementationVisibility; - -// writableStreamMarkFirstWriteRequestInFlight -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMMARKFIRSTWRITEREQUESTINFLIGHT 1 -extern const char* const s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCode; -extern const int s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCodeImplementationVisibility; - -// writableStreamRejectCloseAndClosedPromiseIfNeeded -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMREJECTCLOSEANDCLOSEDPROMISEIFNEEDED 1 -extern const char* const s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCode; -extern const int s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeImplementationVisibility; - -// writableStreamStartErroring -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMSTARTERRORING 1 -extern const char* const s_writableStreamInternalsWritableStreamStartErroringCode; -extern const int s_writableStreamInternalsWritableStreamStartErroringCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamStartErroringCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamStartErroringCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamStartErroringCodeImplementationVisibility; - -// writableStreamUpdateBackpressure -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMUPDATEBACKPRESSURE 1 -extern const char* const s_writableStreamInternalsWritableStreamUpdateBackpressureCode; -extern const int s_writableStreamInternalsWritableStreamUpdateBackpressureCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamUpdateBackpressureCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamUpdateBackpressureCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamUpdateBackpressureCodeImplementationVisibility; - -#define WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_DATA(macro) \ - macro(acquireWritableStreamDefaultWriter, writableStreamInternalsAcquireWritableStreamDefaultWriter, 1) \ - macro(createInternalWritableStreamFromUnderlyingSink, writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSink, 2) \ - macro(createWritableStream, writableStreamInternalsCreateWritableStream, 7) \ - macro(initializeWritableStreamSlots, writableStreamInternalsInitializeWritableStreamSlots, 2) \ - macro(isCloseSentinel, writableStreamInternalsIsCloseSentinel, 0) \ - macro(isWritableStream, writableStreamInternalsIsWritableStream, 1) \ - macro(isWritableStreamDefaultWriter, writableStreamInternalsIsWritableStreamDefaultWriter, 1) \ - macro(isWritableStreamLocked, writableStreamInternalsIsWritableStreamLocked, 1) \ - macro(setUpWritableStreamDefaultController, writableStreamInternalsSetUpWritableStreamDefaultController, 9) \ - macro(setUpWritableStreamDefaultControllerFromUnderlyingSink, writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSink, 6) \ - macro(setUpWritableStreamDefaultWriter, writableStreamInternalsSetUpWritableStreamDefaultWriter, 2) \ - macro(writableStreamAbort, writableStreamInternalsWritableStreamAbort, 2) \ - macro(writableStreamAbortForBindings, writableStreamInternalsWritableStreamAbortForBindings, 2) \ - macro(writableStreamAddWriteRequest, writableStreamInternalsWritableStreamAddWriteRequest, 1) \ - macro(writableStreamClose, writableStreamInternalsWritableStreamClose, 1) \ - macro(writableStreamCloseForBindings, writableStreamInternalsWritableStreamCloseForBindings, 1) \ - macro(writableStreamCloseQueuedOrInFlight, writableStreamInternalsWritableStreamCloseQueuedOrInFlight, 1) \ - macro(writableStreamDealWithRejection, writableStreamInternalsWritableStreamDealWithRejection, 2) \ - macro(writableStreamDefaultControllerAdvanceQueueIfNeeded, writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeeded, 1) \ - macro(writableStreamDefaultControllerClearAlgorithms, writableStreamInternalsWritableStreamDefaultControllerClearAlgorithms, 1) \ - macro(writableStreamDefaultControllerClose, writableStreamInternalsWritableStreamDefaultControllerClose, 1) \ - macro(writableStreamDefaultControllerError, writableStreamInternalsWritableStreamDefaultControllerError, 2) \ - macro(writableStreamDefaultControllerErrorIfNeeded, writableStreamInternalsWritableStreamDefaultControllerErrorIfNeeded, 2) \ - macro(writableStreamDefaultControllerGetBackpressure, writableStreamInternalsWritableStreamDefaultControllerGetBackpressure, 1) \ - macro(writableStreamDefaultControllerGetChunkSize, writableStreamInternalsWritableStreamDefaultControllerGetChunkSize, 2) \ - macro(writableStreamDefaultControllerGetDesiredSize, writableStreamInternalsWritableStreamDefaultControllerGetDesiredSize, 1) \ - macro(writableStreamDefaultControllerProcessClose, writableStreamInternalsWritableStreamDefaultControllerProcessClose, 1) \ - macro(writableStreamDefaultControllerProcessWrite, writableStreamInternalsWritableStreamDefaultControllerProcessWrite, 2) \ - macro(writableStreamDefaultControllerStart, writableStreamInternalsWritableStreamDefaultControllerStart, 1) \ - macro(writableStreamDefaultControllerWrite, writableStreamInternalsWritableStreamDefaultControllerWrite, 3) \ - macro(writableStreamDefaultWriterAbort, writableStreamInternalsWritableStreamDefaultWriterAbort, 2) \ - macro(writableStreamDefaultWriterClose, writableStreamInternalsWritableStreamDefaultWriterClose, 1) \ - macro(writableStreamDefaultWriterCloseWithErrorPropagation, writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagation, 1) \ - macro(writableStreamDefaultWriterEnsureClosedPromiseRejected, writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejected, 2) \ - macro(writableStreamDefaultWriterEnsureReadyPromiseRejected, writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejected, 2) \ - macro(writableStreamDefaultWriterGetDesiredSize, writableStreamInternalsWritableStreamDefaultWriterGetDesiredSize, 1) \ - macro(writableStreamDefaultWriterRelease, writableStreamInternalsWritableStreamDefaultWriterRelease, 1) \ - macro(writableStreamDefaultWriterWrite, writableStreamInternalsWritableStreamDefaultWriterWrite, 2) \ - macro(writableStreamFinishErroring, writableStreamInternalsWritableStreamFinishErroring, 1) \ - macro(writableStreamFinishInFlightClose, writableStreamInternalsWritableStreamFinishInFlightClose, 1) \ - macro(writableStreamFinishInFlightCloseWithError, writableStreamInternalsWritableStreamFinishInFlightCloseWithError, 2) \ - macro(writableStreamFinishInFlightWrite, writableStreamInternalsWritableStreamFinishInFlightWrite, 1) \ - macro(writableStreamFinishInFlightWriteWithError, writableStreamInternalsWritableStreamFinishInFlightWriteWithError, 2) \ - macro(writableStreamHasOperationMarkedInFlight, writableStreamInternalsWritableStreamHasOperationMarkedInFlight, 1) \ - macro(writableStreamMarkCloseRequestInFlight, writableStreamInternalsWritableStreamMarkCloseRequestInFlight, 1) \ - macro(writableStreamMarkFirstWriteRequestInFlight, writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlight, 1) \ - macro(writableStreamRejectCloseAndClosedPromiseIfNeeded, writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeeded, 1) \ - macro(writableStreamStartErroring, writableStreamInternalsWritableStreamStartErroring, 2) \ - macro(writableStreamUpdateBackpressure, writableStreamInternalsWritableStreamUpdateBackpressure, 2) \ - -#define WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_CODE(macro) \ - macro(writableStreamInternalsAcquireWritableStreamDefaultWriterCode, acquireWritableStreamDefaultWriter, ASCIILiteral(), s_writableStreamInternalsAcquireWritableStreamDefaultWriterCodeLength) \ - macro(writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSinkCode, createInternalWritableStreamFromUnderlyingSink, ASCIILiteral(), s_writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSinkCodeLength) \ - macro(writableStreamInternalsCreateWritableStreamCode, createWritableStream, ASCIILiteral(), s_writableStreamInternalsCreateWritableStreamCodeLength) \ - macro(writableStreamInternalsInitializeWritableStreamSlotsCode, initializeWritableStreamSlots, ASCIILiteral(), s_writableStreamInternalsInitializeWritableStreamSlotsCodeLength) \ - macro(writableStreamInternalsIsCloseSentinelCode, isCloseSentinel, ASCIILiteral(), s_writableStreamInternalsIsCloseSentinelCodeLength) \ - macro(writableStreamInternalsIsWritableStreamCode, isWritableStream, ASCIILiteral(), s_writableStreamInternalsIsWritableStreamCodeLength) \ - macro(writableStreamInternalsIsWritableStreamDefaultWriterCode, isWritableStreamDefaultWriter, ASCIILiteral(), s_writableStreamInternalsIsWritableStreamDefaultWriterCodeLength) \ - macro(writableStreamInternalsIsWritableStreamLockedCode, isWritableStreamLocked, ASCIILiteral(), s_writableStreamInternalsIsWritableStreamLockedCodeLength) \ - macro(writableStreamInternalsSetUpWritableStreamDefaultControllerCode, setUpWritableStreamDefaultController, ASCIILiteral(), s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeLength) \ - macro(writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCode, setUpWritableStreamDefaultControllerFromUnderlyingSink, ASCIILiteral(), s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeLength) \ - macro(writableStreamInternalsSetUpWritableStreamDefaultWriterCode, setUpWritableStreamDefaultWriter, ASCIILiteral(), s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeLength) \ - macro(writableStreamInternalsWritableStreamAbortCode, writableStreamAbort, ASCIILiteral(), s_writableStreamInternalsWritableStreamAbortCodeLength) \ - macro(writableStreamInternalsWritableStreamAbortForBindingsCode, writableStreamAbortForBindings, ASCIILiteral(), s_writableStreamInternalsWritableStreamAbortForBindingsCodeLength) \ - macro(writableStreamInternalsWritableStreamAddWriteRequestCode, writableStreamAddWriteRequest, ASCIILiteral(), s_writableStreamInternalsWritableStreamAddWriteRequestCodeLength) \ - macro(writableStreamInternalsWritableStreamCloseCode, writableStreamClose, ASCIILiteral(), s_writableStreamInternalsWritableStreamCloseCodeLength) \ - macro(writableStreamInternalsWritableStreamCloseForBindingsCode, writableStreamCloseForBindings, ASCIILiteral(), s_writableStreamInternalsWritableStreamCloseForBindingsCodeLength) \ - macro(writableStreamInternalsWritableStreamCloseQueuedOrInFlightCode, writableStreamCloseQueuedOrInFlight, ASCIILiteral(), s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCodeLength) \ - macro(writableStreamInternalsWritableStreamDealWithRejectionCode, writableStreamDealWithRejection, ASCIILiteral(), s_writableStreamInternalsWritableStreamDealWithRejectionCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCode, writableStreamDefaultControllerAdvanceQueueIfNeeded, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCode, writableStreamDefaultControllerClearAlgorithms, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultControllerCloseCode, writableStreamDefaultControllerClose, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultControllerCloseCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultControllerErrorCode, writableStreamDefaultControllerError, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultControllerErrorCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCode, writableStreamDefaultControllerErrorIfNeeded, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCode, writableStreamDefaultControllerGetBackpressure, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCode, writableStreamDefaultControllerGetChunkSize, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCode, writableStreamDefaultControllerGetDesiredSize, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultControllerProcessCloseCode, writableStreamDefaultControllerProcessClose, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultControllerProcessWriteCode, writableStreamDefaultControllerProcessWrite, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultControllerStartCode, writableStreamDefaultControllerStart, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultControllerStartCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultControllerWriteCode, writableStreamDefaultControllerWrite, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultControllerWriteCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultWriterAbortCode, writableStreamDefaultWriterAbort, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultWriterAbortCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultWriterCloseCode, writableStreamDefaultWriterClose, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultWriterCloseCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCode, writableStreamDefaultWriterCloseWithErrorPropagation, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCode, writableStreamDefaultWriterEnsureClosedPromiseRejected, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCode, writableStreamDefaultWriterEnsureReadyPromiseRejected, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCode, writableStreamDefaultWriterGetDesiredSize, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultWriterReleaseCode, writableStreamDefaultWriterRelease, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultWriterReleaseCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultWriterWriteCode, writableStreamDefaultWriterWrite, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultWriterWriteCodeLength) \ - macro(writableStreamInternalsWritableStreamFinishErroringCode, writableStreamFinishErroring, ASCIILiteral(), s_writableStreamInternalsWritableStreamFinishErroringCodeLength) \ - macro(writableStreamInternalsWritableStreamFinishInFlightCloseCode, writableStreamFinishInFlightClose, ASCIILiteral(), s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeLength) \ - macro(writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCode, writableStreamFinishInFlightCloseWithError, ASCIILiteral(), s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeLength) \ - macro(writableStreamInternalsWritableStreamFinishInFlightWriteCode, writableStreamFinishInFlightWrite, ASCIILiteral(), s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeLength) \ - macro(writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCode, writableStreamFinishInFlightWriteWithError, ASCIILiteral(), s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeLength) \ - macro(writableStreamInternalsWritableStreamHasOperationMarkedInFlightCode, writableStreamHasOperationMarkedInFlight, ASCIILiteral(), s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCodeLength) \ - macro(writableStreamInternalsWritableStreamMarkCloseRequestInFlightCode, writableStreamMarkCloseRequestInFlight, ASCIILiteral(), s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCodeLength) \ - macro(writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCode, writableStreamMarkFirstWriteRequestInFlight, ASCIILiteral(), s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCodeLength) \ - macro(writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCode, writableStreamRejectCloseAndClosedPromiseIfNeeded, ASCIILiteral(), s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeLength) \ - macro(writableStreamInternalsWritableStreamStartErroringCode, writableStreamStartErroring, ASCIILiteral(), s_writableStreamInternalsWritableStreamStartErroringCodeLength) \ - macro(writableStreamInternalsWritableStreamUpdateBackpressureCode, writableStreamUpdateBackpressure, ASCIILiteral(), s_writableStreamInternalsWritableStreamUpdateBackpressureCodeLength) \ - -#define WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(macro) \ - macro(acquireWritableStreamDefaultWriter) \ - macro(createInternalWritableStreamFromUnderlyingSink) \ - macro(createWritableStream) \ - macro(initializeWritableStreamSlots) \ - macro(isCloseSentinel) \ - macro(isWritableStream) \ - macro(isWritableStreamDefaultWriter) \ - macro(isWritableStreamLocked) \ - macro(setUpWritableStreamDefaultController) \ - macro(setUpWritableStreamDefaultControllerFromUnderlyingSink) \ - macro(setUpWritableStreamDefaultWriter) \ - macro(writableStreamAbort) \ - macro(writableStreamAbortForBindings) \ - macro(writableStreamAddWriteRequest) \ - macro(writableStreamClose) \ - macro(writableStreamCloseForBindings) \ - macro(writableStreamCloseQueuedOrInFlight) \ - macro(writableStreamDealWithRejection) \ - macro(writableStreamDefaultControllerAdvanceQueueIfNeeded) \ - macro(writableStreamDefaultControllerClearAlgorithms) \ - macro(writableStreamDefaultControllerClose) \ - macro(writableStreamDefaultControllerError) \ - macro(writableStreamDefaultControllerErrorIfNeeded) \ - macro(writableStreamDefaultControllerGetBackpressure) \ - macro(writableStreamDefaultControllerGetChunkSize) \ - macro(writableStreamDefaultControllerGetDesiredSize) \ - macro(writableStreamDefaultControllerProcessClose) \ - macro(writableStreamDefaultControllerProcessWrite) \ - macro(writableStreamDefaultControllerStart) \ - macro(writableStreamDefaultControllerWrite) \ - macro(writableStreamDefaultWriterAbort) \ - macro(writableStreamDefaultWriterClose) \ - macro(writableStreamDefaultWriterCloseWithErrorPropagation) \ - macro(writableStreamDefaultWriterEnsureClosedPromiseRejected) \ - macro(writableStreamDefaultWriterEnsureReadyPromiseRejected) \ - macro(writableStreamDefaultWriterGetDesiredSize) \ - macro(writableStreamDefaultWriterRelease) \ - macro(writableStreamDefaultWriterWrite) \ - macro(writableStreamFinishErroring) \ - macro(writableStreamFinishInFlightClose) \ - macro(writableStreamFinishInFlightCloseWithError) \ - macro(writableStreamFinishInFlightWrite) \ - macro(writableStreamFinishInFlightWriteWithError) \ - macro(writableStreamHasOperationMarkedInFlight) \ - macro(writableStreamMarkCloseRequestInFlight) \ - macro(writableStreamMarkFirstWriteRequestInFlight) \ - macro(writableStreamRejectCloseAndClosedPromiseIfNeeded) \ - macro(writableStreamStartErroring) \ - macro(writableStreamUpdateBackpressure) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class WritableStreamInternalsBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit WritableStreamInternalsBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { }, JSC::SourceTaintedOrigin::Untainted)) - WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak m_##name##Executable; - WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* WritableStreamInternalsBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void WritableStreamInternalsBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} -class WritableStreamInternalsBuiltinFunctions { -public: - explicit WritableStreamInternalsBuiltinFunctions(JSC::VM& vm) : m_vm(vm) { } - - void init(JSC::JSGlobalObject&); - template void visit(Visitor&); - -public: - JSC::VM& m_vm; - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \ - JSC::WriteBarrier m_##functionName##Function; - WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS -}; - -inline void WritableStreamInternalsBuiltinFunctions::init(JSC::JSGlobalObject& globalObject) -{ -#define EXPORT_FUNCTION(codeName, functionName, overriddenName, length) \ - m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::create(m_vm, codeName##Generator(m_vm), &globalObject)); - WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_CODE(EXPORT_FUNCTION) -#undef EXPORT_FUNCTION -} - -template -inline void WritableStreamInternalsBuiltinFunctions::visit(Visitor& visitor) -{ -#define VISIT_FUNCTION(name) visitor.append(m_##name##Function); - WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION) -#undef VISIT_FUNCTION -} - -template void WritableStreamInternalsBuiltinFunctions::visit(JSC::AbstractSlotVisitor&); -template void WritableStreamInternalsBuiltinFunctions::visit(JSC::SlotVisitor&); - class JSBuiltinFunctions { -public: - explicit JSBuiltinFunctions(JSC::VM& vm) - : m_vm(vm) - , m_bundlerPluginBuiltins(m_vm) - , m_byteLengthQueuingStrategyBuiltins(m_vm) - , m_consoleObjectBuiltins(m_vm) - , m_countQueuingStrategyBuiltins(m_vm) - , m_eventSourceBuiltins(m_vm) - , m_importMetaObjectBuiltins(m_vm) - , m_jsBufferConstructorBuiltins(m_vm) - , m_jsBufferPrototypeBuiltins(m_vm) - , m_moduleBuiltins(m_vm) - , m_processObjectInternalsBuiltins(m_vm) - , m_readableByteStreamControllerBuiltins(m_vm) - , m_readableByteStreamInternalsBuiltins(m_vm) - , m_readableStreamBuiltins(m_vm) - , m_readableStreamBYOBReaderBuiltins(m_vm) - , m_readableStreamBYOBRequestBuiltins(m_vm) - , m_readableStreamDefaultControllerBuiltins(m_vm) - , m_readableStreamDefaultReaderBuiltins(m_vm) - , m_readableStreamInternalsBuiltins(m_vm) - , m_streamInternalsBuiltins(m_vm) - , m_transformStreamBuiltins(m_vm) - , m_transformStreamDefaultControllerBuiltins(m_vm) - , m_transformStreamInternalsBuiltins(m_vm) - , m_utilInspectBuiltins(m_vm) - , m_writableStreamDefaultControllerBuiltins(m_vm) - , m_writableStreamDefaultWriterBuiltins(m_vm) - , m_writableStreamInternalsBuiltins(m_vm) - - { - m_readableByteStreamInternalsBuiltins.exportNames(); - m_readableStreamInternalsBuiltins.exportNames(); - m_streamInternalsBuiltins.exportNames(); - m_transformStreamInternalsBuiltins.exportNames(); - m_writableStreamInternalsBuiltins.exportNames(); - } - BundlerPluginBuiltinsWrapper& bundlerPluginBuiltins() { return m_bundlerPluginBuiltins; } - ByteLengthQueuingStrategyBuiltinsWrapper& byteLengthQueuingStrategyBuiltins() { return m_byteLengthQueuingStrategyBuiltins; } - ConsoleObjectBuiltinsWrapper& consoleObjectBuiltins() { return m_consoleObjectBuiltins; } - CountQueuingStrategyBuiltinsWrapper& countQueuingStrategyBuiltins() { return m_countQueuingStrategyBuiltins; } - EventSourceBuiltinsWrapper& eventSourceBuiltins() { return m_eventSourceBuiltins; } - ImportMetaObjectBuiltinsWrapper& importMetaObjectBuiltins() { return m_importMetaObjectBuiltins; } - JSBufferConstructorBuiltinsWrapper& jsBufferConstructorBuiltins() { return m_jsBufferConstructorBuiltins; } - JSBufferPrototypeBuiltinsWrapper& jsBufferPrototypeBuiltins() { return m_jsBufferPrototypeBuiltins; } - ModuleBuiltinsWrapper& moduleBuiltins() { return m_moduleBuiltins; } - ProcessObjectInternalsBuiltinsWrapper& processObjectInternalsBuiltins() { return m_processObjectInternalsBuiltins; } - ReadableByteStreamControllerBuiltinsWrapper& readableByteStreamControllerBuiltins() { return m_readableByteStreamControllerBuiltins; } - ReadableByteStreamInternalsBuiltinsWrapper& readableByteStreamInternalsBuiltins() { return m_readableByteStreamInternalsBuiltins; } - ReadableStreamBuiltinsWrapper& readableStreamBuiltins() { return m_readableStreamBuiltins; } - ReadableStreamBYOBReaderBuiltinsWrapper& readableStreamBYOBReaderBuiltins() { return m_readableStreamBYOBReaderBuiltins; } - ReadableStreamBYOBRequestBuiltinsWrapper& readableStreamBYOBRequestBuiltins() { return m_readableStreamBYOBRequestBuiltins; } - ReadableStreamDefaultControllerBuiltinsWrapper& readableStreamDefaultControllerBuiltins() { return m_readableStreamDefaultControllerBuiltins; } - ReadableStreamDefaultReaderBuiltinsWrapper& readableStreamDefaultReaderBuiltins() { return m_readableStreamDefaultReaderBuiltins; } - ReadableStreamInternalsBuiltinsWrapper& readableStreamInternalsBuiltins() { return m_readableStreamInternalsBuiltins; } - StreamInternalsBuiltinsWrapper& streamInternalsBuiltins() { return m_streamInternalsBuiltins; } - TransformStreamBuiltinsWrapper& transformStreamBuiltins() { return m_transformStreamBuiltins; } - TransformStreamDefaultControllerBuiltinsWrapper& transformStreamDefaultControllerBuiltins() { return m_transformStreamDefaultControllerBuiltins; } - TransformStreamInternalsBuiltinsWrapper& transformStreamInternalsBuiltins() { return m_transformStreamInternalsBuiltins; } - UtilInspectBuiltinsWrapper& utilInspectBuiltins() { return m_utilInspectBuiltins; } - WritableStreamDefaultControllerBuiltinsWrapper& writableStreamDefaultControllerBuiltins() { return m_writableStreamDefaultControllerBuiltins; } - WritableStreamDefaultWriterBuiltinsWrapper& writableStreamDefaultWriterBuiltins() { return m_writableStreamDefaultWriterBuiltins; } - WritableStreamInternalsBuiltinsWrapper& writableStreamInternalsBuiltins() { return m_writableStreamInternalsBuiltins; } - -private: - JSC::VM& m_vm; - BundlerPluginBuiltinsWrapper m_bundlerPluginBuiltins; - ByteLengthQueuingStrategyBuiltinsWrapper m_byteLengthQueuingStrategyBuiltins; - ConsoleObjectBuiltinsWrapper m_consoleObjectBuiltins; - CountQueuingStrategyBuiltinsWrapper m_countQueuingStrategyBuiltins; - EventSourceBuiltinsWrapper m_eventSourceBuiltins; - ImportMetaObjectBuiltinsWrapper m_importMetaObjectBuiltins; - JSBufferConstructorBuiltinsWrapper m_jsBufferConstructorBuiltins; - JSBufferPrototypeBuiltinsWrapper m_jsBufferPrototypeBuiltins; - ModuleBuiltinsWrapper m_moduleBuiltins; - ProcessObjectInternalsBuiltinsWrapper m_processObjectInternalsBuiltins; - ReadableByteStreamControllerBuiltinsWrapper m_readableByteStreamControllerBuiltins; - ReadableByteStreamInternalsBuiltinsWrapper m_readableByteStreamInternalsBuiltins; - ReadableStreamBuiltinsWrapper m_readableStreamBuiltins; - ReadableStreamBYOBReaderBuiltinsWrapper m_readableStreamBYOBReaderBuiltins; - ReadableStreamBYOBRequestBuiltinsWrapper m_readableStreamBYOBRequestBuiltins; - ReadableStreamDefaultControllerBuiltinsWrapper m_readableStreamDefaultControllerBuiltins; - ReadableStreamDefaultReaderBuiltinsWrapper m_readableStreamDefaultReaderBuiltins; - ReadableStreamInternalsBuiltinsWrapper m_readableStreamInternalsBuiltins; - StreamInternalsBuiltinsWrapper m_streamInternalsBuiltins; - TransformStreamBuiltinsWrapper m_transformStreamBuiltins; - TransformStreamDefaultControllerBuiltinsWrapper m_transformStreamDefaultControllerBuiltins; - TransformStreamInternalsBuiltinsWrapper m_transformStreamInternalsBuiltins; - UtilInspectBuiltinsWrapper m_utilInspectBuiltins; - WritableStreamDefaultControllerBuiltinsWrapper m_writableStreamDefaultControllerBuiltins; - WritableStreamDefaultWriterBuiltinsWrapper m_writableStreamDefaultWriterBuiltins; - WritableStreamInternalsBuiltinsWrapper m_writableStreamInternalsBuiltins; -; -}; - -class JSBuiltinInternalFunctions { -public: - explicit JSBuiltinInternalFunctions(JSC::VM&); - - template void visit(Visitor&); - void initialize(Zig::GlobalObject&); - ReadableByteStreamInternalsBuiltinFunctions& readableByteStreamInternals() { return m_readableByteStreamInternals; } - ReadableStreamInternalsBuiltinFunctions& readableStreamInternals() { return m_readableStreamInternals; } - StreamInternalsBuiltinFunctions& streamInternals() { return m_streamInternals; } - TransformStreamInternalsBuiltinFunctions& transformStreamInternals() { return m_transformStreamInternals; } - WritableStreamInternalsBuiltinFunctions& writableStreamInternals() { return m_writableStreamInternals; } - -private: - JSC::VM& m_vm; - ReadableByteStreamInternalsBuiltinFunctions m_readableByteStreamInternals; - ReadableStreamInternalsBuiltinFunctions m_readableStreamInternals; - StreamInternalsBuiltinFunctions m_streamInternals; - TransformStreamInternalsBuiltinFunctions m_transformStreamInternals; - WritableStreamInternalsBuiltinFunctions m_writableStreamInternals; - -}; - -} // namespace WebCore diff --git a/src/jsc.zig b/src/jsc.zig index 5cdf739b3a3a5..9f02d6a7810be 100644 --- a/src/jsc.zig +++ b/src/jsc.zig @@ -85,4 +85,6 @@ pub const Subprocess = @import("./bun.js/api/bun.zig").Subprocess; /// - pub usingnamespace JSC.Codegen.JSMyClassName; /// 5. make clean-bindings && make bindings -j10 /// -pub const Codegen = @import("./bun.js/bindings/generated_classes.zig"); +pub const Codegen = @import("generated/ZigGeneratedClasses.zig"); + +pub const GeneratedClassesList = @import("./bun.js/bindings/generated_classes_list.zig").Classes; diff --git a/src/main.zig b/src/main.zig index ee8b0fb47ad44..6af74ab2a2ac5 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1,4 +1,5 @@ const std = @import("std"); +pub const build_options = @import("build_options"); const panicky = @import("./panic_handler.zig"); const MainPanicHandler = panicky.NewPanicHandler(std.builtin.default_panic); @@ -12,16 +13,23 @@ pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace, addr const CrashReporter = @import("./crash_reporter.zig"); extern fn bun_warn_avx_missing(url: [*:0]const u8) void; +pub extern "C" var _environ: ?*anyopaque; +pub extern "C" var environ: ?*anyopaque; + pub fn main() void { const bun = @import("root").bun; const Output = bun.Output; const Environment = bun.Environment; - if (comptime Environment.isWindows) { - bun.win32.populateArgv(); - } - if (comptime Environment.isRelease) + if (Environment.isRelease and Environment.isPosix) CrashReporter.start() catch unreachable; + if (Environment.isWindows) { + environ = @ptrCast(std.os.environ.ptr); + _environ = @ptrCast(std.os.environ.ptr); + bun.win32.STDOUT_FD = bun.toFD(std.io.getStdOut().handle); + bun.win32.STDERR_FD = bun.toFD(std.io.getStdErr().handle); + bun.win32.STDIN_FD = bun.toFD(std.io.getStdIn().handle); + } bun.start_time = std.time.nanoTimestamp(); @@ -31,13 +39,9 @@ pub fn main() void { Output.Source.set(&output_source); defer Output.flush(); - if (comptime Environment.isX64) { - if (comptime Environment.enableSIMD) { - bun_warn_avx_missing(@import("./cli/upgrade_command.zig").Version.Bun__githubBaselineURL.ptr); - } + if (Environment.isX64 and Environment.enableSIMD) { + bun_warn_avx_missing(@import("./cli/upgrade_command.zig").Version.Bun__githubBaselineURL.ptr); } bun.CLI.Cli.start(bun.default_allocator, stdout, stderr, MainPanicHandler); } - -pub const build_options = @import("build_options"); diff --git a/src/napi/napi.zig b/src/napi/napi.zig index f747fb785a8b4..b45ffdb5a4478 100644 --- a/src/napi/napi.zig +++ b/src/napi/napi.zig @@ -25,6 +25,7 @@ fn genericFailure() napi_status { } return .generic_failure; } +const Async = bun.Async; pub const napi_env = *JSC.JSGlobalObject; pub const Ref = opaque { @@ -925,7 +926,7 @@ pub const napi_async_work = struct { can_deinit: bool = false, wait_for_deinit: bool = false, scheduled: bool = false, - ref: JSC.PollRef = .{}, + ref: Async.KeepAlive = .{}, pub const Status = enum(u32) { pending = 0, started = 1, @@ -1225,7 +1226,7 @@ pub const ThreadSafeFunction = struct { /// Neither does napi_unref_threadsafe_function mark the thread-safe /// functions as able to be destroyed nor does napi_ref_threadsafe_function /// prevent it from being destroyed. - poll_ref: JSC.PollRef, + poll_ref: Async.KeepAlive, owning_threads: std.AutoArrayHashMapUnmanaged(u64, void) = .{}, owning_thread_lock: Lock = Lock.init(), @@ -1428,7 +1429,7 @@ pub export fn napi_create_threadsafe_function( .ctx = context, .channel = ThreadSafeFunction.Queue.init(max_queue_size, bun.default_allocator), .owning_threads = .{}, - .poll_ref = JSC.PollRef.init(), + .poll_ref = Async.KeepAlive.init(), }; function.owning_threads.ensureTotalCapacity(bun.default_allocator, initial_thread_count) catch return genericFailure(); function.finalizer = .{ .ctx = thread_finalize_data, .fun = thread_finalize_cb }; diff --git a/src/network_thread.zig b/src/network_thread.zig index e1c2046a8d3c9..a2353ebd28fb9 100644 --- a/src/network_thread.zig +++ b/src/network_thread.zig @@ -28,7 +28,6 @@ pub var global_loaded: std.atomic.Atomic(u32) = std.atomic.Atomic(u32).init(0); const log = Output.scoped(.NetworkThread, true); const Global = @import("root").bun.Global; pub fn onStartIOThread(waker: AsyncIO.Waker) void { - NetworkThread.address_list_cached = NetworkThread.AddressListCache.init(@import("root").bun.default_allocator); AsyncIO.global = AsyncIO.init(1024, 0, waker) catch |err| { log: { if (comptime Environment.isLinux) { @@ -164,57 +163,10 @@ pub fn schedule(this: *@This(), batch: Batch) void { const one = @as([8]u8, @bitCast(@as(usize, batch.len))); _ = std.os.write(this.waker.fd, &one) catch @panic("Failed to write to eventfd"); } else { - this.waker.wake() catch @panic("Failed to wake"); + this.waker.wake(); } } -const CachedAddressList = struct { - address_list: *std.net.AddressList, - expire_after: u64, - key: u64, - index: ?u32 = null, - invalidated: bool = false, - pub fn hash(name: []const u8, port: u16) u64 { - var hasher = std.hash.Wyhash.init(0); - hasher.update(name); - hasher.update(":"); - hasher.update(std.mem.asBytes(&port)); - return hasher.final(); - } - - pub fn init(key: u64, address_list: *std.net.AddressList, now: u64) CachedAddressList { - return CachedAddressList{ - .address_list = address_list, - .expire_after = now + std.time.ms_per_hour, - .key = key, - }; - } - - pub fn invalidate(this: *CachedAddressList) void { - if (!this.invalidated) { - this.invalidated = true; - this.address_list.deinit(); - } - _ = address_list_cached.remove(this.key); - } -}; - -pub const AddressListCache = std.HashMap(u64, CachedAddressList, IdentityContext(u64), 80); -pub var address_list_cached: AddressListCache = undefined; -pub fn getAddressList(allocator: std.mem.Allocator, name: []const u8, port: u16) !*std.net.AddressList { - // const hash = CachedAddressList.hash(name, port); - // const now = @intCast(u64, @max(0, std.time.milliTimestamp())); - // if (address_list_cached.getPtr(hash)) |cached| { - // if (cached.expire_after > now) { - // return cached; - // } - - // cached.address_list.deinit(); - // } - - return try std.net.getAddressList(allocator, name, port); -} - pub var has_warmed = false; pub fn warmup() !void { if (has_warmed or global_loaded.load(.Monotonic) > 0) return; diff --git a/src/node-fallbacks/package.json b/src/node-fallbacks/package.json index 3d48960c5ec13..4c54b4c438df9 100644 --- a/src/node-fallbacks/package.json +++ b/src/node-fallbacks/package.json @@ -5,8 +5,8 @@ "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "build-gen": "esbuild --bundle *.js --outdir=bun --format=esm --platform=browser --external:buffer --external:stream --external:util --external:util/ --external:assert", - "build": "esbuild --bundle *.js --outdir=out --format=esm --minify --platform=browser" + "build-gen": "bash -c 'esbuild --bundle *.js --outdir=bun --format=esm --platform=browser --external:buffer --external:stream --external:util --external:util/ --external:assert'", + "build": "bash -c 'esbuild --bundle *.js --outdir=out --format=esm --minify --platform=browser'" }, "author": "", "license": "ISC", diff --git a/src/options.zig b/src/options.zig index 80dcc77813e4d..3dd733c6978d3 100644 --- a/src/options.zig +++ b/src/options.zig @@ -1907,7 +1907,7 @@ pub const TransformOptions = struct { var cwd: string = "/"; if (Environment.isWasi or Environment.isWindows) { - cwd = try std.process.getCwdAlloc(allocator); + cwd = try bun.getcwdAlloc(allocator); } var define = bun.StringHashMap(string).init(allocator); diff --git a/src/output.zig b/src/output.zig index 94f0bffa0505a..f79fd90f669e5 100644 --- a/src/output.zig +++ b/src/output.zig @@ -123,6 +123,13 @@ pub const Source = struct { if (bun.getenvZ("TERM")) |term| { return !strings.eqlComptime(term, "dumb"); } + if (Environment.isWindows) { + // https://github.com/chalk/supports-color/blob/d4f413efaf8da045c5ab440ed418ef02dbb28bf1/index.js#L100C11-L112 + // Windows 10 build 10586 is the first Windows release that supports 256 colors. + // Windows 10 build 14931 is the first release that supports 16m/TrueColor. + // Every other version supports 16 colors. + return true; + } return false; } diff --git a/src/renamer.zig b/src/renamer.zig index 9d2f7d414bbd0..72d098a2cd108 100644 --- a/src/renamer.zig +++ b/src/renamer.zig @@ -548,7 +548,7 @@ pub const NumberRenamer = struct { renamer.name_temp_allocator = renamer.name_stack_fallback.get(); renamer.number_scope_pool = bun.HiveArray(NumberScope, 128).Fallback.init(renamer.arena.allocator()); renamer.root.name_counts = root_names; - if (comptime Environment.allow_assert) { + if (comptime Environment.allow_assert and !Environment.isWindows) { if (std.os.getenv("BUN_DUMP_SYMBOLS") != null) symbols.dump(); } diff --git a/src/report.zig b/src/report.zig index 75c63a7af9cef..a9ee06be9f4bb 100644 --- a/src/report.zig +++ b/src/report.zig @@ -62,9 +62,9 @@ pub const CrashReportWriter = struct { var base_dir: []const u8 = "."; if (bun.getenvZ("BUN_INSTALL")) |install_dir| { - base_dir = std.mem.trimRight(u8, install_dir, std.fs.path.sep_str); - } else if (bun.getenvZ("HOME")) |home_dir| { - base_dir = std.mem.trimRight(u8, home_dir, std.fs.path.sep_str); + base_dir = strings.withoutTrailingSlash(install_dir); + } else if (bun.getenvZ(bun.DotEnv.home_env)) |home_dir| { + base_dir = strings.withoutTrailingSlash(home_dir); } const file_path = std.fmt.bufPrintZ( &crash_reporter_path, @@ -72,8 +72,12 @@ pub const CrashReportWriter = struct { .{ base_dir, Global.package_json_version, @as(u64, @intCast(@max(std.time.milliTimestamp(), 0))) }, ) catch return; - std.fs.cwd().makeDir(std.fs.path.dirname(bun.asByteSlice(file_path)).?) catch {}; - var file = std.fs.cwd().createFileZ(file_path, .{ .truncate = true }) catch return; + if (bun.path.nextDirname(file_path)) |dirname| { + _ = bun.sys.mkdirA(dirname, 0); + } + + const call = bun.sys.open(file_path, std.os.O.TRUNC, 0).unwrap() catch return; + var file = std.fs.File{ .handle = bun.fdcast(call) }; this.file = std.io.bufferedWriter( file.writer(), ); @@ -85,7 +89,7 @@ pub const CrashReportWriter = struct { if (this.file_path.len > 0) { var tilda = false; - if (bun.getenvZ("HOME")) |home_dir| { + if (bun.getenvZ(bun.DotEnv.home_env)) |home_dir| { if (strings.hasPrefix(display_path, home_dir)) { display_path = display_path[home_dir.len..]; tilda = true; @@ -107,8 +111,8 @@ pub fn printMetadata() void { const cmd_label: string = if (CLI.cmd) |tag| @tagName(tag) else "Unknown"; - const platform = if (Environment.isMac) "macOS" else "Linux"; - const arch = if (Environment.isAarch64) + const platform = comptime Environment.os.displayString(); + const arch = comptime if (Environment.isAarch64) if (Environment.isMac) "Silicon" else "arm64" else "x64"; diff --git a/src/resolver/package_json.zig b/src/resolver/package_json.zig index 7b1442898f2c7..26c246ca69404 100644 --- a/src/resolver/package_json.zig +++ b/src/resolver/package_json.zig @@ -592,7 +592,7 @@ pub const PackageJSON = struct { // So we cannot free these const allocator = bun.fs_allocator; - const entry = r.caches.fs.readFileWithAllocator( + var entry = r.caches.fs.readFileWithAllocator( allocator, r.fs, package_json_path, @@ -606,12 +606,7 @@ pub const PackageJSON = struct { return null; }; - - defer { - if (entry.fd != 0) { - _ = bun.sys.close(entry.fd); - } - } + defer _ = entry.closeFD(); if (r.debug_logs) |*debug| { debug.addNoteFmt("The file \"{s}\" exists", .{package_json_path}); diff --git a/src/resolver/resolve_path.zig b/src/resolver/resolve_path.zig index 381abc648189d..34ed35a5a5891 100644 --- a/src/resolver/resolve_path.zig +++ b/src/resolver/resolve_path.zig @@ -321,7 +321,7 @@ pub fn getIfExistsLongestCommonPath(input: []const []const u8) ?[]const u8 { } pub fn longestCommonPathWindows(input: []const []const u8) []const u8 { - return longestCommonPathGeneric(input, std.fs.path.sep_windows, isSepWin32); + return longestCommonPathGeneric(input, std.fs.path.sep_windows, isSepAny); } pub fn longestCommonPathPosix(input: []const []const u8) []const u8 { @@ -580,8 +580,9 @@ pub const Platform = enum { pub fn isAbsolute(comptime platform: Platform, path: []const u8) bool { return switch (comptime platform) { .auto => (comptime platform.resolve()).isAbsolute(path), - .loose, .posix => path.len > 0 and path[0] == '/', + .posix => path.len > 0 and path[0] == '/', .windows => std.fs.path.isAbsoluteWindows(path), + .loose => isAbsolute(.posix, path) or isAbsolute(.windows, path), }; } @@ -613,7 +614,7 @@ pub const Platform = enum { return isSepAny; }, .windows => { - return isSepWin32; + return isSepAny; }, .posix => { return isSepPosix; @@ -643,7 +644,7 @@ pub const Platform = enum { return isSepAny(char); }, .windows => { - return isSepWin32(char); + return isSepAny(char); }, .posix => { return isSepPosix(char); @@ -654,7 +655,7 @@ pub const Platform = enum { pub fn trailingSeparator(comptime _platform: Platform) [2]u8 { return comptime switch (_platform) { .auto => _platform.resolve().trailingSeparator(), - .windows => ".\\".*, + .windows => "./".*, .posix, .loose => "./".*, }; } @@ -727,8 +728,7 @@ pub fn normalizeBuf(str: []const u8, buf: []u8, comptime _platform: Platform) [] const is_absolute = _platform.isAbsolute(str); - const trailing_separator = - buf[buf.len - 1] == _platform.separator(); + const trailing_separator = _platform.getLastSeparatorFunc()(str) == str.len - 1; if (is_absolute and trailing_separator) return normalizeStringBuf(str, buf, true, _platform, true); @@ -820,7 +820,17 @@ threadlocal var join_buf: [4096]u8 = undefined; pub fn join(_parts: anytype, comptime _platform: Platform) []const u8 { return joinStringBuf(&join_buf, _parts, _platform); } +pub fn joinZ(_parts: anytype, comptime _platform: Platform) [:0]const u8 { + return joinZBuf(&join_buf, _parts, _platform); +} +pub fn joinZBuf(buf: []u8, _parts: anytype, comptime _platform: Platform) [:0]const u8 { + var joined = joinStringBuf(buf[0 .. buf.len - 1], _parts, _platform); + std.debug.assert(bun.isSliceInBuffer(joined, buf)); + const start_offset = @intFromPtr(joined.ptr) - @intFromPtr(buf.ptr); + buf[joined.len + start_offset] = 0; + return buf[start_offset..][0..joined.len :0]; +} pub fn joinStringBuf(buf: []u8, _parts: anytype, comptime _platform: Platform) []const u8 { if (FeatureFlags.use_std_path_join) { var alloc = std.heap.FixedBufferAllocator.init(buf); @@ -880,7 +890,7 @@ pub fn joinAbsStringBufZ(_cwd: []const u8, buf: []u8, _parts: anytype, comptime return _joinAbsStringBuf(true, [:0]const u8, _cwd, buf, _parts, _platform); } -inline fn _joinAbsStringBuf(comptime is_sentinel: bool, comptime ReturnType: type, _cwd: []const u8, buf: []u8, _parts: anytype, comptime _platform: Platform) ReturnType { +fn _joinAbsStringBuf(comptime is_sentinel: bool, comptime ReturnType: type, _cwd: []const u8, buf: []u8, _parts: anytype, comptime _platform: Platform) ReturnType { var parts: []const []const u8 = _parts; var temp_buf: [bun.MAX_PATH_BYTES * 2]u8 = undefined; if (parts.len == 0) { @@ -937,10 +947,18 @@ inline fn _joinAbsStringBuf(comptime is_sentinel: bool, comptime ReturnType: typ out += part.len; } - const leading_separator: []const u8 = if (_platform.leadingSeparatorIndex(temp_buf[0..out])) |i| - temp_buf[0 .. i + 1] - else - "/"; + const leading_separator: []const u8 = if (_platform.leadingSeparatorIndex(temp_buf[0..out])) |i| brk: { + var outdir = temp_buf[0 .. i + 1]; + if (_platform == .windows or _platform == .loose) { + for (outdir) |*c| { + if (c.* == '\\') { + c.* = '/'; + } + } + } + + break :brk outdir; + } else "/"; const result = normalizeStringBuf( temp_buf[leading_separator.len..out], @@ -973,7 +991,7 @@ pub fn isSepAny(char: u8) bool { } pub fn lastIndexOfSeparatorWindows(slice: []const u8) ?usize { - return std.mem.lastIndexOfScalar(u8, slice, std.fs.path.sep_windows); + return lastIndexOfSep(slice); } pub fn lastIndexOfSeparatorPosix(slice: []const u8) ?usize { @@ -992,7 +1010,7 @@ pub fn lastIndexOfNonSeparatorPosix(slice: []const u8) ?u32 { } pub fn lastIndexOfSeparatorLoose(slice: []const u8) ?usize { - return std.mem.lastIndexOfAny(u8, slice, "/\\"); + return lastIndexOfSep(slice); } pub fn normalizeStringLooseBuf( @@ -1022,8 +1040,8 @@ pub fn normalizeStringWindows( str, buf, allow_above_root, - std.fs.path.sep_windows, - isSepWin32, + std.fs.path.sep_posix, + isSepAny, lastIndexOfSeparatorWindows, preserve_trailing_slash, ); @@ -1421,3 +1439,69 @@ test "longestCommonPath" { _ = t.expect("/app/", longestCommonPath(&more), @src()); _ = t.expect("/app/public/", longestCommonPath(more[0..2]), @src()); } + +pub fn basename(path: []const u8) []const u8 { + if (path.len == 0) + return &[_]u8{}; + + var end_index: usize = path.len - 1; + while (isSepAny(path[end_index])) { + if (end_index == 0) + return &[_]u8{}; + end_index -= 1; + } + var start_index: usize = end_index; + end_index += 1; + while (!isSepAny(path[start_index])) { + if (start_index == 0) + return path[0..end_index]; + start_index -= 1; + } + + return path[start_index + 1 .. end_index]; +} +pub fn lastIndexOfSep(path: []const u8) ?usize { + if (comptime !bun.Environment.isWindows) { + return strings.lastIndexOfChar(path, '/'); + } + + return std.mem.lastIndexOfAny(u8, path, "/\\"); +} + +pub fn nextDirname(path_: []const u8) ?[]const u8 { + var path = path_; + var root_prefix: []const u8 = ""; + if (path.len > 3) { + // disk designator + if (path[1] == ':' and isSepAny(path[2])) { + root_prefix = path[0..3]; + } + + // TODO: unc path + + } + + if (path.len == 0) + return if (root_prefix.len > 0) root_prefix else null; + + var end_index: usize = path.len - 1; + while (isSepAny(path[end_index])) { + if (end_index == 0) + return if (root_prefix.len > 0) root_prefix else null; + end_index -= 1; + } + + while (!isSepAny(path[end_index])) { + if (end_index == 0) + return if (root_prefix.len > 0) root_prefix else null; + end_index -= 1; + } + + if (end_index == 0 and isSepAny(path[0])) + return path[0..1]; + + if (end_index == 0) + return if (root_prefix.len > 0) root_prefix else null; + + return path[0 .. end_index + 1]; +} diff --git a/src/resolver/resolver.zig b/src/resolver/resolver.zig index 7c8f37aacddf5..7e39a062c13e0 100644 --- a/src/resolver/resolver.zig +++ b/src/resolver/resolver.zig @@ -2298,7 +2298,7 @@ pub const Resolver = struct { ) !?*TSConfigJSON { // Since tsconfig.json is cached permanently, in our DirEntries cache // we must use the global allocator - const entry = try r.caches.fs.readFileWithAllocator( + var entry = try r.caches.fs.readFileWithAllocator( bun.fs_allocator, r.fs, file, @@ -2306,7 +2306,7 @@ pub const Resolver = struct { false, null, ); - _ = bun.sys.close(entry.fd); + defer _ = entry.closeFD(); // The file name needs to be persistent because it can have errors // and if those errors need to print the filename @@ -2410,7 +2410,7 @@ pub const Resolver = struct { return r.dir_cache.get(path); } - inline fn dirInfoCachedMaybeLog(r: *ThisResolver, __path: string, comptime enable_logging: bool, comptime follow_symlinks: bool) !?*DirInfo { + fn dirInfoCachedMaybeLog(r: *ThisResolver, __path: string, comptime enable_logging: bool, comptime follow_symlinks: bool) !?*DirInfo { r.mutex.lock(); defer r.mutex.unlock(); var _path = __path; @@ -2437,7 +2437,8 @@ pub const Resolver = struct { .status = .not_found, }; const root_path = if (comptime Environment.isWindows) - std.fs.path.diskDesignator(path) + // std.fs.path.diskDesignator(path) + path[0..3] else // we cannot just use "/" // we will write to the buffer past the ptr len so it must be a non-const buffer @@ -2449,6 +2450,7 @@ pub const Resolver = struct { while (!strings.eql(top, root_path)) : (top = Dirname.dirname(top)) { var result = try r.dir_cache.getOrPut(top); + if (result.status != .unknown) { top_parent = result; break; @@ -2531,14 +2533,23 @@ pub const Resolver = struct { defer path.ptr[queue_top.unsafe_path.len] = prev_char; var sentinel = path.ptr[0..queue_top.unsafe_path.len :0]; - _open_dir = std.fs.openIterableDirAbsoluteZ( - sentinel, - .{ - .no_follow = !follow_symlinks, - }, - ); + if (comptime Environment.isPosix) { + _open_dir = std.fs.openIterableDirAbsoluteZ( + sentinel, + .{ + .no_follow = !follow_symlinks, + }, + ); + } else if (comptime Environment.isWindows) { + const dirfd_result = bun.sys.openDirAtWindowsA(bun.invalid_fd, sentinel, true, !follow_symlinks); + if (dirfd_result.unwrap()) |result| { + _open_dir = std.fs.IterableDir{ .dir = .{ .fd = bun.fdcast(result) } }; + } else |err| { + _open_dir = err; + } + } + bun.fs.debug("open({s}) = {any}", .{ sentinel, _open_dir }); - // } } const open_dir = if (queue_top.fd != 0) std.fs.IterableDir{ .dir = .{ .fd = bun.fdcast(queue_top.fd) } } else (_open_dir catch |err| { @@ -3856,9 +3867,12 @@ pub const Resolver = struct { // not sure why this needs cwd but we'll just pass in the dir of the tsconfig... var abs_path = ResolvePath.joinAbsStringBuf(ts_dir_name, bufs(.tsconfig_path_abs), &[_]string{ ts_dir_name, current.extends }, .auto); var parent_config_maybe = r.parseTSConfig(abs_path, 0) catch |err| { - r.log.addDebugFmt(null, logger.Loc.Empty, r.allocator, "{s} loading tsconfig.json extends {}", .{ @errorName(err), strings.QuotedFormatter{ - .text = abs_path, - } }) catch {}; + r.log.addDebugFmt(null, logger.Loc.Empty, r.allocator, "{s} loading tsconfig.json extends {}", .{ + @errorName(err), + strings.QuotedFormatter{ + .text = abs_path, + }, + }) catch {}; break; }; if (parent_config_maybe) |parent_config| { @@ -3900,28 +3914,46 @@ pub const Resolver = struct { }; pub const Dirname = struct { - pub fn dirname(path: string) string { + pub fn dirname(path_: string) string { + var path = path_; + const root = brk: { + if (Environment.isWindows) { + if (path.len > 1 and path[1] == ':' and switch (path[0]) { + 'A'...'Z', 'a'...'z' => true, + else => false, + }) { + break :brk path[0..2]; + } + + // TODO: UNC paths + // TODO: NT paths + break :brk "/c/"; + } + + break :brk "/"; + }; + if (path.len == 0) - return "/"; + return root; var end_index: usize = path.len - 1; - while (path[end_index] == '/') { + while (bun.path.isSepAny(path[end_index])) { if (end_index == 0) - return "/"; + return root; end_index -= 1; } - while (path[end_index] != '/') { + while (!bun.path.isSepAny(path[end_index])) { if (end_index == 0) - return "/"; + return root; end_index -= 1; } - if (end_index == 0 and path[0] == '/') + if (end_index == 0 and bun.path.isSepAny(path[0])) return path[0..1]; if (end_index == 0) - return "/"; + return root; return path[0 .. end_index + 1]; } diff --git a/src/string_immutable.zig b/src/string_immutable.zig index 8e6dc0ab2af15..309d394fa2395 100644 --- a/src/string_immutable.zig +++ b/src/string_immutable.zig @@ -711,7 +711,11 @@ pub inline fn endsWithChar(self: string, char: u8) bool { pub fn withoutTrailingSlash(this: string) []const u8 { var href = this; - while (href.len > 1 and href[href.len - 1] == '/') { + while (href.len > 1 and (switch (href[href.len - 1]) { + '/' => true, + '\\' => true, + else => false, + })) { href.len -= 1; } @@ -1603,16 +1607,93 @@ pub fn fromWPath(buf: []u8, utf16: []const u16) [:0]const u8 { return buf[0..encode_into_result.written :0]; } +pub fn toNTPath(wbuf: []u16, utf8: []const u8) [:0]const u16 { + if (!std.fs.path.isAbsoluteWindows(utf8)) { + return toWPathNormalized(wbuf, utf8); + } + + wbuf[0..4].* = [_]u16{ '\\', '?', '?', '\\' }; + return wbuf[0 .. toWPathNormalized(wbuf[4..], utf8).len + 4 :0]; +} + +// These are the same because they don't have rules like needing a trailing slash +pub const toNTDir = toNTPath; + +pub fn toExtendedPathNormalized(wbuf: []u16, utf8: []const u8) [:0]const u16 { + std.debug.assert(wbuf.len > 4); + wbuf[0..4].* = [_]u16{ '\\', '\\', '?', '\\' }; + return wbuf[0 .. toWPathNormalized(wbuf[4..], utf8).len + 4 :0]; +} + +pub fn toWPathNormalizeAutoExtend(wbuf: []u16, utf8: []const u8) [:0]const u16 { + if (std.fs.path.isAbsoluteWindows(utf8)) { + return toExtendedPathNormalized(wbuf, utf8); + } + + return toWPathNormalized(wbuf, utf8); +} + +pub fn toWPathNormalized(wbuf: []u16, utf8: []const u8) [:0]const u16 { + var renormalized: [bun.MAX_PATH_BYTES]u8 = undefined; + var path_to_use = utf8; + + if (bun.strings.containsChar(utf8, '/')) { + @memcpy(renormalized[0..utf8.len], utf8); + for (renormalized[0..utf8.len]) |*c| { + if (c.* == '/') { + c.* = '\\'; + } + } + path_to_use = renormalized[0..utf8.len]; + } + + // is there a trailing slash? Let's remove it before converting to UTF-16 + if (path_to_use.len > 3 and bun.path.isSepAny(path_to_use[path_to_use.len - 1])) { + path_to_use = path_to_use[0 .. path_to_use.len - 1]; + } + + return toWPath(wbuf, path_to_use); +} + +pub fn toWDirNormalized(wbuf: []u16, utf8: []const u8) [:0]const u16 { + var renormalized: [bun.MAX_PATH_BYTES]u8 = undefined; + var path_to_use = utf8; + + if (bun.strings.containsChar(utf8, '/')) { + @memcpy(renormalized[0..utf8.len], utf8); + for (renormalized[0..utf8.len]) |*c| { + if (c.* == '/') { + c.* = '\\'; + } + } + path_to_use = renormalized[0..utf8.len]; + } + + return toWDirPath(wbuf, path_to_use); +} + pub fn toWPath(wbuf: []u16, utf8: []const u8) [:0]const u16 { + return toWPathMaybeDir(wbuf, utf8, false); +} + +pub fn toWDirPath(wbuf: []u16, utf8: []const u8) [:0]const u16 { + return toWPathMaybeDir(wbuf, utf8, true); +} + +pub fn toWPathMaybeDir(wbuf: []u16, utf8: []const u8, comptime add_trailing_lash: bool) [:0]const u16 { std.debug.assert(wbuf.len > 0); var result = bun.simdutf.convert.utf8.to.utf16.with_errors.le( utf8, - wbuf[0..wbuf.len -| 1], + wbuf[0..wbuf.len -| (1 + @as(usize, @intFromBool(add_trailing_lash)))], ); - // TODO: error handling - // if (result.status == .surrogate) { - // } + if (add_trailing_lash and result.count > 0 and wbuf[result.count - 1] != '\\') { + wbuf[result.count] = '\\'; + result.count += 1; + } + + wbuf[result.count] = 0; + return wbuf[0..result.count :0]; } @@ -4156,6 +4237,18 @@ pub fn formatUTF16(slice_: []align(1) const u16, writer: anytype) !void { return formatUTF16Type([]align(1) const u16, slice_, writer); } +pub const FormatUTF16 = struct { + buf: []const u16, + pub fn format(self: @This(), comptime _: []const u8, opts: anytype, writer: anytype) !void { + _ = opts; + try formatUTF16Type([]const u16, self.buf, writer); + } +}; + +pub fn fmtUTF16(buf: []const u16) FormatUTF16 { + return FormatUTF16{ .buf = buf }; +} + pub fn formatLatin1(slice_: []const u8, writer: anytype) !void { var chunk = getSharedBuffer(); var slice = slice_; diff --git a/src/sync.zig b/src/sync.zig index 5e57f7c6c53a9..befa7b73abb49 100644 --- a/src/sync.zig +++ b/src/sync.zig @@ -373,17 +373,17 @@ pub fn Channel( pub usingnamespace switch (buffer_type) { .Static => struct { - pub fn init() Self { + pub inline fn init() Self { return Self.withBuffer(Buffer.init()); } }, .Slice => struct { - pub fn init(buf: []T) Self { + pub inline fn init(buf: []T) Self { return Self.withBuffer(Buffer.init(buf)); } }, .Dynamic => struct { - pub fn init(allocator: std.mem.Allocator) Self { + pub inline fn init(allocator: std.mem.Allocator) Self { return Self.withBuffer(Buffer.init(allocator)); } }, diff --git a/src/sys.zig b/src/sys.zig index b7542b44f3c5a..b73c9b508bfc6 100644 --- a/src/sys.zig +++ b/src/sys.zig @@ -148,10 +148,13 @@ pub fn chdirOSPath(destination: bun.OSPathSlice) Maybe(void) { } if (comptime Environment.isWindows) { - if (kernel32.SetCurrentDirectory(destination) != 0) { + if (kernel32.SetCurrentDirectory(destination) == windows.FALSE) { + log("SetCurrentDirectory({}) = {d}", .{ bun.strings.fmtUTF16(destination), kernel32.GetLastError() }); return Maybe(void).errnoSys(0, .chdir) orelse Maybe(void).success; } + log("SetCurrentDirectory({}) = {d}", .{ bun.strings.fmtUTF16(destination), 0 }); + return Maybe(void).success; } @@ -188,7 +191,7 @@ pub fn chdir(destination: anytype) Maybe(void) { } var wbuf: bun.MAX_WPATH = undefined; - return chdirOSPath(bun.strings.toWPath(&wbuf, destination)); + return chdirOSPath(bun.strings.toWDirPath(&wbuf, destination)); } return Maybe(void).todo; @@ -237,6 +240,31 @@ pub fn mkdir(file_path: [:0]const u8, flags: bun.Mode) Maybe(void) { return Maybe(void).errnoSysP(0, .mkdir, file_path) orelse Maybe(void).success; } +pub fn mkdirA(file_path: []const u8, flags: bun.Mode) Maybe(void) { + if (comptime Environment.isMac) { + return Maybe(void).errnoSysP(system.mkdir(&(std.os.toPosixPath(file_path) catch return Maybe(void){ + .err = .{ + .errno = @intFromEnum(bun.C.E.NOMEM), + .syscall = .open, + }, + }), flags), .mkdir, file_path) orelse Maybe(void).success; + } + + if (comptime Environment.isLinux) { + return Maybe(void).errnoSysP(linux.mkdir(&(std.os.toPosixPath(file_path) catch return Maybe(void){ + .err = .{ + .errno = @intFromEnum(bun.C.E.NOMEM), + .syscall = .open, + }, + }), flags), .mkdir, file_path) orelse Maybe(void).success; + } + + var wbuf: bun.MAX_WPATH = undefined; + _ = kernel32.CreateDirectoryW(bun.strings.toWPath(&wbuf, file_path).ptr, null); + + return Maybe(void).errnoSysP(0, .mkdir, file_path) orelse Maybe(void).success; +} + pub fn fcntl(fd_: bun.FileDescriptor, cmd: i32, arg: usize) Maybe(usize) { const fd = bun.fdcast(fd_); const result = fcntl_symbol(fd, cmd, arg); @@ -299,11 +327,90 @@ pub fn getErrno(rc: anytype) bun.C.E { const O = std.os.O; const w = std.os.windows; +pub fn openDirAtWindows( + dirFd: bun.FileDescriptor, + path: [:0]const u16, + iterable: bool, + no_follow: bool, +) Maybe(bun.FileDescriptor) { + const base_flags = w.STANDARD_RIGHTS_READ | w.FILE_READ_ATTRIBUTES | w.FILE_READ_EA | + w.SYNCHRONIZE | w.FILE_TRAVERSE; + const flags: u32 = if (iterable) base_flags | w.FILE_LIST_DIRECTORY else base_flags; + + const path_len_bytes: u16 = @truncate(path.len * 2); + var nt_name = w.UNICODE_STRING{ + .Length = path_len_bytes, + .MaximumLength = path_len_bytes, + .Buffer = @constCast(path.ptr), + }; + var attr = w.OBJECT_ATTRIBUTES{ + .Length = @sizeOf(w.OBJECT_ATTRIBUTES), + .RootDirectory = if (std.fs.path.isAbsoluteWindowsW(path)) null else bun.fdcast(dirFd), + .Attributes = 0, // Note we do not use OBJ_CASE_INSENSITIVE here. + .ObjectName = &nt_name, + .SecurityDescriptor = null, + .SecurityQualityOfService = null, + }; + const open_reparse_point: w.DWORD = if (no_follow) w.FILE_OPEN_REPARSE_POINT else 0x0; + var fd: w.HANDLE = w.INVALID_HANDLE_VALUE; + var io: w.IO_STATUS_BLOCK = undefined; + const rc = w.ntdll.NtCreateFile( + &fd, + flags, + &attr, + &io, + null, + 0, + w.FILE_SHARE_READ | w.FILE_SHARE_WRITE, + w.FILE_OPEN, + w.FILE_DIRECTORY_FILE | w.FILE_SYNCHRONOUS_IO_NONALERT | w.FILE_OPEN_FOR_BACKUP_INTENT | open_reparse_point, + null, + 0, + ); + + if (comptime Environment.allow_assert) { + log("NtCreateFile({d}, {}) = {d} (dir)", .{ dirFd, bun.strings.fmtUTF16(path), rc }); + } + + switch (windows.Win32Error.fromNTStatus(rc)) { + .SUCCESS => { + return JSC.Maybe(bun.FileDescriptor){ + .result = bun.toFD(fd), + }; + }, + else => |code| { + if (code.toSystemErrno()) |sys_err| { + return .{ + .err = .{ + .errno = @truncate(@intFromEnum(sys_err)), + .syscall = .open, + }, + }; + } + + return .{ + .err = .{ + .errno = @intFromEnum(bun.C.E.UNKNOWN), + .syscall = .open, + }, + }; + }, + } +} + +pub noinline fn openDirAtWindowsA( + dirFd: bun.FileDescriptor, + path: []const u8, + iterable: bool, + no_follow: bool, +) Maybe(bun.FileDescriptor) { + var wbuf: bun.MAX_WPATH = undefined; + return openDirAtWindows(dirFd, bun.strings.toNTDir(&wbuf, path), iterable, no_follow); +} pub fn openatWindows(dirfD: bun.FileDescriptor, path: []const u16, flags: bun.Mode) Maybe(bun.FileDescriptor) { const nonblock = flags & O.NONBLOCK != 0; var access_mask: w.ULONG = w.READ_CONTROL | w.FILE_WRITE_ATTRIBUTES | w.SYNCHRONIZE; - if (flags & O.RDWR != 0) { access_mask |= w.GENERIC_READ | w.GENERIC_WRITE; } else if (flags & O.WRONLY != 0) { @@ -348,6 +455,7 @@ pub fn openatWindows(dirfD: bun.FileDescriptor, path: []const u16, flags: bun.Mo if (flags & O.EXCL != 0) { break :blk w.FILE_CREATE; } + break :blk w.FILE_OPEN_IF; } break :blk w.FILE_OPEN; }; @@ -368,6 +476,11 @@ pub fn openatWindows(dirfD: bun.FileDescriptor, path: []const u16, flags: bun.Mo null, 0, ); + + if (comptime Environment.allow_assert) { + log("NtCreateFile({d}, {}) = {d} (file)", .{ dirfD, bun.strings.fmtUTF16(path), rc }); + } + switch (windows.Win32Error.fromNTStatus(rc)) { .SUCCESS => { return JSC.Maybe(bun.FileDescriptor){ @@ -399,7 +512,8 @@ pub fn openatOSPath(dirfd: bun.FileDescriptor, file_path: bun.OSPathSlice, flags if (comptime Environment.isMac) { // https://opensource.apple.com/source/xnu/xnu-7195.81.3/libsyscall/wrappers/open-base.c const rc = bun.AsyncIO.darwin.@"openat$NOCANCEL"(dirfd, file_path.ptr, @as(c_uint, @intCast(flags)), @as(c_int, @intCast(perm))); - log("openat({d}, {s}) = {d}", .{ dirfd, file_path, rc }); + if (comptime Environment.allow_assert) + log("openat({d}, {s}) = {d}", .{ dirfd, file_path, rc }); return switch (Syscall.getErrno(rc)) { .SUCCESS => .{ .result = @as(bun.FileDescriptor, @intCast(rc)) }, @@ -418,7 +532,8 @@ pub fn openatOSPath(dirfd: bun.FileDescriptor, file_path: bun.OSPathSlice, flags while (true) { const rc = Syscall.system.openat(@as(Syscall.system.fd_t, @intCast(dirfd)), file_path, flags, perm); - log("openat({d}, {s}) = {d}", .{ dirfd, file_path, rc }); + if (comptime Environment.allow_assert) + log("openat({d}, {s}) = {d}", .{ dirfd, file_path, rc }); return switch (Syscall.getErrno(rc)) { .SUCCESS => .{ .result = @as(bun.FileDescriptor, @intCast(rc)) }, .INTR => continue, @@ -438,13 +553,45 @@ pub fn openatOSPath(dirfd: bun.FileDescriptor, file_path: bun.OSPathSlice, flags pub fn openat(dirfd: bun.FileDescriptor, file_path: [:0]const u8, flags: bun.Mode, perm: bun.Mode) Maybe(bun.FileDescriptor) { if (comptime Environment.isWindows) { + if (flags & O.DIRECTORY != 0) { + return openDirAtWindowsA(dirfd, file_path, false, flags & O.NOFOLLOW != 0); + } + var wbuf: bun.MAX_WPATH = undefined; - return openatWindows(dirfd, bun.strings.toWPath(&wbuf, file_path), flags); + return openatWindows(dirfd, bun.strings.toNTPath(&wbuf, file_path), flags); } return openatOSPath(dirfd, file_path, flags, perm); } +pub fn openatA(dirfd: bun.FileDescriptor, file_path: []const u8, flags: bun.Mode, perm: bun.Mode) Maybe(bun.FileDescriptor) { + if (comptime Environment.isWindows) { + if (flags & O.DIRECTORY != 0) { + return openDirAtWindowsA(dirfd, file_path, false, flags & O.NOFOLLOW != 0); + } + + var wbuf: bun.MAX_WPATH = undefined; + return openatWindows(dirfd, bun.strings.toNTPath(&wbuf, file_path), flags); + } + + return openatOSPath( + dirfd, + &(std.os.toPosixPath(file_path) catch return Maybe(bun.FileDescriptor){ + .err = .{ + .errno = @intFromEnum(bun.C.E.NOMEM), + .syscall = .open, + }, + }), + flags, + perm, + ); +} + +pub fn openA(file_path: []const u8, flags: bun.Mode, perm: bun.Mode) Maybe(bun.FileDescriptor) { + // this is what open() does anyway. + return openatA(bun.toFD((std.fs.cwd().fd)), file_path, flags, perm); +} + pub fn open(file_path: [:0]const u8, flags: bun.Mode, perm: bun.Mode) Maybe(bun.FileDescriptor) { // this is what open() does anyway. return openat(bun.toFD((std.fs.cwd().fd)), file_path, flags, perm); @@ -463,6 +610,7 @@ pub fn close(fd: bun.FileDescriptor) ?Syscall.Error { pub fn closeAllowingStdoutAndStderr(fd: bun.FileDescriptor) ?Syscall.Error { log("close({d})", .{fd}); std.debug.assert(fd != bun.invalid_fd); + if (comptime std.meta.trait.isSignedInt(@TypeOf(fd))) std.debug.assert(fd > -1); @@ -482,6 +630,8 @@ pub fn closeAllowingStdoutAndStderr(fd: bun.FileDescriptor) ?Syscall.Error { } if (comptime Environment.isWindows) { + std.debug.assert(fd != 0); + if (kernel32.CloseHandle(bun.fdcast(fd)) == 0) { return Syscall.Error{ .errno = @intFromEnum(os.E.BADF), .syscall = .close }; } @@ -1240,6 +1390,20 @@ pub fn existsOSPath(path: bun.OSPathSlice) bool { @compileError("TODO: existsOSPath"); } +pub fn exists(path: []const u8) bool { + if (comptime Environment.isPosix) { + return system.access(&(std.os.toPosixPath(path) catch return false), 0) == 0; + } + + if (comptime Environment.isWindows) { + var wbuf: bun.MAX_WPATH = undefined; + const path_to_use = bun.strings.toWPath(&wbuf, path); + return kernel32.GetFileAttributesW(path_to_use.ptr) != os.windows.INVALID_FILE_ATTRIBUTES; + } + + @compileError("TODO: existsOSPath"); +} + pub fn isExecutableFileOSPath(path: bun.OSPathSlice) bool { if (comptime Environment.isPosix) { return bun.is_executable_fileZ(path); @@ -1248,7 +1412,7 @@ pub fn isExecutableFileOSPath(path: bun.OSPathSlice) bool { if (comptime Environment.isWindows) { var out: windows.DWORD = 8; const rc = kernel32.GetBinaryTypeW(path, &out); - log("GetBinaryTypeW({}) = {d}", .{ bun.String.init(path), out }); + log("GetBinaryTypeW({}) = {d}", .{ bun.strings.fmtUTF16(path), out }); if (rc == windows.FALSE) { return false; @@ -1275,7 +1439,9 @@ pub fn isExecutableFilePath(path: anytype) bool { switch (Type) { *[*:0]const u8, *[*:0]u8, [*:0]const u8, [*:0]u8 => return bun.is_executable_fileZ(path), [:0]const u8, [:0]u8 => return bun.is_executable_fileZ(path.ptr), - []const u8, []u8 => return bun.is_executable_fileZ(&(std.os.toPosixPath(path) catch return false)), + []const u8, []u8 => return bun.is_executable_fileZ( + &(std.os.toPosixPath(path) catch return false), + ), else => @compileError("TODO: isExecutableFilePath"), } } @@ -1346,3 +1512,27 @@ pub fn dup(fd: bun.FileDescriptor) Maybe(bun.FileDescriptor) { const out = std.c.dup(fd); return Maybe(bun.FileDescriptor).errnoSysFd(out, .dup, fd) orelse Maybe(bun.FileDescriptor){ .result = bun.toFD(out) }; } + +pub fn linkat(dir_fd: bun.FileDescriptor, basename: []const u8, dest_dir_fd: bun.FileDescriptor, dest_name: []const u8) Maybe(void) { + return Maybe(void).errnoSysP( + std.c.linkat( + @intCast(dir_fd), + &(std.os.toPosixPath(basename) catch return .{ + .err = .{ + .errno = @intFromEnum(bun.C.E.NOMEM), + .syscall = .open, + }, + }), + @intCast(dest_dir_fd), + &(std.os.toPosixPath(dest_name) catch return .{ + .err = .{ + .errno = @intFromEnum(bun.C.E.NOMEM), + .syscall = .open, + }, + }), + 0, + ), + .link, + basename, + ) orelse Maybe(void).success; +} diff --git a/src/tracy.zig b/src/tracy.zig index a51420f02165e..a1eab78559f08 100644 --- a/src/tracy.zig +++ b/src/tracy.zig @@ -538,14 +538,14 @@ fn dlsym(comptime Type: type, comptime symbol: [:0]const u8) ?Type { 0; if (bun.getenvZ("BUN_TRACY_PATH")) |path| { - const handle = std.c.dlopen(&(std.os.toPosixPath(path) catch unreachable), RLTD); + const handle = bun.C.dlopen(&(std.os.toPosixPath(path) catch unreachable), RLTD); if (handle != null) { Handle.handle = handle; break :get; } } inline for (comptime paths_to_try) |path| { - const handle = std.c.dlopen(path, RLTD); + const handle = bun.C.dlopen(path, RLTD); if (handle != null) { Handle.handle = handle; break; diff --git a/src/watcher.zig b/src/watcher.zig index 98cf5aa2961a7..379af80018307 100644 --- a/src/watcher.zig +++ b/src/watcher.zig @@ -117,7 +117,7 @@ pub const INotify = struct { std.debug.assert(!loaded_inotify); loaded_inotify = true; - if (std.os.getenvZ("BUN_INOTIFY_COALESCE_INTERVAL")) |env| { + if (bun.getenvZ("BUN_INOTIFY_COALESCE_INTERVAL")) |env| { coalesce_interval = std.fmt.parseInt(isize, env, 10) catch 100_000; } diff --git a/src/which.zig b/src/which.zig index ec4157161fe43..2a0dc77940376 100644 --- a/src/which.zig +++ b/src/which.zig @@ -52,10 +52,10 @@ pub fn which(buf: *[bun.MAX_PATH_BYTES]u8, path: []const u8, cwd: []const u8, bi test "which" { var buf: [bun.MAX_PATH_BYTES]u8 = undefined; var realpath = bun.getenvZ("PATH") orelse unreachable; - var whichbin = which(&buf, realpath, try std.process.getCwdAlloc(std.heap.c_allocator), "which"); + var whichbin = which(&buf, realpath, try bun.getcwdAlloc(std.heap.c_allocator), "which"); try std.testing.expectEqualStrings(whichbin orelse return std.debug.assert(false), "/usr/bin/which"); - try std.testing.expect(null == which(&buf, realpath, try std.process.getCwdAlloc(std.heap.c_allocator), "baconnnnnn")); - try std.testing.expect(null != which(&buf, realpath, try std.process.getCwdAlloc(std.heap.c_allocator), "zig")); - try std.testing.expect(null == which(&buf, realpath, try std.process.getCwdAlloc(std.heap.c_allocator), "bin")); - try std.testing.expect(null == which(&buf, realpath, try std.process.getCwdAlloc(std.heap.c_allocator), "usr")); + try std.testing.expect(null == which(&buf, realpath, try bun.getcwdAlloc(std.heap.c_allocator), "baconnnnnn")); + try std.testing.expect(null != which(&buf, realpath, try bun.getcwdAlloc(std.heap.c_allocator), "zig")); + try std.testing.expect(null == which(&buf, realpath, try bun.getcwdAlloc(std.heap.c_allocator), "bin")); + try std.testing.expect(null == which(&buf, realpath, try bun.getcwdAlloc(std.heap.c_allocator), "usr")); } diff --git a/src/windows.zig b/src/windows.zig index 359b8189761b0..12531fa7c8da7 100644 --- a/src/windows.zig +++ b/src/windows.zig @@ -10,6 +10,7 @@ pub const LPCVOID = windows.LPCVOID; pub const LPWSTR = windows.LPWSTR; pub const LPCWSTR = windows.LPCWSTR; pub const LPSTR = windows.LPSTR; +pub const WCHAR = windows.WCHAR; pub const LPCSTR = windows.LPCSTR; pub const FALSE = windows.FALSE; pub const TRUE = windows.TRUE; @@ -22,6 +23,10 @@ pub const UNICODE_STRING = windows.UNICODE_STRING; pub const NTSTATUS = windows.NTSTATUS; pub const NT_SUCCESS = windows.NT_SUCCESS; pub const STATUS_SUCCESS = windows.STATUS_SUCCESS; +pub const MOVEFILE_COPY_ALLOWED = 0x2; +pub const MOVEFILE_REPLACE_EXISTING = 0x1; +pub const MOVEFILE_WRITE_THROUGH = 0x8; + pub const DUPLICATE_SAME_ACCESS = windows.DUPLICATE_SAME_ACCESS; pub const OBJECT_ATTRIBUTES = windows.OBJECT_ATTRIBUTES; pub const kernel32 = windows.kernel32; @@ -95,10 +100,10 @@ pub const SCS_POSIX_BINARY = 4; /// The current directory is shared by all threads of the process: If one thread changes the current directory, it affects all threads in the process. Multithreaded applications and shared library code should avoid calling the SetCurrentDirectory function due to the risk of affecting relative path calculations being performed by other threads. Conversely, multithreaded applications and shared library code should avoid using relative paths so that they are unaffected by changes to the current directory performed by other threads. /// /// Note that the current directory for a process is locked while the process is executing. This will prevent the directory from being deleted, moved, or renamed. -pub extern "kernel32" fn SetCurrentDirectory( +pub extern "kernel32" fn SetCurrentDirectoryW( lpPathName: win32.LPCWSTR, ) callconv(windows.WINAPI) win32.BOOL; - +pub const SetCurrentDirectory = SetCurrentDirectoryW; pub extern "ntdll" fn RtlNtStatusToDosError(win32.NTSTATUS) callconv(windows.WINAPI) Win32Error; const SystemErrno = bun.C.SystemErrno; @@ -2907,6 +2912,13 @@ pub const Win32Error = enum(u16) { return @enumFromInt(@intFromEnum(bun.windows.kernel32.GetLastError())); } + pub fn unwrap(this: @This()) !void { + if (this == .SUCCESS) return; + if (this.toSystemErrno()) |err| { + return err.toError(); + } + } + pub fn toSystemErrno(this: Win32Error) ?SystemErrno { return SystemErrno.init(this); } @@ -2915,3 +2927,34 @@ pub const Win32Error = enum(u16) { return RtlNtStatusToDosError(status); } }; + +pub const libuv = @import("./deps/libuv.zig"); + +pub extern fn GetProcAddress( + ptr: ?*anyopaque, + [*:0]const u16, +) ?*anyopaque; + +pub fn GetProcAddressA( + ptr: ?*anyopaque, + utf8: [:0]const u8, +) ?*anyopaque { + var wbuf: [2048]u16 = undefined; + return GetProcAddress(ptr, bun.strings.toWPath(&wbuf, utf8).ptr); +} + +pub extern fn LoadLibraryA( + [*:0]const u8, +) ?*anyopaque; + +pub extern "kernel32" fn CreateHardLinkW( + newFileName: [*:0]const u16, + existingFileName: [*:0]const u16, + securityAttributes: ?*win32.SECURITY_ATTRIBUTES, +) win32.BOOL; + +pub extern "kernel32" fn CopyFileW( + source: [*:0]const u16, + dest: [*:0]const u16, + bFailIfExists: win32.BOOL, +) win32.BOOL; diff --git a/src/windows_c.zig b/src/windows_c.zig index 5101d7ffb27b2..e740f05957abb 100644 --- a/src/windows_c.zig +++ b/src/windows_c.zig @@ -180,142 +180,142 @@ pub const SystemErrno = enum(u8) { pub const max = 137; pub const Error = error{ - PERM, - NOENT, - SRCH, - INTR, - IO, - NXIO, - @"2BIG", - NOEXEC, - BADF, - CHILD, - AGAIN, - NOMEM, - ACCES, - FAULT, - NOTBLK, - BUSY, - EXIST, - XDEV, - NODEV, - NOTDIR, - ISDIR, - INVAL, - NFILE, - MFILE, - NOTTY, - TXTBSY, - FBIG, - NOSPC, - SPIPE, - ROFS, - MLINK, - PIPE, - DOM, - RANGE, - DEADLK, - NAMETOOLONG, - NOLCK, - NOSYS, - NOTEMPTY, - LOOP, - WOULDBLOCK, - NOMSG, - IDRM, - CHRNG, - L2NSYNC, - L3HLT, - L3RST, - LNRNG, - UNATCH, - NOCSI, - L2HLT, - BADE, - BADR, - XFULL, - NOANO, - BADRQC, - BADSLT, - DEADLOCK, - BFONT, - NOSTR, - NODATA, - TIME, - NOSR, - NONET, - NOPKG, - REMOTE, - NOLINK, - ADV, - SRMNT, - COMM, - PROTO, - MULTIHOP, - DOTDOT, - BADMSG, - OVERFLOW, - NOTUNIQ, - BADFD, - REMCHG, - LIBACC, - LIBBAD, - LIBSCN, - LIBMAX, - LIBEXEC, - ILSEQ, - RESTART, - STRPIPE, - USERS, - NOTSOCK, - DESTADDRREQ, - MSGSIZE, - PROTOTYPE, - NOPROTOOPT, - PROTONOSUPPORT, - SOCKTNOSUPPORT, - NOTSUP, - PFNOSUPPORT, - AFNOSUPPORT, - ADDRINUSE, - ADDRNOTAVAIL, - NETDOWN, - NETUNREACH, - NETRESET, - CONNABORTED, - CONNRESET, - NOBUFS, - ISCONN, - NOTCONN, - SHUTDOWN, - TOOMANYREFS, - TIMEDOUT, - CONNREFUSED, - HOSTDOWN, - HOSTUNREACH, - ALREADY, - INPROGRESS, - STALE, - UCLEAN, - NOTNAM, - NAVAIL, - ISNAM, - REMOTEIO, - DQUOT, - NOMEDIUM, - MEDIUMTYPE, - CANCELED, - NOKEY, - KEYEXPIRED, - KEYREVOKED, - KEYREJECTED, - OWNERDEAD, - NOTRECOVERABLE, - RFKILL, - HWPOISON, - UNKNOWN, - CHARSET, - OF, + EPERM, + ENOENT, + ESRCH, + EINTR, + EIO, + ENXIO, + E2BIG, + ENOEXEC, + EBADF, + ECHILD, + EAGAIN, + ENOMEM, + EACCES, + EFAULT, + ENOTBLK, + EBUSY, + EEXIST, + EXDEV, + ENODEV, + ENOTDIR, + EISDIR, + EINVAL, + ENFILE, + EMFILE, + ENOTTY, + ETXTBSY, + EFBIG, + ENOSPC, + ESPIPE, + EROFS, + EMLINK, + EPIPE, + EDOM, + ERANGE, + EDEADLK, + ENAMETOOLONG, + ENOLCK, + ENOSYS, + ENOTEMPTY, + ELOOP, + EWOULDBLOCK, + ENOMSG, + EIDRM, + ECHRNG, + EL2NSYNC, + EL3HLT, + EL3RST, + ELNRNG, + EUNATCH, + ENOCSI, + EL2HLT, + EBADE, + EBADR, + EXFULL, + ENOANO, + EBADRQC, + EBADSLT, + EDEADLOCK, + EBFONT, + ENOSTR, + ENODATA, + ETIME, + ENOSR, + ENONET, + ENOPKG, + EREMOTE, + ENOLINK, + EADV, + ESRMNT, + ECOMM, + EPROTO, + EMULTIHOP, + EDOTDOT, + EBADMSG, + EOVERFLOW, + ENOTUNIQ, + EBADFD, + EREMCHG, + ELIBACC, + ELIBBAD, + ELIBSCN, + ELIBMAX, + ELIBEXEC, + EILSEQ, + ERESTART, + ESTRPIPE, + EUSERS, + ENOTSOCK, + EDESTADDRREQ, + EMSGSIZE, + EPROTOTYPE, + ENOPROTOOPT, + EPROTONOSUPPORT, + ESOCKTNOSUPPORT, + ENOTSUP, + EPFNOSUPPORT, + EAFNOSUPPORT, + EADDRINUSE, + EADDRNOTAVAIL, + ENETDOWN, + ENETUNREACH, + ENETRESET, + ECONNABORTED, + ECONNRESET, + ENOBUFS, + EISCONN, + ENOTCONN, + ESHUTDOWN, + ETOOMANYREFS, + ETIMEDOUT, + ECONNREFUSED, + EHOSTDOWN, + EHOSTUNREACH, + EALREADY, + EINPROGRESS, + ESTALE, + EUCLEAN, + ENOTNAM, + ENAVAIL, + EISNAM, + EREMOTEIO, + EDQUOT, + ENOMEDIUM, + EMEDIUMTYPE, + ECANCELED, + ENOKEY, + EKEYEXPIRED, + EKEYREVOKED, + EKEYREJECTED, + EOWNERDEAD, + ENOTRECOVERABLE, + ERFKILL, + EHWPOISON, + EUNKNOWN, + ECHARSET, + EOF, Unexpected, }; @@ -325,283 +325,283 @@ pub const SystemErrno = enum(u8) { const error_map: [SystemErrno.max]Error = brk: { var errors: [SystemErrno.max]Error = undefined; - errors[@intFromEnum(SystemErrno.EPERM)] = error.PERM; - errors[@intFromEnum(SystemErrno.ENOENT)] = error.NOENT; - errors[@intFromEnum(SystemErrno.ESRCH)] = error.SRCH; - errors[@intFromEnum(SystemErrno.EINTR)] = error.INTR; - errors[@intFromEnum(SystemErrno.EIO)] = error.IO; - errors[@intFromEnum(SystemErrno.ENXIO)] = error.NXIO; - errors[@intFromEnum(SystemErrno.E2BIG)] = error.@"2BIG"; - errors[@intFromEnum(SystemErrno.ENOEXEC)] = error.NOEXEC; - errors[@intFromEnum(SystemErrno.EBADF)] = error.BADF; - errors[@intFromEnum(SystemErrno.ECHILD)] = error.CHILD; - errors[@intFromEnum(SystemErrno.EAGAIN)] = error.AGAIN; - errors[@intFromEnum(SystemErrno.ENOMEM)] = error.NOMEM; - errors[@intFromEnum(SystemErrno.EACCES)] = error.ACCES; - errors[@intFromEnum(SystemErrno.EFAULT)] = error.FAULT; - errors[@intFromEnum(SystemErrno.ENOTBLK)] = error.NOTBLK; - errors[@intFromEnum(SystemErrno.EBUSY)] = error.BUSY; - errors[@intFromEnum(SystemErrno.EEXIST)] = error.EXIST; - errors[@intFromEnum(SystemErrno.EXDEV)] = error.XDEV; - errors[@intFromEnum(SystemErrno.ENODEV)] = error.NODEV; - errors[@intFromEnum(SystemErrno.ENOTDIR)] = error.NOTDIR; - errors[@intFromEnum(SystemErrno.EISDIR)] = error.ISDIR; - errors[@intFromEnum(SystemErrno.EINVAL)] = error.INVAL; - errors[@intFromEnum(SystemErrno.ENFILE)] = error.NFILE; - errors[@intFromEnum(SystemErrno.EMFILE)] = error.MFILE; - errors[@intFromEnum(SystemErrno.ENOTTY)] = error.NOTTY; - errors[@intFromEnum(SystemErrno.ETXTBSY)] = error.TXTBSY; - errors[@intFromEnum(SystemErrno.EFBIG)] = error.FBIG; - errors[@intFromEnum(SystemErrno.ENOSPC)] = error.NOSPC; - errors[@intFromEnum(SystemErrno.ESPIPE)] = error.SPIPE; - errors[@intFromEnum(SystemErrno.EROFS)] = error.ROFS; - errors[@intFromEnum(SystemErrno.EMLINK)] = error.MLINK; - errors[@intFromEnum(SystemErrno.EPIPE)] = error.PIPE; - errors[@intFromEnum(SystemErrno.EDOM)] = error.DOM; - errors[@intFromEnum(SystemErrno.ERANGE)] = error.RANGE; - errors[@intFromEnum(SystemErrno.EDEADLK)] = error.DEADLK; - errors[@intFromEnum(SystemErrno.ENAMETOOLONG)] = error.NAMETOOLONG; - errors[@intFromEnum(SystemErrno.ENOLCK)] = error.NOLCK; - errors[@intFromEnum(SystemErrno.ENOSYS)] = error.NOSYS; - errors[@intFromEnum(SystemErrno.ENOTEMPTY)] = error.NOTEMPTY; - errors[@intFromEnum(SystemErrno.ELOOP)] = error.LOOP; - errors[@intFromEnum(SystemErrno.EWOULDBLOCK)] = error.WOULDBLOCK; - errors[@intFromEnum(SystemErrno.ENOMSG)] = error.NOMSG; - errors[@intFromEnum(SystemErrno.EIDRM)] = error.IDRM; - errors[@intFromEnum(SystemErrno.ECHRNG)] = error.CHRNG; - errors[@intFromEnum(SystemErrno.EL2NSYNC)] = error.L2NSYNC; - errors[@intFromEnum(SystemErrno.EL3HLT)] = error.L3HLT; - errors[@intFromEnum(SystemErrno.EL3RST)] = error.L3RST; - errors[@intFromEnum(SystemErrno.ELNRNG)] = error.LNRNG; - errors[@intFromEnum(SystemErrno.EUNATCH)] = error.UNATCH; - errors[@intFromEnum(SystemErrno.ENOCSI)] = error.NOCSI; - errors[@intFromEnum(SystemErrno.EL2HLT)] = error.L2HLT; - errors[@intFromEnum(SystemErrno.EBADE)] = error.BADE; - errors[@intFromEnum(SystemErrno.EBADR)] = error.BADR; - errors[@intFromEnum(SystemErrno.EXFULL)] = error.XFULL; - errors[@intFromEnum(SystemErrno.ENOANO)] = error.NOANO; - errors[@intFromEnum(SystemErrno.EBADRQC)] = error.BADRQC; - errors[@intFromEnum(SystemErrno.EBADSLT)] = error.BADSLT; - errors[@intFromEnum(SystemErrno.EDEADLOCK)] = error.DEADLOCK; - errors[@intFromEnum(SystemErrno.EBFONT)] = error.BFONT; - errors[@intFromEnum(SystemErrno.ENOSTR)] = error.NOSTR; - errors[@intFromEnum(SystemErrno.ENODATA)] = error.NODATA; - errors[@intFromEnum(SystemErrno.ETIME)] = error.TIME; - errors[@intFromEnum(SystemErrno.ENOSR)] = error.NOSR; - errors[@intFromEnum(SystemErrno.ENONET)] = error.NONET; - errors[@intFromEnum(SystemErrno.ENOPKG)] = error.NOPKG; - errors[@intFromEnum(SystemErrno.EREMOTE)] = error.REMOTE; - errors[@intFromEnum(SystemErrno.ENOLINK)] = error.NOLINK; - errors[@intFromEnum(SystemErrno.EADV)] = error.ADV; - errors[@intFromEnum(SystemErrno.ESRMNT)] = error.SRMNT; - errors[@intFromEnum(SystemErrno.ECOMM)] = error.COMM; - errors[@intFromEnum(SystemErrno.EPROTO)] = error.PROTO; - errors[@intFromEnum(SystemErrno.EMULTIHOP)] = error.MULTIHOP; - errors[@intFromEnum(SystemErrno.EDOTDOT)] = error.DOTDOT; - errors[@intFromEnum(SystemErrno.EBADMSG)] = error.BADMSG; - errors[@intFromEnum(SystemErrno.EOVERFLOW)] = error.OVERFLOW; - errors[@intFromEnum(SystemErrno.ENOTUNIQ)] = error.NOTUNIQ; - errors[@intFromEnum(SystemErrno.EBADFD)] = error.BADFD; - errors[@intFromEnum(SystemErrno.EREMCHG)] = error.REMCHG; - errors[@intFromEnum(SystemErrno.ELIBACC)] = error.LIBACC; - errors[@intFromEnum(SystemErrno.ELIBBAD)] = error.LIBBAD; - errors[@intFromEnum(SystemErrno.ELIBSCN)] = error.LIBSCN; - errors[@intFromEnum(SystemErrno.ELIBMAX)] = error.LIBMAX; - errors[@intFromEnum(SystemErrno.ELIBEXEC)] = error.LIBEXEC; - errors[@intFromEnum(SystemErrno.EILSEQ)] = error.ILSEQ; - errors[@intFromEnum(SystemErrno.ERESTART)] = error.RESTART; - errors[@intFromEnum(SystemErrno.ESTRPIPE)] = error.STRPIPE; - errors[@intFromEnum(SystemErrno.EUSERS)] = error.USERS; - errors[@intFromEnum(SystemErrno.ENOTSOCK)] = error.NOTSOCK; - errors[@intFromEnum(SystemErrno.EDESTADDRREQ)] = error.DESTADDRREQ; - errors[@intFromEnum(SystemErrno.EMSGSIZE)] = error.MSGSIZE; - errors[@intFromEnum(SystemErrno.EPROTOTYPE)] = error.PROTOTYPE; - errors[@intFromEnum(SystemErrno.ENOPROTOOPT)] = error.NOPROTOOPT; - errors[@intFromEnum(SystemErrno.EPROTONOSUPPORT)] = error.PROTONOSUPPORT; - errors[@intFromEnum(SystemErrno.ESOCKTNOSUPPORT)] = error.SOCKTNOSUPPORT; - errors[@intFromEnum(SystemErrno.ENOTSUP)] = error.NOTSUP; - errors[@intFromEnum(SystemErrno.EPFNOSUPPORT)] = error.PFNOSUPPORT; - errors[@intFromEnum(SystemErrno.EAFNOSUPPORT)] = error.AFNOSUPPORT; - errors[@intFromEnum(SystemErrno.EADDRINUSE)] = error.ADDRINUSE; - errors[@intFromEnum(SystemErrno.EADDRNOTAVAIL)] = error.ADDRNOTAVAIL; - errors[@intFromEnum(SystemErrno.ENETDOWN)] = error.NETDOWN; - errors[@intFromEnum(SystemErrno.ENETUNREACH)] = error.NETUNREACH; - errors[@intFromEnum(SystemErrno.ENETRESET)] = error.NETRESET; - errors[@intFromEnum(SystemErrno.ECONNABORTED)] = error.CONNABORTED; - errors[@intFromEnum(SystemErrno.ECONNRESET)] = error.CONNRESET; - errors[@intFromEnum(SystemErrno.ENOBUFS)] = error.NOBUFS; - errors[@intFromEnum(SystemErrno.EISCONN)] = error.ISCONN; - errors[@intFromEnum(SystemErrno.ENOTCONN)] = error.NOTCONN; - errors[@intFromEnum(SystemErrno.ESHUTDOWN)] = error.SHUTDOWN; - errors[@intFromEnum(SystemErrno.ETOOMANYREFS)] = error.TOOMANYREFS; - errors[@intFromEnum(SystemErrno.ETIMEDOUT)] = error.TIMEDOUT; - errors[@intFromEnum(SystemErrno.ECONNREFUSED)] = error.CONNREFUSED; - errors[@intFromEnum(SystemErrno.EHOSTDOWN)] = error.HOSTDOWN; - errors[@intFromEnum(SystemErrno.EHOSTUNREACH)] = error.HOSTUNREACH; - errors[@intFromEnum(SystemErrno.EALREADY)] = error.ALREADY; - errors[@intFromEnum(SystemErrno.EINPROGRESS)] = error.INPROGRESS; - errors[@intFromEnum(SystemErrno.ESTALE)] = error.STALE; - errors[@intFromEnum(SystemErrno.EUCLEAN)] = error.UCLEAN; - errors[@intFromEnum(SystemErrno.ENOTNAM)] = error.NOTNAM; - errors[@intFromEnum(SystemErrno.ENAVAIL)] = error.NAVAIL; - errors[@intFromEnum(SystemErrno.EISNAM)] = error.ISNAM; - errors[@intFromEnum(SystemErrno.EREMOTEIO)] = error.REMOTEIO; - errors[@intFromEnum(SystemErrno.EDQUOT)] = error.DQUOT; - errors[@intFromEnum(SystemErrno.ENOMEDIUM)] = error.NOMEDIUM; - errors[@intFromEnum(SystemErrno.EMEDIUMTYPE)] = error.MEDIUMTYPE; - errors[@intFromEnum(SystemErrno.ECANCELED)] = error.CANCELED; - errors[@intFromEnum(SystemErrno.ENOKEY)] = error.NOKEY; - errors[@intFromEnum(SystemErrno.EKEYEXPIRED)] = error.KEYEXPIRED; - errors[@intFromEnum(SystemErrno.EKEYREVOKED)] = error.KEYREVOKED; - errors[@intFromEnum(SystemErrno.EKEYREJECTED)] = error.KEYREJECTED; - errors[@intFromEnum(SystemErrno.EOWNERDEAD)] = error.OWNERDEAD; - errors[@intFromEnum(SystemErrno.ENOTRECOVERABLE)] = error.NOTRECOVERABLE; - errors[@intFromEnum(SystemErrno.ERFKILL)] = error.RFKILL; - errors[@intFromEnum(SystemErrno.EHWPOISON)] = error.HWPOISON; - errors[@intFromEnum(SystemErrno.EUNKNOWN)] = error.UNKNOWN; - errors[@intFromEnum(SystemErrno.ECHARSET)] = error.CHARSET; - errors[@intFromEnum(SystemErrno.EOF)] = error.OF; + errors[@intFromEnum(SystemErrno.EPERM)] = error.EPERM; + errors[@intFromEnum(SystemErrno.ENOENT)] = error.ENOENT; + errors[@intFromEnum(SystemErrno.ESRCH)] = error.ESRCH; + errors[@intFromEnum(SystemErrno.EINTR)] = error.EINTR; + errors[@intFromEnum(SystemErrno.EIO)] = error.EIO; + errors[@intFromEnum(SystemErrno.ENXIO)] = error.ENXIO; + errors[@intFromEnum(SystemErrno.E2BIG)] = error.E2BIG; + errors[@intFromEnum(SystemErrno.ENOEXEC)] = error.ENOEXEC; + errors[@intFromEnum(SystemErrno.EBADF)] = error.EBADF; + errors[@intFromEnum(SystemErrno.ECHILD)] = error.ECHILD; + errors[@intFromEnum(SystemErrno.EAGAIN)] = error.EAGAIN; + errors[@intFromEnum(SystemErrno.ENOMEM)] = error.ENOMEM; + errors[@intFromEnum(SystemErrno.EACCES)] = error.EACCES; + errors[@intFromEnum(SystemErrno.EFAULT)] = error.EFAULT; + errors[@intFromEnum(SystemErrno.ENOTBLK)] = error.ENOTBLK; + errors[@intFromEnum(SystemErrno.EBUSY)] = error.EBUSY; + errors[@intFromEnum(SystemErrno.EEXIST)] = error.EEXIST; + errors[@intFromEnum(SystemErrno.EXDEV)] = error.EXDEV; + errors[@intFromEnum(SystemErrno.ENODEV)] = error.ENODEV; + errors[@intFromEnum(SystemErrno.ENOTDIR)] = error.ENOTDIR; + errors[@intFromEnum(SystemErrno.EISDIR)] = error.EISDIR; + errors[@intFromEnum(SystemErrno.EINVAL)] = error.EINVAL; + errors[@intFromEnum(SystemErrno.ENFILE)] = error.ENFILE; + errors[@intFromEnum(SystemErrno.EMFILE)] = error.EMFILE; + errors[@intFromEnum(SystemErrno.ENOTTY)] = error.ENOTTY; + errors[@intFromEnum(SystemErrno.ETXTBSY)] = error.ETXTBSY; + errors[@intFromEnum(SystemErrno.EFBIG)] = error.EFBIG; + errors[@intFromEnum(SystemErrno.ENOSPC)] = error.ENOSPC; + errors[@intFromEnum(SystemErrno.ESPIPE)] = error.ESPIPE; + errors[@intFromEnum(SystemErrno.EROFS)] = error.EROFS; + errors[@intFromEnum(SystemErrno.EMLINK)] = error.EMLINK; + errors[@intFromEnum(SystemErrno.EPIPE)] = error.EPIPE; + errors[@intFromEnum(SystemErrno.EDOM)] = error.EDOM; + errors[@intFromEnum(SystemErrno.ERANGE)] = error.ERANGE; + errors[@intFromEnum(SystemErrno.EDEADLK)] = error.EDEADLK; + errors[@intFromEnum(SystemErrno.ENAMETOOLONG)] = error.ENAMETOOLONG; + errors[@intFromEnum(SystemErrno.ENOLCK)] = error.ENOLCK; + errors[@intFromEnum(SystemErrno.ENOSYS)] = error.ENOSYS; + errors[@intFromEnum(SystemErrno.ENOTEMPTY)] = error.ENOTEMPTY; + errors[@intFromEnum(SystemErrno.ELOOP)] = error.ELOOP; + errors[@intFromEnum(SystemErrno.EWOULDBLOCK)] = error.EWOULDBLOCK; + errors[@intFromEnum(SystemErrno.ENOMSG)] = error.ENOMSG; + errors[@intFromEnum(SystemErrno.EIDRM)] = error.EIDRM; + errors[@intFromEnum(SystemErrno.ECHRNG)] = error.ECHRNG; + errors[@intFromEnum(SystemErrno.EL2NSYNC)] = error.EL2NSYNC; + errors[@intFromEnum(SystemErrno.EL3HLT)] = error.EL3HLT; + errors[@intFromEnum(SystemErrno.EL3RST)] = error.EL3RST; + errors[@intFromEnum(SystemErrno.ELNRNG)] = error.ELNRNG; + errors[@intFromEnum(SystemErrno.EUNATCH)] = error.EUNATCH; + errors[@intFromEnum(SystemErrno.ENOCSI)] = error.ENOCSI; + errors[@intFromEnum(SystemErrno.EL2HLT)] = error.EL2HLT; + errors[@intFromEnum(SystemErrno.EBADE)] = error.EBADE; + errors[@intFromEnum(SystemErrno.EBADR)] = error.EBADR; + errors[@intFromEnum(SystemErrno.EXFULL)] = error.EXFULL; + errors[@intFromEnum(SystemErrno.ENOANO)] = error.ENOANO; + errors[@intFromEnum(SystemErrno.EBADRQC)] = error.EBADRQC; + errors[@intFromEnum(SystemErrno.EBADSLT)] = error.EBADSLT; + errors[@intFromEnum(SystemErrno.EDEADLOCK)] = error.EDEADLOCK; + errors[@intFromEnum(SystemErrno.EBFONT)] = error.EBFONT; + errors[@intFromEnum(SystemErrno.ENOSTR)] = error.ENOSTR; + errors[@intFromEnum(SystemErrno.ENODATA)] = error.ENODATA; + errors[@intFromEnum(SystemErrno.ETIME)] = error.ETIME; + errors[@intFromEnum(SystemErrno.ENOSR)] = error.ENOSR; + errors[@intFromEnum(SystemErrno.ENONET)] = error.ENONET; + errors[@intFromEnum(SystemErrno.ENOPKG)] = error.ENOPKG; + errors[@intFromEnum(SystemErrno.EREMOTE)] = error.EREMOTE; + errors[@intFromEnum(SystemErrno.ENOLINK)] = error.ENOLINK; + errors[@intFromEnum(SystemErrno.EADV)] = error.EADV; + errors[@intFromEnum(SystemErrno.ESRMNT)] = error.ESRMNT; + errors[@intFromEnum(SystemErrno.ECOMM)] = error.ECOMM; + errors[@intFromEnum(SystemErrno.EPROTO)] = error.EPROTO; + errors[@intFromEnum(SystemErrno.EMULTIHOP)] = error.EMULTIHOP; + errors[@intFromEnum(SystemErrno.EDOTDOT)] = error.EDOTDOT; + errors[@intFromEnum(SystemErrno.EBADMSG)] = error.EBADMSG; + errors[@intFromEnum(SystemErrno.EOVERFLOW)] = error.EOVERFLOW; + errors[@intFromEnum(SystemErrno.ENOTUNIQ)] = error.ENOTUNIQ; + errors[@intFromEnum(SystemErrno.EBADFD)] = error.EBADFD; + errors[@intFromEnum(SystemErrno.EREMCHG)] = error.EREMCHG; + errors[@intFromEnum(SystemErrno.ELIBACC)] = error.ELIBACC; + errors[@intFromEnum(SystemErrno.ELIBBAD)] = error.ELIBBAD; + errors[@intFromEnum(SystemErrno.ELIBSCN)] = error.ELIBSCN; + errors[@intFromEnum(SystemErrno.ELIBMAX)] = error.ELIBMAX; + errors[@intFromEnum(SystemErrno.ELIBEXEC)] = error.ELIBEXEC; + errors[@intFromEnum(SystemErrno.EILSEQ)] = error.EILSEQ; + errors[@intFromEnum(SystemErrno.ERESTART)] = error.ERESTART; + errors[@intFromEnum(SystemErrno.ESTRPIPE)] = error.ESTRPIPE; + errors[@intFromEnum(SystemErrno.EUSERS)] = error.EUSERS; + errors[@intFromEnum(SystemErrno.ENOTSOCK)] = error.ENOTSOCK; + errors[@intFromEnum(SystemErrno.EDESTADDRREQ)] = error.EDESTADDRREQ; + errors[@intFromEnum(SystemErrno.EMSGSIZE)] = error.EMSGSIZE; + errors[@intFromEnum(SystemErrno.EPROTOTYPE)] = error.EPROTOTYPE; + errors[@intFromEnum(SystemErrno.ENOPROTOOPT)] = error.ENOPROTOOPT; + errors[@intFromEnum(SystemErrno.EPROTONOSUPPORT)] = error.EPROTONOSUPPORT; + errors[@intFromEnum(SystemErrno.ESOCKTNOSUPPORT)] = error.ESOCKTNOSUPPORT; + errors[@intFromEnum(SystemErrno.ENOTSUP)] = error.ENOTSUP; + errors[@intFromEnum(SystemErrno.EPFNOSUPPORT)] = error.EPFNOSUPPORT; + errors[@intFromEnum(SystemErrno.EAFNOSUPPORT)] = error.EAFNOSUPPORT; + errors[@intFromEnum(SystemErrno.EADDRINUSE)] = error.EADDRINUSE; + errors[@intFromEnum(SystemErrno.EADDRNOTAVAIL)] = error.EADDRNOTAVAIL; + errors[@intFromEnum(SystemErrno.ENETDOWN)] = error.ENETDOWN; + errors[@intFromEnum(SystemErrno.ENETUNREACH)] = error.ENETUNREACH; + errors[@intFromEnum(SystemErrno.ENETRESET)] = error.ENETRESET; + errors[@intFromEnum(SystemErrno.ECONNABORTED)] = error.ECONNABORTED; + errors[@intFromEnum(SystemErrno.ECONNRESET)] = error.ECONNRESET; + errors[@intFromEnum(SystemErrno.ENOBUFS)] = error.ENOBUFS; + errors[@intFromEnum(SystemErrno.EISCONN)] = error.EISCONN; + errors[@intFromEnum(SystemErrno.ENOTCONN)] = error.ENOTCONN; + errors[@intFromEnum(SystemErrno.ESHUTDOWN)] = error.ESHUTDOWN; + errors[@intFromEnum(SystemErrno.ETOOMANYREFS)] = error.ETOOMANYREFS; + errors[@intFromEnum(SystemErrno.ETIMEDOUT)] = error.ETIMEDOUT; + errors[@intFromEnum(SystemErrno.ECONNREFUSED)] = error.ECONNREFUSED; + errors[@intFromEnum(SystemErrno.EHOSTDOWN)] = error.EHOSTDOWN; + errors[@intFromEnum(SystemErrno.EHOSTUNREACH)] = error.EHOSTUNREACH; + errors[@intFromEnum(SystemErrno.EALREADY)] = error.EALREADY; + errors[@intFromEnum(SystemErrno.EINPROGRESS)] = error.EINPROGRESS; + errors[@intFromEnum(SystemErrno.ESTALE)] = error.ESTALE; + errors[@intFromEnum(SystemErrno.EUCLEAN)] = error.EUCLEAN; + errors[@intFromEnum(SystemErrno.ENOTNAM)] = error.ENOTNAM; + errors[@intFromEnum(SystemErrno.ENAVAIL)] = error.ENAVAIL; + errors[@intFromEnum(SystemErrno.EISNAM)] = error.EISNAM; + errors[@intFromEnum(SystemErrno.EREMOTEIO)] = error.EREMOTEIO; + errors[@intFromEnum(SystemErrno.EDQUOT)] = error.EDQUOT; + errors[@intFromEnum(SystemErrno.ENOMEDIUM)] = error.ENOMEDIUM; + errors[@intFromEnum(SystemErrno.EMEDIUMTYPE)] = error.EMEDIUMTYPE; + errors[@intFromEnum(SystemErrno.ECANCELED)] = error.ECANCELED; + errors[@intFromEnum(SystemErrno.ENOKEY)] = error.ENOKEY; + errors[@intFromEnum(SystemErrno.EKEYEXPIRED)] = error.EKEYEXPIRED; + errors[@intFromEnum(SystemErrno.EKEYREVOKED)] = error.EKEYREVOKED; + errors[@intFromEnum(SystemErrno.EKEYREJECTED)] = error.EKEYREJECTED; + errors[@intFromEnum(SystemErrno.EOWNERDEAD)] = error.EOWNERDEAD; + errors[@intFromEnum(SystemErrno.ENOTRECOVERABLE)] = error.ENOTRECOVERABLE; + errors[@intFromEnum(SystemErrno.ERFKILL)] = error.ERFKILL; + errors[@intFromEnum(SystemErrno.EHWPOISON)] = error.EHWPOISON; + errors[@intFromEnum(SystemErrno.EUNKNOWN)] = error.EUNKNOWN; + errors[@intFromEnum(SystemErrno.ECHARSET)] = error.ECHARSET; + errors[@intFromEnum(SystemErrno.EOF)] = error.EOF; break :brk errors; }; pub fn fromError(err: anyerror) ?SystemErrno { return switch (err) { - error.PERM => SystemErrno.EPERM, - error.NOENT => SystemErrno.ENOENT, - error.SRCH => SystemErrno.ESRCH, - error.INTR => SystemErrno.EINTR, - error.IO => SystemErrno.EIO, - error.NXIO => SystemErrno.ENXIO, - error.@"2BIG" => SystemErrno.E2BIG, - error.NOEXEC => SystemErrno.ENOEXEC, - error.BADF => SystemErrno.EBADF, - error.CHILD => SystemErrno.ECHILD, - error.AGAIN => SystemErrno.EAGAIN, - error.NOMEM => SystemErrno.ENOMEM, - error.ACCES => SystemErrno.EACCES, - error.FAULT => SystemErrno.EFAULT, - error.NOTBLK => SystemErrno.ENOTBLK, - error.BUSY => SystemErrno.EBUSY, - error.EXIST => SystemErrno.EEXIST, - error.XDEV => SystemErrno.EXDEV, - error.NODEV => SystemErrno.ENODEV, - error.NOTDIR => SystemErrno.ENOTDIR, - error.ISDIR => SystemErrno.EISDIR, - error.INVAL => SystemErrno.EINVAL, - error.NFILE => SystemErrno.ENFILE, - error.MFILE => SystemErrno.EMFILE, - error.NOTTY => SystemErrno.ENOTTY, - error.TXTBSY => SystemErrno.ETXTBSY, - error.FBIG => SystemErrno.EFBIG, - error.NOSPC => SystemErrno.ENOSPC, - error.SPIPE => SystemErrno.ESPIPE, - error.ROFS => SystemErrno.EROFS, - error.MLINK => SystemErrno.EMLINK, - error.PIPE => SystemErrno.EPIPE, - error.DOM => SystemErrno.EDOM, - error.RANGE => SystemErrno.ERANGE, - error.DEADLK => SystemErrno.EDEADLK, - error.NAMETOOLONG => SystemErrno.ENAMETOOLONG, - error.NOLCK => SystemErrno.ENOLCK, - error.NOSYS => SystemErrno.ENOSYS, - error.NOTEMPTY => SystemErrno.ENOTEMPTY, - error.LOOP => SystemErrno.ELOOP, - error.WOULDBLOCK => SystemErrno.EWOULDBLOCK, - error.NOMSG => SystemErrno.ENOMSG, - error.IDRM => SystemErrno.EIDRM, - error.CHRNG => SystemErrno.ECHRNG, - error.L2NSYNC => SystemErrno.EL2NSYNC, - error.L3HLT => SystemErrno.EL3HLT, - error.L3RST => SystemErrno.EL3RST, - error.LNRNG => SystemErrno.ELNRNG, - error.UNATCH => SystemErrno.EUNATCH, - error.NOCSI => SystemErrno.ENOCSI, - error.L2HLT => SystemErrno.EL2HLT, - error.BADE => SystemErrno.EBADE, - error.BADR => SystemErrno.EBADR, - error.XFULL => SystemErrno.EXFULL, - error.NOANO => SystemErrno.ENOANO, - error.BADRQC => SystemErrno.EBADRQC, - error.BADSLT => SystemErrno.EBADSLT, - error.DEADLOCK => SystemErrno.EDEADLOCK, - error.BFONT => SystemErrno.EBFONT, - error.NOSTR => SystemErrno.ENOSTR, - error.NODATA => SystemErrno.ENODATA, - error.TIME => SystemErrno.ETIME, - error.NOSR => SystemErrno.ENOSR, - error.NONET => SystemErrno.ENONET, - error.NOPKG => SystemErrno.ENOPKG, - error.REMOTE => SystemErrno.EREMOTE, - error.NOLINK => SystemErrno.ENOLINK, - error.ADV => SystemErrno.EADV, - error.SRMNT => SystemErrno.ESRMNT, - error.COMM => SystemErrno.ECOMM, - error.PROTO => SystemErrno.EPROTO, - error.MULTIHOP => SystemErrno.EMULTIHOP, - error.DOTDOT => SystemErrno.EDOTDOT, - error.BADMSG => SystemErrno.EBADMSG, - error.OVERFLOW => SystemErrno.EOVERFLOW, - error.NOTUNIQ => SystemErrno.ENOTUNIQ, - error.BADFD => SystemErrno.EBADFD, - error.REMCHG => SystemErrno.EREMCHG, - error.LIBACC => SystemErrno.ELIBACC, - error.LIBBAD => SystemErrno.ELIBBAD, - error.LIBSCN => SystemErrno.ELIBSCN, - error.LIBMAX => SystemErrno.ELIBMAX, - error.LIBEXEC => SystemErrno.ELIBEXEC, - error.ILSEQ => SystemErrno.EILSEQ, - error.RESTART => SystemErrno.ERESTART, - error.STRPIPE => SystemErrno.ESTRPIPE, - error.USERS => SystemErrno.EUSERS, - error.NOTSOCK => SystemErrno.ENOTSOCK, - error.DESTADDRREQ => SystemErrno.EDESTADDRREQ, - error.MSGSIZE => SystemErrno.EMSGSIZE, - error.PROTOTYPE => SystemErrno.EPROTOTYPE, - error.NOPROTOOPT => SystemErrno.ENOPROTOOPT, - error.PROTONOSUPPORT => SystemErrno.EPROTONOSUPPORT, - error.SOCKTNOSUPPORT => SystemErrno.ESOCKTNOSUPPORT, - error.NOTSUP => SystemErrno.ENOTSUP, - error.PFNOSUPPORT => SystemErrno.EPFNOSUPPORT, - error.AFNOSUPPORT => SystemErrno.EAFNOSUPPORT, - error.ADDRINUSE => SystemErrno.EADDRINUSE, - error.ADDRNOTAVAIL => SystemErrno.EADDRNOTAVAIL, - error.NETDOWN => SystemErrno.ENETDOWN, - error.NETUNREACH => SystemErrno.ENETUNREACH, - error.NETRESET => SystemErrno.ENETRESET, - error.CONNABORTED => SystemErrno.ECONNABORTED, - error.CONNRESET => SystemErrno.ECONNRESET, - error.NOBUFS => SystemErrno.ENOBUFS, - error.ISCONN => SystemErrno.EISCONN, - error.NOTCONN => SystemErrno.ENOTCONN, - error.SHUTDOWN => SystemErrno.ESHUTDOWN, - error.TOOMANYREFS => SystemErrno.ETOOMANYREFS, - error.TIMEDOUT => SystemErrno.ETIMEDOUT, - error.CONNREFUSED => SystemErrno.ECONNREFUSED, - error.HOSTDOWN => SystemErrno.EHOSTDOWN, - error.HOSTUNREACH => SystemErrno.EHOSTUNREACH, - error.ALREADY => SystemErrno.EALREADY, - error.INPROGRESS => SystemErrno.EINPROGRESS, - error.STALE => SystemErrno.ESTALE, - error.UCLEAN => SystemErrno.EUCLEAN, - error.NOTNAM => SystemErrno.ENOTNAM, - error.NAVAIL => SystemErrno.ENAVAIL, - error.ISNAM => SystemErrno.EISNAM, - error.REMOTEIO => SystemErrno.EREMOTEIO, - error.DQUOT => SystemErrno.EDQUOT, - error.NOMEDIUM => SystemErrno.ENOMEDIUM, - error.MEDIUMTYPE => SystemErrno.EMEDIUMTYPE, - error.CANCELED => SystemErrno.ECANCELED, - error.NOKEY => SystemErrno.ENOKEY, - error.KEYEXPIRED => SystemErrno.EKEYEXPIRED, - error.KEYREVOKED => SystemErrno.EKEYREVOKED, - error.KEYREJECTED => SystemErrno.EKEYREJECTED, - error.OWNERDEAD => SystemErrno.EOWNERDEAD, - error.NOTRECOVERABLE => SystemErrno.ENOTRECOVERABLE, - error.RFKILL => SystemErrno.ERFKILL, - error.HWPOISON => SystemErrno.EHWPOISON, - error.UNKNOWN => SystemErrno.EUNKNOWN, - error.CHARSET => SystemErrno.ECHARSET, - error.OF => SystemErrno.EOF, + error.EPERM => SystemErrno.EPERM, + error.ENOENT => SystemErrno.ENOENT, + error.ESRCH => SystemErrno.ESRCH, + error.EINTR => SystemErrno.EINTR, + error.EIO => SystemErrno.EIO, + error.ENXIO => SystemErrno.ENXIO, + error.E2BIG => SystemErrno.E2BIG, + error.ENOEXEC => SystemErrno.ENOEXEC, + error.EBADF => SystemErrno.EBADF, + error.ECHILD => SystemErrno.ECHILD, + error.EAGAIN => SystemErrno.EAGAIN, + error.ENOMEM => SystemErrno.ENOMEM, + error.EACCES => SystemErrno.EACCES, + error.EFAULT => SystemErrno.EFAULT, + error.ENOTBLK => SystemErrno.ENOTBLK, + error.EBUSY => SystemErrno.EBUSY, + error.EEXIST => SystemErrno.EEXIST, + error.EXDEV => SystemErrno.EXDEV, + error.ENODEV => SystemErrno.ENODEV, + error.ENOTDIR => SystemErrno.ENOTDIR, + error.EISDIR => SystemErrno.EISDIR, + error.EINVAL => SystemErrno.EINVAL, + error.ENFILE => SystemErrno.ENFILE, + error.EMFILE => SystemErrno.EMFILE, + error.ENOTTY => SystemErrno.ENOTTY, + error.ETXTBSY => SystemErrno.ETXTBSY, + error.EFBIG => SystemErrno.EFBIG, + error.ENOSPC => SystemErrno.ENOSPC, + error.ESPIPE => SystemErrno.ESPIPE, + error.EROFS => SystemErrno.EROFS, + error.EMLINK => SystemErrno.EMLINK, + error.EPIPE => SystemErrno.EPIPE, + error.EDOM => SystemErrno.EDOM, + error.ERANGE => SystemErrno.ERANGE, + error.EDEADLK => SystemErrno.EDEADLK, + error.ENAMETOOLONG => SystemErrno.ENAMETOOLONG, + error.ENOLCK => SystemErrno.ENOLCK, + error.ENOSYS => SystemErrno.ENOSYS, + error.ENOTEMPTY => SystemErrno.ENOTEMPTY, + error.ELOOP => SystemErrno.ELOOP, + error.EWOULDBLOCK => SystemErrno.EWOULDBLOCK, + error.ENOMSG => SystemErrno.ENOMSG, + error.EIDRM => SystemErrno.EIDRM, + error.ECHRNG => SystemErrno.ECHRNG, + error.EL2NSYNC => SystemErrno.EL2NSYNC, + error.EL3HLT => SystemErrno.EL3HLT, + error.EL3RST => SystemErrno.EL3RST, + error.ELNRNG => SystemErrno.ELNRNG, + error.EUNATCH => SystemErrno.EUNATCH, + error.ENOCSI => SystemErrno.ENOCSI, + error.EL2HLT => SystemErrno.EL2HLT, + error.EBADE => SystemErrno.EBADE, + error.EBADR => SystemErrno.EBADR, + error.EXFULL => SystemErrno.EXFULL, + error.ENOANO => SystemErrno.ENOANO, + error.EBADRQC => SystemErrno.EBADRQC, + error.EBADSLT => SystemErrno.EBADSLT, + error.EDEADLOCK => SystemErrno.EDEADLOCK, + error.EBFONT => SystemErrno.EBFONT, + error.ENOSTR => SystemErrno.ENOSTR, + error.ENODATA => SystemErrno.ENODATA, + error.ETIME => SystemErrno.ETIME, + error.ENOSR => SystemErrno.ENOSR, + error.ENONET => SystemErrno.ENONET, + error.ENOPKG => SystemErrno.ENOPKG, + error.EREMOTE => SystemErrno.EREMOTE, + error.ENOLINK => SystemErrno.ENOLINK, + error.EADV => SystemErrno.EADV, + error.ESRMNT => SystemErrno.ESRMNT, + error.ECOMM => SystemErrno.ECOMM, + error.EPROTO => SystemErrno.EPROTO, + error.EMULTIHOP => SystemErrno.EMULTIHOP, + error.EDOTDOT => SystemErrno.EDOTDOT, + error.EBADMSG => SystemErrno.EBADMSG, + error.EOVERFLOW => SystemErrno.EOVERFLOW, + error.ENOTUNIQ => SystemErrno.ENOTUNIQ, + error.EBADFD => SystemErrno.EBADFD, + error.EREMCHG => SystemErrno.EREMCHG, + error.ELIBACC => SystemErrno.ELIBACC, + error.ELIBBAD => SystemErrno.ELIBBAD, + error.ELIBSCN => SystemErrno.ELIBSCN, + error.ELIBMAX => SystemErrno.ELIBMAX, + error.ELIBEXEC => SystemErrno.ELIBEXEC, + error.EILSEQ => SystemErrno.EILSEQ, + error.ERESTART => SystemErrno.ERESTART, + error.ESTRPIPE => SystemErrno.ESTRPIPE, + error.EUSERS => SystemErrno.EUSERS, + error.ENOTSOCK => SystemErrno.ENOTSOCK, + error.EDESTADDRREQ => SystemErrno.EDESTADDRREQ, + error.EMSGSIZE => SystemErrno.EMSGSIZE, + error.EPROTOTYPE => SystemErrno.EPROTOTYPE, + error.ENOPROTOOPT => SystemErrno.ENOPROTOOPT, + error.EPROTONOSUPPORT => SystemErrno.EPROTONOSUPPORT, + error.ESOCKTNOSUPPORT => SystemErrno.ESOCKTNOSUPPORT, + error.ENOTSUP => SystemErrno.ENOTSUP, + error.EPFNOSUPPORT => SystemErrno.EPFNOSUPPORT, + error.EAFNOSUPPORT => SystemErrno.EAFNOSUPPORT, + error.EADDRINUSE => SystemErrno.EADDRINUSE, + error.EADDRNOTAVAIL => SystemErrno.EADDRNOTAVAIL, + error.ENETDOWN => SystemErrno.ENETDOWN, + error.ENETUNREACH => SystemErrno.ENETUNREACH, + error.ENETRESET => SystemErrno.ENETRESET, + error.ECONNABORTED => SystemErrno.ECONNABORTED, + error.ECONNRESET => SystemErrno.ECONNRESET, + error.ENOBUFS => SystemErrno.ENOBUFS, + error.EISCONN => SystemErrno.EISCONN, + error.ENOTCONN => SystemErrno.ENOTCONN, + error.ESHUTDOWN => SystemErrno.ESHUTDOWN, + error.ETOOMANYREFS => SystemErrno.ETOOMANYREFS, + error.ETIMEDOUT => SystemErrno.ETIMEDOUT, + error.ECONNREFUSED => SystemErrno.ECONNREFUSED, + error.EHOSTDOWN => SystemErrno.EHOSTDOWN, + error.EHOSTUNREACH => SystemErrno.EHOSTUNREACH, + error.EALREADY => SystemErrno.EALREADY, + error.EINPROGRESS => SystemErrno.EINPROGRESS, + error.ESTALE => SystemErrno.ESTALE, + error.EUCLEAN => SystemErrno.EUCLEAN, + error.ENOTNAM => SystemErrno.ENOTNAM, + error.ENAVAIL => SystemErrno.ENAVAIL, + error.EISNAM => SystemErrno.EISNAM, + error.EREMOTEIO => SystemErrno.EREMOTEIO, + error.EDQUOT => SystemErrno.EDQUOT, + error.ENOMEDIUM => SystemErrno.ENOMEDIUM, + error.EMEDIUMTYPE => SystemErrno.EMEDIUMTYPE, + error.ECANCELED => SystemErrno.ECANCELED, + error.ENOKEY => SystemErrno.ENOKEY, + error.EKEYEXPIRED => SystemErrno.EKEYEXPIRED, + error.EKEYREVOKED => SystemErrno.EKEYREVOKED, + error.EKEYREJECTED => SystemErrno.EKEYREJECTED, + error.EOWNERDEAD => SystemErrno.EOWNERDEAD, + error.ENOTRECOVERABLE => SystemErrno.ENOTRECOVERABLE, + error.ERFKILL => SystemErrno.ERFKILL, + error.EHWPOISON => SystemErrno.EHWPOISON, + error.EUNKNOWN => SystemErrno.EUNKNOWN, + error.ECHARSET => SystemErrno.ECHARSET, + error.EOF => SystemErrno.EOF, else => return null, }; } diff --git a/src/zlib.zig b/src/zlib.zig index 00617cf24acde..4bccb4422baa9 100644 --- a/src/zlib.zig +++ b/src/zlib.zig @@ -65,12 +65,10 @@ const z_crc_t = c_uint; // typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); // typedef void (*free_func) OF((voidpf opaque, voidpf address)); -pub const z_alloc_fn = ?*const fn (*anyopaque, uInt, uInt) callconv(.C) voidpf; -pub const z_free_fn = ?*const fn (*anyopaque, *anyopaque) callconv(.C) void; +const zStream_struct = @import("zlib-internal").zStream_struct; +const z_stream = @import("zlib-internal").z_stream; +const z_streamp = @import("zlib-internal").z_streamp; -pub const struct_internal_state = extern struct { - dummy: c_int, -}; // typedef struct z_stream_s { // z_const Bytef *next_in; /* next input byte */ // uInt avail_in; /* number of bytes available at next_in */ @@ -93,97 +91,9 @@ pub const struct_internal_state = extern struct { // uLong reserved; /* reserved for future use */ // } z_stream; -pub const zStream_struct = extern struct { - /// next input byte - next_in: [*c]const u8, - /// number of bytes available at next_in - avail_in: uInt, - /// total number of input bytes read so far - total_in: uLong, - - /// next output byte will go here - next_out: [*c]u8, - /// remaining free space at next_out - avail_out: uInt, - /// total number of bytes output so far - total_out: uLong, - - /// last error message, NULL if no error - err_msg: [*c]const u8, - /// not visible by applications - internal_state: ?*struct_internal_state, - - /// used to allocate the internal state - alloc_func: z_alloc_fn, - /// used to free the internal state - free_func: z_free_fn, - /// private data object passed to zalloc and zfree - user_data: *anyopaque, - - /// best guess about the data type: binary or text for deflate, or the decoding state for inflate - data_type: DataType, - - ///Adler-32 or CRC-32 value of the uncompressed data - adler: uLong, - /// reserved for future use - reserved: uLong, -}; - -pub const z_stream = zStream_struct; -pub const z_streamp = *z_stream; - -// #define Z_BINARY 0 -// #define Z_TEXT 1 -// #define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ -// #define Z_UNKNOWN 2 -pub const DataType = enum(c_int) { - Binary = 0, - Text = 1, - Unknown = 2, -}; - -// #define Z_OK 0 -// #define Z_STREAM_END 1 -// #define Z_NEED_DICT 2 -// #define Z_ERRNO (-1) -// #define Z_STREAM_ERROR (-2) -// #define Z_DATA_ERROR (-3) -// #define Z_MEM_ERROR (-4) -// #define Z_BUF_ERROR (-5) -// #define Z_VERSION_ERROR (-6) -pub const ReturnCode = enum(c_int) { - Ok = 0, - StreamEnd = 1, - NeedDict = 2, - ErrNo = -1, - StreamError = -2, - DataError = -3, - MemError = -4, - BufError = -5, - VersionError = -6, -}; - -// #define Z_NO_FLUSH 0 -// #define Z_PARTIAL_FLUSH 1 -// #define Z_SYNC_FLUSH 2 -// #define Z_FULL_FLUSH 3 -// #define Z_FINISH 4 -// #define Z_BLOCK 5 -// #define Z_TREES 6 -pub const FlushValue = enum(c_int) { - NoFlush = 0, - PartialFlush = 1, - /// Z_SYNC_FLUSH requests that inflate() flush as much output as possible to the output buffer - SyncFlush = 2, - FullFlush = 3, - Finish = 4, - - /// Z_BLOCK requests that inflate() stop if and when it gets to the next / deflate block boundary When decoding the zlib or gzip format, this will / cause inflate() to return immediately after the header and before the / first block. When doing a raw inflate, inflate() will go ahead and / process the first block, and will return when it gets to the end of that / block, or when it runs out of data. / The Z_BLOCK option assists in appending to or combining deflate streams. / To assist in this, on return inflate() always sets strm->data_type to the / number of unused bits in the last byte taken from strm->next_in, plus 64 / if inflate() is currently decoding the last block in the deflate stream, / plus 128 if inflate() returned immediately after decoding an end-of-block / code or decoding the complete header up to just before the first byte of / the deflate stream. The end-of-block will not be indicated until all of / the uncompressed data from that block has been written to strm->next_out. / The number of unused bits may in general be greater than seven, except / when bit 7 of data_type is set, in which case the number of unused bits / will be less than eight. data_type is set as noted here every time / inflate() returns for all flush options, and so can be used to determine / the amount of currently consumed input in bits. - Block = 5, - - /// The Z_TREES option behaves as Z_BLOCK does, but it also returns when the end of each deflate block header is reached, before any actual data in that block is decoded. This allows the caller to determine the length of the deflate block header for later use in random access within a deflate block. 256 is added to the value of strm->data_type when inflate() returns immediately after reaching the end of the deflate block header. - Trees = 6, -}; +const DataType = @import("zlib-internal").DataType; +const FlushValue = @import("zlib-internal").FlushValue; +const ReturnCode = @import("zlib-internal").ReturnCode; // ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); @@ -475,12 +385,12 @@ pub const ZlibReaderArrayList = struct { zlib_reader.zlib = zStream_struct{ .next_in = input.ptr, - .avail_in = @as(uInt, @intCast(input.len)), - .total_in = @as(uInt, @intCast(input.len)), + .avail_in = @truncate(input.len), + .total_in = @truncate(input.len), .next_out = zlib_reader.list.items.ptr, - .avail_out = @as(u32, @intCast(zlib_reader.list.items.len)), - .total_out = zlib_reader.list.items.len, + .avail_out = @truncate(zlib_reader.list.items.len), + .total_out = @truncate(zlib_reader.list.items.len), .err_msg = null, .alloc_func = ZlibReader.alloc, @@ -562,8 +472,8 @@ pub const ZlibReaderArrayList = struct { const initial = this.list.items.len; try this.list.ensureUnusedCapacity(this.list_allocator, 4096); this.list.expandToCapacity(); - this.zlib.next_out = &this.list.items[initial]; - this.zlib.avail_out = @as(u32, @intCast(this.list.items.len - initial)); + this.zlib.next_out = @ptrCast(&this.list.items[initial]); + this.zlib.avail_out = @truncate(this.list.items.len -| initial); } if (this.zlib.avail_in == 0) { @@ -868,12 +778,12 @@ pub const ZlibCompressorArrayList = struct { zlib_reader.zlib = zStream_struct{ .next_in = input.ptr, - .avail_in = @as(uInt, @intCast(input.len)), - .total_in = @as(uInt, @intCast(input.len)), + .avail_in = @truncate(input.len), + .total_in = @truncate(input.len), .next_out = zlib_reader.list.items.ptr, - .avail_out = @as(u32, @intCast(zlib_reader.list.items.len)), - .total_out = zlib_reader.list.items.len, + .avail_out = @truncate(zlib_reader.list.items.len), + .total_out = @truncate(zlib_reader.list.items.len), .err_msg = null, .alloc_func = ZlibCompressor.alloc, @@ -900,7 +810,7 @@ pub const ZlibCompressorArrayList = struct { ReturnCode.Ok => { try zlib_reader.list.ensureTotalCapacityPrecise(list_allocator, deflateBound(&zlib_reader.zlib, input.len)); zlib_reader.list_ptr.* = zlib_reader.list; - zlib_reader.zlib.avail_out = @as(uInt, @truncate(zlib_reader.list.capacity)); + zlib_reader.zlib.avail_out = @truncate(zlib_reader.list.capacity); zlib_reader.zlib.next_out = zlib_reader.list.items.ptr; return zlib_reader; @@ -967,8 +877,8 @@ pub const ZlibCompressorArrayList = struct { const initial = this.list.items.len; try this.list.ensureUnusedCapacity(this.list_allocator, 4096); this.list.expandToCapacity(); - this.zlib.next_out = &this.list.items[initial]; - this.zlib.avail_out = @as(u32, @intCast(this.list.items.len - initial)); + this.zlib.next_out = @ptrCast(&this.list.items[initial]); + this.zlib.avail_out = @truncate(this.list.items.len -| initial); } if (this.zlib.avail_out == 0) { diff --git a/test/cli/install/bun-run.test.ts b/test/cli/install/bun-run.test.ts index 3c12086b10bd5..15afb2dbdf24f 100644 --- a/test/cli/install/bun-run.test.ts +++ b/test/cli/install/bun-run.test.ts @@ -14,7 +14,7 @@ beforeEach(async () => { ); }); afterEach(async () => { - await rm(run_dir, { force: true, recursive: true }); + // await rm(run_dir, { force: true, recursive: true }); }); for (let withRun of [false, true]) { @@ -149,6 +149,7 @@ logLevel = "debug" cwd: run_dir, env: bunEnv, }); + console.log(run_dir); if (withLogLevel) { expect(stderr.toString().trim()).toContain("FileNotFound loading tsconfig.json extends"); } else { @@ -311,7 +312,7 @@ for (const entry of await decompress(Buffer.from(buffer))) { }); expect(stderr2).toBeDefined(); const err2 = await new Response(stderr2).text(); - expect(err2).toBe(""); + if (err2) throw new Error(err2); expect(await readdirSorted(run_dir)).toEqual([".cache", "test.js"]); expect(await readdirSorted(join(run_dir, ".cache"))).toContain("decompress"); expect(await readdirSorted(join(run_dir, ".cache", "decompress"))).toEqual(["4.2.1"]); diff --git a/test/cli/test/bun-test.test.ts b/test/cli/test/bun-test.test.ts index 0896cae1a6b8a..7c649120eb4c5 100644 --- a/test/cli/test/bun-test.test.ts +++ b/test/cli/test/bun-test.test.ts @@ -321,7 +321,7 @@ describe("bun test", () => { `, }); expect(stderr).toContain("timed out after 5000ms"); - }); + }, 10000); }); describe("support for Github Actions", () => { test("should not group logs by default", () => { diff --git a/test/http-test-server.ts b/test/http-test-server.ts index ab85a5ec80b40..4b94371f8fcf5 100644 --- a/test/http-test-server.ts +++ b/test/http-test-server.ts @@ -163,6 +163,5 @@ export function createServer() { return response; }, }); - const { port, stop } = server; - return { server, port, stop }; + return server; } diff --git a/test/js/first_party/undici/undici.test.ts b/test/js/first_party/undici/undici.test.ts index ab8430ee9f66a..f7199e9f54437 100644 --- a/test/js/first_party/undici/undici.test.ts +++ b/test/js/first_party/undici/undici.test.ts @@ -6,14 +6,13 @@ import { createServer } from "../../../http-test-server"; describe("undici", () => { let serverCtl: ReturnType; let hostUrl: string; - let hostname = "localhost"; let port: number; let host: string; beforeAll(() => { serverCtl = createServer(); port = serverCtl.port; - host = `${hostname}:${port}`; + host = `${serverCtl.hostname}:${port}`; hostUrl = `http://${host}`; }); diff --git a/test/js/web/worker-fixture-many-messages.js b/test/js/web/worker-fixture-many-messages.js index 5bc4442a9e282..de606fb70cc9d 100644 --- a/test/js/web/worker-fixture-many-messages.js +++ b/test/js/web/worker-fixture-many-messages.js @@ -1,6 +1,4 @@ addEventListener("message", function fn({ data }) { - // console.log("worker", data); - if (data === "initial message") { postMessage({ i: 0 }); } else if (data.i > 50) {